@e-mc/types 0.11.16 → 0.11.17
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.d.ts +4 -2
- package/index.js +12 -4
- package/lib/compat-v4.d.ts +121 -0
- package/lib/index.d.ts +5 -5
- 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.11.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.11.17/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -198,10 +198,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
198
198
|
|
|
199
199
|
## References
|
|
200
200
|
|
|
201
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
202
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
203
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
204
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
201
|
+
- https://www.unpkg.com/@e-mc/types@0.11.17/index.d.ts
|
|
202
|
+
- https://www.unpkg.com/@e-mc/types@0.11.17/lib/logger.d.ts
|
|
203
|
+
- https://www.unpkg.com/@e-mc/types@0.11.17/lib/module.d.ts
|
|
204
|
+
- https://www.unpkg.com/@e-mc/types@0.11.17/lib/node.d.ts
|
|
205
205
|
|
|
206
206
|
* https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
207
207
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -330,8 +330,10 @@ declare namespace types {
|
|
|
330
330
|
function incrementUUID(restart?: boolean): string;
|
|
331
331
|
function validateUUID(value: unknown): boolean;
|
|
332
332
|
function randomString(format: string, dictionary?: string): string;
|
|
333
|
-
function errorValue(value: string,
|
|
334
|
-
function
|
|
333
|
+
function errorValue(value: string, cause: unknown): Error;
|
|
334
|
+
function errorValue(value: string, hint?: string, cause?: unknown): Error;
|
|
335
|
+
function errorMessage(title: number | string, value: string, cause: unknown): Error;
|
|
336
|
+
function errorMessage(title: number | string, value: string, hint?: string, cause?: unknown): Error;
|
|
335
337
|
function supported(major: number, minor: number, lts: boolean): boolean;
|
|
336
338
|
function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
337
339
|
function importESM<T = unknown>(name: string, isDefault?: boolean, fromPath?: boolean): Promise<T>;
|
package/index.js
CHANGED
|
@@ -1040,11 +1040,19 @@ function randomString(format, dictionary) {
|
|
|
1040
1040
|
function validateUUID(value) {
|
|
1041
1041
|
return typeof value === 'string' && value.length === 36 && REGEXP_UUID.test(value);
|
|
1042
1042
|
}
|
|
1043
|
-
function errorValue(value, hint) {
|
|
1044
|
-
|
|
1043
|
+
function errorValue(value, hint, cause) {
|
|
1044
|
+
if (!cause && isObject(hint)) {
|
|
1045
|
+
cause = hint;
|
|
1046
|
+
hint = undefined;
|
|
1047
|
+
}
|
|
1048
|
+
return new Error(value + (hint ? ` (${hint})` : ''), cause ? { cause } : undefined);
|
|
1045
1049
|
}
|
|
1046
|
-
function errorMessage(title, value, hint) {
|
|
1047
|
-
|
|
1050
|
+
function errorMessage(title, value, hint, cause) {
|
|
1051
|
+
if (!cause && isObject(hint)) {
|
|
1052
|
+
cause = hint;
|
|
1053
|
+
hint = undefined;
|
|
1054
|
+
}
|
|
1055
|
+
return new Error((isString(title) || typeof title === 'number' ? title + ': ' : '') + value + (hint ? ` (${hint})` : ''), cause ? { cause } : undefined);
|
|
1048
1056
|
}
|
|
1049
1057
|
function purgeMemory(percent) {
|
|
1050
1058
|
CACHE_COERCED = new WeakSet();
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IModule, ModuleConstructor, WatchConstructor } from './index';
|
|
2
|
+
|
|
3
|
+
import type { CloneObjectOptions } from '../index.d';
|
|
4
|
+
import type { ExternalAsset } from './asset';
|
|
5
|
+
import type { CacheOptions } from './core';
|
|
6
|
+
import type { QueryResult } from './db';
|
|
7
|
+
import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document';
|
|
8
|
+
import type { IHttpMemoryCache } from './filemanager';
|
|
9
|
+
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
10
|
+
import type { ParseFunctionOptions } from './module';
|
|
11
|
+
import type { LogFailOptions, LogType, LogValue } from './logger';
|
|
12
|
+
import type { HostConfig, OpenOptions, ProxySettings } from './request';
|
|
13
|
+
import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
|
|
14
|
+
|
|
15
|
+
import type { OutgoingHttpHeaders } from 'http';
|
|
16
|
+
import type { LookupFunction } from 'net';
|
|
17
|
+
import type { Readable, Writable } from 'stream';
|
|
18
|
+
|
|
19
|
+
type CpuUsage = NodeJS.CpuUsage;
|
|
20
|
+
|
|
21
|
+
export interface GetFunctionsOptions extends ParseFunctionOptions {
|
|
22
|
+
outFailed?: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface IModuleLibV4 {
|
|
26
|
+
isString(value: unknown): value is string;
|
|
27
|
+
isObject<T = object>(value: unknown): value is T;
|
|
28
|
+
isPlainObject<T = PlainObject>(value: unknown): value is T;
|
|
29
|
+
escapePattern(value: unknown, lookBehind?: boolean): string;
|
|
30
|
+
generateUUID(format?: string, dictionary?: string): string;
|
|
31
|
+
validateUUID(value: unknown): boolean;
|
|
32
|
+
cloneObject<T, U = unknown>(data: T, options?: boolean | WeakSet<object> | CloneObjectOptions<U>): T;
|
|
33
|
+
coerceObject<T = unknown>(data: T, parseString?: FunctionType<unknown, string> | boolean, cache?: boolean): T;
|
|
34
|
+
asFunction<T = unknown, U = FunctionType<Promise<T> | T>>(value: unknown, sync?: boolean): Null<U>;
|
|
35
|
+
isFileHTTP(value: string | URL): boolean;
|
|
36
|
+
isFileUNC(value: string | URL): boolean;
|
|
37
|
+
isPathUNC(value: string | URL): boolean;
|
|
38
|
+
toTimeMs(hrtime: HighResolutionTime, format?: boolean): number | string;
|
|
39
|
+
renameExt(value: string, ext: string, when?: string): string;
|
|
40
|
+
existsSafe(value: string, isFile?: boolean): boolean;
|
|
41
|
+
readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<Bufferable>;
|
|
42
|
+
getFunctions<T extends FunctionType>(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[];
|
|
43
|
+
formatSize(value: number | string, options?: PlainObject): number | string;
|
|
44
|
+
hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean;
|
|
45
|
+
hasSize(value: string, keepEmpty?: boolean): boolean;
|
|
46
|
+
getSize(value: string, diskUsed?: boolean): number;
|
|
47
|
+
byteLength(value: Bufferable, encoding?: BufferEncoding): number;
|
|
48
|
+
cleanupStream(target: Readable | Writable, pathname?: string): void;
|
|
49
|
+
allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise<PromiseSettledResult<U>[]>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface IModuleCompatV4<T extends IHost = IHost> extends IModule<T> {
|
|
53
|
+
set startCPU(value);
|
|
54
|
+
get startCPU(): Null<CpuUsage>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ModuleCompatV4Constructor extends ModuleConstructor, IModuleLibV4 {
|
|
58
|
+
readonly prototype: IModuleCompatV4;
|
|
59
|
+
new(...args: unknown[]): IModuleCompatV4;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> extends IFileManager<T> {
|
|
63
|
+
archiving: boolean;
|
|
64
|
+
cacheHttpRequest: boolean | FirstOf<string>;
|
|
65
|
+
cacheHttpRequestBuffer: IHttpMemoryCache<T>;
|
|
66
|
+
fetchTimeout: number;
|
|
67
|
+
httpProxy: Null<ProxySettings>;
|
|
68
|
+
acceptEncoding: boolean;
|
|
69
|
+
keepAliveTimeout: number;
|
|
70
|
+
addDns(hostname: string, address: string, family?: number | string): void;
|
|
71
|
+
lookupDns(hostname: string): LookupFunction;
|
|
72
|
+
getHttpProxy(uri: string, localhost?: boolean): Null<ProxySettings>;
|
|
73
|
+
getHttpHeaders(uri: string): Undef<OutgoingHttpHeaders>;
|
|
74
|
+
createHttpRequest(uri: string | URL, options?: OpenOptions): HostConfig;
|
|
75
|
+
getHttpClient(uri: string | URL, options: OpenOptions): HttpRequestClient;
|
|
76
|
+
set httpVersion(value);
|
|
77
|
+
get httpVersion(): Null<HttpProtocolVersion>;
|
|
78
|
+
set ipVersion(value);
|
|
79
|
+
get ipVersion(): InternetProtocolVersion;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface FileManagerCompatV4Constructor<T extends ExternalAsset = ExternalAsset> extends FileManagerConstructor<T> {
|
|
83
|
+
fromHttpStatusCode(value: number | string): string;
|
|
84
|
+
resetHttpHost(version?: HttpProtocolVersion): void;
|
|
85
|
+
defineHttpBuffer(options: HttpMemorySettings): void;
|
|
86
|
+
defineHttpSettings(options: HttpSettings): void;
|
|
87
|
+
defineHttpAgent(options: HttpAgentSettings): void;
|
|
88
|
+
defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
|
|
89
|
+
clearDnsLookup(): void;
|
|
90
|
+
getAria2Path(): string;
|
|
91
|
+
clearHttpBuffer(percent?: number, limit?: number): void;
|
|
92
|
+
readonly prototype: IFileManagerCompatV4<T>;
|
|
93
|
+
new(...args: unknown[]): IFileManagerCompatV4<T>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ICloudCompatV4<T extends IHost = IHost> extends ICloud<T> {
|
|
97
|
+
getDatabaseResult(service: string, credential: unknown, queryString: string, options?: CacheOptions | boolean | string): Undef<QueryResult>;
|
|
98
|
+
setDatabaseResult(service: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
|
|
99
|
+
hasDatabaseCache(service: string, sessionKey?: string): boolean;
|
|
100
|
+
hasDatabaseCoerce(service: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface CloudCompatV4Constructor extends CloudConstructor {
|
|
104
|
+
readonly prototype: ICloudCompatV4;
|
|
105
|
+
new(...args: unknown[]): ICloudCompatV4;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface WatchCompatV4Constructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> extends WatchConstructor<T, U> {
|
|
109
|
+
readCACert(value: string, cache?: boolean): string;
|
|
110
|
+
readTLSKey(value: string, cache?: boolean): string;
|
|
111
|
+
readTLSCert(value: string, cache?: boolean): string;
|
|
112
|
+
isCert(value: string): boolean;
|
|
113
|
+
parseExpires(value: number | string, start?: number): number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ITransformSeriesCompatV4<T = AnyObject, U = T> extends ITransformSeries<T, U>, PropertyAction<OutV3, "out"> {}
|
|
117
|
+
|
|
118
|
+
export interface TransformSeriesCompatV4Constructor extends TransformSeriesConstructor {
|
|
119
|
+
readonly prototype: ITransformSeriesCompatV4;
|
|
120
|
+
new(...args: unknown[]): ITransformSeriesCompatV4;
|
|
121
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction,
|
|
|
5
5
|
import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
|
|
6
6
|
import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, DeleteObjectsOptions, UploadAssetOptions } from './cloud';
|
|
7
7
|
import type { BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
|
|
8
|
-
import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
8
|
+
import type { ClientConstructor, ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
9
9
|
import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
|
|
10
10
|
import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
|
|
11
11
|
import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
|
|
@@ -106,7 +106,7 @@ declare namespace functions {
|
|
|
106
106
|
get host(): T | null;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends
|
|
109
|
+
interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ClientConstructor {
|
|
110
110
|
/** @deprecated */
|
|
111
111
|
readonly REGEXP_SIZERANGE: RegExp;
|
|
112
112
|
transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<V extends { tempFile: true } ? string : Buffer | null>;
|
|
@@ -129,7 +129,7 @@ declare namespace functions {
|
|
|
129
129
|
get host(): T | null;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends
|
|
132
|
+
interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ClientConstructor {
|
|
133
133
|
finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
|
|
134
134
|
readonly prototype: ITask<T, U>;
|
|
135
135
|
new(module?: U, ...args: unknown[]): ITask<T, U>;
|
|
@@ -265,7 +265,7 @@ declare namespace functions {
|
|
|
265
265
|
get host(): T | null;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends
|
|
268
|
+
interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends ClientConstructor {
|
|
269
269
|
finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
270
270
|
createSourceMap(code: string, remove: boolean): SourceMap;
|
|
271
271
|
createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
|
|
@@ -303,7 +303,7 @@ declare namespace functions {
|
|
|
303
303
|
get host(): T | null;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends
|
|
306
|
+
interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ClientConstructor {
|
|
307
307
|
createServer(port: number, active: boolean): ws.Server | null;
|
|
308
308
|
createServer(port: number, secure?: SecureOptions | null, active?: boolean): ws.Server | null;
|
|
309
309
|
shutdown(): void;
|
package/package.json
CHANGED