@e-mc/types 0.8.2 → 0.8.4
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 +194 -3
- package/constant.d.ts +8 -1
- package/index.d.ts +1 -0
- package/index.js +38 -8
- package/lib/filemanager.d.ts +7 -0
- package/lib/index.d.ts +13 -11
- package/lib/logger.d.ts +2 -4
- package/lib/type.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,198 @@
|
|
|
1
|
-
|
|
1
|
+
# @e-mc/types
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
* NodeJS 14
|
|
4
|
+
* ES2020
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## General Usage
|
|
7
|
+
|
|
8
|
+
* [Read the Docs](https://e-mc.readthedocs.io)
|
|
9
|
+
|
|
10
|
+
## Interface
|
|
11
|
+
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/index.d.ts
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { LogArguments } from "./lib/logger";
|
|
16
|
+
import type { CloneObjectOptions } from "./lib/module";
|
|
17
|
+
|
|
18
|
+
import type { BinaryLike, CipherGCMTypes, Encoding } from "crypto";
|
|
19
|
+
|
|
20
|
+
import type { BytesOptions } from "bytes";
|
|
21
|
+
|
|
22
|
+
function createAbortError(): Error;
|
|
23
|
+
function hasBit(value: unknown, flags: number): boolean;
|
|
24
|
+
function ignoreFlag(value: unknown): boolean;
|
|
25
|
+
function cloneFlag(value: unknown): boolean;
|
|
26
|
+
function usingFlag(value: unknown): boolean;
|
|
27
|
+
function watchFlag(value: unknown): boolean;
|
|
28
|
+
function modifiedFlag(value: unknown): boolean;
|
|
29
|
+
function processFlag(value: unknown): boolean;
|
|
30
|
+
function mainFlag(value: unknown): boolean;
|
|
31
|
+
function existsFlag(value: unknown): boolean;
|
|
32
|
+
function getLogCurrent(): LogArguments | null;
|
|
33
|
+
function setLogCurrent(value: LogArguments): void;
|
|
34
|
+
function setTempDir(value: string): boolean;
|
|
35
|
+
function getTempDir(): string;
|
|
36
|
+
function isArray(value: unknown): value is unknown[];
|
|
37
|
+
function isObject(value: unknown): value is object;
|
|
38
|
+
function isPlainObject(value: unknown): value is Record<string | number | symbol, unknown>;
|
|
39
|
+
function isString(value: unknown): value is string;
|
|
40
|
+
function isEmpty(value: unknown): boolean;
|
|
41
|
+
function asFunction(value: unknown, sync?: boolean): ((...args: unknown[]) => Promise<unknown> | unknown) | null;
|
|
42
|
+
function parseTime(value: number | string, start?: number): number;
|
|
43
|
+
function parseExpires(value: number | string, start?: number): number;
|
|
44
|
+
function formatTime(value: number, char: string): string;
|
|
45
|
+
function formatTime(value: number, elapsed?: boolean, char?: string): string;
|
|
46
|
+
function convertTime(value: number | string): number;
|
|
47
|
+
function convertTime(value: HighResolutionTime, format: true): string;
|
|
48
|
+
function convertTime(value: HighResolutionTime, format?: boolean): number;
|
|
49
|
+
function hasGlob(value: string): boolean;
|
|
50
|
+
function escapePattern(value: unknown, lookBehind?: boolean): string;
|
|
51
|
+
function renameExt(value: string, ext: string, when?: string): string;
|
|
52
|
+
function formatSize(value: string): number;
|
|
53
|
+
function formatSize(value: number, options?: BytesOptions): string;
|
|
54
|
+
function alignSize(value: unknown, kb?: number, factor?: number): number;
|
|
55
|
+
function cascadeObject(data: object, query: string, fallback?: unknown): unknown;
|
|
56
|
+
function cloneObject(data: unknown, deep: boolean): unknown;
|
|
57
|
+
function cloneObject(data: unknown, deepIgnore: WeakSet<object>): unknown;
|
|
58
|
+
function cloneObject(data: unknown, options?: CloneObjectOptions<unknown>): unknown;
|
|
59
|
+
function coerceObject(data: unknown, cache: boolean): unknown;
|
|
60
|
+
function coerceObject(data: unknown, parseString?: (...args: [string]) => unknown, cache?: boolean): unknown;
|
|
61
|
+
function getEncoding(value: unknown, fallback?: BufferEncoding): BufferEncoding;
|
|
62
|
+
function encryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): string | undefined;
|
|
63
|
+
function decryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): string | undefined;
|
|
64
|
+
function generateUUID(): string;
|
|
65
|
+
function incrementUUID(restart?: boolean): string;
|
|
66
|
+
function validateUUID(value: unknown): boolean;
|
|
67
|
+
function randomString(format: string, dictionary?: string): string;
|
|
68
|
+
function errorValue(value: string, hint?: string): Error;
|
|
69
|
+
function errorMessage(title: number | string, value: string, hint?: string): Error;
|
|
70
|
+
function purgeMemory(percent?: number): number;
|
|
71
|
+
|
|
72
|
+
interface LOG_TYPE {
|
|
73
|
+
UNKNOWN: 0;
|
|
74
|
+
SYSTEM: 1;
|
|
75
|
+
NODE: 2;
|
|
76
|
+
PROCESS: 4;
|
|
77
|
+
COMPRESS: 8;
|
|
78
|
+
WATCH: 16;
|
|
79
|
+
FILE: 32;
|
|
80
|
+
CLOUD: 64;
|
|
81
|
+
TIME_ELAPSED: 128;
|
|
82
|
+
TIME_PROCESS: 256;
|
|
83
|
+
FAIL: 512;
|
|
84
|
+
HTTP: 1024;
|
|
85
|
+
IMAGE: 2048;
|
|
86
|
+
EXEC: 4096;
|
|
87
|
+
PERMISSION: 8192;
|
|
88
|
+
TIMEOUT: 16384;
|
|
89
|
+
STDOUT: 32768;
|
|
90
|
+
DB: 65536;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface STATUS_TYPE {
|
|
94
|
+
UNKNOWN: 0;
|
|
95
|
+
FATAL: 1;
|
|
96
|
+
ERROR: 2;
|
|
97
|
+
WARN: 3;
|
|
98
|
+
INFO: 4;
|
|
99
|
+
DEBUG: 5;
|
|
100
|
+
ASSERT: 6;
|
|
101
|
+
TRACE: 7;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface ASSET_FLAG {
|
|
105
|
+
NONE: 0;
|
|
106
|
+
IGNORE: 1;
|
|
107
|
+
CLONE: 2;
|
|
108
|
+
USING: 4;
|
|
109
|
+
WATCH: 8;
|
|
110
|
+
MODIFIED: 16;
|
|
111
|
+
PROCESS: 32;
|
|
112
|
+
MAIN: 64;
|
|
113
|
+
EXISTS: 128;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface FILE_TYPE {
|
|
117
|
+
UNKNOWN: 0;
|
|
118
|
+
ASSET: 1;
|
|
119
|
+
TRANSFORM: 2;
|
|
120
|
+
COMPRESSED: 4;
|
|
121
|
+
SOURCEMAP: 8;
|
|
122
|
+
TORRENT: 16;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface ACTION_FLAG {
|
|
126
|
+
NONE: 0;
|
|
127
|
+
IGNORE: 1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface ERR_CODE {
|
|
131
|
+
MODULE_NOT_FOUND: "MODULE_NOT_FOUND";
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface DOWNLOAD_TYPE {
|
|
135
|
+
HTTP: 0;
|
|
136
|
+
DISK: 1;
|
|
137
|
+
CACHE: 2;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface FETCH_TYPE {
|
|
141
|
+
UNKNOWN: 0;
|
|
142
|
+
HTTP: 1;
|
|
143
|
+
TORRENT: 2;
|
|
144
|
+
FTP: 3;
|
|
145
|
+
UNIX_SOCKET: 4;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface DB_TYPE {
|
|
149
|
+
SQL: 1;
|
|
150
|
+
NOSQL: 2;
|
|
151
|
+
DOCUMENT: 4;
|
|
152
|
+
KEYVALUE: 8;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
interface DB_TRANSACTION {
|
|
156
|
+
ACTIVE: 1;
|
|
157
|
+
PARTIAL: 2;
|
|
158
|
+
COMMIT: 4;
|
|
159
|
+
TERMINATE: 8;
|
|
160
|
+
ABORT: 16;
|
|
161
|
+
FAIL: 32;
|
|
162
|
+
AUTH: 64;
|
|
163
|
+
CACHE: 128;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface WATCH_EVENT {
|
|
167
|
+
MODIFIED: "modified";
|
|
168
|
+
BROADCAST: "broadcast";
|
|
169
|
+
CLOSE: "close";
|
|
170
|
+
ERROR: "error";
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface READDIR_SORT {
|
|
174
|
+
FILE: number;
|
|
175
|
+
DIRECTORY: number;
|
|
176
|
+
DESCENDING: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface THRESHOLD {
|
|
180
|
+
FILEMANAGER_INTERVAL: number;
|
|
181
|
+
WATCH_INTERVAL: number;
|
|
182
|
+
WATCH_CHANGE: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const IMPORT_MAP: Record<string, string | undefined>;
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## References
|
|
189
|
+
|
|
190
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/logger.d.ts
|
|
191
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/module.d.ts
|
|
192
|
+
|
|
193
|
+
* https://nodejs.org/api/perf_hooks.html
|
|
194
|
+
* https://www.npmjs.com/package/@types/bytes
|
|
195
|
+
|
|
196
|
+
## LICENSE
|
|
6
197
|
|
|
7
198
|
BSD 3-Clause
|
package/constant.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const enum INTERNAL {
|
|
2
|
-
VERSION = '0.8.
|
|
2
|
+
VERSION = '0.8.4',
|
|
3
3
|
TEMP_DIR = 'tmp', // eslint-disable-line @typescript-eslint/no-shadow
|
|
4
4
|
CJS = '__cjs__'
|
|
5
5
|
}
|
|
@@ -7,6 +7,7 @@ export const enum INTERNAL {
|
|
|
7
7
|
export const enum VAL_MESSAGE {
|
|
8
8
|
SUCCESS = 'Success',
|
|
9
9
|
COMPLETED = 'Completed',
|
|
10
|
+
CHECKSUM = 'Checksum matched',
|
|
10
11
|
MODIFIED_DIRECTORY = 'Directory was modified',
|
|
11
12
|
COMMIT_TRANSACTION = 'Transactions were committed'
|
|
12
13
|
}
|
|
@@ -28,6 +29,7 @@ export const enum VAL_CLOUD {
|
|
|
28
29
|
EMPTY_BUCKET = 'Bucket emptied',
|
|
29
30
|
CONFIGURE_BUCKET = 'Bucket configured',
|
|
30
31
|
POLICY_BUCKET = 'Bucket policy configured',
|
|
32
|
+
WEBSITE_BUCKET = 'Bucket website configured',
|
|
31
33
|
ACL_BUCKET = 'Bucket ACL configured'
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -57,6 +59,7 @@ export const enum ERR_MESSAGE {
|
|
|
57
59
|
TIMEOUT = 'Timeout was exceeded',
|
|
58
60
|
HANDLED_REJECTION = 'Handled rejection',
|
|
59
61
|
UNSUPPORTED_ACCESS = 'Unsupported access',
|
|
62
|
+
UNSUPPORTED_MIME = 'Unsupported MIME',
|
|
60
63
|
UNSUPPORTED_READ = 'Not permitted to read file',
|
|
61
64
|
UNSUPPORTED_WRITE = 'Not permitted to write file',
|
|
62
65
|
NOTFOUND_FILE = 'File not found',
|
|
@@ -123,8 +126,11 @@ export const enum ERR_CLOUD {
|
|
|
123
126
|
CONSTRUCTOR = 'Not a Cloud constructor',
|
|
124
127
|
CREATE_BUCKET = 'Unable to create bucket',
|
|
125
128
|
POLICY_BUCKET = 'Unable to update bucket policy',
|
|
129
|
+
TAGGING_BUCKET = 'Unable to update bucket tagging',
|
|
130
|
+
WEBSITE_BUCKET = 'Unable to set bucket website',
|
|
126
131
|
DELETE_BUCKET = 'Unable to empty bucket',
|
|
127
132
|
CONFIGURE_BUCKET = 'Unable to configure bucket',
|
|
133
|
+
CREATE_TAG = 'Unable to create tags',
|
|
128
134
|
EXISTS_BUCKET = 'Bucket does not exist',
|
|
129
135
|
POLICY_INVALID = 'Invalid bucket policy',
|
|
130
136
|
LIST_BUCKET = 'Unable to list bucket',
|
|
@@ -135,6 +141,7 @@ export const enum ERR_CLOUD {
|
|
|
135
141
|
MODULE_NOTFOUND = 'Cloud module not installed',
|
|
136
142
|
CREATE_BUCKET_SUPPORT = 'Create bucket not supported',
|
|
137
143
|
BUCKET_POLICY_SUPPORT = 'Bucket policy not supported',
|
|
144
|
+
BUCKET_TAGGING_SUPPORT = 'Bucket tagging not supported',
|
|
138
145
|
DELETE_OBJECTS_SUPPORT = 'Delete objects not supported',
|
|
139
146
|
BUCKET_WEBSITE_SUPPORT = 'Set bucket website not supported',
|
|
140
147
|
EXECUTE_QUERY_SUPPORT = 'Execute query not supported',
|
package/index.d.ts
CHANGED
|
@@ -276,6 +276,7 @@ declare namespace types {
|
|
|
276
276
|
function renameExt(value: string, ext: string, when?: string): string;
|
|
277
277
|
function formatSize(value: string): number;
|
|
278
278
|
function formatSize(value: number, options?: BytesOptions): string;
|
|
279
|
+
function alignSize(value: unknown, kb?: number, factor?: number): number;
|
|
279
280
|
function cascadeObject<T = unknown>(data: object, query: string, fallback?: unknown): T;
|
|
280
281
|
function cloneObject<T>(data: T, deep: boolean): T;
|
|
281
282
|
function cloneObject<T>(data: T, deepIgnore: WeakSet<object>): T;
|
package/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.generateUUID = exports.incrementUUID = exports.purgeMemory = exports.errorMessage = void 0;
|
|
3
|
+
exports.validateUUID = exports.randomString = exports.decryptUTF8 = exports.encryptUTF8 = exports.getEncoding = exports.asFunction = exports.coerceObject = exports.cloneObject = exports.cascadeObject = exports.alignSize = 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.incrementUUID = exports.purgeMemory = exports.errorMessage = exports.errorValue = void 0;
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const crypto = require("crypto");
|
|
8
|
-
const uuid = require("uuid");
|
|
9
8
|
const bytes = require("bytes");
|
|
10
9
|
class AbortError extends Error {
|
|
11
10
|
constructor() {
|
|
@@ -323,8 +322,8 @@ var IMPORT_MAP;
|
|
|
323
322
|
IMPORT_MAP["@squared-functions/document/packages/@babel/core"] = "@pi-r/babel";
|
|
324
323
|
IMPORT_MAP["@squared-functions/document/packages/clean-css"] = "@pi-r/clean-css";
|
|
325
324
|
IMPORT_MAP["@squared-functions/document/packages/eslint"] = "@pi-r/eslint";
|
|
326
|
-
IMPORT_MAP["@squared-functions/document/packages/html-minifier-terser"] = "@pi-r/html-minifier-terser";
|
|
327
325
|
IMPORT_MAP["@squared-functions/document/packages/html-minifier"] = "@pi-r/html-minifier";
|
|
326
|
+
IMPORT_MAP["@squared-functions/document/packages/html-minifier-terser"] = "@pi-r/html-minifier-terser";
|
|
328
327
|
IMPORT_MAP["@squared-functions/document/packages/html-validate"] = "@pi-r/html-validate";
|
|
329
328
|
IMPORT_MAP["@squared-functions/document/packages/postcss"] = "@pi-r/postcss";
|
|
330
329
|
IMPORT_MAP["@squared-functions/document/packages/posthtml"] = "@pi-r/posthtml";
|
|
@@ -572,9 +571,40 @@ function renameExt(value, ext, when) {
|
|
|
572
571
|
}
|
|
573
572
|
exports.renameExt = renameExt;
|
|
574
573
|
function formatSize(value, options) {
|
|
575
|
-
|
|
574
|
+
if (typeof value === 'number') {
|
|
575
|
+
return (bytes(value, options) || ('0' + (options?.unitSeparator || '') + 'B'));
|
|
576
|
+
}
|
|
577
|
+
return (bytes(value) || 0);
|
|
576
578
|
}
|
|
577
579
|
exports.formatSize = formatSize;
|
|
580
|
+
function alignSize(value, kb = 0, factor = 0) {
|
|
581
|
+
if (value === undefined) {
|
|
582
|
+
return NaN;
|
|
583
|
+
}
|
|
584
|
+
let result = 0;
|
|
585
|
+
switch (typeof value) {
|
|
586
|
+
case 'number':
|
|
587
|
+
if (value < 0) {
|
|
588
|
+
return NaN;
|
|
589
|
+
}
|
|
590
|
+
result = Math.ceil(factor > 0 ? value * Math.pow(1024, factor) : value);
|
|
591
|
+
break;
|
|
592
|
+
case 'string':
|
|
593
|
+
result = formatSize(value);
|
|
594
|
+
if (result < 0) {
|
|
595
|
+
return NaN;
|
|
596
|
+
}
|
|
597
|
+
break;
|
|
598
|
+
default:
|
|
599
|
+
return NaN;
|
|
600
|
+
}
|
|
601
|
+
if (kb > 0) {
|
|
602
|
+
kb = Math.ceil(kb) * 1024;
|
|
603
|
+
return Math.ceil(result / kb) * kb;
|
|
604
|
+
}
|
|
605
|
+
return result;
|
|
606
|
+
}
|
|
607
|
+
exports.alignSize = alignSize;
|
|
578
608
|
function cascadeObject(data, query, fallback) {
|
|
579
609
|
if (isObject(data) && isString(query)) {
|
|
580
610
|
const names = query.trim().split(/(?<!\\)\./).map(item => item.includes('.') ? item.replace(/\\(?=\.)/g, '') : item);
|
|
@@ -830,11 +860,11 @@ function getEncoding(value, fallback = 'utf-8') {
|
|
|
830
860
|
case 'utf8':
|
|
831
861
|
case 'utf-8':
|
|
832
862
|
case 'utf16le':
|
|
833
|
-
case 'utf-16le':
|
|
834
863
|
return value;
|
|
864
|
+
case 'utf-16le':
|
|
835
865
|
case 'utf16':
|
|
836
866
|
case 'utf-16':
|
|
837
|
-
return '
|
|
867
|
+
return 'utf16le';
|
|
838
868
|
}
|
|
839
869
|
if (Buffer.isEncoding(value)) {
|
|
840
870
|
return value;
|
|
@@ -933,4 +963,4 @@ function incrementUUID(restart) {
|
|
|
933
963
|
return INCREMENT_PREFIX + (INCREMENT_COUNT++).toString(16).padStart(4, '0');
|
|
934
964
|
}
|
|
935
965
|
exports.incrementUUID = incrementUUID;
|
|
936
|
-
exports.generateUUID = typeof crypto.randomUUID === 'function' ? crypto.randomUUID.bind(crypto) : uuid.v4;
|
|
966
|
+
exports.generateUUID = typeof crypto.randomUUID === 'function' ? crypto.randomUUID.bind(crypto) : require('uuid').v4;
|
package/lib/filemanager.d.ts
CHANGED
|
@@ -19,6 +19,13 @@ export const enum FINALIZE_STATE {
|
|
|
19
19
|
ABORTED = 6
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export const enum INCREMENTAL {
|
|
23
|
+
NONE = 'none',
|
|
24
|
+
STAGING = 'staging',
|
|
25
|
+
ETAG = 'etag',
|
|
26
|
+
EXISTS = 'exists'
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
export interface RequestData<T extends ExternalAsset = ExternalAsset> extends IRequestData<T>, RequestInit {
|
|
23
30
|
timeout?: ObjectMap<NumString>;
|
|
24
31
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ import type * as EventEmitter from 'events';
|
|
|
35
35
|
|
|
36
36
|
// @ts-ignore
|
|
37
37
|
import type * as ws from 'ws';
|
|
38
|
-
// @ts-ignore
|
|
39
38
|
import type { FileTypeResult } from 'file-type';
|
|
40
39
|
|
|
41
40
|
type BufferView = BufferContent | NodeJS.ArrayBufferView;
|
|
@@ -66,7 +65,7 @@ declare namespace functions {
|
|
|
66
65
|
chunkSize?: number;
|
|
67
66
|
register(format: string, callback: TryFileCompressor): void;
|
|
68
67
|
getLevel(value: string, fallback?: number): Undef<number>;
|
|
69
|
-
getReadable(file: string | Buffer): Readable;
|
|
68
|
+
getReadable(file: string | URL | Buffer): Readable;
|
|
70
69
|
createGzip(file: string | Buffer, options?: CompressLevel): Gzip;
|
|
71
70
|
createBrotliCompress(file: string | Buffer, options?: CompressLevel): BrotliCompress;
|
|
72
71
|
createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
|
|
@@ -109,7 +108,7 @@ declare namespace functions {
|
|
|
109
108
|
clamp(value: unknown, min?: number, max?: number): number;
|
|
110
109
|
isBinary(mime: unknown): mime is string;
|
|
111
110
|
toABGR(buffer: Uint8Array | Buffer): Buffer;
|
|
112
|
-
/* @deprecated IImage.using
|
|
111
|
+
/* @deprecated - IImage.using */
|
|
113
112
|
using?<V extends ExternalAsset>(this: T, instance: IImage<T, U>, data: IFileThread<V>, command: string): Promise<unknown>;
|
|
114
113
|
readonly prototype: IImage<T, U>;
|
|
115
114
|
new(module?: U): IImage<T, U>;
|
|
@@ -127,7 +126,7 @@ declare namespace functions {
|
|
|
127
126
|
|
|
128
127
|
interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
|
|
129
128
|
finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
|
|
130
|
-
/* @deprecated ITask.using
|
|
129
|
+
/* @deprecated - ITask.using */
|
|
131
130
|
using?<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[], preceding?: boolean): Promise<unknown>;
|
|
132
131
|
readonly prototype: ITask<T, U>;
|
|
133
132
|
new(module?: U, ...args: unknown[]): ITask<T, U>;
|
|
@@ -147,9 +146,9 @@ declare namespace functions {
|
|
|
147
146
|
handleFail(err: unknown, item: V, options?: HandleFailOptions): boolean;
|
|
148
147
|
readTLSCert(value: unknown, cache?: boolean): string;
|
|
149
148
|
readTLSConfig(options: SecureContextOptions, cache?: boolean): void;
|
|
150
|
-
settingsOf(source: string, name:
|
|
149
|
+
settingsOf(source: string, name: keyof Omit<W, "coerce">): unknown;
|
|
151
150
|
settingsOf(source: string, name: "coerce", component: keyof X): unknown;
|
|
152
|
-
settingsKey(source: string, name:
|
|
151
|
+
settingsKey(source: string, name: keyof Omit<W, "coerce">): unknown;
|
|
153
152
|
settingsKey(source: string, name: "coerce", component: keyof X): unknown;
|
|
154
153
|
getPoolConfig(source: string, uuidKey?: string): Undef<Required<PoolConfig>>;
|
|
155
154
|
get sourceType(): DB_TYPE;
|
|
@@ -256,7 +255,7 @@ declare namespace functions {
|
|
|
256
255
|
writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
|
|
257
256
|
updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions | boolean): string;
|
|
258
257
|
generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
|
|
259
|
-
/* @deprecated IDocument.using
|
|
258
|
+
/* @deprecated - IDocument.using */
|
|
260
259
|
using?(this: T, instance: IDocument<T, U, V, W, X, Y>, file: U): Promise<unknown>;
|
|
261
260
|
cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
262
261
|
sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
|
|
@@ -293,6 +292,7 @@ declare namespace functions {
|
|
|
293
292
|
checkTimeout(client: ws): boolean;
|
|
294
293
|
readonly prototype: IWatch<T, U, V, W>;
|
|
295
294
|
new(module?: V): IWatch<T, U, V, W>;
|
|
295
|
+
/* @deprecated */
|
|
296
296
|
new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
|
|
297
297
|
}
|
|
298
298
|
|
|
@@ -311,8 +311,8 @@ declare namespace functions {
|
|
|
311
311
|
proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
|
|
312
312
|
statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
|
|
313
313
|
statusOn(name: ArrayOf<number>, patternUrl: string, callback: StatusOnCallback): void;
|
|
314
|
-
headersOn(name:
|
|
315
|
-
headersOn(name:
|
|
314
|
+
headersOn(name: StringOfArray, callback: HeadersOnCallback): void;
|
|
315
|
+
headersOn(name: StringOfArray, patternUrl: string, callback: HeadersOnCallback): void;
|
|
316
316
|
headersOf(uri: string): Undef<OutgoingHttpHeaders>;
|
|
317
317
|
aria2c(uri: string | URL, pathname: string): Promise<string[]>;
|
|
318
318
|
aria2c(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
|
@@ -425,8 +425,10 @@ declare namespace functions {
|
|
|
425
425
|
writeBuffer(file: T, options?: WriteFileOptions): Null<Buffer>;
|
|
426
426
|
writeImage(document: StringOfArray, output: OutputFinalize<T>): boolean;
|
|
427
427
|
compressFile(file: T, overwrite?: boolean): Promise<unknown>;
|
|
428
|
+
fetchObject(uri: string | URL, format: BufferFormat): Promise<Null<object>>;
|
|
428
429
|
fetchObject(uri: string | URL, options?: OpenOptions | BufferFormat): Promise<Null<object>>;
|
|
429
430
|
fetchBuffer<U extends OpenOptions>(uri: string | URL, options?: U): Promise<DataEncodedResult<U>>;
|
|
431
|
+
fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
|
|
430
432
|
fetchFiles(uri: string | URL, options?: Aria2Options | string): Promise<string[]>;
|
|
431
433
|
start(emptyDir?: boolean): Promise<FinalizeResult>;
|
|
432
434
|
processAssets(emptyDir?: boolean, using?: T[]): void;
|
|
@@ -723,8 +725,8 @@ declare namespace functions {
|
|
|
723
725
|
copyDir(src: string | URL, dest: string | URL, move?: boolean, recursive?: boolean): Promise<CopyDirResult>;
|
|
724
726
|
renameFile(src: string | URL, dest: string | URL, throws?: boolean): boolean;
|
|
725
727
|
streamFile<U extends BufferContent>(src: string, cache: boolean): Promise<U>;
|
|
726
|
-
streamFile<U extends
|
|
727
|
-
streamFile<U extends
|
|
728
|
+
streamFile<U extends ReadBufferOptions>(src: string, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
|
729
|
+
streamFile<U extends ReadBufferOptions>(src: string, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
|
728
730
|
readText(value: string | URL, cache: boolean): string;
|
|
729
731
|
readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<string> : string;
|
|
730
732
|
readText(value: string | URL, encoding?: BufferEncoding | boolean | ReadTextOptions, cache?: boolean): string;
|
package/lib/logger.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { LogStatus } from './squared';
|
|
|
2
2
|
|
|
3
3
|
import type { LOG_TYPE, STATUS_TYPE } from '../index.d';
|
|
4
4
|
|
|
5
|
-
// @ts-ignore
|
|
6
5
|
import type { BackgroundColor as IBackgroundColor, ForegroundColor as IForegroundColor } from 'chalk';
|
|
7
6
|
|
|
8
7
|
type HexColor = `#${string}`;
|
|
@@ -94,10 +93,9 @@ export interface LogTypeValue {
|
|
|
94
93
|
sessionId?: string;
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
export interface LogArguments {
|
|
98
|
-
type?: LogType;
|
|
99
|
-
value?: LogValue;
|
|
96
|
+
export interface LogArguments extends Pick<LogBaseOptions, "type" | "sessionId"> {
|
|
100
97
|
title?: string;
|
|
98
|
+
value?: LogValue;
|
|
101
99
|
message?: unknown;
|
|
102
100
|
}
|
|
103
101
|
|
package/lib/type.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
type Undef<T> = T | undefined;
|
|
4
4
|
type Null<T> = T | null;
|
|
5
5
|
type Void<T> = T | void;
|
|
6
|
-
type Optional<T> =
|
|
6
|
+
type Optional<T> = T | null | undefined;
|
|
7
7
|
type Nullable<T> = { [P in keyof T]: T[P] | null; };
|
|
8
8
|
type Writeable<T> = { -readonly [P in keyof T]: T[P] };
|
|
9
9
|
type KeyOfType<T, U = any, V = any> = { [K in keyof T]: K extends U ? T[K] extends V ? K : never : never }[keyof T];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/types",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "Type definitions for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/anpham6/e-mc.git",
|
|
12
|
+
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
13
|
"directory": "src/types"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|