@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,60 @@
|
|
|
1
|
+
import { IncomingHttpHeaders } from './header';
|
|
2
|
+
import Dispatcher from './dispatcher';
|
|
3
|
+
import { BodyInit, Headers } from './fetch';
|
|
4
|
+
declare class MockScope<TData extends object = object> {
|
|
5
|
+
constructor(mockDispatch: MockInterceptor.MockDispatch<TData>);
|
|
6
|
+
delay(waitInMs: number): MockScope<TData>;
|
|
7
|
+
persist(): MockScope<TData>;
|
|
8
|
+
times(repeatTimes: number): MockScope<TData>;
|
|
9
|
+
}
|
|
10
|
+
declare class MockInterceptor {
|
|
11
|
+
constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]);
|
|
12
|
+
reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>;
|
|
13
|
+
reply<TData extends object = object>(statusCode: number, data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>, responseOptions?: MockInterceptor.MockResponseOptions): MockScope<TData>;
|
|
14
|
+
replyWithError<TError extends Error = Error>(error: TError): MockScope;
|
|
15
|
+
defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor;
|
|
16
|
+
defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor;
|
|
17
|
+
replyContentLength(): MockInterceptor;
|
|
18
|
+
}
|
|
19
|
+
declare namespace MockInterceptor {
|
|
20
|
+
export interface Options {
|
|
21
|
+
path: string | RegExp | ((path: string) => boolean);
|
|
22
|
+
method?: string | RegExp | ((method: string) => boolean);
|
|
23
|
+
body?: string | RegExp | ((body: string) => boolean);
|
|
24
|
+
headers?: Record<string, string | RegExp | ((body: string) => boolean)> | ((headers: Record<string, string>) => boolean);
|
|
25
|
+
query?: Record<string, any>;
|
|
26
|
+
}
|
|
27
|
+
export interface MockDispatch<TData extends object = object, TError extends Error = Error> extends Options {
|
|
28
|
+
times: number | null;
|
|
29
|
+
persist: boolean;
|
|
30
|
+
consumed: boolean;
|
|
31
|
+
data: MockDispatchData<TData, TError>;
|
|
32
|
+
}
|
|
33
|
+
export interface MockDispatchData<TData extends object = object, TError extends Error = Error> extends MockResponseOptions {
|
|
34
|
+
error: TError | null;
|
|
35
|
+
statusCode?: number;
|
|
36
|
+
data?: TData | string;
|
|
37
|
+
}
|
|
38
|
+
export interface MockResponseOptions {
|
|
39
|
+
headers?: IncomingHttpHeaders;
|
|
40
|
+
trailers?: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
export interface MockResponseCallbackOptions {
|
|
43
|
+
path: string;
|
|
44
|
+
method: string;
|
|
45
|
+
headers?: Headers | Record<string, string>;
|
|
46
|
+
origin?: string;
|
|
47
|
+
body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
|
|
48
|
+
}
|
|
49
|
+
export type MockResponseDataHandler<TData extends object = object> = (opts: MockResponseCallbackOptions) => TData | Buffer | string;
|
|
50
|
+
export type MockReplyOptionsCallback<TData extends object = object> = (opts: MockResponseCallbackOptions) => {
|
|
51
|
+
statusCode: number;
|
|
52
|
+
data?: TData | Buffer | string;
|
|
53
|
+
responseOptions?: MockResponseOptions;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
interface Interceptable extends Dispatcher {
|
|
57
|
+
intercept(options: MockInterceptor.Options): MockInterceptor;
|
|
58
|
+
cleanMocks(): void;
|
|
59
|
+
}
|
|
60
|
+
export { Interceptable, MockInterceptor, MockScope };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Pool from './pool';
|
|
2
|
+
import MockAgent from './mock-agent';
|
|
3
|
+
import { Interceptable, MockInterceptor } from './mock-interceptor';
|
|
4
|
+
import Dispatcher from './dispatcher';
|
|
5
|
+
export default MockPool;
|
|
6
|
+
declare class MockPool extends Pool implements Interceptable {
|
|
7
|
+
constructor(origin: string, options: MockPool.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 MockPool {
|
|
14
|
+
export interface Options extends Pool.Options {
|
|
15
|
+
agent: MockAgent;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference path="../node/index.d.ts" />
|
|
2
|
+
export interface EventInit {
|
|
3
|
+
bubbles?: boolean;
|
|
4
|
+
cancelable?: boolean;
|
|
5
|
+
composed?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface EventListenerOptions {
|
|
8
|
+
capture?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface AddEventListenerOptions extends EventListenerOptions {
|
|
11
|
+
once?: boolean;
|
|
12
|
+
passive?: boolean;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}
|
|
15
|
+
export type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
|
16
|
+
export interface EventListenerObject {
|
|
17
|
+
handleEvent(object: Event): void;
|
|
18
|
+
}
|
|
19
|
+
export interface EventListener {
|
|
20
|
+
(evt: Event): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Client from './client';
|
|
2
|
+
import TPoolStats from './pool-stats';
|
|
3
|
+
import { URL } from 'node:url';
|
|
4
|
+
import Dispatcher from './dispatcher';
|
|
5
|
+
export default Pool;
|
|
6
|
+
type PoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>;
|
|
7
|
+
declare class Pool extends Dispatcher {
|
|
8
|
+
constructor(url: string | URL, options?: Pool.Options);
|
|
9
|
+
closed: boolean;
|
|
10
|
+
destroyed: boolean;
|
|
11
|
+
readonly stats: TPoolStats;
|
|
12
|
+
override connect(options: PoolConnectOptions): Promise<Dispatcher.ConnectData>;
|
|
13
|
+
override connect(options: PoolConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
|
|
14
|
+
}
|
|
15
|
+
declare namespace Pool {
|
|
16
|
+
export type PoolStats = TPoolStats;
|
|
17
|
+
export interface Options extends Client.Options {
|
|
18
|
+
factory?(origin: URL, opts: object): Dispatcher;
|
|
19
|
+
connections?: number | null;
|
|
20
|
+
clientTtl?: number | null;
|
|
21
|
+
interceptors?: {
|
|
22
|
+
Pool?: readonly Dispatcher.DispatchInterceptor[];
|
|
23
|
+
} & Client.Options['interceptors'];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Agent from './agent';
|
|
2
|
+
import buildConnector from './connector';
|
|
3
|
+
import Dispatcher from './dispatcher';
|
|
4
|
+
import { IncomingHttpHeaders } from './header';
|
|
5
|
+
export default ProxyAgent;
|
|
6
|
+
declare class ProxyAgent extends Dispatcher {
|
|
7
|
+
constructor(options: ProxyAgent.Options | string);
|
|
8
|
+
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean;
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
declare namespace ProxyAgent {
|
|
12
|
+
export interface Options extends Agent.Options {
|
|
13
|
+
uri: string;
|
|
14
|
+
auth?: string;
|
|
15
|
+
token?: string;
|
|
16
|
+
headers?: IncomingHttpHeaders;
|
|
17
|
+
requestTls?: buildConnector.BuildOptions;
|
|
18
|
+
proxyTls?: buildConnector.BuildOptions;
|
|
19
|
+
clientFactory?(origin: URL, opts: object): Dispatcher;
|
|
20
|
+
proxyTunnel?: boolean;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
import { Blob } from 'node:buffer';
|
|
3
|
+
export default BodyReadable;
|
|
4
|
+
declare class BodyReadable extends Readable {
|
|
5
|
+
constructor(opts: {
|
|
6
|
+
resume: (this: Readable, size: number) => void | null;
|
|
7
|
+
abort: () => void | null;
|
|
8
|
+
contentType?: string;
|
|
9
|
+
contentLength?: number;
|
|
10
|
+
highWaterMark?: number;
|
|
11
|
+
});
|
|
12
|
+
text(): Promise<string>;
|
|
13
|
+
json(): Promise<unknown>;
|
|
14
|
+
blob(): Promise<Blob>;
|
|
15
|
+
bytes(): Promise<Uint8Array>;
|
|
16
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
17
|
+
formData(): Promise<never>;
|
|
18
|
+
readonly bodyUsed: boolean;
|
|
19
|
+
readonly body: never | undefined;
|
|
20
|
+
dump(opts?: {
|
|
21
|
+
limit: number;
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Dispatcher from './dispatcher';
|
|
2
|
+
export default RetryHandler;
|
|
3
|
+
declare class RetryHandler implements Dispatcher.DispatchHandler {
|
|
4
|
+
constructor(options: Dispatcher.DispatchOptions & {
|
|
5
|
+
retryOptions?: RetryHandler.RetryOptions;
|
|
6
|
+
}, retryHandlers: RetryHandler.RetryHandlers);
|
|
7
|
+
}
|
|
8
|
+
declare namespace RetryHandler {
|
|
9
|
+
export type RetryState = {
|
|
10
|
+
counter: number;
|
|
11
|
+
};
|
|
12
|
+
export type RetryContext = {
|
|
13
|
+
state: RetryState;
|
|
14
|
+
opts: Dispatcher.DispatchOptions & {
|
|
15
|
+
retryOptions?: RetryHandler.RetryOptions;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type OnRetryCallback = (result?: Error | null) => void;
|
|
19
|
+
export type RetryCallback = (err: Error, context: {
|
|
20
|
+
state: RetryState;
|
|
21
|
+
opts: Dispatcher.DispatchOptions & {
|
|
22
|
+
retryOptions?: RetryHandler.RetryOptions;
|
|
23
|
+
};
|
|
24
|
+
}, callback: OnRetryCallback) => void;
|
|
25
|
+
export interface RetryOptions {
|
|
26
|
+
throwOnError?: boolean;
|
|
27
|
+
retry?: RetryCallback;
|
|
28
|
+
maxRetries?: number;
|
|
29
|
+
maxTimeout?: number;
|
|
30
|
+
minTimeout?: number;
|
|
31
|
+
timeoutFactor?: number;
|
|
32
|
+
retryAfter?: boolean;
|
|
33
|
+
methods?: Dispatcher.HttpMethod[];
|
|
34
|
+
errorCodes?: string[];
|
|
35
|
+
statusCodes?: number[];
|
|
36
|
+
}
|
|
37
|
+
export interface RetryHandlers {
|
|
38
|
+
dispatch: Dispatcher['dispatch'];
|
|
39
|
+
handler: Dispatcher.DispatchHandler;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Client from './client';
|
|
2
|
+
import TPoolStats from './pool-stats';
|
|
3
|
+
import { URL } from 'node:url';
|
|
4
|
+
import Dispatcher from './dispatcher';
|
|
5
|
+
export default RoundRobinPool;
|
|
6
|
+
type RoundRobinPoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>;
|
|
7
|
+
declare class RoundRobinPool extends Dispatcher {
|
|
8
|
+
constructor(url: string | URL, options?: RoundRobinPool.Options);
|
|
9
|
+
closed: boolean;
|
|
10
|
+
destroyed: boolean;
|
|
11
|
+
readonly stats: TPoolStats;
|
|
12
|
+
override connect(options: RoundRobinPoolConnectOptions): Promise<Dispatcher.ConnectData>;
|
|
13
|
+
override connect(options: RoundRobinPoolConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
|
|
14
|
+
}
|
|
15
|
+
declare namespace RoundRobinPool {
|
|
16
|
+
export type RoundRobinPoolStats = TPoolStats;
|
|
17
|
+
export interface Options extends Client.Options {
|
|
18
|
+
factory?(origin: URL, opts: object): Dispatcher;
|
|
19
|
+
connections?: number | null;
|
|
20
|
+
clientTtl?: number | null;
|
|
21
|
+
interceptors?: {
|
|
22
|
+
RoundRobinPool?: readonly Dispatcher.DispatchInterceptor[];
|
|
23
|
+
} & Client.Options['interceptors'];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import MockAgent from './mock-agent';
|
|
2
|
+
declare class SnapshotRecorder {
|
|
3
|
+
constructor(options?: SnapshotRecorder.Options);
|
|
4
|
+
record(requestOpts: any, response: any): Promise<void>;
|
|
5
|
+
findSnapshot(requestOpts: any): SnapshotRecorder.Snapshot | undefined;
|
|
6
|
+
loadSnapshots(filePath?: string): Promise<void>;
|
|
7
|
+
saveSnapshots(filePath?: string): Promise<void>;
|
|
8
|
+
clear(): void;
|
|
9
|
+
getSnapshots(): SnapshotRecorder.Snapshot[];
|
|
10
|
+
size(): number;
|
|
11
|
+
resetCallCounts(): void;
|
|
12
|
+
deleteSnapshot(requestOpts: any): boolean;
|
|
13
|
+
getSnapshotInfo(requestOpts: any): SnapshotRecorder.SnapshotInfo | null;
|
|
14
|
+
replaceSnapshots(snapshotData: SnapshotRecorder.SnapshotData[]): void;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
17
|
+
declare namespace SnapshotRecorder {
|
|
18
|
+
type SnapshotRecorderMode = 'record' | 'playback' | 'update';
|
|
19
|
+
export interface Options {
|
|
20
|
+
snapshotPath?: string;
|
|
21
|
+
mode?: SnapshotRecorderMode;
|
|
22
|
+
maxSnapshots?: number;
|
|
23
|
+
autoFlush?: boolean;
|
|
24
|
+
flushInterval?: number;
|
|
25
|
+
matchHeaders?: string[];
|
|
26
|
+
ignoreHeaders?: string[];
|
|
27
|
+
excludeHeaders?: string[];
|
|
28
|
+
matchBody?: boolean;
|
|
29
|
+
matchQuery?: boolean;
|
|
30
|
+
caseSensitive?: boolean;
|
|
31
|
+
shouldRecord?: (requestOpts: any) => boolean;
|
|
32
|
+
shouldPlayback?: (requestOpts: any) => boolean;
|
|
33
|
+
excludeUrls?: (string | RegExp)[];
|
|
34
|
+
}
|
|
35
|
+
export interface Snapshot {
|
|
36
|
+
request: {
|
|
37
|
+
method: string;
|
|
38
|
+
url: string;
|
|
39
|
+
headers: Record<string, string>;
|
|
40
|
+
body?: string;
|
|
41
|
+
};
|
|
42
|
+
responses: {
|
|
43
|
+
statusCode: number;
|
|
44
|
+
headers: Record<string, string>;
|
|
45
|
+
body: string;
|
|
46
|
+
trailers: Record<string, string>;
|
|
47
|
+
}[];
|
|
48
|
+
callCount: number;
|
|
49
|
+
timestamp: string;
|
|
50
|
+
}
|
|
51
|
+
export interface SnapshotInfo {
|
|
52
|
+
hash: string;
|
|
53
|
+
request: {
|
|
54
|
+
method: string;
|
|
55
|
+
url: string;
|
|
56
|
+
headers: Record<string, string>;
|
|
57
|
+
body?: string;
|
|
58
|
+
};
|
|
59
|
+
responseCount: number;
|
|
60
|
+
callCount: number;
|
|
61
|
+
timestamp: string;
|
|
62
|
+
}
|
|
63
|
+
export interface SnapshotData {
|
|
64
|
+
hash: string;
|
|
65
|
+
snapshot: Snapshot;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
declare class SnapshotAgent extends MockAgent {
|
|
69
|
+
constructor(options?: SnapshotAgent.Options);
|
|
70
|
+
saveSnapshots(filePath?: string): Promise<void>;
|
|
71
|
+
loadSnapshots(filePath?: string): Promise<void>;
|
|
72
|
+
getRecorder(): SnapshotRecorder;
|
|
73
|
+
getMode(): SnapshotRecorder.SnapshotRecorderMode;
|
|
74
|
+
clearSnapshots(): void;
|
|
75
|
+
resetCallCounts(): void;
|
|
76
|
+
deleteSnapshot(requestOpts: any): boolean;
|
|
77
|
+
getSnapshotInfo(requestOpts: any): SnapshotRecorder.SnapshotInfo | null;
|
|
78
|
+
replaceSnapshots(snapshotData: SnapshotRecorder.SnapshotData[]): void;
|
|
79
|
+
}
|
|
80
|
+
declare namespace SnapshotAgent {
|
|
81
|
+
export interface Options extends MockAgent.Options {
|
|
82
|
+
mode?: SnapshotRecorder.SnapshotRecorderMode;
|
|
83
|
+
snapshotPath?: string;
|
|
84
|
+
maxSnapshots?: number;
|
|
85
|
+
autoFlush?: boolean;
|
|
86
|
+
flushInterval?: number;
|
|
87
|
+
matchHeaders?: string[];
|
|
88
|
+
ignoreHeaders?: string[];
|
|
89
|
+
excludeHeaders?: string[];
|
|
90
|
+
matchBody?: boolean;
|
|
91
|
+
matchQuery?: boolean;
|
|
92
|
+
caseSensitive?: boolean;
|
|
93
|
+
shouldRecord?: (requestOpts: any) => boolean;
|
|
94
|
+
shouldPlayback?: (requestOpts: any) => boolean;
|
|
95
|
+
excludeUrls?: (string | RegExp)[];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export { SnapshotAgent, SnapshotRecorder };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Dispatcher from './dispatcher';
|
|
2
|
+
import buildConnector from './connector';
|
|
3
|
+
import { IncomingHttpHeaders } from './header';
|
|
4
|
+
import Pool from './pool';
|
|
5
|
+
export default Socks5ProxyAgent;
|
|
6
|
+
declare class Socks5ProxyAgent extends Dispatcher {
|
|
7
|
+
constructor(proxyUrl: string | URL, options?: Socks5ProxyAgent.Options);
|
|
8
|
+
}
|
|
9
|
+
declare namespace Socks5ProxyAgent {
|
|
10
|
+
export interface Options extends Pool.Options {
|
|
11
|
+
headers?: IncomingHttpHeaders;
|
|
12
|
+
username?: string;
|
|
13
|
+
password?: string;
|
|
14
|
+
connect?: buildConnector.connector;
|
|
15
|
+
proxyTls?: buildConnector.BuildOptions;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { BufferSource } from 'node:stream/web';
|
|
2
|
+
import * as undici from './index';
|
|
3
|
+
type Converter<T> = (object: unknown) => T;
|
|
4
|
+
type SequenceConverter<T> = (object: unknown, iterable?: IterableIterator<T>) => T[];
|
|
5
|
+
type RecordConverter<K extends string, V> = (object: unknown) => Record<K, V>;
|
|
6
|
+
interface WebidlErrors {
|
|
7
|
+
exception(opts: {
|
|
8
|
+
header: string;
|
|
9
|
+
message: string;
|
|
10
|
+
}): TypeError;
|
|
11
|
+
conversionFailed(opts: {
|
|
12
|
+
prefix: string;
|
|
13
|
+
argument: string;
|
|
14
|
+
types: string[];
|
|
15
|
+
}): TypeError;
|
|
16
|
+
invalidArgument(opts: {
|
|
17
|
+
prefix: string;
|
|
18
|
+
value: string;
|
|
19
|
+
type: string;
|
|
20
|
+
}): TypeError;
|
|
21
|
+
}
|
|
22
|
+
interface WebIDLTypes {
|
|
23
|
+
UNDEFINED: 1;
|
|
24
|
+
BOOLEAN: 2;
|
|
25
|
+
STRING: 3;
|
|
26
|
+
SYMBOL: 4;
|
|
27
|
+
NUMBER: 5;
|
|
28
|
+
BIGINT: 6;
|
|
29
|
+
NULL: 7;
|
|
30
|
+
OBJECT: 8;
|
|
31
|
+
}
|
|
32
|
+
interface WebidlUtil {
|
|
33
|
+
Type(object: unknown): WebIDLTypes[keyof WebIDLTypes];
|
|
34
|
+
TypeValueToString(o: unknown): 'Undefined' | 'Boolean' | 'String' | 'Symbol' | 'Number' | 'BigInt' | 'Null' | 'Object';
|
|
35
|
+
Types: WebIDLTypes;
|
|
36
|
+
ConvertToInt(V: unknown, bitLength: number, signedness: 'signed' | 'unsigned', flags?: number): number;
|
|
37
|
+
IntegerPart(N: number): number;
|
|
38
|
+
Stringify(V: any): string;
|
|
39
|
+
MakeTypeAssertion<I>(I: I): (arg: any) => arg is I;
|
|
40
|
+
markAsUncloneable(V: any): void;
|
|
41
|
+
IsResizableArrayBuffer(V: ArrayBufferLike): boolean;
|
|
42
|
+
HasFlag(flag: number, attributes: number): boolean;
|
|
43
|
+
getCopyOfBytesHeldByBufferSource(bufferSource: BufferSource): Uint8Array;
|
|
44
|
+
}
|
|
45
|
+
interface WebidlConverters {
|
|
46
|
+
DOMString(V: unknown, prefix: string, argument: string, flags?: number): string;
|
|
47
|
+
ByteString(V: unknown, prefix: string, argument: string): string;
|
|
48
|
+
USVString(V: unknown): string;
|
|
49
|
+
boolean(V: unknown): boolean;
|
|
50
|
+
any<Value>(V: Value): Value;
|
|
51
|
+
['long long'](V: unknown): number;
|
|
52
|
+
['unsigned long long'](V: unknown): number;
|
|
53
|
+
['unsigned long'](V: unknown): number;
|
|
54
|
+
['unsigned short'](V: unknown, flags?: number): number;
|
|
55
|
+
ArrayBuffer(V: unknown, prefix: string, argument: string, options?: {
|
|
56
|
+
allowResizable: boolean;
|
|
57
|
+
}): ArrayBuffer;
|
|
58
|
+
SharedArrayBuffer(V: unknown, prefix: string, argument: string, options?: {
|
|
59
|
+
allowResizable: boolean;
|
|
60
|
+
}): SharedArrayBuffer;
|
|
61
|
+
TypedArray(V: unknown, T: new () => NodeJS.TypedArray, prefix: string, argument: string, flags?: number): NodeJS.TypedArray;
|
|
62
|
+
DataView(V: unknown, prefix: string, argument: string, flags?: number): DataView;
|
|
63
|
+
ArrayBufferView(V: unknown, prefix: string, argument: string, flags?: number): NodeJS.ArrayBufferView;
|
|
64
|
+
BufferSource(V: unknown, prefix: string, argument: string, flags?: number): ArrayBuffer | NodeJS.ArrayBufferView;
|
|
65
|
+
AllowSharedBufferSource(V: unknown, prefix: string, argument: string, flags?: number): ArrayBuffer | SharedArrayBuffer | NodeJS.ArrayBufferView;
|
|
66
|
+
['sequence<ByteString>']: SequenceConverter<string>;
|
|
67
|
+
['sequence<sequence<ByteString>>']: SequenceConverter<string[]>;
|
|
68
|
+
['record<ByteString, ByteString>']: RecordConverter<string, string>;
|
|
69
|
+
RequestInfo(V: unknown): undici.Request | string;
|
|
70
|
+
RequestInit(V: unknown): undici.RequestInit;
|
|
71
|
+
EventHandlerNonNull(V: unknown): Function | null;
|
|
72
|
+
WebSocketStreamWrite(V: unknown): ArrayBuffer | NodeJS.TypedArray | string;
|
|
73
|
+
[Key: string]: (...args: any[]) => unknown;
|
|
74
|
+
}
|
|
75
|
+
type WebidlIsFunction<T> = (arg: any) => arg is T;
|
|
76
|
+
interface WebidlIs {
|
|
77
|
+
Request: WebidlIsFunction<undici.Request>;
|
|
78
|
+
Response: WebidlIsFunction<undici.Response>;
|
|
79
|
+
ReadableStream: WebidlIsFunction<ReadableStream>;
|
|
80
|
+
Blob: WebidlIsFunction<Blob>;
|
|
81
|
+
URLSearchParams: WebidlIsFunction<URLSearchParams>;
|
|
82
|
+
File: WebidlIsFunction<File>;
|
|
83
|
+
FormData: WebidlIsFunction<undici.FormData>;
|
|
84
|
+
URL: WebidlIsFunction<URL>;
|
|
85
|
+
WebSocketError: WebidlIsFunction<undici.WebSocketError>;
|
|
86
|
+
AbortSignal: WebidlIsFunction<AbortSignal>;
|
|
87
|
+
MessagePort: WebidlIsFunction<MessagePort>;
|
|
88
|
+
USVString: WebidlIsFunction<string>;
|
|
89
|
+
BufferSource: WebidlIsFunction<ArrayBuffer | NodeJS.TypedArray>;
|
|
90
|
+
}
|
|
91
|
+
export interface Webidl {
|
|
92
|
+
errors: WebidlErrors;
|
|
93
|
+
util: WebidlUtil;
|
|
94
|
+
converters: WebidlConverters;
|
|
95
|
+
is: WebidlIs;
|
|
96
|
+
attributes: WebIDLExtendedAttributes;
|
|
97
|
+
brandCheck<Interface extends new () => unknown>(V: unknown, cls: Interface): asserts V is Interface;
|
|
98
|
+
brandCheckMultiple<Interfaces extends (new () => unknown)[]>(list: Interfaces): (V: any) => asserts V is Interfaces[number];
|
|
99
|
+
sequenceConverter<Type>(C: Converter<Type>): SequenceConverter<Type>;
|
|
100
|
+
illegalConstructor(): never;
|
|
101
|
+
recordConverter<K extends string, V>(keyConverter: Converter<K>, valueConverter: Converter<V>): RecordConverter<K, V>;
|
|
102
|
+
interfaceConverter<Interface>(typeCheck: WebidlIsFunction<Interface>, name: string): (V: unknown, prefix: string, argument: string) => asserts V is Interface;
|
|
103
|
+
dictionaryConverter(converters: {
|
|
104
|
+
key: string;
|
|
105
|
+
defaultValue?: () => unknown;
|
|
106
|
+
required?: boolean;
|
|
107
|
+
converter: (...args: unknown[]) => unknown;
|
|
108
|
+
allowedValues?: unknown[];
|
|
109
|
+
}[]): (V: unknown) => Record<string, unknown>;
|
|
110
|
+
nullableConverter<T>(converter: Converter<T>): (V: unknown) => ReturnType<typeof converter> | null;
|
|
111
|
+
argumentLengthCheck(args: {
|
|
112
|
+
length: number;
|
|
113
|
+
}, min: number, context: string): void;
|
|
114
|
+
}
|
|
115
|
+
interface WebIDLExtendedAttributes {
|
|
116
|
+
Clamp: number;
|
|
117
|
+
EnforceRange: number;
|
|
118
|
+
AllowShared: number;
|
|
119
|
+
AllowResizable: number;
|
|
120
|
+
LegacyNullToEmptyString: number;
|
|
121
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/// <reference path="../node/index.d.ts" />
|
|
2
|
+
import type { Blob } from 'node:buffer';
|
|
3
|
+
import type { ReadableStream, WritableStream } from 'node:stream/web';
|
|
4
|
+
import type { MessagePort } from 'node:worker_threads';
|
|
5
|
+
import { EventInit, EventListenerOptions, AddEventListenerOptions, EventListenerOrEventListenerObject } from './patch';
|
|
6
|
+
import Dispatcher from './dispatcher';
|
|
7
|
+
import { HeadersInit } from './fetch';
|
|
8
|
+
export type BinaryType = 'blob' | 'arraybuffer';
|
|
9
|
+
interface WebSocketEventMap {
|
|
10
|
+
close: CloseEvent;
|
|
11
|
+
error: ErrorEvent;
|
|
12
|
+
message: MessageEvent;
|
|
13
|
+
open: Event;
|
|
14
|
+
}
|
|
15
|
+
interface WebSocket extends EventTarget {
|
|
16
|
+
binaryType: BinaryType;
|
|
17
|
+
readonly bufferedAmount: number;
|
|
18
|
+
readonly extensions: string;
|
|
19
|
+
onclose: ((this: WebSocket, ev: WebSocketEventMap['close']) => any) | null;
|
|
20
|
+
onerror: ((this: WebSocket, ev: WebSocketEventMap['error']) => any) | null;
|
|
21
|
+
onmessage: ((this: WebSocket, ev: WebSocketEventMap['message']) => any) | null;
|
|
22
|
+
onopen: ((this: WebSocket, ev: WebSocketEventMap['open']) => any) | null;
|
|
23
|
+
readonly protocol: string;
|
|
24
|
+
readonly readyState: number;
|
|
25
|
+
readonly url: string;
|
|
26
|
+
close(code?: number, reason?: string): void;
|
|
27
|
+
send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
28
|
+
readonly CLOSED: number;
|
|
29
|
+
readonly CLOSING: number;
|
|
30
|
+
readonly CONNECTING: number;
|
|
31
|
+
readonly OPEN: number;
|
|
32
|
+
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
33
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
34
|
+
removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
35
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
36
|
+
}
|
|
37
|
+
export declare const WebSocket: {
|
|
38
|
+
prototype: WebSocket;
|
|
39
|
+
new (url: string | URL, protocols?: string | string[] | WebSocketInit): WebSocket;
|
|
40
|
+
readonly CLOSED: number;
|
|
41
|
+
readonly CLOSING: number;
|
|
42
|
+
readonly CONNECTING: number;
|
|
43
|
+
readonly OPEN: number;
|
|
44
|
+
};
|
|
45
|
+
interface CloseEventInit extends EventInit {
|
|
46
|
+
code?: number;
|
|
47
|
+
reason?: string;
|
|
48
|
+
wasClean?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface CloseEvent extends Event {
|
|
51
|
+
readonly code: number;
|
|
52
|
+
readonly reason: string;
|
|
53
|
+
readonly wasClean: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const CloseEvent: {
|
|
56
|
+
prototype: CloseEvent;
|
|
57
|
+
new (type: string, eventInitDict?: CloseEventInit): CloseEvent;
|
|
58
|
+
};
|
|
59
|
+
interface MessageEventInit<T = any> extends EventInit {
|
|
60
|
+
data?: T;
|
|
61
|
+
lastEventId?: string;
|
|
62
|
+
origin?: string;
|
|
63
|
+
ports?: MessagePort[];
|
|
64
|
+
source?: MessagePort | null;
|
|
65
|
+
}
|
|
66
|
+
interface MessageEvent<T = any> extends Event {
|
|
67
|
+
readonly data: T;
|
|
68
|
+
readonly lastEventId: string;
|
|
69
|
+
readonly origin: string;
|
|
70
|
+
readonly ports: readonly MessagePort[];
|
|
71
|
+
readonly source: MessagePort | null;
|
|
72
|
+
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessagePort | null, ports?: MessagePort[]): void;
|
|
73
|
+
}
|
|
74
|
+
export declare const MessageEvent: {
|
|
75
|
+
prototype: MessageEvent;
|
|
76
|
+
new <T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>;
|
|
77
|
+
};
|
|
78
|
+
interface ErrorEventInit extends EventInit {
|
|
79
|
+
message?: string;
|
|
80
|
+
filename?: string;
|
|
81
|
+
lineno?: number;
|
|
82
|
+
colno?: number;
|
|
83
|
+
error?: any;
|
|
84
|
+
}
|
|
85
|
+
interface ErrorEvent extends Event {
|
|
86
|
+
readonly message: string;
|
|
87
|
+
readonly filename: string;
|
|
88
|
+
readonly lineno: number;
|
|
89
|
+
readonly colno: number;
|
|
90
|
+
readonly error: Error;
|
|
91
|
+
}
|
|
92
|
+
export declare const ErrorEvent: {
|
|
93
|
+
prototype: ErrorEvent;
|
|
94
|
+
new (type: string, eventInitDict?: ErrorEventInit): ErrorEvent;
|
|
95
|
+
};
|
|
96
|
+
interface WebSocketInit {
|
|
97
|
+
protocols?: string | string[];
|
|
98
|
+
dispatcher?: Dispatcher;
|
|
99
|
+
headers?: HeadersInit;
|
|
100
|
+
}
|
|
101
|
+
interface WebSocketStreamOptions {
|
|
102
|
+
protocols?: string | string[];
|
|
103
|
+
signal?: AbortSignal;
|
|
104
|
+
}
|
|
105
|
+
interface WebSocketCloseInfo {
|
|
106
|
+
closeCode: number;
|
|
107
|
+
reason: string;
|
|
108
|
+
}
|
|
109
|
+
interface WebSocketStream {
|
|
110
|
+
closed: Promise<WebSocketCloseInfo>;
|
|
111
|
+
opened: Promise<{
|
|
112
|
+
extensions: string;
|
|
113
|
+
protocol: string;
|
|
114
|
+
readable: ReadableStream;
|
|
115
|
+
writable: WritableStream;
|
|
116
|
+
}>;
|
|
117
|
+
url: string;
|
|
118
|
+
close(options?: Partial<WebSocketCloseInfo>): void;
|
|
119
|
+
}
|
|
120
|
+
export declare const WebSocketStream: {
|
|
121
|
+
prototype: WebSocketStream;
|
|
122
|
+
new (url: string | URL, options?: WebSocketStreamOptions): WebSocketStream;
|
|
123
|
+
};
|
|
124
|
+
interface WebSocketError extends Event, WebSocketCloseInfo {
|
|
125
|
+
}
|
|
126
|
+
export declare const WebSocketError: {
|
|
127
|
+
prototype: WebSocketError;
|
|
128
|
+
new (type: string, init?: WebSocketCloseInfo): WebSocketError;
|
|
129
|
+
};
|
|
130
|
+
export declare const ping: (ws: WebSocket, body?: Buffer) => void;
|
package/README.md
DELETED