@rio-cloud/cdk-v2-constructs 8.2.0-alpha.0 → 8.2.1-alpha.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 (179) hide show
  1. package/.jsii +2 -2
  2. package/node_modules/@types/node/README.md +3 -3
  3. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  4. package/node_modules/@types/node/assert.d.ts +211 -92
  5. package/node_modules/@types/node/async_hooks.d.ts +103 -19
  6. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  7. package/node_modules/@types/node/buffer.d.ts +88 -516
  8. package/node_modules/@types/node/child_process.d.ts +167 -231
  9. package/node_modules/@types/node/cluster.d.ts +172 -26
  10. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  11. package/node_modules/@types/node/console.d.ts +66 -28
  12. package/node_modules/@types/node/constants.d.ts +14 -12
  13. package/node_modules/@types/node/crypto.d.ts +1458 -497
  14. package/node_modules/@types/node/dgram.d.ts +44 -30
  15. package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
  16. package/node_modules/@types/node/dns/promises.d.ts +120 -42
  17. package/node_modules/@types/node/dns.d.ts +209 -95
  18. package/node_modules/@types/node/domain.d.ts +14 -18
  19. package/node_modules/@types/node/events.d.ts +245 -113
  20. package/node_modules/@types/node/fs/promises.d.ts +194 -96
  21. package/node_modules/@types/node/fs.d.ts +695 -270
  22. package/node_modules/@types/node/globals.d.ts +97 -308
  23. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  24. package/node_modules/@types/node/http.d.ts +363 -97
  25. package/node_modules/@types/node/http2.d.ts +684 -231
  26. package/node_modules/@types/node/https.d.ts +122 -87
  27. package/node_modules/@types/node/index.d.ts +24 -11
  28. package/node_modules/@types/node/inspector.d.ts +220 -2690
  29. package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
  30. package/node_modules/@types/node/module.d.ts +705 -149
  31. package/node_modules/@types/node/net.d.ts +178 -54
  32. package/node_modules/@types/node/os.d.ts +47 -17
  33. package/node_modules/@types/node/package.json +22 -97
  34. package/node_modules/@types/node/path.d.ts +12 -3
  35. package/node_modules/@types/node/perf_hooks.d.ts +500 -97
  36. package/node_modules/@types/node/process.d.ts +657 -87
  37. package/node_modules/@types/node/punycode.d.ts +5 -5
  38. package/node_modules/@types/node/querystring.d.ts +24 -13
  39. package/node_modules/@types/node/readline/promises.d.ts +25 -14
  40. package/node_modules/@types/node/readline.d.ts +102 -41
  41. package/node_modules/@types/node/repl.d.ts +38 -30
  42. package/node_modules/@types/node/sea.d.ts +162 -0
  43. package/node_modules/@types/node/sqlite.d.ts +1040 -0
  44. package/node_modules/@types/node/stream/consumers.d.ts +33 -7
  45. package/node_modules/@types/node/stream/promises.d.ts +8 -1
  46. package/node_modules/@types/node/stream/web.d.ts +251 -28
  47. package/node_modules/@types/node/stream.d.ts +1060 -1055
  48. package/node_modules/@types/node/string_decoder.d.ts +8 -8
  49. package/node_modules/@types/node/test.d.ts +2133 -1166
  50. package/node_modules/@types/node/timers/promises.d.ts +31 -16
  51. package/node_modules/@types/node/timers.d.ts +159 -114
  52. package/node_modules/@types/node/tls.d.ts +232 -163
  53. package/node_modules/@types/node/trace_events.d.ts +43 -28
  54. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  55. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  56. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  57. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  58. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  59. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  60. package/node_modules/@types/node/tty.d.ts +9 -9
  61. package/node_modules/@types/node/url.d.ts +236 -84
  62. package/node_modules/@types/node/util.d.ts +562 -412
  63. package/node_modules/@types/node/v8.d.ts +368 -21
  64. package/node_modules/@types/node/vm.d.ts +443 -149
  65. package/node_modules/@types/node/wasi.d.ts +62 -18
  66. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  67. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  68. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  69. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  72. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  73. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  74. package/node_modules/@types/node/worker_threads.d.ts +310 -107
  75. package/node_modules/@types/node/zlib.d.ts +301 -73
  76. package/node_modules/undici-types/LICENSE +21 -0
  77. package/node_modules/undici-types/agent.d.ts +13 -12
  78. package/node_modules/undici-types/api.d.ts +26 -26
  79. package/node_modules/undici-types/balanced-pool.d.ts +19 -7
  80. package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  81. package/node_modules/undici-types/client-stats.d.ts +15 -0
  82. package/node_modules/undici-types/client.d.ts +26 -15
  83. package/node_modules/undici-types/connector.d.ts +2 -2
  84. package/node_modules/undici-types/cookies.d.ts +2 -0
  85. package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
  86. package/node_modules/undici-types/dispatcher.d.ts +148 -113
  87. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  88. package/node_modules/undici-types/errors.d.ts +79 -46
  89. package/node_modules/undici-types/eventsource.d.ts +66 -0
  90. package/node_modules/undici-types/fetch.d.ts +41 -39
  91. package/node_modules/undici-types/formdata.d.ts +8 -8
  92. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  93. package/node_modules/undici-types/global-origin.d.ts +5 -5
  94. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  95. package/node_modules/undici-types/handlers.d.ts +11 -5
  96. package/node_modules/undici-types/header.d.ts +157 -1
  97. package/node_modules/undici-types/index.d.ts +68 -43
  98. package/node_modules/undici-types/interceptors.d.ts +71 -3
  99. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  100. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  101. package/node_modules/undici-types/mock-client.d.ts +6 -4
  102. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  103. package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
  104. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  105. package/node_modules/undici-types/package.json +1 -1
  106. package/node_modules/undici-types/patch.d.ts +0 -42
  107. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  108. package/node_modules/undici-types/pool.d.ts +21 -8
  109. package/node_modules/undici-types/proxy-agent.d.ts +5 -6
  110. package/node_modules/undici-types/readable.d.ts +24 -17
  111. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  112. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  113. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  114. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  115. package/node_modules/undici-types/util.d.ts +18 -0
  116. package/node_modules/undici-types/utility.d.ts +7 -0
  117. package/node_modules/undici-types/webidl.d.ts +157 -36
  118. package/node_modules/undici-types/websocket.d.ts +67 -12
  119. package/package.json +9 -60
  120. package/version.json +1 -1
  121. package/node_modules/@types/node/dom-events.d.ts +0 -122
  122. package/node_modules/@types/node/globals.global.d.ts +0 -1
  123. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  124. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  125. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  126. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  127. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  128. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  129. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  130. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  131. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
  132. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
  133. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
  134. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  135. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  136. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  137. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  138. package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
  139. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
  140. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
  141. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
  142. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  143. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
  144. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  145. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  146. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  147. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  148. package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
  149. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  150. package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
  151. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  152. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
  153. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
  154. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  155. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  156. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  157. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  158. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  159. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  160. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  161. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
  162. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  163. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  164. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
  165. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  166. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  167. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  168. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  169. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  170. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  171. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
  172. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
  173. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
  174. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  175. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  176. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  177. package/node_modules/argparse/CHANGELOG.md +0 -216
  178. package/node_modules/undici-types/file.d.ts +0 -39
  179. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1,25 +1,39 @@
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 buildConnector from'./connector'
10
- import errors from'./errors'
11
- import Agent from'./agent'
12
- import MockClient from'./mock-client'
13
- import MockPool from'./mock-pool'
14
- import MockAgent from'./mock-agent'
15
- import mockErrors from'./mock-errors'
16
- import ProxyAgent from'./proxy-agent'
8
+ import RoundRobinPool from './round-robin-pool'
9
+ import Client from './client'
10
+ import H2CClient from './h2c-client'
11
+ import buildConnector from './connector'
12
+ import errors from './errors'
13
+ import Agent from './agent'
14
+ import MockClient from './mock-client'
15
+ import MockPool from './mock-pool'
16
+ import MockAgent from './mock-agent'
17
+ import { SnapshotAgent } from './snapshot-agent'
18
+ import { MockCallHistory, MockCallHistoryLog } from './mock-call-history'
19
+ import mockErrors from './mock-errors'
20
+ import ProxyAgent from './proxy-agent'
21
+ import EnvHttpProxyAgent from './env-http-proxy-agent'
22
+ import RetryHandler from './retry-handler'
23
+ import RetryAgent from './retry-agent'
17
24
  import { request, pipeline, stream, connect, upgrade } from './api'
