@e-mc/types 0.10.2 → 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/README.md +6 -6
- package/constant.d.ts +1 -1
- package/index.d.ts +1 -1
- package/lib/index.d.ts +11 -6
- package/lib/module.d.ts +8 -0
- package/lib/request.d.ts +11 -5
- package/lib/type.d.ts +0 -2
- package/package.json +2 -2
- 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.10.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.3/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -37,7 +37,7 @@ function isObject(value: unknown): value is object;
|
|
|
37
37
|
function isPlainObject(value: unknown): value is Record<string | number | symbol, unknown>;
|
|
38
38
|
function isString(value: unknown): value is string;
|
|
39
39
|
function isEmpty(value: unknown): boolean;
|
|
40
|
-
function asFunction(value: unknown, sync?: boolean): ((...args: unknown[]) =>
|
|
40
|
+
function asFunction(value: unknown, sync?: boolean): ((...args: unknown[]) => unknown) | null;
|
|
41
41
|
function parseTime(value: number | string, start?: number): number;
|
|
42
42
|
function parseExpires(value: number | string, start?: number): number;
|
|
43
43
|
function formatTime(value: number, char: string): string;
|
|
@@ -196,10 +196,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
196
196
|
|
|
197
197
|
## References
|
|
198
198
|
|
|
199
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
200
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
201
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
202
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
199
|
+
- https://www.unpkg.com/@e-mc/types@0.10.3/index.d.ts
|
|
200
|
+
- https://www.unpkg.com/@e-mc/types@0.10.3/lib/logger.d.ts
|
|
201
|
+
- https://www.unpkg.com/@e-mc/types@0.10.3/lib/module.d.ts
|
|
202
|
+
- https://www.unpkg.com/@e-mc/types@0.10.3/lib/object.d.ts
|
|
203
203
|
|
|
204
204
|
* https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
205
205
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -298,7 +298,7 @@ declare namespace types {
|
|
|
298
298
|
function isPlainObject<T = PlainObject>(value: unknown): value is T;
|
|
299
299
|
function isString(value: unknown): value is string;
|
|
300
300
|
function isEmpty(value: unknown): boolean;
|
|
301
|
-
function asFunction<
|
|
301
|
+
function asFunction<U = unknown, V = unknown>(value: unknown, sync?: boolean): Null<FunctionType<U, V>>;
|
|
302
302
|
function parseTime(value: number | string, start?: number): number;
|
|
303
303
|
function parseExpires(value: number | string, start?: number): number;
|
|
304
304
|
function formatTime(value: number, char: string): string;
|
package/lib/index.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutp
|
|
|
13
13
|
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
14
14
|
import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
|
|
15
15
|
import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogState, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
|
|
16
|
-
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, FileTypeFormat, MoveFileOptions, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, TempDirOptions, WriteFileOptions } from './module';
|
|
16
|
+
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, FileTypeFormat, GlobDirOptions, MoveFileOptions, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, TempDirOptions, WriteFileOptions } from './module';
|
|
17
17
|
import type { RequestData, Settings } from './node';
|
|
18
|
-
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from './request';
|
|
18
|
+
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, PutOptions, ReadExpectType, RequestInit, StatusOnCallback } from './request';
|
|
19
19
|
import type { ClientModule, CloudAuthSettings, CloudModule, CloudServiceOptions, CompressModule, CompressSettings, DbCoerceSettings, DbModule, DbSourceOptions, DnsLookupSettings, DocumentComponent, DocumentComponentOption, DocumentModule, HandlerSettings, HttpConnectSettings, HttpMemorySettings, ImageModule, LoggerFormat, LoggerFormatSettings, PoolConfig, RequestModule, RequestSettings, TaskModule, WatchModule } from './settings';
|
|
20
20
|
import type { Command, SpawnResult } from './task';
|
|
21
21
|
import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
|
|
@@ -28,12 +28,12 @@ import type { LookupFunction } from 'net';
|
|
|
28
28
|
import type { Readable, Writable } from 'stream';
|
|
29
29
|
import type { SecureContextOptions } from 'tls';
|
|
30
30
|
import type { BrotliCompress, Gzip } from 'zlib';
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
import type { FileTypeResult } from 'file-type';
|
|
31
33
|
|
|
32
34
|
import type * as EventEmitter from 'events';
|
|
33
|
-
|
|
34
35
|
// @ts-ignore
|
|
35
36
|
import type * as ws from 'ws';
|
|
36
|
-
import type { FileTypeResult } from 'file-type';
|
|
37
37
|
|
|
38
38
|
type BufferView = Bufferable | NodeJS.ArrayBufferView;
|
|
39
39
|
type CpuUsage = NodeJS.CpuUsage;
|
|
@@ -327,6 +327,9 @@ declare namespace functions {
|
|
|
327
327
|
opts(url: string | URL, options?: OpenOptions): HostConfig;
|
|
328
328
|
open(uri: string | URL, options: OpenOptions): HttpRequestClient;
|
|
329
329
|
head(uri: string | URL, options?: OpenOptions): ClientRequest;
|
|
330
|
+
put<V extends { format: undefined; encoding: undefined }>(uri: string | URL, data: unknown, contentType: string): Promise<DataObjectResult<V>>;
|
|
331
|
+
put<V extends PutOptions>(uri: string | URL, data: unknown, options: V): Promise<DataObjectResult<V>>;
|
|
332
|
+
put<V extends PutOptions>(uri: string | URL, data: unknown, contentType?: string | V, options?: V): Promise<DataObjectResult<V>>;
|
|
330
333
|
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, data: unknown, contentType: string): Promise<DataObjectResult<V>>;
|
|
331
334
|
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
|
|
332
335
|
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, form: AnyObject, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
|
|
@@ -726,8 +729,8 @@ declare namespace functions {
|
|
|
726
729
|
formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
|
|
727
730
|
writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
|
|
728
731
|
enabled(key: string, username?: string): boolean;
|
|
729
|
-
parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
|
|
730
|
-
parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
|
|
732
|
+
parseFunction<U = unknown, V = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U, V>>;
|
|
733
|
+
parseFunction<U = unknown, V = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U, V>>;
|
|
731
734
|
asString(value: unknown, cacheKey?: boolean | "throws"): string;
|
|
732
735
|
asHash(data: BinaryLike, options?: AsHashOptions): string;
|
|
733
736
|
asHash(data: BinaryLike, algorithm?: string, options?: HashOptions): string;
|
|
@@ -753,6 +756,8 @@ declare namespace functions {
|
|
|
753
756
|
removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
|
|
754
757
|
copyDir(src: string | URL, dest: string | URL, move?: boolean, recursive?: boolean): Promise<CopyDirResult>;
|
|
755
758
|
copyDir(src: string | URL, dest: string | URL, options?: CopyDirOptions): Promise<CopyDirResult>;
|
|
759
|
+
globDir(src: string | URL, pattern: ArrayOf<string>, recursive: boolean | number): Promise<string[]>;
|
|
760
|
+
globDir(src: string | URL, pattern: ArrayOf<string>, options?: GlobDirOptions): Promise<string[]>;
|
|
756
761
|
renameFile(src: string | URL, dest: string | URL, throws?: boolean): boolean;
|
|
757
762
|
streamFile<U extends Bufferable>(value: string | URL, cache: boolean): Promise<U>;
|
|
758
763
|
streamFile<U extends ReadBufferOptions>(value: string | URL, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
package/lib/module.d.ts
CHANGED
|
@@ -100,6 +100,14 @@ export interface CopyDirResult {
|
|
|
100
100
|
ignored: string[];
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
export interface GlobDirOptions {
|
|
104
|
+
exclude?: ArrayOf<string>;
|
|
105
|
+
recursive?: boolean | number;
|
|
106
|
+
matchBase?: boolean;
|
|
107
|
+
dot?: boolean;
|
|
108
|
+
contains?: boolean;
|
|
109
|
+
}
|
|
110
|
+
|
|
103
111
|
export interface StreamBase extends StreamAction {
|
|
104
112
|
signal?: AbortSignal;
|
|
105
113
|
}
|
package/lib/request.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
|
60
60
|
base?: boolean;
|
|
61
61
|
socketPath?: string;
|
|
62
62
|
httpVersion?: HttpProtocolVersion;
|
|
63
|
-
method?:
|
|
63
|
+
method?: HttpMethod | Lowercase<HttpMethod>;
|
|
64
64
|
search?: StringMap;
|
|
65
65
|
/** @deprecated followRedirect */
|
|
66
66
|
follow_redirect?: boolean;
|
|
@@ -68,7 +68,8 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
|
68
68
|
encoding?: BufferEncoding;
|
|
69
69
|
maxBufferSize?: number | string;
|
|
70
70
|
format?: BufferFormat | { out?: BufferFormat; parser?: PlainObject };
|
|
71
|
-
headers?: OutgoingHttpHeaders;
|
|
71
|
+
headers?: OutgoingHttpHeaders | Headers;
|
|
72
|
+
signal?: AbortSignal;
|
|
72
73
|
timeout?: number;
|
|
73
74
|
pipeTo?: string | Writable;
|
|
74
75
|
postData?: unknown;
|
|
@@ -82,12 +83,15 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
|
82
83
|
outAbort?: AbortController;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
export interface
|
|
86
|
+
export interface PutOptions extends OpenOptions {
|
|
86
87
|
contentType?: string;
|
|
87
|
-
formData?: ArrayOf<FormDataPart>;
|
|
88
88
|
dataEncoding?: BufferEncoding;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
export interface PostOptions extends PutOptions {
|
|
92
|
+
formData?: ArrayOf<FormDataPart>;
|
|
93
|
+
}
|
|
94
|
+
|
|
91
95
|
export interface FormDataPart {
|
|
92
96
|
name?: string;
|
|
93
97
|
data?: Buffer | Readable | string;
|
|
@@ -98,7 +102,8 @@ export interface FormDataPart {
|
|
|
98
102
|
|
|
99
103
|
export interface Aria2Options extends BinaryAction, SilentAction {
|
|
100
104
|
pathname?: string;
|
|
101
|
-
headers?: OutgoingHttpHeaders;
|
|
105
|
+
headers?: OutgoingHttpHeaders | Headers;
|
|
106
|
+
signal?: AbortSignal;
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
export interface HostConfig extends OpenOptions {
|
|
@@ -133,6 +138,7 @@ export interface ApplyOptions extends ProtocolAction, PlainObject {
|
|
|
133
138
|
keepAlive?: boolean;
|
|
134
139
|
}
|
|
135
140
|
|
|
141
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "HEAD" | "DELETE";
|
|
136
142
|
export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
|
|
137
143
|
export type ReadExpectType = "always" | "string" | "none";
|
|
138
144
|
export type DataEncodedResult<T extends { encoding?: BufferEncoding }> = T extends { encoding: BufferEncoding } ? string : Null<Bufferable>;
|
package/lib/type.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/types",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Type definitions for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"squared-functions"
|
|
18
18
|
],
|
|
19
19
|
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "BSD
|
|
20
|
+
"license": "BSD-3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"bytes": "^3.1.2"
|