@e-mc/types 0.10.6 → 0.11.1
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 +1 -1
- package/README.md +12 -10
- package/constant.d.ts +39 -10
- package/index.d.ts +35 -20
- package/index.js +86 -114
- package/lib/asset.d.ts +3 -3
- package/lib/cloud.d.ts +11 -4
- package/lib/compress.d.ts +12 -11
- package/lib/core.d.ts +31 -30
- package/lib/db.d.ts +20 -17
- package/lib/document.d.ts +17 -16
- package/lib/filemanager.d.ts +12 -11
- package/lib/http.d.ts +7 -6
- package/lib/image.d.ts +53 -43
- package/lib/index.d.ts +195 -170
- package/lib/logger.d.ts +7 -2
- package/lib/module.d.ts +31 -44
- package/lib/node.d.ts +9 -3
- package/lib/object.d.ts +1 -3
- package/lib/request.d.ts +96 -24
- package/lib/settings.d.ts +126 -90
- package/lib/squared.d.ts +26 -57
- package/lib/type.d.ts +11 -6
- package/lib/watch.d.ts +5 -5
- package/package.json +4 -3
- package/lib/compat-v4.d.ts +0 -116
package/lib/db.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DataSource, DbDataSource } from './squared';
|
|
2
2
|
|
|
3
3
|
import type { CacheOptions, IdentifierAction } from './core';
|
|
4
|
+
import type { AuthValue } from './http';
|
|
4
5
|
|
|
5
6
|
import type { DB_TYPE } from '../index.d';
|
|
6
7
|
|
|
@@ -32,14 +33,12 @@ export interface ProcessRowsOptions {
|
|
|
32
33
|
parallel?: boolean;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export interface DbConnection {
|
|
36
|
+
export interface DbConnection extends Required<AuthValue> {
|
|
37
|
+
protocol: string;
|
|
36
38
|
hostname: string;
|
|
37
|
-
password: string;
|
|
38
|
-
pathname: string;
|
|
39
39
|
port: string;
|
|
40
|
-
|
|
40
|
+
pathname: string;
|
|
41
41
|
search: string;
|
|
42
|
-
username: string;
|
|
43
42
|
database: string;
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -56,16 +55,16 @@ export interface ServerAuth<T = number> extends AuthValue, IdentifierAction {
|
|
|
56
55
|
database?: string;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
|
|
58
|
+
export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
|
|
60
59
|
client: U;
|
|
61
60
|
lastAccessed: number;
|
|
62
61
|
success: number;
|
|
63
62
|
failed: number;
|
|
64
63
|
poolKey: string;
|
|
65
|
-
uuidKey:
|
|
64
|
+
uuidKey: AuthValue | null;
|
|
66
65
|
add(item: T, uuidKey?: string): this;
|
|
67
66
|
has(item: T): boolean;
|
|
68
|
-
getConnection(): Promise<V>;
|
|
67
|
+
getConnection(credential?: W): Promise<V>;
|
|
69
68
|
remove(): void;
|
|
70
69
|
detach(force?: boolean): Promise<void>;
|
|
71
70
|
close(): Promise<void>;
|
|
@@ -78,22 +77,26 @@ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V =
|
|
|
78
77
|
set parent(value: ObjectMap<IDbPool<T>>);
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
|
|
81
|
+
CACHE_UNUSED: readonly string[];
|
|
82
|
+
asString(credential: unknown): string;
|
|
83
|
+
sanitize(credential: unknown): unknown;
|
|
84
|
+
removeUUIDKey<X>(credential: X & IdentifierAction): X;
|
|
85
|
+
findKey<X extends IDbPool, Y extends DbDataSource>(pools: ObjectMap<X>, uuidKey: unknown, poolKey: string | undefined, ...items: Y[]): X | null;
|
|
86
|
+
validateKey<X extends IDbPool>(pools: ObjectMap<X>, username: string, uuidKey: unknown): [string, X | null];
|
|
87
|
+
checkTimeout<X extends IDbPool>(pools: ObjectMap<X>, value: number, limit?: number): Promise<number>;
|
|
88
|
+
readonly prototype: IDbPool<T, U, V, W>;
|
|
89
|
+
new(pool: U, poolKey: string, uuidKey?: AuthValue | null): IDbPool<T, U, V, W>;
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
export interface TimeoutAction {
|
|
90
|
-
timeout?:
|
|
93
|
+
timeout?: number | string;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
export type DbSource = "mariadb" | "mongodb" | "mssql" | "mysql" | "oracle" | "postgres" | "redis";
|
|
94
97
|
export type QueryResult = unknown[];
|
|
95
|
-
export type BatchQueryResult =
|
|
96
|
-
export type CheckObjectCallback = (item: DataSource, data: unknown) =>
|
|
98
|
+
export type BatchQueryResult = QueryResult | null[];
|
|
99
|
+
export type CheckObjectCallback = (item: DataSource, data: unknown) => QueryResult | null;
|
|
97
100
|
export type ErrorQueryCallback = (err: unknown, item: DbDataSource, commandType?: number) => boolean;
|
|
98
101
|
|
|
99
102
|
export interface SQL_COMMAND {
|
package/lib/document.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { LogComponent, LogDate } from './logger';
|
|
|
7
7
|
import type { DocumentTransform } from './settings';
|
|
8
8
|
|
|
9
9
|
export interface DocumentAsset extends ExternalAsset, StorageAction<CloudStorage> {
|
|
10
|
+
inlineFilename?: string;
|
|
10
11
|
initialValue?: InitialValue & { inlineFilename?: string };
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -15,7 +16,7 @@ export interface StartOfSourceMap {
|
|
|
15
16
|
sourceRoot?: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export interface RawSourceMap<T =
|
|
19
|
+
export interface RawSourceMap<T = number | string> extends StartOfSourceMap {
|
|
19
20
|
version: T;
|
|
20
21
|
sources: string[];
|
|
21
22
|
names: string[];
|
|
@@ -59,7 +60,7 @@ export interface TransformAction {
|
|
|
59
60
|
|
|
60
61
|
export interface TransformResult extends SourceCode {
|
|
61
62
|
type?: string;
|
|
62
|
-
chunks?:
|
|
63
|
+
chunks?: Array<SourceCode & ChunkFile> | null;
|
|
63
64
|
sourceFiles?: string[];
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -69,8 +70,8 @@ export interface TransformOutput extends Partial<LocationUri>, Omit<SourceInput<
|
|
|
69
70
|
metadata?: unknown;
|
|
70
71
|
external?: PlainObject;
|
|
71
72
|
productionRelease?: boolean;
|
|
72
|
-
getMainFile?(code?: string, imports?: StringMap):
|
|
73
|
-
getSourceFiles?(imports?: StringMap):
|
|
73
|
+
getMainFile?(code?: string, imports?: StringMap): SourceInput<string> | undefined;
|
|
74
|
+
getSourceFiles?(imports?: StringMap): SourceInput | undefined;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
export interface TransformOptions<T = AnyObject, U = T> extends TransformOutput {
|
|
@@ -85,10 +86,11 @@ export interface ITransformSeries<T = AnyObject, U = T> extends IModule, Transfo
|
|
|
85
86
|
init(instance: IModule, dirname?: string): this;
|
|
86
87
|
close(instance: IModule): void;
|
|
87
88
|
createSourceMap(value: string): SourceMap;
|
|
88
|
-
getMainFile(code?: string, imports?: StringMap):
|
|
89
|
-
getSourceFiles(imports?: StringMap):
|
|
89
|
+
getMainFile(code?: string, imports?: StringMap): SourceInput<string> | undefined;
|
|
90
|
+
getSourceFiles(imports?: StringMap): SourceInput | undefined;
|
|
90
91
|
toBaseConfig(all?: boolean): T;
|
|
91
|
-
upgrade<V = unknown>(context: V, dirname?: string,
|
|
92
|
+
upgrade<V = unknown>(context: V, dirname?: string, pkgname?: string): V;
|
|
93
|
+
upgradeESM<V = unknown>(context: V, dirname?: string, pkgname?: string): Promise<V>;
|
|
92
94
|
set code(value);
|
|
93
95
|
get code(): string;
|
|
94
96
|
get out(): IOut;
|
|
@@ -136,12 +138,12 @@ export interface SourceMap extends SourceCode {
|
|
|
136
138
|
reset(): void;
|
|
137
139
|
nextMap(name: string, code: string, map: unknown, sourceMappingURL?: string, emptySources?: boolean): boolean;
|
|
138
140
|
set map(value);
|
|
139
|
-
get map():
|
|
141
|
+
get map(): RawSourceMap | undefined;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
export interface SourceMapConstructor {
|
|
143
|
-
findSourceMap(code?: string, uri?: string):
|
|
144
|
-
removeSourceMappingURL(value: string): [string, string?,
|
|
145
|
+
findSourceMap(code?: string, uri?: string): RawSourceMap | undefined;
|
|
146
|
+
removeSourceMappingURL(value: string): [string, string?, (RawSourceMap | null)?];
|
|
145
147
|
isRaw(map: unknown): map is RawSourceMap;
|
|
146
148
|
readonly prototype: SourceMap;
|
|
147
149
|
new(code: string, remove: boolean): SourceMap;
|
|
@@ -174,8 +176,8 @@ export interface LintMessage {
|
|
|
174
176
|
export interface GenerateLintTableOptions extends Partial<LocationUri> {
|
|
175
177
|
leadingText?: string;
|
|
176
178
|
trailingText?: string;
|
|
177
|
-
errorCount?: number;
|
|
178
|
-
warningCount?: number;
|
|
179
|
+
errorCount?: number | [number, number];
|
|
180
|
+
warningCount?: number | [number, number];
|
|
179
181
|
fatalErrorCount?: number;
|
|
180
182
|
timeStamp?: LogDate;
|
|
181
183
|
ruleWidth?: number;
|
|
@@ -188,11 +190,10 @@ export interface CustomizeOptions {
|
|
|
188
190
|
|
|
189
191
|
export interface AsSourceFileOptions {
|
|
190
192
|
encoding?: BufferEncoding;
|
|
191
|
-
persist?: boolean;
|
|
192
193
|
cache?: boolean;
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
export type Transformer = FunctionType<
|
|
196
|
+
export type Transformer = FunctionType<Promise<string> | string> | undefined;
|
|
196
197
|
export type ConfigOrTransformer = AnyObject | Transformer;
|
|
197
|
-
export type PluginConfig = [string,
|
|
198
|
-
export type TransformCallback<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> = (this: T, instance: IDocument<T, U>, requireOrDocumentDir?: NodeJS.Require | string) =>
|
|
198
|
+
export type PluginConfig = [string, ConfigOrTransformer | undefined, AnyObject | undefined, boolean?] | [];
|
|
199
|
+
export type TransformCallback<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> = (this: T, instance: IDocument<T, U>, requireOrDocumentDir?: NodeJS.Require | string) => Promise<void >;
|
package/lib/filemanager.d.ts
CHANGED
|
@@ -10,13 +10,13 @@ import type { RequestInit } from './request';
|
|
|
10
10
|
import type { FETCH_TYPE } from '../index.d';
|
|
11
11
|
|
|
12
12
|
export const enum FINALIZE_STATE {
|
|
13
|
-
READY
|
|
14
|
-
COMMIT
|
|
15
|
-
END
|
|
16
|
-
RESTART
|
|
17
|
-
QUEUED
|
|
18
|
-
RESTARTED
|
|
19
|
-
ABORTED
|
|
13
|
+
READY,
|
|
14
|
+
COMMIT,
|
|
15
|
+
END,
|
|
16
|
+
RESTART,
|
|
17
|
+
QUEUED,
|
|
18
|
+
RESTARTED,
|
|
19
|
+
ABORTED
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const enum INCREMENTAL {
|
|
@@ -26,8 +26,8 @@ export const enum INCREMENTAL {
|
|
|
26
26
|
EXISTS = 'exists'
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export interface RequestData<T extends ExternalAsset = ExternalAsset> extends IRequestData<T>, RequestInit {
|
|
30
|
-
timeout?: ObjectMap<
|
|
29
|
+
export interface RequestData<T extends ExternalAsset = ExternalAsset, U extends HostInitLog = HostInitLog> extends IRequestData<T, U>, RequestInit {
|
|
30
|
+
timeout?: ObjectMap<number | string>;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface InstallData<T extends IModule = IModule, U extends ModuleConstructor = ModuleConstructor> {
|
|
@@ -53,14 +53,14 @@ export interface IHttpDiskCache<T extends ExternalAsset = ExternalAsset> {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export interface IHttpMemoryCache<T extends ExternalAsset = ExternalAsset> extends IHttpDiskCache<T> {
|
|
56
|
-
toDisk:
|
|
56
|
+
toDisk: [number, number];
|
|
57
57
|
purge(percent?: number, limit?: number): void;
|
|
58
58
|
withinDisk(value: T | number): boolean;
|
|
59
59
|
clear(uri?: string | URL): void;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export interface HttpDiskCacheAddOptions {
|
|
63
|
-
buffer?:
|
|
63
|
+
buffer?: Bufferable | null;
|
|
64
64
|
contentLength?: number;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -99,6 +99,7 @@ export interface DeleteFileAddendum {
|
|
|
99
99
|
export interface HostInitLog extends IHostInitLog {
|
|
100
100
|
useNumeric: boolean;
|
|
101
101
|
showSize?: boolean;
|
|
102
|
+
showDiff?: string[];
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
export interface FindAssetOptions<T extends ExternalAsset = ExternalAsset> {
|
package/lib/http.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { LookupAddress } from 'dns';
|
|
2
|
-
import type { ClientRequest, Agent as HttpAgent, OutgoingHttpHeaders } from 'http';
|
|
3
|
-
import type { Agent as HttpsAgent } from 'https';
|
|
4
|
-
import type { ClientHttp2Stream } from 'http2';
|
|
5
|
-
import type { SecureVersion } from 'tls';
|
|
1
|
+
import type { LookupAddress } from 'node:dns';
|
|
2
|
+
import type { ClientRequest, Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
3
|
+
import type { Agent as HttpsAgent } from 'node:https';
|
|
4
|
+
import type { ClientHttp2Stream } from 'node:http2';
|
|
5
|
+
import type { SecureVersion } from 'node:tls';
|
|
6
6
|
|
|
7
7
|
export const enum HTTP_STATUS {
|
|
8
8
|
CONTINUE = 100,
|
|
@@ -93,10 +93,11 @@ export interface SecureConfig<T = string, U = T> {
|
|
|
93
93
|
key?: U;
|
|
94
94
|
cert?: T;
|
|
95
95
|
passphrase?: U;
|
|
96
|
+
ciphers?: string;
|
|
96
97
|
version?: SecureVersion;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
export interface ServerPort<T =
|
|
100
|
+
export interface ServerPort<T = number | string> {
|
|
100
101
|
port?: T;
|
|
101
102
|
}
|
|
102
103
|
|
package/lib/image.d.ts
CHANGED
|
@@ -1,44 +1,54 @@
|
|
|
1
|
-
import type { MimeTypeAction } from './squared';
|
|
2
|
-
|
|
3
|
-
import type { BroadcastValue, LogTime } from './logger';
|
|
4
|
-
import type { ImageModule } from './settings';
|
|
5
|
-
|
|
6
|
-
export interface CommandData {
|
|
7
|
-
resize?: ResizeData;
|
|
8
|
-
crop?: CropData;
|
|
9
|
-
rotate?: RotateData;
|
|
10
|
-
quality?: QualityData;
|
|
11
|
-
method?: MethodData;
|
|
12
|
-
opacity?: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface RotateData {
|
|
16
|
-
values: number[];
|
|
17
|
-
color: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ResizeData extends Dimension {
|
|
21
|
-
mode: string;
|
|
22
|
-
color: number;
|
|
23
|
-
align:
|
|
24
|
-
algorithm?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface CropData extends Point, Dimension {}
|
|
28
|
-
|
|
29
|
-
export interface QualityData {
|
|
30
|
-
value: number;
|
|
31
|
-
nearLossless: number;
|
|
32
|
-
method: number;
|
|
33
|
-
preset?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface TransformOptions extends MimeTypeAction {
|
|
37
|
-
tempFile?: boolean;
|
|
38
|
-
startTime?: LogTime;
|
|
39
|
-
module?: ImageModule;
|
|
40
|
-
broadcastId?: BroadcastValue;
|
|
41
|
-
cache?: boolean;
|
|
42
|
-
}
|
|
43
|
-
|
|
1
|
+
import type { MimeTypeAction } from './squared';
|
|
2
|
+
|
|
3
|
+
import type { BroadcastValue, LogTime } from './logger';
|
|
4
|
+
import type { ImageModule } from './settings';
|
|
5
|
+
|
|
6
|
+
export interface CommandData {
|
|
7
|
+
resize?: ResizeData | null;
|
|
8
|
+
crop?: CropData | null;
|
|
9
|
+
rotate?: RotateData | null;
|
|
10
|
+
quality?: QualityData | null;
|
|
11
|
+
method?: MethodData | null;
|
|
12
|
+
opacity?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RotateData {
|
|
16
|
+
values: number[];
|
|
17
|
+
color: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ResizeData extends Dimension {
|
|
21
|
+
mode: string;
|
|
22
|
+
color: number;
|
|
23
|
+
align: [string | undefined, string | undefined];
|
|
24
|
+
algorithm?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CropData extends Point, Dimension {}
|
|
28
|
+
|
|
29
|
+
export interface QualityData {
|
|
30
|
+
value: number;
|
|
31
|
+
nearLossless: number;
|
|
32
|
+
method: number;
|
|
33
|
+
preset?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface TransformOptions extends MimeTypeAction {
|
|
37
|
+
tempFile?: boolean;
|
|
38
|
+
startTime?: LogTime;
|
|
39
|
+
module?: ImageModule;
|
|
40
|
+
broadcastId?: BroadcastValue;
|
|
41
|
+
cache?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface Point {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface Dimension {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
export type MethodData = [string, unknown[]?][];
|