@runlith/tagma 0.0.0-stage → 0.2.3
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 +134 -3
- package/plugin/Held-cvetk2wg.js +6 -0
- package/plugin/accountKey-t44g9avw.js +2 -0
- package/plugin/adapter-qdnpxs6n.js +1 -0
- package/plugin/anthropic-a4pdzrv2.js +2 -0
- package/plugin/anthropic-messages-svq0svwe.js +2 -0
- package/plugin/anthropic-q1xa9n0j.js +2 -0
- package/plugin/auth-cp8wnd0z.js +2 -0
- package/plugin/authStatus-d6scztz5.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-q2asby82.js +16 -0
- package/plugin/capabilities-jfhf61dt.js +2 -0
- package/plugin/claudeHooks-edpg1e46.js +3 -0
- package/plugin/cli.js +21 -0
- package/plugin/cliStore-5s0qerr7.js +2 -0
- package/plugin/clientSession-tmmxm39z.js +2 -0
- package/plugin/codec-aa8mxqyr.js +1 -0
- package/plugin/connect-d7ec6kfh.js +2 -0
- package/plugin/contract-qn0z7r9c.js +1 -0
- package/plugin/credential-garn07qc.js +2 -0
- package/plugin/deepseek-fvdrmjr9.js +2 -0
- package/plugin/deepseek-sp4vxjqy.js +2 -0
- package/plugin/definition-0h3gqd2z.js +2 -0
- package/plugin/description-8xhxryaq.js +2 -0
- package/plugin/deviceGrant-axpyc7xr.js +2 -0
- package/plugin/devin-hy98d305.js +2 -0
- package/plugin/duplex-yexjcpv2.js +2 -0
- package/plugin/endpoint-0b9bsb4q.js +2 -0
- package/plugin/errors-kck87dpv.js +2 -0
- package/plugin/events-81m69vqz.js +2 -0
- package/plugin/events-s95ybm4g.js +2 -0
- package/plugin/executor-avear8af.js +2 -0
- package/plugin/failure-ddv4456n.js +2 -0
- package/plugin/framing-jnd2zm0h.js +2 -0
- package/plugin/grant-85r3bbqn.js +2 -0
- package/plugin/harness-jm3fhnwg.js +2 -0
- package/plugin/headers-w6p5sp18.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-2dndaq8y.js +2 -0
- package/plugin/images-s2kqebfv.js +2 -0
- package/plugin/index-b3yp4szm.js +2 -0
- package/plugin/index-xs7nfsck.js +2 -0
- package/plugin/lifecycle-er51apxp.js +2 -0
- package/plugin/manual-2mdscj84.js +2 -0
- package/plugin/messages-gmwcg1pq.js +2 -0
- package/plugin/metadata-gpazs3f5.js +4 -0
- package/plugin/muse-g8bc58v8.js +2 -0
- package/plugin/muse-tfe6sph7.js +2 -0
- package/plugin/museToolSchema-tbe0f3wa.js +2 -0
- package/plugin/notes-5m0m3pdr.js +2 -0
- package/plugin/object-9pjtdam7.js +2 -0
- package/plugin/open-browser-vqb7ckt1.js +2 -0
- package/plugin/openai-6f50tf64.js +2 -0
- package/plugin/openai-compatible-chat-eez8hkge.js +2 -0
- package/plugin/openai-images-haszbnft.js +2 -0
- package/plugin/openai-mfqwg6pa.js +2 -0
- package/plugin/openai-responses-1gpyp640.js +2 -0
- package/plugin/opencodeGo-1wgdjtjz.js +3 -0
- package/plugin/opencodeGo-qgw3pfg6.js +2 -0
- package/plugin/options-476akxaj.js +2 -0
- package/plugin/payload-2gr4q9g8.js +2 -0
- package/plugin/pkce-y3sh5pk8.js +2 -0
- package/plugin/plugin-0e34qaar.js +3 -0
- package/plugin/plugin-1vpp5mqk.js +4 -0
- package/plugin/plugin-1zkx860n.js +3 -0
- package/plugin/plugin-217mw9ck.js +3 -0
- package/plugin/plugin-24j9hnc7.js +3 -0
- package/plugin/plugin-2s6bq45c.js +3 -0
- package/plugin/plugin-3969dy0b.js +3 -0
- package/plugin/plugin-3b8x73y6.js +3 -0
- package/plugin/plugin-3t0qp574.js +3 -0
- package/plugin/plugin-55fbx586.js +3 -0
- package/plugin/plugin-5zq084fb.js +3 -0
- package/plugin/plugin-6a56xsx3.js +3 -0
- package/plugin/plugin-6vzw5yyr.js +3 -0
- package/plugin/plugin-72xxqm1t.js +3 -0
- package/plugin/plugin-7swap1ad.js +3 -0
- package/plugin/plugin-7te9b50h.js +3 -0
- package/plugin/plugin-7xmwhj5h.js +3 -0
- package/plugin/plugin-80gqwmjy.js +3 -0
- package/plugin/plugin-8g8myq9g.js +3 -0
- package/plugin/plugin-8q44b578.js +3 -0
- package/plugin/plugin-8v4g0q0b.js +3 -0
- package/plugin/plugin-8x3c401q.js +9 -0
- package/plugin/plugin-92sxs4r1.js +3 -0
- package/plugin/plugin-9gha9fx3.js +3 -0
- package/plugin/plugin-9zbh7788.js +3 -0
- package/plugin/plugin-a3vzpk4e.js +3 -0
- package/plugin/plugin-ak62rhwz.js +3 -0
- package/plugin/plugin-azkzdkpk.js +3 -0
- package/plugin/plugin-cydz2zhy.js +3 -0
- package/plugin/plugin-d28d8jar.js +4 -0
- package/plugin/plugin-dd951075.js +3 -0
- package/plugin/plugin-dqxdznvd.js +3 -0
- package/plugin/plugin-dsjq4tye.js +3 -0
- package/plugin/plugin-e5ybk2a2.js +3 -0
- package/plugin/plugin-eksq91yp.js +5 -0
- package/plugin/plugin-er1kc6f6.js +5 -0
- package/plugin/plugin-fjsmz1vy.js +4 -0
- package/plugin/plugin-fre9hdcg.js +3 -0
- package/plugin/plugin-g0zv4vrz.js +3 -0
- package/plugin/plugin-g4hst0jz.js +3 -0
- package/plugin/plugin-g7hrtg2p.js +3 -0
- package/plugin/plugin-gh857xdd.js +3 -0
- package/plugin/plugin-hkjxkgty.js +3 -0
- package/plugin/plugin-jxvmq18y.js +3 -0
- package/plugin/plugin-kc4z9msd.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-nzacjxf9.js +3 -0
- package/plugin/plugin-p59gy5xd.js +3 -0
- package/plugin/plugin-p6x7emar.js +3 -0
- package/plugin/plugin-pdww1ma8.js +3 -0
- package/plugin/plugin-psj9935q.js +3 -0
- package/plugin/plugin-q6pvb1xf.js +3 -0
- package/plugin/plugin-r342d8zf.js +3 -0
- package/plugin/plugin-r7g3vqrm.js +3 -0
- package/plugin/plugin-rrgyjesv.js +3 -0
- package/plugin/plugin-t4xrq5q2.js +3 -0
- package/plugin/plugin-tetj2cr3.js +3 -0
- package/plugin/plugin-v80m00bq.js +14 -0
- package/plugin/plugin-vfjhxng8.js +3 -0
- package/plugin/plugin-vqrd05eg.js +3 -0
- package/plugin/plugin-w3zbkmy6.js +3 -0
- package/plugin/plugin-w8f977my.js +3 -0
- package/plugin/plugin-xbnw80pk.js +3 -0
- package/plugin/plugin-xfcgt5ba.js +36 -0
- package/plugin/plugin-y9cdpmbv.js +6 -0
- package/plugin/plugin-yg0h5k5d.js +3 -0
- package/plugin/plugin-yp736z4n.js +3 -0
- package/plugin/plugin-zrb8bbr4.js +3 -0
- package/plugin/plugin-zsv7wawc.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-8c26dk6v.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-v63yvp13.js +2 -0
- package/plugin/quotaRead-esmjycnd.js +2 -0
- package/plugin/reasoning-1saw6tds.js +2 -0
- package/plugin/record-1m3vvy60.js +2 -0
- package/plugin/requests-2zyr1g8e.js +1 -0
- package/plugin/responseFold-xxhqx4sa.js +2 -0
- package/plugin/settings-8xq8dvhp.js +2 -0
- package/plugin/shared-4jndfh28.js +2 -0
- package/plugin/speech-067caz1a.js +2 -0
- package/plugin/stepfun-3en5g41d.js +2 -0
- package/plugin/stepfun-xp1c5wpk.js +2 -0
- package/plugin/stream-8yrr289z.js +2 -0
- package/plugin/svelteProgram-73v9yajk.js +2 -0
- package/plugin/synthesisDuplex-ch9jhqzt.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-vean6rqa.js +2 -0
- package/plugin/tool-stream-fb180jmt.js +2 -0
- package/plugin/transport-j784dsdr.js +2 -0
- package/plugin/ui.generated.d.ts +1041 -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-82evk8b3.js +2 -0
- package/plugin/vendorPayload-458354fv.js +2 -0
- package/plugin/vendorWeb-cz5t01m7.js +2 -0
- package/plugin/verbatim-2f2d9n02.js +2 -0
- package/plugin/xai-2cqraa99.js +2 -0
- package/plugin/xai-e8sbtk6a.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,98 @@
|
|
|
1
|
+
import { Readable, Writable } from 'node:stream';
|
|
2
|
+
export default CacheHandler;
|
|
3
|
+
declare namespace CacheHandler {
|
|
4
|
+
export type CacheMethods = 'GET' | 'HEAD' | 'OPTIONS' | 'TRACE';
|
|
5
|
+
export interface CacheHandlerOptions {
|
|
6
|
+
store: CacheStore;
|
|
7
|
+
cacheByDefault?: number;
|
|
8
|
+
type?: CacheOptions['type'];
|
|
9
|
+
}
|
|
10
|
+
export interface CacheOptions {
|
|
11
|
+
store?: CacheStore;
|
|
12
|
+
methods?: CacheMethods[];
|
|
13
|
+
cacheByDefault?: number;
|
|
14
|
+
type?: 'shared' | 'private';
|
|
15
|
+
origins?: (string | RegExp)[];
|
|
16
|
+
}
|
|
17
|
+
export interface CacheControlDirectives {
|
|
18
|
+
'max-stale'?: number;
|
|
19
|
+
'min-fresh'?: number;
|
|
20
|
+
'max-age'?: number;
|
|
21
|
+
's-maxage'?: number;
|
|
22
|
+
'stale-while-revalidate'?: number;
|
|
23
|
+
'stale-if-error'?: number;
|
|
24
|
+
public?: true;
|
|
25
|
+
private?: true | string[];
|
|
26
|
+
'no-store'?: true;
|
|
27
|
+
'no-cache'?: true | string[];
|
|
28
|
+
'must-revalidate'?: true;
|
|
29
|
+
'proxy-revalidate'?: true;
|
|
30
|
+
immutable?: true;
|
|
31
|
+
'no-transform'?: true;
|
|
32
|
+
'must-understand'?: true;
|
|
33
|
+
'only-if-cached'?: true;
|
|
34
|
+
}
|
|
35
|
+
export interface CacheKey {
|
|
36
|
+
origin: string;
|
|
37
|
+
method: string;
|
|
38
|
+
path: string;
|
|
39
|
+
headers?: Record<string, string | string[]>;
|
|
40
|
+
}
|
|
41
|
+
export interface CacheValue {
|
|
42
|
+
statusCode: number;
|
|
43
|
+
statusMessage: string;
|
|
44
|
+
headers: Record<string, string | string[]>;
|
|
45
|
+
vary?: Record<string, string | string[] | null>;
|
|
46
|
+
etag?: string;
|
|
47
|
+
cacheControlDirectives?: CacheControlDirectives;
|
|
48
|
+
cachedAt: number;
|
|
49
|
+
staleAt: number;
|
|
50
|
+
deleteAt: number;
|
|
51
|
+
}
|
|
52
|
+
export interface DeleteByUri {
|
|
53
|
+
origin: string;
|
|
54
|
+
method: string;
|
|
55
|
+
path: string;
|
|
56
|
+
}
|
|
57
|
+
type GetResult = {
|
|
58
|
+
statusCode: number;
|
|
59
|
+
statusMessage: string;
|
|
60
|
+
headers: Record<string, string | string[]>;
|
|
61
|
+
vary?: Record<string, string | string[] | null>;
|
|
62
|
+
etag?: string;
|
|
63
|
+
body?: Readable | Iterable<Buffer> | AsyncIterable<Buffer> | Buffer | Iterable<string> | AsyncIterable<string> | string;
|
|
64
|
+
cacheControlDirectives: CacheControlDirectives;
|
|
65
|
+
cachedAt: number;
|
|
66
|
+
staleAt: number;
|
|
67
|
+
deleteAt: number;
|
|
68
|
+
};
|
|
69
|
+
export interface CacheStore {
|
|
70
|
+
get(key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined;
|
|
71
|
+
createWriteStream(key: CacheKey, val: CacheValue): Writable | undefined;
|
|
72
|
+
delete(key: CacheKey): void | Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
export interface MemoryCacheStoreOpts {
|
|
75
|
+
maxCount?: number;
|
|
76
|
+
maxSize?: number;
|
|
77
|
+
maxEntrySize?: number;
|
|
78
|
+
errorCallback?: (err: Error) => void;
|
|
79
|
+
}
|
|
80
|
+
export class MemoryCacheStore implements CacheStore {
|
|
81
|
+
constructor(opts?: MemoryCacheStoreOpts);
|
|
82
|
+
get(key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined;
|
|
83
|
+
createWriteStream(key: CacheKey, value: CacheValue): Writable | undefined;
|
|
84
|
+
delete(key: CacheKey): void | Promise<void>;
|
|
85
|
+
}
|
|
86
|
+
export interface SqliteCacheStoreOpts {
|
|
87
|
+
location?: string;
|
|
88
|
+
maxCount?: number;
|
|
89
|
+
maxEntrySize?: number;
|
|
90
|
+
}
|
|
91
|
+
export class SqliteCacheStore implements CacheStore {
|
|
92
|
+
constructor(opts?: SqliteCacheStoreOpts);
|
|
93
|
+
close(): void;
|
|
94
|
+
get(key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined;
|
|
95
|
+
createWriteStream(key: CacheKey, value: CacheValue): Writable | undefined;
|
|
96
|
+
delete(key: CacheKey): void | Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RequestInfo, Response, Request } from './fetch';
|
|
2
|
+
export interface CacheStorage {
|
|
3
|
+
match(request: RequestInfo, options?: MultiCacheQueryOptions): Promise<Response | undefined>;
|
|
4
|
+
has(cacheName: string): Promise<boolean>;
|
|
5
|
+
open(cacheName: string): Promise<Cache>;
|
|
6
|
+
delete(cacheName: string): Promise<boolean>;
|
|
7
|
+
keys(): Promise<string[]>;
|
|
8
|
+
}
|
|
9
|
+
declare const CacheStorage: {
|
|
10
|
+
prototype: CacheStorage;
|
|
11
|
+
new (): CacheStorage;
|
|
12
|
+
};
|
|
13
|
+
export interface Cache {
|
|
14
|
+
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response | undefined>;
|
|
15
|
+
matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Response[]>;
|
|
16
|
+
add(request: RequestInfo): Promise<undefined>;
|
|
17
|
+
addAll(requests: RequestInfo[]): Promise<undefined>;
|
|
18
|
+
put(request: RequestInfo, response: Response): Promise<undefined>;
|
|
19
|
+
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
|
|
20
|
+
keys(request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Request[]>;
|
|
21
|
+
}
|
|
22
|
+
export interface CacheQueryOptions {
|
|
23
|
+
ignoreSearch?: boolean;
|
|
24
|
+
ignoreMethod?: boolean;
|
|
25
|
+
ignoreVary?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface MultiCacheQueryOptions extends CacheQueryOptions {
|
|
28
|
+
cacheName?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const caches: CacheStorage;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { URL } from 'node:url';
|
|
2
|
+
import Dispatcher from './dispatcher';
|
|
3
|
+
import buildConnector from './connector';
|
|
4
|
+
import TClientStats from './client-stats';
|
|
5
|
+
type ClientConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>;
|
|
6
|
+
export class Client extends Dispatcher {
|
|
7
|
+
constructor(url: string | URL, options?: Client.Options);
|
|
8
|
+
pipelining: number;
|
|
9
|
+
closed: boolean;
|
|
10
|
+
destroyed: boolean;
|
|
11
|
+
readonly stats: TClientStats;
|
|
12
|
+
override connect(options: ClientConnectOptions): Promise<Dispatcher.ConnectData>;
|
|
13
|
+
override connect(options: ClientConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
|
|
14
|
+
}
|
|
15
|
+
export declare namespace Client {
|
|
16
|
+
export interface OptionsInterceptors {
|
|
17
|
+
Client: readonly Dispatcher.DispatchInterceptor[];
|
|
18
|
+
}
|
|
19
|
+
export interface Options {
|
|
20
|
+
interceptors?: OptionsInterceptors;
|
|
21
|
+
maxHeaderSize?: number;
|
|
22
|
+
headersTimeout?: number;
|
|
23
|
+
socketTimeout?: never;
|
|
24
|
+
requestTimeout?: never;
|
|
25
|
+
connectTimeout?: number;
|
|
26
|
+
bodyTimeout?: number;
|
|
27
|
+
idleTimeout?: never;
|
|
28
|
+
keepAlive?: never;
|
|
29
|
+
keepAliveTimeout?: number;
|
|
30
|
+
maxKeepAliveTimeout?: never;
|
|
31
|
+
keepAliveMaxTimeout?: number;
|
|
32
|
+
keepAliveTimeoutThreshold?: number;
|
|
33
|
+
socketPath?: string;
|
|
34
|
+
pipelining?: number;
|
|
35
|
+
tls?: never;
|
|
36
|
+
strictContentLength?: boolean;
|
|
37
|
+
maxCachedSessions?: number;
|
|
38
|
+
connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
|
|
39
|
+
maxRequestsPerClient?: number;
|
|
40
|
+
localAddress?: string;
|
|
41
|
+
maxResponseSize?: number;
|
|
42
|
+
autoSelectFamily?: boolean;
|
|
43
|
+
autoSelectFamilyAttemptTimeout?: number;
|
|
44
|
+
allowH2?: boolean;
|
|
45
|
+
maxConcurrentStreams?: number;
|
|
46
|
+
initialWindowSize?: number;
|
|
47
|
+
connectionWindowSize?: number;
|
|
48
|
+
pingInterval?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface SocketInfo {
|
|
51
|
+
localAddress?: string;
|
|
52
|
+
localPort?: number;
|
|
53
|
+
remoteAddress?: string;
|
|
54
|
+
remotePort?: number;
|
|
55
|
+
remoteFamily?: string;
|
|
56
|
+
timeout?: number;
|
|
57
|
+
bytesWritten?: number;
|
|
58
|
+
bytesRead?: number;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export default Client;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TLSSocket, ConnectionOptions } from 'node:tls';
|
|
2
|
+
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'node:net';
|
|
3
|
+
export default buildConnector;
|
|
4
|
+
declare function buildConnector(options?: buildConnector.BuildOptions): buildConnector.connector;
|
|
5
|
+
declare namespace buildConnector {
|
|
6
|
+
export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
|
|
7
|
+
allowH2?: boolean;
|
|
8
|
+
maxCachedSessions?: number | null;
|
|
9
|
+
socketPath?: string | null;
|
|
10
|
+
timeout?: number | null;
|
|
11
|
+
port?: number;
|
|
12
|
+
keepAlive?: boolean | null;
|
|
13
|
+
keepAliveInitialDelay?: number | null;
|
|
14
|
+
typeOfService?: number | null;
|
|
15
|
+
};
|
|
16
|
+
export interface Options {
|
|
17
|
+
hostname: string;
|
|
18
|
+
host?: string;
|
|
19
|
+
protocol: string;
|
|
20
|
+
port: string;
|
|
21
|
+
servername?: string;
|
|
22
|
+
localAddress?: string | null;
|
|
23
|
+
socketPath?: string | null;
|
|
24
|
+
httpSocket?: Socket;
|
|
25
|
+
}
|
|
26
|
+
export type Callback = (...args: CallbackArgs) => void;
|
|
27
|
+
type CallbackArgs = [
|
|
28
|
+
null,
|
|
29
|
+
Socket | TLSSocket
|
|
30
|
+
] | [
|
|
31
|
+
Error,
|
|
32
|
+
null
|
|
33
|
+
];
|
|
34
|
+
export interface connector {
|
|
35
|
+
(options: buildConnector.Options, callback: buildConnector.Callback): void;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference path="../node/index.d.ts" />
|
|
2
|
+
interface MIMEType {
|
|
3
|
+
type: string;
|
|
4
|
+
subtype: string;
|
|
5
|
+
parameters: Map<string, string>;
|
|
6
|
+
essence: string;
|
|
7
|
+
}
|
|
8
|
+
export function parseMIMEType(input: string): 'failure' | MIMEType;
|
|
9
|
+
export function serializeAMimeType(mimeType: MIMEType): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference path="../node/index.d.ts" />
|
|
2
|
+
import type { Headers } from './fetch';
|
|
3
|
+
export interface Cookie {
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
expires?: Date | number;
|
|
7
|
+
maxAge?: number;
|
|
8
|
+
domain?: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
secure?: boolean;
|
|
11
|
+
httpOnly?: boolean;
|
|
12
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
13
|
+
unparsed?: string[];
|
|
14
|
+
}
|
|
15
|
+
export function deleteCookie(headers: Headers, name: string, attributes?: {
|
|
16
|
+
name?: string;
|
|
17
|
+
domain?: string;
|
|
18
|
+
}): void;
|
|
19
|
+
export function getCookies(headers: Headers): Record<string, string>;
|
|
20
|
+
export function getSetCookies(headers: Headers): Cookie[];
|
|
21
|
+
export function setCookie(headers: Headers, cookie: Cookie): void;
|
|
22
|
+
export function parseCookie(cookie: string): Cookie | null;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Socket } from 'node:net';
|
|
2
|
+
import { URL } from 'node:url';
|
|
3
|
+
import buildConnector from './connector';
|
|
4
|
+
import Dispatcher from './dispatcher';
|
|
5
|
+
declare namespace DiagnosticsChannel {
|
|
6
|
+
interface Request {
|
|
7
|
+
origin?: string | URL;
|
|
8
|
+
completed: boolean;
|
|
9
|
+
method?: Dispatcher.HttpMethod;
|
|
10
|
+
path: string;
|
|
11
|
+
headers: any;
|
|
12
|
+
}
|
|
13
|
+
interface Response {
|
|
14
|
+
statusCode: number;
|
|
15
|
+
statusText: string;
|
|
16
|
+
headers: Array<Buffer>;
|
|
17
|
+
}
|
|
18
|
+
interface ConnectParams {
|
|
19
|
+
host: URL['host'];
|
|
20
|
+
hostname: URL['hostname'];
|
|
21
|
+
protocol: URL['protocol'];
|
|
22
|
+
port: URL['port'];
|
|
23
|
+
servername: string | null;
|
|
24
|
+
}
|
|
25
|
+
type Connector = buildConnector.connector;
|
|
26
|
+
export interface RequestCreateMessage {
|
|
27
|
+
request: Request;
|
|
28
|
+
}
|
|
29
|
+
export interface RequestBodySentMessage {
|
|
30
|
+
request: Request;
|
|
31
|
+
}
|
|
32
|
+
export interface RequestBodyChunkSentMessage {
|
|
33
|
+
request: Request;
|
|
34
|
+
chunk: Uint8Array | string;
|
|
35
|
+
}
|
|
36
|
+
export interface RequestBodyChunkReceivedMessage {
|
|
37
|
+
request: Request;
|
|
38
|
+
chunk: Buffer;
|
|
39
|
+
}
|
|
40
|
+
export interface RequestHeadersMessage {
|
|
41
|
+
request: Request;
|
|
42
|
+
response: Response;
|
|
43
|
+
}
|
|
44
|
+
export interface RequestTrailersMessage {
|
|
45
|
+
request: Request;
|
|
46
|
+
trailers: Array<Buffer>;
|
|
47
|
+
}
|
|
48
|
+
export interface RequestErrorMessage {
|
|
49
|
+
request: Request;
|
|
50
|
+
error: Error;
|
|
51
|
+
}
|
|
52
|
+
export interface ClientSendHeadersMessage {
|
|
53
|
+
request: Request;
|
|
54
|
+
headers: string;
|
|
55
|
+
socket: Socket;
|
|
56
|
+
}
|
|
57
|
+
export interface ClientBeforeConnectMessage {
|
|
58
|
+
connectParams: ConnectParams;
|
|
59
|
+
connector: Connector;
|
|
60
|
+
}
|
|
61
|
+
export interface ClientConnectedMessage {
|
|
62
|
+
socket: Socket;
|
|
63
|
+
connectParams: ConnectParams;
|
|
64
|
+
connector: Connector;
|
|
65
|
+
}
|
|
66
|
+
export interface ClientConnectErrorMessage {
|
|
67
|
+
error: Error;
|
|
68
|
+
socket: Socket;
|
|
69
|
+
connectParams: ConnectParams;
|
|
70
|
+
connector: Connector;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { URL } from 'node:url';
|
|
2
|
+
import { Duplex, Readable, Writable } from 'node:stream';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
|
+
import { Blob } from 'node:buffer';
|
|
5
|
+
import { IncomingHttpHeaders } from './header';
|
|
6
|
+
import BodyReadable from './readable';
|
|
7
|
+
import { FormData } from './formdata';
|
|
8
|
+
import Errors from './errors';
|
|
9
|
+
import { Autocomplete } from './utility';
|
|
10
|
+
type AbortSignal = unknown;
|
|
11
|
+
export default Dispatcher;
|
|
12
|
+
export type UndiciHeaders = Record<string, string | string[]> | IncomingHttpHeaders | string[] | Iterable<[
|
|
13
|
+
string,
|
|
14
|
+
string | string[] | undefined
|
|
15
|
+
]> | null;
|
|
16
|
+
declare class Dispatcher extends EventEmitter {
|
|
17
|
+
dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean;
|
|
18
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void;
|
|
19
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>;
|
|
20
|
+
compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
|
|
21
|
+
compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
|
|
22
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void;
|
|
23
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>;
|
|
24
|
+
pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex;
|
|
25
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void;
|
|
26
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>;
|
|
27
|
+
upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
|
|
28
|
+
upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
|
|
29
|
+
close(callback: () => void): void;
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
destroy(err: Error | null, callback: () => void): void;
|
|
32
|
+
destroy(callback: () => void): void;
|
|
33
|
+
destroy(err: Error | null): Promise<void>;
|
|
34
|
+
destroy(): Promise<void>;
|
|
35
|
+
on(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
|
|
36
|
+
on(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
37
|
+
on(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
38
|
+
on(eventName: 'drain', callback: (origin: URL) => void): this;
|
|
39
|
+
once(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
|
|
40
|
+
once(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
41
|
+
once(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
42
|
+
once(eventName: 'drain', callback: (origin: URL) => void): this;
|
|
43
|
+
off(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
|
|
44
|
+
off(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
45
|
+
off(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
46
|
+
off(eventName: 'drain', callback: (origin: URL) => void): this;
|
|
47
|
+
addListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
|
|
48
|
+
addListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
49
|
+
addListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
50
|
+
addListener(eventName: 'drain', callback: (origin: URL) => void): this;
|
|
51
|
+
removeListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
|
|
52
|
+
removeListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
53
|
+
removeListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
54
|
+
removeListener(eventName: 'drain', callback: (origin: URL) => void): this;
|
|
55
|
+
prependListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
|
|
56
|
+
prependListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
57
|
+
prependListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
58
|
+
prependListener(eventName: 'drain', callback: (origin: URL) => void): this;
|
|
59
|
+
prependOnceListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
|
|
60
|
+
prependOnceListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
61
|
+
prependOnceListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
62
|
+
prependOnceListener(eventName: 'drain', callback: (origin: URL) => void): this;
|
|
63
|
+
listeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[];
|
|
64
|
+
listeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
65
|
+
listeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
66
|
+
listeners(eventName: 'drain'): ((origin: URL) => void)[];
|
|
67
|
+
rawListeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[];
|
|
68
|
+
rawListeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
69
|
+
rawListeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
70
|
+
rawListeners(eventName: 'drain'): ((origin: URL) => void)[];
|
|
71
|
+
emit(eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean;
|
|
72
|
+
emit(eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
73
|
+
emit(eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
74
|
+
emit(eventName: 'drain', origin: URL): boolean;
|
|
75
|
+
}
|
|
76
|
+
declare namespace Dispatcher {
|
|
77
|
+
export interface ComposedDispatcher extends Dispatcher {
|
|
78
|
+
}
|
|
79
|
+
export type Dispatch = Dispatcher['dispatch'];
|
|
80
|
+
export type DispatcherComposeInterceptor = (dispatch: Dispatch) => Dispatch;
|
|
81
|
+
export interface DispatchOptions {
|
|
82
|
+
origin?: string | URL;
|
|
83
|
+
path: string;
|
|
84
|
+
method: HttpMethod;
|
|
85
|
+
body?: string | Buffer | Uint8Array | Readable | null | FormData;
|
|
86
|
+
headers?: UndiciHeaders;
|
|
87
|
+
query?: Record<string, any>;
|
|
88
|
+
idempotent?: boolean;
|
|
89
|
+
blocking?: boolean;
|
|
90
|
+
typeOfService?: number | null;
|
|
91
|
+
upgrade?: boolean | string | null;
|
|
92
|
+
headersTimeout?: number | null;
|
|
93
|
+
bodyTimeout?: number | null;
|
|
94
|
+
reset?: boolean;
|
|
95
|
+
throwOnError?: boolean;
|
|
96
|
+
expectContinue?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface ConnectOptions<TOpaque = null> {
|
|
99
|
+
origin: string | URL;
|
|
100
|
+
path: string;
|
|
101
|
+
headers?: UndiciHeaders;
|
|
102
|
+
signal?: AbortSignal | EventEmitter | null;
|
|
103
|
+
opaque?: TOpaque;
|
|
104
|
+
redirectionLimitReached?: boolean;
|
|
105
|
+
responseHeaders?: 'raw' | null;
|
|
106
|
+
}
|
|
107
|
+
export interface RequestOptions<TOpaque = null> extends DispatchOptions {
|
|
108
|
+
opaque?: TOpaque;
|
|
109
|
+
signal?: AbortSignal | EventEmitter | null;
|
|
110
|
+
redirectionLimitReached?: boolean;
|
|
111
|
+
onInfo?: (info: {
|
|
112
|
+
statusCode: number;
|
|
113
|
+
headers: Record<string, string | string[]>;
|
|
114
|
+
}) => void;
|
|
115
|
+
responseHeaders?: 'raw' | null;
|
|
116
|
+
highWaterMark?: number;
|
|
117
|
+
}
|
|
118
|
+
export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
|
|
119
|
+
objectMode?: boolean;
|
|
120
|
+
}
|
|
121
|
+
export interface UpgradeOptions {
|
|
122
|
+
path: string;
|
|
123
|
+
method?: string;
|
|
124
|
+
headers?: UndiciHeaders;
|
|
125
|
+
protocol?: string;
|
|
126
|
+
signal?: AbortSignal | EventEmitter | null;
|
|
127
|
+
redirectionLimitReached?: boolean;
|
|
128
|
+
responseHeaders?: 'raw' | null;
|
|
129
|
+
}
|
|
130
|
+
export interface ConnectData<TOpaque = null> {
|
|
131
|
+
statusCode: number;
|
|
132
|
+
headers: IncomingHttpHeaders;
|
|
133
|
+
socket: Duplex;
|
|
134
|
+
opaque: TOpaque;
|
|
135
|
+
}
|
|
136
|
+
export interface ResponseData<TOpaque = null> {
|
|
137
|
+
statusCode: number;
|
|
138
|
+
statusText: string;
|
|
139
|
+
headers: IncomingHttpHeaders;
|
|
140
|
+
body: BodyReadable & BodyMixin;
|
|
141
|
+
trailers: Record<string, string>;
|
|
142
|
+
opaque: TOpaque;
|
|
143
|
+
context: object;
|
|
144
|
+
}
|
|
145
|
+
export interface PipelineHandlerData<TOpaque = null> {
|
|
146
|
+
statusCode: number;
|
|
147
|
+
headers: IncomingHttpHeaders;
|
|
148
|
+
opaque: TOpaque;
|
|
149
|
+
body: BodyReadable;
|
|
150
|
+
context: object;
|
|
151
|
+
}
|
|
152
|
+
export interface StreamData<TOpaque = null> {
|
|
153
|
+
opaque: TOpaque;
|
|
154
|
+
trailers: Record<string, string>;
|
|
155
|
+
}
|
|
156
|
+
export interface UpgradeData<TOpaque = null> {
|
|
157
|
+
headers: IncomingHttpHeaders;
|
|
158
|
+
socket: Duplex;
|
|
159
|
+
opaque: TOpaque;
|
|
160
|
+
}
|
|
161
|
+
export interface StreamFactoryData<TOpaque = null> {
|
|
162
|
+
statusCode: number;
|
|
163
|
+
headers: IncomingHttpHeaders;
|
|
164
|
+
opaque: TOpaque;
|
|
165
|
+
context: object;
|
|
166
|
+
}
|
|
167
|
+
export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable;
|
|
168
|
+
export interface DispatchController {
|
|
169
|
+
get aborted(): boolean;
|
|
170
|
+
get paused(): boolean;
|
|
171
|
+
get reason(): Error | null;
|
|
172
|
+
abort(reason: Error): void;
|
|
173
|
+
pause(): void;
|
|
174
|
+
resume(): void;
|
|
175
|
+
}
|
|
176
|
+
export interface DispatchHandler {
|
|
177
|
+
onRequestStart?(controller: DispatchController, context: any): void;
|
|
178
|
+
onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, socket: Duplex): void;
|
|
179
|
+
onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, statusMessage?: string): void;
|
|
180
|
+
onResponseData?(controller: DispatchController, chunk: Buffer): void;
|
|
181
|
+
onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
|
|
182
|
+
onResponseError?(controller: DispatchController, error: Error): void;
|
|
183
|
+
onConnect?(abort: (err?: Error) => void): void;
|
|
184
|
+
onError?(err: Error): void;
|
|
185
|
+
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
186
|
+
onResponseStarted?(): void;
|
|
187
|
+
onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
|
|
188
|
+
onData?(chunk: Buffer): boolean;
|
|
189
|
+
onComplete?(trailers: string[] | null): void;
|
|
190
|
+
onBodySent?(chunkSize: number, totalBytesSent: number): void;
|
|
191
|
+
}
|
|
192
|
+
export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable;
|
|
193
|
+
export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>;
|
|
194
|
+
interface BodyMixin {
|
|
195
|
+
readonly body?: never;
|
|
196
|
+
readonly bodyUsed: boolean;
|
|
197
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
198
|
+
blob(): Promise<Blob>;
|
|
199
|
+
bytes(): Promise<Uint8Array>;
|
|
200
|
+
formData(): Promise<never>;
|
|
201
|
+
json(): Promise<unknown>;
|
|
202
|
+
text(): Promise<string>;
|
|
203
|
+
}
|
|
204
|
+
export interface DispatchInterceptor {
|
|
205
|
+
(dispatch: Dispatch): Dispatch;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Agent from './agent';
|
|
2
|
+
import ProxyAgent from './proxy-agent';
|
|
3
|
+
import Dispatcher from './dispatcher';
|
|
4
|
+
export default EnvHttpProxyAgent;
|
|
5
|
+
declare class EnvHttpProxyAgent extends Dispatcher {
|
|
6
|
+
constructor(opts?: EnvHttpProxyAgent.Options);
|
|
7
|
+
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean;
|
|
8
|
+
}
|
|
9
|
+
declare namespace EnvHttpProxyAgent {
|
|
10
|
+
export interface Options extends Omit<ProxyAgent.Options, 'uri'> {
|
|
11
|
+
httpProxy?: string;
|
|
12
|
+
httpsProxy?: string;
|
|
13
|
+
noProxy?: string;
|
|
14
|
+
}
|
|
15
|
+
}
|