@e-mc/types 0.10.1 → 0.10.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/LICENSE +10 -10
- package/README.md +208 -208
- package/constant.d.ts +338 -338
- package/index.d.ts +336 -336
- package/index.js +4 -4
- package/lib/asset.d.ts +76 -76
- package/lib/cloud.d.ts +106 -106
- package/lib/compat-v4.d.ts +120 -120
- package/lib/compress.d.ts +25 -25
- package/lib/core.d.ts +195 -195
- package/lib/db.d.ts +107 -109
- package/lib/document.d.ts +199 -199
- package/lib/filemanager.d.ts +122 -122
- package/lib/http.d.ts +115 -115
- package/lib/index.d.ts +796 -790
- package/lib/logger.d.ts +113 -113
- package/lib/module.d.ts +137 -127
- package/lib/node.d.ts +21 -21
- package/lib/object.d.ts +29 -29
- package/lib/request.d.ts +146 -138
- package/lib/settings.d.ts +490 -490
- package/lib/squared.d.ts +339 -339
- package/lib/type.d.ts +34 -33
- package/lib/watch.d.ts +77 -77
- package/package.json +28 -28
- package/lib/dom.d.ts +0 -9
package/lib/request.d.ts
CHANGED
|
@@ -1,139 +1,147 @@
|
|
|
1
|
-
import type { BinaryAction } from './asset';
|
|
2
|
-
import type { HttpProtocolVersion, InternetProtocolVersion } from './http';
|
|
3
|
-
import type { HttpHostSettings } from './settings';
|
|
4
|
-
|
|
5
|
-
import type { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
|
|
6
|
-
import type { Readable, Writable } from 'stream';
|
|
7
|
-
|
|
8
|
-
interface KeepAliveAction {
|
|
9
|
-
keepAlive?: boolean;
|
|
10
|
-
agentTimeout?: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface SilentAction {
|
|
14
|
-
silent?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface ProtocolAction {
|
|
18
|
-
httpVersion?: HttpProtocolVersion;
|
|
19
|
-
ipVersion?: InternetProtocolVersion;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface IHttpHost {
|
|
23
|
-
localhost: boolean;
|
|
24
|
-
hasProtocol(version: HttpProtocolVersion): Promise<number>;
|
|
25
|
-
upgrade(version: HttpProtocolVersion, altSvc: Undef<string>): void;
|
|
26
|
-
success(version: HttpProtocolVersion, status?: boolean): number;
|
|
27
|
-
failed(version: HttpProtocolVersion, status?: boolean): number;
|
|
28
|
-
error(version: HttpProtocolVersion, status?: boolean): number;
|
|
29
|
-
didAltSvc(version: HttpProtocolVersion): boolean;
|
|
30
|
-
nextAltSvc(): boolean;
|
|
31
|
-
closeAltSvc(error?: boolean): boolean;
|
|
32
|
-
clearAltSvc(version?: HttpProtocolVersion): void;
|
|
33
|
-
flagAltSvc(version: HttpProtocolVersion, value: number): void;
|
|
34
|
-
reset(): void;
|
|
35
|
-
v2(): boolean;
|
|
36
|
-
set version(value);
|
|
37
|
-
get version(): HttpProtocolVersion;
|
|
38
|
-
get protocol(): string;
|
|
39
|
-
get secure(): boolean;
|
|
40
|
-
get hostname(): string;
|
|
41
|
-
get port(): string;
|
|
42
|
-
get origin(): string;
|
|
43
|
-
get streamSize(): number;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface HttpHostConstructor {
|
|
47
|
-
normalizeOrigin(value: string): string;
|
|
48
|
-
formatBasicAuth(url: URL): string;
|
|
49
|
-
getBasicAuth(url: URL): Undef<OutgoingHttpHeaders>;
|
|
50
|
-
defineLocalHost(values: string[]): void;
|
|
51
|
-
defineProtocolNegotiation(data: ObjectMap<string[]>): void;
|
|
52
|
-
defineHostConfig(settings: HttpHostSettings): void;
|
|
53
|
-
readonly prototype: IHttpHost;
|
|
54
|
-
new(url: URL, httpVersion?: HttpProtocolVersion): IHttpHost;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
58
|
-
host?: IHttpHost;
|
|
59
|
-
url?: URL;
|
|
60
|
-
base?: boolean;
|
|
61
|
-
socketPath?: string;
|
|
62
|
-
httpVersion?: HttpProtocolVersion;
|
|
63
|
-
method?:
|
|
64
|
-
search?: StringMap;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
1
|
+
import type { BinaryAction } from './asset';
|
|
2
|
+
import type { HttpProtocolVersion, InternetProtocolVersion } from './http';
|
|
3
|
+
import type { HttpHostSettings } from './settings';
|
|
4
|
+
|
|
5
|
+
import type { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
|
|
6
|
+
import type { Readable, Writable } from 'stream';
|
|
7
|
+
|
|
8
|
+
interface KeepAliveAction {
|
|
9
|
+
keepAlive?: boolean;
|
|
10
|
+
agentTimeout?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface SilentAction {
|
|
14
|
+
silent?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ProtocolAction {
|
|
18
|
+
httpVersion?: HttpProtocolVersion;
|
|
19
|
+
ipVersion?: InternetProtocolVersion;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IHttpHost {
|
|
23
|
+
localhost: boolean;
|
|
24
|
+
hasProtocol(version: HttpProtocolVersion): Promise<number>;
|
|
25
|
+
upgrade(version: HttpProtocolVersion, altSvc: Undef<string>): void;
|
|
26
|
+
success(version: HttpProtocolVersion, status?: boolean): number;
|
|
27
|
+
failed(version: HttpProtocolVersion, status?: boolean): number;
|
|
28
|
+
error(version: HttpProtocolVersion, status?: boolean): number;
|
|
29
|
+
didAltSvc(version: HttpProtocolVersion): boolean;
|
|
30
|
+
nextAltSvc(): boolean;
|
|
31
|
+
closeAltSvc(error?: boolean): boolean;
|
|
32
|
+
clearAltSvc(version?: HttpProtocolVersion): void;
|
|
33
|
+
flagAltSvc(version: HttpProtocolVersion, value: number): void;
|
|
34
|
+
reset(): void;
|
|
35
|
+
v2(): boolean;
|
|
36
|
+
set version(value);
|
|
37
|
+
get version(): HttpProtocolVersion;
|
|
38
|
+
get protocol(): string;
|
|
39
|
+
get secure(): boolean;
|
|
40
|
+
get hostname(): string;
|
|
41
|
+
get port(): string;
|
|
42
|
+
get origin(): string;
|
|
43
|
+
get streamSize(): number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface HttpHostConstructor {
|
|
47
|
+
normalizeOrigin(value: string): string;
|
|
48
|
+
formatBasicAuth(url: URL): string;
|
|
49
|
+
getBasicAuth(url: URL): Undef<OutgoingHttpHeaders>;
|
|
50
|
+
defineLocalHost(values: string[]): void;
|
|
51
|
+
defineProtocolNegotiation(data: ObjectMap<string[]>): void;
|
|
52
|
+
defineHostConfig(settings: HttpHostSettings): void;
|
|
53
|
+
readonly prototype: IHttpHost;
|
|
54
|
+
new(url: URL, httpVersion?: HttpProtocolVersion): IHttpHost;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
58
|
+
host?: IHttpHost;
|
|
59
|
+
url?: URL;
|
|
60
|
+
base?: boolean;
|
|
61
|
+
socketPath?: string;
|
|
62
|
+
httpVersion?: HttpProtocolVersion;
|
|
63
|
+
method?: HttpMethod | Lowercase<HttpMethod>;
|
|
64
|
+
search?: StringMap;
|
|
65
|
+
/** @deprecated followRedirect */
|
|
66
|
+
follow_redirect?: boolean;
|
|
67
|
+
followRedirect?: boolean;
|
|
68
|
+
encoding?: BufferEncoding;
|
|
69
|
+
maxBufferSize?: number | string;
|
|
70
|
+
format?: BufferFormat | { out?: BufferFormat; parser?: PlainObject };
|
|
71
|
+
headers?: OutgoingHttpHeaders | Headers;
|
|
72
|
+
signal?: AbortSignal;
|
|
73
|
+
timeout?: number;
|
|
74
|
+
pipeTo?: string | Writable;
|
|
75
|
+
postData?: unknown;
|
|
76
|
+
connected?: (headers: IncomingHttpHeaders) => Void<boolean>;
|
|
77
|
+
statusMessage?: string;
|
|
78
|
+
progressId?: number | string;
|
|
79
|
+
outFormat?: { out: BufferFormat; parser?: PlainObject };
|
|
80
|
+
outFilename?: Null<string>;
|
|
81
|
+
outHeaders?: Null<IncomingHttpHeaders>;
|
|
82
|
+
outStream?: Writable;
|
|
83
|
+
outAbort?: AbortController;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface PutOptions extends OpenOptions {
|
|
87
|
+
contentType?: string;
|
|
88
|
+
dataEncoding?: BufferEncoding;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface PostOptions extends PutOptions {
|
|
92
|
+
formData?: ArrayOf<FormDataPart>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface FormDataPart {
|
|
96
|
+
name?: string;
|
|
97
|
+
data?: Buffer | Readable | string;
|
|
98
|
+
value?: unknown;
|
|
99
|
+
contentType?: string;
|
|
100
|
+
filename?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface Aria2Options extends BinaryAction, SilentAction {
|
|
104
|
+
pathname?: string;
|
|
105
|
+
headers?: OutgoingHttpHeaders | Headers;
|
|
106
|
+
signal?: AbortSignal;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface HostConfig extends OpenOptions {
|
|
110
|
+
host: IHttpHost;
|
|
111
|
+
url: URL;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface ProxySettings extends KeepAliveAction {
|
|
115
|
+
host: URL;
|
|
116
|
+
exclude?: string[];
|
|
117
|
+
include?: string[];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface RequestInit extends ProtocolAction {
|
|
121
|
+
headers?: unknown;
|
|
122
|
+
readTimeout?: number;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface ClientConfig {
|
|
126
|
+
timeout?: number;
|
|
127
|
+
connectTimeout?: number;
|
|
128
|
+
redirectLimit?: number;
|
|
129
|
+
retryWait?: number;
|
|
130
|
+
retryAfter?: number;
|
|
131
|
+
retryLimit?: number;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface ApplyOptions extends ProtocolAction, PlainObject {
|
|
135
|
+
client?: ClientConfig;
|
|
136
|
+
readExpect?: ReadExpectType;
|
|
137
|
+
acceptEncoding?: boolean;
|
|
138
|
+
keepAlive?: boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "HEAD" | "DELETE";
|
|
142
|
+
export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
|
|
143
|
+
export type ReadExpectType = "always" | "string" | "none";
|
|
144
|
+
export type DataEncodedResult<T extends { encoding?: BufferEncoding }> = T extends { encoding: BufferEncoding } ? string : Null<Bufferable>;
|
|
145
|
+
export type DataObjectResult<T extends { format?: unknown; encoding?: BufferEncoding }> = T extends { format: string | PlainObject } ? Null<object> : DataEncodedResult<T>;
|
|
146
|
+
export type StatusOnCallback = (code: number, headers: IncomingHttpHeaders, url?: URL) => Void<boolean>;
|
|
139
147
|
export type HeadersOnCallback = (headers: IncomingHttpHeaders, url?: URL) => Void<boolean>;
|