@e-mc/types 0.9.12 → 0.9.13
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 +4 -4
- package/constant.d.ts +1 -2
- package/lib/index.d.ts +6 -3
- package/lib/request.d.ts +11 -5
- package/lib/settings.d.ts +1 -5
- package/package.json +2 -2
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.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.13/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -39,7 +39,7 @@ function isObject(value: unknown): value is object;
|
|
|
39
39
|
function isPlainObject(value: unknown): value is Record<string | number | symbol, unknown>;
|
|
40
40
|
function isString(value: unknown): value is string;
|
|
41
41
|
function isEmpty(value: unknown): boolean;
|
|
42
|
-
function asFunction(value: unknown, sync?: boolean): ((...args: unknown[]) =>
|
|
42
|
+
function asFunction(value: unknown, sync?: boolean): ((...args: unknown[]) => unknown) | null;
|
|
43
43
|
function parseTime(value: number | string, start?: number): number;
|
|
44
44
|
function parseExpires(value: number | string, start?: number): number;
|
|
45
45
|
function formatTime(value: number, char: string): string;
|
|
@@ -194,8 +194,8 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
194
194
|
|
|
195
195
|
## References
|
|
196
196
|
|
|
197
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
198
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
197
|
+
- https://www.unpkg.com/@e-mc/types@0.9.13/lib/logger.d.ts
|
|
198
|
+
- https://www.unpkg.com/@e-mc/types@0.9.13/lib/module.d.ts
|
|
199
199
|
|
|
200
200
|
* https://nodejs.org/api/perf_hooks.html
|
|
201
201
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const enum INTERNAL {
|
|
2
|
-
VERSION = '0.9.
|
|
2
|
+
VERSION = '0.9.13',
|
|
3
3
|
TEMP_DIR = 'tmp',
|
|
4
4
|
CJS = '__cjs__'
|
|
5
5
|
}
|
|
@@ -281,7 +281,6 @@ export const enum SETTINGS_KEY_NAME {
|
|
|
281
281
|
NODE_REQUIRE_EXT = "node.require.ext",
|
|
282
282
|
NODE_REQUIRE_NPM = "node.require.npm",
|
|
283
283
|
NODE_REQUIRE_INLINE = "node.require.inline",
|
|
284
|
-
NODE_PACKAGE_MANAGER = "node.settings.package_manager",
|
|
285
284
|
TEMP_DIR = "temp.dir",
|
|
286
285
|
TEMP_WRITE = "temp.write",
|
|
287
286
|
PROCESS_PASSWORD = "process.password",
|
package/lib/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type { CommandData, CropData, QualityData, ResizeData, RotateData, Transf
|
|
|
17
17
|
import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogState, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
|
|
18
18
|
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, GlobDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, WriteFileOptions } from './module';
|
|
19
19
|
import type { RequestData, Settings } from './node';
|
|
20
|
-
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from './request';
|
|
20
|
+
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, PutOptions, ReadExpectType, RequestInit, StatusOnCallback } from './request';
|
|
21
21
|
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';
|
|
22
22
|
import type { Command, SpawnResult } from './task';
|
|
23
23
|
import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
|
|
@@ -30,12 +30,12 @@ import type { LookupFunction } from 'net';
|
|
|
30
30
|
import type { Readable, Writable } from 'stream';
|
|
31
31
|
import type { SecureContextOptions } from 'tls';
|
|
32
32
|
import type { BrotliCompress, Gzip } from 'zlib';
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
import type { FileTypeResult } from 'file-type';
|
|
33
35
|
|
|
34
36
|
import type * as EventEmitter from 'events';
|
|
35
|
-
|
|
36
37
|
// @ts-ignore
|
|
37
38
|
import type * as ws from 'ws';
|
|
38
|
-
import type { FileTypeResult } from 'file-type';
|
|
39
39
|
|
|
40
40
|
type BufferView = Bufferable | NodeJS.ArrayBufferView;
|
|
41
41
|
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>>;
|
package/lib/request.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
|
56
56
|
url?: URL;
|
|
57
57
|
socketPath?: string;
|
|
58
58
|
httpVersion?: HttpProtocolVersion;
|
|
59
|
-
method?:
|
|
59
|
+
method?: HttpMethod | Lowercase<HttpMethod>;
|
|
60
60
|
search?: StringMap;
|
|
61
61
|
/** @deprecated followRedirect */
|
|
62
62
|
follow_redirect?: boolean;
|
|
@@ -64,7 +64,8 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
|
64
64
|
encoding?: BufferEncoding;
|
|
65
65
|
maxBufferSize?: NumString;
|
|
66
66
|
format?: BufferFormat | { out?: BufferFormat; parser?: PlainObject };
|
|
67
|
-
headers?: OutgoingHttpHeaders;
|
|
67
|
+
headers?: OutgoingHttpHeaders | Headers;
|
|
68
|
+
signal?: AbortSignal;
|
|
68
69
|
timeout?: number;
|
|
69
70
|
pipeTo?: string | Writable;
|
|
70
71
|
postData?: unknown;
|
|
@@ -78,12 +79,15 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
|
78
79
|
outAbort?: AbortController;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
export interface
|
|
82
|
+
export interface PutOptions extends OpenOptions {
|
|
82
83
|
contentType?: string;
|
|
83
|
-
formData?: ArrayOf<FormDataPart>;
|
|
84
84
|
dataEncoding?: BufferEncoding;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export interface PostOptions extends PutOptions {
|
|
88
|
+
formData?: ArrayOf<FormDataPart>;
|
|
89
|
+
}
|
|
90
|
+
|
|
87
91
|
export interface FormDataPart {
|
|
88
92
|
name?: string;
|
|
89
93
|
data?: Buffer | Readable | string;
|
|
@@ -94,7 +98,8 @@ export interface FormDataPart {
|
|
|
94
98
|
|
|
95
99
|
export interface Aria2Options extends BinaryAction, SilentAction {
|
|
96
100
|
pathname?: string;
|
|
97
|
-
headers?: OutgoingHttpHeaders;
|
|
101
|
+
headers?: OutgoingHttpHeaders | Headers;
|
|
102
|
+
signal?: AbortSignal;
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
export interface HostConfig extends OpenOptions {
|
|
@@ -129,6 +134,7 @@ export interface ApplyOptions extends ProtocolAction, PlainObject {
|
|
|
129
134
|
keepAlive?: boolean;
|
|
130
135
|
}
|
|
131
136
|
|
|
137
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "HEAD" | "DELETE";
|
|
132
138
|
export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
|
|
133
139
|
export type ReadExpectType = "always" | "string" | "none";
|
|
134
140
|
export type DataEncodedResult<T extends { encoding?: BufferEncoding }> = T extends { encoding: BufferEncoding } ? string : Null<Bufferable>;
|
package/lib/settings.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface ClientSettings<T = PlainObject> extends PlainObject {
|
|
|
38
38
|
cache_dir?: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export interface NodeModule<T =
|
|
41
|
+
export interface NodeModule<T = PlainObject> extends HandlerSettings<T> {
|
|
42
42
|
process?: {
|
|
43
43
|
cpu_usage?: boolean;
|
|
44
44
|
memory_usage?: boolean;
|
|
@@ -51,10 +51,6 @@ export interface NodeModule<T = NodeSettings> extends HandlerSettings<T> {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export interface NodeSettings extends PlainObject {
|
|
55
|
-
package_manager?: "npm" | "yarn" | "pnpm";
|
|
56
|
-
}
|
|
57
|
-
|
|
58
54
|
export interface ProcessModule<T = PlainObject> extends HandlerSettings<T> {
|
|
59
55
|
env?: ProcessEnvConfig;
|
|
60
56
|
thread?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/types",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.13",
|
|
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"
|