deepv-code 1.0.182 → 1.0.183

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 (193) hide show
  1. package/bundle/dvcode.js +635 -635
  2. package/package.json +1 -1
  3. package/bundle/assets/help/README.md +0 -113
  4. package/bundle/assets/sounds/README.md +0 -74
  5. package/bundle/node_modules/undici/LICENSE +0 -21
  6. package/bundle/node_modules/undici/README.md +0 -472
  7. package/bundle/node_modules/undici/docs/docs/api/Agent.md +0 -83
  8. package/bundle/node_modules/undici/docs/docs/api/BalancedPool.md +0 -99
  9. package/bundle/node_modules/undici/docs/docs/api/CacheStorage.md +0 -30
  10. package/bundle/node_modules/undici/docs/docs/api/CacheStore.md +0 -151
  11. package/bundle/node_modules/undici/docs/docs/api/Client.md +0 -281
  12. package/bundle/node_modules/undici/docs/docs/api/ClientStats.md +0 -27
  13. package/bundle/node_modules/undici/docs/docs/api/Connector.md +0 -115
  14. package/bundle/node_modules/undici/docs/docs/api/ContentType.md +0 -57
  15. package/bundle/node_modules/undici/docs/docs/api/Cookies.md +0 -101
  16. package/bundle/node_modules/undici/docs/docs/api/Debug.md +0 -62
  17. package/bundle/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +0 -204
  18. package/bundle/node_modules/undici/docs/docs/api/Dispatcher.md +0 -1200
  19. package/bundle/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +0 -159
  20. package/bundle/node_modules/undici/docs/docs/api/Errors.md +0 -49
  21. package/bundle/node_modules/undici/docs/docs/api/EventSource.md +0 -45
  22. package/bundle/node_modules/undici/docs/docs/api/Fetch.md +0 -52
  23. package/bundle/node_modules/undici/docs/docs/api/H2CClient.md +0 -262
  24. package/bundle/node_modules/undici/docs/docs/api/MockAgent.md +0 -603
  25. package/bundle/node_modules/undici/docs/docs/api/MockCallHistory.md +0 -197
  26. package/bundle/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +0 -43
  27. package/bundle/node_modules/undici/docs/docs/api/MockClient.md +0 -77
  28. package/bundle/node_modules/undici/docs/docs/api/MockErrors.md +0 -12
  29. package/bundle/node_modules/undici/docs/docs/api/MockPool.md +0 -548
  30. package/bundle/node_modules/undici/docs/docs/api/Pool.md +0 -84
  31. package/bundle/node_modules/undici/docs/docs/api/PoolStats.md +0 -35
  32. package/bundle/node_modules/undici/docs/docs/api/ProxyAgent.md +0 -227
  33. package/bundle/node_modules/undici/docs/docs/api/RedirectHandler.md +0 -96
  34. package/bundle/node_modules/undici/docs/docs/api/RetryAgent.md +0 -45
  35. package/bundle/node_modules/undici/docs/docs/api/RetryHandler.md +0 -117
  36. package/bundle/node_modules/undici/docs/docs/api/Util.md +0 -25
  37. package/bundle/node_modules/undici/docs/docs/api/WebSocket.md +0 -85
  38. package/bundle/node_modules/undici/docs/docs/api/api-lifecycle.md +0 -91
  39. package/bundle/node_modules/undici/docs/docs/best-practices/client-certificate.md +0 -64
  40. package/bundle/node_modules/undici/docs/docs/best-practices/mocking-request.md +0 -190
  41. package/bundle/node_modules/undici/docs/docs/best-practices/proxy.md +0 -127
  42. package/bundle/node_modules/undici/docs/docs/best-practices/writing-tests.md +0 -20
  43. package/bundle/node_modules/undici/index-fetch.js +0 -35
  44. package/bundle/node_modules/undici/index.d.ts +0 -3
  45. package/bundle/node_modules/undici/index.js +0 -183
  46. package/bundle/node_modules/undici/lib/api/abort-signal.js +0 -59
  47. package/bundle/node_modules/undici/lib/api/api-connect.js +0 -110
  48. package/bundle/node_modules/undici/lib/api/api-pipeline.js +0 -252
  49. package/bundle/node_modules/undici/lib/api/api-request.js +0 -199
  50. package/bundle/node_modules/undici/lib/api/api-stream.js +0 -209
  51. package/bundle/node_modules/undici/lib/api/api-upgrade.js +0 -110
  52. package/bundle/node_modules/undici/lib/api/index.js +0 -7
  53. package/bundle/node_modules/undici/lib/api/readable.js +0 -558
  54. package/bundle/node_modules/undici/lib/api/util.js +0 -95
  55. package/bundle/node_modules/undici/lib/cache/memory-cache-store.js +0 -234
  56. package/bundle/node_modules/undici/lib/cache/sqlite-cache-store.js +0 -461
  57. package/bundle/node_modules/undici/lib/core/connect.js +0 -164
  58. package/bundle/node_modules/undici/lib/core/constants.js +0 -143
  59. package/bundle/node_modules/undici/lib/core/diagnostics.js +0 -196
  60. package/bundle/node_modules/undici/lib/core/errors.js +0 -244
  61. package/bundle/node_modules/undici/lib/core/request.js +0 -397
  62. package/bundle/node_modules/undici/lib/core/symbols.js +0 -68
  63. package/bundle/node_modules/undici/lib/core/tree.js +0 -160
  64. package/bundle/node_modules/undici/lib/core/util.js +0 -988
  65. package/bundle/node_modules/undici/lib/dispatcher/agent.js +0 -135
  66. package/bundle/node_modules/undici/lib/dispatcher/balanced-pool.js +0 -206
  67. package/bundle/node_modules/undici/lib/dispatcher/client-h1.js +0 -1615
  68. package/bundle/node_modules/undici/lib/dispatcher/client-h2.js +0 -798
  69. package/bundle/node_modules/undici/lib/dispatcher/client.js +0 -614
  70. package/bundle/node_modules/undici/lib/dispatcher/dispatcher-base.js +0 -161
  71. package/bundle/node_modules/undici/lib/dispatcher/dispatcher.js +0 -48
  72. package/bundle/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +0 -151
  73. package/bundle/node_modules/undici/lib/dispatcher/fixed-queue.js +0 -159
  74. package/bundle/node_modules/undici/lib/dispatcher/h2c-client.js +0 -122
  75. package/bundle/node_modules/undici/lib/dispatcher/pool-base.js +0 -191
  76. package/bundle/node_modules/undici/lib/dispatcher/pool.js +0 -118
  77. package/bundle/node_modules/undici/lib/dispatcher/proxy-agent.js +0 -275
  78. package/bundle/node_modules/undici/lib/dispatcher/retry-agent.js +0 -35
  79. package/bundle/node_modules/undici/lib/global.js +0 -32
  80. package/bundle/node_modules/undici/lib/handler/cache-handler.js +0 -448
  81. package/bundle/node_modules/undici/lib/handler/cache-revalidation-handler.js +0 -124
  82. package/bundle/node_modules/undici/lib/handler/decorator-handler.js +0 -67
  83. package/bundle/node_modules/undici/lib/handler/redirect-handler.js +0 -227
  84. package/bundle/node_modules/undici/lib/handler/retry-handler.js +0 -342
  85. package/bundle/node_modules/undici/lib/handler/unwrap-handler.js +0 -96
  86. package/bundle/node_modules/undici/lib/handler/wrap-handler.js +0 -95
  87. package/bundle/node_modules/undici/lib/interceptor/cache.js +0 -372
  88. package/bundle/node_modules/undici/lib/interceptor/dns.js +0 -432
  89. package/bundle/node_modules/undici/lib/interceptor/dump.js +0 -111
  90. package/bundle/node_modules/undici/lib/interceptor/redirect.js +0 -21
  91. package/bundle/node_modules/undici/lib/interceptor/response-error.js +0 -95
  92. package/bundle/node_modules/undici/lib/interceptor/retry.js +0 -19
  93. package/bundle/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  94. package/bundle/node_modules/undici/lib/llhttp/constants.d.ts +0 -97
  95. package/bundle/node_modules/undici/lib/llhttp/constants.js +0 -498
  96. package/bundle/node_modules/undici/lib/llhttp/constants.js.map +0 -1
  97. package/bundle/node_modules/undici/lib/llhttp/llhttp-wasm.js +0 -15
  98. package/bundle/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +0 -15
  99. package/bundle/node_modules/undici/lib/llhttp/utils.d.ts +0 -2
  100. package/bundle/node_modules/undici/lib/llhttp/utils.js +0 -15
  101. package/bundle/node_modules/undici/lib/llhttp/utils.js.map +0 -1
  102. package/bundle/node_modules/undici/lib/mock/mock-agent.js +0 -224
  103. package/bundle/node_modules/undici/lib/mock/mock-call-history.js +0 -248
  104. package/bundle/node_modules/undici/lib/mock/mock-client.js +0 -64
  105. package/bundle/node_modules/undici/lib/mock/mock-errors.js +0 -19
  106. package/bundle/node_modules/undici/lib/mock/mock-interceptor.js +0 -209
  107. package/bundle/node_modules/undici/lib/mock/mock-pool.js +0 -64
  108. package/bundle/node_modules/undici/lib/mock/mock-symbols.js +0 -31
  109. package/bundle/node_modules/undici/lib/mock/mock-utils.js +0 -433
  110. package/bundle/node_modules/undici/lib/mock/pending-interceptors-formatter.js +0 -43
  111. package/bundle/node_modules/undici/lib/util/cache.js +0 -368
  112. package/bundle/node_modules/undici/lib/util/date.js +0 -259
  113. package/bundle/node_modules/undici/lib/util/stats.js +0 -32
  114. package/bundle/node_modules/undici/lib/util/timers.js +0 -423
  115. package/bundle/node_modules/undici/lib/web/cache/cache.js +0 -862
  116. package/bundle/node_modules/undici/lib/web/cache/cachestorage.js +0 -152
  117. package/bundle/node_modules/undici/lib/web/cache/util.js +0 -45
  118. package/bundle/node_modules/undici/lib/web/cookies/constants.js +0 -12
  119. package/bundle/node_modules/undici/lib/web/cookies/index.js +0 -199
  120. package/bundle/node_modules/undici/lib/web/cookies/parse.js +0 -322
  121. package/bundle/node_modules/undici/lib/web/cookies/util.js +0 -282
  122. package/bundle/node_modules/undici/lib/web/eventsource/eventsource-stream.js +0 -399
  123. package/bundle/node_modules/undici/lib/web/eventsource/eventsource.js +0 -484
  124. package/bundle/node_modules/undici/lib/web/eventsource/util.js +0 -37
  125. package/bundle/node_modules/undici/lib/web/fetch/LICENSE +0 -21
  126. package/bundle/node_modules/undici/lib/web/fetch/body.js +0 -532
  127. package/bundle/node_modules/undici/lib/web/fetch/constants.js +0 -131
  128. package/bundle/node_modules/undici/lib/web/fetch/data-url.js +0 -744
  129. package/bundle/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +0 -46
  130. package/bundle/node_modules/undici/lib/web/fetch/formdata-parser.js +0 -501
  131. package/bundle/node_modules/undici/lib/web/fetch/formdata.js +0 -263
  132. package/bundle/node_modules/undici/lib/web/fetch/global.js +0 -40
  133. package/bundle/node_modules/undici/lib/web/fetch/headers.js +0 -719
  134. package/bundle/node_modules/undici/lib/web/fetch/index.js +0 -2258
  135. package/bundle/node_modules/undici/lib/web/fetch/request.js +0 -1099
  136. package/bundle/node_modules/undici/lib/web/fetch/response.js +0 -636
  137. package/bundle/node_modules/undici/lib/web/fetch/util.js +0 -1782
  138. package/bundle/node_modules/undici/lib/web/fetch/webidl.js +0 -740
  139. package/bundle/node_modules/undici/lib/web/websocket/connection.js +0 -325
  140. package/bundle/node_modules/undici/lib/web/websocket/constants.js +0 -126
  141. package/bundle/node_modules/undici/lib/web/websocket/events.js +0 -331
  142. package/bundle/node_modules/undici/lib/web/websocket/frame.js +0 -138
  143. package/bundle/node_modules/undici/lib/web/websocket/permessage-deflate.js +0 -70
  144. package/bundle/node_modules/undici/lib/web/websocket/receiver.js +0 -454
  145. package/bundle/node_modules/undici/lib/web/websocket/sender.js +0 -109
  146. package/bundle/node_modules/undici/lib/web/websocket/stream/websocketerror.js +0 -83
  147. package/bundle/node_modules/undici/lib/web/websocket/stream/websocketstream.js +0 -485
  148. package/bundle/node_modules/undici/lib/web/websocket/util.js +0 -338
  149. package/bundle/node_modules/undici/lib/web/websocket/websocket.js +0 -686
  150. package/bundle/node_modules/undici/package.json +0 -149
  151. package/bundle/node_modules/undici/scripts/strip-comments.js +0 -10
  152. package/bundle/node_modules/undici/types/README.md +0 -6
  153. package/bundle/node_modules/undici/types/agent.d.ts +0 -35
  154. package/bundle/node_modules/undici/types/api.d.ts +0 -43
  155. package/bundle/node_modules/undici/types/balanced-pool.d.ts +0 -29
  156. package/bundle/node_modules/undici/types/cache-interceptor.d.ts +0 -172
  157. package/bundle/node_modules/undici/types/cache.d.ts +0 -36
  158. package/bundle/node_modules/undici/types/client-stats.d.ts +0 -15
  159. package/bundle/node_modules/undici/types/client.d.ts +0 -110
  160. package/bundle/node_modules/undici/types/connector.d.ts +0 -34
  161. package/bundle/node_modules/undici/types/content-type.d.ts +0 -21
  162. package/bundle/node_modules/undici/types/cookies.d.ts +0 -30
  163. package/bundle/node_modules/undici/types/diagnostics-channel.d.ts +0 -66
  164. package/bundle/node_modules/undici/types/dispatcher.d.ts +0 -281
  165. package/bundle/node_modules/undici/types/env-http-proxy-agent.d.ts +0 -21
  166. package/bundle/node_modules/undici/types/errors.d.ts +0 -171
  167. package/bundle/node_modules/undici/types/eventsource.d.ts +0 -61
  168. package/bundle/node_modules/undici/types/fetch.d.ts +0 -210
  169. package/bundle/node_modules/undici/types/formdata.d.ts +0 -108
  170. package/bundle/node_modules/undici/types/global-dispatcher.d.ts +0 -9
  171. package/bundle/node_modules/undici/types/global-origin.d.ts +0 -7
  172. package/bundle/node_modules/undici/types/h2c-client.d.ts +0 -75
  173. package/bundle/node_modules/undici/types/handlers.d.ts +0 -15
  174. package/bundle/node_modules/undici/types/header.d.ts +0 -160
  175. package/bundle/node_modules/undici/types/index.d.ts +0 -75
  176. package/bundle/node_modules/undici/types/interceptors.d.ts +0 -34
  177. package/bundle/node_modules/undici/types/mock-agent.d.ts +0 -68
  178. package/bundle/node_modules/undici/types/mock-call-history.d.ts +0 -111
  179. package/bundle/node_modules/undici/types/mock-client.d.ts +0 -25
  180. package/bundle/node_modules/undici/types/mock-errors.d.ts +0 -12
  181. package/bundle/node_modules/undici/types/mock-interceptor.d.ts +0 -93
  182. package/bundle/node_modules/undici/types/mock-pool.d.ts +0 -25
  183. package/bundle/node_modules/undici/types/patch.d.ts +0 -29
  184. package/bundle/node_modules/undici/types/pool-stats.d.ts +0 -19
  185. package/bundle/node_modules/undici/types/pool.d.ts +0 -41
  186. package/bundle/node_modules/undici/types/proxy-agent.d.ts +0 -29
  187. package/bundle/node_modules/undici/types/readable.d.ts +0 -68
  188. package/bundle/node_modules/undici/types/retry-agent.d.ts +0 -8
  189. package/bundle/node_modules/undici/types/retry-handler.d.ts +0 -116
  190. package/bundle/node_modules/undici/types/util.d.ts +0 -18
  191. package/bundle/node_modules/undici/types/utility.d.ts +0 -7
  192. package/bundle/node_modules/undici/types/webidl.d.ts +0 -266
  193. package/bundle/node_modules/undici/types/websocket.d.ts +0 -184
