diff options
Diffstat (limited to 'includes/external/addressbook/node_modules/cacheable-request')
11 files changed, 895 insertions, 0 deletions
diff --git a/includes/external/addressbook/node_modules/cacheable-request/LICENSE b/includes/external/addressbook/node_modules/cacheable-request/LICENSE new file mode 100644 index 0000000..a9e3a17 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2017-2021 Luke Childs +Copyright (c) 2022 Jared Wray + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/includes/external/addressbook/node_modules/cacheable-request/README.md b/includes/external/addressbook/node_modules/cacheable-request/README.md new file mode 100644 index 0000000..b02b7b4 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/README.md @@ -0,0 +1,334 @@ +# cacheable-request + +> Wrap native HTTP requests with RFC compliant cache support + +[![tests](https://github.com/jaredwray/cacheable-request/actions/workflows/tests.yaml/badge.svg)](https://github.com/jaredwray/cacheable-request/actions/workflows/tests.yaml) +[![codecov](https://codecov.io/gh/jaredwray/cacheable-request/branch/master/graph/badge.svg?token=LDLaqe4PsI)](https://codecov.io/gh/jaredwray/cacheable-request) +[![npm](https://img.shields.io/npm/dm/cacheable-request.svg)](https://www.npmjs.com/package/cacheable-request) +[![npm](https://img.shields.io/npm/v/cacheable-request.svg)](https://www.npmjs.com/package/cacheable-request) + +[RFC 7234](http://httpwg.org/specs/rfc7234.html) compliant HTTP caching for native Node.js HTTP/HTTPS requests. Caching works out of the box in memory or is easily pluggable with a wide range of storage adapters. + +**Note:** This is a low level wrapper around the core HTTP modules, it's not a high level request library. + +# Table of Contents +* [Latest Changes](#latest-changes) +* [Features](#features) +* [Install and Usage](#install-and-usage) +* [Storage Adapters](#storage-adapters) +* [API](#api) +* [Using Hooks](#using-hooks) +* [Contributing](#contributing) +* [Ask a Question](#ask-a-question) +* [License](#license) (MIT) + +# Latest Changes + +## Breaking Changes with v10.0.0 +This release contains breaking changes. This is the new way to use this package. + +### Usage Before v10 +```js +import http from 'http'; +import CacheableRequest from 'cacheable-request'; + +// Then instead of +const req = http.request('http://example.com', cb); +req.end(); + +// You can do +const cacheableRequest = new CacheableRequest(http.request); +const cacheReq = cacheableRequest('http://example.com', cb); +cacheReq.on('request', req => req.end()); +// Future requests to 'example.com' will be returned from cache if still valid + +// You pass in any other http.request API compatible method to be wrapped with cache support: +const cacheableRequest = new CacheableRequest(https.request); +const cacheableRequest = new CacheableRequest(electron.net); +``` + +### Usage After v10.1.0 +```js + +import CacheableRequest from 'cacheable-request'; + +// Now You can do +const cacheableRequest = new CacheableRequest(http.request).request(); +const cacheReq = cacheableRequest('http://example.com', cb); +cacheReq.on('request', req => req.end()); +// Future requests to 'example.com' will be returned from cache if still valid + +// You pass in any other http.request API compatible method to be wrapped with cache support: +const cacheableRequest = new CacheableRequest(https.request).request(); +const cacheableRequest = new CacheableRequest(electron.net).request(); +``` + +The biggest change is that when you do a `new` CacheableRequest you now want to call `request` method will give you the instance to use. + +```diff +- const cacheableRequest = new CacheableRequest(http.request); ++ const cacheableRequest = new CacheableRequest(http.request).request(); +``` + +### ESM Support in version 9 and higher. + +We are now using pure esm support in our package. If you need to use commonjs you can use v8 or lower. To learn more about using ESM please read this from `sindresorhus`: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +## Features + +- Only stores cacheable responses as defined by RFC 7234 +- Fresh cache entries are served directly from cache +- Stale cache entries are revalidated with `If-None-Match`/`If-Modified-Since` headers +- 304 responses from revalidation requests use cached body +- Updates `Age` header on cached responses +- Can completely bypass cache on a per request basis +- In memory cache by default +- Official support for Redis, Memcache, Etcd, MongoDB, SQLite, PostgreSQL and MySQL storage adapters +- Easily plug in your own or third-party storage adapters +- If DB connection fails, cache is automatically bypassed ([disabled by default](#optsautomaticfailover)) +- Adds cache support to any existing HTTP code with minimal changes +- Uses [http-cache-semantics](https://github.com/pornel/http-cache-semantics) internally for HTTP RFC 7234 compliance + +## Install and Usage + +```shell +npm install cacheable-request +``` + +```js +import http from 'http'; +import CacheableRequest from 'cacheable-request'; + +// Then instead of +const req = http.request('http://example.com', cb); +req.end(); + +// You can do +const cacheableRequest = new CacheableRequest(http.request).createCacheableRequest(); +const cacheReq = cacheableRequest('http://example.com', cb); +cacheReq.on('request', req => req.end()); +// Future requests to 'example.com' will be returned from cache if still valid + +// You pass in any other http.request API compatible method to be wrapped with cache support: +const cacheableRequest = new CacheableRequest(https.request).createCacheableRequest(); +const cacheableRequest = new CacheableRequest(electron.net).createCacheableRequest(); +``` + +## Storage Adapters + +`cacheable-request` uses [Keyv](https://github.com/jaredwray/keyv) to support a wide range of storage adapters. + +For example, to use Redis as a cache backend, you just need to install the official Redis Keyv storage adapter: + +``` +npm install @keyv/redis +``` + +And then you can pass `CacheableRequest` your connection string: + +```js +const cacheableRequest = new CacheableRequest(http.request, 'redis://user:pass@localhost:6379').createCacheableRequest(); +``` + +[View all official Keyv storage adapters.](https://github.com/jaredwray/keyv#official-storage-adapters) + +Keyv also supports anything that follows the Map API so it's easy to write your own storage adapter or use a third-party solution. + +e.g The following are all valid storage adapters + +```js +const storageAdapter = new Map(); +// or +const storageAdapter = require('./my-storage-adapter'); +// or +const QuickLRU = require('quick-lru'); +const storageAdapter = new QuickLRU({ maxSize: 1000 }); + +const cacheableRequest = new CacheableRequest(http.request, storageAdapter).createCacheableRequest(); +``` + +View the [Keyv docs](https://github.com/jaredwray/keyv) for more information on how to use storage adapters. + +## API + +### new cacheableRequest(request, [storageAdapter]) + +Returns the provided request function wrapped with cache support. + +#### request + +Type: `function` + +Request function to wrap with cache support. Should be [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) or a similar API compatible request function. + +#### storageAdapter + +Type: `Keyv storage adapter`<br> +Default: `new Map()` + +A [Keyv](https://github.com/jaredwray/keyv) storage adapter instance, or connection string if using with an official Keyv storage adapter. + +### Instance + +#### cacheableRequest(opts, [cb]) + +Returns an event emitter. + +##### opts + +Type: `object`, `string` + +- Any of the default request functions options. +- Any [`http-cache-semantics`](https://github.com/kornelski/http-cache-semantics#constructor-options) options. +- Any of the following: + +###### opts.cache + +Type: `boolean`<br> +Default: `true` + +If the cache should be used. Setting this to false will completely bypass the cache for the current request. + +###### opts.strictTtl + +Type: `boolean`<br> +Default: `false` + +If set to `true` once a cached resource has expired it is deleted and will have to be re-requested. + +If set to `false` (default), after a cached resource's TTL expires it is kept in the cache and will be revalidated on the next request with `If-None-Match`/`If-Modified-Since` headers. + +###### opts.maxTtl + +Type: `number`<br> +Default: `undefined` + +Limits TTL. The `number` represents milliseconds. + +###### opts.automaticFailover + +Type: `boolean`<br> +Default: `false` + +When set to `true`, if the DB connection fails we will automatically fallback to a network request. DB errors will still be emitted to notify you of the problem even though the request callback may succeed. + +###### opts.forceRefresh + +Type: `boolean`<br> +Default: `false` + +Forces refreshing the cache. If the response could be retrieved from the cache, it will perform a new request and override the cache instead. + +##### cb + +Type: `function` + +The callback function which will receive the response as an argument. + +The response can be either a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or a [responselike object](https://github.com/lukechilds/responselike). The response will also have a `fromCache` property set with a boolean value. + +##### .on('request', request) + +`request` event to get the request object of the request. + +**Note:** This event will only fire if an HTTP request is actually made, not when a response is retrieved from cache. However, you should always handle the `request` event to end the request and handle any potential request errors. + +##### .on('response', response) + +`response` event to get the response object from the HTTP request or cache. + +##### .on('error', error) + +`error` event emitted in case of an error with the cache. + +Errors emitted here will be an instance of `CacheableRequest.RequestError` or `CacheableRequest.CacheError`. You will only ever receive a `RequestError` if the request function throws (normally caused by invalid user input). Normal request errors should be handled inside the `request` event. + +To properly handle all error scenarios you should use the following pattern: + +```js +cacheableRequest('example.com', cb) + .on('error', err => { + if (err instanceof CacheableRequest.CacheError) { + handleCacheError(err); // Cache error + } else if (err instanceof CacheableRequest.RequestError) { + handleRequestError(err); // Request function thrown + } + }) + .on('request', req => { + req.on('error', handleRequestError); // Request error emitted + req.end(); + }); +``` +**Note:** Database connection errors are emitted here, however `cacheable-request` will attempt to re-request the resource and bypass the cache on a connection error. Therefore a database connection error doesn't necessarily mean the request won't be fulfilled. + + +## Using Hooks +Hooks have been implemented since version `v9` and are very useful to modify response before saving it in cache. You can use hooks to modify response before saving it in cache. + +### Add Hooks + +The hook will pre compute response right before saving it in cache. You can include many hooks and it will run in order you add hook on response object. + +```js +import http from 'http'; +import CacheableRequest from 'cacheable-request'; + +const cacheableRequest = new CacheableRequest(request, cache).request(); + +// adding a hook to decompress response +cacheableRequest.addHook('onResponse', async (value: CacheValue, response: any) => { + const buffer = await pm(gunzip)(value.body); + value.body = buffer.toString(); + return value; +}); +``` + +here is also an example of how to add in the remote address + +```js +import CacheableRequest, {CacheValue} from 'cacheable-request'; + +const cacheableRequest = new CacheableRequest(request, cache).request(); +cacheableRequest.addHook('onResponse', (value: CacheValue, response: any) => { + if (response.connection) { + value.remoteAddress = response.connection.remoteAddress; + } + + return value; +}); +``` + +### Remove Hooks + +You can also remove hook by using below + +```js +CacheableRequest.removeHook('onResponse'); +``` + +## How to Contribute + +Cacheable-Request is an open source package and community driven that is maintained regularly. In addtion we have a couple of other guidelines for review: + +* [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) - Our code of conduct +* [CONTRIBUTING.md](CONTRIBUTING.md) - How to contribute to this project +* [SECURITY.md](SECURITY.md) - Security guidelines and supported versions + +## Post an Issue + +To post an issue, navigate to the "Issues" tab in the main repository, and then select "New Issue." Enter a clear title describing the issue, as well as a description containing additional relevant information. Also select the label that best describes your issue type. For a bug report, for example, create an issue with the label "bug." In the description field, Be sure to include replication steps, as well as any relevant error messages. + +If you're reporting a security violation, be sure to check out the project's [security policy](SECURITY.md). + +Please also refer to our [Code of Conduct](CODE_OF_CONDUCT.md) for more information on how to report issues. + +## Ask a Question + +To ask a question, create an issue with the label "question." In the issue description, include the related code and any context that can help us answer your question. + +## License + +This project is under the [MIT](LICENSE) license. + +MIT © Luke Childs 2017-2021 +MIT © Jared Wray 2022 diff --git a/includes/external/addressbook/node_modules/cacheable-request/dist/index.d.ts b/includes/external/addressbook/node_modules/cacheable-request/dist/index.d.ts new file mode 100644 index 0000000..123a8e3 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/dist/index.d.ts @@ -0,0 +1,17 @@ +import { RequestFn, StorageAdapter, CacheResponse, CacheValue, CacheableOptions, Emitter } from './types.js'; +type Func = (...args: any[]) => any; +declare class CacheableRequest { + cache: StorageAdapter; + cacheRequest: RequestFn; + hooks: Map<string, Func>; + constructor(cacheRequest: RequestFn, cacheAdapter?: StorageAdapter | string); + request: () => (options: CacheableOptions, cb?: (response: CacheResponse) => void) => Emitter; + addHook: (name: string, fn: Func) => void; + removeHook: (name: string) => boolean; + getHook: (name: string) => Func; + runHook: (name: string, ...args: any[]) => Promise<CacheValue>; +} +export default CacheableRequest; +export * from './types.js'; +export declare const onResponse = "onResponse"; +//# sourceMappingURL=index.d.ts.map
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/cacheable-request/dist/index.d.ts.map b/includes/external/addressbook/node_modules/cacheable-request/dist/index.d.ts.map new file mode 100644 index 0000000..318c87e --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/dist/index.d.ts.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/cacheable-request/dist/index.js b/includes/external/addressbook/node_modules/cacheable-request/dist/index.js new file mode 100644 index 0000000..3ab3ccc --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/dist/index.js @@ -0,0 +1,275 @@ +import EventEmitter from 'node:events'; +import urlLib from 'node:url'; +import crypto from 'node:crypto'; +import stream, { PassThrough as PassThroughStream } from 'node:stream'; +import normalizeUrl from 'normalize-url'; +import getStream from 'get-stream'; +import CachePolicy from 'http-cache-semantics'; +import Response from 'responselike'; +import Keyv from 'keyv'; +import mimicResponse from 'mimic-response'; +import { CacheError, RequestError } from './types.js'; +class CacheableRequest { + constructor(cacheRequest, cacheAdapter) { + this.hooks = new Map(); + this.request = () => (options, cb) => { + let url; + if (typeof options === 'string') { + url = normalizeUrlObject(urlLib.parse(options)); + options = {}; + } + else if (options instanceof urlLib.URL) { + url = normalizeUrlObject(urlLib.parse(options.toString())); + options = {}; + } + else { + const [pathname, ...searchParts] = (options.path ?? '').split('?'); + const search = searchParts.length > 0 + ? `?${searchParts.join('?')}` + : ''; + url = normalizeUrlObject({ ...options, pathname, search }); + } + options = { + headers: {}, + method: 'GET', + cache: true, + strictTtl: false, + automaticFailover: false, + ...options, + ...urlObjectToRequestOptions(url), + }; + options.headers = Object.fromEntries(entries(options.headers).map(([key, value]) => [key.toLowerCase(), value])); + const ee = new EventEmitter(); + const normalizedUrlString = normalizeUrl(urlLib.format(url), { + stripWWW: false, + removeTrailingSlash: false, + stripAuthentication: false, + }); + let key = `${options.method}:${normalizedUrlString}`; + // POST, PATCH, and PUT requests may be cached, depending on the response + // cache-control headers. As a result, the body of the request should be + // added to the cache key in order to avoid collisions. + if (options.body && options.method !== undefined && ['POST', 'PATCH', 'PUT'].includes(options.method)) { + if (options.body instanceof stream.Readable) { + // Streamed bodies should completely skip the cache because they may + // or may not be hashable and in either case the stream would need to + // close before the cache key could be generated. + options.cache = false; + } + else { + key += `:${crypto.createHash('md5').update(options.body).digest('hex')}`; + } + } + let revalidate = false; + let madeRequest = false; + const makeRequest = (options_) => { + madeRequest = true; + let requestErrored = false; + let requestErrorCallback = () => { }; + const requestErrorPromise = new Promise(resolve => { + requestErrorCallback = () => { + if (!requestErrored) { + requestErrored = true; + resolve(); + } + }; + }); + const handler = async (response) => { + if (revalidate) { + response.status = response.statusCode; + const revalidatedPolicy = CachePolicy.fromObject(revalidate.cachePolicy).revalidatedPolicy(options_, response); + if (!revalidatedPolicy.modified) { + response.resume(); + await new Promise(resolve => { + // Skipping 'error' handler cause 'error' event should't be emitted for 304 response + response + .once('end', resolve); + }); + const headers = convertHeaders(revalidatedPolicy.policy.responseHeaders()); + response = new Response({ statusCode: revalidate.statusCode, headers, body: revalidate.body, url: revalidate.url }); + response.cachePolicy = revalidatedPolicy.policy; + response.fromCache = true; + } + } + if (!response.fromCache) { + response.cachePolicy = new CachePolicy(options_, response, options_); + response.fromCache = false; + } + let clonedResponse; + if (options_.cache && response.cachePolicy.storable()) { + clonedResponse = cloneResponse(response); + (async () => { + try { + const bodyPromise = getStream.buffer(response); + await Promise.race([ + requestErrorPromise, + new Promise(resolve => response.once('end', resolve)), + new Promise(resolve => response.once('close', resolve)), // eslint-disable-line no-promise-executor-return + ]); + const body = await bodyPromise; + let value = { + url: response.url, + statusCode: response.fromCache ? revalidate.statusCode : response.statusCode, + body, + cachePolicy: response.cachePolicy.toObject(), + }; + let ttl = options_.strictTtl ? response.cachePolicy.timeToLive() : undefined; + if (options_.maxTtl) { + ttl = ttl ? Math.min(ttl, options_.maxTtl) : options_.maxTtl; + } + if (this.hooks.size > 0) { + /* eslint-disable no-await-in-loop */ + for (const key_ of this.hooks.keys()) { + value = await this.runHook(key_, value, response); + } + /* eslint-enable no-await-in-loop */ + } + await this.cache.set(key, value, ttl); + } + catch (error) { + ee.emit('error', new CacheError(error)); + } + })(); + } + else if (options_.cache && revalidate) { + (async () => { + try { + await this.cache.delete(key); + } + catch (error) { + ee.emit('error', new CacheError(error)); + } + })(); + } + ee.emit('response', clonedResponse ?? response); + if (typeof cb === 'function') { + cb(clonedResponse ?? response); + } + }; + try { + const request_ = this.cacheRequest(options_, handler); + request_.once('error', requestErrorCallback); + request_.once('abort', requestErrorCallback); + request_.once('destroy', requestErrorCallback); + ee.emit('request', request_); + } + catch (error) { + ee.emit('error', new RequestError(error)); + } + }; + (async () => { + const get = async (options_) => { + await Promise.resolve(); + const cacheEntry = options_.cache ? await this.cache.get(key) : undefined; + if (typeof cacheEntry === 'undefined' && !options_.forceRefresh) { + makeRequest(options_); + return; + } + const policy = CachePolicy.fromObject(cacheEntry.cachePolicy); + if (policy.satisfiesWithoutRevalidation(options_) && !options_.forceRefresh) { + const headers = convertHeaders(policy.responseHeaders()); + const response = new Response({ statusCode: cacheEntry.statusCode, headers, body: cacheEntry.body, url: cacheEntry.url }); + response.cachePolicy = policy; + response.fromCache = true; + ee.emit('response', response); + if (typeof cb === 'function') { + cb(response); + } + } + else if (policy.satisfiesWithoutRevalidation(options_) && Date.now() >= policy.timeToLive() && options_.forceRefresh) { + await this.cache.delete(key); + options_.headers = policy.revalidationHeaders(options_); + makeRequest(options_); + } + else { + revalidate = cacheEntry; + options_.headers = policy.revalidationHeaders(options_); + makeRequest(options_); + } + }; + const errorHandler = (error) => ee.emit('error', new CacheError(error)); + if (this.cache instanceof Keyv) { + const cachek = this.cache; + cachek.once('error', errorHandler); + ee.on('error', () => cachek.removeListener('error', errorHandler)); + ee.on('response', () => cachek.removeListener('error', errorHandler)); + } + try { + await get(options); + } + catch (error) { + if (options.automaticFailover && !madeRequest) { + makeRequest(options); + } + ee.emit('error', new CacheError(error)); + } + })(); + return ee; + }; + this.addHook = (name, fn) => { + if (!this.hooks.has(name)) { + this.hooks.set(name, fn); + } + }; + this.removeHook = (name) => this.hooks.delete(name); + this.getHook = (name) => this.hooks.get(name); + this.runHook = async (name, ...args) => this.hooks.get(name)?.(...args); + if (cacheAdapter instanceof Keyv) { + this.cache = cacheAdapter; + } + else if (typeof cacheAdapter === 'string') { + this.cache = new Keyv({ + uri: cacheAdapter, + namespace: 'cacheable-request', + }); + } + else { + this.cache = new Keyv({ + store: cacheAdapter, + namespace: 'cacheable-request', + }); + } + this.request = this.request.bind(this); + this.cacheRequest = cacheRequest; + } +} +const entries = Object.entries; +const cloneResponse = (response) => { + const clone = new PassThroughStream({ autoDestroy: false }); + mimicResponse(response, clone); + return response.pipe(clone); +}; +const urlObjectToRequestOptions = (url) => { + const options = { ...url }; + options.path = `${url.pathname || '/'}${url.search || ''}`; + delete options.pathname; + delete options.search; + return options; +}; +const normalizeUrlObject = (url) => +// If url was parsed by url.parse or new URL: +// - hostname will be set +// - host will be hostname[:port] +// - port will be set if it was explicit in the parsed string +// Otherwise, url was from request options: +// - hostname or host may be set +// - host shall not have port encoded +({ + protocol: url.protocol, + auth: url.auth, + hostname: url.hostname || url.host || 'localhost', + port: url.port, + pathname: url.pathname, + search: url.search, +}); +const convertHeaders = (headers) => { + const result = []; + for (const name of Object.keys(headers)) { + result[name.toLowerCase()] = headers[name]; + } + return result; +}; +export default CacheableRequest; +export * from './types.js'; +export const onResponse = 'onResponse'; +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/cacheable-request/dist/index.js.map b/includes/external/addressbook/node_modules/cacheable-request/dist/index.js.map new file mode 100644 index 0000000..60a4412 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,MAAM,EAAE,EAAC,WAAW,IAAI,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAErE,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,QAAQ,MAAM,cAAc,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAoF,UAAU,EAAE,YAAY,EAAoC,MAAM,YAAY,CAAC;AAI1K,MAAM,gBAAgB;IAIrB,YAAY,YAAuB,EAAE,YAAsC;QAD3E,UAAK,GAAsB,IAAI,GAAG,EAAgB,CAAC;QAoBnD,YAAO,GAAG,GAAG,EAAE,CAAC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AClB,CAAC,CAAC;AAEJ,MAAM,cAAc,GAAG,CAAC,OAA4B,EAAE,EAAE;IACvD,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QACxC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KAC3C;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC"}
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/cacheable-request/dist/types.d.ts b/includes/external/addressbook/node_modules/cacheable-request/dist/types.d.ts new file mode 100644 index 0000000..151b576 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/dist/types.d.ts @@ -0,0 +1,106 @@ +/// <reference types="node" resolution-mode="require"/> +/// <reference types="node" resolution-mode="require"/> +/// <reference types="node" resolution-mode="require"/> +/// <reference types="node" resolution-mode="require"/> +import { request, RequestOptions, ClientRequest, ServerResponse } from 'node:http'; +import { URL } from 'node:url'; +import { EventEmitter } from 'node:events'; +import { Buffer } from 'node:buffer'; +import { Store } from 'keyv'; +import ResponseLike from 'responselike'; +import { CachePolicyObject } from 'http-cache-semantics'; +export type RequestFn = typeof request; +export type RequestFunction = typeof request; +export type CacheResponse = ServerResponse | typeof ResponseLike; +export type CacheableRequestFunction = (options: CacheableOptions, cb?: (response: CacheResponse) => void) => Emitter; +export type CacheableOptions = Options & RequestOptions | string | URL; +export type StorageAdapter = Store<any>; +export interface Options { + /** + * If the cache should be used. Setting this to `false` will completely bypass the cache for the current request. + * @default true + */ + cache?: boolean | undefined; + /** + * If set to `true` once a cached resource has expired it is deleted and will have to be re-requested. + * + * If set to `false`, after a cached resource's TTL expires it is kept in the cache and will be revalidated + * on the next request with `If-None-Match`/`If-Modified-Since` headers. + * @default false + */ + strictTtl?: boolean | undefined; + /** + * Limits TTL. The `number` represents milliseconds. + * @default undefined + */ + maxTtl?: number | undefined; + /** + * When set to `true`, if the DB connection fails we will automatically fallback to a network request. + * DB errors will still be emitted to notify you of the problem even though the request callback may succeed. + * @default false + */ + automaticFailover?: boolean | undefined; + /** + * Forces refreshing the cache. If the response could be retrieved from the cache, it will perform a + * new request and override the cache instead. + * @default false + */ + forceRefresh?: boolean | undefined; + remoteAddress?: boolean | undefined; + url?: string | undefined; + headers?: Record<string, string | string[] | undefined>; + body?: Buffer; +} +export interface CacheValue extends Record<string, any> { + url: string; + statusCode: number; + body: Buffer | string; + cachePolicy: CachePolicyObject; +} +export interface Emitter extends EventEmitter { + addListener(event: 'request', listener: (request: ClientRequest) => void): this; + addListener(event: 'response', listener: (response: CacheResponse) => void): this; + addListener(event: 'error', listener: (error: RequestError | CacheError) => void): this; + on(event: 'request', listener: (request: ClientRequest) => void): this; + on(event: 'response', listener: (response: CacheResponse) => void): this; + on(event: 'error', listener: (error: RequestError | CacheError) => void): this; + once(event: 'request', listener: (request: ClientRequest) => void): this; + once(event: 'response', listener: (response: CacheResponse) => void): this; + once(event: 'error', listener: (error: RequestError | CacheError) => void): this; + prependListener(event: 'request', listener: (request: ClientRequest) => void): this; + prependListener(event: 'response', listener: (response: CacheResponse) => void): this; + prependListener(event: 'error', listener: (error: RequestError | CacheError) => void): this; + prependOnceListener(event: 'request', listener: (request: ClientRequest) => void): this; + prependOnceListener(event: 'response', listener: (response: CacheResponse) => void): this; + prependOnceListener(event: 'error', listener: (error: RequestError | CacheError) => void): this; + removeListener(event: 'request', listener: (request: ClientRequest) => void): this; + removeListener(event: 'response', listener: (response: CacheResponse) => void): this; + removeListener(event: 'error', listener: (error: RequestError | CacheError) => void): this; + off(event: 'request', listener: (request: ClientRequest) => void): this; + off(event: 'response', listener: (response: CacheResponse) => void): this; + off(event: 'error', listener: (error: RequestError | CacheError) => void): this; + removeAllListeners(event?: 'request' | 'response' | 'error'): this; + listeners(event: 'request'): Array<(request: ClientRequest) => void>; + listeners(event: 'response'): Array<(response: CacheResponse) => void>; + listeners(event: 'error'): Array<(error: RequestError | CacheError) => void>; + rawListeners(event: 'request'): Array<(request: ClientRequest) => void>; + rawListeners(event: 'response'): Array<(response: CacheResponse) => void>; + rawListeners(event: 'error'): Array<(error: RequestError | CacheError) => void>; + emit(event: 'request', request: ClientRequest): boolean; + emit(event: 'response', response: CacheResponse): boolean; + emit(event: 'error', error: RequestError | CacheError): boolean; + eventNames(): Array<'request' | 'response' | 'error'>; + listenerCount(type: 'request' | 'response' | 'error'): number; +} +export declare class RequestError extends Error { + constructor(error: Error); +} +export declare class CacheError extends Error { + constructor(error: Error); +} +export interface UrlOption { + path: string; + pathname?: string; + search?: string; +} +//# sourceMappingURL=types.d.ts.map
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/cacheable-request/dist/types.d.ts.map b/includes/external/addressbook/node_modules/cacheable-request/dist/types.d.ts.map new file mode 100644 index 0000000..4d46e21 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/dist/types.d.ts.map @@ -0,0 +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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,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB"}
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/cacheable-request/dist/types.js b/includes/external/addressbook/node_modules/cacheable-request/dist/types.js new file mode 100644 index 0000000..311ef10 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/dist/types.js @@ -0,0 +1,19 @@ +// Type definitions for cacheable-request 6.0 +// Project: https://github.com/lukechilds/cacheable-request#readme +// Definitions by: BendingBender <https://github.com/BendingBender> +// Paul Melnikow <https://github.com/paulmelnikow> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +export class RequestError extends Error { + constructor(error) { + super(error.message); + Object.assign(this, error); + } +} +export class CacheError extends Error { + constructor(error) { + super(error.message); + Object.assign(this, error); + } +} +//# sourceMappingURL=types.js.map
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/cacheable-request/dist/types.js.map b/includes/external/addressbook/node_modules/cacheable-request/dist/types.js.map new file mode 100644 index 0000000..e369227 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/dist/types.js.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/cacheable-request/package.json b/includes/external/addressbook/node_modules/cacheable-request/package.json new file mode 100644 index 0000000..df96587 --- /dev/null +++ b/includes/external/addressbook/node_modules/cacheable-request/package.json @@ -0,0 +1,118 @@ +{ + "name": "cacheable-request", + "version": "10.2.9", + "description": "Wrap native HTTP requests with RFC compliant cache support", + "license": "MIT", + "repository": "jaredwray/cacheable-request", + "author": "Jared Wray <me@jaredwray.com> (http://jaredwray.com)", + "type": "module", + "exports": "./dist/index.js", + "types": "./dist/index.d.ts", + "engines": { + "node": ">=14.16" + }, + "scripts": { + "test": "xo && NODE_OPTIONS=--experimental-vm-modules jest --coverage ", + "prepare": "npm run build", + "build": "tsc --project tsconfig.build.json", + "clean": "rm -rf node_modules && rm -rf ./coverage && rm -rf ./package-lock.json && rm -rf ./test/testdb.sqlite && rm -rf ./dist" + }, + "files": [ + "dist" + ], + "keywords": [ + "HTTP", + "HTTPS", + "cache", + "caching", + "layer", + "cacheable", + "RFC 7234", + "RFC", + "7234", + "compliant" + ], + "dependenciesComments": { + "@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" + }, + "dependencies": { + "@types/http-cache-semantics": "^4.0.1", + "get-stream": "^6.0.1", + "http-cache-semantics": "^4.1.1", + "keyv": "^4.5.2", + "mimic-response": "^4.0.0", + "normalize-url": "^8.0.0", + "responselike": "^3.0.0" + }, + "devDependencies": { + "@keyv/sqlite": "^3.6.5", + "@types/delay": "^3.1.0", + "@types/get-stream": "^3.0.2", + "@types/jest": "^29.5.0", + "@types/node": "^18.15.10", + "@types/responselike": "^1.0.0", + "@types/sqlite3": "^3.1.8", + "body-parser": "^1.20.2", + "delay": "^5.0.0", + "eslint-plugin-jest": "^27.2.1", + "express": "^4.18.2", + "jest": "^29.5.0", + "pify": "^6.1.0", + "sqlite3": "^5.1.6", + "ts-jest": "^29.0.5", + "ts-jest-resolver": "^2.0.1", + "ts-node": "^10.9.1", + "typescript": "^5.0.2", + "xo": "^0.53.1" + }, + "jest": { + "collectCoverageFrom": [ + "src/**/*.{ts,js}" + ], + "extensionsToTreatAsEsm": [ + ".ts" + ], + "resolver": "ts-jest-resolver", + "moduleFileExtensions": [ + "ts", + "js" + ], + "transform": { + "^.+\\.(ts|tsx)$": [ + "ts-jest", + { + "tsconfig": "./tsconfig.build.json", + "useESM": true + } + ] + }, + "testMatch": [ + "**/test/*.test.(ts|js)" + ], + "testEnvironment": "node" + }, + "xo": { + "plugins": [ + "jest" + ], + "extends": [ + "plugin:jest/recommended" + ], + "rules": { + "@typescript-eslint/triple-slash-reference": 0, + "@typescript-eslint/no-namespace": 0, + "@typescript-eslint/no-unsafe-assignment": 0, + "@typescript-eslint/no-unsafe-call": 0, + "@typescript-eslint/ban-types": 0, + "@typescript-eslint/restrict-template-expressions": 0, + "@typescript-eslint/no-unsafe-return": 0, + "new-cap": 0, + "unicorn/no-abusive-eslint-disable": 0, + "@typescript-eslint/restrict-plus-operands": 0, + "@typescript-eslint/no-implicit-any-catch": 0, + "@typescript-eslint/consistent-type-imports": 0, + "@typescript-eslint/consistent-type-definitions": 0, + "n/prefer-global/url": 0 + } + } +} |