@e-mc/types 0.13.6 → 0.13.7
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/README.md +5 -5
- package/constant.d.ts +1 -1
- package/index.js +11 -11
- package/lib/core.d.ts +5 -4
- package/lib/http.d.ts +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/request.d.ts +50 -0
- package/lib/settings.d.ts +13 -19
- package/lib/squared.d.ts +7 -6
- package/package.json +1 -1
- package/lib/dom.d.ts +0 -9
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.13.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.13.7/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -208,10 +208,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
208
208
|
|
|
209
209
|
## References
|
|
210
210
|
|
|
211
|
-
- https://www.unpkg.com/@e-mc/types@0.13.
|
|
212
|
-
- https://www.unpkg.com/@e-mc/types@0.13.
|
|
213
|
-
- https://www.unpkg.com/@e-mc/types@0.13.
|
|
214
|
-
- https://www.unpkg.com/@e-mc/types@0.13.
|
|
211
|
+
- https://www.unpkg.com/@e-mc/types@0.13.7/index.d.ts
|
|
212
|
+
- https://www.unpkg.com/@e-mc/types@0.13.7/lib/logger.d.ts
|
|
213
|
+
- https://www.unpkg.com/@e-mc/types@0.13.7/lib/module.d.ts
|
|
214
|
+
- https://www.unpkg.com/@e-mc/types@0.13.7/lib/node.d.ts
|
|
215
215
|
|
|
216
216
|
* https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
217
217
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1051,18 +1051,18 @@ function asFunction(value, sync = true) {
|
|
|
1051
1051
|
}
|
|
1052
1052
|
function getEncoding(value, fallback) {
|
|
1053
1053
|
if (typeof value === 'string') {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1054
|
+
const result = value.trim().toLowerCase();
|
|
1055
|
+
if (result.slice(0, 3) === 'utf') {
|
|
1056
|
+
switch (result.slice(result[3] === '-' ? 4 : 3)) {
|
|
1057
|
+
case '8':
|
|
1058
|
+
return 'utf8';
|
|
1059
|
+
case '16le':
|
|
1060
|
+
case '16':
|
|
1061
|
+
return 'utf16le';
|
|
1062
|
+
}
|
|
1063
1063
|
}
|
|
1064
|
-
if (Buffer.isEncoding(
|
|
1065
|
-
return
|
|
1064
|
+
else if (Buffer.isEncoding(result)) {
|
|
1065
|
+
return result;
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
1068
|
return fallback || 'utf8';
|
package/lib/core.d.ts
CHANGED
|
@@ -40,11 +40,11 @@ export interface IClientDb<T extends IHost, U extends ClientModule<ClientDbSetti
|
|
|
40
40
|
hasCache(source: string, sessionKey?: string): boolean;
|
|
41
41
|
hasCoerce(source: string, component: keyof DbCoerceSettings, uuidKey: string | undefined): boolean;
|
|
42
42
|
hasCoerce(source: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
|
|
43
|
+
getQueryResult(source: string, credential: unknown, queryString: string, options: CacheOptions): QueryResult | undefined;
|
|
43
44
|
getQueryResult(source: string, credential: unknown, queryString: string, renewCache: boolean): QueryResult | undefined;
|
|
44
|
-
getQueryResult(source: string, credential: unknown, queryString: string, sessionKey?: string, renewCache?: boolean): QueryResult | undefined;
|
|
45
|
-
|
|
46
|
-
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey?: string): QueryResult;
|
|
47
|
-
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
|
|
45
|
+
getQueryResult(source: string, credential: unknown, queryString: string, sessionKey?: string | CacheOptions, renewCache?: boolean): QueryResult | undefined;
|
|
46
|
+
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options: CacheOptions): QueryResult;
|
|
47
|
+
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey?: string | CacheOptions): QueryResult;
|
|
48
48
|
getCacheResult(source: string, credential: unknown, queryString: string, cacheValue: CacheOptions, ignoreCache?: IntBool | FirstOf<number, number>): QueryResult | undefined;
|
|
49
49
|
applyState(items: V | V[], value: number, as?: boolean): void;
|
|
50
50
|
commit(items?: V[]): Promise<boolean>;
|
|
@@ -68,6 +68,7 @@ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientMo
|
|
|
68
68
|
loadSettings(settings: Pick<Settings, "process" | "memory">, password?: string): boolean;
|
|
69
69
|
getTimeout(value: number | string | TimeoutAction | undefined): number;
|
|
70
70
|
convertTime(value: number | string): number;
|
|
71
|
+
findResult(source: string, credential: unknown, queryString: string, timeout: number, renewCache: boolean): QueryResult | undefined;
|
|
71
72
|
findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): QueryResult | undefined;
|
|
72
73
|
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, options: StoreResultOptions): QueryResult;
|
|
73
74
|
/** @deprecated */
|
package/lib/http.d.ts
CHANGED
|
@@ -112,7 +112,8 @@ export interface AuthValue {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
export type HttpRequestClient = ClientRequest | ClientHttp2Stream;
|
|
115
|
-
export type
|
|
115
|
+
export type HttpHeaders = OutgoingHttpHeaders | Headers;
|
|
116
|
+
export type HttpOutgoingHeaders = ObjectMap<HttpHeaders>;
|
|
116
117
|
export type HttpAgentOptions = Pick<AgentOptions, "timeout" | "maxSockets" | "maxTotalSockets" | "keepAliveMsecs" | "maxFreeSockets" | "proxyEnv">;
|
|
117
118
|
export type HttpProtocolVersion = 1 | 2 | 3;
|
|
118
119
|
export type InternetProtocolVersion = 0 | 4 | 6;
|
package/lib/index.d.ts
CHANGED
|
@@ -680,6 +680,7 @@ declare namespace functions {
|
|
|
680
680
|
getThreadCount(full: true): ThreadCountStat;
|
|
681
681
|
getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
|
|
682
682
|
getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
|
|
683
|
+
parseIp(value: unknown, kind?: "ipv4" | "ipv6"): string;
|
|
683
684
|
getLogDelayed(): FormatMessageArgs[];
|
|
684
685
|
getPermissionFromSettings(freeze?: boolean): IPermission;
|
|
685
686
|
readonly prototype: IHost;
|
package/lib/request.d.ts
CHANGED
|
@@ -38,13 +38,20 @@ export interface IHttpHost {
|
|
|
38
38
|
success(version: HttpProtocolVersion, status?: boolean): number;
|
|
39
39
|
failed(version: HttpProtocolVersion, status?: boolean): number;
|
|
40
40
|
error(version: HttpProtocolVersion, status?: boolean): number;
|
|
41
|
+
/** @deprecated altSvc.did */
|
|
41
42
|
didAltSvc(version: HttpProtocolVersion): boolean;
|
|
43
|
+
/** @deprecated altSvc.next */
|
|
42
44
|
nextAltSvc(): boolean;
|
|
45
|
+
/** @deprecated altSvc.close */
|
|
43
46
|
closeAltSvc(error?: boolean): boolean;
|
|
47
|
+
/** @deprecated altSvc.clear */
|
|
44
48
|
clearAltSvc(version?: HttpProtocolVersion): void;
|
|
49
|
+
/** @deprecated altSvc.flag */
|
|
45
50
|
flagAltSvc(version: HttpProtocolVersion, value: number): void;
|
|
46
51
|
reset(): void;
|
|
52
|
+
v1(): boolean;
|
|
47
53
|
v2(): boolean;
|
|
54
|
+
get altSvc(): IHttpHostAltSvc;
|
|
48
55
|
set version(value);
|
|
49
56
|
get version(): HttpProtocolVersion;
|
|
50
57
|
get protocol(): string;
|
|
@@ -66,6 +73,25 @@ export interface HttpHostConstructor {
|
|
|
66
73
|
new(url: URL, httpVersion?: HttpProtocolVersion): IHttpHost;
|
|
67
74
|
}
|
|
68
75
|
|
|
76
|
+
export interface IHttpHostAltSvc {
|
|
77
|
+
did(version: HttpProtocolVersion): boolean;
|
|
78
|
+
next(): boolean;
|
|
79
|
+
close(error?: boolean): boolean;
|
|
80
|
+
clear(version?: HttpProtocolVersion): void;
|
|
81
|
+
flag(version: HttpProtocolVersion, value: number): void;
|
|
82
|
+
valid(hostname: string, port: string, version: number): boolean;
|
|
83
|
+
set available(value: unknown[]);
|
|
84
|
+
get errors(): AltSvcInfo[];
|
|
85
|
+
get hostname(): string | undefined;
|
|
86
|
+
get port(): string | undefined;
|
|
87
|
+
get origin(): string | undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface HttpHostAltSvcConstructor {
|
|
91
|
+
readonly prototype: IHttpHostAltSvc;
|
|
92
|
+
new(host: IHttpHost, versionData: AltSvcData): IHttpHostAltSvc;
|
|
93
|
+
}
|
|
94
|
+
|
|
69
95
|
export interface IHttpAdapter<T extends OpenOptions = OpenOptions> {
|
|
70
96
|
instance: IRequest;
|
|
71
97
|
state: ControllerState;
|
|
@@ -218,6 +244,30 @@ export interface ControllerState {
|
|
|
218
244
|
readonly config: Required<ClientConfig>;
|
|
219
245
|
}
|
|
220
246
|
|
|
247
|
+
export interface AltSvcInfo {
|
|
248
|
+
hostname: string;
|
|
249
|
+
port: string;
|
|
250
|
+
version: number;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface AltSvcLocation extends Partial<AltSvcInfo> {
|
|
254
|
+
origin?: string;
|
|
255
|
+
timeout?: NodeJS.Timeout | null;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface AltSvcAvailability extends AltSvcInfo {
|
|
259
|
+
expires: number;
|
|
260
|
+
persist: boolean;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface AltSvcData {
|
|
264
|
+
success: number;
|
|
265
|
+
failed: number;
|
|
266
|
+
errors: number;
|
|
267
|
+
alpn: number;
|
|
268
|
+
status: number;
|
|
269
|
+
}
|
|
270
|
+
|
|
221
271
|
export type HttpMethod = "GET" | "POST" | "PUT" | "HEAD" | "DELETE";
|
|
222
272
|
export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
|
|
223
273
|
export type ReadExpectType = "always" | "string" | "none";
|
package/lib/settings.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WatchInterval } from './squared';
|
|
1
|
+
import type { ExpiresAction, WatchInterval } from './squared';
|
|
2
2
|
|
|
3
3
|
import type { HashAlgorithm } from './asset';
|
|
4
4
|
import type { CloudSource } from './cloud';
|
|
@@ -74,20 +74,18 @@ export interface ProcessModule<T = PlainObject> extends HandlerSettings<T> {
|
|
|
74
74
|
};
|
|
75
75
|
queue?: {
|
|
76
76
|
limit?: number | string;
|
|
77
|
-
expires?: number | string;
|
|
78
77
|
priority: { bypass?: number | string } & MinMax<number | string>;
|
|
79
|
-
};
|
|
78
|
+
} & ExpiresAction;
|
|
80
79
|
worker?: {
|
|
81
80
|
users?: boolean | string[];
|
|
82
81
|
max?: number | string;
|
|
83
82
|
max_expires?: number | string;
|
|
84
83
|
locked?: boolean;
|
|
85
|
-
channel?: MinMax<number | string> &
|
|
84
|
+
channel?: MinMax<number | string> & ExpiresAction & { verbose?: boolean };
|
|
86
85
|
};
|
|
87
86
|
limit?: number | string;
|
|
88
87
|
sub_limit?: number | string;
|
|
89
|
-
|
|
90
|
-
};
|
|
88
|
+
} & ExpiresAction;
|
|
91
89
|
cipher?: CipherConfig;
|
|
92
90
|
password?: string;
|
|
93
91
|
}
|
|
@@ -114,8 +112,7 @@ export interface PermissionSettings extends PlainObject {
|
|
|
114
112
|
minimatch?: MinimatchOptions | null;
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
export interface DownloadModule<T = PlainObject> extends HandlerSettings<T
|
|
118
|
-
expires?: number | string;
|
|
115
|
+
export interface DownloadModule<T = PlainObject> extends HandlerSettings<T>, ExpiresAction {
|
|
119
116
|
aria2?: DownloadAction & {
|
|
120
117
|
check_integrity?: boolean;
|
|
121
118
|
update_status?: number | string | { interval?: number | string; broadcast_only?: boolean };
|
|
@@ -233,7 +230,7 @@ export interface DocumentDirectory extends StringMap {
|
|
|
233
230
|
export type DocumentComponentOptions = DocumentComponent<DocumentComponentOption<DocumentTransform>, DocumentComponentOption<boolean>>;
|
|
234
231
|
|
|
235
232
|
export interface ClientDbSettings<T = PlainObject> extends ClientSettings<T>, PurgeAction {
|
|
236
|
-
session_expires?: number;
|
|
233
|
+
session_expires?: number | string;
|
|
237
234
|
user_key?: ObjectMap<DbSourceOptions>;
|
|
238
235
|
imports?: StringMap;
|
|
239
236
|
}
|
|
@@ -246,13 +243,13 @@ export interface MemorySettings extends PlainObject {
|
|
|
246
243
|
file_count?: boolean;
|
|
247
244
|
};
|
|
248
245
|
cache_disk?: MemoryCacheDiskSettings;
|
|
246
|
+
gc?: { interval?: number | string; expires_limit?: number | string } & ExpiresAction;
|
|
249
247
|
}
|
|
250
248
|
|
|
251
|
-
export interface MemoryCacheDiskSettings<T = number | string, U = string[] | null> extends IncludeAction<U> {
|
|
249
|
+
export interface MemoryCacheDiskSettings<T = number | string, U = string[] | null> extends IncludeAction<U>, ExpiresAction<T> {
|
|
252
250
|
enabled?: boolean;
|
|
253
251
|
min_size?: T;
|
|
254
252
|
max_size?: T;
|
|
255
|
-
expires?: T;
|
|
256
253
|
}
|
|
257
254
|
|
|
258
255
|
export interface DbModule<T = DbSettings> extends ClientModule<T>, DbSourceDataType<ObjectMap<AnyObject>>, PlainObject {
|
|
@@ -282,6 +279,7 @@ export interface DbCoerceSettings<T = boolean> {
|
|
|
282
279
|
|
|
283
280
|
export interface PurgeBase<T = number | string> extends MinMax {
|
|
284
281
|
enabled?: boolean;
|
|
282
|
+
type?: "lru" | "lfu";
|
|
285
283
|
percent?: T;
|
|
286
284
|
limit?: T;
|
|
287
285
|
}
|
|
@@ -504,10 +502,9 @@ export interface HttpSettings {
|
|
|
504
502
|
certs?: ObjectMap<SecureConfig<string | string[]>>;
|
|
505
503
|
}
|
|
506
504
|
|
|
507
|
-
export interface HttpDiskSettings extends IncludeAction {
|
|
505
|
+
export interface HttpDiskSettings extends IncludeAction, ExpiresAction {
|
|
508
506
|
enabled?: boolean;
|
|
509
507
|
limit?: number | string;
|
|
510
|
-
expires?: number | string;
|
|
511
508
|
}
|
|
512
509
|
|
|
513
510
|
export interface HttpMemorySettings extends HttpDiskSettings {
|
|
@@ -524,17 +521,15 @@ export interface HttpConnectSettings {
|
|
|
524
521
|
redirect_limit?: number | string;
|
|
525
522
|
}
|
|
526
523
|
|
|
527
|
-
export interface DnsLookupSettings {
|
|
524
|
+
export interface DnsLookupSettings extends ExpiresAction {
|
|
528
525
|
family?: number | string;
|
|
529
|
-
expires?: number | string;
|
|
530
526
|
resolve?: ObjectMap<Partial<LookupAddress>>;
|
|
531
527
|
}
|
|
532
528
|
|
|
533
|
-
export interface HashConfig extends IncludeAction<ObjectMap<string[] | "*"
|
|
529
|
+
export interface HashConfig extends IncludeAction<ObjectMap<string[] | "*">>, ExpiresAction {
|
|
534
530
|
enabled?: boolean;
|
|
535
531
|
algorithm?: HashAlgorithm;
|
|
536
532
|
etag?: boolean;
|
|
537
|
-
expires?: number | string;
|
|
538
533
|
renew?: boolean;
|
|
539
534
|
limit?: number | string;
|
|
540
535
|
}
|
|
@@ -552,10 +547,9 @@ export interface PurgeAction {
|
|
|
552
547
|
purge?: PurgeComponent;
|
|
553
548
|
}
|
|
554
549
|
|
|
555
|
-
export interface CacheDirAction {
|
|
550
|
+
export interface CacheDirAction extends ExpiresAction {
|
|
556
551
|
enabled?: boolean;
|
|
557
552
|
dir?: string;
|
|
558
|
-
expires?: number | string;
|
|
559
553
|
}
|
|
560
554
|
|
|
561
555
|
export interface PoolConfig<T = number> extends MinMax {
|
package/lib/squared.d.ts
CHANGED
|
@@ -149,6 +149,10 @@ export interface FromAction {
|
|
|
149
149
|
from?: string[];
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
export interface ExpiresAction<T = number | string> {
|
|
153
|
+
expires?: T;
|
|
154
|
+
}
|
|
155
|
+
|
|
152
156
|
export interface TaskCommand<T = PlainObject> {
|
|
153
157
|
handler?: string;
|
|
154
158
|
task?: string | T;
|
|
@@ -204,11 +208,10 @@ export interface LocationUri {
|
|
|
204
208
|
filename: string;
|
|
205
209
|
}
|
|
206
210
|
|
|
207
|
-
export interface ViewEngine<T = unknown, U = PlainObject> {
|
|
211
|
+
export interface ViewEngine<T = unknown, U = PlainObject> extends ExpiresAction {
|
|
208
212
|
name?: string;
|
|
209
213
|
singleRow?: boolean;
|
|
210
214
|
outputEmpty?: boolean;
|
|
211
|
-
expires?: number | string;
|
|
212
215
|
options?: {
|
|
213
216
|
compile?: T;
|
|
214
217
|
output?: U;
|
|
@@ -323,9 +326,8 @@ export interface ResponseError {
|
|
|
323
326
|
hint?: string;
|
|
324
327
|
}
|
|
325
328
|
|
|
326
|
-
export interface RequestObserve extends WebSocketClient {
|
|
329
|
+
export interface RequestObserve extends WebSocketClient, ExpiresAction {
|
|
327
330
|
action?: string;
|
|
328
|
-
expires?: number | string;
|
|
329
331
|
}
|
|
330
332
|
|
|
331
333
|
export interface ChecksumBase<T = BinaryToTextEncoding> {
|
|
@@ -342,10 +344,9 @@ export interface ChecksumOutput<T = BinaryToTextEncoding> extends ChecksumBase<T
|
|
|
342
344
|
recursive?: boolean | 1;
|
|
343
345
|
}
|
|
344
346
|
|
|
345
|
-
export interface TaskBase {
|
|
347
|
+
export interface TaskBase extends ExpiresAction {
|
|
346
348
|
interval?: number | string;
|
|
347
349
|
start?: number | string;
|
|
348
|
-
expires?: number | string;
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
export type WebSocketEvent = "close" | "error";
|
package/package.json
CHANGED