├── JS_USER_AGENTS.js ├── LICENSE ├── README.md ├── USER_AGENTS.js ├── jdCookie.js ├── jdEnv.py ├── jd_CheckCK.js ├── jd_bean_change.js ├── jd_fruit_help.js ├── jd_fruit_task.js ├── jd_notify.js ├── jd_tiger_calls.py ├── jd_tiger_mt.js ├── jd_tiger_sgin.js ├── jd_wskey.py ├── node_modules ├── .package-lock.json ├── @sindresorhus │ └── is │ │ ├── dist │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── types.d.ts │ │ └── types.js │ │ ├── license │ │ ├── package.json │ │ └── readme.md ├── @szmarczak │ └── http-timer │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ └── source │ │ │ ├── index.d.ts │ │ │ └── index.js │ │ └── package.json ├── @types │ └── http-cache-semantics │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.d.ts │ │ └── package.json ├── cacheable-lookup │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── package.json │ └── source │ │ └── index.js ├── cacheable-request │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── index.d.ts │ │ ├── index.d.ts.map │ │ ├── index.js │ │ ├── index.js.map │ │ ├── types.d.ts │ │ ├── types.d.ts.map │ │ ├── types.js │ │ └── types.js.map │ └── package.json ├── decompress-response │ ├── index.d.ts │ ├── index.js │ ├── license │ ├── node_modules │ │ └── mimic-response │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── license │ │ │ ├── package.json │ │ │ └── readme.md │ ├── package.json │ └── readme.md ├── defer-to-connect │ ├── LICENSE │ ├── README.md │ ├── dist │ │ └── source │ │ │ ├── index.d.ts │ │ │ └── index.js │ └── package.json ├── form-data-encoder │ ├── @type │ │ ├── FileLike.d.ts │ │ ├── FormDataEncoder.d.ts │ │ ├── FormDataLike.d.ts │ │ ├── index.d.ts │ │ └── util │ │ │ ├── Headers.d.ts │ │ │ ├── createBoundary.d.ts │ │ │ ├── escapeName.d.ts │ │ │ ├── getStreamIterator.d.ts │ │ │ ├── isFile.d.ts │ │ │ ├── isFormData.d.ts │ │ │ ├── isFunction.d.ts │ │ │ ├── isPlainObject.d.ts │ │ │ ├── normalizeValue.d.ts │ │ │ └── proxyHeaders.d.ts │ ├── lib │ │ ├── FileLike.js │ │ ├── FormDataEncoder.js │ │ ├── FormDataLike.js │ │ ├── index.js │ │ └── util │ │ │ ├── Headers.js │ │ │ ├── createBoundary.js │ │ │ ├── escapeName.js │ │ │ ├── getStreamIterator.js │ │ │ ├── isFile.js │ │ │ ├── isFormData.js │ │ │ ├── isFunction.js │ │ │ ├── isPlainObject.js │ │ │ ├── normalizeValue.js │ │ │ └── proxyHeaders.js │ ├── license │ ├── package.json │ └── readme.md ├── get-stream │ ├── buffer-stream.js │ ├── index.d.ts │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── got │ ├── dist │ │ └── source │ │ │ ├── as-promise │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── types.d.ts │ │ │ └── types.js │ │ │ ├── core │ │ │ ├── calculate-retry-delay.d.ts │ │ │ ├── calculate-retry-delay.js │ │ │ ├── errors.d.ts │ │ │ ├── errors.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── options.d.ts │ │ │ ├── options.js │ │ │ ├── parse-link-header.d.ts │ │ │ ├── parse-link-header.js │ │ │ ├── response.d.ts │ │ │ ├── response.js │ │ │ ├── timed-out.d.ts │ │ │ ├── timed-out.js │ │ │ └── utils │ │ │ │ ├── get-body-size.d.ts │ │ │ │ ├── get-body-size.js │ │ │ │ ├── is-client-request.d.ts │ │ │ │ ├── is-client-request.js │ │ │ │ ├── is-form-data.d.ts │ │ │ │ ├── is-form-data.js │ │ │ │ ├── is-unix-socket-url.d.ts │ │ │ │ ├── is-unix-socket-url.js │ │ │ │ ├── options-to-url.d.ts │ │ │ │ ├── options-to-url.js │ │ │ │ ├── proxy-events.d.ts │ │ │ │ ├── proxy-events.js │ │ │ │ ├── unhandle.d.ts │ │ │ │ ├── unhandle.js │ │ │ │ ├── url-to-options.d.ts │ │ │ │ ├── url-to-options.js │ │ │ │ ├── weakable-map.d.ts │ │ │ │ └── weakable-map.js │ │ │ ├── create.d.ts │ │ │ ├── create.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── types.d.ts │ │ │ └── types.js │ ├── license │ ├── package.json │ └── readme.md ├── http-cache-semantics │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── http2-wrapper │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── package.json │ └── source │ │ ├── agent.js │ │ ├── auto.js │ │ ├── client-request.js │ │ ├── incoming-message.js │ │ ├── index.js │ │ ├── proxies │ │ ├── get-auth-headers.js │ │ ├── h1-over-h2.js │ │ ├── h2-over-h1.js │ │ ├── h2-over-h2.js │ │ ├── h2-over-hx.js │ │ ├── initialize.js │ │ └── unexpected-status-code-error.js │ │ └── utils │ │ ├── calculate-server-name.js │ │ ├── check-type.js │ │ ├── delay-async-destroy.js │ │ ├── errors.js │ │ ├── is-request-pseudo-header.js │ │ ├── js-stream-socket.js │ │ ├── proxy-events.js │ │ ├── proxy-socket-handler.js │ │ ├── validate-header-name.js │ │ └── validate-header-value.js ├── json-buffer │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ └── index.js ├── keyv │ ├── README.md │ ├── package.json │ └── src │ │ ├── index.d.ts │ │ └── index.js ├── lowercase-keys │ ├── index.d.ts │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── mimic-response │ ├── index.d.ts │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── normalize-url │ ├── index.d.ts │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── p-cancelable │ ├── index.d.ts │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── quick-lru │ ├── index.d.ts │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── resolve-alpn │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json └── responselike │ ├── index.d.ts │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── ql.js ├── scripts_check_dependence.py ├── sendNotify.js ├── utils ├── JDJRValidator_Pure.js └── USER_AGENTS.js ├── version └── version.txt └── 一面玩家.jpg /README.md: -------------------------------------------------------------------------------- 1 | 国内仓库拉取(推荐): 2 | 3 | 4 | ``` 5 | ql repo https://gitee.com/dragon996/tiger.git "jd_|jx_|jdCookie" "activity|backUp" "^jd[^_]|USER|utils|function|sign|sendNotify|ql" 6 | 7 | ``` 8 | 9 | 国外仓库拉取(如果拉取过慢,请自行添加代理): 10 | 11 | ``` 12 | ql repo https://github.com/zll2317463866/tiger.git "jd_|jx_|jdCookie" "activity|backUp" "^jd[^_]|USER|utils|function|sign|sendNotify|ql" 13 | ``` 14 | 15 | 16 | 17 | 18 | 19 | 20 | tg备用联系方式: 21 | https://t.me/+pellEgrbUethMGZl 22 | 23 | 24 | 25 |

便宜服务器看下方,按需求买吧

