@openclaw/twitch 2026.5.26 → 2026.5.27-beta.1

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 (145) hide show
  1. package/dist/api.js +1 -1
  2. package/dist/channel-plugin-api.js +1 -1
  3. package/dist/{monitor-OQV-HuXr.js → monitor-DtKWUPTM.js} +7 -15
  4. package/dist/{plugin-C_YMBt4q.js → plugin-n6agZBWc.js} +2 -2
  5. package/node_modules/@types/ws/node_modules/@types/node/LICENSE +21 -0
  6. package/node_modules/@types/ws/node_modules/@types/node/README.md +15 -0
  7. package/node_modules/@types/ws/node_modules/@types/node/assert/strict.d.ts +59 -0
  8. package/node_modules/@types/ws/node_modules/@types/node/assert.d.ts +950 -0
  9. package/node_modules/@types/ws/node_modules/@types/node/async_hooks.d.ts +711 -0
  10. package/node_modules/@types/ws/node_modules/@types/node/buffer.buffer.d.ts +466 -0
  11. package/node_modules/@types/ws/node_modules/@types/node/buffer.d.ts +1765 -0
  12. package/node_modules/@types/ws/node_modules/@types/node/child_process.d.ts +1366 -0
  13. package/node_modules/@types/ws/node_modules/@types/node/cluster.d.ts +432 -0
  14. package/node_modules/@types/ws/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  15. package/node_modules/@types/ws/node_modules/@types/node/console.d.ts +93 -0
  16. package/node_modules/@types/ws/node_modules/@types/node/constants.d.ts +14 -0
  17. package/node_modules/@types/ws/node_modules/@types/node/crypto.d.ts +4058 -0
  18. package/node_modules/@types/ws/node_modules/@types/node/dgram.d.ts +537 -0
  19. package/node_modules/@types/ws/node_modules/@types/node/diagnostics_channel.d.ts +552 -0
  20. package/node_modules/@types/ws/node_modules/@types/node/dns/promises.d.ts +497 -0
  21. package/node_modules/@types/ws/node_modules/@types/node/dns.d.ts +876 -0
  22. package/node_modules/@types/ws/node_modules/@types/node/domain.d.ts +150 -0
  23. package/node_modules/@types/ws/node_modules/@types/node/events.d.ts +1008 -0
  24. package/node_modules/@types/ws/node_modules/@types/node/fs/promises.d.ts +1468 -0
  25. package/node_modules/@types/ws/node_modules/@types/node/fs.d.ts +4780 -0
  26. package/node_modules/@types/ws/node_modules/@types/node/globals.d.ts +150 -0
  27. package/node_modules/@types/ws/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  28. package/node_modules/@types/ws/node_modules/@types/node/http.d.ts +2147 -0
  29. package/node_modules/@types/ws/node_modules/@types/node/http2.d.ts +2485 -0
  30. package/node_modules/@types/ws/node_modules/@types/node/https.d.ts +400 -0
  31. package/node_modules/@types/ws/node_modules/@types/node/index.d.ts +117 -0
  32. package/node_modules/@types/ws/node_modules/@types/node/inspector/promises.d.ts +35 -0
  33. package/node_modules/@types/ws/node_modules/@types/node/inspector.d.ts +264 -0
  34. package/node_modules/@types/ws/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  35. package/node_modules/@types/ws/node_modules/@types/node/module.d.ts +755 -0
  36. package/node_modules/@types/ws/node_modules/@types/node/net.d.ts +970 -0
  37. package/node_modules/@types/ws/node_modules/@types/node/os.d.ts +498 -0
  38. package/node_modules/@types/ws/node_modules/@types/node/package.json +155 -0
  39. package/node_modules/@types/ws/node_modules/@types/node/path/posix.d.ts +8 -0
  40. package/node_modules/@types/ws/node_modules/@types/node/path/win32.d.ts +8 -0
  41. package/node_modules/@types/ws/node_modules/@types/node/path.d.ts +178 -0
  42. package/node_modules/@types/ws/node_modules/@types/node/perf_hooks.d.ts +612 -0
  43. package/node_modules/@types/ws/node_modules/@types/node/process.d.ts +2204 -0
  44. package/node_modules/@types/ws/node_modules/@types/node/punycode.d.ts +89 -0
  45. package/node_modules/@types/ws/node_modules/@types/node/querystring.d.ts +139 -0
  46. package/node_modules/@types/ws/node_modules/@types/node/quic.d.ts +897 -0
  47. package/node_modules/@types/ws/node_modules/@types/node/readline/promises.d.ts +158 -0
  48. package/node_modules/@types/ws/node_modules/@types/node/readline.d.ts +507 -0
  49. package/node_modules/@types/ws/node_modules/@types/node/repl.d.ts +420 -0
  50. package/node_modules/@types/ws/node_modules/@types/node/sea.d.ts +47 -0
  51. package/node_modules/@types/ws/node_modules/@types/node/sqlite.d.ts +1068 -0
  52. package/node_modules/@types/ws/node_modules/@types/node/stream/consumers.d.ts +114 -0
  53. package/node_modules/@types/ws/node_modules/@types/node/stream/iter.d.ts +301 -0
  54. package/node_modules/@types/ws/node_modules/@types/node/stream/promises.d.ts +211 -0
  55. package/node_modules/@types/ws/node_modules/@types/node/stream/web.d.ts +300 -0
  56. package/node_modules/@types/ws/node_modules/@types/node/stream.d.ts +1774 -0
  57. package/node_modules/@types/ws/node_modules/@types/node/string_decoder.d.ts +27 -0
  58. package/node_modules/@types/ws/node_modules/@types/node/test/reporters.d.ts +59 -0
  59. package/node_modules/@types/ws/node_modules/@types/node/test.d.ts +2279 -0
  60. package/node_modules/@types/ws/node_modules/@types/node/timers/promises.d.ts +93 -0
  61. package/node_modules/@types/ws/node_modules/@types/node/timers.d.ts +149 -0
  62. package/node_modules/@types/ws/node_modules/@types/node/tls.d.ts +1193 -0
  63. package/node_modules/@types/ws/node_modules/@types/node/trace_events.d.ts +103 -0
  64. package/node_modules/@types/ws/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
  65. package/node_modules/@types/ws/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  66. package/node_modules/@types/ws/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  67. package/node_modules/@types/ws/node_modules/@types/node/ts5.6/index.d.ts +119 -0
  68. package/node_modules/@types/ws/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  69. package/node_modules/@types/ws/node_modules/@types/node/ts5.7/index.d.ts +119 -0
  70. package/node_modules/@types/ws/node_modules/@types/node/tty.d.ts +225 -0
  71. package/node_modules/@types/ws/node_modules/@types/node/url.d.ts +556 -0
  72. package/node_modules/@types/ws/node_modules/@types/node/util/types.d.ts +558 -0
  73. package/node_modules/@types/ws/node_modules/@types/node/util.d.ts +1677 -0
  74. package/node_modules/@types/ws/node_modules/@types/node/v8.d.ts +980 -0
  75. package/node_modules/@types/ws/node_modules/@types/node/vm.d.ts +1136 -0
  76. package/node_modules/@types/ws/node_modules/@types/node/wasi.d.ts +131 -0
  77. package/node_modules/@types/ws/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  78. package/node_modules/@types/ws/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  79. package/node_modules/@types/ws/node_modules/@types/node/web-globals/console.d.ts +9 -0
  80. package/node_modules/@types/ws/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  81. package/node_modules/@types/ws/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  82. package/node_modules/@types/ws/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  83. package/node_modules/@types/ws/node_modules/@types/node/web-globals/events.d.ts +106 -0
  84. package/node_modules/@types/ws/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  85. package/node_modules/@types/ws/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  86. package/node_modules/@types/ws/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  87. package/node_modules/@types/ws/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  88. package/node_modules/@types/ws/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  89. package/node_modules/@types/ws/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  90. package/node_modules/@types/ws/node_modules/@types/node/web-globals/streams.d.ts +115 -0
  91. package/node_modules/@types/ws/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  92. package/node_modules/@types/ws/node_modules/@types/node/web-globals/url.d.ts +24 -0
  93. package/node_modules/@types/ws/node_modules/@types/node/worker_threads.d.ts +671 -0
  94. package/node_modules/@types/ws/node_modules/@types/node/zlib/iter.d.ts +131 -0
  95. package/node_modules/@types/ws/node_modules/@types/node/zlib.d.ts +589 -0
  96. package/node_modules/@types/ws/node_modules/undici-types/LICENSE +21 -0
  97. package/node_modules/@types/ws/node_modules/undici-types/README.md +6 -0
  98. package/node_modules/@types/ws/node_modules/undici-types/agent.d.ts +32 -0
  99. package/node_modules/@types/ws/node_modules/undici-types/api.d.ts +43 -0
  100. package/node_modules/@types/ws/node_modules/undici-types/balanced-pool.d.ts +30 -0
  101. package/node_modules/@types/ws/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  102. package/node_modules/@types/ws/node_modules/undici-types/cache.d.ts +36 -0
  103. package/node_modules/@types/ws/node_modules/undici-types/client-stats.d.ts +15 -0
  104. package/node_modules/@types/ws/node_modules/undici-types/client.d.ts +123 -0
  105. package/node_modules/@types/ws/node_modules/undici-types/connector.d.ts +36 -0
  106. package/node_modules/@types/ws/node_modules/undici-types/content-type.d.ts +21 -0
  107. package/node_modules/@types/ws/node_modules/undici-types/cookies.d.ts +30 -0
  108. package/node_modules/@types/ws/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  109. package/node_modules/@types/ws/node_modules/undici-types/dispatcher.d.ts +279 -0
  110. package/node_modules/@types/ws/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  111. package/node_modules/@types/ws/node_modules/undici-types/errors.d.ts +177 -0
  112. package/node_modules/@types/ws/node_modules/undici-types/eventsource.d.ts +66 -0
  113. package/node_modules/@types/ws/node_modules/undici-types/fetch.d.ts +211 -0
  114. package/node_modules/@types/ws/node_modules/undici-types/formdata.d.ts +108 -0
  115. package/node_modules/@types/ws/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  116. package/node_modules/@types/ws/node_modules/undici-types/global-origin.d.ts +7 -0
  117. package/node_modules/@types/ws/node_modules/undici-types/h2c-client.d.ts +73 -0
  118. package/node_modules/@types/ws/node_modules/undici-types/handlers.d.ts +15 -0
  119. package/node_modules/@types/ws/node_modules/undici-types/header.d.ts +160 -0
  120. package/node_modules/@types/ws/node_modules/undici-types/index.d.ts +91 -0
  121. package/node_modules/@types/ws/node_modules/undici-types/interceptors.d.ts +80 -0
  122. package/node_modules/@types/ws/node_modules/undici-types/mock-agent.d.ts +68 -0
  123. package/node_modules/@types/ws/node_modules/undici-types/mock-call-history.d.ts +111 -0
  124. package/node_modules/@types/ws/node_modules/undici-types/mock-client.d.ts +27 -0
  125. package/node_modules/@types/ws/node_modules/undici-types/mock-errors.d.ts +12 -0
  126. package/node_modules/@types/ws/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  127. package/node_modules/@types/ws/node_modules/undici-types/mock-pool.d.ts +27 -0
  128. package/node_modules/@types/ws/node_modules/undici-types/package.json +55 -0
  129. package/node_modules/@types/ws/node_modules/undici-types/patch.d.ts +29 -0
  130. package/node_modules/@types/ws/node_modules/undici-types/pool-stats.d.ts +19 -0
  131. package/node_modules/@types/ws/node_modules/undici-types/pool.d.ts +41 -0
  132. package/node_modules/@types/ws/node_modules/undici-types/proxy-agent.d.ts +29 -0
  133. package/node_modules/@types/ws/node_modules/undici-types/readable.d.ts +68 -0
  134. package/node_modules/@types/ws/node_modules/undici-types/retry-agent.d.ts +8 -0
  135. package/node_modules/@types/ws/node_modules/undici-types/retry-handler.d.ts +125 -0
  136. package/node_modules/@types/ws/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  137. package/node_modules/@types/ws/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  138. package/node_modules/@types/ws/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  139. package/node_modules/@types/ws/node_modules/undici-types/util.d.ts +18 -0
  140. package/node_modules/@types/ws/node_modules/undici-types/utility.d.ts +7 -0
  141. package/node_modules/@types/ws/node_modules/undici-types/webidl.d.ts +347 -0
  142. package/node_modules/@types/ws/node_modules/undici-types/websocket.d.ts +188 -0
  143. package/npm-shrinkwrap.json +17 -2
  144. package/openclaw.plugin.json +2 -0
  145. package/package.json +5 -5
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,125 @@
1
+ import Dispatcher from './dispatcher'
2
+
3
+ export default RetryHandler
4
+
5
+ declare class RetryHandler implements Dispatcher.DispatchHandler {
6
+ constructor (
7
+ options: Dispatcher.DispatchOptions & {
8
+ retryOptions?: RetryHandler.RetryOptions;
9
+ },
10
+ retryHandlers: RetryHandler.RetryHandlers
11
+ )
12
+ }
13
+
14
+ declare namespace RetryHandler {
15
+ export type RetryState = { counter: number; }
16
+
17
+ export type RetryContext = {
18
+ state: RetryState;
19
+ opts: Dispatcher.DispatchOptions & {
20
+ retryOptions?: RetryHandler.RetryOptions;
21
+ };
22
+ }
23
+
24
+ export type OnRetryCallback = (result?: Error | null) => void
25
+
26
+ export type RetryCallback = (
27
+ err: Error,
28
+ context: {
29
+ state: RetryState;
30
+ opts: Dispatcher.DispatchOptions & {
31
+ retryOptions?: RetryHandler.RetryOptions;
32
+ };
33
+ },
34
+ callback: OnRetryCallback
35
+ ) => void
36
+
37
+ export interface RetryOptions {
38
+ /**
39
+ * If true, the retry handler will throw an error if the request fails,
40
+ * this will prevent the folling handlers from being called, and will destroy the socket.
41
+ *
42
+ * @type {boolean}
43
+ * @memberof RetryOptions
44
+ * @default true
45
+ */
46
+ throwOnError?: boolean;
47
+ /**
48
+ * Callback to be invoked on every retry iteration.
49
+ * It receives the error, current state of the retry object and the options object
50
+ * passed when instantiating the retry handler.
51
+ *
52
+ * @type {RetryCallback}
53
+ * @memberof RetryOptions
54
+ */
55
+ retry?: RetryCallback;
56
+ /**
57
+ * Maximum number of retries to allow.
58
+ *
59
+ * @type {number}
60
+ * @memberof RetryOptions
61
+ * @default 5
62
+ */
63
+ maxRetries?: number;
64
+ /**
65
+ * Max number of milliseconds allow between retries
66
+ *
67
+ * @type {number}
68
+ * @memberof RetryOptions
69
+ * @default 30000
70
+ */
71
+ maxTimeout?: number;
72
+ /**
73
+ * Initial number of milliseconds to wait before retrying for the first time.
74
+ *
75
+ * @type {number}
76
+ * @memberof RetryOptions
77
+ * @default 500
78
+ */
79
+ minTimeout?: number;
80
+ /**
81
+ * Factior to multiply the timeout factor between retries.
82
+ *
83
+ * @type {number}
84
+ * @memberof RetryOptions
85
+ * @default 2
86
+ */
87
+ timeoutFactor?: number;
88
+ /**
89
+ * It enables to automatically infer timeout between retries based on the `Retry-After` header.
90
+ *
91
+ * @type {boolean}
92
+ * @memberof RetryOptions
93
+ * @default true
94
+ */
95
+ retryAfter?: boolean;
96
+ /**
97
+ * HTTP methods to retry.
98
+ *
99
+ * @type {Dispatcher.HttpMethod[]}
100
+ * @memberof RetryOptions
101
+ * @default ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'],
102
+ */
103
+ methods?: Dispatcher.HttpMethod[];
104
+ /**
105
+ * Error codes to be retried. e.g. `ECONNRESET`, `ENOTFOUND`, `ETIMEDOUT`, `ECONNREFUSED`, etc.
106
+ *
107
+ * @type {string[]}
108
+ * @default ['ECONNRESET','ECONNREFUSED','ENOTFOUND','ENETDOWN','ENETUNREACH','EHOSTDOWN','EHOSTUNREACH','EPIPE']
109
+ */
110
+ errorCodes?: string[];
111
+ /**
112
+ * HTTP status codes to be retried.
113
+ *
114
+ * @type {number[]}
115
+ * @memberof RetryOptions
116
+ * @default [500, 502, 503, 504, 429],
117
+ */
118
+ statusCodes?: number[];
119
+ }
120
+
121
+ export interface RetryHandlers {
122
+ dispatch: Dispatcher['dispatch'];
123
+ handler: Dispatcher.DispatchHandler;
124
+ }
125
+ }
@@ -0,0 +1,41 @@
1
+ import Client from './client'
2
+ import TPoolStats from './pool-stats'
3
+ import { URL } from 'node:url'
4
+ import Dispatcher from './dispatcher'
5
+
6
+ export default RoundRobinPool
7
+
8
+ type RoundRobinPoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
9
+
10
+ declare class RoundRobinPool extends Dispatcher {
11
+ constructor (url: string | URL, options?: RoundRobinPool.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 RoundRobinPool. */
17
+ readonly stats: TPoolStats
18
+
19
+ // Override dispatcher APIs.
20
+ override connect (
21
+ options: RoundRobinPoolConnectOptions
22
+ ): Promise<Dispatcher.ConnectData>
23
+ override connect (
24
+ options: RoundRobinPoolConnectOptions,
25
+ callback: (err: Error | null, data: Dispatcher.ConnectData) => void
26
+ ): void
27
+ }
28
+
29
+ declare namespace RoundRobinPool {
30
+ export type RoundRobinPoolStats = 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?: { RoundRobinPool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options['interceptors']
40
+ }
41
+ }
@@ -0,0 +1,109 @@
1
+ import MockAgent from './mock-agent'
2
+
3
+ declare class SnapshotRecorder {
4
+ constructor (options?: SnapshotRecorder.Options)
5
+
6
+ record (requestOpts: any, response: any): Promise<void>
7
+ findSnapshot (requestOpts: any): SnapshotRecorder.Snapshot | undefined
8
+ loadSnapshots (filePath?: string): Promise<void>
9
+ saveSnapshots (filePath?: string): Promise<void>
10
+ clear (): void
11
+ getSnapshots (): SnapshotRecorder.Snapshot[]
12
+ size (): number
13
+ resetCallCounts (): void
14
+ deleteSnapshot (requestOpts: any): boolean
15
+ getSnapshotInfo (requestOpts: any): SnapshotRecorder.SnapshotInfo | null
16
+ replaceSnapshots (snapshotData: SnapshotRecorder.SnapshotData[]): void
17
+ destroy (): void
18
+ }
19
+
20
+ declare namespace SnapshotRecorder {
21
+ type SnapshotRecorderMode = 'record' | 'playback' | 'update'
22
+
23
+ export interface Options {
24
+ snapshotPath?: string
25
+ mode?: SnapshotRecorderMode
26
+ maxSnapshots?: number
27
+ autoFlush?: boolean
28
+ flushInterval?: number
29
+ matchHeaders?: string[]
30
+ ignoreHeaders?: string[]
31
+ excludeHeaders?: string[]
32
+ matchBody?: boolean
33
+ matchQuery?: boolean
34
+ caseSensitive?: boolean
35
+ shouldRecord?: (requestOpts: any) => boolean
36
+ shouldPlayback?: (requestOpts: any) => boolean
37
+ excludeUrls?: (string | RegExp)[]
38
+ }
39
+
40
+ export interface Snapshot {
41
+ request: {
42
+ method: string
43
+ url: string
44
+ headers: Record<string, string>
45
+ body?: string
46
+ }
47
+ responses: {
48
+ statusCode: number
49
+ headers: Record<string, string>
50
+ body: string
51
+ trailers: Record<string, string>
52
+ }[]
53
+ callCount: number
54
+ timestamp: string
55
+ }
56
+
57
+ export interface SnapshotInfo {
58
+ hash: string
59
+ request: {
60
+ method: string
61
+ url: string
62
+ headers: Record<string, string>
63
+ body?: string
64
+ }
65
+ responseCount: number
66
+ callCount: number
67
+ timestamp: string
68
+ }
69
+
70
+ export interface SnapshotData {
71
+ hash: string
72
+ snapshot: Snapshot
73
+ }
74
+ }
75
+
76
+ declare class SnapshotAgent extends MockAgent {
77
+ constructor (options?: SnapshotAgent.Options)
78
+
79
+ saveSnapshots (filePath?: string): Promise<void>
80
+ loadSnapshots (filePath?: string): Promise<void>
81
+ getRecorder (): SnapshotRecorder
82
+ getMode (): SnapshotRecorder.SnapshotRecorderMode
83
+ clearSnapshots (): void
84
+ resetCallCounts (): void
85
+ deleteSnapshot (requestOpts: any): boolean
86
+ getSnapshotInfo (requestOpts: any): SnapshotRecorder.SnapshotInfo | null
87
+ replaceSnapshots (snapshotData: SnapshotRecorder.SnapshotData[]): void
88
+ }
89
+
90
+ declare namespace SnapshotAgent {
91
+ export interface Options extends MockAgent.Options {
92
+ mode?: SnapshotRecorder.SnapshotRecorderMode
93
+ snapshotPath?: string
94
+ maxSnapshots?: number
95
+ autoFlush?: boolean
96
+ flushInterval?: number
97
+ matchHeaders?: string[]
98
+ ignoreHeaders?: string[]
99
+ excludeHeaders?: string[]
100
+ matchBody?: boolean
101
+ matchQuery?: boolean
102
+ caseSensitive?: boolean
103
+ shouldRecord?: (requestOpts: any) => boolean
104
+ shouldPlayback?: (requestOpts: any) => boolean
105
+ excludeUrls?: (string | RegExp)[]
106
+ }
107
+ }
108
+
109
+ export { SnapshotAgent, SnapshotRecorder }
@@ -0,0 +1,25 @@
1
+ import Dispatcher from './dispatcher'
2
+ import buildConnector from './connector'
3
+ import { IncomingHttpHeaders } from './header'
4
+ import Pool from './pool'
5
+
6
+ export default Socks5ProxyAgent
7
+
8
+ declare class Socks5ProxyAgent extends Dispatcher {
9
+ constructor (proxyUrl: string | URL, options?: Socks5ProxyAgent.Options)
10
+ }
11
+
12
+ declare namespace Socks5ProxyAgent {
13
+ export interface Options extends Pool.Options {
14
+ /** Additional headers to send with the proxy connection */
15
+ headers?: IncomingHttpHeaders;
16
+ /** SOCKS5 proxy username for authentication */
17
+ username?: string;
18
+ /** SOCKS5 proxy password for authentication */
19
+ password?: string;
20
+ /** Custom connector function for proxy connection */
21
+ connect?: buildConnector.connector;
22
+ /** TLS options for the proxy connection (for SOCKS5 over TLS) */
23
+ proxyTls?: buildConnector.BuildOptions;
24
+ }
25
+ }
@@ -0,0 +1,18 @@
1
+ export namespace util {
2
+ /**
3
+ * Retrieves a header name and returns its lowercase value.
4
+ * @param value Header name
5
+ */
6
+ export function headerNameToString (value: string | Buffer): string
7
+
8
+ /**
9
+ * Receives a header object and returns the parsed value.
10
+ * @param headers Header object
11
+ * @param obj Object to specify a proxy object. Used to assign parsed values.
12
+ * @returns If `obj` is specified, it is equivalent to `obj`.
13
+ */
14
+ export function parseHeaders (
15
+ headers: (Buffer | string | (Buffer | string)[])[],
16
+ obj?: Record<string, string | string[]>
17
+ ): Record<string, string | string[]>
18
+ }
@@ -0,0 +1,7 @@
1
+ type AutocompletePrimitiveBaseType<T> =
2
+ T extends string ? string :
3
+ T extends number ? number :
4
+ T extends boolean ? boolean :
5
+ never
6
+
7
+ export type Autocomplete<T> = T | (AutocompletePrimitiveBaseType<T> & Record<never, never>)
@@ -0,0 +1,347 @@
1
+ // These types are not exported, and are only used internally
2
+ import { BufferSource } from 'node:stream/web'
3
+ import * as undici from './index'
4
+
5
+ /**
6
+ * Take in an unknown value and return one that is of type T
7
+ */
8
+ type Converter<T> = (object: unknown) => T
9
+
10
+ type SequenceConverter<T> = (object: unknown, iterable?: IterableIterator<T>) => T[]
11
+
12
+ type RecordConverter<K extends string, V> = (object: unknown) => Record<K, V>
13
+
14
+ interface WebidlErrors {
15
+ /**
16
+ * @description Instantiate an error
17
+ */
18
+ exception (opts: { header: string, message: string }): TypeError
19
+ /**
20
+ * @description Instantiate an error when conversion from one type to another has failed
21
+ */
22
+ conversionFailed (opts: {
23
+ prefix: string
24
+ argument: string
25
+ types: string[]
26
+ }): TypeError
27
+ /**
28
+ * @description Throw an error when an invalid argument is provided
29
+ */
30
+ invalidArgument (opts: {
31
+ prefix: string
32
+ value: string
33
+ type: string
34
+ }): TypeError
35
+ }
36
+
37
+ interface WebIDLTypes {
38
+ UNDEFINED: 1,
39
+ BOOLEAN: 2,
40
+ STRING: 3,
41
+ SYMBOL: 4,
42
+ NUMBER: 5,
43
+ BIGINT: 6,
44
+ NULL: 7
45
+ OBJECT: 8
46
+ }
47
+
48
+ interface WebidlUtil {
49
+ /**
50
+ * @see https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values
51
+ */
52
+ Type (object: unknown): WebIDLTypes[keyof WebIDLTypes]
53
+
54
+ TypeValueToString (o: unknown):
55
+ | 'Undefined'
56
+ | 'Boolean'
57
+ | 'String'
58
+ | 'Symbol'
59
+ | 'Number'
60
+ | 'BigInt'
61
+ | 'Null'
62
+ | 'Object'
63
+
64
+ Types: WebIDLTypes
65
+
66
+ /**
67
+ * @see https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
68
+ */
69
+ ConvertToInt (
70
+ V: unknown,
71
+ bitLength: number,
72
+ signedness: 'signed' | 'unsigned',
73
+ flags?: number
74
+ ): number
75
+
76
+ /**
77
+ * @see https://webidl.spec.whatwg.org/#abstract-opdef-integerpart
78
+ */
79
+ IntegerPart (N: number): number
80
+
81
+ /**
82
+ * Stringifies {@param V}
83
+ */
84
+ Stringify (V: any): string
85
+
86
+ MakeTypeAssertion <I>(I: I): (arg: any) => arg is I
87
+
88
+ /**
89
+ * Mark a value as uncloneable for Node.js.
90
+ * This is only effective in some newer Node.js versions.
91
+ */
92
+ markAsUncloneable (V: any): void
93
+
94
+ IsResizableArrayBuffer (V: ArrayBufferLike): boolean
95
+
96
+ HasFlag (flag: number, attributes: number): boolean
97
+
98
+ /**
99
+ * @see https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy
100
+ */
101
+ getCopyOfBytesHeldByBufferSource (bufferSource: BufferSource): Uint8Array
102
+ }
103
+
104
+ interface WebidlConverters {
105
+ /**
106
+ * @see https://webidl.spec.whatwg.org/#es-DOMString
107
+ */
108
+ DOMString (V: unknown, prefix: string, argument: string, flags?: number): string
109
+
110
+ /**
111
+ * @see https://webidl.spec.whatwg.org/#es-ByteString
112
+ */
113
+ ByteString (V: unknown, prefix: string, argument: string): string
114
+
115
+ /**
116
+ * @see https://webidl.spec.whatwg.org/#es-USVString
117
+ */
118
+ USVString (V: unknown): string
119
+
120
+ /**
121
+ * @see https://webidl.spec.whatwg.org/#es-boolean
122
+ */
123
+ boolean (V: unknown): boolean
124
+
125
+ /**
126
+ * @see https://webidl.spec.whatwg.org/#es-any
127
+ */
128
+ any <Value>(V: Value): Value
129
+
130
+ /**
131
+ * @see https://webidl.spec.whatwg.org/#es-long-long
132
+ */
133
+ ['long long'] (V: unknown): number
134
+
135
+ /**
136
+ * @see https://webidl.spec.whatwg.org/#es-unsigned-long-long
137
+ */
138
+ ['unsigned long long'] (V: unknown): number
139
+
140
+ /**
141
+ * @see https://webidl.spec.whatwg.org/#es-unsigned-long
142
+ */
143
+ ['unsigned long'] (V: unknown): number
144
+
145
+ /**
146
+ * @see https://webidl.spec.whatwg.org/#es-unsigned-short
147
+ */
148
+ ['unsigned short'] (V: unknown, flags?: number): number
149
+
150
+ /**
151
+ * @see https://webidl.spec.whatwg.org/#idl-ArrayBuffer
152
+ */
153
+ ArrayBuffer (
154
+ V: unknown,
155
+ prefix: string,
156
+ argument: string,
157
+ options?: { allowResizable: boolean }
158
+ ): ArrayBuffer
159
+
160
+ /**
161
+ * @see https://webidl.spec.whatwg.org/#idl-SharedArrayBuffer
162
+ */
163
+ SharedArrayBuffer (
164
+ V: unknown,
165
+ prefix: string,
166
+ argument: string,
167
+ options?: { allowResizable: boolean }
168
+ ): SharedArrayBuffer
169
+
170
+ /**
171
+ * @see https://webidl.spec.whatwg.org/#es-buffer-source-types
172
+ */
173
+ TypedArray (
174
+ V: unknown,
175
+ T: new () => NodeJS.TypedArray,
176
+ prefix: string,
177
+ argument: string,
178
+ flags?: number
179
+ ): NodeJS.TypedArray
180
+
181
+ /**
182
+ * @see https://webidl.spec.whatwg.org/#es-buffer-source-types
183
+ */
184
+ DataView (
185
+ V: unknown,
186
+ prefix: string,
187
+ argument: string,
188
+ flags?: number
189
+ ): DataView
190
+
191
+ /**
192
+ * @see https://webidl.spec.whatwg.org/#es-buffer-source-types
193
+ */
194
+ ArrayBufferView (
195
+ V: unknown,
196
+ prefix: string,
197
+ argument: string,
198
+ flags?: number
199
+ ): NodeJS.ArrayBufferView
200
+
201
+ /**
202
+ * @see https://webidl.spec.whatwg.org/#BufferSource
203
+ */
204
+ BufferSource (
205
+ V: unknown,
206
+ prefix: string,
207
+ argument: string,
208
+ flags?: number
209
+ ): ArrayBuffer | NodeJS.ArrayBufferView
210
+
211
+ /**
212
+ * @see https://webidl.spec.whatwg.org/#AllowSharedBufferSource
213
+ */
214
+ AllowSharedBufferSource (
215
+ V: unknown,
216
+ prefix: string,
217
+ argument: string,
218
+ flags?: number
219
+ ): ArrayBuffer | SharedArrayBuffer | NodeJS.ArrayBufferView
220
+
221
+ ['sequence<ByteString>']: SequenceConverter<string>
222
+
223
+ ['sequence<sequence<ByteString>>']: SequenceConverter<string[]>
224
+
225
+ ['record<ByteString, ByteString>']: RecordConverter<string, string>
226
+
227
+ /**
228
+ * @see https://fetch.spec.whatwg.org/#requestinfo
229
+ */
230
+ RequestInfo (V: unknown): undici.Request | string
231
+
232
+ /**
233
+ * @see https://fetch.spec.whatwg.org/#requestinit
234
+ */
235
+ RequestInit (V: unknown): undici.RequestInit
236
+
237
+ /**
238
+ * @see https://html.spec.whatwg.org/multipage/webappapis.html#eventhandlernonnull
239
+ */
240
+ EventHandlerNonNull (V: unknown): Function | null
241
+
242
+ WebSocketStreamWrite (V: unknown): ArrayBuffer | NodeJS.TypedArray | string
243
+
244
+ [Key: string]: (...args: any[]) => unknown
245
+ }
246
+
247
+ type WebidlIsFunction<T> = (arg: any) => arg is T
248
+
249
+ interface WebidlIs {
250
+ Request: WebidlIsFunction<undici.Request>
251
+ Response: WebidlIsFunction<undici.Response>
252
+ ReadableStream: WebidlIsFunction<ReadableStream>
253
+ Blob: WebidlIsFunction<Blob>
254
+ URLSearchParams: WebidlIsFunction<URLSearchParams>
255
+ File: WebidlIsFunction<File>
256
+ FormData: WebidlIsFunction<undici.FormData>
257
+ URL: WebidlIsFunction<URL>
258
+ WebSocketError: WebidlIsFunction<undici.WebSocketError>
259
+ AbortSignal: WebidlIsFunction<AbortSignal>
260
+ MessagePort: WebidlIsFunction<MessagePort>
261
+ USVString: WebidlIsFunction<string>
262
+ /**
263
+ * @see https://webidl.spec.whatwg.org/#BufferSource
264
+ */
265
+ BufferSource: WebidlIsFunction<ArrayBuffer | NodeJS.TypedArray>
266
+ }
267
+
268
+ export interface Webidl {
269
+ errors: WebidlErrors
270
+ util: WebidlUtil
271
+ converters: WebidlConverters
272
+ is: WebidlIs
273
+ attributes: WebIDLExtendedAttributes
274
+
275
+ /**
276
+ * @description Performs a brand-check on {@param V} to ensure it is a
277
+ * {@param cls} object.
278
+ */
279
+ brandCheck <Interface extends new () => unknown>(V: unknown, cls: Interface): asserts V is Interface
280
+
281
+ brandCheckMultiple <Interfaces extends (new () => unknown)[]> (list: Interfaces): (V: any) => asserts V is Interfaces[number]
282
+
283
+ /**
284
+ * @see https://webidl.spec.whatwg.org/#es-sequence
285
+ * @description Convert a value, V, to a WebIDL sequence type.
286
+ */
287
+ sequenceConverter <Type>(C: Converter<Type>): SequenceConverter<Type>
288
+
289
+ illegalConstructor (): never
290
+
291
+ /**
292
+ * @see https://webidl.spec.whatwg.org/#es-to-record
293
+ * @description Convert a value, V, to a WebIDL record type.
294
+ */
295
+ recordConverter <K extends string, V>(
296
+ keyConverter: Converter<K>,
297
+ valueConverter: Converter<V>
298
+ ): RecordConverter<K, V>
299
+
300
+ /**
301
+ * Similar to {@link Webidl.brandCheck} but allows skipping the check if third party
302
+ * interfaces are allowed.
303
+ */
304
+ interfaceConverter <Interface>(typeCheck: WebidlIsFunction<Interface>, name: string): (
305
+ V: unknown,
306
+ prefix: string,
307
+ argument: string
308
+ ) => asserts V is Interface
309
+
310
+ // TODO(@KhafraDev): a type could likely be implemented that can infer the return type
311
+ // from the converters given?
312
+ /**
313
+ * Converts a value, V, to a WebIDL dictionary types. Allows limiting which keys are
314
+ * allowed, values allowed, optional and required keys. Auto converts the value to
315
+ * a type given a converter.
316
+ */
317
+ dictionaryConverter (converters: {
318
+ key: string,
319
+ defaultValue?: () => unknown,
320
+ required?: boolean,
321
+ converter: (...args: unknown[]) => unknown,
322
+ allowedValues?: unknown[]
323
+ }[]): (V: unknown) => Record<string, unknown>
324
+
325
+ /**
326
+ * @see https://webidl.spec.whatwg.org/#idl-nullable-type
327
+ * @description allows a type, V, to be null
328
+ */
329
+ nullableConverter <T>(
330
+ converter: Converter<T>
331
+ ): (V: unknown) => ReturnType<typeof converter> | null
332
+
333
+ argumentLengthCheck (args: { length: number }, min: number, context: string): void
334
+ }
335
+
336
+ interface WebIDLExtendedAttributes {
337
+ /** https://webidl.spec.whatwg.org/#Clamp */
338
+ Clamp: number
339
+ /** https://webidl.spec.whatwg.org/#EnforceRange */
340
+ EnforceRange: number
341
+ /** https://webidl.spec.whatwg.org/#AllowShared */
342
+ AllowShared: number
343
+ /** https://webidl.spec.whatwg.org/#AllowResizable */
344
+ AllowResizable: number
345
+ /** https://webidl.spec.whatwg.org/#LegacyNullToEmptyString */
346
+ LegacyNullToEmptyString: number
347
+ }