aws-delivlib 15.0.16 → 15.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/publishing/github/node_modules/.yarn-integrity +2 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/README.md +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/assert.d.ts +5 -5
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/async_hooks.d.ts +26 -6
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/buffer.d.ts +1 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/child_process.d.ts +2 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/cluster.d.ts +15 -15
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/console.d.ts +17 -17
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/crypto.d.ts +35 -28
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/dgram.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/dns.d.ts +16 -16
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/domain.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/events.d.ts +1 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/fs/promises.d.ts +16 -9
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/fs.d.ts +28 -19
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/globals.d.ts +7 -6
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/globals.typedarray.d.ts +1 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/http.d.ts +2 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/http2.d.ts +6 -3
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/https.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/index.d.ts +7 -5
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/inspector.d.ts +3 -7
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/module.d.ts +63 -29
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/net.d.ts +2 -5
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/os.d.ts +8 -7
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/package.json +13 -3
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/path.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/perf_hooks.d.ts +8 -8
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/process.d.ts +21 -11
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/punycode.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/querystring.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/readline/promises.d.ts +0 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/readline.d.ts +13 -13
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/repl.d.ts +14 -16
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/sea.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/sqlite.d.ts +182 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/stream.d.ts +8 -19
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/string_decoder.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/test.d.ts +53 -15
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/timers.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/tls.d.ts +2 -48
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/trace_events.d.ts +6 -6
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/{compatibility → ts5.1/compatibility}/disposable.d.ts +0 -4
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.1/index.d.ts +98 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +1 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.6/index.d.ts +9 -5
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.7/index.d.ts +96 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/tty.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/url.d.ts +52 -19
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/util.d.ts +16 -295
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/v8.d.ts +29 -32
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/vm.d.ts +17 -10
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/wasi.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/worker_threads.d.ts +34 -18
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/zlib.d.ts +5 -7
- package/lib/publishing/github/node_modules/undici-types/agent.d.ts +7 -7
- package/lib/publishing/github/node_modules/undici-types/api.d.ts +24 -24
- package/lib/publishing/github/node_modules/undici-types/balanced-pool.d.ts +11 -11
- package/lib/publishing/github/node_modules/undici-types/cache-interceptor.d.ts +172 -0
- package/lib/publishing/github/node_modules/undici-types/client.d.ts +12 -13
- package/lib/publishing/github/node_modules/undici-types/cookies.d.ts +2 -0
- package/lib/publishing/github/node_modules/undici-types/diagnostics-channel.d.ts +10 -10
- package/lib/publishing/github/node_modules/undici-types/dispatcher.d.ts +117 -92
- package/lib/publishing/github/node_modules/undici-types/env-http-proxy-agent.d.ts +2 -2
- package/lib/publishing/github/node_modules/undici-types/errors.d.ts +69 -47
- package/lib/publishing/github/node_modules/undici-types/fetch.d.ts +17 -16
- package/lib/publishing/github/node_modules/undici-types/formdata.d.ts +7 -7
- package/lib/publishing/github/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/lib/publishing/github/node_modules/undici-types/global-origin.d.ts +5 -5
- package/lib/publishing/github/node_modules/undici-types/h2c-client.d.ts +75 -0
- package/lib/publishing/github/node_modules/undici-types/handlers.d.ts +7 -7
- package/lib/publishing/github/node_modules/undici-types/header.d.ts +157 -1
- package/lib/publishing/github/node_modules/undici-types/index.d.ts +51 -47
- package/lib/publishing/github/node_modules/undici-types/interceptors.d.ts +25 -8
- package/lib/publishing/github/node_modules/undici-types/mock-agent.d.ts +33 -18
- package/lib/publishing/github/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/lib/publishing/github/node_modules/undici-types/mock-client.d.ts +4 -4
- package/lib/publishing/github/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/lib/publishing/github/node_modules/undici-types/mock-interceptor.d.ts +19 -19
- package/lib/publishing/github/node_modules/undici-types/mock-pool.d.ts +4 -4
- package/lib/publishing/github/node_modules/undici-types/package.json +1 -1
- package/lib/publishing/github/node_modules/undici-types/patch.d.ts +0 -4
- package/lib/publishing/github/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/lib/publishing/github/node_modules/undici-types/pool.d.ts +12 -12
- package/lib/publishing/github/node_modules/undici-types/proxy-agent.d.ts +4 -4
- package/lib/publishing/github/node_modules/undici-types/readable.d.ts +18 -15
- package/lib/publishing/github/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/lib/publishing/github/node_modules/undici-types/retry-handler.d.ts +10 -10
- package/lib/publishing/github/node_modules/undici-types/util.d.ts +3 -3
- package/lib/publishing/github/node_modules/undici-types/utility.d.ts +7 -0
- package/lib/publishing/github/node_modules/undici-types/webidl.d.ts +44 -6
- package/lib/publishing/github/node_modules/undici-types/websocket.d.ts +35 -1
- package/package.json +2 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
- package/lib/publishing/github/node_modules/undici-types/file.d.ts +0 -39
- package/lib/publishing/github/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1,22 +1,24 @@
|
|
1
|
-
import Dispatcher from'./dispatcher'
|
1
|
+
import Dispatcher from './dispatcher'
|
2
2
|
import { setGlobalDispatcher, getGlobalDispatcher } from './global-dispatcher'
|
3
3
|
import { setGlobalOrigin, getGlobalOrigin } from './global-origin'
|
4
|
-
import Pool from'./pool'
|
4
|
+
import Pool from './pool'
|
5
5
|
import { RedirectHandler, DecoratorHandler } from './handlers'
|
6
6
|
|
7
7
|
import BalancedPool from './balanced-pool'
|
8
|
-
import Client from'./client'
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import
|
16
|
-
import
|
8
|
+
import Client from './client'
|
9
|
+
import H2CClient from './h2c-client'
|
10
|
+
import buildConnector from './connector'
|
11
|
+
import errors from './errors'
|
12
|
+
import Agent from './agent'
|
13
|
+
import MockClient from './mock-client'
|
14
|
+
import MockPool from './mock-pool'
|
15
|
+
import MockAgent from './mock-agent'
|
16
|
+
import { MockCallHistory, MockCallHistoryLog } from './mock-call-history'
|
17
|
+
import mockErrors from './mock-errors'
|
18
|
+
import ProxyAgent from './proxy-agent'
|
17
19
|
import EnvHttpProxyAgent from './env-http-proxy-agent'
|
18
|
-
import RetryHandler from'./retry-handler'
|
19
|
-
import RetryAgent from'./retry-agent'
|
20
|
+
import RetryHandler from './retry-handler'
|
21
|
+
import RetryAgent from './retry-agent'
|
20
22
|
import { request, pipeline, stream, connect, upgrade } from './api'
|
21
23
|
import interceptors from './interceptors'
|
22
24
|
|
@@ -24,8 +26,6 @@ export * from './util'
|
|
24
26
|
export * from './cookies'
|
25
27
|
export * from './eventsource'
|
26
28
|
export * from './fetch'
|
27
|
-
export * from './file'
|
28
|
-
export * from './filereader'
|
29
29
|
export * from './formdata'
|
30
30
|
export * from './diagnostics-channel'
|
31
31
|
export * from './websocket'
|
@@ -33,39 +33,43 @@ export * from './content-type'
|
|
33
33
|
export * from './cache'
|
34
34
|
export { Interceptable } from './mock-interceptor'
|
35
35
|
|
36
|
-
export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent }
|
36
|
+
export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient }
|
37
37
|
export default Undici
|
38
38
|
|
39
39
|
declare namespace Undici {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
40
|
+
const Dispatcher: typeof import('./dispatcher').default
|
41
|
+
const Pool: typeof import('./pool').default
|
42
|
+
const RedirectHandler: typeof import ('./handlers').RedirectHandler
|
43
|
+
const DecoratorHandler: typeof import ('./handlers').DecoratorHandler
|
44
|
+
const RetryHandler: typeof import ('./retry-handler').default
|
45
|
+
const BalancedPool: typeof import('./balanced-pool').default
|
46
|
+
const Client: typeof import('./client').default
|
47
|
+
const H2CClient: typeof import('./h2c-client').default
|
48
|
+
const buildConnector: typeof import('./connector').default
|
49
|
+
const errors: typeof import('./errors').default
|
50
|
+
const Agent: typeof import('./agent').default
|
51
|
+
const setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher
|
52
|
+
const getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher
|
53
|
+
const request: typeof import('./api').request
|
54
|
+
const stream: typeof import('./api').stream
|
55
|
+
const pipeline: typeof import('./api').pipeline
|
56
|
+
const connect: typeof import('./api').connect
|
57
|
+
const upgrade: typeof import('./api').upgrade
|
58
|
+
const MockClient: typeof import('./mock-client').default
|
59
|
+
const MockPool: typeof import('./mock-pool').default
|
60
|
+
const MockAgent: typeof import('./mock-agent').default
|
61
|
+
const MockCallHistory: typeof import('./mock-call-history').MockCallHistory
|
62
|
+
const MockCallHistoryLog: typeof import('./mock-call-history').MockCallHistoryLog
|
63
|
+
const mockErrors: typeof import('./mock-errors').default
|
64
|
+
const fetch: typeof import('./fetch').fetch
|
65
|
+
const Headers: typeof import('./fetch').Headers
|
66
|
+
const Response: typeof import('./fetch').Response
|
67
|
+
const Request: typeof import('./fetch').Request
|
68
|
+
const FormData: typeof import('./formdata').FormData
|
69
|
+
const caches: typeof import('./cache').caches
|
70
|
+
const interceptors: typeof import('./interceptors').default
|
71
|
+
const cacheStores: {
|
72
|
+
MemoryCacheStore: typeof import('./cache-interceptor').default.MemoryCacheStore,
|
73
|
+
SqliteCacheStore: typeof import('./cache-interceptor').default.SqliteCacheStore
|
74
|
+
}
|
71
75
|
}
|
@@ -1,17 +1,34 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import CacheHandler from './cache-interceptor'
|
2
|
+
import Dispatcher from './dispatcher'
|
3
|
+
import RetryHandler from './retry-handler'
|
4
|
+
import { LookupOptions } from 'node:dns'
|
3
5
|
|
4
|
-
export default Interceptors
|
6
|
+
export default Interceptors
|
5
7
|
|
6
8
|
declare namespace Interceptors {
|
7
9
|
export type DumpInterceptorOpts = { maxSize?: number }
|
8
10
|
export type RetryInterceptorOpts = RetryHandler.RetryOptions
|
9
11
|
export type RedirectInterceptorOpts = { maxRedirections?: number }
|
12
|
+
|
10
13
|
export type ResponseErrorInterceptorOpts = { throwOnError: boolean }
|
14
|
+
export type CacheInterceptorOpts = CacheHandler.CacheOptions
|
15
|
+
|
16
|
+
// DNS interceptor
|
17
|
+
export type DNSInterceptorRecord = { address: string, ttl: number, family: 4 | 6 }
|
18
|
+
export type DNSInterceptorOriginRecords = { 4: { ips: DNSInterceptorRecord[] } | null, 6: { ips: DNSInterceptorRecord[] } | null }
|
19
|
+
export type DNSInterceptorOpts = {
|
20
|
+
maxTTL?: number
|
21
|
+
maxItems?: number
|
22
|
+
lookup?: (hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void
|
23
|
+
pick?: (origin: URL, records: DNSInterceptorOriginRecords, affinity: 4 | 6) => DNSInterceptorRecord
|
24
|
+
dualStack?: boolean
|
25
|
+
affinity?: 4 | 6
|
26
|
+
}
|
11
27
|
|
12
|
-
export function
|
13
|
-
export function
|
14
|
-
export function
|
15
|
-
export function
|
16
|
-
export function
|
28
|
+
export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
29
|
+
export function retry (opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
30
|
+
export function redirect (opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
31
|
+
export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
32
|
+
export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
33
|
+
export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
17
34
|
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import Agent from './agent'
|
2
2
|
import Dispatcher from './dispatcher'
|
3
3
|
import { Interceptable, MockInterceptor } from './mock-interceptor'
|
4
|
-
import MockDispatch = MockInterceptor.MockDispatch
|
4
|
+
import MockDispatch = MockInterceptor.MockDispatch
|
5
|
+
import { MockCallHistory } from './mock-call-history'
|
5
6
|
|
6
7
|
export default MockAgent
|
7
8
|
|
@@ -11,30 +12,38 @@ interface PendingInterceptor extends MockDispatch {
|
|
11
12
|
|
12
13
|
/** A mocked Agent class that implements the Agent API. It allows one to intercept HTTP requests made through undici and return mocked responses instead. */
|
13
14
|
declare class MockAgent<TMockAgentOptions extends MockAgent.Options = MockAgent.Options> extends Dispatcher {
|
14
|
-
constructor(options?:
|
15
|
+
constructor (options?: TMockAgentOptions)
|
15
16
|
/** Creates and retrieves mock Dispatcher instances which can then be used to intercept HTTP requests. If the number of connections on the mock agent is set to 1, a MockClient instance is returned. Otherwise a MockPool instance is returned. */
|
16
|
-
get<TInterceptable extends Interceptable>(origin: string): TInterceptable
|
17
|
-
get<TInterceptable extends Interceptable>(origin: RegExp): TInterceptable
|
18
|
-
get<TInterceptable extends Interceptable>(origin: ((origin: string) => boolean)): TInterceptable
|
17
|
+
get<TInterceptable extends Interceptable>(origin: string): TInterceptable
|
18
|
+
get<TInterceptable extends Interceptable>(origin: RegExp): TInterceptable
|
19
|
+
get<TInterceptable extends Interceptable>(origin: ((origin: string) => boolean)): TInterceptable
|
19
20
|
/** Dispatches a mocked request. */
|
20
|
-
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.
|
21
|
+
dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
|
21
22
|
/** Closes the mock agent and waits for registered mock pools and clients to also close before resolving. */
|
22
|
-
close(): Promise<void
|
23
|
+
close (): Promise<void>
|
23
24
|
/** Disables mocking in MockAgent. */
|
24
|
-
deactivate(): void
|
25
|
+
deactivate (): void
|
25
26
|
/** Enables mocking in a MockAgent instance. When instantiated, a MockAgent is automatically activated. Therefore, this method is only effective after `MockAgent.deactivate` has been called. */
|
26
|
-
activate(): void
|
27
|
+
activate (): void
|
27
28
|
/** Define host matchers so only matching requests that aren't intercepted by the mock dispatchers will be attempted. */
|
28
|
-
enableNetConnect(): void
|
29
|
-
enableNetConnect(host: string): void
|
30
|
-
enableNetConnect(host: RegExp): void
|
31
|
-
enableNetConnect(host: ((host: string) => boolean)): void
|
29
|
+
enableNetConnect (): void
|
30
|
+
enableNetConnect (host: string): void
|
31
|
+
enableNetConnect (host: RegExp): void
|
32
|
+
enableNetConnect (host: ((host: string) => boolean)): void
|
32
33
|
/** Causes all requests to throw when requests are not matched in a MockAgent intercept. */
|
33
|
-
disableNetConnect(): void
|
34
|
-
|
35
|
-
|
34
|
+
disableNetConnect (): void
|
35
|
+
/** get call history. returns the MockAgent call history or undefined if the option is not enabled. */
|
36
|
+
getCallHistory (): MockCallHistory | undefined
|
37
|
+
/** clear every call history. Any MockCallHistoryLog will be deleted on the MockCallHistory instance */
|
38
|
+
clearCallHistory (): void
|
39
|
+
/** Enable call history. Any subsequence calls will then be registered. */
|
40
|
+
enableCallHistory (): this
|
41
|
+
/** Disable call history. Any subsequence calls will then not be registered. */
|
42
|
+
disableCallHistory (): this
|
43
|
+
pendingInterceptors (): PendingInterceptor[]
|
44
|
+
assertNoPendingInterceptors (options?: {
|
36
45
|
pendingInterceptorsFormatter?: PendingInterceptorsFormatter;
|
37
|
-
}): void
|
46
|
+
}): void
|
38
47
|
}
|
39
48
|
|
40
49
|
interface PendingInterceptorsFormatter {
|
@@ -45,6 +54,12 @@ declare namespace MockAgent {
|
|
45
54
|
/** MockAgent options. */
|
46
55
|
export interface Options extends Agent.Options {
|
47
56
|
/** A custom agent to be encapsulated by the MockAgent. */
|
48
|
-
agent?:
|
57
|
+
agent?: Dispatcher;
|
58
|
+
|
59
|
+
/** Ignore trailing slashes in the path */
|
60
|
+
ignoreTrailingSlash?: boolean;
|
61
|
+
|
62
|
+
/** Enable call history. you can either call MockAgent.enableCallHistory(). default false */
|
63
|
+
enableCallHistory?: boolean
|
49
64
|
}
|
50
65
|
}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
import Dispatcher from './dispatcher'
|
2
|
+
|
3
|
+
declare namespace MockCallHistoryLog {
|
4
|
+
/** request's configuration properties */
|
5
|
+
export type MockCallHistoryLogProperties = 'protocol' | 'host' | 'port' | 'origin' | 'path' | 'hash' | 'fullUrl' | 'method' | 'searchParams' | 'body' | 'headers'
|
6
|
+
}
|
7
|
+
|
8
|
+
/** a log reflecting request configuration */
|
9
|
+
declare class MockCallHistoryLog {
|
10
|
+
constructor (requestInit: Dispatcher.DispatchOptions)
|
11
|
+
/** protocol used. ie. 'https:' or 'http:' etc... */
|
12
|
+
protocol: string
|
13
|
+
/** request's host. */
|
14
|
+
host: string
|
15
|
+
/** request's port. */
|
16
|
+
port: string
|
17
|
+
/** request's origin. ie. https://localhost:3000. */
|
18
|
+
origin: string
|
19
|
+
/** path. never contains searchParams. */
|
20
|
+
path: string
|
21
|
+
/** request's hash. */
|
22
|
+
hash: string
|
23
|
+
/** the full url requested. */
|
24
|
+
fullUrl: string
|
25
|
+
/** request's method. */
|
26
|
+
method: string
|
27
|
+
/** search params. */
|
28
|
+
searchParams: Record<string, string>
|
29
|
+
/** request's body */
|
30
|
+
body: string | null | undefined
|
31
|
+
/** request's headers */
|
32
|
+
headers: Record<string, string | string[]> | null | undefined
|
33
|
+
|
34
|
+
/** returns an Map of property / value pair */
|
35
|
+
toMap (): Map<MockCallHistoryLog.MockCallHistoryLogProperties, string | Record<string, string | string[]> | null | undefined>
|
36
|
+
|
37
|
+
/** returns a string computed with all key value pair */
|
38
|
+
toString (): string
|
39
|
+
}
|
40
|
+
|
41
|
+
declare namespace MockCallHistory {
|
42
|
+
export type FilterCallsOperator = 'AND' | 'OR'
|
43
|
+
|
44
|
+
/** modify the filtering behavior */
|
45
|
+
export interface FilterCallsOptions {
|
46
|
+
/** the operator to apply when filtering. 'OR' will adds any MockCallHistoryLog matching any criteria given. 'AND' will adds only MockCallHistoryLog matching every criteria given. (default 'OR') */
|
47
|
+
operator?: FilterCallsOperator | Lowercase<FilterCallsOperator>
|
48
|
+
}
|
49
|
+
/** a function to be executed for filtering MockCallHistoryLog */
|
50
|
+
export type FilterCallsFunctionCriteria = (log: MockCallHistoryLog) => boolean
|
51
|
+
|
52
|
+
/** parameter to filter MockCallHistoryLog */
|
53
|
+
export type FilterCallsParameter = string | RegExp | undefined | null
|
54
|
+
|
55
|
+
/** an object to execute multiple filtering at once */
|
56
|
+
export interface FilterCallsObjectCriteria extends Record<string, FilterCallsParameter> {
|
57
|
+
/** filter by request protocol. ie https: */
|
58
|
+
protocol?: FilterCallsParameter;
|
59
|
+
/** filter by request host. */
|
60
|
+
host?: FilterCallsParameter;
|
61
|
+
/** filter by request port. */
|
62
|
+
port?: FilterCallsParameter;
|
63
|
+
/** filter by request origin. */
|
64
|
+
origin?: FilterCallsParameter;
|
65
|
+
/** filter by request path. */
|
66
|
+
path?: FilterCallsParameter;
|
67
|
+
/** filter by request hash. */
|
68
|
+
hash?: FilterCallsParameter;
|
69
|
+
/** filter by request fullUrl. */
|
70
|
+
fullUrl?: FilterCallsParameter;
|
71
|
+
/** filter by request method. */
|
72
|
+
method?: FilterCallsParameter;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
/** a call history to track requests configuration */
|
77
|
+
declare class MockCallHistory {
|
78
|
+
constructor (name: string)
|
79
|
+
/** returns an array of MockCallHistoryLog. */
|
80
|
+
calls (): Array<MockCallHistoryLog>
|
81
|
+
/** returns the first MockCallHistoryLog */
|
82
|
+
firstCall (): MockCallHistoryLog | undefined
|
83
|
+
/** returns the last MockCallHistoryLog. */
|
84
|
+
lastCall (): MockCallHistoryLog | undefined
|
85
|
+
/** returns the nth MockCallHistoryLog. */
|
86
|
+
nthCall (position: number): MockCallHistoryLog | undefined
|
87
|
+
/** return all MockCallHistoryLog matching any of criteria given. if an object is used with multiple properties, you can change the operator to apply during filtering on options */
|
88
|
+
filterCalls (criteria: MockCallHistory.FilterCallsFunctionCriteria | MockCallHistory.FilterCallsObjectCriteria | RegExp, options?: MockCallHistory.FilterCallsOptions): Array<MockCallHistoryLog>
|
89
|
+
/** return all MockCallHistoryLog matching the given protocol. if a string is given, it is matched with includes */
|
90
|
+
filterCallsByProtocol (protocol: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
|
91
|
+
/** return all MockCallHistoryLog matching the given host. if a string is given, it is matched with includes */
|
92
|
+
filterCallsByHost (host: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
|
93
|
+
/** return all MockCallHistoryLog matching the given port. if a string is given, it is matched with includes */
|
94
|
+
filterCallsByPort (port: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
|
95
|
+
/** return all MockCallHistoryLog matching the given origin. if a string is given, it is matched with includes */
|
96
|
+
filterCallsByOrigin (origin: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
|
97
|
+
/** return all MockCallHistoryLog matching the given path. if a string is given, it is matched with includes */
|
98
|
+
filterCallsByPath (path: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
|
99
|
+
/** return all MockCallHistoryLog matching the given hash. if a string is given, it is matched with includes */
|
100
|
+
filterCallsByHash (hash: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
|
101
|
+
/** return all MockCallHistoryLog matching the given fullUrl. if a string is given, it is matched with includes */
|
102
|
+
filterCallsByFullUrl (fullUrl: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
|
103
|
+
/** return all MockCallHistoryLog matching the given method. if a string is given, it is matched with includes */
|
104
|
+
filterCallsByMethod (method: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
|
105
|
+
/** clear all MockCallHistoryLog on this MockCallHistory. */
|
106
|
+
clear (): void
|
107
|
+
/** use it with for..of loop or spread operator */
|
108
|
+
[Symbol.iterator]: () => Generator<MockCallHistoryLog>
|
109
|
+
}
|
110
|
+
|
111
|
+
export { MockCallHistoryLog, MockCallHistory }
|
@@ -7,13 +7,13 @@ export default MockClient
|
|
7
7
|
|
8
8
|
/** MockClient extends the Client API and allows one to mock requests. */
|
9
9
|
declare class MockClient extends Client implements Interceptable {
|
10
|
-
constructor(origin: string, options: MockClient.Options)
|
10
|
+
constructor (origin: string, options: MockClient.Options)
|
11
11
|
/** Intercepts any matching requests that use the same origin as this mock client. */
|
12
|
-
intercept(options: MockInterceptor.Options): MockInterceptor
|
12
|
+
intercept (options: MockInterceptor.Options): MockInterceptor
|
13
13
|
/** Dispatches a mocked request. */
|
14
|
-
dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.
|
14
|
+
dispatch (options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandler): boolean
|
15
15
|
/** Closes the mock client and gracefully waits for enqueued requests to complete. */
|
16
|
-
close(): Promise<void
|
16
|
+
close (): Promise<void>
|
17
17
|
}
|
18
18
|
|
19
19
|
declare namespace MockClient {
|
@@ -5,8 +5,8 @@ export default MockErrors
|
|
5
5
|
declare namespace MockErrors {
|
6
6
|
/** The request does not match any registered mock dispatches. */
|
7
7
|
export class MockNotMatchedError extends Errors.UndiciError {
|
8
|
-
constructor(message?: string)
|
9
|
-
name: 'MockNotMatchedError'
|
10
|
-
code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED'
|
8
|
+
constructor (message?: string)
|
9
|
+
name: 'MockNotMatchedError'
|
10
|
+
code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED'
|
11
11
|
}
|
12
12
|
}
|
@@ -1,42 +1,36 @@
|
|
1
1
|
import { IncomingHttpHeaders } from './header'
|
2
|
-
import Dispatcher from './dispatcher'
|
2
|
+
import Dispatcher from './dispatcher'
|
3
3
|
import { BodyInit, Headers } from './fetch'
|
4
4
|
|
5
|
-
export {
|
6
|
-
Interceptable,
|
7
|
-
MockInterceptor,
|
8
|
-
MockScope
|
9
|
-
}
|
10
|
-
|
11
5
|
/** The scope associated with a mock dispatch. */
|
12
6
|
declare class MockScope<TData extends object = object> {
|
13
|
-
constructor(mockDispatch: MockInterceptor.MockDispatch<TData>)
|
7
|
+
constructor (mockDispatch: MockInterceptor.MockDispatch<TData>)
|
14
8
|
/** Delay a reply by a set amount of time in ms. */
|
15
|
-
delay(waitInMs: number): MockScope<TData
|
9
|
+
delay (waitInMs: number): MockScope<TData>
|
16
10
|
/** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
|
17
|
-
persist(): MockScope<TData
|
11
|
+
persist (): MockScope<TData>
|
18
12
|
/** Define a reply for a set amount of matching requests. */
|
19
|
-
times(repeatTimes: number): MockScope<TData
|
13
|
+
times (repeatTimes: number): MockScope<TData>
|
20
14
|
}
|
21
15
|
|
22
16
|
/** The interceptor for a Mock. */
|
23
17
|
declare class MockInterceptor {
|
24
|
-
constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[])
|
18
|
+
constructor (options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[])
|
25
19
|
/** Mock an undici request with the defined reply. */
|
26
|
-
reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData
|
20
|
+
reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>
|
27
21
|
reply<TData extends object = object>(
|
28
22
|
statusCode: number,
|
29
23
|
data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>,
|
30
24
|
responseOptions?: MockInterceptor.MockResponseOptions
|
31
|
-
): MockScope<TData
|
25
|
+
): MockScope<TData>
|
32
26
|
/** Mock an undici request by throwing the defined reply error. */
|
33
|
-
replyWithError<TError extends Error = Error>(error: TError): MockScope
|
27
|
+
replyWithError<TError extends Error = Error>(error: TError): MockScope
|
34
28
|
/** Set default reply headers on the interceptor for subsequent mocked replies. */
|
35
|
-
defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor
|
29
|
+
defaultReplyHeaders (headers: IncomingHttpHeaders): MockInterceptor
|
36
30
|
/** Set default reply trailers on the interceptor for subsequent mocked replies. */
|
37
|
-
defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor
|
31
|
+
defaultReplyTrailers (trailers: Record<string, string>): MockInterceptor
|
38
32
|
/** Set automatically calculated content-length header on subsequent mocked replies. */
|
39
|
-
replyContentLength(): MockInterceptor
|
33
|
+
replyContentLength (): MockInterceptor
|
40
34
|
}
|
41
35
|
|
42
36
|
declare namespace MockInterceptor {
|
@@ -80,7 +74,7 @@ declare namespace MockInterceptor {
|
|
80
74
|
|
81
75
|
export type MockResponseDataHandler<TData extends object = object> = (
|
82
76
|
opts: MockResponseCallbackOptions
|
83
|
-
) => TData | Buffer | string
|
77
|
+
) => TData | Buffer | string
|
84
78
|
|
85
79
|
export type MockReplyOptionsCallback<TData extends object = object> = (
|
86
80
|
opts: MockResponseCallbackOptions
|
@@ -91,3 +85,9 @@ interface Interceptable extends Dispatcher {
|
|
91
85
|
/** Intercepts any matching requests that use the same origin as this mock client. */
|
92
86
|
intercept(options: MockInterceptor.Options): MockInterceptor;
|
93
87
|
}
|
88
|
+
|
89
|
+
export {
|
90
|
+
Interceptable,
|
91
|
+
MockInterceptor,
|
92
|
+
MockScope
|
93
|
+
}
|
@@ -7,13 +7,13 @@ export default MockPool
|
|
7
7
|
|
8
8
|
/** MockPool extends the Pool API and allows one to mock requests. */
|
9
9
|
declare class MockPool extends Pool implements Interceptable {
|
10
|
-
constructor(origin: string, options: MockPool.Options)
|
10
|
+
constructor (origin: string, options: MockPool.Options)
|
11
11
|
/** Intercepts any matching requests that use the same origin as this mock pool. */
|
12
|
-
intercept(options: MockInterceptor.Options): MockInterceptor
|
12
|
+
intercept (options: MockInterceptor.Options): MockInterceptor
|
13
13
|
/** Dispatches a mocked request. */
|
14
|
-
dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.
|
14
|
+
dispatch (options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandler): boolean
|
15
15
|
/** Closes the mock pool and gracefully waits for enqueued requests to complete. */
|
16
|
-
close(): Promise<void
|
16
|
+
close (): Promise<void>
|
17
17
|
}
|
18
18
|
|
19
19
|
declare namespace MockPool {
|
@@ -1,19 +1,19 @@
|
|
1
|
-
import Pool from
|
1
|
+
import Pool from './pool'
|
2
2
|
|
3
3
|
export default PoolStats
|
4
4
|
|
5
5
|
declare class PoolStats {
|
6
|
-
constructor(pool: Pool)
|
6
|
+
constructor (pool: Pool)
|
7
7
|
/** Number of open socket connections in this pool. */
|
8
|
-
connected: number
|
8
|
+
connected: number
|
9
9
|
/** Number of open socket connections in this pool that do not have an active request. */
|
10
|
-
free: number
|
10
|
+
free: number
|
11
11
|
/** Number of pending requests across all clients in this pool. */
|
12
|
-
pending: number
|
12
|
+
pending: number
|
13
13
|
/** Number of queued requests across all clients in this pool. */
|
14
|
-
queued: number
|
14
|
+
queued: number
|
15
15
|
/** Number of currently active requests across all clients in this pool. */
|
16
|
-
running: number
|
16
|
+
running: number
|
17
17
|
/** Number of active, pending, or queued requests across all clients in this pool. */
|
18
|
-
size: number
|
18
|
+
size: number
|
19
19
|
}
|
@@ -1,39 +1,39 @@
|
|
1
1
|
import Client from './client'
|
2
2
|
import TPoolStats from './pool-stats'
|
3
3
|
import { URL } from 'url'
|
4
|
-
import Dispatcher from
|
4
|
+
import Dispatcher from './dispatcher'
|
5
5
|
|
6
6
|
export default Pool
|
7
7
|
|
8
|
-
type PoolConnectOptions = Omit<Dispatcher.ConnectOptions,
|
8
|
+
type PoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
|
9
9
|
|
10
10
|
declare class Pool extends Dispatcher {
|
11
|
-
constructor(url: string | URL, options?: Pool.Options)
|
11
|
+
constructor (url: string | URL, options?: Pool.Options)
|
12
12
|
/** `true` after `pool.close()` has been called. */
|
13
|
-
closed: boolean
|
13
|
+
closed: boolean
|
14
14
|
/** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
|
15
|
-
destroyed: boolean
|
15
|
+
destroyed: boolean
|
16
16
|
/** Aggregate stats for a Pool. */
|
17
|
-
readonly stats: TPoolStats
|
17
|
+
readonly stats: TPoolStats
|
18
18
|
|
19
19
|
// Override dispatcher APIs.
|
20
|
-
override connect(
|
20
|
+
override connect (
|
21
21
|
options: PoolConnectOptions
|
22
|
-
): Promise<Dispatcher.ConnectData
|
23
|
-
override connect(
|
22
|
+
): Promise<Dispatcher.ConnectData>
|
23
|
+
override connect (
|
24
24
|
options: PoolConnectOptions,
|
25
25
|
callback: (err: Error | null, data: Dispatcher.ConnectData) => void
|
26
|
-
): void
|
26
|
+
): void
|
27
27
|
}
|
28
28
|
|
29
29
|
declare namespace Pool {
|
30
|
-
export type PoolStats = TPoolStats
|
30
|
+
export type PoolStats = TPoolStats
|
31
31
|
export interface Options extends Client.Options {
|
32
32
|
/** Default: `(origin, opts) => new Client(origin, opts)`. */
|
33
33
|
factory?(origin: URL, opts: object): Dispatcher;
|
34
34
|
/** The max number of clients to create. `null` if no limit. Default `null`. */
|
35
35
|
connections?: number | null;
|
36
36
|
|
37
|
-
interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options[
|
37
|
+
interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options['interceptors']
|
38
38
|
}
|
39
39
|
}
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import Agent from './agent'
|
2
|
-
import buildConnector from './connector'
|
2
|
+
import buildConnector from './connector'
|
3
3
|
import Dispatcher from './dispatcher'
|
4
4
|
import { IncomingHttpHeaders } from './header'
|
5
5
|
|
6
6
|
export default ProxyAgent
|
7
7
|
|
8
8
|
declare class ProxyAgent extends Dispatcher {
|
9
|
-
constructor(options: ProxyAgent.Options | string)
|
9
|
+
constructor (options: ProxyAgent.Options | string)
|
10
10
|
|
11
|
-
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.
|
12
|
-
close(): Promise<void
|
11
|
+
dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
|
12
|
+
close (): Promise<void>
|
13
13
|
}
|
14
14
|
|
15
15
|
declare namespace ProxyAgent {
|