25
+ import interceptors from './interceptors'
18
26
 
27
+ import CacheInterceptor from './cache-interceptor'
28
+ declare const cacheStores: {
29
+ MemoryCacheStore: typeof CacheInterceptor.MemoryCacheStore;
30
+ SqliteCacheStore: typeof CacheInterceptor.SqliteCacheStore;
31
+ }
32
+
33
+ export * from './util'
19
34
  export * from './cookies'
35
+ export * from './eventsource'
20
36
  export * from './fetch'
21
- export * from './file'
22
- export * from './filereader'
23
37
  export * from './formdata'
24
38
  export * from './diagnostics-channel'
25
39
  export * from './websocket'
@@ -27,37 +41,48 @@ export * from './content-type'
27
41
  export * from './cache'
28
42
  export { Interceptable } from './mock-interceptor'
29
43
 
30
- export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, MockClient, MockPool, MockAgent, mockErrors, ProxyAgent, RedirectHandler, DecoratorHandler }
44
+ declare function globalThisInstall (): void
45
+
46
+ export { Dispatcher, BalancedPool, RoundRobinPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, cacheStores, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
31
47
  export default Undici
32
48
 
33
49
  declare namespace Undici {
34
- var Dispatcher: typeof import('./dispatcher').default
35
- var Pool: typeof import('./pool').default;
36
- var RedirectHandler: typeof import ('./handlers').RedirectHandler
37
- var DecoratorHandler: typeof import ('./handlers').DecoratorHandler
38
- var createRedirectInterceptor: typeof import ('./interceptors').createRedirectInterceptor
39
- var BalancedPool: typeof import('./balanced-pool').default;
40
- var Client: typeof import('./client').default;
41
- var buildConnector: typeof import('./connector').default;
42
- var errors: typeof import('./errors').default;
43
- var Agent: typeof import('./agent').default;
44
- var setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher;
45
- var getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher;
46
- var request: typeof import('./api').request;
47
- var stream: typeof import('./api').stream;
48
- var pipeline: typeof import('./api').pipeline;
49
- var connect: typeof import('./api').connect;
50
- var upgrade: typeof import('./api').upgrade;
51
- var MockClient: typeof import('./mock-client').default;
52
- var MockPool: typeof import('./mock-pool').default;
53
- var MockAgent: typeof import('./mock-agent').default;
54
- var mockErrors: typeof import('./mock-errors').default;
55
- var fetch: typeof import('./fetch').fetch;
56
- var Headers: typeof import('./fetch').Headers;
57
- var Response: typeof import('./fetch').Response;
58
- var Request: typeof import('./fetch').Request;
59
- var FormData: typeof import('./formdata').FormData;
60
- var File: typeof import('./file').File;
61
- var FileReader: typeof import('./filereader').FileReader;
62
- var caches: typeof import('./cache').caches;
50
+ const Dispatcher: typeof import('./dispatcher').default
51
+ const Pool: typeof import('./pool').default
52
+ const RedirectHandler: typeof import ('./handlers').RedirectHandler
53
+ const DecoratorHandler: typeof import ('./handlers').DecoratorHandler
54
+ const RetryHandler: typeof import ('./retry-handler').default
55
+ const BalancedPool: typeof import('./balanced-pool').default
56
+ const RoundRobinPool: typeof import('./round-robin-pool').default
57
+ const Client: typeof import('./client').default
58
+ const H2CClient: typeof import('./h2c-client').default
59
+ const buildConnector: typeof import('./connector').default
60
+ const errors: typeof import('./errors').default
61
+ const Agent: typeof import('./agent').default
62
+ const setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher
63
+ const getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher
64
+ const request: typeof import('./api').request
65
+ const stream: typeof import('./api').stream
66
+ const pipeline: typeof import('./api').pipeline
67
+ const connect: typeof import('./api').connect
68
+ const upgrade: typeof import('./api').upgrade
69
+ const MockClient: typeof import('./mock-client').default
70
+ const MockPool: typeof import('./mock-pool').default
71
+ const MockAgent: typeof import('./mock-agent').default
72
+ const SnapshotAgent: typeof import('./snapshot-agent').SnapshotAgent
73
+ const MockCallHistory: typeof import('./mock-call-history').MockCallHistory
74
+ const MockCallHistoryLog: typeof import('./mock-call-history').MockCallHistoryLog
75
+ const mockErrors: typeof import('./mock-errors').default
76
+ const fetch: typeof import('./fetch').fetch
77
+ const Headers: typeof import('./fetch').Headers
78
+ const Response: typeof import('./fetch').Response
79
+ const Request: typeof import('./fetch').Request
80
+ const FormData: typeof import('./formdata').FormData
81
+ const caches: typeof import('./cache').caches
82
+ const interceptors: typeof import('./interceptors').default
83
+ const cacheStores: {
84
+ MemoryCacheStore: typeof import('./cache-interceptor').default.MemoryCacheStore,
85
+ SqliteCacheStore: typeof import('./cache-interceptor').default.SqliteCacheStore
86
+ }
87
+ const install: typeof globalThisInstall
63
88
  }
@@ -1,5 +1,73 @@
1
- import Dispatcher from "./dispatcher";
1
+ import CacheHandler from './cache-interceptor'
2
+ import Dispatcher from './dispatcher'
3
+ import RetryHandler from './retry-handler'
4
+ import { LookupOptions } from 'node:dns'
2
5
 
3
- type RedirectInterceptorOpts = { maxRedirections?: number }
6
+ export default Interceptors
4
7
 
5
- export declare function createRedirectInterceptor (opts: RedirectInterceptorOpts): Dispatcher.DispatchInterceptor
8
+ declare namespace Interceptors {
9
+ export type DumpInterceptorOpts = { maxSize?: number }
10
+ export type RetryInterceptorOpts = RetryHandler.RetryOptions
11
+ export type RedirectInterceptorOpts = { maxRedirections?: number }
12
+ export type DecompressInterceptorOpts = {
13
+ skipErrorResponses?: boolean
14
+ skipStatusCodes?: number[]
15
+ }
16
+
17
+ 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
+
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
73
+ }
@@ -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?: MockAgent.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.DispatchHandlers): boolean;
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
- pendingInterceptors(): PendingInterceptor[];
35
- assertNoPendingInterceptors(options?: {
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,15 @@ 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?: Agent;
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
49
67
  }
50
68
  }