26 | 27 | 阿里云服务器 <--点我直达 28 | 29 | 腾讯云服务器【综合页】 <--点我直达
30 | 腾讯云服务器【每日限购】 <--点我直达
31 | 腾讯云服务器【大额优惠卷】 <--点我直达 32 | 33 | **青龙面板依赖** 34 | NodeJs 35 | 36 | ``` 37 | crypto-js 38 | prettytable 39 | dotenv 40 | jsdom 41 | date-fns 42 | tough-cookie 43 | tslib 44 | ws@7.4.3 45 | ts-md5 46 | jsdom -g 47 | jieba 48 | fs 49 | form-data 50 | json5 51 | global-agent 52 | png-js 53 | @types/node 54 | require 55 | typescript 56 | js-base64 57 | axios 58 | ``` 59 | 60 | Python3 61 | 62 | ``` 63 | requests 64 | canvas 65 | ping3 66 | jieba 67 | fake-useragent 68 | ``` 69 | 70 | Linux 71 | 72 | ``` 73 | bizCode 74 | bizMsg 75 | lxml 76 | ``` 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /jdCookie.js: -------------------------------------------------------------------------------- 1 | /* 2 | 此文件为Node.js专用。其他用户请忽略 3 | */ 4 | //此处填写京东账号cookie。 5 | let CookieJDs = [ 6 | '',//账号一ck,例:pt_key=XXX;pt_pin=XXX; 7 | '',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推 8 | ] 9 | // 判断环境变量里面是否有京东ck 10 | if (process.env.JD_COOKIE) { 11 | if (process.env.JD_COOKIE.indexOf('&') > -1) { 12 | CookieJDs = process.env.JD_COOKIE.split('&'); 13 | } else if (process.env.JD_COOKIE.indexOf('\n') > -1) { 14 | CookieJDs = process.env.JD_COOKIE.split('\n'); 15 | } else { 16 | CookieJDs = [process.env.JD_COOKIE]; 17 | } 18 | } 19 | if (JSON.stringify(process.env).indexOf('GITHUB')>-1) { 20 | console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`); 21 | !(async () => { 22 | await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`) 23 | await process.exit(0); 24 | })() 25 | } 26 | CookieJDs = [...new Set(CookieJDs.filter(item => !!item))] 27 | console.log(`\n===============共${CookieJDs.length}个京东账号Cookie===============\n`); 28 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; 29 | for (let i = 0; i < CookieJDs.length; i++) { 30 | if (!CookieJDs[i].match(/pt_pin=(.+?);/) || !CookieJDs[i].match(/pt_key=(.+?);/)) console.log(`\n提示:京东cookie 【${CookieJDs[i]}】填写不规范,可能会影响部分脚本正常使用。正确格式为: pt_key=xxx;pt_pin=xxx;(分号;不可少)\n`); 31 | const index = (i + 1 === 1) ? '' : (i + 1); 32 | exports['CookieJD' + index] = CookieJDs[i].trim(); 33 | } 34 | -------------------------------------------------------------------------------- /node_modules/@sindresorhus/is/dist/types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). 3 | */ 4 | export type Primitive = null | undefined | string | number | boolean | symbol | bigint; 5 | /** 6 | Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). 7 | */ 8 | /** 9 | Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). 10 | */ 11 | export type Class = new (...arguments_: Arguments) => T; 12 | /** 13 | Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. 14 | */ 15 | export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; 16 | declare global { 17 | interface SymbolConstructor { 18 | readonly observable: symbol; 19 | } 20 | } 21 | /** 22 | Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). 23 | */ 24 | export type ObservableLike = { 25 | subscribe(observer: (value: unknown) => void): void; 26 | [Symbol.observable](): ObservableLike; 27 | }; 28 | export type Falsy = false | 0 | 0n | '' | null | undefined; 29 | export type WeakRef = { 30 | readonly [Symbol.toStringTag]: 'WeakRef'; 31 | deref(): T | undefined; 32 | }; 33 | -------------------------------------------------------------------------------- /node_modules/@sindresorhus/is/dist/types.js: -------------------------------------------------------------------------------- 1 | // Extracted from https://github.com/sindresorhus/type-fest/blob/78019f42ea888b0cdceb41a4a78163868de57555/index.d.ts 2 | export {}; 3 | -------------------------------------------------------------------------------- /node_modules/@sindresorhus/is/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/@sindresorhus/is/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@sindresorhus/is", 3 | "version": "5.4.0", 4 | "description": "Type check values", 5 | "license": "MIT", 6 | "repository": "sindresorhus/is", 7 | "funding": "https://github.com/sindresorhus/is?sponsor=1", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "type": "module", 14 | "exports": { 15 | "types": "./dist/index.d.ts", 16 | "default": "./dist/index.js" 17 | }, 18 | "engines": { 19 | "node": ">=14.16" 20 | }, 21 | "scripts": { 22 | "build": "del dist && tsc", 23 | "test": "tsc --noEmit && xo && ava", 24 | "prepare": "npm run build" 25 | }, 26 | "files": [ 27 | "dist" 28 | ], 29 | "keywords": [ 30 | "type", 31 | "types", 32 | "is", 33 | "check", 34 | "checking", 35 | "validate", 36 | "validation", 37 | "utility", 38 | "util", 39 | "typeof", 40 | "instanceof", 41 | "object", 42 | "assert", 43 | "assertion", 44 | "test", 45 | "kind", 46 | "primitive", 47 | "verify", 48 | "compare", 49 | "typescript", 50 | "typeguards", 51 | "types" 52 | ], 53 | "devDependencies": { 54 | "@sindresorhus/tsconfig": "^3.0.1", 55 | "@types/jsdom": "^21.1.1", 56 | "@types/node": "^20.2.5", 57 | "@types/zen-observable": "^0.8.3", 58 | "ava": "^5.3.0", 59 | "del-cli": "^5.0.0", 60 | "jsdom": "^20.0.1", 61 | "rxjs": "^7.8.1", 62 | "tempy": "^3.0.0", 63 | "ts-node": "^10.9.1", 64 | "typescript": "^5.0.4", 65 | "xo": "^0.54.2", 66 | "zen-observable": "^0.10.0" 67 | }, 68 | "sideEffects": false, 69 | "ava": { 70 | "extensions": { 71 | "ts": "module" 72 | }, 73 | "nodeArguments": [ 74 | "--loader=ts-node/esm" 75 | ] 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /node_modules/@szmarczak/http-timer/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Szymon Marczak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/@szmarczak/http-timer/README.md: -------------------------------------------------------------------------------- 1 | # http-timer 2 | > Timings for HTTP requests 3 | 4 | [![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer) 5 | [![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master) 6 | [![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer) 7 | 8 | Inspired by the [`request` package](https://github.com/request/request). 9 | 10 | ## Installation 11 | 12 | NPM: 13 | 14 | > `npm install @szmarczak/http-timer` 15 | 16 | Yarn: 17 | 18 | > `yarn add @szmarczak/http-timer` 19 | 20 | ## Usage 21 | **Note:** 22 | > - The measured events resemble Node.js events, not the kernel ones. 23 | > - Sending a chunk greater than [`highWaterMark`](https://nodejs.org/api/stream.html#stream_new_stream_writable_options) will result in invalid `upload` and `response` timings. You can avoid this by splitting the payload into smaller chunks. 24 | 25 | ```js 26 | import https from 'https'; 27 | import timer from '@szmarczak/http-timer'; 28 | 29 | const request = https.get('https://httpbin.org/anything'); 30 | timer(request); 31 | 32 | request.once('response', response => { 33 | response.resume(); 34 | response.once('end', () => { 35 | console.log(response.timings); // You can use `request.timings` as well 36 | }); 37 | }); 38 | 39 | // { 40 | // start: 1572712180361, 41 | // socket: 1572712180362, 42 | // lookup: 1572712180415, 43 | // connect: 1572712180571, 44 | // upload: 1572712180884, 45 | // response: 1572712181037, 46 | // end: 1572712181039, 47 | // error: undefined, 48 | // abort: undefined, 49 | // phases: { 50 | // wait: 1, 51 | // dns: 53, 52 | // tcp: 156, 53 | // request: 313, 54 | // firstByte: 153, 55 | // download: 2, 56 | // total: 678 57 | // } 58 | // } 59 | ``` 60 | 61 | ## API 62 | 63 | ### timer(request) 64 | 65 | Returns: `Object` 66 | 67 | **Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch. 68 | 69 | - `start` - Time when the request started. 70 | - `socket` - Time when a socket was assigned to the request. 71 | - `lookup` - Time when the DNS lookup finished. 72 | - `connect` - Time when the socket successfully connected. 73 | - `secureConnect` - Time when the socket securely connected. 74 | - `upload` - Time when the request finished uploading. 75 | - `response` - Time when the request fired `response` event. 76 | - `end` - Time when the response fired `end` event. 77 | - `error` - Time when the request fired `error` event. 78 | - `abort` - Time when the request fired `abort` event. 79 | - `phases` 80 | - `wait` - `timings.socket - timings.start` 81 | - `dns` - `timings.lookup - timings.socket` 82 | - `tcp` - `timings.connect - timings.lookup` 83 | - `tls` - `timings.secureConnect - timings.connect` 84 | - `request` - `timings.upload - (timings.secureConnect || timings.connect)` 85 | - `firstByte` - `timings.response - timings.upload` 86 | - `download` - `timings.end - timings.response` 87 | - `total` - `(timings.end || timings.error || timings.abort) - timings.start` 88 | 89 | If something has not been measured yet, it will be `undefined`. 90 | 91 | ## License 92 | 93 | MIT 94 | -------------------------------------------------------------------------------- /node_modules/@szmarczak/http-timer/dist/source/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { ClientRequest, IncomingMessage } from 'http'; 3 | export interface Timings { 4 | start: number; 5 | socket?: number; 6 | lookup?: number; 7 | connect?: number; 8 | secureConnect?: number; 9 | upload?: number; 10 | response?: number; 11 | end?: number; 12 | error?: number; 13 | abort?: number; 14 | phases: { 15 | wait?: number; 16 | dns?: number; 17 | tcp?: number; 18 | tls?: number; 19 | request?: number; 20 | firstByte?: number; 21 | download?: number; 22 | total?: number; 23 | }; 24 | } 25 | export interface ClientRequestWithTimings extends ClientRequest { 26 | timings?: Timings; 27 | } 28 | export interface IncomingMessageWithTimings extends IncomingMessage { 29 | timings?: Timings; 30 | } 31 | declare const timer: (request: ClientRequestWithTimings) => Timings; 32 | export default timer; 33 | -------------------------------------------------------------------------------- /node_modules/@szmarczak/http-timer/dist/source/index.js: -------------------------------------------------------------------------------- 1 | import { errorMonitor } from 'events'; 2 | import { types } from 'util'; 3 | import deferToConnect from 'defer-to-connect'; 4 | const timer = (request) => { 5 | if (request.timings) { 6 | return request.timings; 7 | } 8 | const timings = { 9 | start: Date.now(), 10 | socket: undefined, 11 | lookup: undefined, 12 | connect: undefined, 13 | secureConnect: undefined, 14 | upload: undefined, 15 | response: undefined, 16 | end: undefined, 17 | error: undefined, 18 | abort: undefined, 19 | phases: { 20 | wait: undefined, 21 | dns: undefined, 22 | tcp: undefined, 23 | tls: undefined, 24 | request: undefined, 25 | firstByte: undefined, 26 | download: undefined, 27 | total: undefined, 28 | }, 29 | }; 30 | request.timings = timings; 31 | const handleError = (origin) => { 32 | origin.once(errorMonitor, () => { 33 | timings.error = Date.now(); 34 | timings.phases.total = timings.error - timings.start; 35 | }); 36 | }; 37 | handleError(request); 38 | const onAbort = () => { 39 | timings.abort = Date.now(); 40 | timings.phases.total = timings.abort - timings.start; 41 | }; 42 | request.prependOnceListener('abort', onAbort); 43 | const onSocket = (socket) => { 44 | timings.socket = Date.now(); 45 | timings.phases.wait = timings.socket - timings.start; 46 | if (types.isProxy(socket)) { 47 | return; 48 | } 49 | const lookupListener = () => { 50 | timings.lookup = Date.now(); 51 | timings.phases.dns = timings.lookup - timings.socket; 52 | }; 53 | socket.prependOnceListener('lookup', lookupListener); 54 | deferToConnect(socket, { 55 | connect: () => { 56 | timings.connect = Date.now(); 57 | if (timings.lookup === undefined) { 58 | socket.removeListener('lookup', lookupListener); 59 | timings.lookup = timings.connect; 60 | timings.phases.dns = timings.lookup - timings.socket; 61 | } 62 | timings.phases.tcp = timings.connect - timings.lookup; 63 | }, 64 | secureConnect: () => { 65 | timings.secureConnect = Date.now(); 66 | timings.phases.tls = timings.secureConnect - timings.connect; 67 | }, 68 | }); 69 | }; 70 | if (request.socket) { 71 | onSocket(request.socket); 72 | } 73 | else { 74 | request.prependOnceListener('socket', onSocket); 75 | } 76 | const onUpload = () => { 77 | timings.upload = Date.now(); 78 | timings.phases.request = timings.upload - (timings.secureConnect ?? timings.connect); 79 | }; 80 | if (request.writableFinished) { 81 | onUpload(); 82 | } 83 | else { 84 | request.prependOnceListener('finish', onUpload); 85 | } 86 | request.prependOnceListener('response', (response) => { 87 | timings.response = Date.now(); 88 | timings.phases.firstByte = timings.response - timings.upload; 89 | response.timings = timings; 90 | handleError(response); 91 | response.prependOnceListener('end', () => { 92 | request.off('abort', onAbort); 93 | response.off('aborted', onAbort); 94 | if (timings.phases.total) { 95 | // Aborted or errored 96 | return; 97 | } 98 | timings.end = Date.now(); 99 | timings.phases.download = timings.end - timings.response; 100 | timings.phases.total = timings.end - timings.start; 101 | }); 102 | response.prependOnceListener('aborted', onAbort); 103 | }); 104 | return timings; 105 | }; 106 | export default timer; 107 | -------------------------------------------------------------------------------- /node_modules/@szmarczak/http-timer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@szmarczak/http-timer", 3 | "version": "5.0.1", 4 | "description": "Timings for HTTP requests", 5 | "type": "module", 6 | "exports": "./dist/source/index.js", 7 | "engines": { 8 | "node": ">=14.16" 9 | }, 10 | "scripts": { 11 | "test": "xo && ava", 12 | "build": "del-cli dist && tsc", 13 | "prepare": "npm run build", 14 | "coveralls": "exit 0 && nyc report --reporter=text-lcov | coveralls" 15 | }, 16 | "files": [ 17 | "dist/source" 18 | ], 19 | "keywords": [ 20 | "http", 21 | "https", 22 | "http2", 23 | "timer", 24 | "timings", 25 | "performance", 26 | "measure" 27 | ], 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/szmarczak/http-timer.git" 31 | }, 32 | "author": "Szymon Marczak", 33 | "license": "MIT", 34 | "bugs": { 35 | "url": "https://github.com/szmarczak/http-timer/issues" 36 | }, 37 | "homepage": "https://github.com/szmarczak/http-timer#readme", 38 | "dependencies": { 39 | "defer-to-connect": "^2.0.1" 40 | }, 41 | "devDependencies": { 42 | "@ava/typescript": "^2.0.0", 43 | "@sindresorhus/tsconfig": "^1.0.2", 44 | "@types/node": "^16.7.0", 45 | "ava": "^3.15.0", 46 | "coveralls": "^3.1.1", 47 | "del-cli": "^4.0.1", 48 | "http2-wrapper": "^2.1.4", 49 | "nyc": "^15.1.0", 50 | "p-event": "^4.2.0", 51 | "ts-node": "^10.2.1", 52 | "typescript": "^4.3.5", 53 | "xo": "^0.44.0" 54 | }, 55 | "types": "dist/source", 56 | "nyc": { 57 | "extension": [ 58 | ".ts" 59 | ], 60 | "exclude": [ 61 | "**/tests/**" 62 | ] 63 | }, 64 | "xo": { 65 | "rules": { 66 | "@typescript-eslint/no-non-null-assertion": "off", 67 | "@typescript-eslint/no-unsafe-assignment": "off", 68 | "@typescript-eslint/no-unsafe-member-access": "off", 69 | "@typescript-eslint/no-unsafe-call": "off", 70 | "unicorn/prefer-node-protocol": "off" 71 | } 72 | }, 73 | "ava": { 74 | "files": [ 75 | "tests/*" 76 | ], 77 | "timeout": "1m", 78 | "nonSemVerExperiments": { 79 | "nextGenConfig": true, 80 | "configurableModuleFormat": true 81 | }, 82 | "extensions": { 83 | "ts": "module" 84 | }, 85 | "nodeArguments": [ 86 | "--loader=ts-node/esm" 87 | ] 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /node_modules/@types/http-cache-semantics/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /node_modules/@types/http-cache-semantics/README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | > `npm install --save @types/http-cache-semantics` 3 | 4 | # Summary 5 | This package contains type definitions for http-cache-semantics (https://github.com/kornelski/http-cache-semantics#readme). 6 | 7 | # Details 8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-cache-semantics. 9 | 10 | ### Additional Details 11 | * Last updated: Tue, 06 Jul 2021 21:33:36 GMT 12 | * Dependencies: none 13 | * Global values: none 14 | 15 | # Credits 16 | These definitions were written by [BendingBender](https://github.com/BendingBender). 17 | -------------------------------------------------------------------------------- /node_modules/@types/http-cache-semantics/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@types/http-cache-semantics", 3 | "version": "4.0.1", 4 | "description": "TypeScript definitions for http-cache-semantics", 5 | "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-cache-semantics", 6 | "license": "MIT", 7 | "contributors": [ 8 | { 9 | "name": "BendingBender", 10 | "url": "https://github.com/BendingBender", 11 | "githubUsername": "BendingBender" 12 | } 13 | ], 14 | "main": "", 15 | "types": "index.d.ts", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", 19 | "directory": "types/http-cache-semantics" 20 | }, 21 | "scripts": {}, 22 | "dependencies": {}, 23 | "typesPublisherContentHash": "9ecb3137d8c0ede7c06f5d90c7d4759e560a26effb8846bc51a99b63f03dd2d1", 24 | "typeScriptVersion": "3.6" 25 | } -------------------------------------------------------------------------------- /node_modules/cacheable-lookup/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Szymon Marczak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/cacheable-lookup/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cacheable-lookup", 3 | "version": "7.0.0", 4 | "description": "A cacheable dns.lookup(…) that respects TTL", 5 | "engines": { 6 | "node": ">=14.16" 7 | }, 8 | "files": [ 9 | "source", 10 | "index.d.ts" 11 | ], 12 | "type": "module", 13 | "exports": { 14 | "types": "./index.d.ts", 15 | "default": "./source/index.js" 16 | }, 17 | "scripts": { 18 | "//test": "xo && nyc --reporter=lcovonly --reporter=text ava && tsd", 19 | "test": "tsd" 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "git+https://github.com/szmarczak/cacheable-lookup.git" 24 | }, 25 | "keywords": [ 26 | "dns", 27 | "lookup", 28 | "cacheable", 29 | "ttl" 30 | ], 31 | "author": "Szymon Marczak", 32 | "license": "MIT", 33 | "bugs": { 34 | "url": "https://github.com/szmarczak/cacheable-lookup/issues" 35 | }, 36 | "homepage": "https://github.com/szmarczak/cacheable-lookup#readme", 37 | "devDependencies": { 38 | "@types/keyv": "^3.1.1", 39 | "ava": "^4.3.3", 40 | "benchmark": "^2.1.4", 41 | "coveralls": "^3.0.9", 42 | "keyv": "^4.0.0", 43 | "nyc": "^15.0.0", 44 | "quibble": "^0.6.14", 45 | "quick-lru": "^5.1.0", 46 | "tsd": "^0.11.0", 47 | "xo": "^0.25.3" 48 | }, 49 | "ava": { 50 | "nodeArguments": [ 51 | "--loader=quibble" 52 | ] 53 | }, 54 | "xo": { 55 | "rules": { 56 | "unicorn/import-index": "off", 57 | "import/extensions": "off", 58 | "import/no-useless-path-segments": "off" 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /node_modules/cacheable-request/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2021 Luke Childs 4 | Copyright (c) 2022 Jared Wray 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /node_modules/cacheable-request/dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import { RequestFn, StorageAdapter, CacheResponse, CacheValue, CacheableOptions, Emitter } from './types.js'; 2 | type Func = (...args: any[]) => any; 3 | declare class CacheableRequest { 4 | cache: StorageAdapter; 5 | cacheRequest: RequestFn; 6 | hooks: Map; 7 | constructor(cacheRequest: RequestFn, cacheAdapter?: StorageAdapter | string); 8 | request: () => (options: CacheableOptions, cb?: (response: CacheResponse) => void) => Emitter; 9 | addHook: (name: string, fn: Func) => void; 10 | removeHook: (name: string) => boolean; 11 | getHook: (name: string) => Func; 12 | runHook: (name: string, ...args: any[]) => Promise; 13 | } 14 | export default CacheableRequest; 15 | export * from './types.js'; 16 | export declare const onResponse = "onResponse"; 17 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /node_modules/cacheable-request/dist/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAC,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAuC,OAAO,EAA2B,MAAM,YAAY,CAAC;AAE1K,KAAK,IAAI,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAEpC,cAAM,gBAAgB;IACrB,KAAK,EAAE,cAAc,CAAC;IACtB,YAAY,EAAE,SAAS,CAAC;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAA2B;gBACvC,YAAY,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,cAAc,GAAG,MAAM;IAmB3E,OAAO,kBAAmB,gBAAgB,kBACzB,aAAa,KAAK,IAAI,KAAG,OAAO,CAuM/C;IAEF,OAAO,SAAU,MAAM,MAAM,IAAI,UAI/B;IAEF,UAAU,SAAU,MAAM,aAA6B;IAEvD,OAAO,SAAU,MAAM,UAA0B;IAEjD,OAAO,SAAgB,MAAM,WAAW,GAAG,EAAE,KAAG,QAAQ,UAAU,CAAC,CAAoC;CACvG;AA6CD,eAAe,gBAAgB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,eAAO,MAAM,UAAU,eAAe,CAAC"} -------------------------------------------------------------------------------- /node_modules/cacheable-request/dist/types.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;AASA,OAAO,EAAC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AACjF,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,KAAK,EAAC,MAAM,MAAM,CAAC;AAC3B,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG,OAAO,OAAO,CAAC;AACvC,MAAM,MAAM,eAAe,GAAG,OAAO,OAAO,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,OAAO,YAAY,CAAC;AAEjE,MAAM,MAAM,wBAAwB,GAAG,CACtC,OAAO,EAAE,gBAAgB,EACzB,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,KAClC,OAAO,CAAC;AAEb,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM,GAAG,GAAG,CAAC;AAEvE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAExC,MAAM,WAAW,OAAO;IACvB;;;eAGK;IACL,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE5B;;;;;;eAMK;IACL,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEhC;;;eAGK;IACL,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;;;eAIK;IACL,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAExC;;;;GAIE;IACF,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEpC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IAExD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,WAAW,EAAE,iBAAiB,CAAC;CAC/B;AAED,MAAM,WAAW,OAAQ,SAAQ,YAAY;IAC5C,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IAChF,WAAW,CACV,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GACzC,IAAI,CAAC;IACR,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IACxF,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IACvE,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IACzE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAC/E,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IACzE,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3E,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IACjF,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IACpF,eAAe,CACd,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GACzC,IAAI,CAAC;IACR,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAC5F,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IACxF,mBAAmB,CAClB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GACzC,IAAI,CAAC;IACR,mBAAmB,CAClB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,GAClD,IAAI,CAAC;IACR,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IACnF,cAAc,CACb,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GACzC,IAAI,CAAC;IACR,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3F,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IACxE,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAAC;IAC1E,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAChF,kBAAkB,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC;IACnE,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IACrE,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IACvE,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,CAAC,CAAC;IAC7E,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IACxE,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IAC1E,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,CAAC,CAAC;IAChF,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;IACxD,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC;IAC1D,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;IAChE,UAAU,IAAI,KAAK,CAAC,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC,CAAC;IACtD,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;CAC9D;AAED,qBAAa,YAAa,SAAQ,KAAK;gBAC1B,KAAK,EAAE,KAAK;CAIxB;AACD,qBAAa,UAAW,SAAQ,KAAK;gBACxB,KAAK,EAAE,KAAK;CAIxB;AAED,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB"} -------------------------------------------------------------------------------- /node_modules/cacheable-request/dist/types.js: -------------------------------------------------------------------------------- 1 | // Type definitions for cacheable-request 6.0 2 | // Project: https://github.com/lukechilds/cacheable-request#readme 3 | // Definitions by: BendingBender 4 | // Paul Melnikow 5 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 6 | // TypeScript Version: 2.3 7 | export class RequestError extends Error { 8 | constructor(error) { 9 | super(error.message); 10 | Object.assign(this, error); 11 | } 12 | } 13 | export class CacheError extends Error { 14 | constructor(error) { 15 | super(error.message); 16 | Object.assign(this, error); 17 | } 18 | } 19 | //# sourceMappingURL=types.js.map -------------------------------------------------------------------------------- /node_modules/cacheable-request/dist/types.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,kEAAkE;AAClE,mEAAmE;AACnE,kEAAkE;AAClE,kEAAkE;AAClE,0BAA0B;AA+H1B,MAAM,OAAO,YAAa,SAAQ,KAAK;IACtC,YAAY,KAAY;QACvB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD;AACD,MAAM,OAAO,UAAW,SAAQ,KAAK;IACpC,YAAY,KAAY;QACvB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD"} -------------------------------------------------------------------------------- /node_modules/cacheable-request/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cacheable-request", 3 | "version": "10.2.10", 4 | "description": "Wrap native HTTP requests with RFC compliant cache support", 5 | "license": "MIT", 6 | "repository": "jaredwray/cacheable-request", 7 | "author": "Jared Wray (http://jaredwray.com)", 8 | "type": "module", 9 | "exports": "./dist/index.js", 10 | "types": "./dist/index.d.ts", 11 | "engines": { 12 | "node": ">=14.16" 13 | }, 14 | "scripts": { 15 | "test": "xo && NODE_OPTIONS=--experimental-vm-modules jest --coverage ", 16 | "prepare": "npm run build", 17 | "build": "tsc --project tsconfig.build.json", 18 | "clean": "rm -rf node_modules && rm -rf ./coverage && rm -rf ./package-lock.json && rm -rf ./test/testdb.sqlite && rm -rf ./dist" 19 | }, 20 | "files": [ 21 | "dist" 22 | ], 23 | "keywords": [ 24 | "HTTP", 25 | "HTTPS", 26 | "cache", 27 | "caching", 28 | "layer", 29 | "cacheable", 30 | "RFC 7234", 31 | "RFC", 32 | "7234", 33 | "compliant" 34 | ], 35 | "dependenciesComments": { 36 | "@types/http-cache-semantics": "It needs to be in the dependencies list and not devDependencies because otherwise projects that use this one will be getting `Could not find a declaration file for module 'http-cache-semantics'` error when running `tsc`, see https://github.com/jaredwray/cacheable-request/issues/194 for details" 37 | }, 38 | "dependencies": { 39 | "@types/http-cache-semantics": "^4.0.1", 40 | "get-stream": "^6.0.1", 41 | "http-cache-semantics": "^4.1.1", 42 | "keyv": "^4.5.2", 43 | "mimic-response": "^4.0.0", 44 | "normalize-url": "^8.0.0", 45 | "responselike": "^3.0.0" 46 | }, 47 | "devDependencies": { 48 | "@keyv/sqlite": "^3.6.5", 49 | "@types/delay": "^3.1.0", 50 | "@types/get-stream": "^3.0.2", 51 | "@types/jest": "^29.5.1", 52 | "@types/node": "^18.16.0", 53 | "@types/responselike": "^1.0.0", 54 | "@types/sqlite3": "^3.1.8", 55 | "body-parser": "^1.20.2", 56 | "delay": "^5.0.0", 57 | "eslint-plugin-jest": "^27.2.1", 58 | "express": "^4.18.2", 59 | "jest": "^29.5.0", 60 | "pify": "^6.1.0", 61 | "sqlite3": "^5.1.6", 62 | "ts-jest": "^29.1.0", 63 | "ts-jest-resolver": "^2.0.1", 64 | "ts-node": "^10.9.1", 65 | "typescript": "^5.0.4", 66 | "xo": "^0.54.1" 67 | }, 68 | "jest": { 69 | "collectCoverageFrom": [ 70 | "src/**/*.{ts,js}" 71 | ], 72 | "extensionsToTreatAsEsm": [ 73 | ".ts" 74 | ], 75 | "resolver": "ts-jest-resolver", 76 | "moduleFileExtensions": [ 77 | "ts", 78 | "js" 79 | ], 80 | "transform": { 81 | "^.+\\.(ts|tsx)$": [ 82 | "ts-jest", 83 | { 84 | "tsconfig": "./tsconfig.build.json", 85 | "useESM": true 86 | } 87 | ] 88 | }, 89 | "testMatch": [ 90 | "**/test/*.test.(ts|js)" 91 | ], 92 | "testEnvironment": "node" 93 | }, 94 | "xo": { 95 | "plugins": [ 96 | "jest" 97 | ], 98 | "extends": [ 99 | "plugin:jest/recommended" 100 | ], 101 | "rules": { 102 | "@typescript-eslint/triple-slash-reference": 0, 103 | "@typescript-eslint/no-namespace": 0, 104 | "@typescript-eslint/no-unsafe-assignment": 0, 105 | "@typescript-eslint/no-unsafe-call": 0, 106 | "@typescript-eslint/ban-types": 0, 107 | "@typescript-eslint/restrict-template-expressions": 0, 108 | "@typescript-eslint/no-unsafe-return": 0, 109 | "@typescript-eslint/no-unsafe-argument": 0, 110 | "new-cap": 0, 111 | "unicorn/no-abusive-eslint-disable": 0, 112 | "@typescript-eslint/restrict-plus-operands": 0, 113 | "@typescript-eslint/no-implicit-any-catch": 0, 114 | "@typescript-eslint/consistent-type-imports": 0, 115 | "@typescript-eslint/consistent-type-definitions": 0, 116 | "@typescript-eslint/prefer-nullish-coalescing": 0, 117 | "n/prefer-global/url": 0 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /node_modules/decompress-response/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import {IncomingMessage} from 'http'; 3 | 4 | /** 5 | Decompress a HTTP response if needed. 6 | 7 | @param response - The HTTP incoming stream with compressed data. 8 | @returns The decompressed HTTP response stream. 9 | 10 | @example 11 | ``` 12 | import {http} from 'http'; 13 | import decompressResponse = require('decompress-response'); 14 | 15 | http.get('https://sindresorhus.com', response => { 16 | response = decompressResponse(response); 17 | }); 18 | ``` 19 | */ 20 | declare function decompressResponse(response: IncomingMessage): IncomingMessage; 21 | 22 | export = decompressResponse; 23 | -------------------------------------------------------------------------------- /node_modules/decompress-response/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {Transform, PassThrough} = require('stream'); 3 | const zlib = require('zlib'); 4 | const mimicResponse = require('mimic-response'); 5 | 6 | module.exports = response => { 7 | const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase(); 8 | 9 | if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) { 10 | return response; 11 | } 12 | 13 | // TODO: Remove this when targeting Node.js 12. 14 | const isBrotli = contentEncoding === 'br'; 15 | if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') { 16 | response.destroy(new Error('Brotli is not supported on Node.js < 12')); 17 | return response; 18 | } 19 | 20 | let isEmpty = true; 21 | 22 | const checker = new Transform({ 23 | transform(data, _encoding, callback) { 24 | isEmpty = false; 25 | 26 | callback(null, data); 27 | }, 28 | 29 | flush(callback) { 30 | callback(); 31 | } 32 | }); 33 | 34 | const finalStream = new PassThrough({ 35 | autoDestroy: false, 36 | destroy(error, callback) { 37 | response.destroy(); 38 | 39 | callback(error); 40 | } 41 | }); 42 | 43 | const decompressStream = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip(); 44 | 45 | decompressStream.once('error', error => { 46 | if (isEmpty && !response.readable) { 47 | finalStream.end(); 48 | return; 49 | } 50 | 51 | finalStream.destroy(error); 52 | }); 53 | 54 | mimicResponse(response, finalStream); 55 | response.pipe(checker).pipe(decompressStream).pipe(finalStream); 56 | 57 | return finalStream; 58 | }; 59 | -------------------------------------------------------------------------------- /node_modules/decompress-response/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/decompress-response/node_modules/mimic-response/index.d.ts: -------------------------------------------------------------------------------- 1 | import {IncomingMessage} from 'http'; 2 | 3 | /** 4 | Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) 5 | 6 | Makes `toStream` include the properties from `fromStream`. 7 | 8 | @param fromStream - The stream to copy the properties from. 9 | @param toStream - The stream to copy the properties to. 10 | @return The same object as `toStream`. 11 | */ 12 | declare function mimicResponse( 13 | fromStream: IncomingMessage, // eslint-disable-line @typescript-eslint/prefer-readonly-parameter-types 14 | toStream: T, 15 | ): T & IncomingMessage; 16 | 17 | export = mimicResponse; 18 | -------------------------------------------------------------------------------- /node_modules/decompress-response/node_modules/mimic-response/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // We define these manually to ensure they're always copied 4 | // even if they would move up the prototype chain 5 | // https://nodejs.org/api/http.html#http_class_http_incomingmessage 6 | const knownProperties = [ 7 | 'aborted', 8 | 'complete', 9 | 'headers', 10 | 'httpVersion', 11 | 'httpVersionMinor', 12 | 'httpVersionMajor', 13 | 'method', 14 | 'rawHeaders', 15 | 'rawTrailers', 16 | 'setTimeout', 17 | 'socket', 18 | 'statusCode', 19 | 'statusMessage', 20 | 'trailers', 21 | 'url' 22 | ]; 23 | 24 | module.exports = (fromStream, toStream) => { 25 | if (toStream._readableState.autoDestroy) { 26 | throw new Error('The second stream must have the `autoDestroy` option set to `false`'); 27 | } 28 | 29 | const fromProperties = new Set(Object.keys(fromStream).concat(knownProperties)); 30 | 31 | const properties = {}; 32 | 33 | for (const property of fromProperties) { 34 | // Don't overwrite existing properties. 35 | if (property in toStream) { 36 | continue; 37 | } 38 | 39 | properties[property] = { 40 | get() { 41 | const value = fromStream[property]; 42 | const isFunction = typeof value === 'function'; 43 | 44 | return isFunction ? value.bind(fromStream) : value; 45 | }, 46 | set(value) { 47 | fromStream[property] = value; 48 | }, 49 | enumerable: true, 50 | configurable: false 51 | }; 52 | } 53 | 54 | Object.defineProperties(toStream, properties); 55 | 56 | fromStream.once('aborted', () => { 57 | toStream.destroy(); 58 | 59 | toStream.emit('aborted'); 60 | }); 61 | 62 | fromStream.once('close', () => { 63 | if (fromStream.complete) { 64 | if (toStream.readable) { 65 | toStream.once('end', () => { 66 | toStream.emit('close'); 67 | }); 68 | } else { 69 | toStream.emit('close'); 70 | } 71 | } else { 72 | toStream.emit('close'); 73 | } 74 | }); 75 | 76 | return toStream; 77 | }; 78 | -------------------------------------------------------------------------------- /node_modules/decompress-response/node_modules/mimic-response/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/decompress-response/node_modules/mimic-response/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mimic-response", 3 | "version": "3.1.0", 4 | "description": "Mimic a Node.js HTTP response stream", 5 | "license": "MIT", 6 | "repository": "sindresorhus/mimic-response", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "engines": { 14 | "node": ">=10" 15 | }, 16 | "scripts": { 17 | "test": "xo && ava && tsd" 18 | }, 19 | "files": [ 20 | "index.d.ts", 21 | "index.js" 22 | ], 23 | "keywords": [ 24 | "mimic", 25 | "response", 26 | "stream", 27 | "http", 28 | "https", 29 | "request", 30 | "get", 31 | "core" 32 | ], 33 | "devDependencies": { 34 | "@types/node": "^14.0.1", 35 | "ava": "^2.4.0", 36 | "create-test-server": "^2.4.0", 37 | "p-event": "^4.1.0", 38 | "pify": "^5.0.0", 39 | "tsd": "^0.11.0", 40 | "xo": "^0.30.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /node_modules/decompress-response/node_modules/mimic-response/readme.md: -------------------------------------------------------------------------------- 1 | # mimic-response [![Build Status](https://travis-ci.com/sindresorhus/mimic-response.svg?branch=master)](https://travis-ci.com/sindresorhus/mimic-response) 2 | 3 | > Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) 4 | 5 | ## Install 6 | 7 | ``` 8 | $ npm install mimic-response 9 | ``` 10 | 11 | ## Usage 12 | 13 | ```js 14 | const stream = require('stream'); 15 | const mimicResponse = require('mimic-response'); 16 | 17 | const responseStream = getHttpResponseStream(); 18 | const myStream = new stream.PassThrough(); 19 | 20 | mimicResponse(responseStream, myStream); 21 | 22 | console.log(myStream.statusCode); 23 | //=> 200 24 | ``` 25 | 26 | ## API 27 | 28 | ### mimicResponse(from, to) 29 | 30 | **Note #1:** The `from.destroy(error)` function is not proxied. You have to call it manually: 31 | 32 | ```js 33 | const stream = require('stream'); 34 | const mimicResponse = require('mimic-response'); 35 | 36 | const responseStream = getHttpResponseStream(); 37 | 38 | const myStream = new stream.PassThrough({ 39 | destroy(error, callback) { 40 | responseStream.destroy(); 41 | 42 | callback(error); 43 | } 44 | }); 45 | 46 | myStream.destroy(); 47 | ``` 48 | 49 | Please note that `myStream` and `responseStream` never throws. The error is passed to the request instead. 50 | 51 | #### from 52 | 53 | Type: `Stream` 54 | 55 | [Node.js HTTP response stream.](https://nodejs.org/api/http.html#http_class_http_incomingmessage) 56 | 57 | #### to 58 | 59 | Type: `Stream` 60 | 61 | Any stream. 62 | 63 | ## Related 64 | 65 | - [mimic-fn](https://github.com/sindresorhus/mimic-fn) - Make a function mimic another one 66 | - [clone-response](https://github.com/lukechilds/clone-response) - Clone a Node.js response stream 67 | 68 | --- 69 | 70 |
71 | 72 | Get professional support for this package with a Tidelift subscription 73 | 74 |
75 | 76 | Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. 77 |
78 |
79 | -------------------------------------------------------------------------------- /node_modules/decompress-response/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "decompress-response", 3 | "version": "6.0.0", 4 | "description": "Decompress a HTTP response if needed", 5 | "license": "MIT", 6 | "repository": "sindresorhus/decompress-response", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "engines": { 14 | "node": ">=10" 15 | }, 16 | "scripts": { 17 | "test": "xo && ava && tsd" 18 | }, 19 | "files": [ 20 | "index.js", 21 | "index.d.ts" 22 | ], 23 | "keywords": [ 24 | "decompress", 25 | "response", 26 | "http", 27 | "https", 28 | "zlib", 29 | "gzip", 30 | "zip", 31 | "deflate", 32 | "unzip", 33 | "ungzip", 34 | "incoming", 35 | "message", 36 | "stream", 37 | "compressed", 38 | "brotli" 39 | ], 40 | "dependencies": { 41 | "mimic-response": "^3.1.0" 42 | }, 43 | "devDependencies": { 44 | "@types/node": "^14.0.1", 45 | "ava": "^2.2.0", 46 | "get-stream": "^5.0.0", 47 | "pify": "^5.0.0", 48 | "tsd": "^0.11.0", 49 | "xo": "^0.30.0" 50 | }, 51 | "xo": { 52 | "rules": { 53 | "@typescript-eslint/prefer-readonly-parameter-types": "off" 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /node_modules/decompress-response/readme.md: -------------------------------------------------------------------------------- 1 | # decompress-response [![Build Status](https://travis-ci.com/sindresorhus/decompress-response.svg?branch=master)](https://travis-ci.com/sindresorhus/decompress-response) 2 | 3 | > Decompress a HTTP response if needed 4 | 5 | Decompresses the [response](https://nodejs.org/api/http.html#http_class_http_incomingmessage) from [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) if it's gzipped, deflated or compressed with Brotli, otherwise just passes it through. 6 | 7 | Used by [`got`](https://github.com/sindresorhus/got). 8 | 9 | ## Install 10 | 11 | ``` 12 | $ npm install decompress-response 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```js 18 | const http = require('http'); 19 | const decompressResponse = require('decompress-response'); 20 | 21 | http.get('https://sindresorhus.com', response => { 22 | response = decompressResponse(response); 23 | }); 24 | ``` 25 | 26 | ## API 27 | 28 | ### decompressResponse(response) 29 | 30 | Returns the decompressed HTTP response stream. 31 | 32 | #### response 33 | 34 | Type: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) 35 | 36 | The HTTP incoming stream with compressed data. 37 | 38 | --- 39 | 40 |
41 | 42 | Get professional support for this package with a Tidelift subscription 43 | 44 |
45 | 46 | Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. 47 |
48 |
49 | -------------------------------------------------------------------------------- /node_modules/defer-to-connect/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Szymon Marczak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/defer-to-connect/README.md: -------------------------------------------------------------------------------- 1 | # defer-to-connect 2 | 3 | > The safe way to handle the `connect` socket event 4 | 5 | [![Coverage Status](https://coveralls.io/repos/github/szmarczak/defer-to-connect/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/defer-to-connect?branch=master) 6 | 7 | Once you receive the socket, it may be already connected (or disconnected).
8 | To avoid checking that, use `defer-to-connect`. It'll do that for you. 9 | 10 | ## Usage 11 | 12 | ```js 13 | const deferToConnect = require('defer-to-connect'); 14 | 15 | deferToConnect(socket, () => { 16 | console.log('Connected!'); 17 | }); 18 | ``` 19 | 20 | ## API 21 | 22 | ### deferToConnect(socket, connectListener) 23 | 24 | Calls `connectListener()` when connected. 25 | 26 | ### deferToConnect(socket, listeners) 27 | 28 | #### listeners 29 | 30 | An object representing `connect`, `secureConnect` and `close` properties. 31 | 32 | Calls `connect()` when the socket is connected.
33 | Calls `secureConnect()` when the socket is securely connected.
34 | Calls `close()` when the socket is destroyed. 35 | 36 | ## License 37 | 38 | MIT 39 | -------------------------------------------------------------------------------- /node_modules/defer-to-connect/dist/source/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { Socket } from 'net'; 3 | import { TLSSocket } from 'tls'; 4 | interface Listeners { 5 | connect?: () => void; 6 | secureConnect?: () => void; 7 | close?: (hadError: boolean) => void; 8 | } 9 | declare const deferToConnect: (socket: TLSSocket | Socket, fn: Listeners | (() => void)) => void; 10 | export default deferToConnect; 11 | -------------------------------------------------------------------------------- /node_modules/defer-to-connect/dist/source/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function isTLSSocket(socket) { 4 | return socket.encrypted; 5 | } 6 | const deferToConnect = (socket, fn) => { 7 | let listeners; 8 | if (typeof fn === 'function') { 9 | const connect = fn; 10 | listeners = { connect }; 11 | } 12 | else { 13 | listeners = fn; 14 | } 15 | const hasConnectListener = typeof listeners.connect === 'function'; 16 | const hasSecureConnectListener = typeof listeners.secureConnect === 'function'; 17 | const hasCloseListener = typeof listeners.close === 'function'; 18 | const onConnect = () => { 19 | if (hasConnectListener) { 20 | listeners.connect(); 21 | } 22 | if (isTLSSocket(socket) && hasSecureConnectListener) { 23 | if (socket.authorized) { 24 | listeners.secureConnect(); 25 | } 26 | else if (!socket.authorizationError) { 27 | socket.once('secureConnect', listeners.secureConnect); 28 | } 29 | } 30 | if (hasCloseListener) { 31 | socket.once('close', listeners.close); 32 | } 33 | }; 34 | if (socket.writable && !socket.connecting) { 35 | onConnect(); 36 | } 37 | else if (socket.connecting) { 38 | socket.once('connect', onConnect); 39 | } 40 | else if (socket.destroyed && hasCloseListener) { 41 | listeners.close(socket._hadError); 42 | } 43 | }; 44 | exports.default = deferToConnect; 45 | // For CommonJS default export support 46 | module.exports = deferToConnect; 47 | module.exports.default = deferToConnect; 48 | -------------------------------------------------------------------------------- /node_modules/defer-to-connect/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "defer-to-connect", 3 | "version": "2.0.1", 4 | "description": "The safe way to handle the `connect` socket event", 5 | "main": "dist/source", 6 | "files": [ 7 | "dist/source" 8 | ], 9 | "engines": { 10 | "node": ">=10" 11 | }, 12 | "scripts": { 13 | "build": "del-cli dist && tsc", 14 | "prepare": "npm run build", 15 | "test": "xo && tsc --noEmit && nyc ava", 16 | "coveralls": "nyc report --reporter=text-lcov | coveralls" 17 | }, 18 | "keywords": [ 19 | "socket", 20 | "connect", 21 | "event" 22 | ], 23 | "author": "Szymon Marczak", 24 | "license": "MIT", 25 | "repository": { 26 | "type": "git", 27 | "url": "git+https://github.com/szmarczak/defer-to-connect.git" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/szmarczak/defer-to-connect/issues" 31 | }, 32 | "homepage": "https://github.com/szmarczak/defer-to-connect#readme", 33 | "xo": { 34 | "extends": "xo-typescript", 35 | "extensions": [ 36 | "ts" 37 | ] 38 | }, 39 | "devDependencies": { 40 | "@ava/typescript": "^1.1.0", 41 | "@sindresorhus/tsconfig": "^0.7.0", 42 | "@types/node": "^13.5.0", 43 | "@typescript-eslint/eslint-plugin": "^2.18.0", 44 | "@typescript-eslint/parser": "^2.18.0", 45 | "ava": "^3.2.0", 46 | "coveralls": "^3.0.9", 47 | "create-cert": "^1.0.6", 48 | "del-cli": "^3.0.0", 49 | "eslint-config-xo-typescript": "^0.24.1", 50 | "nyc": "^15.0.0", 51 | "p-event": "^4.1.0", 52 | "typescript": "^3.7.5", 53 | "xo": "^0.25.3" 54 | }, 55 | "nyc": { 56 | "include": [ 57 | "dist/source" 58 | ], 59 | "extension": [ 60 | ".ts" 61 | ] 62 | }, 63 | "ava": { 64 | "typescript": { 65 | "rewritePaths": { 66 | "tests/": "dist/tests/" 67 | } 68 | } 69 | }, 70 | "types": "dist/source/index.d.ts" 71 | } 72 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/FileLike.d.ts: -------------------------------------------------------------------------------- 1 | export interface FileLike { 2 | /** 3 | * Name of the file referenced by the File object. 4 | */ 5 | readonly name: string; 6 | /** 7 | * Returns the media type ([`MIME`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)) of the file represented by a `File` object. 8 | */ 9 | readonly type: string; 10 | /** 11 | * Size of the file parts in bytes 12 | */ 13 | readonly size: number; 14 | /** 15 | * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date. 16 | */ 17 | readonly lastModified: number; 18 | /** 19 | * Returns a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) which upon reading returns the data contained within the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). 20 | */ 21 | stream(): AsyncIterable; 22 | readonly [Symbol.toStringTag]: string; 23 | } 24 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/FormDataLike.d.ts: -------------------------------------------------------------------------------- 1 | import { FileLike } from "./FileLike.js"; 2 | /** 3 | * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs. 4 | */ 5 | export type FormDataEntryValue = string | FileLike; 6 | /** 7 | * This interface reflects minimal shape of the FormData 8 | */ 9 | export interface FormDataLike { 10 | /** 11 | * Appends a new value onto an existing key inside a FormData object, 12 | * or adds the key if it does not already exist. 13 | * 14 | * The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values. 15 | * 16 | * @param name The name of the field whose data is contained in `value`. 17 | * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) 18 | or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string. 19 | * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. 20 | */ 21 | append(name: string, value: unknown, fileName?: string): void; 22 | /** 23 | * Returns all the values associated with a given key from within a `FormData` object. 24 | * 25 | * @param {string} name A name of the value you want to retrieve. 26 | * 27 | * @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list. 28 | */ 29 | getAll(name: string): FormDataEntryValue[]; 30 | /** 31 | * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs. 32 | * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue). 33 | */ 34 | entries(): Generator<[string, FormDataEntryValue]>; 35 | /** 36 | * An alias for FormDataLike#entries() 37 | */ 38 | [Symbol.iterator](): Generator<[string, FormDataEntryValue]>; 39 | readonly [Symbol.toStringTag]: string; 40 | } 41 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./FormDataEncoder.js"; 2 | export * from "./FileLike.js"; 3 | export * from "./FormDataLike.js"; 4 | export * from "./util/isFile.js"; 5 | export * from "./util/isFormData.js"; 6 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/Headers.d.ts: -------------------------------------------------------------------------------- 1 | export interface RawHeaders { 2 | "Content-Type": string; 3 | "Content-Length"?: string; 4 | } 5 | export interface FormDataEncoderHeaders extends RawHeaders { 6 | "content-type": string; 7 | "content-length"?: string; 8 | } 9 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/createBoundary.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Generates a boundary string for FormData encoder. 3 | * 4 | * @api private 5 | * 6 | * ```js 7 | * import createBoundary from "./util/createBoundary" 8 | * 9 | * createBoundary() // -> n2vw38xdagaq6lrv 10 | * ``` 11 | */ 12 | export declare function createBoundary(): string; 13 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/escapeName.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Escape fieldname following the spec requirements. 3 | * 4 | * See: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data 5 | * 6 | * @param name A fieldname to escape 7 | * 8 | * @api private 9 | */ 10 | export declare const escapeName: (name: unknown) => string; 11 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/getStreamIterator.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Turns ReadableStream into async iterable when the `Symbol.asyncIterable` is not implemented on given stream. 3 | * 4 | * @param source A ReadableStream to create async iterator for 5 | */ 6 | export declare const getStreamIterator: (source: ReadableStream | AsyncIterable) => AsyncIterable; 7 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/isFile.d.ts: -------------------------------------------------------------------------------- 1 | import type { FileLike } from "../FileLike.js"; 2 | /** 3 | * Check if given object is `File`. 4 | * 5 | * Note that this function will return `false` for Blob, because the FormDataEncoder expects FormData to return File when a value is binary data. 6 | * 7 | * @param value an object to test 8 | * 9 | * @api public 10 | * 11 | * This function will return `true` for FileAPI compatible `File` objects: 12 | * 13 | * ``` 14 | * import {createReadStream} from "node:fs" 15 | * 16 | * import {isFile} from "form-data-encoder" 17 | * 18 | * isFile(new File(["Content"], "file.txt")) // -> true 19 | * ``` 20 | * 21 | * However, if you pass a Node.js `Buffer` or `ReadStream`, it will return `false`: 22 | * 23 | * ```js 24 | * import {isFile} from "form-data-encoder" 25 | * 26 | * isFile(Buffer.from("Content")) // -> false 27 | * isFile(createReadStream("path/to/a/file.txt")) // -> false 28 | * ``` 29 | */ 30 | export declare const isFile: (value: unknown) => value is FileLike; 31 | /** 32 | * @deprecated use `isFile` instead 33 | */ 34 | export declare const isFileLike: (value: unknown) => value is FileLike; 35 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/isFormData.d.ts: -------------------------------------------------------------------------------- 1 | import type { FormDataLike } from "../FormDataLike.js"; 2 | /** 3 | * Check if given object is FormData 4 | * 5 | * @param value an object to test 6 | */ 7 | export declare const isFormData: (value: unknown) => value is FormDataLike; 8 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/isFunction.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if given value is a function. 3 | * 4 | * @api private 5 | */ 6 | export declare const isFunction: (value: unknown) => value is Function; 7 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/isPlainObject.d.ts: -------------------------------------------------------------------------------- 1 | export declare function isPlainObject(value: unknown): value is object; 2 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/normalizeValue.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Normalize non-File value following the spec requirements. 3 | * 4 | * See: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data 5 | * 6 | * @param value A value to normalize 7 | * 8 | * @api private 9 | */ 10 | export declare const normalizeValue: (value: unknown) => string; 11 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/@type/util/proxyHeaders.d.ts: -------------------------------------------------------------------------------- 1 | import type { FormDataEncoderHeaders, RawHeaders } from "./Headers.js"; 2 | export declare const proxyHeaders: (object: RawHeaders) => FormDataEncoderHeaders; 3 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/FileLike.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/FormDataLike.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/index.js: -------------------------------------------------------------------------------- 1 | export * from "./FormDataEncoder.js"; 2 | export * from "./FileLike.js"; 3 | export * from "./FormDataLike.js"; 4 | export * from "./util/isFile.js"; 5 | export * from "./util/isFormData.js"; 6 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/Headers.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/createBoundary.js: -------------------------------------------------------------------------------- 1 | const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789"; 2 | export function createBoundary() { 3 | let size = 16; 4 | let res = ""; 5 | while (size--) { 6 | res += alphabet[(Math.random() * alphabet.length) << 0]; 7 | } 8 | return res; 9 | } 10 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/escapeName.js: -------------------------------------------------------------------------------- 1 | export const escapeName = (name) => String(name) 2 | .replace(/\r/g, "%0D") 3 | .replace(/\n/g, "%0A") 4 | .replace(/"/g, "%22"); 5 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/getStreamIterator.js: -------------------------------------------------------------------------------- 1 | import { isFunction } from "./isFunction.js"; 2 | const isAsyncIterable = (value) => (isFunction(value[Symbol.asyncIterator])); 3 | async function* readStream(readable) { 4 | const reader = readable.getReader(); 5 | while (true) { 6 | const { done, value } = await reader.read(); 7 | if (done) { 8 | break; 9 | } 10 | yield value; 11 | } 12 | } 13 | export const getStreamIterator = (source) => { 14 | if (isAsyncIterable(source)) { 15 | return source; 16 | } 17 | if (isFunction(source.getReader)) { 18 | return readStream(source); 19 | } 20 | throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable."); 21 | }; 22 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/isFile.js: -------------------------------------------------------------------------------- 1 | import { isFunction } from "./isFunction.js"; 2 | export const isFile = (value) => Boolean(value 3 | && typeof value === "object" 4 | && isFunction(value.constructor) 5 | && value[Symbol.toStringTag] === "File" 6 | && isFunction(value.stream) 7 | && value.name != null); 8 | export const isFileLike = isFile; 9 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/isFormData.js: -------------------------------------------------------------------------------- 1 | import { isFunction } from "./isFunction.js"; 2 | export const isFormData = (value) => Boolean(value 3 | && isFunction(value.constructor) 4 | && value[Symbol.toStringTag] === "FormData" 5 | && isFunction(value.append) 6 | && isFunction(value.getAll) 7 | && isFunction(value.entries) 8 | && isFunction(value[Symbol.iterator])); 9 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/isFunction.js: -------------------------------------------------------------------------------- 1 | export const isFunction = (value) => (typeof value === "function"); 2 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/isPlainObject.js: -------------------------------------------------------------------------------- 1 | const getType = (value) => (Object.prototype.toString.call(value).slice(8, -1).toLowerCase()); 2 | export function isPlainObject(value) { 3 | if (getType(value) !== "object") { 4 | return false; 5 | } 6 | const pp = Object.getPrototypeOf(value); 7 | if (pp === null || pp === undefined) { 8 | return true; 9 | } 10 | const Ctor = pp.constructor && pp.constructor.toString(); 11 | return Ctor === Object.toString(); 12 | } 13 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/normalizeValue.js: -------------------------------------------------------------------------------- 1 | export const normalizeValue = (value) => String(value) 2 | .replace(/\r|\n/g, (match, i, str) => { 3 | if ((match === "\r" && str[i + 1] !== "\n") 4 | || (match === "\n" && str[i - 1] !== "\r")) { 5 | return "\r\n"; 6 | } 7 | return match; 8 | }); 9 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/lib/util/proxyHeaders.js: -------------------------------------------------------------------------------- 1 | function getProperty(target, prop) { 2 | if (typeof prop === "string") { 3 | for (const [name, value] of Object.entries(target)) { 4 | if (prop.toLowerCase() === name.toLowerCase()) { 5 | return value; 6 | } 7 | } 8 | } 9 | return undefined; 10 | } 11 | export const proxyHeaders = (object) => new Proxy(object, { 12 | get: (target, prop) => getProperty(target, prop), 13 | has: (target, prop) => getProperty(target, prop) !== undefined 14 | }); 15 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021-present Nick K. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/form-data-encoder/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "name": "form-data-encoder", 4 | "version": "2.1.4", 5 | "description": "Encode FormData content into the multipart/form-data format", 6 | "repository": "octet-stream/form-data-encoder", 7 | "sideEffects": false, 8 | "engines": { 9 | "node": ">= 14.17" 10 | }, 11 | "keywords": [ 12 | "form-data", 13 | "encoder", 14 | "multipart", 15 | "files-upload", 16 | "async-iterator", 17 | "spec-compatible", 18 | "form" 19 | ], 20 | "main": "./lib/index.js", 21 | "module": "./lib/index.js", 22 | "exports": { 23 | "types": "./@type/index.d.ts", 24 | "default": "./lib/index.js" 25 | }, 26 | "types": "./@type/index.d.ts", 27 | "scripts": { 28 | "eslint": "eslint src/**/*.ts", 29 | "staged": "lint-staged", 30 | "coverage": "c8 npm test", 31 | "ci": "c8 npm test && c8 report --reporter=json", 32 | "build:types": "tsc --project tsconfig.d.ts.json", 33 | "build": "tsc && npm run build:types", 34 | "test": "ava --fail-fast", 35 | "cleanup": "del-cli @type lib", 36 | "prepare": "npm run cleanup && npm run build", 37 | "_postinstall": "husky install", 38 | "prepublishOnly": "pinst --disable", 39 | "postpublish": "pinst --enable" 40 | }, 41 | "author": "Nick K.", 42 | "license": "MIT", 43 | "devDependencies": { 44 | "@octetstream/eslint-config": "6.2.2", 45 | "@types/mime-types": "2.1.1", 46 | "@types/node": "18.11.9", 47 | "@types/sinon": "^10.0.13", 48 | "@typescript-eslint/eslint-plugin": "5.44.0", 49 | "@typescript-eslint/parser": "5.44.0", 50 | "ava": "5.1.0", 51 | "c8": "7.12.0", 52 | "del-cli": "5.0.0", 53 | "eslint": "8.28.0", 54 | "eslint-config-airbnb-typescript": "17.0.0", 55 | "eslint-import-resolver-typescript": "3.5.2", 56 | "eslint-plugin-ava": "13.2.0", 57 | "eslint-plugin-import": "^2.26.0", 58 | "eslint-plugin-jsx-a11y": "6.6.1", 59 | "eslint-plugin-react": "7.31.11", 60 | "formdata-node": "5.0.0", 61 | "husky": "8.0.2", 62 | "lint-staged": "13.0.3", 63 | "pinst": "3.0.0", 64 | "sinon": "^14.0.2", 65 | "ts-node": "10.9.1", 66 | "ttypescript": "1.5.13", 67 | "typescript": "4.9.3", 68 | "web-streams-polyfill": "4.0.0-beta.3" 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/get-stream/buffer-stream.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {PassThrough: PassThroughStream} = require('stream'); 3 | 4 | module.exports = options => { 5 | options = {...options}; 6 | 7 | const {array} = options; 8 | let {encoding} = options; 9 | const isBuffer = encoding === 'buffer'; 10 | let objectMode = false; 11 | 12 | if (array) { 13 | objectMode = !(encoding || isBuffer); 14 | } else { 15 | encoding = encoding || 'utf8'; 16 | } 17 | 18 | if (isBuffer) { 19 | encoding = null; 20 | } 21 | 22 | const stream = new PassThroughStream({objectMode}); 23 | 24 | if (encoding) { 25 | stream.setEncoding(encoding); 26 | } 27 | 28 | let length = 0; 29 | const chunks = []; 30 | 31 | stream.on('data', chunk => { 32 | chunks.push(chunk); 33 | 34 | if (objectMode) { 35 | length = chunks.length; 36 | } else { 37 | length += chunk.length; 38 | } 39 | }); 40 | 41 | stream.getBufferedValue = () => { 42 | if (array) { 43 | return chunks; 44 | } 45 | 46 | return isBuffer ? Buffer.concat(chunks, length) : chunks.join(''); 47 | }; 48 | 49 | stream.getBufferedLength = () => length; 50 | 51 | return stream; 52 | }; 53 | -------------------------------------------------------------------------------- /node_modules/get-stream/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import {Stream} from 'stream'; 3 | 4 | declare class MaxBufferErrorClass extends Error { 5 | readonly name: 'MaxBufferError'; 6 | constructor(); 7 | } 8 | 9 | declare namespace getStream { 10 | interface Options { 11 | /** 12 | Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `MaxBufferError` error. 13 | 14 | @default Infinity 15 | */ 16 | readonly maxBuffer?: number; 17 | } 18 | 19 | interface OptionsWithEncoding extends Options { 20 | /** 21 | [Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. 22 | 23 | @default 'utf8' 24 | */ 25 | readonly encoding?: EncodingType; 26 | } 27 | 28 | type MaxBufferError = MaxBufferErrorClass; 29 | } 30 | 31 | declare const getStream: { 32 | /** 33 | Get the `stream` as a string. 34 | 35 | @returns A promise that resolves when the end event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. 36 | 37 | @example 38 | ``` 39 | import * as fs from 'fs'; 40 | import getStream = require('get-stream'); 41 | 42 | (async () => { 43 | const stream = fs.createReadStream('unicorn.txt'); 44 | 45 | console.log(await getStream(stream)); 46 | // ,,))))))));, 47 | // __)))))))))))))), 48 | // \|/ -\(((((''''((((((((. 49 | // -*-==//////(('' . `)))))), 50 | // /|\ ))| o ;-. '((((( ,(, 51 | // ( `| / ) ;))))' ,_))^;(~ 52 | // | | | ,))((((_ _____------~~~-. %,;(;(>';'~ 53 | // o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ 54 | // ; ''''```` `: `:::|\,__,%% );`'; ~ 55 | // | _ ) / `:|`----' `-' 56 | // ______/\/~ | / / 57 | // /~;;.____/;;' / ___--,-( `;;;/ 58 | // / // _;______;'------~~~~~ /;;/\ / 59 | // // | | / ; \;;,\ 60 | // (<_ | ; /',/-----' _> 61 | // \_| ||_ //~;~~~~~~~~~ 62 | // `\_| (,~~ 63 | // \~\ 64 | // ~~ 65 | })(); 66 | ``` 67 | */ 68 | (stream: Stream, options?: getStream.OptionsWithEncoding): Promise; 69 | 70 | /** 71 | Get the `stream` as a buffer. 72 | 73 | It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. 74 | */ 75 | buffer( 76 | stream: Stream, 77 | options?: getStream.Options 78 | ): Promise; 79 | 80 | /** 81 | Get the `stream` as an array of values. 82 | 83 | It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: 84 | 85 | - When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). 86 | - When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. 87 | - When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. 88 | */ 89 | array( 90 | stream: Stream, 91 | options?: getStream.Options 92 | ): Promise; 93 | array( 94 | stream: Stream, 95 | options: getStream.OptionsWithEncoding<'buffer'> 96 | ): Promise; 97 | array( 98 | stream: Stream, 99 | options: getStream.OptionsWithEncoding 100 | ): Promise; 101 | 102 | MaxBufferError: typeof MaxBufferErrorClass; 103 | }; 104 | 105 | export = getStream; 106 | -------------------------------------------------------------------------------- /node_modules/get-stream/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {constants: BufferConstants} = require('buffer'); 3 | const stream = require('stream'); 4 | const {promisify} = require('util'); 5 | const bufferStream = require('./buffer-stream'); 6 | 7 | const streamPipelinePromisified = promisify(stream.pipeline); 8 | 9 | class MaxBufferError extends Error { 10 | constructor() { 11 | super('maxBuffer exceeded'); 12 | this.name = 'MaxBufferError'; 13 | } 14 | } 15 | 16 | async function getStream(inputStream, options) { 17 | if (!inputStream) { 18 | throw new Error('Expected a stream'); 19 | } 20 | 21 | options = { 22 | maxBuffer: Infinity, 23 | ...options 24 | }; 25 | 26 | const {maxBuffer} = options; 27 | const stream = bufferStream(options); 28 | 29 | await new Promise((resolve, reject) => { 30 | const rejectPromise = error => { 31 | // Don't retrieve an oversized buffer. 32 | if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) { 33 | error.bufferedData = stream.getBufferedValue(); 34 | } 35 | 36 | reject(error); 37 | }; 38 | 39 | (async () => { 40 | try { 41 | await streamPipelinePromisified(inputStream, stream); 42 | resolve(); 43 | } catch (error) { 44 | rejectPromise(error); 45 | } 46 | })(); 47 | 48 | stream.on('data', () => { 49 | if (stream.getBufferedLength() > maxBuffer) { 50 | rejectPromise(new MaxBufferError()); 51 | } 52 | }); 53 | }); 54 | 55 | return stream.getBufferedValue(); 56 | } 57 | 58 | module.exports = getStream; 59 | module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'}); 60 | module.exports.array = (stream, options) => getStream(stream, {...options, array: true}); 61 | module.exports.MaxBufferError = MaxBufferError; 62 | -------------------------------------------------------------------------------- /node_modules/get-stream/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/get-stream/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get-stream", 3 | "version": "6.0.1", 4 | "description": "Get a stream as a string, buffer, or array", 5 | "license": "MIT", 6 | "repository": "sindresorhus/get-stream", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "engines": { 14 | "node": ">=10" 15 | }, 16 | "scripts": { 17 | "test": "xo && ava && tsd" 18 | }, 19 | "files": [ 20 | "index.js", 21 | "index.d.ts", 22 | "buffer-stream.js" 23 | ], 24 | "keywords": [ 25 | "get", 26 | "stream", 27 | "promise", 28 | "concat", 29 | "string", 30 | "text", 31 | "buffer", 32 | "read", 33 | "data", 34 | "consume", 35 | "readable", 36 | "readablestream", 37 | "array", 38 | "object" 39 | ], 40 | "devDependencies": { 41 | "@types/node": "^14.0.27", 42 | "ava": "^2.4.0", 43 | "into-stream": "^5.0.0", 44 | "tsd": "^0.13.1", 45 | "xo": "^0.24.0" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /node_modules/get-stream/readme.md: -------------------------------------------------------------------------------- 1 | # get-stream 2 | 3 | > Get a stream as a string, buffer, or array 4 | 5 | ## Install 6 | 7 | ``` 8 | $ npm install get-stream 9 | ``` 10 | 11 | ## Usage 12 | 13 | ```js 14 | const fs = require('fs'); 15 | const getStream = require('get-stream'); 16 | 17 | (async () => { 18 | const stream = fs.createReadStream('unicorn.txt'); 19 | 20 | console.log(await getStream(stream)); 21 | /* 22 | ,,))))))));, 23 | __)))))))))))))), 24 | \|/ -\(((((''''((((((((. 25 | -*-==//////(('' . `)))))), 26 | /|\ ))| o ;-. '((((( ,(, 27 | ( `| / ) ;))))' ,_))^;(~ 28 | | | | ,))((((_ _____------~~~-. %,;(;(>';'~ 29 | o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ 30 | ; ''''```` `: `:::|\,__,%% );`'; ~ 31 | | _ ) / `:|`----' `-' 32 | ______/\/~ | / / 33 | /~;;.____/;;' / ___--,-( `;;;/ 34 | / // _;______;'------~~~~~ /;;/\ / 35 | // | | / ; \;;,\ 36 | (<_ | ; /',/-----' _> 37 | \_| ||_ //~;~~~~~~~~~ 38 | `\_| (,~~ 39 | \~\ 40 | ~~ 41 | */ 42 | })(); 43 | ``` 44 | 45 | ## API 46 | 47 | The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. 48 | 49 | ### getStream(stream, options?) 50 | 51 | Get the `stream` as a string. 52 | 53 | #### options 54 | 55 | Type: `object` 56 | 57 | ##### encoding 58 | 59 | Type: `string`\ 60 | Default: `'utf8'` 61 | 62 | [Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. 63 | 64 | ##### maxBuffer 65 | 66 | Type: `number`\ 67 | Default: `Infinity` 68 | 69 | Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `getStream.MaxBufferError` error. 70 | 71 | ### getStream.buffer(stream, options?) 72 | 73 | Get the `stream` as a buffer. 74 | 75 | It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. 76 | 77 | ### getStream.array(stream, options?) 78 | 79 | Get the `stream` as an array of values. 80 | 81 | It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: 82 | 83 | - When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). 84 | 85 | - When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. 86 | 87 | - When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. 88 | 89 | ## Errors 90 | 91 | If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. 92 | 93 | ```js 94 | (async () => { 95 | try { 96 | await getStream(streamThatErrorsAtTheEnd('unicorn')); 97 | } catch (error) { 98 | console.log(error.bufferedData); 99 | //=> 'unicorn' 100 | } 101 | })() 102 | ``` 103 | 104 | ## FAQ 105 | 106 | ### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)? 107 | 108 | This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package. 109 | 110 | ## Related 111 | 112 | - [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer 113 | 114 | --- 115 | 116 |
117 | 118 | Get professional support for this package with a Tidelift subscription 119 | 120 |
121 | 122 | Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. 123 |
124 |
125 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/as-promise/index.d.ts: -------------------------------------------------------------------------------- 1 | import Request from '../core/index.js'; 2 | import { type CancelableRequest } from './types.js'; 3 | export default function asPromise(firstRequest?: Request): CancelableRequest; 4 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/as-promise/types.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { Buffer } from 'node:buffer'; 3 | import type PCancelable from 'p-cancelable'; 4 | import { RequestError } from '../core/errors.js'; 5 | import type Request from '../core/index.js'; 6 | import type { RequestEvents } from '../core/index.js'; 7 | import type { Response } from '../core/response.js'; 8 | /** 9 | An error to be thrown when the request is aborted with `.cancel()`. 10 | */ 11 | export declare class CancelError extends RequestError { 12 | readonly response: Response; 13 | constructor(request: Request); 14 | /** 15 | Whether the promise is canceled. 16 | */ 17 | get isCanceled(): boolean; 18 | } 19 | export interface CancelableRequest extends PCancelable, RequestEvents> { 20 | /** 21 | A shortcut method that gives a Promise returning a JSON object. 22 | 23 | It is semantically the same as settings `options.resolveBodyOnly` to `true` and `options.responseType` to `'json'`. 24 | */ 25 | json: () => CancelableRequest; 26 | /** 27 | A shortcut method that gives a Promise returning a [Buffer](https://nodejs.org/api/buffer.html). 28 | 29 | It is semantically the same as settings `options.resolveBodyOnly` to `true` and `options.responseType` to `'buffer'`. 30 | */ 31 | buffer: () => CancelableRequest; 32 | /** 33 | A shortcut method that gives a Promise returning a string. 34 | 35 | It is semantically the same as settings `options.resolveBodyOnly` to `true` and `options.responseType` to `'text'`. 36 | */ 37 | text: () => CancelableRequest; 38 | } 39 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/as-promise/types.js: -------------------------------------------------------------------------------- 1 | import { RequestError } from '../core/errors.js'; 2 | /** 3 | An error to be thrown when the request is aborted with `.cancel()`. 4 | */ 5 | export class CancelError extends RequestError { 6 | constructor(request) { 7 | super('Promise was canceled', {}, request); 8 | this.name = 'CancelError'; 9 | this.code = 'ERR_CANCELED'; 10 | } 11 | /** 12 | Whether the promise is canceled. 13 | */ 14 | get isCanceled() { 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/calculate-retry-delay.d.ts: -------------------------------------------------------------------------------- 1 | import type { RetryFunction } from './options.js'; 2 | type Returns unknown, V> = (...args: Parameters) => V; 3 | declare const calculateRetryDelay: Returns; 4 | export default calculateRetryDelay; 5 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/calculate-retry-delay.js: -------------------------------------------------------------------------------- 1 | const calculateRetryDelay = ({ attemptCount, retryOptions, error, retryAfter, computedValue, }) => { 2 | if (error.name === 'RetryError') { 3 | return 1; 4 | } 5 | if (attemptCount > retryOptions.limit) { 6 | return 0; 7 | } 8 | const hasMethod = retryOptions.methods.includes(error.options.method); 9 | const hasErrorCode = retryOptions.errorCodes.includes(error.code); 10 | const hasStatusCode = error.response && retryOptions.statusCodes.includes(error.response.statusCode); 11 | if (!hasMethod || (!hasErrorCode && !hasStatusCode)) { 12 | return 0; 13 | } 14 | if (error.response) { 15 | if (retryAfter) { 16 | // In this case `computedValue` is `options.request.timeout` 17 | if (retryAfter > computedValue) { 18 | return 0; 19 | } 20 | return retryAfter; 21 | } 22 | if (error.response.statusCode === 413) { 23 | return 0; 24 | } 25 | } 26 | const noise = Math.random() * retryOptions.noise; 27 | return Math.min(((2 ** (attemptCount - 1)) * 1000), retryOptions.backoffLimit) + noise; 28 | }; 29 | export default calculateRetryDelay; 30 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/errors.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { Timings } from '@szmarczak/http-timer'; 3 | import type Options from './options.js'; 4 | import type { TimeoutError as TimedOutTimeoutError } from './timed-out.js'; 5 | import type { PlainResponse, Response } from './response.js'; 6 | import type Request from './index.js'; 7 | type Error = NodeJS.ErrnoException; 8 | /** 9 | An error to be thrown when a request fails. 10 | Contains a `code` property with error class code, like `ECONNREFUSED`. 11 | */ 12 | export declare class RequestError extends Error { 13 | input?: string; 14 | code: string; 15 | stack: string; 16 | readonly options: Options; 17 | readonly response?: Response; 18 | readonly request?: Request; 19 | readonly timings?: Timings; 20 | constructor(message: string, error: Partial, self: Request | Options); 23 | } 24 | /** 25 | An error to be thrown when the server redirects you more than ten times. 26 | Includes a `response` property. 27 | */ 28 | export declare class MaxRedirectsError extends RequestError { 29 | readonly response: Response; 30 | readonly request: Request; 31 | readonly timings: Timings; 32 | constructor(request: Request); 33 | } 34 | /** 35 | An error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304. 36 | Includes a `response` property. 37 | */ 38 | export declare class HTTPError extends RequestError { 39 | readonly response: Response; 40 | readonly request: Request; 41 | readonly timings: Timings; 42 | constructor(response: PlainResponse); 43 | } 44 | /** 45 | An error to be thrown when a cache method fails. 46 | For example, if the database goes down or there's a filesystem error. 47 | */ 48 | export declare class CacheError extends RequestError { 49 | readonly request: Request; 50 | constructor(error: Error, request: Request); 51 | } 52 | /** 53 | An error to be thrown when the request body is a stream and an error occurs while reading from that stream. 54 | */ 55 | export declare class UploadError extends RequestError { 56 | readonly request: Request; 57 | constructor(error: Error, request: Request); 58 | } 59 | /** 60 | An error to be thrown when the request is aborted due to a timeout. 61 | Includes an `event` and `timings` property. 62 | */ 63 | export declare class TimeoutError extends RequestError { 64 | readonly request: Request; 65 | readonly timings: Timings; 66 | readonly event: string; 67 | constructor(error: TimedOutTimeoutError, timings: Timings, request: Request); 68 | } 69 | /** 70 | An error to be thrown when reading from response stream fails. 71 | */ 72 | export declare class ReadError extends RequestError { 73 | readonly request: Request; 74 | readonly response: Response; 75 | readonly timings: Timings; 76 | constructor(error: Error, request: Request); 77 | } 78 | /** 79 | An error which always triggers a new retry when thrown. 80 | */ 81 | export declare class RetryError extends RequestError { 82 | constructor(request: Request); 83 | } 84 | /** 85 | An error to be thrown when the request is aborted by AbortController. 86 | */ 87 | export declare class AbortError extends RequestError { 88 | constructor(request: Request); 89 | } 90 | export {}; 91 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/parse-link-header.d.ts: -------------------------------------------------------------------------------- 1 | export default function parseLinkHeader(link: string): { 2 | reference: string; 3 | parameters: Record; 4 | }[]; 5 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/parse-link-header.js: -------------------------------------------------------------------------------- 1 | export default function parseLinkHeader(link) { 2 | const parsed = []; 3 | const items = link.split(','); 4 | for (const item of items) { 5 | // https://tools.ietf.org/html/rfc5988#section-5 6 | const [rawUriReference, ...rawLinkParameters] = item.split(';'); 7 | const trimmedUriReference = rawUriReference.trim(); 8 | // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with 9 | if (trimmedUriReference[0] !== '<' || trimmedUriReference[trimmedUriReference.length - 1] !== '>') { 10 | throw new Error(`Invalid format of the Link header reference: ${trimmedUriReference}`); 11 | } 12 | const reference = trimmedUriReference.slice(1, -1); 13 | const parameters = {}; 14 | if (rawLinkParameters.length === 0) { 15 | throw new Error(`Unexpected end of Link header parameters: ${rawLinkParameters.join(';')}`); 16 | } 17 | for (const rawParameter of rawLinkParameters) { 18 | const trimmedRawParameter = rawParameter.trim(); 19 | const center = trimmedRawParameter.indexOf('='); 20 | if (center === -1) { 21 | throw new Error(`Failed to parse Link header: ${link}`); 22 | } 23 | const name = trimmedRawParameter.slice(0, center).trim(); 24 | const value = trimmedRawParameter.slice(center + 1).trim(); 25 | parameters[name] = value; 26 | } 27 | parsed.push({ 28 | reference, 29 | parameters, 30 | }); 31 | } 32 | return parsed; 33 | } 34 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/response.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | import type { Buffer } from 'node:buffer'; 4 | import type { IncomingMessageWithTimings, Timings } from '@szmarczak/http-timer'; 5 | import { RequestError } from './errors.js'; 6 | import type { ParseJsonFunction, ResponseType } from './options.js'; 7 | import type Request from './index.js'; 8 | export type PlainResponse = { 9 | /** 10 | The original request URL. 11 | */ 12 | requestUrl: URL; 13 | /** 14 | The redirect URLs. 15 | */ 16 | redirectUrls: URL[]; 17 | /** 18 | - `options` - The Got options that were set on this request. 19 | 20 | __Note__: This is not a [http.ClientRequest](https://nodejs.org/api/http.html#http_class_http_clientrequest). 21 | */ 22 | request: Request; 23 | /** 24 | The remote IP address. 25 | 26 | This is hopefully a temporary limitation, see [lukechilds/cacheable-request#86](https://github.com/lukechilds/cacheable-request/issues/86). 27 | 28 | __Note__: Not available when the response is cached. 29 | */ 30 | ip?: string; 31 | /** 32 | Whether the response was retrieved from the cache. 33 | */ 34 | isFromCache: boolean; 35 | /** 36 | The status code of the response. 37 | */ 38 | statusCode: number; 39 | /** 40 | The request URL or the final URL after redirects. 41 | */ 42 | url: string; 43 | /** 44 | The object contains the following properties: 45 | 46 | - `start` - Time when the request started. 47 | - `socket` - Time when a socket was assigned to the request. 48 | - `lookup` - Time when the DNS lookup finished. 49 | - `connect` - Time when the socket successfully connected. 50 | - `secureConnect` - Time when the socket securely connected. 51 | - `upload` - Time when the request finished uploading. 52 | - `response` - Time when the request fired `response` event. 53 | - `end` - Time when the response fired `end` event. 54 | - `error` - Time when the request fired `error` event. 55 | - `abort` - Time when the request fired `abort` event. 56 | - `phases` 57 | - `wait` - `timings.socket - timings.start` 58 | - `dns` - `timings.lookup - timings.socket` 59 | - `tcp` - `timings.connect - timings.lookup` 60 | - `tls` - `timings.secureConnect - timings.connect` 61 | - `request` - `timings.upload - (timings.secureConnect || timings.connect)` 62 | - `firstByte` - `timings.response - timings.upload` 63 | - `download` - `timings.end - timings.response` 64 | - `total` - `(timings.end || timings.error || timings.abort) - timings.start` 65 | 66 | If something has not been measured yet, it will be `undefined`. 67 | 68 | __Note__: The time is a `number` representing the milliseconds elapsed since the UNIX epoch. 69 | */ 70 | timings: Timings; 71 | /** 72 | The number of times the request was retried. 73 | */ 74 | retryCount: number; 75 | /** 76 | The raw result of the request. 77 | */ 78 | rawBody?: Buffer; 79 | /** 80 | The result of the request. 81 | */ 82 | body?: unknown; 83 | /** 84 | Whether the response was successful. 85 | 86 | __Note__: Got throws automatically when `response.ok` is `false` and `throwHttpErrors` is `true`. 87 | */ 88 | ok: boolean; 89 | } & IncomingMessageWithTimings; 90 | export type Response = { 91 | /** 92 | The result of the request. 93 | */ 94 | body: T; 95 | /** 96 | The raw result of the request. 97 | */ 98 | rawBody: Buffer; 99 | } & PlainResponse; 100 | export declare const isResponseOk: (response: PlainResponse) => boolean; 101 | /** 102 | An error to be thrown when server response code is 2xx, and parsing body fails. 103 | Includes a `response` property. 104 | */ 105 | export declare class ParseError extends RequestError { 106 | readonly response: Response; 107 | constructor(error: Error, response: Response); 108 | } 109 | export declare const parseBody: (response: Response, responseType: ResponseType, parseJson: ParseJsonFunction, encoding?: BufferEncoding) => unknown; 110 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/response.js: -------------------------------------------------------------------------------- 1 | import { RequestError } from './errors.js'; 2 | export const isResponseOk = (response) => { 3 | const { statusCode } = response; 4 | const limitStatusCode = response.request.options.followRedirect ? 299 : 399; 5 | return (statusCode >= 200 && statusCode <= limitStatusCode) || statusCode === 304; 6 | }; 7 | /** 8 | An error to be thrown when server response code is 2xx, and parsing body fails. 9 | Includes a `response` property. 10 | */ 11 | export class ParseError extends RequestError { 12 | constructor(error, response) { 13 | const { options } = response.request; 14 | super(`${error.message} in "${options.url.toString()}"`, error, response.request); 15 | this.name = 'ParseError'; 16 | this.code = 'ERR_BODY_PARSE_FAILURE'; 17 | } 18 | } 19 | export const parseBody = (response, responseType, parseJson, encoding) => { 20 | const { rawBody } = response; 21 | try { 22 | if (responseType === 'text') { 23 | return rawBody.toString(encoding); 24 | } 25 | if (responseType === 'json') { 26 | return rawBody.length === 0 ? '' : parseJson(rawBody.toString(encoding)); 27 | } 28 | if (responseType === 'buffer') { 29 | return rawBody; 30 | } 31 | } 32 | catch (error) { 33 | throw new ParseError(error, response); 34 | } 35 | throw new ParseError({ 36 | message: `Unknown body type '${responseType}'`, 37 | name: 'Error', 38 | }, response); 39 | }; 40 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/timed-out.d.ts: -------------------------------------------------------------------------------- 1 | import type { ClientRequest } from 'node:http'; 2 | declare const reentry: unique symbol; 3 | type TimedOutOptions = { 4 | host?: string; 5 | hostname?: string; 6 | protocol?: string; 7 | }; 8 | export type Delays = { 9 | lookup?: number; 10 | socket?: number; 11 | connect?: number; 12 | secureConnect?: number; 13 | send?: number; 14 | response?: number; 15 | read?: number; 16 | request?: number; 17 | }; 18 | export type ErrorCode = 'ETIMEDOUT' | 'ECONNRESET' | 'EADDRINUSE' | 'ECONNREFUSED' | 'EPIPE' | 'ENOTFOUND' | 'ENETUNREACH' | 'EAI_AGAIN'; 19 | export declare class TimeoutError extends Error { 20 | event: string; 21 | code: ErrorCode; 22 | constructor(threshold: number, event: string); 23 | } 24 | export default function timedOut(request: ClientRequest, delays: Delays, options: TimedOutOptions): () => void; 25 | declare module 'http' { 26 | interface ClientRequest { 27 | [reentry]?: boolean; 28 | } 29 | } 30 | export {}; 31 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/get-body-size.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { ClientRequestArgs } from 'node:http'; 3 | export default function getBodySize(body: unknown, headers: ClientRequestArgs['headers']): Promise; 4 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/get-body-size.js: -------------------------------------------------------------------------------- 1 | import { Buffer } from 'node:buffer'; 2 | import { promisify } from 'node:util'; 3 | import is from '@sindresorhus/is'; 4 | import isFormData from './is-form-data.js'; 5 | export default async function getBodySize(body, headers) { 6 | if (headers && 'content-length' in headers) { 7 | return Number(headers['content-length']); 8 | } 9 | if (!body) { 10 | return 0; 11 | } 12 | if (is.string(body)) { 13 | return Buffer.byteLength(body); 14 | } 15 | if (is.buffer(body)) { 16 | return body.length; 17 | } 18 | if (isFormData(body)) { 19 | return promisify(body.getLength.bind(body))(); 20 | } 21 | return undefined; 22 | } 23 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/is-client-request.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { Writable, Readable } from 'node:stream'; 3 | import type { ClientRequest } from 'node:http'; 4 | declare function isClientRequest(clientRequest: Writable | Readable): clientRequest is ClientRequest; 5 | export default isClientRequest; 6 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/is-client-request.js: -------------------------------------------------------------------------------- 1 | function isClientRequest(clientRequest) { 2 | return clientRequest.writable && !clientRequest.writableEnded; 3 | } 4 | export default isClientRequest; 5 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/is-form-data.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { Readable } from 'node:stream'; 3 | type FormData = { 4 | getBoundary: () => string; 5 | getLength: (callback: (error: Error | null, length: number) => void) => void; 6 | } & Readable; 7 | export default function isFormData(body: unknown): body is FormData; 8 | export {}; 9 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/is-form-data.js: -------------------------------------------------------------------------------- 1 | import is from '@sindresorhus/is'; 2 | export default function isFormData(body) { 3 | return is.nodeStream(body) && is.function_(body.getBoundary); 4 | } 5 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/is-unix-socket-url.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export default function isUnixSocketURL(url: URL): boolean; 3 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/is-unix-socket-url.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/naming-convention 2 | export default function isUnixSocketURL(url) { 3 | return url.protocol === 'unix:' || url.hostname === 'unix'; 4 | } 5 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/options-to-url.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export type URLOptions = { 3 | href?: string; 4 | protocol?: string; 5 | host?: string; 6 | hostname?: string; 7 | port?: string | number; 8 | pathname?: string; 9 | search?: string; 10 | searchParams?: unknown; 11 | path?: string; 12 | }; 13 | export default function optionsToUrl(origin: string, options: URLOptions): URL; 14 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/options-to-url.js: -------------------------------------------------------------------------------- 1 | const keys = [ 2 | 'protocol', 3 | 'host', 4 | 'hostname', 5 | 'port', 6 | 'pathname', 7 | 'search', 8 | ]; 9 | export default function optionsToUrl(origin, options) { 10 | if (options.path) { 11 | if (options.pathname) { 12 | throw new TypeError('Parameters `path` and `pathname` are mutually exclusive.'); 13 | } 14 | if (options.search) { 15 | throw new TypeError('Parameters `path` and `search` are mutually exclusive.'); 16 | } 17 | if (options.searchParams) { 18 | throw new TypeError('Parameters `path` and `searchParams` are mutually exclusive.'); 19 | } 20 | } 21 | if (options.search && options.searchParams) { 22 | throw new TypeError('Parameters `search` and `searchParams` are mutually exclusive.'); 23 | } 24 | if (!origin) { 25 | if (!options.protocol) { 26 | throw new TypeError('No URL protocol specified'); 27 | } 28 | origin = `${options.protocol}//${options.hostname ?? options.host ?? ''}`; 29 | } 30 | const url = new URL(origin); 31 | if (options.path) { 32 | const searchIndex = options.path.indexOf('?'); 33 | if (searchIndex === -1) { 34 | options.pathname = options.path; 35 | } 36 | else { 37 | options.pathname = options.path.slice(0, searchIndex); 38 | options.search = options.path.slice(searchIndex + 1); 39 | } 40 | delete options.path; 41 | } 42 | for (const key of keys) { 43 | if (options[key]) { 44 | url[key] = options[key].toString(); 45 | } 46 | } 47 | return url; 48 | } 49 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/proxy-events.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { EventEmitter } from 'node:events'; 3 | export default function proxyEvents(from: EventEmitter, to: EventEmitter, events: Readonly): () => void; 4 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/proxy-events.js: -------------------------------------------------------------------------------- 1 | export default function proxyEvents(from, to, events) { 2 | const eventFunctions = {}; 3 | for (const event of events) { 4 | const eventFunction = (...args) => { 5 | to.emit(event, ...args); 6 | }; 7 | eventFunctions[event] = eventFunction; 8 | from.on(event, eventFunction); 9 | } 10 | return () => { 11 | for (const [event, eventFunction] of Object.entries(eventFunctions)) { 12 | from.off(event, eventFunction); 13 | } 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/unhandle.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { EventEmitter } from 'node:events'; 3 | type Origin = EventEmitter; 4 | type Event = string | symbol; 5 | type Fn = (...args: any[]) => void; 6 | type Unhandler = { 7 | once: (origin: Origin, event: Event, fn: Fn) => void; 8 | unhandleAll: () => void; 9 | }; 10 | export default function unhandle(): Unhandler; 11 | export {}; 12 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/unhandle.js: -------------------------------------------------------------------------------- 1 | // When attaching listeners, it's very easy to forget about them. 2 | // Especially if you do error handling and set timeouts. 3 | // So instead of checking if it's proper to throw an error on every timeout ever, 4 | // use this simple tool which will remove all listeners you have attached. 5 | export default function unhandle() { 6 | const handlers = []; 7 | return { 8 | once(origin, event, fn) { 9 | origin.once(event, fn); 10 | handlers.push({ origin, event, fn }); 11 | }, 12 | unhandleAll() { 13 | for (const handler of handlers) { 14 | const { origin, event, fn } = handler; 15 | origin.removeListener(event, fn); 16 | } 17 | handlers.length = 0; 18 | }, 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/url-to-options.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type { UrlWithStringQuery } from 'node:url'; 3 | export type LegacyUrlOptions = { 4 | protocol: string; 5 | hostname: string; 6 | host: string; 7 | hash: string | null; 8 | search: string | null; 9 | pathname: string; 10 | href: string; 11 | path: string; 12 | port?: number; 13 | auth?: string; 14 | }; 15 | export default function urlToOptions(url: URL | UrlWithStringQuery): LegacyUrlOptions; 16 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/url-to-options.js: -------------------------------------------------------------------------------- 1 | import is from '@sindresorhus/is'; 2 | export default function urlToOptions(url) { 3 | // Cast to URL 4 | url = url; 5 | const options = { 6 | protocol: url.protocol, 7 | hostname: is.string(url.hostname) && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, 8 | host: url.host, 9 | hash: url.hash, 10 | search: url.search, 11 | pathname: url.pathname, 12 | href: url.href, 13 | path: `${url.pathname || ''}${url.search || ''}`, 14 | }; 15 | if (is.string(url.port) && url.port.length > 0) { 16 | options.port = Number(url.port); 17 | } 18 | if (url.username || url.password) { 19 | options.auth = `${url.username || ''}:${url.password || ''}`; 20 | } 21 | return options; 22 | } 23 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/weakable-map.d.ts: -------------------------------------------------------------------------------- 1 | export default class WeakableMap { 2 | weakMap: WeakMap, V>; 3 | map: Map; 4 | constructor(); 5 | set(key: K, value: V): void; 6 | get(key: K): V | undefined; 7 | has(key: K): boolean; 8 | } 9 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/core/utils/weakable-map.js: -------------------------------------------------------------------------------- 1 | export default class WeakableMap { 2 | constructor() { 3 | Object.defineProperty(this, "weakMap", { 4 | enumerable: true, 5 | configurable: true, 6 | writable: true, 7 | value: void 0 8 | }); 9 | Object.defineProperty(this, "map", { 10 | enumerable: true, 11 | configurable: true, 12 | writable: true, 13 | value: void 0 14 | }); 15 | this.weakMap = new WeakMap(); 16 | this.map = new Map(); 17 | } 18 | set(key, value) { 19 | if (typeof key === 'object') { 20 | this.weakMap.set(key, value); 21 | } 22 | else { 23 | this.map.set(key, value); 24 | } 25 | } 26 | get(key) { 27 | if (typeof key === 'object') { 28 | return this.weakMap.get(key); 29 | } 30 | return this.map.get(key); 31 | } 32 | has(key) { 33 | if (typeof key === 'object') { 34 | return this.weakMap.has(key); 35 | } 36 | return this.map.has(key); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/create.d.ts: -------------------------------------------------------------------------------- 1 | import type { Got, InstanceDefaults } from './types.js'; 2 | declare const create: (defaults: InstanceDefaults) => Got; 3 | export default create; 4 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/index.d.ts: -------------------------------------------------------------------------------- 1 | declare const got: import("./types.js").Got; 2 | export default got; 3 | export { got }; 4 | export { default as Options } from './core/options.js'; 5 | export * from './core/options.js'; 6 | export * from './core/response.js'; 7 | export type { default as Request } from './core/index.js'; 8 | export * from './core/index.js'; 9 | export * from './core/errors.js'; 10 | export type { Delays } from './core/timed-out.js'; 11 | export { default as calculateRetryDelay } from './core/calculate-retry-delay.js'; 12 | export * from './as-promise/types.js'; 13 | export * from './types.js'; 14 | export { default as create } from './create.js'; 15 | export { default as parseLinkHeader } from './core/parse-link-header.js'; 16 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/index.js: -------------------------------------------------------------------------------- 1 | import create from './create.js'; 2 | import Options from './core/options.js'; 3 | const defaults = { 4 | options: new Options(), 5 | handlers: [], 6 | mutableDefaults: false, 7 | }; 8 | const got = create(defaults); 9 | export default got; 10 | export { got }; 11 | export { default as Options } from './core/options.js'; 12 | export * from './core/options.js'; 13 | export * from './core/response.js'; 14 | export * from './core/index.js'; 15 | export * from './core/errors.js'; 16 | export { default as calculateRetryDelay } from './core/calculate-retry-delay.js'; 17 | export * from './as-promise/types.js'; 18 | export * from './types.js'; 19 | export { default as create } from './create.js'; 20 | export { default as parseLinkHeader } from './core/parse-link-header.js'; 21 | -------------------------------------------------------------------------------- /node_modules/got/dist/source/types.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node_modules/got/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/got/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "got", 3 | "version": "13.0.0", 4 | "description": "Human-friendly and powerful HTTP request library for Node.js", 5 | "license": "MIT", 6 | "repository": "sindresorhus/got", 7 | "funding": "https://github.com/sindresorhus/got?sponsor=1", 8 | "type": "module", 9 | "exports": { 10 | "types": "./dist/source/index.d.ts", 11 | "default": "./dist/source/index.js" 12 | }, 13 | "engines": { 14 | "node": ">=16" 15 | }, 16 | "scripts": { 17 | "test": "xo && tsc --noEmit && ava", 18 | "release": "np", 19 | "build": "del-cli dist && tsc", 20 | "prepare": "npm run build" 21 | }, 22 | "files": [ 23 | "dist/source" 24 | ], 25 | "keywords": [ 26 | "http", 27 | "https", 28 | "http2", 29 | "get", 30 | "got", 31 | "url", 32 | "uri", 33 | "request", 34 | "simple", 35 | "curl", 36 | "wget", 37 | "fetch", 38 | "net", 39 | "network", 40 | "gzip", 41 | "brotli", 42 | "requests", 43 | "human-friendly", 44 | "axios", 45 | "superagent", 46 | "node-fetch", 47 | "ky" 48 | ], 49 | "dependencies": { 50 | "@sindresorhus/is": "^5.2.0", 51 | "@szmarczak/http-timer": "^5.0.1", 52 | "cacheable-lookup": "^7.0.0", 53 | "cacheable-request": "^10.2.8", 54 | "decompress-response": "^6.0.0", 55 | "form-data-encoder": "^2.1.2", 56 | "get-stream": "^6.0.1", 57 | "http2-wrapper": "^2.1.10", 58 | "lowercase-keys": "^3.0.0", 59 | "p-cancelable": "^3.0.0", 60 | "responselike": "^3.0.0" 61 | }, 62 | "devDependencies": { 63 | "@hapi/bourne": "^3.0.0", 64 | "@sindresorhus/tsconfig": "^3.0.1", 65 | "@sinonjs/fake-timers": "^10.0.2", 66 | "@types/benchmark": "^2.1.2", 67 | "@types/express": "^4.17.17", 68 | "@types/node": "^18.14.5", 69 | "@types/pem": "^1.9.6", 70 | "@types/pify": "^5.0.1", 71 | "@types/readable-stream": "^2.3.13", 72 | "@types/request": "^2.48.8", 73 | "@types/sinon": "^10.0.11", 74 | "@types/sinonjs__fake-timers": "^8.1.1", 75 | "@types/tough-cookie": "^4.0.1", 76 | "ava": "^5.2.0", 77 | "axios": "^0.27.2", 78 | "benchmark": "^2.1.4", 79 | "bluebird": "^3.7.2", 80 | "body-parser": "^1.20.2", 81 | "create-cert": "^1.0.6", 82 | "create-test-server": "^3.0.1", 83 | "del-cli": "^5.0.0", 84 | "delay": "^5.0.0", 85 | "express": "^4.17.3", 86 | "form-data": "^4.0.0", 87 | "formdata-node": "^5.0.0", 88 | "nock": "^13.3.0", 89 | "node-fetch": "^3.2.3", 90 | "np": "^7.6.0", 91 | "nyc": "^15.1.0", 92 | "p-event": "^5.0.1", 93 | "pem": "^1.14.6", 94 | "pify": "^6.0.0", 95 | "readable-stream": "^4.2.0", 96 | "request": "^2.88.2", 97 | "sinon": "^15.0.1", 98 | "slow-stream": "0.0.4", 99 | "tempy": "^3.0.0", 100 | "then-busboy": "^5.2.1", 101 | "tough-cookie": "4.1.2", 102 | "ts-node": "^10.8.2", 103 | "type-fest": "^3.6.1", 104 | "typescript": "^5.0.4", 105 | "xo": "^0.54.2" 106 | }, 107 | "sideEffects": false, 108 | "ava": { 109 | "files": [ 110 | "test/*" 111 | ], 112 | "timeout": "1m", 113 | "extensions": { 114 | "ts": "module" 115 | }, 116 | "nodeArguments": [ 117 | "--loader=ts-node/esm" 118 | ] 119 | }, 120 | "nyc": { 121 | "reporter": [ 122 | "text", 123 | "html", 124 | "lcov" 125 | ], 126 | "extension": [ 127 | ".ts" 128 | ], 129 | "exclude": [ 130 | "**/test/**" 131 | ] 132 | }, 133 | "xo": { 134 | "ignores": [ 135 | "documentation/examples/*" 136 | ], 137 | "rules": { 138 | "@typescript-eslint/no-empty-function": "off", 139 | "n/no-deprecated-api": "off", 140 | "@typescript-eslint/no-implicit-any-catch": "off", 141 | "ava/assertion-arguments": "off", 142 | "@typescript-eslint/no-unsafe-member-access": "off", 143 | "@typescript-eslint/no-unsafe-return": "off", 144 | "@typescript-eslint/no-unsafe-assignment": "off", 145 | "@typescript-eslint/no-unsafe-call": "off", 146 | "@typescript-eslint/await-thenable": "off", 147 | "@typescript-eslint/no-redundant-type-constituents": "off", 148 | "@typescript-eslint/no-unsafe-argument": "off", 149 | "@typescript-eslint/promise-function-async": "off", 150 | "no-lone-blocks": "off", 151 | "unicorn/no-await-expression-member": "off" 152 | } 153 | }, 154 | "runkitExampleFilename": "./documentation/examples/runkit-example.js" 155 | } 156 | -------------------------------------------------------------------------------- /node_modules/http-cache-semantics/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016-2018 Kornel Lesiński 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10 | -------------------------------------------------------------------------------- /node_modules/http-cache-semantics/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http-cache-semantics", 3 | "version": "4.1.1", 4 | "description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies", 5 | "repository": "https://github.com/kornelski/http-cache-semantics.git", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "mocha" 9 | }, 10 | "files": [ 11 | "index.js" 12 | ], 13 | "author": "Kornel Lesiński (https://kornel.ski/)", 14 | "license": "BSD-2-Clause", 15 | "devDependencies": { 16 | "mocha": "^10.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Szymon Marczak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/index.d.ts: -------------------------------------------------------------------------------- 1 | // See https://github.com/facebook/jest/issues/2549 2 | // eslint-disable-next-line node/prefer-global/url 3 | import {URL} from 'url'; 4 | import {EventEmitter} from 'events'; 5 | import tls = require('tls'); 6 | import http = require('http'); 7 | import https = require('https'); 8 | import http2 = require('http2'); 9 | 10 | // Note: do not convert this to import from. 11 | import QuickLRU = require('quick-lru'); 12 | 13 | export interface RequestOptions extends Omit { 14 | tlsSession?: tls.ConnectionOptions['session']; 15 | h2session?: http2.ClientHttp2Session; 16 | agent?: Agent | false; 17 | 18 | // Required because @types/node is missing types 19 | ALPNProtocols?: string[]; 20 | } 21 | 22 | export interface AutoRequestOptions extends Omit { 23 | agent?: { 24 | http?: http.Agent | false; 25 | https?: https.Agent | false; 26 | http2?: Agent | false; 27 | }; 28 | resolveProtocol?: ResolveProtocolFunction; 29 | } 30 | 31 | export interface EntryFunction { 32 | (): Promise; 33 | 34 | completed: boolean; 35 | destroyed: boolean; 36 | listeners: PromiseListeners; 37 | } 38 | 39 | export interface AgentOptions { 40 | timeout?: number; 41 | maxSessions?: number; 42 | maxEmptySessions?: number; 43 | maxCachedTlsSessions?: number; 44 | } 45 | 46 | export interface PromiseListeners { 47 | resolve: (value: unknown) => void; 48 | reject: (error: Error) => void; 49 | } 50 | 51 | export class Agent extends EventEmitter { 52 | sessions: Record; 53 | queue: Record>; 54 | 55 | timeout: number; 56 | maxSessions: number; 57 | maxEmptySessions: number; 58 | protocol: string; 59 | settings: http2.Settings; 60 | 61 | tlsSessionCache: QuickLRU; 62 | 63 | emptySessionCount: number; 64 | pendingSessionCount: number; 65 | sessionCount: number; 66 | 67 | constructor(options?: AgentOptions); 68 | 69 | static connect(origin: URL, options: http2.SecureClientSessionOptions): tls.TLSSocket; 70 | 71 | normalizeOptions(options: http2.ClientSessionRequestOptions): string; 72 | 73 | getSession(origin: string | URL, options?: http2.SecureClientSessionOptions, listeners?: PromiseListeners): Promise; 74 | request(origin: string | URL, options?: http2.SecureClientSessionOptions, headers?: http2.OutgoingHttpHeaders, streamOptions?: http2.ClientSessionRequestOptions): Promise; 75 | 76 | createConnection(origin: URL, options: http2.SecureClientSessionOptions): Promise; 77 | 78 | closeEmptySessions(count?: number): void; 79 | destroy(reason?: Error): void; 80 | } 81 | 82 | export interface ProxyOptions { 83 | headers?: http2.OutgoingHttpHeaders; 84 | raw?: boolean; 85 | url: URL | string; 86 | } 87 | 88 | export namespace proxies { 89 | class HttpOverHttp2 extends http.Agent { 90 | constructor(options: http.AgentOptions & {proxyOptions: ProxyOptions}); 91 | } 92 | 93 | class HttpsOverHttp2 extends https.Agent { 94 | constructor(options: https.AgentOptions & {proxyOptions: ProxyOptions}); 95 | } 96 | 97 | class Http2OverHttp2 extends Agent { 98 | constructor(options: AgentOptions & {proxyOptions: ProxyOptions}); 99 | } 100 | 101 | class Http2OverHttp extends Agent { 102 | constructor(options: AgentOptions & {proxyOptions: ProxyOptions}); 103 | } 104 | 105 | class Http2OverHttps extends Agent { 106 | constructor(options: AgentOptions & {proxyOptions: ProxyOptions}); 107 | } 108 | } 109 | 110 | export type RequestFunction = 111 | ((url: string | URL, options?: O, callback?: (response: http.IncomingMessage) => void) => T) & 112 | ((url: string | URL, callback?: (response: http.IncomingMessage) => void) => T) & 113 | ((options: O, callback?: (response: http.IncomingMessage) => void) => T); 114 | 115 | export const globalAgent: Agent; 116 | 117 | export type ResolveProtocolResult = { 118 | alpnProtocol: string; 119 | socket?: tls.TLSSocket; 120 | timeout?: boolean; 121 | }; 122 | export type ResolveProtocolFunction = (options: AutoRequestOptions) => Promise; 123 | 124 | type Promisable = T | Promise; 125 | 126 | export type ResolveProtocolConnectFunction = (options: tls.ConnectionOptions, callback: () => void) => Promisable; 127 | 128 | export const request: RequestFunction; 129 | export const get: RequestFunction; 130 | export const auto: RequestFunction, AutoRequestOptions> & { 131 | protocolCache: QuickLRU; 132 | resolveProtocol: ResolveProtocolFunction; 133 | createResolveProtocol: (cache: Map, queue: Map>, connect?: ResolveProtocolConnectFunction) => ResolveProtocolFunction; 134 | }; 135 | 136 | export { 137 | ClientRequest, 138 | IncomingMessage 139 | } from 'http'; 140 | 141 | export * from 'http2'; 142 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http2-wrapper", 3 | "version": "2.2.0", 4 | "description": "HTTP2 client, just with the familiar `https` API", 5 | "main": "source", 6 | "types": "index.d.ts", 7 | "engines": { 8 | "node": ">=10.19.0" 9 | }, 10 | "scripts": { 11 | "test": "xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava && tsd" 12 | }, 13 | "files": [ 14 | "source", 15 | "index.d.ts" 16 | ], 17 | "keywords": [ 18 | "http2", 19 | "https", 20 | "http", 21 | "request" 22 | ], 23 | "repository": { 24 | "type": "git", 25 | "url": "git+https://github.com/szmarczak/http2-wrapper.git" 26 | }, 27 | "author": "Szymon Marczak", 28 | "license": "MIT", 29 | "bugs": { 30 | "url": "https://github.com/szmarczak/http2-wrapper/issues" 31 | }, 32 | "homepage": "https://github.com/szmarczak/http2-wrapper#readme", 33 | "dependencies": { 34 | "quick-lru": "^5.1.1", 35 | "resolve-alpn": "^1.2.0" 36 | }, 37 | "devDependencies": { 38 | "@sindresorhus/is": "^4.0.1", 39 | "ava": "^3.15.0", 40 | "benchmark": "^2.1.4", 41 | "get-stream": "^6.0.1", 42 | "got": "^11.8.2", 43 | "http2-proxy": "^5.0.53", 44 | "https-proxy-agent": "^5.0.0", 45 | "lolex": "^6.0.0", 46 | "many-keys-map": "^1.0.3", 47 | "nyc": "^15.1.0", 48 | "p-event": "^4.2.0", 49 | "tempy": "^1.0.1", 50 | "to-readable-stream": "^2.1.0", 51 | "tsd": "^0.17.0", 52 | "websocket-stream": "^5.5.2", 53 | "ws": "^7.5.3", 54 | "xo": "0.39.1" 55 | }, 56 | "ava": { 57 | "timeout": "10s" 58 | }, 59 | "nyc": { 60 | "include": [ 61 | "source" 62 | ] 63 | }, 64 | "xo": { 65 | "rules": { 66 | "unicorn/no-for-loop": "off", 67 | "unicorn/prefer-module": "off", 68 | "comma-dangle": "off", 69 | "@typescript-eslint/comma-dangle": "off", 70 | "quotes": [ 71 | "error", 72 | "single", 73 | { 74 | "avoidEscape": true, 75 | "allowTemplateLiterals": true 76 | } 77 | ], 78 | "operator-linebreak": ["error", "before"] 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/incoming-message.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {Readable} = require('stream'); 3 | 4 | class IncomingMessage extends Readable { 5 | constructor(socket, highWaterMark) { 6 | super({ 7 | emitClose: false, 8 | autoDestroy: true, 9 | highWaterMark 10 | }); 11 | 12 | this.statusCode = null; 13 | this.statusMessage = ''; 14 | this.httpVersion = '2.0'; 15 | this.httpVersionMajor = 2; 16 | this.httpVersionMinor = 0; 17 | this.headers = {}; 18 | this.trailers = {}; 19 | this.req = null; 20 | 21 | this.aborted = false; 22 | this.complete = false; 23 | this.upgrade = null; 24 | 25 | this.rawHeaders = []; 26 | this.rawTrailers = []; 27 | 28 | this.socket = socket; 29 | 30 | this._dumped = false; 31 | } 32 | 33 | get connection() { 34 | return this.socket; 35 | } 36 | 37 | set connection(value) { 38 | this.socket = value; 39 | } 40 | 41 | _destroy(error, callback) { 42 | if (!this.readableEnded) { 43 | this.aborted = true; 44 | } 45 | 46 | // See https://github.com/nodejs/node/issues/35303 47 | callback(); 48 | 49 | this.req._request.destroy(error); 50 | } 51 | 52 | setTimeout(ms, callback) { 53 | this.req.setTimeout(ms, callback); 54 | return this; 55 | } 56 | 57 | _dump() { 58 | if (!this._dumped) { 59 | this._dumped = true; 60 | 61 | this.removeAllListeners('data'); 62 | this.resume(); 63 | } 64 | } 65 | 66 | _read() { 67 | if (this.req) { 68 | this.req._request.resume(); 69 | } 70 | } 71 | } 72 | 73 | module.exports = IncomingMessage; 74 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const http2 = require('http2'); 3 | const { 4 | Agent, 5 | globalAgent 6 | } = require('./agent.js'); 7 | const ClientRequest = require('./client-request.js'); 8 | const IncomingMessage = require('./incoming-message.js'); 9 | const auto = require('./auto.js'); 10 | const { 11 | HttpOverHttp2, 12 | HttpsOverHttp2 13 | } = require('./proxies/h1-over-h2.js'); 14 | const Http2OverHttp2 = require('./proxies/h2-over-h2.js'); 15 | const { 16 | Http2OverHttp, 17 | Http2OverHttps 18 | } = require('./proxies/h2-over-h1.js'); 19 | const validateHeaderName = require('./utils/validate-header-name.js'); 20 | const validateHeaderValue = require('./utils/validate-header-value.js'); 21 | 22 | const request = (url, options, callback) => new ClientRequest(url, options, callback); 23 | 24 | const get = (url, options, callback) => { 25 | // eslint-disable-next-line unicorn/prevent-abbreviations 26 | const req = new ClientRequest(url, options, callback); 27 | req.end(); 28 | 29 | return req; 30 | }; 31 | 32 | module.exports = { 33 | ...http2, 34 | ClientRequest, 35 | IncomingMessage, 36 | Agent, 37 | globalAgent, 38 | request, 39 | get, 40 | auto, 41 | proxies: { 42 | HttpOverHttp2, 43 | HttpsOverHttp2, 44 | Http2OverHttp2, 45 | Http2OverHttp, 46 | Http2OverHttps 47 | }, 48 | validateHeaderName, 49 | validateHeaderValue 50 | }; 51 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/proxies/get-auth-headers.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = self => { 4 | const {username, password} = self.proxyOptions.url; 5 | 6 | if (username || password) { 7 | const data = `${username}:${password}`; 8 | const authorization = `Basic ${Buffer.from(data).toString('base64')}`; 9 | 10 | return { 11 | 'proxy-authorization': authorization, 12 | authorization 13 | }; 14 | } 15 | 16 | return {}; 17 | }; 18 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/proxies/h1-over-h2.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const tls = require('tls'); 3 | const http = require('http'); 4 | const https = require('https'); 5 | const JSStreamSocket = require('../utils/js-stream-socket.js'); 6 | const {globalAgent} = require('../agent.js'); 7 | const UnexpectedStatusCodeError = require('./unexpected-status-code-error.js'); 8 | const initialize = require('./initialize.js'); 9 | const getAuthorizationHeaders = require('./get-auth-headers.js'); 10 | 11 | const createConnection = (self, options, callback) => { 12 | (async () => { 13 | try { 14 | const {proxyOptions} = self; 15 | const {url, headers, raw} = proxyOptions; 16 | 17 | const stream = await globalAgent.request(url, proxyOptions, { 18 | ...getAuthorizationHeaders(self), 19 | ...headers, 20 | ':method': 'CONNECT', 21 | ':authority': `${options.host}:${options.port}` 22 | }); 23 | 24 | stream.once('error', callback); 25 | stream.once('response', headers => { 26 | const statusCode = headers[':status']; 27 | 28 | if (statusCode !== 200) { 29 | callback(new UnexpectedStatusCodeError(statusCode, '')); 30 | return; 31 | } 32 | 33 | const encrypted = self instanceof https.Agent; 34 | 35 | if (raw && encrypted) { 36 | options.socket = stream; 37 | const secureStream = tls.connect(options); 38 | 39 | secureStream.once('close', () => { 40 | stream.destroy(); 41 | }); 42 | 43 | callback(null, secureStream); 44 | return; 45 | } 46 | 47 | const socket = new JSStreamSocket(stream); 48 | socket.encrypted = false; 49 | socket._handle.getpeername = out => { 50 | out.family = undefined; 51 | out.address = undefined; 52 | out.port = undefined; 53 | }; 54 | 55 | callback(null, socket); 56 | }); 57 | } catch (error) { 58 | callback(error); 59 | } 60 | })(); 61 | }; 62 | 63 | class HttpOverHttp2 extends http.Agent { 64 | constructor(options) { 65 | super(options); 66 | 67 | initialize(this, options.proxyOptions); 68 | } 69 | 70 | createConnection(options, callback) { 71 | createConnection(this, options, callback); 72 | } 73 | } 74 | 75 | class HttpsOverHttp2 extends https.Agent { 76 | constructor(options) { 77 | super(options); 78 | 79 | initialize(this, options.proxyOptions); 80 | } 81 | 82 | createConnection(options, callback) { 83 | createConnection(this, options, callback); 84 | } 85 | } 86 | 87 | module.exports = { 88 | HttpOverHttp2, 89 | HttpsOverHttp2 90 | }; 91 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/proxies/h2-over-h1.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const http = require('http'); 3 | const https = require('https'); 4 | const Http2OverHttpX = require('./h2-over-hx.js'); 5 | const getAuthorizationHeaders = require('./get-auth-headers.js'); 6 | 7 | const getStream = request => new Promise((resolve, reject) => { 8 | const onConnect = (response, socket, head) => { 9 | socket.unshift(head); 10 | 11 | request.off('error', reject); 12 | resolve([socket, response.statusCode, response.statusMessage]); 13 | }; 14 | 15 | request.once('error', reject); 16 | request.once('connect', onConnect); 17 | }); 18 | 19 | class Http2OverHttp extends Http2OverHttpX { 20 | async _getProxyStream(authority) { 21 | const {proxyOptions} = this; 22 | const {url, headers} = this.proxyOptions; 23 | 24 | const network = url.protocol === 'https:' ? https : http; 25 | 26 | // `new URL('https://localhost/httpbin.org:443')` results in 27 | // a `/httpbin.org:443` path, which has an invalid leading slash. 28 | const request = network.request({ 29 | ...proxyOptions, 30 | hostname: url.hostname, 31 | port: url.port, 32 | path: authority, 33 | headers: { 34 | ...getAuthorizationHeaders(this), 35 | ...headers, 36 | host: authority 37 | }, 38 | method: 'CONNECT' 39 | }).end(); 40 | 41 | return getStream(request); 42 | } 43 | } 44 | 45 | module.exports = { 46 | Http2OverHttp, 47 | Http2OverHttps: Http2OverHttp 48 | }; 49 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/proxies/h2-over-h2.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {globalAgent} = require('../agent.js'); 3 | const Http2OverHttpX = require('./h2-over-hx.js'); 4 | const getAuthorizationHeaders = require('./get-auth-headers.js'); 5 | 6 | const getStatusCode = stream => new Promise((resolve, reject) => { 7 | stream.once('error', reject); 8 | stream.once('response', headers => { 9 | stream.off('error', reject); 10 | resolve(headers[':status']); 11 | }); 12 | }); 13 | 14 | class Http2OverHttp2 extends Http2OverHttpX { 15 | async _getProxyStream(authority) { 16 | const {proxyOptions} = this; 17 | 18 | const headers = { 19 | ...getAuthorizationHeaders(this), 20 | ...proxyOptions.headers, 21 | ':method': 'CONNECT', 22 | ':authority': authority 23 | }; 24 | 25 | const stream = await globalAgent.request(proxyOptions.url, proxyOptions, headers); 26 | const statusCode = await getStatusCode(stream); 27 | 28 | return [stream, statusCode, '']; 29 | } 30 | } 31 | 32 | module.exports = Http2OverHttp2; 33 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/proxies/h2-over-hx.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {Agent} = require('../agent.js'); 3 | const JSStreamSocket = require('../utils/js-stream-socket.js'); 4 | const UnexpectedStatusCodeError = require('./unexpected-status-code-error.js'); 5 | const initialize = require('./initialize.js'); 6 | 7 | class Http2OverHttpX extends Agent { 8 | constructor(options) { 9 | super(options); 10 | 11 | initialize(this, options.proxyOptions); 12 | } 13 | 14 | async createConnection(origin, options) { 15 | const authority = `${origin.hostname}:${origin.port || 443}`; 16 | 17 | const [stream, statusCode, statusMessage] = await this._getProxyStream(authority); 18 | if (statusCode !== 200) { 19 | throw new UnexpectedStatusCodeError(statusCode, statusMessage); 20 | } 21 | 22 | if (this.proxyOptions.raw) { 23 | options.socket = stream; 24 | } else { 25 | const socket = new JSStreamSocket(stream); 26 | socket.encrypted = false; 27 | socket._handle.getpeername = out => { 28 | out.family = undefined; 29 | out.address = undefined; 30 | out.port = undefined; 31 | }; 32 | 33 | return socket; 34 | } 35 | 36 | return super.createConnection(origin, options); 37 | } 38 | } 39 | 40 | module.exports = Http2OverHttpX; 41 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/proxies/initialize.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // See https://github.com/facebook/jest/issues/2549 3 | // eslint-disable-next-line node/prefer-global/url 4 | const {URL} = require('url'); 5 | const checkType = require('../utils/check-type.js'); 6 | 7 | module.exports = (self, proxyOptions) => { 8 | checkType('proxyOptions', proxyOptions, ['object']); 9 | checkType('proxyOptions.headers', proxyOptions.headers, ['object', 'undefined']); 10 | checkType('proxyOptions.raw', proxyOptions.raw, ['boolean', 'undefined']); 11 | checkType('proxyOptions.url', proxyOptions.url, [URL, 'string']); 12 | 13 | const url = new URL(proxyOptions.url); 14 | 15 | self.proxyOptions = { 16 | raw: true, 17 | ...proxyOptions, 18 | headers: {...proxyOptions.headers}, 19 | url 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/proxies/unexpected-status-code-error.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class UnexpectedStatusCodeError extends Error { 4 | constructor(statusCode, statusMessage = '') { 5 | super(`The proxy server rejected the request with status code ${statusCode} (${statusMessage || 'empty status message'})`); 6 | this.statusCode = statusCode; 7 | this.statusMessage = statusMessage; 8 | } 9 | } 10 | 11 | module.exports = UnexpectedStatusCodeError; 12 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/calculate-server-name.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {isIP} = require('net'); 3 | const assert = require('assert'); 4 | 5 | const getHost = host => { 6 | if (host[0] === '[') { 7 | const idx = host.indexOf(']'); 8 | 9 | assert(idx !== -1); 10 | return host.slice(1, idx); 11 | } 12 | 13 | const idx = host.indexOf(':'); 14 | if (idx === -1) { 15 | return host; 16 | } 17 | 18 | return host.slice(0, idx); 19 | }; 20 | 21 | module.exports = host => { 22 | const servername = getHost(host); 23 | 24 | if (isIP(servername)) { 25 | return ''; 26 | } 27 | 28 | return servername; 29 | }; 30 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/check-type.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const checkType = (name, value, types) => { 4 | const valid = types.some(type => { 5 | const typeofType = typeof type; 6 | if (typeofType === 'string') { 7 | return typeof value === type; 8 | } 9 | 10 | return value instanceof type; 11 | }); 12 | 13 | if (!valid) { 14 | const names = types.map(type => typeof type === 'string' ? type : type.name); 15 | 16 | throw new TypeError(`Expected '${name}' to be a type of ${names.join(' or ')}, got ${typeof value}`); 17 | } 18 | }; 19 | 20 | module.exports = checkType; 21 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/delay-async-destroy.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = stream => { 4 | if (stream.listenerCount('error') !== 0) { 5 | return stream; 6 | } 7 | 8 | stream.__destroy = stream._destroy; 9 | stream._destroy = (...args) => { 10 | const callback = args.pop(); 11 | 12 | stream.__destroy(...args, async error => { 13 | await Promise.resolve(); 14 | callback(error); 15 | }); 16 | }; 17 | 18 | const onError = error => { 19 | // eslint-disable-next-line promise/prefer-await-to-then 20 | Promise.resolve().then(() => { 21 | stream.emit('error', error); 22 | }); 23 | }; 24 | 25 | stream.once('error', onError); 26 | 27 | // eslint-disable-next-line promise/prefer-await-to-then 28 | Promise.resolve().then(() => { 29 | stream.off('error', onError); 30 | }); 31 | 32 | return stream; 33 | }; 34 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/errors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /* istanbul ignore file: https://github.com/nodejs/node/blob/master/lib/internal/errors.js */ 3 | 4 | const makeError = (Base, key, getMessage) => { 5 | module.exports[key] = class NodeError extends Base { 6 | constructor(...args) { 7 | super(typeof getMessage === 'string' ? getMessage : getMessage(args)); 8 | this.name = `${super.name} [${key}]`; 9 | this.code = key; 10 | } 11 | }; 12 | }; 13 | 14 | makeError(TypeError, 'ERR_INVALID_ARG_TYPE', args => { 15 | const type = args[0].includes('.') ? 'property' : 'argument'; 16 | 17 | let valid = args[1]; 18 | const isManyTypes = Array.isArray(valid); 19 | 20 | if (isManyTypes) { 21 | valid = `${valid.slice(0, -1).join(', ')} or ${valid.slice(-1)}`; 22 | } 23 | 24 | return `The "${args[0]}" ${type} must be ${isManyTypes ? 'one of' : 'of'} type ${valid}. Received ${typeof args[2]}`; 25 | }); 26 | 27 | makeError(TypeError, 'ERR_INVALID_PROTOCOL', args => 28 | `Protocol "${args[0]}" not supported. Expected "${args[1]}"` 29 | ); 30 | 31 | makeError(Error, 'ERR_HTTP_HEADERS_SENT', args => 32 | `Cannot ${args[0]} headers after they are sent to the client` 33 | ); 34 | 35 | makeError(TypeError, 'ERR_INVALID_HTTP_TOKEN', args => 36 | `${args[0]} must be a valid HTTP token [${args[1]}]` 37 | ); 38 | 39 | makeError(TypeError, 'ERR_HTTP_INVALID_HEADER_VALUE', args => 40 | `Invalid value "${args[0]} for header "${args[1]}"` 41 | ); 42 | 43 | makeError(TypeError, 'ERR_INVALID_CHAR', args => 44 | `Invalid character in ${args[0]} [${args[1]}]` 45 | ); 46 | 47 | makeError( 48 | Error, 49 | 'ERR_HTTP2_NO_SOCKET_MANIPULATION', 50 | 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)' 51 | ); 52 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = header => { 4 | switch (header) { 5 | case ':method': 6 | case ':scheme': 7 | case ':authority': 8 | case ':path': 9 | return true; 10 | default: 11 | return false; 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/js-stream-socket.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const stream = require('stream'); 3 | const tls = require('tls'); 4 | 5 | // Really awesome hack. 6 | const JSStreamSocket = (new tls.TLSSocket(new stream.PassThrough()))._handle._parentWrap.constructor; 7 | 8 | module.exports = JSStreamSocket; 9 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/proxy-events.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (from, to, events) => { 4 | for (const event of events) { 5 | from.on(event, (...args) => to.emit(event, ...args)); 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/proxy-socket-handler.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {ERR_HTTP2_NO_SOCKET_MANIPULATION} = require('./errors.js'); 3 | 4 | /* istanbul ignore file */ 5 | /* https://github.com/nodejs/node/blob/6eec858f34a40ffa489c1ec54bb24da72a28c781/lib/internal/http2/compat.js#L195-L272 */ 6 | 7 | const proxySocketHandler = { 8 | has(stream, property) { 9 | // Replaced [kSocket] with .socket 10 | const reference = stream.session === undefined ? stream : stream.session.socket; 11 | return (property in stream) || (property in reference); 12 | }, 13 | 14 | get(stream, property) { 15 | switch (property) { 16 | case 'on': 17 | case 'once': 18 | case 'end': 19 | case 'emit': 20 | case 'destroy': 21 | return stream[property].bind(stream); 22 | case 'writable': 23 | case 'destroyed': 24 | return stream[property]; 25 | case 'readable': 26 | if (stream.destroyed) { 27 | return false; 28 | } 29 | 30 | return stream.readable; 31 | case 'setTimeout': { 32 | const {session} = stream; 33 | if (session !== undefined) { 34 | return session.setTimeout.bind(session); 35 | } 36 | 37 | return stream.setTimeout.bind(stream); 38 | } 39 | 40 | case 'write': 41 | case 'read': 42 | case 'pause': 43 | case 'resume': 44 | throw new ERR_HTTP2_NO_SOCKET_MANIPULATION(); 45 | default: { 46 | // Replaced [kSocket] with .socket 47 | const reference = stream.session === undefined ? stream : stream.session.socket; 48 | const value = reference[property]; 49 | 50 | return typeof value === 'function' ? value.bind(reference) : value; 51 | } 52 | } 53 | }, 54 | 55 | getPrototypeOf(stream) { 56 | if (stream.session !== undefined) { 57 | // Replaced [kSocket] with .socket 58 | return Reflect.getPrototypeOf(stream.session.socket); 59 | } 60 | 61 | return Reflect.getPrototypeOf(stream); 62 | }, 63 | 64 | set(stream, property, value) { 65 | switch (property) { 66 | case 'writable': 67 | case 'readable': 68 | case 'destroyed': 69 | case 'on': 70 | case 'once': 71 | case 'end': 72 | case 'emit': 73 | case 'destroy': 74 | stream[property] = value; 75 | return true; 76 | case 'setTimeout': { 77 | const {session} = stream; 78 | if (session === undefined) { 79 | stream.setTimeout = value; 80 | } else { 81 | session.setTimeout = value; 82 | } 83 | 84 | return true; 85 | } 86 | 87 | case 'write': 88 | case 'read': 89 | case 'pause': 90 | case 'resume': 91 | throw new ERR_HTTP2_NO_SOCKET_MANIPULATION(); 92 | default: { 93 | // Replaced [kSocket] with .socket 94 | const reference = stream.session === undefined ? stream : stream.session.socket; 95 | reference[property] = value; 96 | return true; 97 | } 98 | } 99 | } 100 | }; 101 | 102 | module.exports = proxySocketHandler; 103 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/validate-header-name.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const {ERR_INVALID_HTTP_TOKEN} = require('./errors.js'); 3 | const isRequestPseudoHeader = require('./is-request-pseudo-header.js'); 4 | 5 | const isValidHttpToken = /^[\^`\-\w!#$%&*+.|~]+$/; 6 | 7 | module.exports = name => { 8 | if (typeof name !== 'string' || (!isValidHttpToken.test(name) && !isRequestPseudoHeader(name))) { 9 | throw new ERR_INVALID_HTTP_TOKEN('Header name', name); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /node_modules/http2-wrapper/source/utils/validate-header-value.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const { 3 | ERR_HTTP_INVALID_HEADER_VALUE, 4 | ERR_INVALID_CHAR 5 | } = require('./errors.js'); 6 | 7 | const isInvalidHeaderValue = /[^\t\u0020-\u007E\u0080-\u00FF]/; 8 | 9 | module.exports = (name, value) => { 10 | if (typeof value === 'undefined') { 11 | throw new ERR_HTTP_INVALID_HEADER_VALUE(value, name); 12 | } 13 | 14 | if (isInvalidHeaderValue.test(value)) { 15 | throw new ERR_INVALID_CHAR('header content', name); 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /node_modules/json-buffer/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | -------------------------------------------------------------------------------- /node_modules/json-buffer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Dominic Tarr 2 | 3 | Permission is hereby granted, free of charge, 4 | to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom 10 | the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 20 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /node_modules/json-buffer/README.md: -------------------------------------------------------------------------------- 1 | # json-buffer 2 | 3 | JSON functions that can convert buffers! 4 | 5 | [![build status](https://secure.travis-ci.org/dominictarr/json-buffer.png)](http://travis-ci.org/dominictarr/json-buffer) 6 | 7 | [![testling badge](https://ci.testling.com/dominictarr/json-buffer.png)](https://ci.testling.com/dominictarr/json-buffer) 8 | 9 | JSON mangles buffers by converting to an array... 10 | which isn't helpful. json-buffers converts to base64 instead, 11 | and deconverts base64 to a buffer. 12 | 13 | ``` js 14 | var JSONB = require('json-buffer') 15 | var Buffer = require('buffer').Buffer 16 | 17 | var str = JSONB.stringify(Buffer.from('hello there!')) 18 | 19 | console.log(JSONB.parse(str)) //GET a BUFFER back 20 | ``` 21 | 22 | ## License 23 | 24 | MIT 25 | -------------------------------------------------------------------------------- /node_modules/json-buffer/index.js: -------------------------------------------------------------------------------- 1 | //TODO: handle reviver/dehydrate function like normal 2 | //and handle indentation, like normal. 3 | //if anyone needs this... please send pull request. 4 | 5 | exports.stringify = function stringify (o) { 6 | if('undefined' == typeof o) return o 7 | 8 | if(o && Buffer.isBuffer(o)) 9 | return JSON.stringify(':base64:' + o.toString('base64')) 10 | 11 | if(o && o.toJSON) 12 | o = o.toJSON() 13 | 14 | if(o && 'object' === typeof o) { 15 | var s = '' 16 | var array = Array.isArray(o) 17 | s = array ? '[' : '{' 18 | var first = true 19 | 20 | for(var k in o) { 21 | var ignore = 'function' == typeof o[k] || (!array && 'undefined' === typeof o[k]) 22 | if(Object.hasOwnProperty.call(o, k) && !ignore) { 23 | if(!first) 24 | s += ',' 25 | first = false 26 | if (array) { 27 | if(o[k] == undefined) 28 | s += 'null' 29 | else 30 | s += stringify(o[k]) 31 | } else if (o[k] !== void(0)) { 32 | s += stringify(k) + ':' + stringify(o[k]) 33 | } 34 | } 35 | } 36 | 37 | s += array ? ']' : '}' 38 | 39 | return s 40 | } else if ('string' === typeof o) { 41 | return JSON.stringify(/^:/.test(o) ? ':' + o : o) 42 | } else if ('undefined' === typeof o) { 43 | return 'null'; 44 | } else 45 | return JSON.stringify(o) 46 | } 47 | 48 | exports.parse = function (s) { 49 | return JSON.parse(s, function (key, value) { 50 | if('string' === typeof value) { 51 | if(/^:base64:/.test(value)) 52 | return Buffer.from(value.substring(8), 'base64') 53 | else 54 | return /^:/.test(value) ? value.substring(1) : value 55 | } 56 | return value 57 | }) 58 | } 59 | -------------------------------------------------------------------------------- /node_modules/json-buffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "json-buffer", 3 | "description": "JSON parse & stringify that supports binary via bops & base64", 4 | "version": "3.0.1", 5 | "homepage": "https://github.com/dominictarr/json-buffer", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/dominictarr/json-buffer.git" 9 | }, 10 | "devDependencies": { 11 | "tape": "^4.6.3" 12 | }, 13 | "scripts": { 14 | "test": "set -e; for t in test/*.js; do node $t; done" 15 | }, 16 | "author": "Dominic Tarr (http://dominictarr.com)", 17 | "license": "MIT", 18 | "testling": { 19 | "files": "test/*.js", 20 | "browsers": [ 21 | "ie/8..latest", 22 | "firefox/17..latest", 23 | "firefox/nightly", 24 | "chrome/22..latest", 25 | "chrome/canary", 26 | "opera/12..latest", 27 | "opera/next", 28 | "safari/5.1..latest", 29 | "ipad/6.0..latest", 30 | "iphone/6.0..latest", 31 | "android-browser/4.2..latest" 32 | ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /node_modules/json-buffer/test/index.js: -------------------------------------------------------------------------------- 1 | 2 | var test = require('tape') 3 | var _JSON = require('../') 4 | 5 | function clone (o) { 6 | return JSON.parse(JSON.stringify(o)) 7 | } 8 | 9 | var examples = { 10 | simple: { foo: [], bar: {}, baz: Buffer.from('some binary data') }, 11 | just_buffer: Buffer.from('JUST A BUFFER'), 12 | all_types: { 13 | string:'hello', 14 | number: 3145, 15 | null: null, 16 | object: {}, 17 | array: [], 18 | boolean: true, 19 | boolean2: false 20 | }, 21 | foo: Buffer.from('foo'), 22 | foo2: Buffer.from('foo2'), 23 | escape: { 24 | buffer: Buffer.from('x'), 25 | string: _JSON.stringify(Buffer.from('x')) 26 | }, 27 | escape2: { 28 | buffer: Buffer.from('x'), 29 | string: ':base64:'+ Buffer.from('x').toString('base64') 30 | }, 31 | undefined: { 32 | empty: undefined, test: true 33 | }, 34 | undefined2: { 35 | first: 1, empty: undefined, test: true 36 | }, 37 | undefinedArray: { 38 | array: [undefined, 1, 'two'] 39 | }, 40 | fn: { 41 | fn: function () {} 42 | }, 43 | undefined: undefined 44 | } 45 | 46 | for(k in examples) 47 | (function (value, k) { 48 | test(k, function (t) { 49 | var s = _JSON.stringify(value) 50 | console.log('parse', s) 51 | if(JSON.stringify(value) !== undefined) { 52 | console.log(s) 53 | var _value = _JSON.parse(s) 54 | t.deepEqual(clone(_value), clone(value)) 55 | } 56 | else 57 | t.equal(s, undefined) 58 | t.end() 59 | }) 60 | })(examples[k], k) 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /node_modules/keyv/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "keyv", 3 | "version": "4.5.2", 4 | "description": "Simple key-value storage with support for multiple backends", 5 | "main": "src/index.js", 6 | "scripts": { 7 | "test": "xo && nyc ava --serial", 8 | "coverage": "nyc report --reporter=text-lcov > coverage.lcov", 9 | "clean": "rm -rf node_modules && rm -rf .nyc_output && rm -rf coverage.lcov && rm -rf ./test/testdb.sqlite" 10 | }, 11 | "xo": { 12 | "rules": { 13 | "unicorn/prefer-module": 0, 14 | "unicorn/prefer-node-protocol": 0, 15 | "@typescript-eslint/consistent-type-definitions": 0 16 | } 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/jaredwray/keyv.git" 21 | }, 22 | "keywords": [ 23 | "key", 24 | "value", 25 | "store", 26 | "cache", 27 | "ttl" 28 | ], 29 | "author": "Jared Wray (http://jaredwray.com)", 30 | "license": "MIT", 31 | "bugs": { 32 | "url": "https://github.com/jaredwray/keyv/issues" 33 | }, 34 | "homepage": "https://github.com/jaredwray/keyv", 35 | "dependencies": { 36 | "json-buffer": "3.0.1" 37 | }, 38 | "devDependencies": { 39 | "@keyv/test-suite": "*", 40 | "ava": "^5.0.1", 41 | "eslint": "^8.26.0", 42 | "eslint-plugin-promise": "^6.1.1", 43 | "nyc": "^15.1.0", 44 | "pify": "5.0.0", 45 | "this": "^1.1.0", 46 | "timekeeper": "^2.2.0", 47 | "tsd": "^0.24.1", 48 | "typescript": "^4.8.4", 49 | "xo": "^0.52.4" 50 | }, 51 | "tsd": { 52 | "directory": "test" 53 | }, 54 | "types": "./src/index.d.ts", 55 | "files": [ 56 | "src" 57 | ] 58 | } 59 | -------------------------------------------------------------------------------- /node_modules/keyv/src/index.d.ts: -------------------------------------------------------------------------------- 1 | import {EventEmitter} from 'events'; 2 | 3 | type WithRequiredProperties = T & Required>; 4 | 5 | declare class Keyv = Record> extends EventEmitter { 6 | /** 7 | * `this.opts` is an object containing at least the properties listed 8 | * below. However, `Keyv.Options` allows arbitrary properties as well. 9 | * These properties can be specified as the second type parameter to `Keyv`. 10 | */ 11 | opts: WithRequiredProperties< 12 | Keyv.Options, 13 | 'deserialize' | 'namespace' | 'serialize' | 'store' | 'uri' 14 | > & 15 | Options; 16 | 17 | /** 18 | * @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options. 19 | */ 20 | constructor(options?: Keyv.Options & Options); 21 | /** 22 | * @param uri The connection string URI. 23 | * 24 | * Merged into the options object as options.uri. 25 | * @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options. 26 | */ 27 | constructor(uri?: string, options?: Keyv.Options & Options); 28 | 29 | /** Returns the value. */ 30 | get(key: string, options?: {raw?: Raw}): 31 | Promise<(Raw extends false 32 | ? Value 33 | : Keyv.DeserializedData) | undefined>; 34 | 35 | /** Returns an array of values. Uses `store.getMany` if it exists, otherwise uses parallel calls to `store.get`. */ 36 | get( 37 | key: string[], 38 | options?: {raw?: Raw} 39 | ): Promise< 40 | Array<(Raw extends false ? Value : Keyv.DeserializedData) | undefined> 41 | >; 42 | 43 | /** 44 | * Set a value. 45 | * 46 | * By default keys are persistent. You can set an expiry TTL in milliseconds. 47 | */ 48 | set(key: string, value: Value, ttl?: number): Promise; 49 | /** 50 | * Deletes an entry. 51 | * 52 | * Returns `true` if the key existed, `false` if not. 53 | */ 54 | delete(key: string | string[]): Promise; 55 | /** Delete all entries in the current namespace. */ 56 | clear(): Promise; 57 | /** Check if key exists in current namespace. */ 58 | has(key: string): Promise; 59 | /** Iterator */ 60 | iterator(namespace?: string): AsyncGenerator; 61 | /** 62 | * Closes the connection. 63 | * 64 | * Returns `undefined` when the connection closes. 65 | */ 66 | disconnect(): Promise; 67 | } 68 | 69 | declare namespace Keyv { 70 | interface Options { 71 | [key: string]: any; 72 | 73 | /** Namespace for the current instance. */ 74 | namespace?: string | undefined; 75 | /** A custom serialization function. */ 76 | serialize?: ((data: DeserializedData) => string) | undefined; 77 | /** A custom deserialization function. */ 78 | deserialize?: ((data: string) => DeserializedData | undefined) | undefined; 79 | /** The connection string URI. */ 80 | uri?: string | undefined; 81 | /** The storage adapter instance to be used by Keyv. */ 82 | store?: Store | undefined; 83 | /** Default TTL. Can be overridden by specififying a TTL on `.set()`. */ 84 | ttl?: number | undefined; 85 | /** Specify an adapter to use. e.g `'redis'` or `'mongodb'`. */ 86 | adapter?: 'redis' | 'mongodb' | 'mongo' | 'sqlite' | 'postgresql' | 'postgres' | 'mysql' | undefined; 87 | /** Enable compression option **/ 88 | compression?: CompressionAdapter | undefined; 89 | } 90 | 91 | interface CompressionAdapter { 92 | compress(value: any, options?: any): Promise; 93 | decompress(value: any, options?: any): Promise; 94 | serialize(value: any): Promise; 95 | deserialize(value: any): Promise; 96 | } 97 | 98 | interface DeserializedData { 99 | value: Value; expires: number | undefined; 100 | } 101 | 102 | type StoredData = DeserializedData | string | undefined; 103 | 104 | interface Store { 105 | get(key: string): Value | Promise | undefined; 106 | set(key: string, value: Value, ttl?: number): any; 107 | delete(key: string): boolean | Promise; 108 | clear(): void | Promise; 109 | has?(key: string): boolean | Promise; 110 | getMany?( 111 | keys: string[] 112 | ): Array> | Promise>> | undefined; 113 | } 114 | } 115 | 116 | export = Keyv; 117 | -------------------------------------------------------------------------------- /node_modules/lowercase-keys/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Lowercase the keys of an object. 3 | 4 | @returns A new object with the keys lowercased. 5 | 6 | @example 7 | ``` 8 | import lowercaseKeys from 'lowercase-keys'; 9 | 10 | lowercaseKeys({FOO: true, bAr: false}); 11 | //=> {foo: true, bar: false} 12 | ``` 13 | */ 14 | export default function lowercaseKeys(object: Record): Record; 15 | -------------------------------------------------------------------------------- /node_modules/lowercase-keys/index.js: -------------------------------------------------------------------------------- 1 | export default function lowercaseKeys(object) { 2 | return Object.fromEntries(Object.entries(object).map(([key, value]) => [key.toLowerCase(), value])); 3 | } 4 | -------------------------------------------------------------------------------- /node_modules/lowercase-keys/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/lowercase-keys/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lowercase-keys", 3 | "version": "3.0.0", 4 | "description": "Lowercase the keys of an object", 5 | "license": "MIT", 6 | "repository": "sindresorhus/lowercase-keys", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "type": "module", 14 | "exports": "./index.js", 15 | "engines": { 16 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 17 | }, 18 | "scripts": { 19 | "test": "xo && ava && tsd" 20 | }, 21 | "files": [ 22 | "index.js", 23 | "index.d.ts" 24 | ], 25 | "keywords": [ 26 | "object", 27 | "assign", 28 | "extend", 29 | "properties", 30 | "lowercase", 31 | "lower-case", 32 | "case", 33 | "keys", 34 | "key" 35 | ], 36 | "devDependencies": { 37 | "ava": "^3.15.0", 38 | "tsd": "^0.18.0", 39 | "xo": "^0.45.0" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /node_modules/lowercase-keys/readme.md: -------------------------------------------------------------------------------- 1 | # lowercase-keys 2 | 3 | > Lowercase the keys of an object 4 | 5 | Check out [`map-obj`](https://github.com/sindresorhus/map-obj) if you need support for deep iteration. 6 | 7 | ## Install 8 | 9 | ```sh 10 | npm install lowercase-keys 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import lowercaseKeys from 'lowercase-keys'; 17 | 18 | lowercaseKeys({FOO: true, bAr: false}); 19 | //=> {foo: true, bar: false} 20 | ``` 21 | 22 | ## API 23 | 24 | ### lowercaseKeys(object) 25 | 26 | Returns a new object with the keys lowercased. 27 | 28 | ## lowercase-keys for enterprise 29 | 30 | Available as part of the Tidelift Subscription. 31 | 32 | The maintainers of lowercase-keys and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-lowercase-keys?utm_source=npm-lowercase-keys&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) 33 | -------------------------------------------------------------------------------- /node_modules/mimic-response/index.d.ts: -------------------------------------------------------------------------------- 1 | import {IncomingMessage} from 'node:http'; 2 | 3 | /** 4 | Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) 5 | 6 | Makes `toStream` include the properties from `fromStream`. 7 | 8 | @param fromStream - The stream to copy the properties from. 9 | @param toStream - The stream to copy the properties to. 10 | @return The same object as `toStream`. 11 | 12 | @example 13 | ``` 14 | import {PassThrough as PassThroughStream} from 'node:stream'; 15 | import mimicResponse from 'mimic-response'; 16 | 17 | const responseStream = getHttpResponseStream(); 18 | const myStream = new PassThroughStream(); 19 | 20 | mimicResponse(responseStream, myStream); 21 | 22 | console.log(myStream.statusCode); 23 | //=> 200 24 | ``` 25 | */ 26 | export default function mimicResponse( 27 | fromStream: IncomingMessage, 28 | toStream: T, 29 | ): T & IncomingMessage; 30 | -------------------------------------------------------------------------------- /node_modules/mimic-response/index.js: -------------------------------------------------------------------------------- 1 | // We define these manually to ensure they're always copied 2 | // even if they would move up the prototype chain 3 | // https://nodejs.org/api/http.html#http_class_http_incomingmessage 4 | const knownProperties = [ 5 | 'aborted', 6 | 'complete', 7 | 'headers', 8 | 'httpVersion', 9 | 'httpVersionMinor', 10 | 'httpVersionMajor', 11 | 'method', 12 | 'rawHeaders', 13 | 'rawTrailers', 14 | 'setTimeout', 15 | 'socket', 16 | 'statusCode', 17 | 'statusMessage', 18 | 'trailers', 19 | 'url', 20 | ]; 21 | 22 | export default function mimicResponse(fromStream, toStream) { 23 | if (toStream._readableState.autoDestroy) { 24 | throw new Error('The second stream must have the `autoDestroy` option set to `false`'); 25 | } 26 | 27 | const fromProperties = new Set([...Object.keys(fromStream), ...knownProperties]); 28 | 29 | const properties = {}; 30 | 31 | for (const property of fromProperties) { 32 | // Don't overwrite existing properties. 33 | if (property in toStream) { 34 | continue; 35 | } 36 | 37 | properties[property] = { 38 | get() { 39 | const value = fromStream[property]; 40 | const isFunction = typeof value === 'function'; 41 | 42 | return isFunction ? value.bind(fromStream) : value; 43 | }, 44 | set(value) { 45 | fromStream[property] = value; 46 | }, 47 | enumerable: true, 48 | configurable: false, 49 | }; 50 | } 51 | 52 | Object.defineProperties(toStream, properties); 53 | 54 | fromStream.once('aborted', () => { 55 | toStream.destroy(); 56 | 57 | toStream.emit('aborted'); 58 | }); 59 | 60 | fromStream.once('close', () => { 61 | if (fromStream.complete) { 62 | if (toStream.readable) { 63 | toStream.once('end', () => { 64 | toStream.emit('close'); 65 | }); 66 | } else { 67 | toStream.emit('close'); 68 | } 69 | } else { 70 | toStream.emit('close'); 71 | } 72 | }); 73 | 74 | return toStream; 75 | } 76 | -------------------------------------------------------------------------------- /node_modules/mimic-response/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/mimic-response/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mimic-response", 3 | "version": "4.0.0", 4 | "description": "Mimic a Node.js HTTP response stream", 5 | "license": "MIT", 6 | "repository": "sindresorhus/mimic-response", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "type": "module", 14 | "exports": "./index.js", 15 | "engines": { 16 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 17 | }, 18 | "scripts": { 19 | "test": "xo && ava && tsd" 20 | }, 21 | "files": [ 22 | "index.d.ts", 23 | "index.js" 24 | ], 25 | "keywords": [ 26 | "mimic", 27 | "response", 28 | "stream", 29 | "http", 30 | "https", 31 | "request", 32 | "get", 33 | "core" 34 | ], 35 | "devDependencies": { 36 | "@types/node": "^16.4.13", 37 | "ava": "^3.15.0", 38 | "create-test-server": "^3.0.1", 39 | "p-event": "^4.2.0", 40 | "pify": "^5.0.0", 41 | "tsd": "^0.17.0", 42 | "xo": "^0.44.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /node_modules/mimic-response/readme.md: -------------------------------------------------------------------------------- 1 | # mimic-response 2 | 3 | > Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) 4 | 5 | ## Install 6 | 7 | ``` 8 | $ npm install mimic-response 9 | ``` 10 | 11 | ## Usage 12 | 13 | ```js 14 | import {PassThrough as PassThroughStream} from 'node:stream'; 15 | import mimicResponse from 'mimic-response'; 16 | 17 | const responseStream = getHttpResponseStream(); 18 | const myStream = new PassThroughStream(); 19 | 20 | mimicResponse(responseStream, myStream); 21 | 22 | console.log(myStream.statusCode); 23 | //=> 200 24 | ``` 25 | 26 | ## API 27 | 28 | ### mimicResponse(from, to) 29 | 30 | **Note #1:** The `from.destroy(error)` function is not proxied. You have to call it manually: 31 | 32 | ```js 33 | import {PassThrough as PassThroughStream} from 'node:stream'; 34 | import mimicResponse from 'mimic-response'; 35 | 36 | const responseStream = getHttpResponseStream(); 37 | 38 | const myStream = new PassThroughStream({ 39 | destroy(error, callback) { 40 | responseStream.destroy(); 41 | 42 | callback(error); 43 | } 44 | }); 45 | 46 | myStream.destroy(); 47 | ``` 48 | 49 | Please note that `myStream` and `responseStream` never throw. The error is passed to the request instead. 50 | 51 | #### from 52 | 53 | Type: `Stream` 54 | 55 | [Node.js HTTP response stream.](https://nodejs.org/api/http.html#http_class_http_incomingmessage) 56 | 57 | #### to 58 | 59 | Type: `Stream` 60 | 61 | Any stream. 62 | 63 | ## Related 64 | 65 | - [mimic-fn](https://github.com/sindresorhus/mimic-fn) - Make a function mimic another one 66 | - [clone-response](https://github.com/lukechilds/clone-response) - Clone a Node.js response stream 67 | 68 | --- 69 | 70 |
71 | 72 | Get professional support for this package with a Tidelift subscription 73 | 74 |
75 | 76 | Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. 77 |
78 |
79 | -------------------------------------------------------------------------------- /node_modules/normalize-url/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/normalize-url/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "normalize-url", 3 | "version": "8.0.0", 4 | "description": "Normalize a URL", 5 | "license": "MIT", 6 | "repository": "sindresorhus/normalize-url", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "type": "module", 14 | "exports": { 15 | "types": "./index.d.ts", 16 | "default": "./index.js" 17 | }, 18 | "engines": { 19 | "node": ">=14.16" 20 | }, 21 | "scripts": { 22 | "test": "xo && c8 ava && tsd" 23 | }, 24 | "files": [ 25 | "index.js", 26 | "index.d.ts" 27 | ], 28 | "keywords": [ 29 | "normalize", 30 | "url", 31 | "uri", 32 | "address", 33 | "string", 34 | "normalization", 35 | "normalisation", 36 | "query", 37 | "querystring", 38 | "simplify", 39 | "strip", 40 | "trim", 41 | "canonical" 42 | ], 43 | "devDependencies": { 44 | "ava": "^5.0.1", 45 | "c8": "^7.12.0", 46 | "tsd": "^0.24.1", 47 | "xo": "^0.52.4" 48 | }, 49 | "c8": { 50 | "reporter": [ 51 | "text", 52 | "lcov" 53 | ] 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /node_modules/p-cancelable/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | The rejection reason when `.cancel()` is called. 3 | 4 | It includes a `.isCanceled` property for convenience. 5 | */ 6 | export class CancelError extends Error { 7 | readonly name: 'CancelError'; 8 | readonly isCanceled: true; 9 | 10 | constructor(reason?: string); 11 | } 12 | 13 | /** 14 | Accepts a function that is called when the promise is canceled. 15 | 16 | You're not required to call this function. You can call this function multiple times to add multiple cancel handlers. 17 | */ 18 | export interface OnCancelFunction { 19 | shouldReject: boolean; 20 | (cancelHandler: () => void): void; 21 | } 22 | 23 | export default class PCancelable extends Promise { 24 | /** 25 | Whether the promise is canceled. 26 | */ 27 | readonly isCanceled: boolean; 28 | 29 | /** 30 | Cancel the promise and optionally provide a reason. 31 | 32 | The cancellation is synchronous. Calling it after the promise has settled or multiple times does nothing. 33 | 34 | @param reason - The cancellation reason to reject the promise with. 35 | */ 36 | cancel: (reason?: string) => void; 37 | 38 | /** 39 | Create a promise that can be canceled. 40 | 41 | Can be constructed in the same was as a [`Promise` constructor](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise), but with an appended `onCancel` parameter in `executor`. `PCancelable` is a subclass of `Promise`. 42 | 43 | Cancelling will reject the promise with `CancelError`. To avoid that, set `onCancel.shouldReject` to `false`. 44 | 45 | @example 46 | ``` 47 | import PCancelable from 'p-cancelable'; 48 | 49 | const cancelablePromise = new PCancelable((resolve, reject, onCancel) => { 50 | const job = new Job(); 51 | 52 | onCancel.shouldReject = false; 53 | onCancel(() => { 54 | job.stop(); 55 | }); 56 | 57 | job.on('finish', resolve); 58 | }); 59 | 60 | cancelablePromise.cancel(); // Doesn't throw an error 61 | ``` 62 | */ 63 | constructor( 64 | executor: ( 65 | resolve: (value?: ValueType | PromiseLike) => void, 66 | reject: (reason?: unknown) => void, 67 | onCancel: OnCancelFunction 68 | ) => void 69 | ); 70 | 71 | /** 72 | Convenience method to make your promise-returning or async function cancelable. 73 | 74 | @param fn - A promise-returning function. The function you specify will have `onCancel` appended to its parameters. 75 | 76 | @example 77 | ``` 78 | import PCancelable from 'p-cancelable'; 79 | 80 | const fn = PCancelable.fn((input, onCancel) => { 81 | const job = new Job(); 82 | 83 | onCancel(() => { 84 | job.cleanup(); 85 | }); 86 | 87 | return job.start(); //=> Promise 88 | }); 89 | 90 | const cancelablePromise = fn('input'); //=> PCancelable 91 | 92 | // … 93 | 94 | cancelablePromise.cancel(); 95 | ``` 96 | */ 97 | static fn( 98 | userFn: (onCancel: OnCancelFunction) => PromiseLike 99 | ): () => PCancelable; 100 | static fn( 101 | userFn: ( 102 | argument1: Agument1Type, 103 | onCancel: OnCancelFunction 104 | ) => PromiseLike 105 | ): (argument1: Agument1Type) => PCancelable; 106 | static fn( 107 | userFn: ( 108 | argument1: Agument1Type, 109 | argument2: Agument2Type, 110 | onCancel: OnCancelFunction 111 | ) => PromiseLike 112 | ): ( 113 | argument1: Agument1Type, 114 | argument2: Agument2Type 115 | ) => PCancelable; 116 | static fn( 117 | userFn: ( 118 | argument1: Agument1Type, 119 | argument2: Agument2Type, 120 | argument3: Agument3Type, 121 | onCancel: OnCancelFunction 122 | ) => PromiseLike 123 | ): ( 124 | argument1: Agument1Type, 125 | argument2: Agument2Type, 126 | argument3: Agument3Type 127 | ) => PCancelable; 128 | static fn( 129 | userFn: ( 130 | argument1: Agument1Type, 131 | argument2: Agument2Type, 132 | argument3: Agument3Type, 133 | argument4: Agument4Type, 134 | onCancel: OnCancelFunction 135 | ) => PromiseLike 136 | ): ( 137 | argument1: Agument1Type, 138 | argument2: Agument2Type, 139 | argument3: Agument3Type, 140 | argument4: Agument4Type 141 | ) => PCancelable; 142 | static fn< 143 | Agument1Type, 144 | Agument2Type, 145 | Agument3Type, 146 | Agument4Type, 147 | Agument5Type, 148 | ReturnType 149 | >( 150 | userFn: ( 151 | argument1: Agument1Type, 152 | argument2: Agument2Type, 153 | argument3: Agument3Type, 154 | argument4: Agument4Type, 155 | argument5: Agument5Type, 156 | onCancel: OnCancelFunction 157 | ) => PromiseLike 158 | ): ( 159 | argument1: Agument1Type, 160 | argument2: Agument2Type, 161 | argument3: Agument3Type, 162 | argument4: Agument4Type, 163 | argument5: Agument5Type 164 | ) => PCancelable; 165 | static fn( 166 | userFn: (...arguments: unknown[]) => PromiseLike 167 | ): (...arguments: unknown[]) => PCancelable; 168 | } 169 | -------------------------------------------------------------------------------- /node_modules/p-cancelable/index.js: -------------------------------------------------------------------------------- 1 | export class CancelError extends Error { 2 | constructor(reason) { 3 | super(reason || 'Promise was canceled'); 4 | this.name = 'CancelError'; 5 | } 6 | 7 | get isCanceled() { 8 | return true; 9 | } 10 | } 11 | 12 | // TODO: Use private class fields when ESLint 8 is out. 13 | 14 | export default class PCancelable { 15 | static fn(userFunction) { 16 | return (...arguments_) => { 17 | return new PCancelable((resolve, reject, onCancel) => { 18 | arguments_.push(onCancel); 19 | // eslint-disable-next-line promise/prefer-await-to-then 20 | userFunction(...arguments_).then(resolve, reject); 21 | }); 22 | }; 23 | } 24 | 25 | constructor(executor) { 26 | this._cancelHandlers = []; 27 | this._isPending = true; 28 | this._isCanceled = false; 29 | this._rejectOnCancel = true; 30 | 31 | this._promise = new Promise((resolve, reject) => { 32 | this._reject = reject; 33 | 34 | const onResolve = value => { 35 | if (!this._isCanceled || !onCancel.shouldReject) { 36 | this._isPending = false; 37 | resolve(value); 38 | } 39 | }; 40 | 41 | const onReject = error => { 42 | this._isPending = false; 43 | reject(error); 44 | }; 45 | 46 | const onCancel = handler => { 47 | if (!this._isPending) { 48 | throw new Error('The `onCancel` handler was attached after the promise settled.'); 49 | } 50 | 51 | this._cancelHandlers.push(handler); 52 | }; 53 | 54 | Object.defineProperties(onCancel, { 55 | shouldReject: { 56 | get: () => this._rejectOnCancel, 57 | set: boolean => { 58 | this._rejectOnCancel = boolean; 59 | } 60 | } 61 | }); 62 | 63 | executor(onResolve, onReject, onCancel); 64 | }); 65 | } 66 | 67 | then(onFulfilled, onRejected) { 68 | // eslint-disable-next-line promise/prefer-await-to-then 69 | return this._promise.then(onFulfilled, onRejected); 70 | } 71 | 72 | catch(onRejected) { 73 | // eslint-disable-next-line promise/prefer-await-to-then 74 | return this._promise.catch(onRejected); 75 | } 76 | 77 | finally(onFinally) { 78 | // eslint-disable-next-line promise/prefer-await-to-then 79 | return this._promise.finally(onFinally); 80 | } 81 | 82 | cancel(reason) { 83 | if (!this._isPending || this._isCanceled) { 84 | return; 85 | } 86 | 87 | this._isCanceled = true; 88 | 89 | if (this._cancelHandlers.length > 0) { 90 | try { 91 | for (const handler of this._cancelHandlers) { 92 | handler(); 93 | } 94 | } catch (error) { 95 | this._reject(error); 96 | return; 97 | } 98 | } 99 | 100 | if (this._rejectOnCancel) { 101 | this._reject(new CancelError(reason)); 102 | } 103 | } 104 | 105 | get isCanceled() { 106 | return this._isCanceled; 107 | } 108 | } 109 | 110 | Object.setPrototypeOf(PCancelable.prototype, Promise.prototype); 111 | -------------------------------------------------------------------------------- /node_modules/p-cancelable/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/p-cancelable/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "p-cancelable", 3 | "version": "3.0.0", 4 | "description": "Create a promise that can be canceled", 5 | "license": "MIT", 6 | "repository": "sindresorhus/p-cancelable", 7 | "author": { 8 | "name": "Sindre Sorhus", 9 | "email": "sindresorhus@gmail.com", 10 | "url": "https://sindresorhus.com" 11 | }, 12 | "type": "module", 13 | "exports": "./index.js", 14 | "engines": { 15 | "node": ">=12.20" 16 | }, 17 | "scripts": { 18 | "test": "xo && ava && tsd" 19 | }, 20 | "files": [ 21 | "index.js", 22 | "index.d.ts" 23 | ], 24 | "keywords": [ 25 | "promise", 26 | "cancelable", 27 | "cancel", 28 | "canceled", 29 | "canceling", 30 | "cancellable", 31 | "cancellation", 32 | "abort", 33 | "abortable", 34 | "aborting", 35 | "cleanup", 36 | "task", 37 | "token", 38 | "async", 39 | "function", 40 | "await", 41 | "promises", 42 | "bluebird" 43 | ], 44 | "devDependencies": { 45 | "ava": "^3.15.0", 46 | "delay": "^5.0.0", 47 | "tsd": "^0.16.0", 48 | "xo": "^0.40.1" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /node_modules/quick-lru/index.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace QuickLRU { 2 | interface Options { 3 | /** 4 | The maximum number of items before evicting the least recently used items. 5 | */ 6 | readonly maxSize: number; 7 | 8 | /** 9 | Called right before an item is evicted from the cache. 10 | 11 | Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`). 12 | */ 13 | onEviction?: (key: KeyType, value: ValueType) => void; 14 | } 15 | } 16 | 17 | declare class QuickLRU 18 | implements Iterable<[KeyType, ValueType]> { 19 | /** 20 | The stored item count. 21 | */ 22 | readonly size: number; 23 | 24 | /** 25 | Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29). 26 | 27 | The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop. 28 | 29 | @example 30 | ``` 31 | import QuickLRU = require('quick-lru'); 32 | 33 | const lru = new QuickLRU({maxSize: 1000}); 34 | 35 | lru.set('🦄', '🌈'); 36 | 37 | lru.has('🦄'); 38 | //=> true 39 | 40 | lru.get('🦄'); 41 | //=> '🌈' 42 | ``` 43 | */ 44 | constructor(options: QuickLRU.Options); 45 | 46 | [Symbol.iterator](): IterableIterator<[KeyType, ValueType]>; 47 | 48 | /** 49 | Set an item. 50 | 51 | @returns The list instance. 52 | */ 53 | set(key: KeyType, value: ValueType): this; 54 | 55 | /** 56 | Get an item. 57 | 58 | @returns The stored item or `undefined`. 59 | */ 60 | get(key: KeyType): ValueType | undefined; 61 | 62 | /** 63 | Check if an item exists. 64 | */ 65 | has(key: KeyType): boolean; 66 | 67 | /** 68 | Get an item without marking it as recently used. 69 | 70 | @returns The stored item or `undefined`. 71 | */ 72 | peek(key: KeyType): ValueType | undefined; 73 | 74 | /** 75 | Delete an item. 76 | 77 | @returns `true` if the item is removed or `false` if the item doesn't exist. 78 | */ 79 | delete(key: KeyType): boolean; 80 | 81 | /** 82 | Delete all items. 83 | */ 84 | clear(): void; 85 | 86 | /** 87 | Iterable for all the keys. 88 | */ 89 | keys(): IterableIterator; 90 | 91 | /** 92 | Iterable for all the values. 93 | */ 94 | values(): IterableIterator; 95 | } 96 | 97 | export = QuickLRU; 98 | -------------------------------------------------------------------------------- /node_modules/quick-lru/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class QuickLRU { 4 | constructor(options = {}) { 5 | if (!(options.maxSize && options.maxSize > 0)) { 6 | throw new TypeError('`maxSize` must be a number greater than 0'); 7 | } 8 | 9 | this.maxSize = options.maxSize; 10 | this.onEviction = options.onEviction; 11 | this.cache = new Map(); 12 | this.oldCache = new Map(); 13 | this._size = 0; 14 | } 15 | 16 | _set(key, value) { 17 | this.cache.set(key, value); 18 | this._size++; 19 | 20 | if (this._size >= this.maxSize) { 21 | this._size = 0; 22 | 23 | if (typeof this.onEviction === 'function') { 24 | for (const [key, value] of this.oldCache.entries()) { 25 | this.onEviction(key, value); 26 | } 27 | } 28 | 29 | this.oldCache = this.cache; 30 | this.cache = new Map(); 31 | } 32 | } 33 | 34 | get(key) { 35 | if (this.cache.has(key)) { 36 | return this.cache.get(key); 37 | } 38 | 39 | if (this.oldCache.has(key)) { 40 | const value = this.oldCache.get(key); 41 | this.oldCache.delete(key); 42 | this._set(key, value); 43 | return value; 44 | } 45 | } 46 | 47 | set(key, value) { 48 | if (this.cache.has(key)) { 49 | this.cache.set(key, value); 50 | } else { 51 | this._set(key, value); 52 | } 53 | 54 | return this; 55 | } 56 | 57 | has(key) { 58 | return this.cache.has(key) || this.oldCache.has(key); 59 | } 60 | 61 | peek(key) { 62 | if (this.cache.has(key)) { 63 | return this.cache.get(key); 64 | } 65 | 66 | if (this.oldCache.has(key)) { 67 | return this.oldCache.get(key); 68 | } 69 | } 70 | 71 | delete(key) { 72 | const deleted = this.cache.delete(key); 73 | if (deleted) { 74 | this._size--; 75 | } 76 | 77 | return this.oldCache.delete(key) || deleted; 78 | } 79 | 80 | clear() { 81 | this.cache.clear(); 82 | this.oldCache.clear(); 83 | this._size = 0; 84 | } 85 | 86 | * keys() { 87 | for (const [key] of this) { 88 | yield key; 89 | } 90 | } 91 | 92 | * values() { 93 | for (const [, value] of this) { 94 | yield value; 95 | } 96 | } 97 | 98 | * [Symbol.iterator]() { 99 | for (const item of this.cache) { 100 | yield item; 101 | } 102 | 103 | for (const item of this.oldCache) { 104 | const [key] = item; 105 | if (!this.cache.has(key)) { 106 | yield item; 107 | } 108 | } 109 | } 110 | 111 | get size() { 112 | let oldCacheSize = 0; 113 | for (const key of this.oldCache.keys()) { 114 | if (!this.cache.has(key)) { 115 | oldCacheSize++; 116 | } 117 | } 118 | 119 | return Math.min(this._size + oldCacheSize, this.maxSize); 120 | } 121 | } 122 | 123 | module.exports = QuickLRU; 124 | -------------------------------------------------------------------------------- /node_modules/quick-lru/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/quick-lru/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quick-lru", 3 | "version": "5.1.1", 4 | "description": "Simple “Least Recently Used” (LRU) cache", 5 | "license": "MIT", 6 | "repository": "sindresorhus/quick-lru", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "engines": { 14 | "node": ">=10" 15 | }, 16 | "scripts": { 17 | "test": "xo && nyc ava && tsd" 18 | }, 19 | "files": [ 20 | "index.js", 21 | "index.d.ts" 22 | ], 23 | "keywords": [ 24 | "lru", 25 | "quick", 26 | "cache", 27 | "caching", 28 | "least", 29 | "recently", 30 | "used", 31 | "fast", 32 | "map", 33 | "hash", 34 | "buffer" 35 | ], 36 | "devDependencies": { 37 | "ava": "^2.0.0", 38 | "coveralls": "^3.0.3", 39 | "nyc": "^15.0.0", 40 | "tsd": "^0.11.0", 41 | "xo": "^0.26.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /node_modules/quick-lru/readme.md: -------------------------------------------------------------------------------- 1 | # quick-lru [![Build Status](https://travis-ci.org/sindresorhus/quick-lru.svg?branch=master)](https://travis-ci.org/sindresorhus/quick-lru) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/quick-lru/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/quick-lru?branch=master) 2 | 3 | > Simple [“Least Recently Used” (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29) 4 | 5 | Useful when you need to cache something and limit memory usage. 6 | 7 | Inspired by the [`hashlru` algorithm](https://github.com/dominictarr/hashlru#algorithm), but instead uses [`Map`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) to support keys of any type, not just strings, and values can be `undefined`. 8 | 9 | ## Install 10 | 11 | ``` 12 | $ npm install quick-lru 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```js 18 | const QuickLRU = require('quick-lru'); 19 | 20 | const lru = new QuickLRU({maxSize: 1000}); 21 | 22 | lru.set('🦄', '🌈'); 23 | 24 | lru.has('🦄'); 25 | //=> true 26 | 27 | lru.get('🦄'); 28 | //=> '🌈' 29 | ``` 30 | 31 | ## API 32 | 33 | ### new QuickLRU(options?) 34 | 35 | Returns a new instance. 36 | 37 | ### options 38 | 39 | Type: `object` 40 | 41 | #### maxSize 42 | 43 | *Required*\ 44 | Type: `number` 45 | 46 | The maximum number of items before evicting the least recently used items. 47 | 48 | #### onEviction 49 | 50 | *Optional*\ 51 | Type: `(key, value) => void` 52 | 53 | Called right before an item is evicted from the cache. 54 | 55 | Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`). 56 | 57 | ### Instance 58 | 59 | The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop. 60 | 61 | Both `key` and `value` can be of any type. 62 | 63 | #### .set(key, value) 64 | 65 | Set an item. Returns the instance. 66 | 67 | #### .get(key) 68 | 69 | Get an item. 70 | 71 | #### .has(key) 72 | 73 | Check if an item exists. 74 | 75 | #### .peek(key) 76 | 77 | Get an item without marking it as recently used. 78 | 79 | #### .delete(key) 80 | 81 | Delete an item. 82 | 83 | Returns `true` if the item is removed or `false` if the item doesn't exist. 84 | 85 | #### .clear() 86 | 87 | Delete all items. 88 | 89 | #### .keys() 90 | 91 | Iterable for all the keys. 92 | 93 | #### .values() 94 | 95 | Iterable for all the values. 96 | 97 | #### .size 98 | 99 | The stored item count. 100 | 101 | --- 102 | 103 |
104 | 105 | Get professional support for this package with a Tidelift subscription 106 | 107 |
108 | 109 | Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. 110 |
111 |
112 | -------------------------------------------------------------------------------- /node_modules/resolve-alpn/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Szymon Marczak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /node_modules/resolve-alpn/README.md: -------------------------------------------------------------------------------- 1 | # `resolve-alpn` 2 | 3 | [![Node CI](https://github.com/szmarczak/resolve-alpn/workflows/Node%20CI/badge.svg)](https://github.com/szmarczak/resolve-alpn/actions) 4 | [![codecov](https://codecov.io/gh/szmarczak/resolve-alpn/branch/master/graph/badge.svg)](https://codecov.io/gh/szmarczak/resolve-alpn) 5 | 6 | ## API 7 | 8 | ### resolveALPN(options, connect = tls.connect) 9 | 10 | Returns an object with an `alpnProtocol` property. The `socket` property may be also present. 11 | 12 | ```js 13 | const result = await resolveALPN({ 14 | host: 'nghttp2.org', 15 | port: 443, 16 | ALPNProtocols: ['h2', 'http/1.1'], 17 | servername: 'nghttp2.org' 18 | }); 19 | 20 | console.log(result); // {alpnProtocol: 'h2'} 21 | ``` 22 | 23 | **Note:** While the `servername` option is not required in this case, many other servers do. It's best practice to set it anyway. 24 | 25 | **Note:** If the socket times out, the promise will resolve and `result.timeout` will be set to `true`. 26 | 27 | #### options 28 | 29 | Same as [TLS options](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback). 30 | 31 | ##### options.resolveSocket 32 | 33 | By default, the socket gets destroyed and the promise resolves.
34 | If you set this to true, it will return the socket in a `socket` property. 35 | 36 | ```js 37 | const result = await resolveALPN({ 38 | host: 'nghttp2.org', 39 | port: 443, 40 | ALPNProtocols: ['h2', 'http/1.1'], 41 | servername: 'nghttp2.org', 42 | resolveSocket: true 43 | }); 44 | 45 | console.log(result); // {alpnProtocol: 'h2', socket: tls.TLSSocket} 46 | 47 | // Remember to destroy the socket if you don't use it! 48 | result.socket.destroy(); 49 | ``` 50 | 51 | #### connect 52 | 53 | Type: `Function | AsyncFunction`\ 54 | Default: [`tls.connect`](https://nodejs.org/dist/latest-v16.x/docs/api/tls.html#tls_tls_connect_options_callback) 55 | 56 | **Note:** No matter which function is used (synchronous or asynchronous), it **must** accept a `callback` function as a second argument. The `callback` function gets executed when the socket has successfully connected. 57 | 58 | ## License 59 | 60 | MIT 61 | -------------------------------------------------------------------------------- /node_modules/resolve-alpn/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const tls = require('tls'); 3 | 4 | module.exports = (options = {}, connect = tls.connect) => new Promise((resolve, reject) => { 5 | let timeout = false; 6 | 7 | let socket; 8 | 9 | const callback = async () => { 10 | await socketPromise; 11 | 12 | socket.off('timeout', onTimeout); 13 | socket.off('error', reject); 14 | 15 | if (options.resolveSocket) { 16 | resolve({alpnProtocol: socket.alpnProtocol, socket, timeout}); 17 | 18 | if (timeout) { 19 | await Promise.resolve(); 20 | socket.emit('timeout'); 21 | } 22 | } else { 23 | socket.destroy(); 24 | resolve({alpnProtocol: socket.alpnProtocol, timeout}); 25 | } 26 | }; 27 | 28 | const onTimeout = async () => { 29 | timeout = true; 30 | callback(); 31 | }; 32 | 33 | const socketPromise = (async () => { 34 | try { 35 | socket = await connect(options, callback); 36 | 37 | socket.on('error', reject); 38 | socket.once('timeout', onTimeout); 39 | } catch (error) { 40 | reject(error); 41 | } 42 | })(); 43 | }); 44 | -------------------------------------------------------------------------------- /node_modules/resolve-alpn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resolve-alpn", 3 | "version": "1.2.1", 4 | "description": "Detects the ALPN protocol", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava" 8 | }, 9 | "files": [ 10 | "index.js" 11 | ], 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/szmarczak/resolve-alpn.git" 15 | }, 16 | "keywords": [ 17 | "alpn", 18 | "tls", 19 | "socket", 20 | "http2" 21 | ], 22 | "author": "Szymon Marczak", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/szmarczak/resolve-alpn/issues" 26 | }, 27 | "homepage": "https://github.com/szmarczak/resolve-alpn#readme", 28 | "devDependencies": { 29 | "ava": "^3.15.0", 30 | "nyc": "^15.1.0", 31 | "pem": "1.14.3", 32 | "xo": "^0.38.2" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /node_modules/responselike/index.d.ts: -------------------------------------------------------------------------------- 1 | import {Buffer} from 'node:buffer'; 2 | import {Readable as ReadableStream} from 'node:stream'; 3 | 4 | export type Options = { 5 | /** 6 | The HTTP response status code. 7 | */ 8 | readonly statusCode: number; 9 | 10 | /** 11 | The HTTP headers object. 12 | 13 | Keys are in lowercase. 14 | */ 15 | readonly headers: Record; 16 | 17 | /** 18 | The response body. 19 | 20 | The contents will be streamable but is also exposed directly as `response.body`. 21 | */ 22 | readonly body: Buffer; 23 | 24 | /** 25 | The request URL string. 26 | */ 27 | readonly url: string; 28 | }; 29 | 30 | /** 31 | Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage). 32 | 33 | @example 34 | ``` 35 | import Response from 'responselike'; 36 | 37 | const response = new Response({ 38 | statusCode: 200, 39 | headers: { 40 | foo: 'bar' 41 | }, 42 | body: Buffer.from('Hi!'), 43 | url: 'https://example.com' 44 | }); 45 | 46 | response.statusCode; 47 | // 200 48 | 49 | response.headers; 50 | // {foo: 'bar'} 51 | 52 | response.body; 53 | // 54 | 55 | response.url; 56 | // 'https://example.com' 57 | 58 | response.pipe(process.stdout); 59 | // 'Hi!' 60 | ``` 61 | */ 62 | export default class Response extends ReadableStream { 63 | /** 64 | The HTTP response status code. 65 | */ 66 | readonly statusCode: number; 67 | 68 | /** 69 | The HTTP headers. 70 | 71 | Keys will be automatically lowercased. 72 | */ 73 | readonly headers: Record; 74 | 75 | /** 76 | The response body. 77 | */ 78 | readonly body: Buffer; 79 | 80 | /** 81 | The request URL string. 82 | */ 83 | readonly url: string; 84 | 85 | constructor(options?: Options); 86 | } 87 | -------------------------------------------------------------------------------- /node_modules/responselike/index.js: -------------------------------------------------------------------------------- 1 | import {Readable as ReadableStream} from 'node:stream'; 2 | import lowercaseKeys from 'lowercase-keys'; 3 | 4 | export default class Response extends ReadableStream { 5 | statusCode; 6 | headers; 7 | body; 8 | url; 9 | 10 | constructor({statusCode, headers, body, url}) { 11 | if (typeof statusCode !== 'number') { 12 | throw new TypeError('Argument `statusCode` should be a number'); 13 | } 14 | 15 | if (typeof headers !== 'object') { 16 | throw new TypeError('Argument `headers` should be an object'); 17 | } 18 | 19 | if (!(body instanceof Uint8Array)) { 20 | throw new TypeError('Argument `body` should be a buffer'); 21 | } 22 | 23 | if (typeof url !== 'string') { 24 | throw new TypeError('Argument `url` should be a string'); 25 | } 26 | 27 | super({ 28 | read() { 29 | this.push(body); 30 | this.push(null); 31 | }, 32 | }); 33 | 34 | this.statusCode = statusCode; 35 | this.headers = lowercaseKeys(headers); 36 | this.body = body; 37 | this.url = url; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /node_modules/responselike/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | Copyright (c) Luke Childs (https://lukechilds.co.uk) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 | -------------------------------------------------------------------------------- /node_modules/responselike/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "responselike", 3 | "version": "3.0.0", 4 | "description": "A response-like object for mocking a Node.js HTTP response stream", 5 | "license": "MIT", 6 | "repository": "sindresorhus/responselike", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": "Luke Childs (https://lukechilds.co.uk)", 9 | "type": "module", 10 | "exports": "./index.js", 11 | "engines": { 12 | "node": ">=14.16" 13 | }, 14 | "scripts": { 15 | "test": "xo && ava && tsd" 16 | }, 17 | "files": [ 18 | "index.js", 19 | "index.d.ts" 20 | ], 21 | "keywords": [ 22 | "http", 23 | "https", 24 | "response", 25 | "mock", 26 | "test", 27 | "request", 28 | "responselike" 29 | ], 30 | "dependencies": { 31 | "lowercase-keys": "^3.0.0" 32 | }, 33 | "devDependencies": { 34 | "ava": "^4.3.1", 35 | "get-stream": "^6.0.1", 36 | "tsd": "^0.22.0", 37 | "xo": "^0.50.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /node_modules/responselike/readme.md: -------------------------------------------------------------------------------- 1 | # responselike 2 | 3 | > A response-like object for mocking a Node.js HTTP response stream 4 | 5 | Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage). Useful for formatting cached responses so they can be consumed by code expecting a real response. 6 | 7 | ## Install 8 | 9 | ```sh 10 | npm install responselike 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import Response from 'responselike'; 17 | 18 | const response = new Response({ 19 | statusCode: 200, 20 | headers: { 21 | foo: 'bar' 22 | }, 23 | body: Buffer.from('Hi!'), 24 | url: 'https://example.com' 25 | }); 26 | 27 | response.statusCode; 28 | // 200 29 | 30 | response.headers; 31 | // {foo: 'bar'} 32 | 33 | response.body; 34 | // 35 | 36 | response.url; 37 | // 'https://example.com' 38 | 39 | response.pipe(process.stdout); 40 | // 'Hi!' 41 | ``` 42 | 43 | ## API 44 | 45 | ### new Response(options?) 46 | 47 | Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage). 48 | 49 | #### options 50 | 51 | Type: `object` 52 | 53 | ##### statusCode 54 | 55 | Type: `number` 56 | 57 | The HTTP response status code. 58 | 59 | ##### headers 60 | 61 | Type: `object` 62 | 63 | The HTTP headers. Keys will be automatically lowercased. 64 | 65 | ##### body 66 | 67 | Type: `Buffer` 68 | 69 | The response body. The Buffer contents will be streamable but is also exposed directly as `response.body`. 70 | 71 | ##### url 72 | 73 | Type: `string` 74 | 75 | The request URL string. 76 | -------------------------------------------------------------------------------- /version/version.txt: -------------------------------------------------------------------------------- 1 | 1.1 -------------------------------------------------------------------------------- /一面玩家.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zll2317463866/tiger/71025d6b06c6e32dc0e2282a0b3233fec2d735c1/一面玩家.jpg --------------------------------------------------------------------------------