@e-mc/types 0.5.3 → 0.7.0
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/constant.d.ts +23 -1
- package/index.d.ts +12 -0
- package/index.js +25 -19
- package/lib/cloud.d.ts +13 -11
- package/lib/compress.d.ts +1 -1
- package/lib/db.d.ts +3 -1
- package/lib/filemanager.d.ts +11 -1
- package/lib/http.d.ts +7 -2
- package/lib/index.d.ts +13 -5
- package/lib/module.d.ts +9 -4
- package/lib/settings.d.ts +14 -2
- package/lib/squared.d.ts +31 -5
- package/lib/watch.d.ts +1 -0
- package/package.json +3 -3
package/constant.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const enum INTERNAL {
|
|
2
|
-
VERSION = '0.
|
|
2
|
+
VERSION = '0.7.0',
|
|
3
3
|
TEMP_DIR = 'tmp', // eslint-disable-line @typescript-eslint/no-shadow
|
|
4
4
|
CJS = '__cjs__'
|
|
5
5
|
}
|
|
@@ -19,6 +19,8 @@ export const enum VAL_CLOUD {
|
|
|
19
19
|
DOWNLOAD_FILE = 'Download success',
|
|
20
20
|
DELETE_FILE = 'Delete success',
|
|
21
21
|
RENAME_FILE = 'File renamed',
|
|
22
|
+
CREATE_TAG = 'Tags created',
|
|
23
|
+
DELETE_TAG = 'Tags deleted',
|
|
22
24
|
PUBLIC_READ = 'Grant public-read',
|
|
23
25
|
CREATE_BUCKET = 'Bucket created',
|
|
24
26
|
DELETE_BUCKET = 'Bucket deleted',
|
|
@@ -35,8 +37,10 @@ export const enum ERR_MESSAGE {
|
|
|
35
37
|
ABORTED = 'Aborted',
|
|
36
38
|
ABORTED_OPERATION = 'The operation was aborted',
|
|
37
39
|
FAILED = 'Failed',
|
|
40
|
+
FAILED_CHECKSUM = 'Checksum did not match',
|
|
38
41
|
PARAMETERS = 'Invalid parameters',
|
|
39
42
|
FORMAT = 'Invalid format',
|
|
43
|
+
CHECKSUM = 'Invalid checksum',
|
|
40
44
|
ERROR_CODE = 'Error code',
|
|
41
45
|
EXEC_PERMISSION = 'Exec command not permitted',
|
|
42
46
|
NOT_CACHEABLE = 'Not able to cache',
|
|
@@ -225,6 +229,12 @@ export const enum LOG_TYPE {
|
|
|
225
229
|
DB = 65536
|
|
226
230
|
}
|
|
227
231
|
|
|
232
|
+
export const enum READDIR_SORT {
|
|
233
|
+
FILE = 0,
|
|
234
|
+
DIRECTORY = 1,
|
|
235
|
+
DESCENDING = 2
|
|
236
|
+
}
|
|
237
|
+
|
|
228
238
|
export const enum SETTINGS_KEY_NAME {
|
|
229
239
|
NODE_PROCESS_CPUUSAGE = "node.process.cpu_usage",
|
|
230
240
|
NODE_PROCESS_MEMORYUSAGE = "node.process.memory_usage",
|
|
@@ -245,4 +255,16 @@ export const enum SETTINGS_KEY_NAME {
|
|
|
245
255
|
ERROR_FATAL = "error.fatal",
|
|
246
256
|
BROADCAST_OUT = "broadcast.out",
|
|
247
257
|
LOGGER_LEVEL = "logger.level"
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export const enum CACHE_SIZE {
|
|
261
|
+
CORE_CLIENTDB_PARTITION_SIZE = 16,
|
|
262
|
+
CORE_CLIENTDB_PARTITION_MULT = 2,
|
|
263
|
+
CLOUD_PARTITION_SIZE = 16,
|
|
264
|
+
CLOUD_PARTITION_MULT = 2,
|
|
265
|
+
DB_PARTITION_SIZE = 16,
|
|
266
|
+
DB_PARTITION_MULT = 2,
|
|
267
|
+
FILE_MANAGER_DISK_LIMIT = '1gb',
|
|
268
|
+
FILE_MANAGER_MEMORY_LIMIT = '100mb',
|
|
269
|
+
FILE_MANAGER_MEMORY_LIMIT_ALL = '512mb'
|
|
248
270
|
}
|
package/index.d.ts
CHANGED
|
@@ -216,6 +216,18 @@ declare namespace types {
|
|
|
216
216
|
ERROR: "error";
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
+
interface READDIR_SORT {
|
|
220
|
+
FILE: number;
|
|
221
|
+
DIRECTORY: number;
|
|
222
|
+
DESCENDING: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const READDIR_SORT: {
|
|
226
|
+
FILE: 0;
|
|
227
|
+
DIRECTORY: 1;
|
|
228
|
+
DESCENDING: 2;
|
|
229
|
+
};
|
|
230
|
+
|
|
219
231
|
interface THRESHOLD {
|
|
220
232
|
FILEMANAGER_INTERVAL: number;
|
|
221
233
|
WATCH_INTERVAL: number;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.generateUUID = exports.purgeMemory = void 0;
|
|
3
|
+
exports.errorValue = exports.validateUUID = exports.randomString = exports.decryptUTF8 = exports.encryptUTF8 = exports.getEncoding = exports.asFunction = exports.coerceObject = exports.cloneObject = exports.cascadeObject = exports.formatSize = exports.renameExt = exports.escapePattern = exports.hasGlob = exports.convertTime = exports.formatTime = exports.parseExpires = exports.parseTime = exports.isEmpty = exports.isString = exports.isObject = exports.isPlainObject = exports.isArray = exports.setTempDir = exports.getTempDir = exports.setLogCurrent = exports.getLogCurrent = exports.existsFlag = exports.mainFlag = exports.processFlag = exports.modifiedFlag = exports.watchFlag = exports.usingFlag = exports.cloneFlag = exports.ignoreFlag = exports.hasBit = exports.createAbortError = exports.IMPORT_MAP = exports.THRESHOLD = exports.READDIR_SORT = exports.WATCH_EVENT = exports.DB_TRANSACTION = exports.DB_TYPE = exports.FETCH_TYPE = exports.DOWNLOAD_TYPE = exports.ERR_CODE = exports.ASSET_FLAG = exports.FILE_TYPE = exports.STATUS_TYPE = exports.LOG_TYPE = void 0;
|
|
4
|
+
exports.generateUUID = exports.purgeMemory = exports.errorMessage = void 0;
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const crypto = require("crypto");
|
|
@@ -165,7 +165,7 @@ var LOG_TYPE;
|
|
|
165
165
|
LOG_TYPE[LOG_TYPE["TIMEOUT"] = 16384] = "TIMEOUT";
|
|
166
166
|
LOG_TYPE[LOG_TYPE["STDOUT"] = 32768] = "STDOUT";
|
|
167
167
|
LOG_TYPE[LOG_TYPE["DB"] = 65536] = "DB";
|
|
168
|
-
})(LOG_TYPE
|
|
168
|
+
})(LOG_TYPE || (exports.LOG_TYPE = LOG_TYPE = {}));
|
|
169
169
|
var STATUS_TYPE;
|
|
170
170
|
(function (STATUS_TYPE) {
|
|
171
171
|
STATUS_TYPE[STATUS_TYPE["UNKNOWN"] = 0] = "UNKNOWN";
|
|
@@ -176,7 +176,7 @@ var STATUS_TYPE;
|
|
|
176
176
|
STATUS_TYPE[STATUS_TYPE["DEBUG"] = 5] = "DEBUG";
|
|
177
177
|
STATUS_TYPE[STATUS_TYPE["ASSERT"] = 6] = "ASSERT";
|
|
178
178
|
STATUS_TYPE[STATUS_TYPE["TRACE"] = 7] = "TRACE";
|
|
179
|
-
})(STATUS_TYPE
|
|
179
|
+
})(STATUS_TYPE || (exports.STATUS_TYPE = STATUS_TYPE = {}));
|
|
180
180
|
var FILE_TYPE;
|
|
181
181
|
(function (FILE_TYPE) {
|
|
182
182
|
FILE_TYPE[FILE_TYPE["UNKNOWN"] = 0] = "UNKNOWN";
|
|
@@ -185,7 +185,7 @@ var FILE_TYPE;
|
|
|
185
185
|
FILE_TYPE[FILE_TYPE["COMPRESSED"] = 4] = "COMPRESSED";
|
|
186
186
|
FILE_TYPE[FILE_TYPE["SOURCEMAP"] = 8] = "SOURCEMAP";
|
|
187
187
|
FILE_TYPE[FILE_TYPE["TORRENT"] = 16] = "TORRENT";
|
|
188
|
-
})(FILE_TYPE
|
|
188
|
+
})(FILE_TYPE || (exports.FILE_TYPE = FILE_TYPE = {}));
|
|
189
189
|
var ASSET_FLAG;
|
|
190
190
|
(function (ASSET_FLAG) {
|
|
191
191
|
ASSET_FLAG[ASSET_FLAG["NONE"] = 0] = "NONE";
|
|
@@ -197,17 +197,17 @@ var ASSET_FLAG;
|
|
|
197
197
|
ASSET_FLAG[ASSET_FLAG["PROCESS"] = 32] = "PROCESS";
|
|
198
198
|
ASSET_FLAG[ASSET_FLAG["MAIN"] = 64] = "MAIN";
|
|
199
199
|
ASSET_FLAG[ASSET_FLAG["EXISTS"] = 128] = "EXISTS";
|
|
200
|
-
})(ASSET_FLAG
|
|
200
|
+
})(ASSET_FLAG || (exports.ASSET_FLAG = ASSET_FLAG = {}));
|
|
201
201
|
var ERR_CODE;
|
|
202
202
|
(function (ERR_CODE) {
|
|
203
203
|
ERR_CODE["MODULE_NOT_FOUND"] = "MODULE_NOT_FOUND";
|
|
204
|
-
})(ERR_CODE
|
|
204
|
+
})(ERR_CODE || (exports.ERR_CODE = ERR_CODE = {}));
|
|
205
205
|
var DOWNLOAD_TYPE;
|
|
206
206
|
(function (DOWNLOAD_TYPE) {
|
|
207
207
|
DOWNLOAD_TYPE[DOWNLOAD_TYPE["HTTP"] = 0] = "HTTP";
|
|
208
208
|
DOWNLOAD_TYPE[DOWNLOAD_TYPE["DISK"] = 1] = "DISK";
|
|
209
209
|
DOWNLOAD_TYPE[DOWNLOAD_TYPE["CACHE"] = 2] = "CACHE";
|
|
210
|
-
})(DOWNLOAD_TYPE
|
|
210
|
+
})(DOWNLOAD_TYPE || (exports.DOWNLOAD_TYPE = DOWNLOAD_TYPE = {}));
|
|
211
211
|
var FETCH_TYPE;
|
|
212
212
|
(function (FETCH_TYPE) {
|
|
213
213
|
FETCH_TYPE[FETCH_TYPE["UNKNOWN"] = 0] = "UNKNOWN";
|
|
@@ -215,14 +215,14 @@ var FETCH_TYPE;
|
|
|
215
215
|
FETCH_TYPE[FETCH_TYPE["UNIX_SOCKET"] = 2] = "UNIX_SOCKET";
|
|
216
216
|
FETCH_TYPE[FETCH_TYPE["FTP"] = 3] = "FTP";
|
|
217
217
|
FETCH_TYPE[FETCH_TYPE["TORRENT"] = 4] = "TORRENT";
|
|
218
|
-
})(FETCH_TYPE
|
|
218
|
+
})(FETCH_TYPE || (exports.FETCH_TYPE = FETCH_TYPE = {}));
|
|
219
219
|
var DB_TYPE;
|
|
220
220
|
(function (DB_TYPE) {
|
|
221
221
|
DB_TYPE[DB_TYPE["SQL"] = 1] = "SQL";
|
|
222
222
|
DB_TYPE[DB_TYPE["NOSQL"] = 2] = "NOSQL";
|
|
223
223
|
DB_TYPE[DB_TYPE["DOCUMENT"] = 4] = "DOCUMENT";
|
|
224
224
|
DB_TYPE[DB_TYPE["KEYVALUE"] = 8] = "KEYVALUE";
|
|
225
|
-
})(DB_TYPE
|
|
225
|
+
})(DB_TYPE || (exports.DB_TYPE = DB_TYPE = {}));
|
|
226
226
|
var DB_TRANSACTION;
|
|
227
227
|
(function (DB_TRANSACTION) {
|
|
228
228
|
DB_TRANSACTION[DB_TRANSACTION["ACTIVE"] = 1] = "ACTIVE";
|
|
@@ -233,14 +233,26 @@ var DB_TRANSACTION;
|
|
|
233
233
|
DB_TRANSACTION[DB_TRANSACTION["FAIL"] = 32] = "FAIL";
|
|
234
234
|
DB_TRANSACTION[DB_TRANSACTION["AUTH"] = 64] = "AUTH";
|
|
235
235
|
DB_TRANSACTION[DB_TRANSACTION["CACHE"] = 128] = "CACHE";
|
|
236
|
-
})(DB_TRANSACTION
|
|
236
|
+
})(DB_TRANSACTION || (exports.DB_TRANSACTION = DB_TRANSACTION = {}));
|
|
237
237
|
var WATCH_EVENT;
|
|
238
238
|
(function (WATCH_EVENT) {
|
|
239
239
|
WATCH_EVENT["MODIFIED"] = "modified";
|
|
240
240
|
WATCH_EVENT["BROADCAST"] = "broadcast";
|
|
241
241
|
WATCH_EVENT["CLOSE"] = "close";
|
|
242
242
|
WATCH_EVENT["ERROR"] = "error";
|
|
243
|
-
})(WATCH_EVENT
|
|
243
|
+
})(WATCH_EVENT || (exports.WATCH_EVENT = WATCH_EVENT = {}));
|
|
244
|
+
var READDIR_SORT;
|
|
245
|
+
(function (READDIR_SORT) {
|
|
246
|
+
READDIR_SORT[READDIR_SORT["FILE"] = 0] = "FILE";
|
|
247
|
+
READDIR_SORT[READDIR_SORT["DIRECTORY"] = 1] = "DIRECTORY";
|
|
248
|
+
READDIR_SORT[READDIR_SORT["DESCENDING"] = 2] = "DESCENDING";
|
|
249
|
+
})(READDIR_SORT || (exports.READDIR_SORT = READDIR_SORT = {}));
|
|
250
|
+
var THRESHOLD;
|
|
251
|
+
(function (THRESHOLD) {
|
|
252
|
+
THRESHOLD[THRESHOLD["FILEMANAGER_INTERVAL"] = 100] = "FILEMANAGER_INTERVAL";
|
|
253
|
+
THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
|
|
254
|
+
THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
|
|
255
|
+
})(THRESHOLD || (exports.THRESHOLD = THRESHOLD = {}));
|
|
244
256
|
var IMPORT_MAP;
|
|
245
257
|
(function (IMPORT_MAP) {
|
|
246
258
|
IMPORT_MAP["@squared-functions/cloud"] = "@e-mc/cloud";
|
|
@@ -320,13 +332,7 @@ var IMPORT_MAP;
|
|
|
320
332
|
IMPORT_MAP["@squared-functions/document/packages/svgo"] = "@pi-r/svgo";
|
|
321
333
|
IMPORT_MAP["@squared-functions/document/packages/terser"] = "@pi-r/terser";
|
|
322
334
|
IMPORT_MAP["@squared-functions/document/packages/uglify-js"] = "@pi-r/uglify-js";
|
|
323
|
-
})(IMPORT_MAP
|
|
324
|
-
var THRESHOLD;
|
|
325
|
-
(function (THRESHOLD) {
|
|
326
|
-
THRESHOLD[THRESHOLD["FILEMANAGER_INTERVAL"] = 100] = "FILEMANAGER_INTERVAL";
|
|
327
|
-
THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
|
|
328
|
-
THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
|
|
329
|
-
})(THRESHOLD = exports.THRESHOLD || (exports.THRESHOLD = {}));
|
|
335
|
+
})(IMPORT_MAP || (exports.IMPORT_MAP = IMPORT_MAP = {}));
|
|
330
336
|
function createAbortError() {
|
|
331
337
|
return new AbortError();
|
|
332
338
|
}
|
package/lib/cloud.d.ts
CHANGED
|
@@ -25,27 +25,29 @@ export interface CloudStorage extends CloudService {
|
|
|
25
25
|
download?: CloudStorageDownload;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown> extends CloudStorageACL<U> {
|
|
28
|
+
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unknown> extends CloudStorageACL<U> {
|
|
29
29
|
emptyBucket?: boolean;
|
|
30
30
|
configBucket?: {
|
|
31
31
|
create?: T;
|
|
32
32
|
policy?: V;
|
|
33
33
|
website?: BucketWebsiteOptions;
|
|
34
|
+
retentionPolicy?: W;
|
|
34
35
|
};
|
|
35
36
|
recursive?: boolean;
|
|
36
37
|
preservePath?: boolean;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export interface CloudStorageAction<T = unknown, U = string, V = unknown> extends Partial<LocationUri> {
|
|
40
|
+
export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown> extends Partial<LocationUri> {
|
|
40
41
|
active?: boolean;
|
|
41
42
|
overwrite?: boolean;
|
|
42
|
-
admin?: CloudStorageAdmin<T, U, V>;
|
|
43
|
+
admin?: CloudStorageAdmin<T, U, V, W>;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = string> extends CloudStorageACL<U>, CloudStorageAction<V, W> {
|
|
46
|
+
export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = string, X = unknown> extends CloudStorageACL<U>, CloudStorageAction<V, W, unknown, X> {
|
|
46
47
|
buffer?: Null<Buffer>;
|
|
47
48
|
contentType?: string;
|
|
48
49
|
metadata?: Record<string, string>;
|
|
50
|
+
tags?: Record<string, string> | false;
|
|
49
51
|
options?: T;
|
|
50
52
|
fileGroup?: [BufferContent, string, string?][];
|
|
51
53
|
localStorage?: boolean;
|
|
@@ -71,19 +73,19 @@ export interface BucketWebsiteOptions {
|
|
|
71
73
|
errorPath?: string;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
export interface
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface UploadData<T = unknown, U = string, V = unknown, W = string> extends FunctionData {
|
|
79
|
-
upload: CloudStorageUpload<T, U, V, W>;
|
|
76
|
+
export interface UploadData<T = unknown, U = string, V = unknown, W = string, X = unknown> extends BucketAction {
|
|
77
|
+
upload: CloudStorageUpload<T, U, V, W, X>;
|
|
80
78
|
localUri: string;
|
|
81
79
|
buffer: Buffer;
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
export interface DownloadData<T = unknown> extends
|
|
82
|
+
export interface DownloadData<T = unknown> extends BucketAction {
|
|
85
83
|
download: CloudStorageDownload<T>;
|
|
86
84
|
}
|
|
87
85
|
|
|
86
|
+
export interface BucketAction {
|
|
87
|
+
bucket: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
88
90
|
export type CloudFeatures = "storage" | "database";
|
|
89
91
|
export type CloudFunctions = "upload" | "download";
|
package/lib/compress.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface Woff {
|
|
|
17
17
|
type ResultCallback<T = Null<Buffer | Uint8Array>> = (err: unknown, data?: T, ext?: string) => void;
|
|
18
18
|
type ResultData = Null<Buffer | Uint8Array> | string;
|
|
19
19
|
|
|
20
|
-
export type BufferLike = Buffer | Uint8Array | ArrayBuffer | SharedArrayBuffer |
|
|
20
|
+
export type BufferLike = Buffer | Uint8Array | ArrayBuffer | SharedArrayBuffer | readonly number[];
|
|
21
21
|
export type TryFileCompressor = (data: string | Buffer, output: string, config: CompressFormat, callback?: TryFileResult) => Void<Promise<ResultData>>;
|
|
22
22
|
export type TryFileCompressorAsync = (data: string | Buffer, output: string, config: CompressFormat) => Promise<ResultData>;
|
|
23
23
|
export type TryFileResult = ResultCallback<ResultData>;
|
package/lib/db.d.ts
CHANGED
|
@@ -91,13 +91,15 @@ export interface PoolConfig<T = number> extends MinMax {
|
|
|
91
91
|
queue_max?: number;
|
|
92
92
|
queue_idle?: T;
|
|
93
93
|
purge?: T;
|
|
94
|
+
timeout?: number;
|
|
95
|
+
socket_timeout?: number;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
export interface TimeoutAction {
|
|
97
99
|
timeout?: NumString;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
export type DbSource = "mongodb" | "
|
|
102
|
+
export type DbSource = "mariadb" | "mongodb" | "mssql" | "mysql" | "oracle" | "postgres" | "redis";
|
|
101
103
|
export type QueryResult = unknown[];
|
|
102
104
|
export type BatchQueryResult = Null<QueryResult>[];
|
|
103
105
|
export type CheckObjectCallback = (item: DataSource, data: unknown) => Null<QueryResult>;
|
package/lib/filemanager.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { BundleAction, FileInfo, LogStatus } from './squared';
|
|
1
|
+
import type { BundleAction, ChecksumOutput, FileInfo, LogStatus } from './squared';
|
|
2
2
|
|
|
3
3
|
import type { IFileManager, IModule, ModuleConstructor } from './index';
|
|
4
4
|
import type { ExternalAsset } from './asset';
|
|
5
5
|
import type { HostInitLog as IHostInitLog } from './core';
|
|
6
|
+
import type { ReadHashOptions } from './module';
|
|
6
7
|
import type { RequestData as IRequestData } from './node';
|
|
7
8
|
import type { RequestInit } from './request';
|
|
8
9
|
|
|
@@ -99,5 +100,14 @@ export interface FindAssetOptions<T extends ExternalAsset = ExternalAsset> {
|
|
|
99
100
|
replaced?: boolean;
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
export interface ChecksumOptions extends ReadHashOptions, Pick<ChecksumOutput, "include" | "exclude" | "recursive"> {
|
|
104
|
+
sortBy?: number;
|
|
105
|
+
verbose?: boolean;
|
|
106
|
+
ignore?: string[];
|
|
107
|
+
joinRoot?: boolean;
|
|
108
|
+
outPath?: string;
|
|
109
|
+
throwsEmpty?: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
102
112
|
export type FetchType = FETCH_TYPE[keyof FETCH_TYPE];
|
|
103
113
|
export type PostFinalizeCallback = (files: FileInfo[] | string[], errors: string[], status?: LogStatus[]) => void;
|
package/lib/http.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export const enum HTTP_STATUS {
|
|
|
50
50
|
TOO_MANY_REQUESTS = 429,
|
|
51
51
|
REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
|
|
52
52
|
UNAVAILABLE_FOR_LEGAL_REASONS = 451,
|
|
53
|
+
SSL_CERTIFICATE_ERROR = 495,
|
|
54
|
+
SSL_CERTIFICATE_REQUIRED = 496,
|
|
53
55
|
CLIENT_CLOSED_REQUEST = 499,
|
|
54
56
|
INTERNAL_SERVER_ERROR = 500,
|
|
55
57
|
NOT_IMPLEMENTED = 501,
|
|
@@ -64,7 +66,10 @@ export const enum HTTP_STATUS {
|
|
|
64
66
|
NETWORK_AUTHENTICATION_REQUIRED = 511,
|
|
65
67
|
WEB_SERVER_IS_DOWN = 521,
|
|
66
68
|
CONNECTION_TIMED_OUT = 522,
|
|
67
|
-
|
|
69
|
+
ORIGIN_IS_UNREACHABLE = 523,
|
|
70
|
+
A_TIMEOUT_OCCURRED = 524,
|
|
71
|
+
SSL_HANDSHAKE_FAILED = 525,
|
|
72
|
+
INVALID_SSL_CERTIFICATE = 526
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
export const enum QUERY_RESULT {
|
|
@@ -84,4 +89,4 @@ export type HttpRequestClient = ClientRequest | ClientHttp2Stream;
|
|
|
84
89
|
export type HttpOutgoingHeaders = ObjectMap<OutgoingHttpHeaders>;
|
|
85
90
|
export type HttpProtocolVersion = 1 | 2 | 3;
|
|
86
91
|
export type InternetProtocolVersion = 0 | 4 | 6;
|
|
87
|
-
export type LookupCallback = (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family?: number) => void;
|
|
92
|
+
export type LookupCallback = (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family?: number) => void;
|
package/lib/index.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ import type { BufferResult, CompressFormat, TryFileCompressor, TryFileResult, Tr
|
|
|
11
11
|
import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
12
12
|
import type { BatchQueryResult, DB_TYPE, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, PoolConfig, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
|
|
13
13
|
import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
|
|
14
|
-
import type { AssetContentOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
|
|
14
|
+
import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
|
|
15
15
|
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
16
16
|
import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
|
|
17
17
|
import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
|
|
18
|
-
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadFileCallback, ReadFileOptions, RemoveDirOptions, WriteFileOptions } from './module';
|
|
18
|
+
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadFileCallback, ReadFileOptions, ReadHashOptions, RemoveDirOptions, WriteFileOptions } from './module';
|
|
19
19
|
import type { RequestData, Settings } from './node';
|
|
20
20
|
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit } from './request';
|
|
21
21
|
import type { ClientModule, CloudModule, CloudServiceOptions, CompressModule, CompressSettings, DbCoerceSettings, DbModule, DbSourceOptions, DnsLookupSettings, DocumentComponent, DocumentComponentOption, DocumentModule, HttpConnectSettings, HttpMemorySettings, ImageModule, RequestModule, RequestSettings, TaskModule, WatchModule } from './settings';
|
|
@@ -206,7 +206,6 @@ declare namespace functions {
|
|
|
206
206
|
Db: Null<IDb>;
|
|
207
207
|
assets: U[];
|
|
208
208
|
config: StandardMap;
|
|
209
|
-
imports?: StringMap;
|
|
210
209
|
init(assets: U[], config?: HostInitConfig): this;
|
|
211
210
|
customize(options?: CustomizeDocument): void;
|
|
212
211
|
findConfig(data: object, name: string, type?: string): PluginConfig;
|
|
@@ -241,6 +240,8 @@ declare namespace functions {
|
|
|
241
240
|
watchModified?(watch: IFileGroup<U>, assets?: U[]): PostFinalizeCallback;
|
|
242
241
|
set dataSource(value: DataSource[]);
|
|
243
242
|
get dataSource(): DataSource[];
|
|
243
|
+
set imports(value);
|
|
244
|
+
get imports(): StringMap;
|
|
244
245
|
get watching(): boolean;
|
|
245
246
|
}
|
|
246
247
|
|
|
@@ -280,8 +281,8 @@ declare namespace functions {
|
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ModuleConstructor {
|
|
283
|
-
createServer(port: number, active: boolean):
|
|
284
|
-
createServer(port: number, secure?: Null<SecureOptions>, active?: boolean):
|
|
284
|
+
createServer(port: number, active: boolean): Null<ws.Server>;
|
|
285
|
+
createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
|
|
285
286
|
shutdown(): void;
|
|
286
287
|
setTimeout(value: NumString): void;
|
|
287
288
|
checkTimeout(client: ws): boolean;
|
|
@@ -485,6 +486,12 @@ declare namespace functions {
|
|
|
485
486
|
loadSettings(settings: Settings, password?: string): boolean;
|
|
486
487
|
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
487
488
|
sanitizeAssets(assets: T[], exclusions?: string[]): T[];
|
|
489
|
+
writeChecksum(root: string, options?: ChecksumOptions): Promise<string[]>;
|
|
490
|
+
writeChecksum(root: string, to: Undef<string>, options?: ChecksumOptions): Promise<Null<string[]>>;
|
|
491
|
+
writeChecksum(root: string, to?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<string[]>>;
|
|
492
|
+
verifyChecksum(root: string, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
|
|
493
|
+
verifyChecksum(root: string, from: Undef<string>, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
|
|
494
|
+
verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
|
|
488
495
|
createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
|
|
489
496
|
setTimeout(options: ObjectMap<NumString>): void;
|
|
490
497
|
defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
|
|
@@ -683,6 +690,7 @@ declare namespace functions {
|
|
|
683
690
|
asHash(data: BinaryLike, options: AsHashOptions): string;
|
|
684
691
|
asHash(data: BinaryLike, minLength: number): string;
|
|
685
692
|
asHash(data: BinaryLike, algorithm?: NumString | AsHashOptions, minLength?: number | AsHashOptions): string;
|
|
693
|
+
readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
|
|
686
694
|
toPosix(value: unknown, normalize: boolean): string;
|
|
687
695
|
toPosix(value: unknown, filename?: string, normalize?: boolean): string;
|
|
688
696
|
hasLogType(value: LogType): boolean;
|
package/lib/module.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChecksumBase } from './squared';
|
|
2
|
+
|
|
3
|
+
import type { HashOptions } from 'crypto';
|
|
2
4
|
|
|
3
5
|
declare enum NORMALIZE_FLAGS {
|
|
4
6
|
NONE = 0,
|
|
@@ -95,9 +97,12 @@ export interface CopyDirResult {
|
|
|
95
97
|
ignored: string[];
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
export interface
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
export interface ReadHashOptions extends ChecksumBase {
|
|
101
|
+
chunkSize?: number;
|
|
102
|
+
minStreamSize?: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface AsHashOptions extends HashOptions, ChecksumBase {
|
|
101
106
|
minLength?: number;
|
|
102
107
|
}
|
|
103
108
|
|
package/lib/settings.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface ClientSettings extends PlainObject {
|
|
|
33
33
|
cache_dir?: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export interface NodeModule {
|
|
36
|
+
export interface NodeModule<T = PlainObject> extends HandlerSettings<T> {
|
|
37
37
|
process?: {
|
|
38
38
|
cpu_usage?: boolean;
|
|
39
39
|
memory_usage?: boolean;
|
|
@@ -89,6 +89,7 @@ export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
|
|
|
89
89
|
expires?: NumString;
|
|
90
90
|
aria2?: {
|
|
91
91
|
bin?: string | false;
|
|
92
|
+
exec?: ExecAction;
|
|
92
93
|
update_status?: NumString | { interval?: NumString; broadcast_only?: boolean };
|
|
93
94
|
max_concurrent_downloads?: NumString;
|
|
94
95
|
max_connection_per_server?: NumString;
|
|
@@ -121,6 +122,11 @@ export interface DocumentGroup<T = { imports?: StringMap } & AnyObject, U = T> {
|
|
|
121
122
|
transform?: T;
|
|
122
123
|
view_engine?: U;
|
|
123
124
|
pages?: ObjectMap<AnyObject>;
|
|
125
|
+
imports?: StringMap;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface DocumentUsersGroup<T = AnyObject, U = T> extends DocumentGroup<T, U> {
|
|
129
|
+
extensions?: Null<string[]>;
|
|
124
130
|
}
|
|
125
131
|
|
|
126
132
|
export interface DocumentComponent<T = boolean, U = T, V = U> extends Omit<DocumentGroup<T, U>, "pages"> {
|
|
@@ -135,7 +141,7 @@ export interface DocumentComponentOption<T = unknown> {
|
|
|
135
141
|
}
|
|
136
142
|
|
|
137
143
|
export interface DocumentSettings extends DocumentGroup, PurgeAction, PlainObject {
|
|
138
|
-
users?: ObjectMap<
|
|
144
|
+
users?: ObjectMap<DocumentUsersGroup>;
|
|
139
145
|
directory?: DocumentDirectory;
|
|
140
146
|
options?: DocumentComponentOptions;
|
|
141
147
|
}
|
|
@@ -149,6 +155,7 @@ export type DocumentComponentOptions = DocumentComponent<DocumentComponentOption
|
|
|
149
155
|
export interface ClientDBSettings extends ClientSettings, PurgeAction {
|
|
150
156
|
session_expires?: number;
|
|
151
157
|
user_key?: ObjectMap<DbSourceOptions>;
|
|
158
|
+
imports?: StringMap;
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
export interface MemoryModule<T = MemorySettings> extends HandlerSettings<T>, Record<string, Undef<T | ObjectMap<PurgeBase>>> {}
|
|
@@ -419,6 +426,11 @@ export interface ExecOptions extends SpawnOptions {
|
|
|
419
426
|
warn?: StringOfArray;
|
|
420
427
|
}
|
|
421
428
|
|
|
429
|
+
export interface ExecAction {
|
|
430
|
+
uid?: NumString;
|
|
431
|
+
gid?: NumString;
|
|
432
|
+
}
|
|
433
|
+
|
|
422
434
|
export interface PurgeAction {
|
|
423
435
|
purge?: PurgeComponent;
|
|
424
436
|
}
|
package/lib/squared.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference path="type.d.ts" />
|
|
2
2
|
/// <reference path="object.d.ts" />
|
|
3
3
|
|
|
4
|
+
import type { BinaryToTextEncoding } from "crypto";
|
|
5
|
+
|
|
4
6
|
interface Asset extends MimeTypeAction {
|
|
5
7
|
uri?: string;
|
|
6
8
|
}
|
|
@@ -33,7 +35,7 @@ interface BoxRectDimension extends BoxRect, Dimension {
|
|
|
33
35
|
overflow?: boolean;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
export interface FileAsset extends TextAsset, OutputAction, DocumentAction, MultipartAction, ResourceAction, IncrementalAction {
|
|
38
|
+
export interface FileAsset extends TextAsset, OutputAction, DocumentAction, MultipartAction, ResourceAction, IncrementalAction, ChecksumAction {
|
|
37
39
|
format?: StringOfArray;
|
|
38
40
|
dataView?: NodeJS.ArrayBufferView;
|
|
39
41
|
base64?: string;
|
|
@@ -96,6 +98,11 @@ export interface BundleAction<T = unknown> {
|
|
|
96
98
|
exported?: boolean;
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
export interface ChecksumAction {
|
|
102
|
+
checksum?: ChecksumValue;
|
|
103
|
+
checksumOutput?: ChecksumValue;
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
export interface DocumentAction {
|
|
100
107
|
document?: StringOfArray;
|
|
101
108
|
encoding?: BufferEncoding;
|
|
@@ -220,10 +227,8 @@ export interface CompressFormat extends CompressLevel {
|
|
|
220
227
|
options?: PlainObject & { apiKey?: string };
|
|
221
228
|
}
|
|
222
229
|
|
|
223
|
-
export interface WatchInterval<T = FileAsset> {
|
|
230
|
+
export interface WatchInterval<T = FileAsset> extends TaskBase {
|
|
224
231
|
id?: string;
|
|
225
|
-
interval?: number;
|
|
226
|
-
expires?: NumString;
|
|
227
232
|
main?: boolean;
|
|
228
233
|
reload?: WatchReload;
|
|
229
234
|
assets?: T[];
|
|
@@ -238,6 +243,7 @@ export interface WebSocketResponse {
|
|
|
238
243
|
event?: string;
|
|
239
244
|
socketId?: StringOfArray;
|
|
240
245
|
type?: string;
|
|
246
|
+
encoding?: BufferEncoding;
|
|
241
247
|
value?: unknown;
|
|
242
248
|
timeStamp?: number;
|
|
243
249
|
status?: LogStatus[];
|
|
@@ -280,6 +286,7 @@ export interface RequestData extends RequestBase, ImportAction<StringMap>, Incre
|
|
|
280
286
|
task?: string[];
|
|
281
287
|
modules?: string[];
|
|
282
288
|
update?: WatchInterval;
|
|
289
|
+
checksum?: string | boolean | 1 | ChecksumOutput;
|
|
283
290
|
cache?: boolean | AnyObject;
|
|
284
291
|
}
|
|
285
292
|
|
|
@@ -341,8 +348,27 @@ export interface ControllerSettingsDirectoryUI {
|
|
|
341
348
|
audio: string;
|
|
342
349
|
}
|
|
343
350
|
|
|
351
|
+
export interface ChecksumBase<T = BinaryToTextEncoding> {
|
|
352
|
+
algorithm?: string;
|
|
353
|
+
digest?: T;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface ChecksumOutput<T = BinaryToTextEncoding> extends ChecksumBase<T> {
|
|
357
|
+
filename?: string;
|
|
358
|
+
include?: StringOfArray;
|
|
359
|
+
exclude?: StringOfArray;
|
|
360
|
+
recursive?: boolean | 1;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface TaskBase {
|
|
364
|
+
interval?: NumString;
|
|
365
|
+
start?: NumString;
|
|
366
|
+
expires?: NumString;
|
|
367
|
+
}
|
|
368
|
+
|
|
344
369
|
export type WebSocketEvent = "close" | "error";
|
|
345
370
|
export type IncrementalMatch = "none" | "staging" | "etag" | "exists";
|
|
346
371
|
export type TextEncoding = "utf-8" | "utf-16" | "utf-16be" | "utf-16le" | "latin1";
|
|
347
372
|
export type AttributeMap = ObjectMap<unknown>;
|
|
348
|
-
export type WatchValue = boolean | WatchInterval;
|
|
373
|
+
export type WatchValue = boolean | WatchInterval;
|
|
374
|
+
export type ChecksumValue = string | ChecksumBase & { value?: string };
|
package/lib/watch.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export interface IFileGroup<T extends ExternalAsset = ExternalAsset> extends IAb
|
|
|
50
50
|
set lastModified(value: unknown);
|
|
51
51
|
get lastModified(): string;
|
|
52
52
|
get expires(): number;
|
|
53
|
+
get started(): boolean;
|
|
53
54
|
get expired(): boolean;
|
|
54
55
|
get paused(): boolean;
|
|
55
56
|
get abortable(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Type definitions for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"bytes": "^3.1.2",
|
|
24
|
-
"uuid": "^9.0.
|
|
24
|
+
"uuid": "^9.0.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"typescript": "5.
|
|
27
|
+
"typescript": "5.3.3"
|
|
28
28
|
}
|
|
29
29
|
}
|