@@ -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,15 @@ 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.DispatchHandlers): boolean;
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
+ /** Clean up all the prepared mocks. */
18
+ cleanMocks (): void
17
19
  }
18
20
 
19
21
  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 {
@@ -71,16 +65,15 @@ declare namespace MockInterceptor {
71
65
 
72
66
  export interface MockResponseCallbackOptions {
73
67
  path: string;
74
- origin: string;
75
68
  method: string;
76
- body?: BodyInit | Dispatcher.DispatchOptions['body'];
77
- headers: Headers | Record<string, string>;
78
- maxRedirections: number;
69
+ headers?: Headers | Record<string, string>;
70
+ origin?: string;
71
+ body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
79
72
  }
80
73
 
81
74
  export type MockResponseDataHandler<TData extends object = object> = (
82
75
  opts: MockResponseCallbackOptions
83
- ) => TData | Buffer | string;
76
+ ) => TData | Buffer | string
84
77
 
85
78
  export type MockReplyOptionsCallback<TData extends object = object> = (
86
79
  opts: MockResponseCallbackOptions
@@ -90,4 +83,12 @@ declare namespace MockInterceptor {
90
83
  interface Interceptable extends Dispatcher {
91
84
  /** Intercepts any matching requests that use the same origin as this mock client. */
92
85
  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
93
94
  }
@@ -7,13 +7,15 @@ 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.DispatchHandlers): boolean;
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
+ /** Clean up all the prepared mocks. */
18
+ cleanMocks (): void
17
19
  }
18
20
 
19
21
  declare namespace MockPool {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici-types",
3
- "version": "5.26.5",
3
+ "version": "7.18.2",
4
4
  "description": "A stand-alone types package for Undici",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -2,48 +2,6 @@
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
-
9
- export type EventTarget = typeof globalThis extends { EventTarget: infer T }
10
- ? T
11
- : {
12
- addEventListener(
13
- type: string,
14
- listener: any,
15
- options?: any,
16
- ): void
17
- dispatchEvent(event: Event): boolean
18
- removeEventListener(
19
- type: string,
20
- listener: any,
21
- options?: any | boolean,
22
- ): void
23
- }
24
-
25
- export type Event = typeof globalThis extends { Event: infer T }
26
- ? T
27
- : {
28
- readonly bubbles: boolean
29
- cancelBubble: () => void
30
- readonly cancelable: boolean
31
- readonly composed: boolean
32
- composedPath(): [EventTarget?]
33
- readonly currentTarget: EventTarget | null
34
- readonly defaultPrevented: boolean
35
- readonly eventPhase: 0 | 2
36
- readonly isTrusted: boolean
37
- preventDefault(): void
38
- returnValue: boolean
39
- readonly srcElement: EventTarget | null
40
- stopImmediatePropagation(): void
41
- stopPropagation(): void
42
- readonly target: EventTarget | null
43
- readonly timeStamp: number
44
- readonly type: string
45
- }
46
-
47
5
  export interface EventInit {
48
6
  bubbles?: boolean
49
7
  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
  }