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,83 +0,0 @@
1
- # Agent
2
-
3
- Extends: `undici.Dispatcher`
4
-
5
- Agent allows dispatching requests against multiple different origins.
6
-
7
- Requests are not guaranteed to be dispatched in order of invocation.
8
-
9
- ## `new undici.Agent([options])`
10
-
11
- Arguments:
12
-
13
- * **options** `AgentOptions` (optional)
14
-
15
- Returns: `Agent`
16
-
17
- ### Parameter: `AgentOptions`
18
-
19
- Extends: [`PoolOptions`](/docs/docs/api/Pool.md#parameter-pooloptions)
20
-
21
- * **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Pool(origin, opts)`
22
-
23
- ## Instance Properties
24
-
25
- ### `Agent.closed`
26
-
27
- Implements [Client.closed](/docs/docs/api/Client.md#clientclosed)
28
-
29
- ### `Agent.destroyed`
30
-
31
- Implements [Client.destroyed](/docs/docs/api/Client.md#clientdestroyed)
32
-
33
- ## Instance Methods
34
-
35
- ### `Agent.close([callback])`
36
-
37
- Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise).
38
-
39
- ### `Agent.destroy([error, callback])`
40
-
41
- Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise).
42
-
43
- ### `Agent.dispatch(options, handler: AgentDispatchOptions)`
44
-
45
- Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
46
-
47
- #### Parameter: `AgentDispatchOptions`
48
-
49
- Extends: [`DispatchOptions`](/docs/docs/api/Dispatcher.md#parameter-dispatchoptions)
50
-
51
- * **origin** `string | URL`
52
-
53
- Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise).
54
-
55
- ### `Agent.connect(options[, callback])`
56
-
57
- See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback).
58
-
59
- ### `Agent.dispatch(options, handler)`
60
-
61
- Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
62
-
63
- ### `Agent.pipeline(options, handler)`
64
-
65
- See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler).
66
-
67
- ### `Agent.request(options[, callback])`
68
-
69
- See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback).
70
-
71
- ### `Agent.stream(options, factory[, callback])`
72
-
73
- See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback).
74
-
75
- ### `Agent.upgrade(options[, callback])`
76
-
77
- See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback).
78
-
79
- ### `Agent.stats()`
80
-
81
- Returns an object of stats by origin in the format of `Record<string, TClientStats | TPoolStats>`
82
-
83
- See [`PoolStats`](/docs/docs/api/PoolStats.md) and [`ClientStats`](/docs/docs/api/ClientStats.md).
@@ -1,99 +0,0 @@
1
- # Class: BalancedPool
2
-
3
- Extends: `undici.Dispatcher`
4
-
5
- A pool of [Pool](/docs/docs/api/Pool.md) instances connected to multiple upstreams.
6
-
7
- Requests are not guaranteed to be dispatched in order of invocation.
8
-
9
- ## `new BalancedPool(upstreams [, options])`
10
-
11
- Arguments:
12
-
13
- * **upstreams** `URL | string | string[]` - It should only include the **protocol, hostname, and port**.
14
- * **options** `BalancedPoolOptions` (optional)
15
-
16
- ### Parameter: `BalancedPoolOptions`
17
-
18
- Extends: [`PoolOptions`](/docs/docs/api/Pool.md#parameter-pooloptions)
19
-
20
- * **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Pool(origin, opts)`
21
-
22
- The `PoolOptions` are passed to each of the `Pool` instances being created.
23
- ## Instance Properties
24
-
25
- ### `BalancedPool.upstreams`
26
-
27
- Returns an array of upstreams that were previously added.
28
-
29
- ### `BalancedPool.closed`
30
-
31
- Implements [Client.closed](/docs/docs/api/Client.md#clientclosed)
32
-
33
- ### `BalancedPool.destroyed`
34
-
35
- Implements [Client.destroyed](/docs/docs/api/Client.md#clientdestroyed)
36
-
37
- ### `Pool.stats`
38
-
39
- Returns [`PoolStats`](/docs/docs/api/PoolStats.md) instance for this pool.
40
-
41
- ## Instance Methods
42
-
43
- ### `BalancedPool.addUpstream(upstream)`
44
-
45
- Add an upstream.
46
-
47
- Arguments:
48
-
49
- * **upstream** `string` - It should only include the **protocol, hostname, and port**.
50
-
51
- ### `BalancedPool.removeUpstream(upstream)`
52
-
53
- Removes an upstream that was previously added.
54
-
55
- ### `BalancedPool.close([callback])`
56
-
57
- Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise).
58
-
59
- ### `BalancedPool.destroy([error, callback])`
60
-
61
- Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise).
62
-
63
- ### `BalancedPool.connect(options[, callback])`
64
-
65
- See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback).
66
-
67
- ### `BalancedPool.dispatch(options, handlers)`
68
-
69
- Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
70
-
71
- ### `BalancedPool.pipeline(options, handler)`
72
-
73
- See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler).
74
-
75
- ### `BalancedPool.request(options[, callback])`
76
-
77
- See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback).
78
-
79
- ### `BalancedPool.stream(options, factory[, callback])`
80
-
81
- See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback).
82
-
83
- ### `BalancedPool.upgrade(options[, callback])`
84
-
85
- See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback).
86
-
87
- ## Instance Events
88
-
89
- ### Event: `'connect'`
90
-
91
- See [Dispatcher Event: `'connect'`](/docs/docs/api/Dispatcher.md#event-connect).
92
-
93
- ### Event: `'disconnect'`
94
-
95
- See [Dispatcher Event: `'disconnect'`](/docs/docs/api/Dispatcher.md#event-disconnect).
96
-
97
- ### Event: `'drain'`
98
-
99
- See [Dispatcher Event: `'drain'`](/docs/docs/api/Dispatcher.md#event-drain).
@@ -1,30 +0,0 @@
1
- # CacheStorage
2
-
3
- Undici exposes a W3C spec-compliant implementation of [CacheStorage](https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage) and [Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache).
4
-
5
- ## Opening a Cache
6
-
7
- Undici exports a top-level CacheStorage instance. You can open a new Cache, or duplicate a Cache with an existing name, by using `CacheStorage.prototype.open`. If you open a Cache with the same name as an already-existing Cache, its list of cached Responses will be shared between both instances.
8
-
9
- ```mjs
10
- import { caches } from 'undici'
11
-
12
- const cache_1 = await caches.open('v1')
13
- const cache_2 = await caches.open('v1')
14
-
15
- // Although .open() creates a new instance,
16
- assert(cache_1 !== cache_2)
17
- // The same Response is matched in both.
18
- assert.deepStrictEqual(await cache_1.match('/req'), await cache_2.match('/req'))
19
- ```
20
-
21
- ## Deleting a Cache
22
-
23
- If a Cache is deleted, the cached Responses/Requests can still be used.
24
-
25
- ```mjs
26
- const response = await cache_1.match('/req')
27
- await caches.delete('v1')
28
-
29
- await response.text() // the Response's body
30
- ```
@@ -1,151 +0,0 @@
1
- # Cache Store
2
-
3
- A Cache Store is responsible for storing and retrieving cached responses.
4
- It is also responsible for deciding which specific response to use based off of
5
- a response's `Vary` header (if present). It is expected to be compliant with
6
- [RFC-9111](https://www.rfc-editor.org/rfc/rfc9111.html).
7
-
8
- ## Pre-built Cache Stores
9
-
10
- ### `MemoryCacheStore`
11
-
12
- The `MemoryCacheStore` stores the responses in-memory.
13
-
14
- **Options**
15
-
16
- - `maxSize` - The maximum total size in bytes of all stored responses. Default `Infinity`.
17
- - `maxCount` - The maximum amount of responses to store. Default `Infinity`.
18
- - `maxEntrySize` - The maximum size in bytes that a response's body can be. If a response's body is greater than or equal to this, the response will not be cached. Default `Infinity`.
19
-
20
- ### Getters
21
-
22
- #### `MemoryCacheStore.size`
23
-
24
- Returns the current total size in bytes of all stored responses.
25
-
26
- ### Methods
27
-
28
- #### `MemoryCacheStore.isFull()`
29
-
30
- Returns a boolean indicating whether the cache has reached its maximum size or count.
31
-
32
- ### Events
33
-
34
- #### `'maxSizeExceeded'`
35
-
36
- Emitted when the cache exceeds its maximum size or count limits. The event payload contains `size`, `maxSize`, `count`, and `maxCount` properties.
37
-
38
-
39
- ### `SqliteCacheStore`
40
-
41
- The `SqliteCacheStore` stores the responses in a SQLite database.
42
- Under the hood, it uses Node.js' [`node:sqlite`](https://nodejs.org/api/sqlite.html) api.
43
- The `SqliteCacheStore` is only exposed if the `node:sqlite` api is present.
44
-
45
- **Options**
46
-
47
- - `location` - The location of the SQLite database to use. Default `:memory:`.
48
- - `maxCount` - The maximum number of entries to store in the database. Default `Infinity`.
49
- - `maxEntrySize` - The maximum size in bytes that a response's body can be. If a response's body is greater than or equal to this, the response will not be cached. Default `Infinity`.
50
-
51
- ## Defining a Custom Cache Store
52
-
53
- The store must implement the following functions:
54
-
55
- ### Getter: `isFull`
56
-
57
- Optional. This tells the cache interceptor if the store is full or not. If this is true,
58
- the cache interceptor will not attempt to cache the response.
59
-
60
- ### Function: `get`
61
-
62
- Parameters:
63
-
64
- * **req** `Dispatcher.RequestOptions` - Incoming request
65
-
66
- Returns: `GetResult | Promise<GetResult | undefined> | undefined` - If the request is cached, the cached response is returned. If the request's method is anything other than HEAD, the response is also returned.
67
- If the request isn't cached, `undefined` is returned.
68
-
69
- Response properties:
70
-
71
- * **response** `CacheValue` - The cached response data.
72
- * **body** `Readable | undefined` - The response's body.
73
-
74
- ### Function: `createWriteStream`
75
-
76
- Parameters:
77
-
78
- * **req** `Dispatcher.RequestOptions` - Incoming request
79
- * **value** `CacheValue` - Response to store
80
-
81
- Returns: `Writable | undefined` - If the store is full, return `undefined`. Otherwise, return a writable so that the cache interceptor can stream the body and trailers to the store.
82
-
83
- ## `CacheValue`
84
-
85
- This is an interface containing the majority of a response's data (minus the body).
86
-
87
- ### Property `statusCode`
88
-
89
- `number` - The response's HTTP status code.
90
-
91
- ### Property `statusMessage`
92
-
93
- `string` - The response's HTTP status message.
94
-
95
- ### Property `rawHeaders`
96
-
97
- `Buffer[]` - The response's headers.
98
-
99
- ### Property `vary`
100
-
101
- `Record<string, string | string[]> | undefined` - The headers defined by the response's `Vary` header
102
- and their respective values for later comparison
103
-
104
- For example, for a response like
105
- ```
106
- Vary: content-encoding, accepts
107
- content-encoding: utf8
108
- accepts: application/json
109
- ```
110
-
111
- This would be
112
- ```js
113
- {
114
- 'content-encoding': 'utf8',
115
- accepts: 'application/json'
116
- }
117
- ```
118
-
119
- ### Property `cachedAt`
120
-
121
- `number` - Time in millis that this value was cached.
122
-
123
- ### Property `staleAt`
124
-
125
- `number` - Time in millis that this value is considered stale.
126
-
127
- ### Property `deleteAt`
128
-
129
- `number` - Time in millis that this value is to be deleted from the cache. This
130
- is either the same sa staleAt or the `max-stale` caching directive.
131
-
132
- The store must not return a response after the time defined in this property.
133
-
134
- ## `CacheStoreReadable`
135
-
136
- This extends Node's [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable)
137
- and defines extra properties relevant to the cache interceptor.
138
-
139
- ### Getter: `value`
140
-
141
- The response's [`CacheStoreValue`](/docs/docs/api/CacheStore.md#cachestorevalue)
142
-
143
- ## `CacheStoreWriteable`
144
-
145
- This extends Node's [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable)
146
- and defines extra properties relevant to the cache interceptor.
147
-
148
- ### Setter: `rawTrailers`
149
-
150
- If the response has trailers, the cache interceptor will pass them to the cache
151
- interceptor through this method.
@@ -1,281 +0,0 @@
1
- # Class: Client
2
-
3
- Extends: `undici.Dispatcher`
4
-
5
- A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
6
-
7
- Requests are not guaranteed to be dispatched in order of invocation.
8
-
9
- ## `new Client(url[, options])`
10
-
11
- Arguments:
12
-
13
- * **url** `URL | string` - Should only include the **protocol, hostname, and port**.
14
- * **options** `ClientOptions` (optional)
15
-
16
- Returns: `Client`
17
-
18
- ### Parameter: `ClientOptions`
19
-
20
- * **bodyTimeout** `number | null` (optional) - Default: `300e3` - The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Defaults to 300 seconds. Please note the `timeout` will be reset if you keep writing data to the socket everytime.
21
- * **headersTimeout** `number | null` (optional) - Default: `300e3` - The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds.
22
- * **keepAliveMaxTimeout** `number | null` (optional) - Default: `600e3` - The maximum allowed `keepAliveTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Defaults to 10 minutes.
23
- * **keepAliveTimeout** `number | null` (optional) - Default: `4e3` - The timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. See [MDN: HTTP - Headers - Keep-Alive directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive#directives) for more details. Defaults to 4 seconds.
24
- * **keepAliveTimeoutThreshold** `number | null` (optional) - Default: `2e3` - A number of milliseconds subtracted from server *keep-alive* hints when overriding `keepAliveTimeout` to account for timing inaccuracies caused by e.g. transport latency. Defaults to 2 seconds.
25
- * **maxHeaderSize** `number | null` (optional) - Default: `--max-http-header-size` or `16384` - The maximum length of request headers in bytes. Defaults to Node.js' --max-http-header-size or 16KiB.
26
- * **maxResponseSize** `number | null` (optional) - Default: `-1` - The maximum length of response body in bytes. Set to `-1` to disable.
27
- * **pipelining** `number | null` (optional) - Default: `1` - The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Carefully consider your workload and environment before enabling concurrent requests as pipelining may reduce performance if used incorrectly. Pipelining is sensitive to network stack settings as well as head of line blocking caused by e.g. long running requests. Set to `0` to disable keep-alive connections.
28
- * **connect** `ConnectOptions | Function | null` (optional) - Default: `null`.
29
- * **strictContentLength** `Boolean` (optional) - Default: `true` - Whether to treat request content length mismatches as errors. If true, an error is thrown when the request content-length header doesn't match the length of the request body.
30
- * **autoSelectFamily**: `boolean` (optional) - Default: depends on local Node version, on Node 18.13.0 and above is `false`. Enables a family autodetection algorithm that loosely implements section 5 of [RFC 8305](https://tools.ietf.org/html/rfc8305#section-5). See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details. This option is ignored if not supported by the current Node version.
31
- * **autoSelectFamilyAttemptTimeout**: `number` - Default: depends on local Node version, on Node 18.13.0 and above is `250`. The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details.
32
- * **allowH2**: `boolean` - Default: `false`. Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
33
- * **maxConcurrentStreams**: `number` - Default: `100`. Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
34
-
35
- > **Notes about HTTP/2**
36
- > - It only works under TLS connections. h2c is not supported.
37
- > - The server must support HTTP/2 and choose it as the protocol during the ALPN negotiation.
38
- > - The server must not have a bigger priority for HTTP/1.1 than HTTP/2.
39
- > - Pseudo headers are automatically attached to the request. If you try to set them, they will be overwritten.
40
- > - The `:path` header is automatically set to the request path.
41
- > - The `:method` header is automatically set to the request method.
42
- > - The `:scheme` header is automatically set to the request scheme.
43
- > - The `:authority` header is automatically set to the request `host[:port]`.
44
- > - `PUSH` frames are yet not supported.
45
-
46
- #### Parameter: `ConnectOptions`
47
-
48
- Every Tls option, see [here](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).
49
- Furthermore, the following options can be passed:
50
-
51
- * **socketPath** `string | null` (optional) - Default: `null` - An IPC endpoint, either Unix domain socket or Windows named pipe.
52
- * **maxCachedSessions** `number | null` (optional) - Default: `100` - Maximum number of TLS cached sessions. Use 0 to disable TLS session caching. Default: 100.
53
- * **timeout** `number | null` (optional) - In milliseconds, Default `10e3`.
54
- * **servername** `string | null` (optional)
55
- * **keepAlive** `boolean | null` (optional) - Default: `true` - TCP keep-alive enabled
56
- * **keepAliveInitialDelay** `number | null` (optional) - Default: `60000` - TCP keep-alive interval for the socket in milliseconds
57
-
58
- ### Example - Basic Client instantiation
59
-
60
- This will instantiate the undici Client, but it will not connect to the origin until something is queued. Consider using `client.connect` to prematurely connect to the origin, or just call `client.request`.
61
-
62
- ```js
63
- 'use strict'
64
- import { Client } from 'undici'
65
-
66
- const client = new Client('http://localhost:3000')
67
- ```
68
-
69
- ### Example - Custom connector
70
-
71
- This will allow you to perform some additional check on the socket that will be used for the next request.
72
-
73
- ```js
74
- 'use strict'
75
- import { Client, buildConnector } from 'undici'
76
-
77
- const connector = buildConnector({ rejectUnauthorized: false })
78
- const client = new Client('https://localhost:3000', {
79
- connect (opts, cb) {
80
- connector(opts, (err, socket) => {
81
- if (err) {
82
- cb(err)
83
- } else if (/* assertion */) {
84
- socket.destroy()
85
- cb(new Error('kaboom'))
86
- } else {
87
- cb(null, socket)
88
- }
89
- })
90
- }
91
- })
92
- ```
93
-
94
- ## Instance Methods
95
-
96
- ### `Client.close([callback])`
97
-
98
- Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise).
99
-
100
- ### `Client.destroy([error, callback])`
101
-
102
- Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise).
103
-
104
- Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided).
105
-
106
- ### `Client.connect(options[, callback])`
107
-
108
- See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback).
109
-
110
- ### `Client.dispatch(options, handlers)`
111
-
112
- Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
113
-
114
- ### `Client.pipeline(options, handler)`
115
-
116
- See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler).
117
-
118
- ### `Client.request(options[, callback])`
119
-
120
- See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback).
121
-
122
- ### `Client.stream(options, factory[, callback])`
123
-
124
- See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback).
125
-
126
- ### `Client.upgrade(options[, callback])`
127
-
128
- See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback).
129
-
130
- ## Instance Properties
131
-
132
- ### `Client.closed`
133
-
134
- * `boolean`
135
-
136
- `true` after `client.close()` has been called.
137
-
138
- ### `Client.destroyed`
139
-
140
- * `boolean`
141
-
142
- `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed.
143
-
144
- ### `Client.pipelining`
145
-
146
- * `number`
147
-
148
- Property to get and set the pipelining factor.
149
-
150
- ## Instance Events
151
-
152
- ### Event: `'connect'`
153
-
154
- See [Dispatcher Event: `'connect'`](/docs/docs/api/Dispatcher.md#event-connect).
155
-
156
- Parameters:
157
-
158
- * **origin** `URL`
159
- * **targets** `Array<Dispatcher>`
160
-
161
- Emitted when a socket has been created and connected. The client will connect once `client.size > 0`.
162
-
163
- #### Example - Client connect event
164
-
165
- ```js
166
- import { createServer } from 'http'
167
- import { Client } from 'undici'
168
- import { once } from 'events'
169
-
170
- const server = createServer((request, response) => {
171
- response.end('Hello, World!')
172
- }).listen()
173
-
174
- await once(server, 'listening')
175
-
176
- const client = new Client(`http://localhost:${server.address().port}`)
177
-
178
- client.on('connect', (origin) => {
179
- console.log(`Connected to ${origin}`) // should print before the request body statement
180
- })
181
-
182
- try {
183
- const { body } = await client.request({
184
- path: '/',
185
- method: 'GET'
186
- })
187
- body.setEncoding('utf-8')
188
- body.on('data', console.log)
189
- client.close()
190
- server.close()
191
- } catch (error) {
192
- console.error(error)
193
- client.close()
194
- server.close()
195
- }
196
- ```
197
-
198
- ### Event: `'disconnect'`
199
-
200
- See [Dispatcher Event: `'disconnect'`](/docs/docs/api/Dispatcher.md#event-disconnect).
201
-
202
- Parameters:
203
-
204
- * **origin** `URL`
205
- * **targets** `Array<Dispatcher>`
206
- * **error** `Error`
207
-
208
- Emitted when socket has disconnected. The error argument of the event is the error which caused the socket to disconnect. The client will reconnect if or once `client.size > 0`.
209
-
210
- #### Example - Client disconnect event
211
-
212
- ```js
213
- import { createServer } from 'http'
214
- import { Client } from 'undici'
215
- import { once } from 'events'
216
-
217
- const server = createServer((request, response) => {
218
- response.destroy()
219
- }).listen()
220
-
221
- await once(server, 'listening')
222
-
223
- const client = new Client(`http://localhost:${server.address().port}`)
224
-
225
- client.on('disconnect', (origin) => {
226
- console.log(`Disconnected from ${origin}`)
227
- })
228
-
229
- try {
230
- await client.request({
231
- path: '/',
232
- method: 'GET'
233
- })
234
- } catch (error) {
235
- console.error(error.message)
236
- client.close()
237
- server.close()
238
- }
239
- ```
240
-
241
- ### Event: `'drain'`
242
-
243
- Emitted when pipeline is no longer busy.
244
-
245
- See [Dispatcher Event: `'drain'`](/docs/docs/api/Dispatcher.md#event-drain).
246
-
247
- #### Example - Client drain event
248
-
249
- ```js
250
- import { createServer } from 'http'
251
- import { Client } from 'undici'
252
- import { once } from 'events'
253
-
254
- const server = createServer((request, response) => {
255
- response.end('Hello, World!')
256
- }).listen()
257
-
258
- await once(server, 'listening')
259
-
260
- const client = new Client(`http://localhost:${server.address().port}`)
261
-
262
- client.on('drain', () => {
263
- console.log('drain event')
264
- client.close()
265
- server.close()
266
- })
267
-
268
- const requests = [
269
- client.request({ path: '/', method: 'GET' }),
270
- client.request({ path: '/', method: 'GET' }),
271
- client.request({ path: '/', method: 'GET' })
272
- ]
273
-
274
- await Promise.all(requests)
275
-
276
- console.log('requests completed')
277
- ```
278
-
279
- ### Event: `'error'`
280
-
281
- Invoked for users errors such as throwing in the `onError` handler.
@@ -1,27 +0,0 @@
1
- # Class: ClientStats
2
-
3
- Stats for a [Client](/docs/docs/api/Client.md).
4
-
5
- ## `new ClientStats(client)`
6
-
7
- Arguments:
8
-
9
- * **client** `Client` - Client from which to return stats.
10
-
11
- ## Instance Properties
12
-
13
- ### `ClientStats.connected`
14
-
15
- Boolean if socket as open connection by this client.
16
-
17
- ### `ClientStats.pending`
18
-
19
- Number of pending requests of this client.
20
-
21
- ### `ClientStats.running`
22
-
23
- Number of currently active requests across this client.
24
-
25
- ### `ClientStats.size`
26
-
27
- Number of active, pending, or queued requests of this clients.