omegon 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/extensions/cleave/dispatcher.ts +213 -20
  2. package/extensions/cleave/index.ts +24 -8
  3. package/extensions/cleave/rpc-child.ts +269 -0
  4. package/extensions/cleave/types.ts +52 -0
  5. package/extensions/openspec/spec.ts +3 -0
  6. package/node_modules/@types/node/README.md +3 -3
  7. package/node_modules/@types/node/assert/strict.d.ts +11 -5
  8. package/node_modules/@types/node/assert.d.ts +173 -50
  9. package/node_modules/@types/node/async_hooks.d.ts +8 -28
  10. package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
  11. package/node_modules/@types/node/buffer.d.ts +168 -44
  12. package/node_modules/@types/node/child_process.d.ts +70 -27
  13. package/node_modules/@types/node/cluster.d.ts +332 -240
  14. package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  15. package/node_modules/@types/node/compatibility/index.d.ts +9 -0
  16. package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  17. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
  18. package/node_modules/@types/node/console.d.ts +350 -49
  19. package/node_modules/@types/node/constants.d.ts +4 -3
  20. package/node_modules/@types/node/crypto.d.ts +1110 -630
  21. package/node_modules/@types/node/dgram.d.ts +51 -15
  22. package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
  23. package/node_modules/@types/node/dns/promises.d.ts +4 -4
  24. package/node_modules/@types/node/dns.d.ts +133 -132
  25. package/node_modules/@types/node/domain.d.ts +17 -13
  26. package/node_modules/@types/node/events.d.ts +663 -734
  27. package/node_modules/@types/node/fs/promises.d.ts +9 -43
  28. package/node_modules/@types/node/fs.d.ts +411 -628
  29. package/node_modules/@types/node/globals.d.ts +30 -8
  30. package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
  31. package/node_modules/@types/node/http.d.ts +265 -364
  32. package/node_modules/@types/node/http2.d.ts +715 -551
  33. package/node_modules/@types/node/https.d.ts +239 -65
  34. package/node_modules/@types/node/index.d.ts +6 -24
  35. package/node_modules/@types/node/inspector.d.ts +53 -69
  36. package/node_modules/@types/node/inspector.generated.d.ts +410 -759
  37. package/node_modules/@types/node/module.d.ts +186 -52
  38. package/node_modules/@types/node/net.d.ts +194 -70
  39. package/node_modules/@types/node/os.d.ts +11 -12
  40. package/node_modules/@types/node/package.json +3 -13
  41. package/node_modules/@types/node/path.d.ts +133 -120
  42. package/node_modules/@types/node/perf_hooks.d.ts +643 -318
  43. package/node_modules/@types/node/process.d.ts +132 -223
  44. package/node_modules/@types/node/punycode.d.ts +5 -5
  45. package/node_modules/@types/node/querystring.d.ts +4 -4
  46. package/node_modules/@types/node/readline/promises.d.ts +3 -3
  47. package/node_modules/@types/node/readline.d.ts +120 -68
  48. package/node_modules/@types/node/repl.d.ts +100 -87
  49. package/node_modules/@types/node/sea.d.ts +1 -10
  50. package/node_modules/@types/node/sqlite.d.ts +19 -363
  51. package/node_modules/@types/node/stream/consumers.d.ts +10 -10
  52. package/node_modules/@types/node/stream/promises.d.ts +15 -136
  53. package/node_modules/@types/node/stream/web.d.ts +502 -176
  54. package/node_modules/@types/node/stream.d.ts +475 -581
  55. package/node_modules/@types/node/string_decoder.d.ts +4 -4
  56. package/node_modules/@types/node/test.d.ts +196 -308
  57. package/node_modules/@types/node/timers/promises.d.ts +4 -4
  58. package/node_modules/@types/node/timers.d.ts +132 -4
  59. package/node_modules/@types/node/tls.d.ts +226 -110
  60. package/node_modules/@types/node/trace_events.d.ts +9 -9
  61. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
  62. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
  63. package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
  64. package/node_modules/@types/node/tty.d.ts +16 -58
  65. package/node_modules/@types/node/url.d.ts +573 -130
  66. package/node_modules/@types/node/util.d.ts +1100 -181
  67. package/node_modules/@types/node/v8.d.ts +8 -76
  68. package/node_modules/@types/node/vm.d.ts +72 -280
  69. package/node_modules/@types/node/wasi.d.ts +4 -25
  70. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
  71. package/node_modules/@types/node/web-globals/events.d.ts +0 -9
  72. package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
  73. package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
  74. package/node_modules/@types/node/worker_threads.d.ts +335 -268
  75. package/node_modules/@types/node/zlib.d.ts +74 -9
  76. package/node_modules/undici-types/agent.d.ts +12 -13
  77. package/node_modules/undici-types/api.d.ts +26 -26
  78. package/node_modules/undici-types/balanced-pool.d.ts +12 -13
  79. package/node_modules/undici-types/client.d.ts +19 -19
  80. package/node_modules/undici-types/connector.d.ts +2 -2
  81. package/node_modules/undici-types/cookies.d.ts +0 -2
  82. package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
  83. package/node_modules/undici-types/dispatcher.d.ts +103 -123
  84. package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
  85. package/node_modules/undici-types/errors.d.ts +54 -66
  86. package/node_modules/undici-types/eventsource.d.ts +4 -9
  87. package/node_modules/undici-types/fetch.d.ts +20 -22
  88. package/node_modules/undici-types/file.d.ts +39 -0
  89. package/node_modules/undici-types/filereader.d.ts +54 -0
  90. package/node_modules/undici-types/formdata.d.ts +7 -7
  91. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  92. package/node_modules/undici-types/global-origin.d.ts +5 -5
  93. package/node_modules/undici-types/handlers.d.ts +8 -8
  94. package/node_modules/undici-types/header.d.ts +1 -157
  95. package/node_modules/undici-types/index.d.ts +47 -64
  96. package/node_modules/undici-types/interceptors.d.ts +8 -64
  97. package/node_modules/undici-types/mock-agent.d.ts +18 -36
  98. package/node_modules/undici-types/mock-client.d.ts +4 -6
  99. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  100. package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
  101. package/node_modules/undici-types/mock-pool.d.ts +4 -6
  102. package/node_modules/undici-types/package.json +1 -1
  103. package/node_modules/undici-types/patch.d.ts +4 -0
  104. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  105. package/node_modules/undici-types/pool.d.ts +13 -15
  106. package/node_modules/undici-types/proxy-agent.d.ts +4 -5
  107. package/node_modules/undici-types/readable.d.ts +16 -19
  108. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  109. package/node_modules/undici-types/retry-handler.d.ts +10 -19
  110. package/node_modules/undici-types/util.d.ts +3 -3
  111. package/node_modules/undici-types/webidl.d.ts +29 -142
  112. package/node_modules/undici-types/websocket.d.ts +10 -46
  113. package/package.json +2 -1
  114. package/skills/cleave/SKILL.md +62 -2
  115. package/node_modules/@types/node/inspector/promises.d.ts +0 -41
  116. package/node_modules/@types/node/path/posix.d.ts +0 -8
  117. package/node_modules/@types/node/path/win32.d.ts +0 -8
  118. package/node_modules/@types/node/quic.d.ts +0 -910
  119. package/node_modules/@types/node/test/reporters.d.ts +0 -96
  120. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
  121. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
  122. package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
  123. package/node_modules/@types/node/util/types.d.ts +0 -558
  124. package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
  125. package/node_modules/@types/node/web-globals/console.d.ts +0 -9
  126. package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
  127. package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
  128. package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
  129. package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
  130. package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
  131. package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
  132. package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
  133. package/node_modules/@types/node/web-globals/url.d.ts +0 -24
  134. package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
  135. package/node_modules/undici-types/client-stats.d.ts +0 -15
  136. package/node_modules/undici-types/h2c-client.d.ts +0 -73
  137. package/node_modules/undici-types/mock-call-history.d.ts +0 -111
  138. package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
  139. package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
  140. package/node_modules/undici-types/utility.d.ts +0 -7
