@runlith/tagma 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter/claudeHooks.d.ts +10 -0
- package/adapter/claudeHooks.js +4 -0
- package/adapter/declaration.d.ts +14 -0
- package/adapter/declaration.js +2 -0
- package/adapter/harness.d.ts +454 -0
- package/adapter/harness.js +2 -0
- package/adapter/hook.d.ts +43 -0
- package/adapter/hook.js +2 -0
- package/adapter/hostModules.d.ts +19 -0
- package/adapter/hostModules.js +2 -0
- package/adapter/loader.d.ts +10 -0
- package/adapter/loader.js +2 -0
- package/adapter/metadata.d.ts +179 -0
- package/adapter/metadata.js +4 -0
- package/adapter/payload.d.ts +19 -0
- package/adapter/payload.js +3 -0
- package/adapter/provider.d.ts +209 -0
- package/adapter/provider.js +2 -0
- package/adapter/settings.d.ts +182 -0
- package/adapter/settings.js +2 -0
- package/adapter/speech.d.ts +4 -0
- package/adapter/speech.js +2 -0
- package/host.d.ts +61223 -0
- package/package.json +129 -3
- package/plugin/Held-6krt6ncs.js +6 -0
- package/plugin/accountKey-tdjj67f5.js +2 -0
- package/plugin/adapter-qdnpxs6n.js +1 -0
- package/plugin/anthropic-a4pdzrv2.js +2 -0
- package/plugin/anthropic-messages-7gtja121.js +2 -0
- package/plugin/anthropic-z9xqmm3q.js +2 -0
- package/plugin/auth-0w6kk39v.js +2 -0
- package/plugin/authStatus-a1g3eb9p.js +2 -0
- package/plugin/bundling.d.ts +30 -0
- package/plugin/bundling.js +2 -0
- package/plugin/cacheLifetime-c5mpw676.js +2 -0
- package/plugin/callback-server-0wrzmjfx.js +16 -0
- package/plugin/capabilities-n3vfpy41.js +2 -0
- package/plugin/claudeHooks-edpg1e46.js +3 -0
- package/plugin/cli.js +21 -0
- package/plugin/cliStore-9rhjxtht.js +2 -0
- package/plugin/clientSession-tmmxm39z.js +2 -0
- package/plugin/codec-aa8mxqyr.js +1 -0
- package/plugin/connect-vrdsw05j.js +2 -0
- package/plugin/contract-qn0z7r9c.js +1 -0
- package/plugin/credential-5sgapkh0.js +2 -0
- package/plugin/deepseek-fvdrmjr9.js +2 -0
- package/plugin/deepseek-v388d1wv.js +2 -0
- package/plugin/definition-s3xx207f.js +2 -0
- package/plugin/description-8xhxryaq.js +2 -0
- package/plugin/deviceGrant-vgbscpr4.js +2 -0
- package/plugin/devin-hy98d305.js +2 -0
- package/plugin/duplex-kpmftvf7.js +2 -0
- package/plugin/endpoint-kvf97tz7.js +2 -0
- package/plugin/errors-5t42p4q1.js +2 -0
- package/plugin/events-e8vv9hda.js +2 -0
- package/plugin/events-s95ybm4g.js +2 -0
- package/plugin/executor-q8kp5q8h.js +2 -0
- package/plugin/failure-vr32debc.js +2 -0
- package/plugin/framing-nktw5sts.js +2 -0
- package/plugin/grant-67b10nhx.js +2 -0
- package/plugin/harness-nrh78w4d.js +2 -0
- package/plugin/headers-ss3dzznj.js +2 -0
- package/plugin/hook-hjrk83m8.js +2 -0
- package/plugin/icon-044pa3y8.js +6 -0
- package/plugin/icon-j22svmgp.js +4 -0
- package/plugin/icon-ny6qbjvc.js +4 -0
- package/plugin/icon-pz54e8n3.js +4 -0
- package/plugin/icon-qy92jx2b.js +4 -0
- package/plugin/ids-n269hc5k.js +2 -0
- package/plugin/images-q80x3bt1.js +2 -0
- package/plugin/index-cyd7v366.js +2 -0
- package/plugin/index-jpmjpmkn.js +2 -0
- package/plugin/lifecycle-qf4fh5m8.js +2 -0
- package/plugin/manual-2mdscj84.js +2 -0
- package/plugin/messages-1szh3p3k.js +2 -0
- package/plugin/metadata-zm1v3ptf.js +4 -0
- package/plugin/muse-r16jp51z.js +2 -0
- package/plugin/muse-tfe6sph7.js +2 -0
- package/plugin/museToolSchema-tbe0f3wa.js +2 -0
- package/plugin/notes-6amdhm6h.js +2 -0
- package/plugin/object-9pjtdam7.js +2 -0
- package/plugin/open-browser-vqb7ckt1.js +2 -0
- package/plugin/openai-0z6fy497.js +2 -0
- package/plugin/openai-37dne8v0.js +2 -0
- package/plugin/openai-compatible-chat-tq9w69h4.js +2 -0
- package/plugin/openai-images-x1sj79qh.js +2 -0
- package/plugin/openai-responses-dka6k753.js +2 -0
- package/plugin/opencodeGo-173fz5c5.js +3 -0
- package/plugin/opencodeGo-qgw3pfg6.js +2 -0
- package/plugin/options-pxwjpfdk.js +2 -0
- package/plugin/payload-2gr4q9g8.js +2 -0
- package/plugin/pkce-nrpept7w.js +2 -0
- package/plugin/plugin-1n46me5n.js +6 -0
- package/plugin/plugin-1vpp5mqk.js +4 -0
- package/plugin/plugin-1x94cj6e.js +3 -0
- package/plugin/plugin-1xze8f5y.js +3 -0
- package/plugin/plugin-285exjxd.js +3 -0
- package/plugin/plugin-3b8x73y6.js +3 -0
- package/plugin/plugin-3pfrkxg1.js +3 -0
- package/plugin/plugin-3whwpedj.js +3 -0
- package/plugin/plugin-521srf94.js +3 -0
- package/plugin/plugin-55fbx586.js +3 -0
- package/plugin/plugin-5zq084fb.js +3 -0
- package/plugin/plugin-60bdzk1r.js +4 -0
- package/plugin/plugin-6a56xsx3.js +3 -0
- package/plugin/plugin-6xpcmvm3.js +36 -0
- package/plugin/plugin-72xxqm1t.js +3 -0
- package/plugin/plugin-7y7ndrk9.js +3 -0
- package/plugin/plugin-80gqwmjy.js +3 -0
- package/plugin/plugin-8230g28p.js +3 -0
- package/plugin/plugin-8jf7f360.js +3 -0
- package/plugin/plugin-92redty0.js +3 -0
- package/plugin/plugin-9gha9fx3.js +3 -0
- package/plugin/plugin-a4ng6krf.js +3 -0
- package/plugin/plugin-ak62rhwz.js +3 -0
- package/plugin/plugin-ay29ch70.js +3 -0
- package/plugin/plugin-ba1sv0th.js +3 -0
- package/plugin/plugin-ca4vf4j5.js +3 -0
- package/plugin/plugin-cydz2zhy.js +3 -0
- package/plugin/plugin-d6hbav22.js +3 -0
- package/plugin/plugin-e2y95zm5.js +3 -0
- package/plugin/plugin-ff38dxy1.js +3 -0
- package/plugin/plugin-ff9hx5a4.js +3 -0
- package/plugin/plugin-fhc5q7r3.js +3 -0
- package/plugin/plugin-frrvs5yc.js +3 -0
- package/plugin/plugin-g65b14k1.js +3 -0
- package/plugin/plugin-gh857xdd.js +3 -0
- package/plugin/plugin-gkgs7vfv.js +3 -0
- package/plugin/plugin-h66k1zhn.js +14 -0
- package/plugin/plugin-je5cfnqn.js +3 -0
- package/plugin/plugin-jjm52353.js +3 -0
- package/plugin/plugin-jxvmq18y.js +3 -0
- package/plugin/plugin-kc4z9msd.js +3 -0
- package/plugin/plugin-kjtzm2q6.js +3 -0
- package/plugin/plugin-krbbb4ts.js +3 -0
- package/plugin/plugin-me00x60n.js +3 -0
- package/plugin/plugin-mqr325kz.js +3 -0
- package/plugin/plugin-njh1f7b2.js +5 -0
- package/plugin/plugin-nkb5bb2q.js +3 -0
- package/plugin/plugin-nqmb78ez.js +4 -0
- package/plugin/plugin-nzacjxf9.js +3 -0
- package/plugin/plugin-p59gy5xd.js +3 -0
- package/plugin/plugin-pfj9nc2e.js +3 -0
- package/plugin/plugin-pkxw1pfs.js +3 -0
- package/plugin/plugin-q1n5kwx0.js +3 -0
- package/plugin/plugin-q1sqj2tc.js +3 -0
- package/plugin/plugin-q7rk75bs.js +3 -0
- package/plugin/plugin-qpda63gv.js +3 -0
- package/plugin/plugin-rrgyjesv.js +3 -0
- package/plugin/plugin-sfdxgkds.js +3 -0
- package/plugin/plugin-v7k9fx92.js +3 -0
- package/plugin/plugin-vfjhxng8.js +3 -0
- package/plugin/plugin-vv72e4ah.js +3 -0
- package/plugin/plugin-w8f977my.js +3 -0
- package/plugin/plugin-xbnw80pk.js +3 -0
- package/plugin/plugin-yxgg03s0.js +5 -0
- package/plugin/plugin-z6hkd9rw.js +3 -0
- package/plugin/plugin-zew2m18x.js +3 -0
- package/plugin/plugin-zphe2a5v.js +9 -0
- package/plugin/plugin-zvyk8bnr.js +3 -0
- package/plugin/plugin-zw3ywa4b.js +3 -0
- package/plugin/plugin-zxe49p72.js +3 -0
- package/plugin/plugin-zz7yc97m.js +3 -0
- package/plugin/plugin.d.ts +175 -0
- package/plugin/plugin.js +2 -0
- package/plugin/points.generated.d.ts +341 -0
- package/plugin/points.generated.js +2 -0
- package/plugin/process.d.ts +4 -0
- package/plugin/process.js +85 -0
- package/plugin/protocol-hwnfh4h1.js +2 -0
- package/plugin/protocol.d.ts +115 -0
- package/plugin/protocol.js +2 -0
- package/plugin/provider-0b7xxyhn.js +2 -0
- package/plugin/quota-vrrmfag6.js +2 -0
- package/plugin/quotaRead-vj6e90xc.js +2 -0
- package/plugin/reasoning-5nanktp2.js +2 -0
- package/plugin/record-1m3vvy60.js +2 -0
- package/plugin/requests-2zyr1g8e.js +1 -0
- package/plugin/responseFold-w4526gvb.js +2 -0
- package/plugin/settings-vdypzert.js +2 -0
- package/plugin/shared-a2yyy8ry.js +2 -0
- package/plugin/speech-067caz1a.js +2 -0
- package/plugin/stepfun-3en5g41d.js +2 -0
- package/plugin/stepfun-bwsz4nrd.js +2 -0
- package/plugin/stream-bt8etfpc.js +2 -0
- package/plugin/svelteProgram-73v9yajk.js +2 -0
- package/plugin/synthesisDuplex-m2j6pmyv.js +2 -0
- package/plugin/template.d.ts +14 -0
- package/plugin/template.js +2 -0
- package/plugin/testing.d.ts +85 -0
- package/plugin/testing.js +4 -0
- package/plugin/tool-content-b9jtprr7.js +2 -0
- package/plugin/tool-stream-gdajdxn0.js +2 -0
- package/plugin/transport-7hfp9sn4.js +2 -0
- package/plugin/ui.generated.d.ts +1044 -0
- package/plugin/value.d.ts +8 -0
- package/plugin/value.js +2 -0
- package/plugin/vendor-pn6b5a8f.js +2 -0
- package/plugin/vendorCall-6n5chrn0.js +2 -0
- package/plugin/vendorCall-hv01nwsp.js +2 -0
- package/plugin/vendorPayload-awxqr7t8.js +2 -0
- package/plugin/vendorWeb-vnf344r1.js +2 -0
- package/plugin/verbatim-mqt9x4aa.js +2 -0
- package/plugin/xai-e8sbtk6a.js +2 -0
- package/plugin/xai-z1ysta23.js +2 -0
- package/rules/effect.d.ts +55 -0
- package/rules/effect.js +11 -0
- package/rules/rules.d.ts +342 -0
- package/rules/rules.js +50 -0
- package/types/node/assert/strict.d.ts +12 -0
- package/types/node/assert.d.ts +76 -0
- package/types/node/async_hooks.d.ts +113 -0
- package/types/node/buffer.buffer.d.ts +29 -0
- package/types/node/buffer.d.ts +162 -0
- package/types/node/child_process.d.ts +337 -0
- package/types/node/cluster.d.ts +118 -0
- package/types/node/compatibility/iterators.d.ts +11 -0
- package/types/node/console.d.ts +48 -0
- package/types/node/constants.d.ts +8 -0
- package/types/node/crypto.d.ts +847 -0
- package/types/node/dgram.d.ts +88 -0
- package/types/node/diagnostics_channel.d.ts +61 -0
- package/types/node/dns/promises.d.ts +94 -0
- package/types/node/dns.d.ts +276 -0
- package/types/node/domain.d.ts +17 -0
- package/types/node/events.d.ts +138 -0
- package/types/node/fs/promises.d.ts +253 -0
- package/types/node/fs.d.ts +1038 -0
- package/types/node/globals.d.ts +73 -0
- package/types/node/globals.typedarray.d.ts +22 -0
- package/types/node/http.d.ts +530 -0
- package/types/node/http2.d.ts +794 -0
- package/types/node/https.d.ts +66 -0
- package/types/node/index.d.ts +84 -0
- package/types/node/inspector/promises.d.ts +13 -0
- package/types/node/inspector.d.ts +61 -0
- package/types/node/inspector.generated.d.ts +1624 -0
- package/types/node/module.d.ts +187 -0
- package/types/node/net.d.ts +266 -0
- package/types/node/os.d.ts +236 -0
- package/types/node/path/posix.d.ts +8 -0
- package/types/node/path/win32.d.ts +8 -0
- package/types/node/path.d.ts +40 -0
- package/types/node/perf_hooks.d.ts +236 -0
- package/types/node/process.d.ts +436 -0
- package/types/node/punycode.d.ts +15 -0
- package/types/node/querystring.d.ts +22 -0
- package/types/node/quic.d.ts +203 -0
- package/types/node/readline/promises.d.ts +28 -0
- package/types/node/readline.d.ts +94 -0
- package/types/node/repl.d.ts +104 -0
- package/types/node/sea.d.ts +11 -0
- package/types/node/sqlite.d.ts +183 -0
- package/types/node/stream/consumers.d.ts +13 -0
- package/types/node/stream/iter.d.ts +240 -0
- package/types/node/stream/promises.d.ts +37 -0
- package/types/node/stream/web.d.ts +297 -0
- package/types/node/stream.d.ts +378 -0
- package/types/node/string_decoder.d.ts +10 -0
- package/types/node/test/reporters.d.ts +66 -0
- package/types/node/test.d.ts +462 -0
- package/types/node/timers/promises.d.ts +16 -0
- package/types/node/timers.d.ts +43 -0
- package/types/node/tls.d.ts +279 -0
- package/types/node/trace_events.d.ts +16 -0
- package/types/node/ts5.6/buffer.buffer.d.ts +26 -0
- package/types/node/ts5.6/compatibility/float16array.d.ts +43 -0
- package/types/node/ts5.6/globals.typedarray.d.ts +22 -0
- package/types/node/ts5.6/index.d.ts +84 -0
- package/types/node/ts5.7/compatibility/float16array.d.ts +50 -0
- package/types/node/ts5.7/index.d.ts +84 -0
- package/types/node/tty.d.ts +61 -0
- package/types/node/url.d.ts +165 -0
- package/types/node/util/types.d.ts +49 -0
- package/types/node/util.d.ts +320 -0
- package/types/node/v8.d.ts +178 -0
- package/types/node/vm.d.ts +130 -0
- package/types/node/wasi.d.ts +26 -0
- package/types/node/web-globals/abortcontroller.d.ts +47 -0
- package/types/node/web-globals/blob.d.ts +34 -0
- package/types/node/web-globals/console.d.ts +7 -0
- package/types/node/web-globals/crypto.d.ts +46 -0
- package/types/node/web-globals/domexception.d.ts +74 -0
- package/types/node/web-globals/encoding.d.ts +16 -0
- package/types/node/web-globals/events.d.ts +111 -0
- package/types/node/web-globals/fetch.d.ts +121 -0
- package/types/node/web-globals/importmeta.d.ts +11 -0
- package/types/node/web-globals/messaging.d.ts +32 -0
- package/types/node/web-globals/navigator.d.ts +28 -0
- package/types/node/web-globals/performance.d.ts +71 -0
- package/types/node/web-globals/storage.d.ts +26 -0
- package/types/node/web-globals/streams.d.ts +162 -0
- package/types/node/web-globals/timers.d.ts +22 -0
- package/types/node/web-globals/url.d.ts +27 -0
- package/types/node/worker_threads.d.ts +199 -0
- package/types/node/zlib/iter.d.ts +49 -0
- package/types/node/zlib.d.ts +360 -0
- package/types/undici/agent.d.ts +24 -0
- package/types/undici/api.d.ts +19 -0
- package/types/undici/balanced-pool.d.ts +16 -0
- package/types/undici/cache-interceptor.d.ts +98 -0
- package/types/undici/cache.d.ts +30 -0
- package/types/undici/client-stats.d.ts +9 -0
- package/types/undici/client.d.ts +61 -0
- package/types/undici/connector.d.ts +37 -0
- package/types/undici/content-type.d.ts +9 -0
- package/types/undici/cookies.d.ts +22 -0
- package/types/undici/diagnostics-channel.d.ts +72 -0
- package/types/undici/dispatcher.d.ts +207 -0
- package/types/undici/env-http-proxy-agent.d.ts +15 -0
- package/types/undici/errors.d.ts +117 -0
- package/types/undici/eventsource.d.ts +39 -0
- package/types/undici/fetch.d.ts +122 -0
- package/types/undici/formdata.d.ts +24 -0
- package/types/undici/global-dispatcher.d.ts +4 -0
- package/types/undici/global-origin.d.ts +3 -0
- package/types/undici/h2c-client.d.ts +35 -0
- package/types/undici/handlers.d.ts +7 -0
- package/types/undici/header.d.ts +10 -0
- package/types/undici/index.d.ts +85 -0
- package/types/undici/interceptors.d.ts +70 -0
- package/types/undici/mock-agent.d.ts +43 -0
- package/types/undici/mock-call-history.d.ts +57 -0
- package/types/undici/mock-client.d.ts +17 -0
- package/types/undici/mock-errors.d.ts +9 -0
- package/types/undici/mock-interceptor.d.ts +60 -0
- package/types/undici/mock-pool.d.ts +17 -0
- package/types/undici/patch.d.ts +21 -0
- package/types/undici/pool-stats.d.ts +11 -0
- package/types/undici/pool.d.ts +25 -0
- package/types/undici/proxy-agent.d.ts +22 -0
- package/types/undici/readable.d.ts +24 -0
- package/types/undici/retry-agent.d.ts +6 -0
- package/types/undici/retry-handler.d.ts +41 -0
- package/types/undici/round-robin-pool.d.ts +25 -0
- package/types/undici/snapshot-agent.d.ts +98 -0
- package/types/undici/socks5-proxy-agent.d.ts +17 -0
- package/types/undici/util.d.ts +4 -0
- package/types/undici/utility.d.ts +2 -0
- package/types/undici/webidl.d.ts +121 -0
- package/types/undici/websocket.d.ts +130 -0
- package/README.md +0 -3
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { IncomingHttpHeaders } from './header';
|
|
2
|
+
import Client from './client';
|
|
3
|
+
export default Errors;
|
|
4
|
+
declare namespace Errors {
|
|
5
|
+
export class UndiciError extends Error {
|
|
6
|
+
name: string;
|
|
7
|
+
code: string;
|
|
8
|
+
}
|
|
9
|
+
export class ConnectTimeoutError extends UndiciError {
|
|
10
|
+
name: 'ConnectTimeoutError';
|
|
11
|
+
code: 'UND_ERR_CONNECT_TIMEOUT';
|
|
12
|
+
}
|
|
13
|
+
export class HeadersTimeoutError extends UndiciError {
|
|
14
|
+
name: 'HeadersTimeoutError';
|
|
15
|
+
code: 'UND_ERR_HEADERS_TIMEOUT';
|
|
16
|
+
}
|
|
17
|
+
export class HeadersOverflowError extends UndiciError {
|
|
18
|
+
name: 'HeadersOverflowError';
|
|
19
|
+
code: 'UND_ERR_HEADERS_OVERFLOW';
|
|
20
|
+
}
|
|
21
|
+
export class BodyTimeoutError extends UndiciError {
|
|
22
|
+
name: 'BodyTimeoutError';
|
|
23
|
+
code: 'UND_ERR_BODY_TIMEOUT';
|
|
24
|
+
}
|
|
25
|
+
export class ResponseError extends UndiciError {
|
|
26
|
+
constructor(message: string, code: number, options: {
|
|
27
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
28
|
+
body?: null | Record<string, any> | string;
|
|
29
|
+
});
|
|
30
|
+
name: 'ResponseError';
|
|
31
|
+
code: 'UND_ERR_RESPONSE';
|
|
32
|
+
statusCode: number;
|
|
33
|
+
body: null | Record<string, any> | string;
|
|
34
|
+
headers: IncomingHttpHeaders | string[] | null;
|
|
35
|
+
}
|
|
36
|
+
export class InvalidArgumentError extends UndiciError {
|
|
37
|
+
name: 'InvalidArgumentError';
|
|
38
|
+
code: 'UND_ERR_INVALID_ARG';
|
|
39
|
+
}
|
|
40
|
+
export class InvalidReturnValueError extends UndiciError {
|
|
41
|
+
name: 'InvalidReturnValueError';
|
|
42
|
+
code: 'UND_ERR_INVALID_RETURN_VALUE';
|
|
43
|
+
}
|
|
44
|
+
export class RequestAbortedError extends UndiciError {
|
|
45
|
+
name: 'AbortError';
|
|
46
|
+
code: 'UND_ERR_ABORTED';
|
|
47
|
+
}
|
|
48
|
+
export class InformationalError extends UndiciError {
|
|
49
|
+
name: 'InformationalError';
|
|
50
|
+
code: 'UND_ERR_INFO';
|
|
51
|
+
}
|
|
52
|
+
export class RequestContentLengthMismatchError extends UndiciError {
|
|
53
|
+
name: 'RequestContentLengthMismatchError';
|
|
54
|
+
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
|
|
55
|
+
}
|
|
56
|
+
export class ResponseContentLengthMismatchError extends UndiciError {
|
|
57
|
+
name: 'ResponseContentLengthMismatchError';
|
|
58
|
+
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
|
|
59
|
+
}
|
|
60
|
+
export class ClientDestroyedError extends UndiciError {
|
|
61
|
+
name: 'ClientDestroyedError';
|
|
62
|
+
code: 'UND_ERR_DESTROYED';
|
|
63
|
+
}
|
|
64
|
+
export class ClientClosedError extends UndiciError {
|
|
65
|
+
name: 'ClientClosedError';
|
|
66
|
+
code: 'UND_ERR_CLOSED';
|
|
67
|
+
}
|
|
68
|
+
export class SocketError extends UndiciError {
|
|
69
|
+
name: 'SocketError';
|
|
70
|
+
code: 'UND_ERR_SOCKET';
|
|
71
|
+
socket: Client.SocketInfo | null;
|
|
72
|
+
}
|
|
73
|
+
export class NotSupportedError extends UndiciError {
|
|
74
|
+
name: 'NotSupportedError';
|
|
75
|
+
code: 'UND_ERR_NOT_SUPPORTED';
|
|
76
|
+
}
|
|
77
|
+
export class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
78
|
+
name: 'MissingUpstreamError';
|
|
79
|
+
code: 'UND_ERR_BPL_MISSING_UPSTREAM';
|
|
80
|
+
}
|
|
81
|
+
export class HTTPParserError extends UndiciError {
|
|
82
|
+
name: 'HTTPParserError';
|
|
83
|
+
code: string;
|
|
84
|
+
}
|
|
85
|
+
export class ResponseExceededMaxSizeError extends UndiciError {
|
|
86
|
+
name: 'ResponseExceededMaxSizeError';
|
|
87
|
+
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
|
|
88
|
+
}
|
|
89
|
+
export class RequestRetryError extends UndiciError {
|
|
90
|
+
constructor(message: string, statusCode: number, headers?: IncomingHttpHeaders | string[] | null, body?: null | Record<string, any> | string);
|
|
91
|
+
name: 'RequestRetryError';
|
|
92
|
+
code: 'UND_ERR_REQ_RETRY';
|
|
93
|
+
statusCode: number;
|
|
94
|
+
data: {
|
|
95
|
+
count: number;
|
|
96
|
+
};
|
|
97
|
+
headers: Record<string, string | string[]>;
|
|
98
|
+
}
|
|
99
|
+
export class SecureProxyConnectionError extends UndiciError {
|
|
100
|
+
constructor(cause?: Error, message?: string, options?: Record<any, any>);
|
|
101
|
+
name: 'SecureProxyConnectionError';
|
|
102
|
+
code: 'UND_ERR_PRX_TLS';
|
|
103
|
+
}
|
|
104
|
+
export class MaxOriginsReachedError extends UndiciError {
|
|
105
|
+
name: 'MaxOriginsReachedError';
|
|
106
|
+
code: 'UND_ERR_MAX_ORIGINS_REACHED';
|
|
107
|
+
}
|
|
108
|
+
export class Socks5ProxyError extends UndiciError {
|
|
109
|
+
constructor(message?: string, code?: string);
|
|
110
|
+
name: 'Socks5ProxyError';
|
|
111
|
+
code: string;
|
|
112
|
+
}
|
|
113
|
+
export class MessageSizeExceededError extends UndiciError {
|
|
114
|
+
name: 'MessageSizeExceededError';
|
|
115
|
+
code: 'UND_ERR_WS_MESSAGE_SIZE_EXCEEDED';
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MessageEvent, ErrorEvent } from './websocket';
|
|
2
|
+
import Dispatcher from './dispatcher';
|
|
3
|
+
import { EventListenerOptions, AddEventListenerOptions, EventListenerOrEventListenerObject } from './patch';
|
|
4
|
+
interface EventSourceEventMap {
|
|
5
|
+
error: ErrorEvent;
|
|
6
|
+
message: MessageEvent;
|
|
7
|
+
open: Event;
|
|
8
|
+
}
|
|
9
|
+
interface EventSource extends EventTarget {
|
|
10
|
+
close(): void;
|
|
11
|
+
readonly CLOSED: 2;
|
|
12
|
+
readonly CONNECTING: 0;
|
|
13
|
+
readonly OPEN: 1;
|
|
14
|
+
onerror: ((this: EventSource, ev: ErrorEvent) => any) | null;
|
|
15
|
+
onmessage: ((this: EventSource, ev: MessageEvent) => any) | null;
|
|
16
|
+
onopen: ((this: EventSource, ev: Event) => any) | null;
|
|
17
|
+
readonly readyState: 0 | 1 | 2;
|
|
18
|
+
readonly url: string;
|
|
19
|
+
readonly withCredentials: boolean;
|
|
20
|
+
addEventListener<K extends keyof EventSourceEventMap>(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
21
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
22
|
+
removeEventListener<K extends keyof EventSourceEventMap>(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
23
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
24
|
+
}
|
|
25
|
+
export declare const EventSource: {
|
|
26
|
+
prototype: EventSource;
|
|
27
|
+
new (url: string | URL, init?: EventSourceInit): EventSource;
|
|
28
|
+
readonly CLOSED: 2;
|
|
29
|
+
readonly CONNECTING: 0;
|
|
30
|
+
readonly OPEN: 1;
|
|
31
|
+
};
|
|
32
|
+
interface EventSourceInit {
|
|
33
|
+
withCredentials?: boolean;
|
|
34
|
+
dispatcher?: Dispatcher;
|
|
35
|
+
node?: {
|
|
36
|
+
dispatcher?: Dispatcher;
|
|
37
|
+
reconnectionTime?: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/// <reference path="../node/index.d.ts" />
|
|
2
|
+
import { Blob } from 'node:buffer';
|
|
3
|
+
import { URL, URLSearchParams } from 'node:url';
|
|
4
|
+
import { ReadableStream } from 'node:stream/web';
|
|
5
|
+
import { FormData } from './formdata';
|
|
6
|
+
import { HeaderRecord } from './header';
|
|
7
|
+
import Dispatcher from './dispatcher';
|
|
8
|
+
export type RequestInfo = string | URL | Request;
|
|
9
|
+
export declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
10
|
+
export type BodyInit = ArrayBuffer | AsyncIterable<Uint8Array> | Blob | FormData | Iterable<Uint8Array> | NodeJS.ArrayBufferView | URLSearchParams | null | string;
|
|
11
|
+
export class BodyMixin {
|
|
12
|
+
readonly body: ReadableStream | null;
|
|
13
|
+
readonly bodyUsed: boolean;
|
|
14
|
+
readonly arrayBuffer: () => Promise<ArrayBuffer>;
|
|
15
|
+
readonly blob: () => Promise<Blob>;
|
|
16
|
+
readonly bytes: () => Promise<Uint8Array>;
|
|
17
|
+
readonly formData: () => Promise<FormData>;
|
|
18
|
+
readonly json: () => Promise<unknown>;
|
|
19
|
+
readonly text: () => Promise<string>;
|
|
20
|
+
}
|
|
21
|
+
export interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
22
|
+
next(...args: [
|
|
23
|
+
] | [
|
|
24
|
+
TNext
|
|
25
|
+
]): IteratorResult<T, TReturn>;
|
|
26
|
+
}
|
|
27
|
+
export interface SpecIterableIterator<T> extends SpecIterator<T> {
|
|
28
|
+
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
29
|
+
}
|
|
30
|
+
export interface SpecIterable<T> {
|
|
31
|
+
[Symbol.iterator](): SpecIterator<T>;
|
|
32
|
+
}
|
|
33
|
+
export type HeadersInit = [
|
|
34
|
+
string,
|
|
35
|
+
string
|
|
36
|
+
][] | HeaderRecord | Headers;
|
|
37
|
+
export declare class Headers implements SpecIterable<[
|
|
38
|
+
string,
|
|
39
|
+
string
|
|
40
|
+
]> {
|
|
41
|
+
constructor(init?: HeadersInit);
|
|
42
|
+
readonly append: (name: string, value: string) => void;
|
|
43
|
+
readonly delete: (name: string) => void;
|
|
44
|
+
readonly get: (name: string) => string | null;
|
|
45
|
+
readonly has: (name: string) => boolean;
|
|
46
|
+
readonly set: (name: string, value: string) => void;
|
|
47
|
+
readonly getSetCookie: () => string[];
|
|
48
|
+
readonly forEach: (callbackfn: (value: string, key: string, iterable: Headers) => void, thisArg?: unknown) => void;
|
|
49
|
+
readonly keys: () => SpecIterableIterator<string>;
|
|
50
|
+
readonly values: () => SpecIterableIterator<string>;
|
|
51
|
+
readonly entries: () => SpecIterableIterator<[
|
|
52
|
+
string,
|
|
53
|
+
string
|
|
54
|
+
]>;
|
|
55
|
+
readonly [Symbol.iterator]: () => SpecIterableIterator<[
|
|
56
|
+
string,
|
|
57
|
+
string
|
|
58
|
+
]>;
|
|
59
|
+
}
|
|
60
|
+
export type RequestCache = 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
|
|
61
|
+
export type RequestCredentials = 'omit' | 'include' | 'same-origin';
|
|
62
|
+
type RequestDestination = '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
|
|
63
|
+
export interface RequestInit {
|
|
64
|
+
body?: BodyInit | null;
|
|
65
|
+
cache?: RequestCache;
|
|
66
|
+
credentials?: RequestCredentials;
|
|
67
|
+
dispatcher?: Dispatcher;
|
|
68
|
+
duplex?: RequestDuplex;
|
|
69
|
+
headers?: HeadersInit;
|
|
70
|
+
integrity?: string;
|
|
71
|
+
keepalive?: boolean;
|
|
72
|
+
method?: string;
|
|
73
|
+
mode?: RequestMode;
|
|
74
|
+
redirect?: RequestRedirect;
|
|
75
|
+
referrer?: string;
|
|
76
|
+
referrerPolicy?: ReferrerPolicy;
|
|
77
|
+
signal?: AbortSignal | null;
|
|
78
|
+
window?: null;
|
|
79
|
+
}
|
|
80
|
+
export type ReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
|
81
|
+
export type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin';
|
|
82
|
+
export type RequestRedirect = 'error' | 'follow' | 'manual';
|
|
83
|
+
export type RequestDuplex = 'half';
|
|
84
|
+
export declare class Request extends BodyMixin {
|
|
85
|
+
constructor(input: RequestInfo, init?: RequestInit);
|
|
86
|
+
readonly cache: RequestCache;
|
|
87
|
+
readonly credentials: RequestCredentials;
|
|
88
|
+
readonly destination: RequestDestination;
|
|
89
|
+
readonly headers: Headers;
|
|
90
|
+
readonly integrity: string;
|
|
91
|
+
readonly method: string;
|
|
92
|
+
readonly mode: RequestMode;
|
|
93
|
+
readonly redirect: RequestRedirect;
|
|
94
|
+
readonly referrer: string;
|
|
95
|
+
readonly referrerPolicy: ReferrerPolicy;
|
|
96
|
+
readonly url: string;
|
|
97
|
+
readonly keepalive: boolean;
|
|
98
|
+
readonly signal: AbortSignal;
|
|
99
|
+
readonly duplex: RequestDuplex;
|
|
100
|
+
readonly clone: () => Request;
|
|
101
|
+
}
|
|
102
|
+
export interface ResponseInit {
|
|
103
|
+
readonly status?: number;
|
|
104
|
+
readonly statusText?: string;
|
|
105
|
+
readonly headers?: HeadersInit;
|
|
106
|
+
}
|
|
107
|
+
export type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
|
|
108
|
+
export type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308;
|
|
109
|
+
export declare class Response extends BodyMixin {
|
|
110
|
+
constructor(body?: BodyInit, init?: ResponseInit);
|
|
111
|
+
readonly headers: Headers;
|
|
112
|
+
readonly ok: boolean;
|
|
113
|
+
readonly status: number;
|
|
114
|
+
readonly statusText: string;
|
|
115
|
+
readonly type: ResponseType;
|
|
116
|
+
readonly url: string;
|
|
117
|
+
readonly redirected: boolean;
|
|
118
|
+
readonly clone: () => Response;
|
|
119
|
+
static error(): Response;
|
|
120
|
+
static json(data: any, init?: ResponseInit): Response;
|
|
121
|
+
static redirect(url: string | URL, status?: ResponseRedirectStatus): Response;
|
|
122
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference path="../node/index.d.ts" />
|
|
2
|
+
import { File } from 'node:buffer';
|
|
3
|
+
import { SpecIterableIterator } from './fetch';
|
|
4
|
+
declare type FormDataEntryValue = string | File;
|
|
5
|
+
export declare class FormData {
|
|
6
|
+
append(name: string, value: unknown, fileName?: string): void;
|
|
7
|
+
set(name: string, value: unknown, fileName?: string): void;
|
|
8
|
+
get(name: string): FormDataEntryValue | null;
|
|
9
|
+
getAll(name: string): FormDataEntryValue[];
|
|
10
|
+
has(name: string): boolean;
|
|
11
|
+
delete(name: string): void;
|
|
12
|
+
forEach: (callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void, thisArg?: unknown) => void;
|
|
13
|
+
keys: () => SpecIterableIterator<string>;
|
|
14
|
+
values: () => SpecIterableIterator<FormDataEntryValue>;
|
|
15
|
+
entries: () => SpecIterableIterator<[
|
|
16
|
+
string,
|
|
17
|
+
FormDataEntryValue
|
|
18
|
+
]>;
|
|
19
|
+
[Symbol.iterator]: () => SpecIterableIterator<[
|
|
20
|
+
string,
|
|
21
|
+
FormDataEntryValue
|
|
22
|
+
]>;
|
|
23
|
+
readonly [Symbol.toStringTag]: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Dispatcher from './dispatcher';
|
|
2
|
+
declare function setGlobalDispatcher<DispatcherImplementation extends Dispatcher>(dispatcher: DispatcherImplementation): void;
|
|
3
|
+
declare function getGlobalDispatcher(): Dispatcher;
|
|
4
|
+
export { getGlobalDispatcher, setGlobalDispatcher };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { URL } from 'node:url';
|
|
2
|
+
import Dispatcher from './dispatcher';
|
|
3
|
+
import buildConnector from './connector';
|
|
4
|
+
type H2ClientOptions = Omit<Dispatcher.ConnectOptions, 'origin'>;
|
|
5
|
+
export class H2CClient extends Dispatcher {
|
|
6
|
+
constructor(url: string | URL, options?: H2CClient.Options);
|
|
7
|
+
pipelining: number;
|
|
8
|
+
closed: boolean;
|
|
9
|
+
destroyed: boolean;
|
|
10
|
+
override connect(options: H2ClientOptions): Promise<Dispatcher.ConnectData>;
|
|
11
|
+
override connect(options: H2ClientOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace H2CClient {
|
|
14
|
+
export interface Options {
|
|
15
|
+
maxHeaderSize?: number;
|
|
16
|
+
headersTimeout?: number;
|
|
17
|
+
connectTimeout?: number;
|
|
18
|
+
bodyTimeout?: number;
|
|
19
|
+
keepAliveTimeout?: number;
|
|
20
|
+
keepAliveMaxTimeout?: number;
|
|
21
|
+
keepAliveTimeoutThreshold?: number;
|
|
22
|
+
socketPath?: string;
|
|
23
|
+
pipelining?: number;
|
|
24
|
+
strictContentLength?: boolean;
|
|
25
|
+
maxCachedSessions?: number;
|
|
26
|
+
connect?: Omit<Partial<buildConnector.BuildOptions>, 'allowH2'> | buildConnector.connector;
|
|
27
|
+
maxRequestsPerClient?: number;
|
|
28
|
+
localAddress?: string;
|
|
29
|
+
maxResponseSize?: number;
|
|
30
|
+
autoSelectFamily?: boolean;
|
|
31
|
+
autoSelectFamilyAttemptTimeout?: number;
|
|
32
|
+
maxConcurrentStreams?: number;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export default H2CClient;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Dispatcher from './dispatcher';
|
|
2
|
+
export declare class RedirectHandler implements Dispatcher.DispatchHandler {
|
|
3
|
+
constructor(dispatch: Dispatcher.Dispatch, maxRedirections: number, opts: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler, redirectionLimitReached: boolean);
|
|
4
|
+
}
|
|
5
|
+
export declare class DecoratorHandler implements Dispatcher.DispatchHandler {
|
|
6
|
+
constructor(handler: Dispatcher.DispatchHandler);
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Autocomplete } from './utility';
|
|
2
|
+
export type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
3
|
+
type HeaderNames = Autocomplete<'Accept' | 'Accept-CH' | 'Accept-Charset' | 'Accept-Encoding' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Age' | 'Allow' | 'Alt-Svc' | 'Alt-Used' | 'Authorization' | 'Cache-Control' | 'Clear-Site-Data' | 'Connection' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'Device-Memory' | 'ETag' | 'Expect' | 'Expect-CT' | 'Expires' | 'Forwarded' | 'From' | 'Host' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Unmodified-Since' | 'Keep-Alive' | 'Last-Modified' | 'Link' | 'Location' | 'Max-Forwards' | 'Origin' | 'Permissions-Policy' | 'Priority' | 'Proxy-Authenticate' | 'Proxy-Authorization' | 'Range' | 'Referer' | 'Referrer-Policy' | 'Retry-After' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-Purpose' | 'Sec-WebSocket-Accept' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'SourceMap' | 'Strict-Transport-Security' | 'TE' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Upgrade-Insecure-Requests' | 'User-Agent' | 'Vary' | 'Via' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-Frame-Options'>;
|
|
4
|
+
type IANARegisteredMimeType = Autocomplete<'audio/aac' | 'video/x-msvideo' | 'image/avif' | 'video/av1' | 'application/octet-stream' | 'image/bmp' | 'text/css' | 'text/csv' | 'application/vnd.ms-fontobject' | 'application/epub+zip' | 'image/gif' | 'application/gzip' | 'text/html' | 'image/x-icon' | 'text/calendar' | 'image/jpeg' | 'text/javascript' | 'application/json' | 'application/ld+json' | 'audio/x-midi' | 'audio/mpeg' | 'video/mp4' | 'video/mpeg' | 'audio/ogg' | 'video/ogg' | 'application/ogg' | 'audio/opus' | 'font/otf' | 'application/pdf' | 'image/png' | 'application/rtf' | 'image/svg+xml' | 'image/tiff' | 'video/mp2t' | 'font/ttf' | 'text/plain' | 'application/wasm' | 'video/webm' | 'audio/webm' | 'image/webp' | 'font/woff' | 'font/woff2' | 'application/xhtml+xml' | 'application/xml' | 'application/zip' | 'video/3gpp' | 'video/3gpp2' | 'model/gltf+json' | 'model/gltf-binary'>;
|
|
5
|
+
type KnownHeaderValues = {
|
|
6
|
+
'content-type': IANARegisteredMimeType;
|
|
7
|
+
};
|
|
8
|
+
export type HeaderRecord = {
|
|
9
|
+
[K in HeaderNames | Lowercase<HeaderNames>]?: Lowercase<K> extends keyof KnownHeaderValues ? KnownHeaderValues[Lowercase<K>] : string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import Dispatcher from './dispatcher';
|
|
2
|
+
import { setGlobalDispatcher, getGlobalDispatcher } from './global-dispatcher';
|
|
3
|
+
import { setGlobalOrigin, getGlobalOrigin } from './global-origin';
|
|
4
|
+
import Pool from './pool';
|
|
5
|
+
import { RedirectHandler, DecoratorHandler } from './handlers';
|
|
6
|
+
import BalancedPool from './balanced-pool';
|
|
7
|
+
import RoundRobinPool from './round-robin-pool';
|
|
8
|
+
import Client from './client';
|
|
9
|
+
import H2CClient from './h2c-client';
|
|
10
|
+
import buildConnector from './connector';
|
|
11
|
+
import errors from './errors';
|
|
12
|
+
import Agent from './agent';
|
|
13
|
+
import MockClient from './mock-client';
|
|
14
|
+
import MockPool from './mock-pool';
|
|
15
|
+
import MockAgent from './mock-agent';
|
|
16
|
+
import { SnapshotAgent } from './snapshot-agent';
|
|
17
|
+
import { MockCallHistory, MockCallHistoryLog } from './mock-call-history';
|
|
18
|
+
import mockErrors from './mock-errors';
|
|
19
|
+
import ProxyAgent from './proxy-agent';
|
|
20
|
+
import Socks5ProxyAgent from './socks5-proxy-agent';
|
|
21
|
+
import EnvHttpProxyAgent from './env-http-proxy-agent';
|
|
22
|
+
import RetryHandler from './retry-handler';
|
|
23
|
+
import RetryAgent from './retry-agent';
|
|
24
|
+
import { request, pipeline, stream, connect, upgrade } from './api';
|
|
25
|
+
import interceptors from './interceptors';
|
|
26
|
+
import CacheInterceptor from './cache-interceptor';
|
|
27
|
+
declare const cacheStores: {
|
|
28
|
+
MemoryCacheStore: typeof CacheInterceptor.MemoryCacheStore;
|
|
29
|
+
SqliteCacheStore: typeof CacheInterceptor.SqliteCacheStore;
|
|
30
|
+
};
|
|
31
|
+
export * from './util';
|
|
32
|
+
export * from './cookies';
|
|
33
|
+
export * from './eventsource';
|
|
34
|
+
export * from './fetch';
|
|
35
|
+
export * from './formdata';
|
|
36
|
+
export * from './diagnostics-channel';
|
|
37
|
+
export * from './websocket';
|
|
38
|
+
export * from './content-type';
|
|
39
|
+
export * from './cache';
|
|
40
|
+
export { Interceptable } from './mock-interceptor';
|
|
41
|
+
declare function globalThisInstall(): void;
|
|
42
|
+
export { Dispatcher, BalancedPool, RoundRobinPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, cacheStores, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, Socks5ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install };
|
|
43
|
+
export default Undici;
|
|
44
|
+
declare namespace Undici {
|
|
45
|
+
const Dispatcher: typeof import('./dispatcher').default;
|
|
46
|
+
const Pool: typeof import('./pool').default;
|
|
47
|
+
const RedirectHandler: typeof import('./handlers').RedirectHandler;
|
|
48
|
+
const DecoratorHandler: typeof import('./handlers').DecoratorHandler;
|
|
49
|
+
const RetryHandler: typeof import('./retry-handler').default;
|
|
50
|
+
const BalancedPool: typeof import('./balanced-pool').default;
|
|
51
|
+
const RoundRobinPool: typeof import('./round-robin-pool').default;
|
|
52
|
+
const Client: typeof import('./client').default;
|
|
53
|
+
const H2CClient: typeof import('./h2c-client').default;
|
|
54
|
+
const buildConnector: typeof import('./connector').default;
|
|
55
|
+
const errors: typeof import('./errors').default;
|
|
56
|
+
const Agent: typeof import('./agent').default;
|
|
57
|
+
const setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher;
|
|
58
|
+
const getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher;
|
|
59
|
+
const request: typeof import('./api').request;
|
|
60
|
+
const stream: typeof import('./api').stream;
|
|
61
|
+
const pipeline: typeof import('./api').pipeline;
|
|
62
|
+
const connect: typeof import('./api').connect;
|
|
63
|
+
const upgrade: typeof import('./api').upgrade;
|
|
64
|
+
const MockClient: typeof import('./mock-client').default;
|
|
65
|
+
const MockPool: typeof import('./mock-pool').default;
|
|
66
|
+
const MockAgent: typeof import('./mock-agent').default;
|
|
67
|
+
const SnapshotAgent: typeof import('./snapshot-agent').SnapshotAgent;
|
|
68
|
+
const MockCallHistory: typeof import('./mock-call-history').MockCallHistory;
|
|
69
|
+
const MockCallHistoryLog: typeof import('./mock-call-history').MockCallHistoryLog;
|
|
70
|
+
const mockErrors: typeof import('./mock-errors').default;
|
|
71
|
+
const ProxyAgent: typeof import('./proxy-agent').default;
|
|
72
|
+
const Socks5ProxyAgent: typeof import('./socks5-proxy-agent').default;
|
|
73
|
+
const fetch: typeof import('./fetch').fetch;
|
|
74
|
+
const Headers: typeof import('./fetch').Headers;
|
|
75
|
+
const Response: typeof import('./fetch').Response;
|
|
76
|
+
const Request: typeof import('./fetch').Request;
|
|
77
|
+
const FormData: typeof import('./formdata').FormData;
|
|
78
|
+
const caches: typeof import('./cache').caches;
|
|
79
|
+
const interceptors: typeof import('./interceptors').default;
|
|
80
|
+
const cacheStores: {
|
|
81
|
+
MemoryCacheStore: typeof import('./cache-interceptor').default.MemoryCacheStore;
|
|
82
|
+
SqliteCacheStore: typeof import('./cache-interceptor').default.SqliteCacheStore;
|
|
83
|
+
};
|
|
84
|
+
const install: typeof globalThisInstall;
|
|
85
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import CacheHandler from './cache-interceptor';
|
|
2
|
+
import Dispatcher from './dispatcher';
|
|
3
|
+
import RetryHandler from './retry-handler';
|
|
4
|
+
import { LookupOptions } from 'node:dns';
|
|
5
|
+
export default Interceptors;
|
|
6
|
+
declare namespace Interceptors {
|
|
7
|
+
export type DumpInterceptorOpts = {
|
|
8
|
+
maxSize?: number;
|
|
9
|
+
};
|
|
10
|
+
export type RetryInterceptorOpts = RetryHandler.RetryOptions;
|
|
11
|
+
export type RedirectInterceptorOpts = {
|
|
12
|
+
maxRedirections?: number;
|
|
13
|
+
};
|
|
14
|
+
export type DecompressInterceptorOpts = {
|
|
15
|
+
skipErrorResponses?: boolean;
|
|
16
|
+
skipStatusCodes?: number[];
|
|
17
|
+
};
|
|
18
|
+
export type ResponseErrorInterceptorOpts = {
|
|
19
|
+
throwOnError: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type CacheInterceptorOpts = CacheHandler.CacheOptions;
|
|
22
|
+
export type DNSInterceptorRecord = {
|
|
23
|
+
address: string;
|
|
24
|
+
ttl: number;
|
|
25
|
+
family: 4 | 6;
|
|
26
|
+
};
|
|
27
|
+
export type DNSInterceptorOriginRecords = {
|
|
28
|
+
records: {
|
|
29
|
+
4: {
|
|
30
|
+
ips: DNSInterceptorRecord[];
|
|
31
|
+
} | null;
|
|
32
|
+
6: {
|
|
33
|
+
ips: DNSInterceptorRecord[];
|
|
34
|
+
} | null;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export type DNSStorage = {
|
|
38
|
+
size: number;
|
|
39
|
+
get(origin: string): DNSInterceptorOriginRecords | null;
|
|
40
|
+
set(origin: string, records: DNSInterceptorOriginRecords | null, options: {
|
|
41
|
+
ttl: number;
|
|
42
|
+
}): void;
|
|
43
|
+
delete(origin: string): void;
|
|
44
|
+
full(): boolean;
|
|
45
|
+
};
|
|
46
|
+
export type DNSInterceptorOpts = {
|
|
47
|
+
maxTTL?: number;
|
|
48
|
+
maxItems?: number;
|
|
49
|
+
lookup?: (origin: URL, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void;
|
|
50
|
+
pick?: (origin: URL, records: DNSInterceptorOriginRecords, affinity: 4 | 6) => DNSInterceptorRecord;
|
|
51
|
+
dualStack?: boolean;
|
|
52
|
+
affinity?: 4 | 6;
|
|
53
|
+
storage?: DNSStorage;
|
|
54
|
+
};
|
|
55
|
+
export type DeduplicateMethods = 'GET' | 'HEAD' | 'OPTIONS' | 'TRACE';
|
|
56
|
+
export type DeduplicateInterceptorOpts = {
|
|
57
|
+
methods?: DeduplicateMethods[];
|
|
58
|
+
skipHeaderNames?: string[];
|
|
59
|
+
excludeHeaderNames?: string[];
|
|
60
|
+
maxBufferSize?: number;
|
|
61
|
+
};
|
|
62
|
+
export function dump(opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor;
|
|
63
|
+
export function retry(opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor;
|
|
64
|
+
export function redirect(opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor;
|
|
65
|
+
export function decompress(opts?: DecompressInterceptorOpts): Dispatcher.DispatcherComposeInterceptor;
|
|
66
|
+
export function responseError(opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor;
|
|
67
|
+
export function dns(opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor;
|
|
68
|
+
export function cache(opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor;
|
|
69
|
+
export function deduplicate(opts?: DeduplicateInterceptorOpts): Dispatcher.DispatcherComposeInterceptor;
|
|
70
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
export default MockAgent;
|
|
7
|
+
interface PendingInterceptor extends MockDispatch {
|
|
8
|
+
origin: string;
|
|
9
|
+
}
|
|
10
|
+
declare class MockAgent<TMockAgentOptions extends MockAgent.Options = MockAgent.Options> extends Dispatcher {
|
|
11
|
+
constructor(options?: TMockAgentOptions);
|
|
12
|
+
get<TInterceptable extends Interceptable>(origin: string): TInterceptable;
|
|
13
|
+
get<TInterceptable extends Interceptable>(origin: RegExp): TInterceptable;
|
|
14
|
+
get<TInterceptable extends Interceptable>(origin: ((origin: string) => boolean)): TInterceptable;
|
|
15
|
+
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
deactivate(): void;
|
|
18
|
+
activate(): void;
|
|
19
|
+
enableNetConnect(): void;
|
|
20
|
+
enableNetConnect(host: string): void;
|
|
21
|
+
enableNetConnect(host: RegExp): void;
|
|
22
|
+
enableNetConnect(host: ((host: string) => boolean)): void;
|
|
23
|
+
disableNetConnect(): void;
|
|
24
|
+
getCallHistory(): MockCallHistory | undefined;
|
|
25
|
+
clearCallHistory(): void;
|
|
26
|
+
enableCallHistory(): this;
|
|
27
|
+
disableCallHistory(): this;
|
|
28
|
+
pendingInterceptors(): PendingInterceptor[];
|
|
29
|
+
assertNoPendingInterceptors(options?: {
|
|
30
|
+
pendingInterceptorsFormatter?: PendingInterceptorsFormatter;
|
|
31
|
+
}): void;
|
|
32
|
+
}
|
|
33
|
+
interface PendingInterceptorsFormatter {
|
|
34
|
+
format(pendingInterceptors: readonly PendingInterceptor[]): string;
|
|
35
|
+
}
|
|
36
|
+
declare namespace MockAgent {
|
|
37
|
+
export interface Options extends Agent.Options {
|
|
38
|
+
agent?: Dispatcher;
|
|
39
|
+
ignoreTrailingSlash?: boolean;
|
|
40
|
+
acceptNonStandardSearchParameters?: boolean;
|
|
41
|
+
enableCallHistory?: boolean;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import Dispatcher from './dispatcher';
|
|
2
|
+
declare namespace MockCallHistoryLog {
|
|
3
|
+
export type MockCallHistoryLogProperties = 'protocol' | 'host' | 'port' | 'origin' | 'path' | 'hash' | 'fullUrl' | 'method' | 'searchParams' | 'body' | 'headers';
|
|
4
|
+
}
|
|
5
|
+
declare class MockCallHistoryLog {
|
|
6
|
+
constructor(requestInit: Dispatcher.DispatchOptions);
|
|
7
|
+
protocol: string;
|
|
8
|
+
host: string;
|
|
9
|
+
port: string;
|
|
10
|
+
origin: string;
|
|
11
|
+
path: string;
|
|
12
|
+
hash: string;
|
|
13
|
+
fullUrl: string;
|
|
14
|
+
method: string;
|
|
15
|
+
searchParams: Record<string, string>;
|
|
16
|
+
body: string | null | undefined;
|
|
17
|
+
headers: Record<string, string | string[]> | null | undefined;
|
|
18
|
+
toMap(): Map<MockCallHistoryLog.MockCallHistoryLogProperties, string | Record<string, string | string[]> | null | undefined>;
|
|
19
|
+
toString(): string;
|
|
20
|
+
}
|
|
21
|
+
declare namespace MockCallHistory {
|
|
22
|
+
export type FilterCallsOperator = 'AND' | 'OR';
|
|
23
|
+
export interface FilterCallsOptions {
|
|
24
|
+
operator?: FilterCallsOperator | Lowercase<FilterCallsOperator>;
|
|
25
|
+
}
|
|
26
|
+
export type FilterCallsFunctionCriteria = (log: MockCallHistoryLog) => boolean;
|
|
27
|
+
export type FilterCallsParameter = string | RegExp | undefined | null;
|
|
28
|
+
export interface FilterCallsObjectCriteria extends Record<string, FilterCallsParameter> {
|
|
29
|
+
protocol?: FilterCallsParameter;
|
|
30
|
+
host?: FilterCallsParameter;
|
|
31
|
+
port?: FilterCallsParameter;
|
|
32
|
+
origin?: FilterCallsParameter;
|
|
33
|
+
path?: FilterCallsParameter;
|
|
34
|
+
hash?: FilterCallsParameter;
|
|
35
|
+
fullUrl?: FilterCallsParameter;
|
|
36
|
+
method?: FilterCallsParameter;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
declare class MockCallHistory {
|
|
40
|
+
constructor(name: string);
|
|
41
|
+
calls(): Array<MockCallHistoryLog>;
|
|
42
|
+
firstCall(): MockCallHistoryLog | undefined;
|
|
43
|
+
lastCall(): MockCallHistoryLog | undefined;
|
|
44
|
+
nthCall(position: number): MockCallHistoryLog | undefined;
|
|
45
|
+
filterCalls(criteria: MockCallHistory.FilterCallsFunctionCriteria | MockCallHistory.FilterCallsObjectCriteria | RegExp, options?: MockCallHistory.FilterCallsOptions): Array<MockCallHistoryLog>;
|
|
46
|
+
filterCallsByProtocol(protocol: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>;
|
|
47
|
+
filterCallsByHost(host: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>;
|
|
48
|
+
filterCallsByPort(port: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>;
|
|
49
|
+
filterCallsByOrigin(origin: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>;
|
|
50
|
+
filterCallsByPath(path: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>;
|
|
51
|
+
filterCallsByHash(hash: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>;
|
|
52
|
+
filterCallsByFullUrl(fullUrl: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>;
|
|
53
|
+
filterCallsByMethod(method: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>;
|
|
54
|
+
clear(): void;
|
|
55
|
+
[Symbol.iterator]: () => Generator<MockCallHistoryLog>;
|
|
56
|
+
}
|
|
57
|
+
export { MockCallHistoryLog, MockCallHistory };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Client from './client';
|
|
2
|
+
import Dispatcher from './dispatcher';
|
|
3
|
+
import MockAgent from './mock-agent';
|
|
4
|
+
import { MockInterceptor, Interceptable } from './mock-interceptor';
|
|
5
|
+
export default MockClient;
|
|
6
|
+
declare class MockClient extends Client implements Interceptable {
|
|
7
|
+
constructor(origin: string, options: MockClient.Options);
|
|
8
|
+
intercept(options: MockInterceptor.Options): MockInterceptor;
|
|
9
|
+
dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandler): boolean;
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
cleanMocks(): void;
|
|
12
|
+
}
|
|
13
|
+
declare namespace MockClient {
|
|
14
|
+
export interface Options extends Client.Options {
|
|
15
|
+
agent: MockAgent;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Errors from './errors';
|
|
2
|
+
export default MockErrors;
|
|
3
|
+
declare namespace MockErrors {
|
|
4
|
+
export class MockNotMatchedError extends Errors.UndiciError {
|
|
5
|
+
constructor(message?: string);
|
|
6
|
+
name: 'MockNotMatchedError';
|
|
7
|
+
code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED';
|
|
8
|
+
}
|
|
9
|
+
}
|