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