@@ -1,34 +0,0 @@
1
- import CacheHandler from './cache-interceptor'
2
- import Dispatcher from './dispatcher'
3
- import RetryHandler from './retry-handler'
4
- import { LookupOptions } from 'node:dns'
5
-
6
- export default Interceptors
7
-
8
- declare namespace Interceptors {
9
- export type DumpInterceptorOpts = { maxSize?: number }
10
- export type RetryInterceptorOpts = RetryHandler.RetryOptions
11
- export type RedirectInterceptorOpts = { maxRedirections?: number }
12
-
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
- }
27
-
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
34
- }
@@ -1,68 +0,0 @@
1
- import Agent from './agent'
2
- import Dispatcher from './dispatcher'
3
- import { Interceptable, MockInterceptor } from './mock-interceptor'
4
- import MockDispatch = MockInterceptor.MockDispatch
5
- import { MockCallHistory } from './mock-call-history'
6
-
7
- export default MockAgent
8
-
9
- interface PendingInterceptor extends MockDispatch {
10
- origin: string;
11
- }
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. */
14
- declare class MockAgent<TMockAgentOptions extends MockAgent.Options = MockAgent.Options> extends Dispatcher {
15
- constructor (options?: TMockAgentOptions)
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. */
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
20
- /** Dispatches a mocked request. */
21
- dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
22
- /** Closes the mock agent and waits for registered mock pools and clients to also close before resolving. */
23
- close (): Promise<void>
24
- /** Disables mocking in MockAgent. */
25
- deactivate (): void
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. */
27
- activate (): void
28
- /** 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
33
- /** 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?: {
45
- pendingInterceptorsFormatter?: PendingInterceptorsFormatter;
46
- }): void
47
- }
48
-
49
- interface PendingInterceptorsFormatter {
50
- format(pendingInterceptors: readonly PendingInterceptor[]): string;
51
- }
52
-
53
- declare namespace MockAgent {
54
- /** MockAgent options. */
55
- export interface Options extends Agent.Options {
56
- /** 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
67
- }
68
- }
@@ -1,111 +0,0 @@
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 }
@@ -1,25 +0,0 @@
1
- import Client from './client'
2
- import Dispatcher from './dispatcher'
3
- import MockAgent from './mock-agent'
4
- import { MockInterceptor, Interceptable } from './mock-interceptor'
5
-
6
- export default MockClient
7
-
8
- /** MockClient extends the Client API and allows one to mock requests. */
9
- declare class MockClient extends Client implements Interceptable {
10
- constructor (origin: string, options: MockClient.Options)
11
- /** Intercepts any matching requests that use the same origin as this mock client. */
12
- intercept (options: MockInterceptor.Options): MockInterceptor
13
- /** Dispatches a mocked request. */
14
- dispatch (options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandler): boolean
15
- /** Closes the mock client and gracefully waits for enqueued requests to complete. */
16
- close (): Promise<void>
17
- }
18
-
19
- declare namespace MockClient {
20
- /** MockClient options. */
21
- export interface Options extends Client.Options {
22
- /** The agent to associate this MockClient with. */
23
- agent: MockAgent;
24
- }
25
- }
@@ -1,12 +0,0 @@
1
- import Errors from './errors'
2
-
3
- export default MockErrors
4
-
5
- declare namespace MockErrors {
6
- /** The request does not match any registered mock dispatches. */
7
- export class MockNotMatchedError extends Errors.UndiciError {
8
- constructor (message?: string)
9
- name: 'MockNotMatchedError'
10
- code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED'
11
- }
12
- }
@@ -1,93 +0,0 @@
1
- import { IncomingHttpHeaders } from './header'
2
- import Dispatcher from './dispatcher'
3
- import { BodyInit, Headers } from './fetch'
4
-
5
- /** The scope associated with a mock dispatch. */
6
- declare class MockScope<TData extends object = object> {
7
- constructor (mockDispatch: MockInterceptor.MockDispatch<TData>)
8
- /** Delay a reply by a set amount of time in ms. */
9
- delay (waitInMs: number): MockScope<TData>
10
- /** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
11
- persist (): MockScope<TData>
12
- /** Define a reply for a set amount of matching requests. */
13
- times (repeatTimes: number): MockScope<TData>
14
- }
15
-
16
- /** The interceptor for a Mock. */
17
- declare class MockInterceptor {
18
- constructor (options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[])
19
- /** Mock an undici request with the defined reply. */
20
- reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>
21
- reply<TData extends object = object>(
22
- statusCode: number,
23
- data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>,
24
- responseOptions?: MockInterceptor.MockResponseOptions
25
- ): MockScope<TData>
26
- /** Mock an undici request by throwing the defined reply error. */
27
- replyWithError<TError extends Error = Error>(error: TError): MockScope
28
- /** Set default reply headers on the interceptor for subsequent mocked replies. */
29
- defaultReplyHeaders (headers: IncomingHttpHeaders): MockInterceptor
30
- /** Set default reply trailers on the interceptor for subsequent mocked replies. */
31
- defaultReplyTrailers (trailers: Record<string, string>): MockInterceptor
32
- /** Set automatically calculated content-length header on subsequent mocked replies. */
33
- replyContentLength (): MockInterceptor
34
- }
35
-
36
- declare namespace MockInterceptor {
37
- /** MockInterceptor options. */
38
- export interface Options {
39
- /** Path to intercept on. */
40
- path: string | RegExp | ((path: string) => boolean);
41
- /** Method to intercept on. Defaults to GET. */
42
- method?: string | RegExp | ((method: string) => boolean);
43
- /** Body to intercept on. */
44
- body?: string | RegExp | ((body: string) => boolean);
45
- /** Headers to intercept on. */
46
- headers?: Record<string, string | RegExp | ((body: string) => boolean)> | ((headers: Record<string, string>) => boolean);
47
- /** Query params to intercept on */
48
- query?: Record<string, any>;
49
- }
50
- export interface MockDispatch<TData extends object = object, TError extends Error = Error> extends Options {
51
- times: number | null;
52
- persist: boolean;
53
- consumed: boolean;
54
- data: MockDispatchData<TData, TError>;
55
- }
56
- export interface MockDispatchData<TData extends object = object, TError extends Error = Error> extends MockResponseOptions {
57
- error: TError | null;
58
- statusCode?: number;
59
- data?: TData | string;
60
- }
61
- export interface MockResponseOptions {
62
- headers?: IncomingHttpHeaders;
63
- trailers?: Record<string, string>;
64
- }
65
-
66
- export interface MockResponseCallbackOptions {
67
- path: string;
68
- method: string;
69
- headers?: Headers | Record<string, string>;
70
- origin?: string;
71
- body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
72
- maxRedirections?: number;
73
- }
74
-
75
- export type MockResponseDataHandler<TData extends object = object> = (
76
- opts: MockResponseCallbackOptions
77
- ) => TData | Buffer | string
78
-
79
- export type MockReplyOptionsCallback<TData extends object = object> = (
80
- opts: MockResponseCallbackOptions
81
- ) => { statusCode: number, data?: TData | Buffer | string, responseOptions?: MockResponseOptions }
82
- }
83
-
84
- interface Interceptable extends Dispatcher {
85
- /** Intercepts any matching requests that use the same origin as this mock client. */
86
- intercept(options: MockInterceptor.Options): MockInterceptor;
87
- }
88
-
89
- export {
90
- Interceptable,
91
- MockInterceptor,
92
- MockScope
93
- }
@@ -1,25 +0,0 @@
1
- import Pool from './pool'
2
- import MockAgent from './mock-agent'
3
- import { Interceptable, MockInterceptor } from './mock-interceptor'
4
- import Dispatcher from './dispatcher'
5
-
6
- export default MockPool
7
-
8
- /** MockPool extends the Pool API and allows one to mock requests. */
9
- declare class MockPool extends Pool implements Interceptable {
10
- constructor (origin: string, options: MockPool.Options)
11
- /** Intercepts any matching requests that use the same origin as this mock pool. */
12
- intercept (options: MockInterceptor.Options): MockInterceptor
13
- /** Dispatches a mocked request. */
14
- dispatch (options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandler): boolean
15
- /** Closes the mock pool and gracefully waits for enqueued requests to complete. */
16
- close (): Promise<void>
17
- }
18
-
19
- declare namespace MockPool {
20
- /** MockPool options. */
21
- export interface Options extends Pool.Options {
22
- /** The agent to associate this MockPool with. */
23
- agent: MockAgent;
24
- }
25
- }
@@ -1,29 +0,0 @@
1
- /// <reference types="node" />
2
-
3
- // See https://github.com/nodejs/undici/issues/1740
4
-
5
- export interface EventInit {
6
- bubbles?: boolean
7
- cancelable?: boolean
8
- composed?: boolean
9
- }
10
-
11
- export interface EventListenerOptions {
12
- capture?: boolean
13
- }
14
-
15
- export interface AddEventListenerOptions extends EventListenerOptions {
16
- once?: boolean
17
- passive?: boolean
18
- signal?: AbortSignal
19
- }
20
-
21
- export type EventListenerOrEventListenerObject = EventListener | EventListenerObject
22
-
23
- export interface EventListenerObject {
24
- handleEvent (object: Event): void
25
- }
26
-
27
- export interface EventListener {
28
- (evt: Event): void
29
- }
@@ -1,19 +0,0 @@
1
- import Pool from './pool'
2
-
3
- export default PoolStats
4
-
5
- declare class PoolStats {
6
- constructor (pool: Pool)
7
- /** Number of open socket connections in this pool. */
8
- connected: number
9
- /** Number of open socket connections in this pool that do not have an active request. */
10
- free: number
11
- /** Number of pending requests across all clients in this pool. */
12
- pending: number
13
- /** Number of queued requests across all clients in this pool. */
14
- queued: number
15
- /** Number of currently active requests across all clients in this pool. */
16
- running: number
17
- /** Number of active, pending, or queued requests across all clients in this pool. */
18
- size: number
19
- }
@@ -1,41 +0,0 @@
1
- import Client from './client'
2
- import TPoolStats from './pool-stats'
3
- import { URL } from 'url'
4
- import Dispatcher from './dispatcher'
5
-
6
- export default Pool
7
-
8
- type PoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
9
-
10
- declare class Pool extends Dispatcher {
11
- constructor (url: string | URL, options?: Pool.Options)
12
- /** `true` after `pool.close()` has been called. */
13
- closed: boolean
14
- /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
15
- destroyed: boolean
16
- /** Aggregate stats for a Pool. */
17
- readonly stats: TPoolStats
18
-
19
- // Override dispatcher APIs.
20
- override connect (
21
- options: PoolConnectOptions
22
- ): Promise<Dispatcher.ConnectData>
23
- override connect (
24
- options: PoolConnectOptions,
25
- callback: (err: Error | null, data: Dispatcher.ConnectData) => void
26
- ): void
27
- }
28
-
29
- declare namespace Pool {
30
- export type PoolStats = TPoolStats
31
- export interface Options extends Client.Options {
32
- /** Default: `(origin, opts) => new Client(origin, opts)`. */
33
- factory?(origin: URL, opts: object): Dispatcher;
34
- /** The max number of clients to create. `null` if no limit. Default `null`. */
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
-
39
- interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options['interceptors']
40
- }
41
- }
@@ -1,29 +0,0 @@
1
- import Agent from './agent'
2
- import buildConnector from './connector'
3
- import Dispatcher from './dispatcher'
4
- import { IncomingHttpHeaders } from './header'
5
-
6
- export default ProxyAgent
7
-
8
- declare class ProxyAgent extends Dispatcher {
9
- constructor (options: ProxyAgent.Options | string)
10
-
11
- dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
12
- close (): Promise<void>
13
- }
14
-
15
- declare namespace ProxyAgent {
16
- export interface Options extends Agent.Options {
17
- uri: string;
18
- /**
19
- * @deprecated use opts.token
20
- */
21
- auth?: string;
22
- token?: string;
23
- headers?: IncomingHttpHeaders;
24
- requestTls?: buildConnector.BuildOptions;
25
- proxyTls?: buildConnector.BuildOptions;
26
- clientFactory?(origin: URL, opts: object): Dispatcher;
27
- proxyTunnel?: boolean;
28
- }
29
- }
@@ -1,68 +0,0 @@
1
- import { Readable } from 'stream'
2
- import { Blob } from 'buffer'
3
-
4
- export default BodyReadable
5
-
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
- })
14
-
15
- /** Consumes and returns the body as a string
16
- * https://fetch.spec.whatwg.org/#dom-body-text
17
- */
18
- text (): Promise<string>
19
-
20
- /** Consumes and returns the body as a JavaScript Object
21
- * https://fetch.spec.whatwg.org/#dom-body-json
22
- */
23
- json (): Promise<unknown>
24
-
25
- /** Consumes and returns the body as a Blob
26
- * https://fetch.spec.whatwg.org/#dom-body-blob
27
- */
28
- blob (): Promise<Blob>
29
-
30
- /** Consumes and returns the body as an Uint8Array
31
- * https://fetch.spec.whatwg.org/#dom-body-bytes
32
- */
33
- bytes (): Promise<Uint8Array>
34
-
35
- /** Consumes and returns the body as an ArrayBuffer
36
- * https://fetch.spec.whatwg.org/#dom-body-arraybuffer
37
- */
38
- arrayBuffer (): Promise<ArrayBuffer>
39
-
40
- /** Not implemented
41
- *
42
- * https://fetch.spec.whatwg.org/#dom-body-formdata
43
- */
44
- formData (): Promise<never>
45
-
46
- /** Returns true if the body is not null and the body has been consumed
47
- *
48
- * Otherwise, returns false
49
- *
50
- * https://fetch.spec.whatwg.org/#dom-body-bodyused
51
- */
52
- readonly bodyUsed: boolean
53
-
54
- /**
55
- * If body is null, it should return null as the body
56
- *
57
- * If body is not null, should return the body as a ReadableStream
58
- *
59
- * https://fetch.spec.whatwg.org/#dom-body-body
60
- */
61
- readonly body: never | undefined
62
-
63
- /** 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)
66
- */
67
- dump (opts?: { limit: number; signal?: AbortSignal }): Promise<void>
68
- }
@@ -1,8 +0,0 @@
1
- import Dispatcher from './dispatcher'
2
- import RetryHandler from './retry-handler'
3
-
4
- export default RetryAgent
5
-
6
- declare class RetryAgent extends Dispatcher {
7
- constructor (dispatcher: Dispatcher, options?: RetryHandler.RetryOptions)
8
- }