@@ -1,73 +1,17 @@
1
- import CacheHandler from './cache-interceptor'
2
- import Dispatcher from './dispatcher'
3
- import RetryHandler from './retry-handler'
4
- import { LookupOptions } from 'node:dns'
1
+ import Dispatcher from "./dispatcher";
2
+ import RetryHandler from "./retry-handler";
5
3
 
6
- export default Interceptors
4
+ export default Interceptors;
7
5
 
8
6
  declare namespace Interceptors {
9
7
  export type DumpInterceptorOpts = { maxSize?: number }
10
8
  export type RetryInterceptorOpts = RetryHandler.RetryOptions
11
9
  export type RedirectInterceptorOpts = { maxRedirections?: number }
12
- export type DecompressInterceptorOpts = {
13
- skipErrorResponses?: boolean
14
- skipStatusCodes?: number[]
15
- }
16
-
17
10
  export type ResponseErrorInterceptorOpts = { throwOnError: boolean }
18
- export type CacheInterceptorOpts = CacheHandler.CacheOptions
19
-
20
- // DNS interceptor
21
- export type DNSInterceptorRecord = { address: string, ttl: number, family: 4 | 6 }
22
- export type DNSInterceptorOriginRecords = { records: { 4: { ips: DNSInterceptorRecord[] } | null, 6: { ips: DNSInterceptorRecord[] } | null } }
23
- export type DNSStorage = {
24
- size: number
25
- get(origin: string): DNSInterceptorOriginRecords | null
26
- set(origin: string, records: DNSInterceptorOriginRecords | null, options: { ttl: number }): void
27
- delete(origin: string): void
28
- full(): boolean
29
- }
30
- export type DNSInterceptorOpts = {
31
- maxTTL?: number
32
- maxItems?: number
33
- lookup?: (origin: URL, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void
34
- pick?: (origin: URL, records: DNSInterceptorOriginRecords, affinity: 4 | 6) => DNSInterceptorRecord
35
- dualStack?: boolean
36
- affinity?: 4 | 6
37
- storage?: DNSStorage
38
- }
39
-
40
- // Deduplicate interceptor
41
- export type DeduplicateMethods = 'GET' | 'HEAD' | 'OPTIONS' | 'TRACE'
42
- export type DeduplicateInterceptorOpts = {
43
- /**
44
- * The HTTP methods to deduplicate.
45
- * Note: Only safe HTTP methods can be deduplicated.
46
- * @default ['GET']
47
- */
48
- methods?: DeduplicateMethods[]
49
- /**
50
- * Header names that, if present in a request, will cause the request to skip deduplication.
51
- * Header name matching is case-insensitive.
52
- * @default []
53
- */
54
- skipHeaderNames?: string[]
55
- /**
56
- * Header names to exclude from the deduplication key.
57
- * Requests with different values for these headers will still be deduplicated together.
58
- * Useful for headers like `x-request-id` that vary per request but shouldn't affect deduplication.
59
- * Header name matching is case-insensitive.
60
- * @default []
61
- */
62
- excludeHeaderNames?: string[]
63
- }
64
11
 
65
- export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
66
- export function retry (opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
67
- export function redirect (opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
68
- export function decompress (opts?: DecompressInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
69
- export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
70
- export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
71
- export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
72
- export function deduplicate (opts?: DeduplicateInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
12
+ export function createRedirectInterceptor(opts: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
13
+ export function dump(opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
14
+ export function retry(opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
15
+ export function redirect(opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
16
+ export function responseError(opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
73
17
  }
@@ -1,8 +1,7 @@
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
5
- import { MockCallHistory } from './mock-call-history'
4
+ import MockDispatch = MockInterceptor.MockDispatch;
6
5
 
7
6
  export default MockAgent
8
7
 
@@ -12,38 +11,30 @@ interface PendingInterceptor extends MockDispatch {
12
11
 
13
12
  /** A mocked Agent class that implements the Agent API. It allows one to intercept HTTP requests made through undici and return mocked responses instead. */
14
13
  declare class MockAgent<TMockAgentOptions extends MockAgent.Options = MockAgent.Options> extends Dispatcher {
15
- constructor (options?: TMockAgentOptions)
14
+ constructor(options?: MockAgent.Options)
16
15
  /** 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. */
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
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;
20
19
  /** Dispatches a mocked request. */
21
- dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
20
+ dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
22
21
  /** Closes the mock agent and waits for registered mock pools and clients to also close before resolving. */
23
- close (): Promise<void>
22
+ close(): Promise<void>;
24
23
  /** Disables mocking in MockAgent. */
25
- deactivate (): void
24
+ deactivate(): void;
26
25
  /** 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. */
27
- activate (): void
26
+ activate(): void;
28
27
  /** Define host matchers so only matching requests that aren't intercepted by the mock dispatchers will be attempted. */
29
- enableNetConnect (): void
30
- enableNetConnect (host: string): void
31
- enableNetConnect (host: RegExp): void
32
- enableNetConnect (host: ((host: string) => boolean)): void
28
+ enableNetConnect(): void;
29
+ enableNetConnect(host: string): void;
30
+ enableNetConnect(host: RegExp): void;
31
+ enableNetConnect(host: ((host: string) => boolean)): void;
33
32
  /** Causes all requests to throw when requests are not matched in a MockAgent intercept. */
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?: {
33
+ disableNetConnect(): void;
34
+ pendingInterceptors(): PendingInterceptor[];
35
+ assertNoPendingInterceptors(options?: {
45
36
  pendingInterceptorsFormatter?: PendingInterceptorsFormatter;
46
- }): void
37
+ }): void;
47
38
  }
48
39
 
49
40
  interface PendingInterceptorsFormatter {
@@ -54,15 +45,6 @@ declare namespace MockAgent {
54
45
  /** MockAgent options. */
55
46
  export interface Options extends Agent.Options {
56
47
  /** A custom agent to be encapsulated by the MockAgent. */
57
- agent?: Dispatcher;
58
-
59
- /** Ignore trailing slashes in the path */
60
- ignoreTrailingSlash?: boolean;
61
-
62
- /** Accept URLs with search parameters using non standard syntaxes. default false */
63
- acceptNonStandardSearchParameters?: boolean;
64
-
65
- /** Enable call history. you can either call MockAgent.enableCallHistory(). default false */
66
- enableCallHistory?: boolean
48
+ agent?: Agent;
67
49
  }
68
50
  }
@@ -7,15 +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.DispatchHandler): boolean
14
+ dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean;
15
15
  /** Closes the mock client and gracefully waits for enqueued requests to complete. */
16
- close (): Promise<void>
17
- /** Clean up all the prepared mocks. */
18
- cleanMocks (): void
16
+ close(): Promise<void>;
19
17
  }
20
18
 
21
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,36 +1,42 @@
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
+
5
11
  /** The scope associated with a mock dispatch. */
6
12
  declare class MockScope<TData extends object = object> {
7
- constructor (mockDispatch: MockInterceptor.MockDispatch<TData>)
13
+ constructor(mockDispatch: MockInterceptor.MockDispatch<TData>);
8
14
  /** Delay a reply by a set amount of time in ms. */
9
- delay (waitInMs: number): MockScope<TData>
15
+ delay(waitInMs: number): MockScope<TData>;
10
16
  /** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
11
- persist (): MockScope<TData>
17
+ persist(): MockScope<TData>;
12
18
  /** Define a reply for a set amount of matching requests. */
13
- times (repeatTimes: number): MockScope<TData>
19
+ times(repeatTimes: number): MockScope<TData>;
14
20
  }
15
21
 
16
22
  /** The interceptor for a Mock. */
17
23
  declare class MockInterceptor {
18
- constructor (options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[])
24
+ constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]);
19
25
  /** Mock an undici request with the defined reply. */
20
- reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>
26
+ reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>;
21
27
  reply<TData extends object = object>(
22
28
  statusCode: number,
23
29
  data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>,
24
30
  responseOptions?: MockInterceptor.MockResponseOptions
25
- ): MockScope<TData>
31
+ ): MockScope<TData>;
26
32
  /** Mock an undici request by throwing the defined reply error. */
27
- replyWithError<TError extends Error = Error>(error: TError): MockScope
33
+ replyWithError<TError extends Error = Error>(error: TError): MockScope;
28
34
  /** Set default reply headers on the interceptor for subsequent mocked replies. */
29
- defaultReplyHeaders (headers: IncomingHttpHeaders): MockInterceptor
35
+ defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor;
30
36
  /** Set default reply trailers on the interceptor for subsequent mocked replies. */
31
- defaultReplyTrailers (trailers: Record<string, string>): MockInterceptor
37
+ defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor;
32
38
  /** Set automatically calculated content-length header on subsequent mocked replies. */
33
- replyContentLength (): MockInterceptor
39
+ replyContentLength(): MockInterceptor;
34
40
  }
35
41
 
36
42
  declare namespace MockInterceptor {
@@ -69,11 +75,12 @@ declare namespace MockInterceptor {
69
75
  headers?: Headers | Record<string, string>;
70
76
  origin?: string;
71
77
  body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
78
+ maxRedirections?: number;
72
79
  }
73
80
 
74
81
  export type MockResponseDataHandler<TData extends object = object> = (
75
82
  opts: MockResponseCallbackOptions
76
- ) => TData | Buffer | string
83
+ ) => TData | Buffer | string;
77
84
 
78
85
  export type MockReplyOptionsCallback<TData extends object = object> = (
79
86
  opts: MockResponseCallbackOptions
@@ -83,12 +90,4 @@ declare namespace MockInterceptor {
83
90
  interface Interceptable extends Dispatcher {
84
91
  /** Intercepts any matching requests that use the same origin as this mock client. */
85
92
  intercept(options: MockInterceptor.Options): MockInterceptor;
86
- /** Clean up all the prepared mocks. */
87
- cleanMocks (): void
88
- }
89
-
90
- export {
91
- Interceptable,
92
- MockInterceptor,
93
- MockScope
94
93
  }
@@ -7,15 +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.DispatchHandler): boolean
14
+ dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean;
15
15
  /** Closes the mock pool and gracefully waits for enqueued requests to complete. */
16
- close (): Promise<void>
17
- /** Clean up all the prepared mocks. */
18
- cleanMocks (): void
16
+ close(): Promise<void>;
19
17
  }
20
18
 
21
19
  declare namespace MockPool {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici-types",
3
- "version": "7.18.2",
3
+ "version": "6.21.0",
4
4
  "description": "A stand-alone types package for Undici",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -2,6 +2,10 @@
2
2
 
3
3
  // See https://github.com/nodejs/undici/issues/1740
4
4
 
5
+ export type DOMException = typeof globalThis extends { DOMException: infer T }
6
+ ? T
7
+ : any
8
+
5
9
  export interface EventInit {
6
10
  bubbles?: boolean
7
11
  cancelable?: boolean
@@ -1,19 +1,19 @@
1
- import Pool from './pool'
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,41 +1,39 @@
1
1
  import Client from './client'
2
2
  import TPoolStats from './pool-stats'
3
- import { URL } from 'node:url'
4
- import Dispatcher from './dispatcher'
3
+ import { URL } from 'url'
4
+ import Dispatcher from "./dispatcher";
5
5
 
6
6
  export default Pool
7
7
 
8
- type PoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
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
- /** The amount of time before a client is removed from the pool and closed. `null` if no time limit. Default `null` */
37
- clientTtl?: number | null;
38
36
 
39
- interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options['interceptors']
37
+ interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options["interceptors"]
40
38
  }
41
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.DispatchHandler): boolean
12
- close (): Promise<void>
11
+ dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
12
+ close(): Promise<void>;
13
13
  }
14
14
 
15
15
  declare namespace ProxyAgent {
@@ -24,6 +24,5 @@ declare namespace ProxyAgent {
24
24
  requestTls?: buildConnector.BuildOptions;
25
25
  proxyTls?: buildConnector.BuildOptions;
26
26
  clientFactory?(origin: URL, opts: object): Dispatcher;
27
- proxyTunnel?: boolean;
28
27
  }
29
28
  }
@@ -1,47 +1,45 @@
1
- import { Readable } from 'node:stream'
2
- import { Blob } from 'node:buffer'
1
+ import { Readable } from "stream";
2
+ import { Blob } from 'buffer'
3
3
 
4
4
  export default BodyReadable
5
5
 
6
6
  declare class BodyReadable extends Readable {
7
- constructor (opts: {
8
- resume: (this: Readable, size: number) => void | null;
9
- abort: () => void | null;
10
- contentType?: string;
11
- contentLength?: number;
12
- highWaterMark?: number;
13
- })
7
+ constructor(
8
+ resume?: (this: Readable, size: number) => void | null,
9
+ abort?: () => void | null,
10
+ contentType?: string
11
+ )
14
12
 
15
13
  /** Consumes and returns the body as a string
16
14
  * https://fetch.spec.whatwg.org/#dom-body-text
17
15
  */
18
- text (): Promise<string>
16
+ text(): Promise<string>
19
17
 
20
18
  /** Consumes and returns the body as a JavaScript Object
21
19
  * https://fetch.spec.whatwg.org/#dom-body-json
22
20
  */
23
- json (): Promise<unknown>
21
+ json(): Promise<unknown>
24
22
 
25
23
  /** Consumes and returns the body as a Blob
26
24
  * https://fetch.spec.whatwg.org/#dom-body-blob
27
25
  */
28
- blob (): Promise<Blob>
26
+ blob(): Promise<Blob>
29
27
 
30
28
  /** Consumes and returns the body as an Uint8Array
31
29
  * https://fetch.spec.whatwg.org/#dom-body-bytes
32
30
  */
33
- bytes (): Promise<Uint8Array>
31
+ bytes(): Promise<Uint8Array>
34
32
 
35
33
  /** Consumes and returns the body as an ArrayBuffer
36
34
  * https://fetch.spec.whatwg.org/#dom-body-arraybuffer
37
35
  */
38
- arrayBuffer (): Promise<ArrayBuffer>
36
+ arrayBuffer(): Promise<ArrayBuffer>
39
37
 
40
38
  /** Not implemented
41
39
  *
42
40
  * https://fetch.spec.whatwg.org/#dom-body-formdata
43
41
  */
44
- formData (): Promise<never>
42
+ formData(): Promise<never>
45
43
 
46
44
  /** Returns true if the body is not null and the body has been consumed
47
45
  *
@@ -51,7 +49,7 @@ declare class BodyReadable extends Readable {
51
49
  */
52
50
  readonly bodyUsed: boolean
53
51
 
54
- /**
52
+ /**
55
53
  * If body is null, it should return null as the body
56
54
  *
57
55
  * If body is not null, should return the body as a ReadableStream
@@ -61,8 +59,7 @@ declare class BodyReadable extends Readable {
61
59
  readonly body: never | undefined
62
60
 
63
61
  /** Dumps the response body by reading `limit` number of bytes.
64
- * @param opts.limit Number of bytes to read (optional) - Default: 131072
65
- * @param opts.signal AbortSignal to cancel the operation (optional)
62
+ * @param opts.limit Number of bytes to read (optional) - Default: 262144
66
63
  */
67
- dump (opts?: { limit: number; signal?: AbortSignal }): Promise<void>
64
+ dump(opts?: { limit: number }): Promise<void>
68
65
  }
@@ -4,5 +4,5 @@ import RetryHandler from './retry-handler'
4
4
  export default RetryAgent
5
5
 
6
6
  declare class RetryAgent extends Dispatcher {
7
- constructor (dispatcher: Dispatcher, options?: RetryHandler.RetryOptions)
7
+ constructor(dispatcher: Dispatcher, options?: RetryHandler.RetryOptions)
8
8
  }
@@ -1,18 +1,18 @@
1
- import Dispatcher from './dispatcher'
1
+ import Dispatcher from "./dispatcher";
2
2
 
3
- export default RetryHandler
3
+ export default RetryHandler;
4
4
 
5
- declare class RetryHandler implements Dispatcher.DispatchHandler {
6
- constructor (
5
+ declare class RetryHandler implements Dispatcher.DispatchHandlers {
6
+ constructor(
7
7
  options: Dispatcher.DispatchOptions & {
8
8
  retryOptions?: RetryHandler.RetryOptions;
9
9
  },
10
10
  retryHandlers: RetryHandler.RetryHandlers
11
- )
11
+ );
12
12
  }
13
13
 
14
14
  declare namespace RetryHandler {
15
- export type RetryState = { counter: number; }
15
+ export type RetryState = { counter: number; };
16
16
 
17
17
  export type RetryContext = {
18
18
  state: RetryState;
@@ -21,7 +21,7 @@ declare namespace RetryHandler {
21
21
  };
22
22
  }
23
23
 
24
- export type OnRetryCallback = (result?: Error | null) => void
24
+ export type OnRetryCallback = (result?: Error | null) => void;
25
25
 
26
26
  export type RetryCallback = (
27
27
  err: Error,
@@ -32,18 +32,9 @@ declare namespace RetryHandler {
32
32
  };
33
33
  },
34
34
  callback: OnRetryCallback
35
- ) => void
35
+ ) => number | null;
36
36
 
37
37
  export interface RetryOptions {
38
- /**
39
- * If true, the retry handler will throw an error if the request fails,
40
- * this will prevent the folling handlers from being called, and will destroy the socket.
41
- *
42
- * @type {boolean}
43
- * @memberof RetryOptions
44
- * @default true
45
- */
46
- throwOnError?: boolean;
47
38
  /**
48
39
  * Callback to be invoked on every retry iteration.
49
40
  * It receives the error, current state of the retry object and the options object
@@ -119,7 +110,7 @@ declare namespace RetryHandler {
119
110
  }
120
111
 
121
112
  export interface RetryHandlers {
122
- dispatch: Dispatcher['dispatch'];
123
- handler: Dispatcher.DispatchHandler;
113
+ dispatch: Dispatcher["dispatch"];
114
+ handler: Dispatcher.DispatchHandlers;
124
115
  }
125
116
  }
@@ -3,7 +3,7 @@ export namespace util {
3
3
  * Retrieves a header name and returns its lowercase value.
4
4
  * @param value Header name
5
5
  */
6
- export function headerNameToString (value: string | Buffer): string
6
+ export function headerNameToString(value: string | Buffer): string;
7
7
 
8
8
  /**
9
9
  * Receives a header object and returns the parsed value.
@@ -11,8 +11,8 @@ export namespace util {
11
11
  * @param obj Object to specify a proxy object. Used to assign parsed values.
12
12
  * @returns If `obj` is specified, it is equivalent to `obj`.
13
13
  */
14
- export function parseHeaders (
14
+ export function parseHeaders(
15
15
  headers: (Buffer | string | (Buffer | string)[])[],
16
16
  obj?: Record<string, string | string[]>
17
- ): Record<string, string | string[]>
17
+ ): Record<string, string | string[]>;
18
18
  }