@e-mc/types 0.5.17 → 0.5.19
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 +1 -1
- package/index.js +14 -7
- package/lib/index.d.ts +2 -1
- package/lib/watch.d.ts +2 -2
- package/package.json +1 -1
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -146,7 +146,6 @@ function recurseObject(data, parseString, completed, cache) {
|
|
|
146
146
|
}
|
|
147
147
|
return data;
|
|
148
148
|
}
|
|
149
|
-
const convertScrypt = (key, iv, data) => crypto.scryptSync(key, iv, Math.ceil(data.length / 16) * 16);
|
|
150
149
|
const isFunction = (value) => typeof value === 'function';
|
|
151
150
|
var LOG_TYPE;
|
|
152
151
|
(function (LOG_TYPE) {
|
|
@@ -714,8 +713,10 @@ function coerceObject(data, parseString, cache) {
|
|
|
714
713
|
const removeQuotes = (content) => content.trim().replace(/^["']/g, '').replace(/["']$/g, '').trim();
|
|
715
714
|
const errorCreate = () => errorValue('Invalid parameters', match[2].trim());
|
|
716
715
|
switch (match[1]) {
|
|
717
|
-
case 'Date':
|
|
718
|
-
|
|
716
|
+
case 'Date': {
|
|
717
|
+
const text = match[2].replace(/["']/g, '').trim();
|
|
718
|
+
return text ? new Date(text) : new Date();
|
|
719
|
+
}
|
|
719
720
|
case 'URL':
|
|
720
721
|
case 'RegExp': {
|
|
721
722
|
const pattern = /^("[^"]+"|'[^']+'|[^\s,]+)(?:\s*,\s*("[^"]+"|'[^']+'|\S+))?$/.exec(match[2].trim());
|
|
@@ -824,23 +825,29 @@ function getEncoding(value, fallback = 'utf-8') {
|
|
|
824
825
|
exports.getEncoding = getEncoding;
|
|
825
826
|
function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
826
827
|
if (checkCipherType(algorithm) && isString(data)) {
|
|
828
|
+
let result;
|
|
827
829
|
try {
|
|
828
|
-
const gcm = crypto.createCipheriv(algorithm,
|
|
829
|
-
|
|
830
|
+
const gcm = crypto.createCipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
|
|
831
|
+
result = gcm.update(data, 'utf8', encoding);
|
|
832
|
+
result += gcm.final(encoding);
|
|
830
833
|
}
|
|
831
834
|
catch {
|
|
832
835
|
}
|
|
836
|
+
return result;
|
|
833
837
|
}
|
|
834
838
|
}
|
|
835
839
|
exports.encryptUTF8 = encryptUTF8;
|
|
836
840
|
function decryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
837
841
|
if (checkCipherType(algorithm) && isString(data)) {
|
|
842
|
+
let result;
|
|
838
843
|
try {
|
|
839
|
-
const gcm = crypto.createDecipheriv(algorithm,
|
|
840
|
-
|
|
844
|
+
const gcm = crypto.createDecipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
|
|
845
|
+
result = gcm.update(data, encoding, 'utf8');
|
|
846
|
+
result += gcm.final('utf8');
|
|
841
847
|
}
|
|
842
848
|
catch {
|
|
843
849
|
}
|
|
850
|
+
return result;
|
|
844
851
|
}
|
|
845
852
|
}
|
|
846
853
|
exports.decryptUTF8 = decryptUTF8;
|
package/lib/index.d.ts
CHANGED
|
@@ -104,6 +104,7 @@ declare namespace functions {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
|
|
107
|
+
/** @deprecated */
|
|
107
108
|
readonly REGEXP_SIZERANGE: RegExp;
|
|
108
109
|
transform(file: string, command: string, options?: TransformOptions): Promise<Null<Buffer> | string>;
|
|
109
110
|
clamp(value: unknown, min?: number, max?: number): number;
|
|
@@ -284,7 +285,7 @@ declare namespace functions {
|
|
|
284
285
|
createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Undef<ws.Server>;
|
|
285
286
|
shutdown(): void;
|
|
286
287
|
setTimeout(value: NumString): void;
|
|
287
|
-
checkTimeout(client: ws): boolean;
|
|
288
|
+
checkTimeout(client: ws.WebSocket): boolean;
|
|
288
289
|
readonly prototype: IWatch<T, U, V, W>;
|
|
289
290
|
new(module?: V): IWatch<T, U, V, W>;
|
|
290
291
|
new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
|
package/lib/watch.d.ts
CHANGED
|
@@ -57,8 +57,8 @@ export interface IFileGroup<T extends ExternalAsset = ExternalAsset> extends IAb
|
|
|
57
57
|
|
|
58
58
|
export interface FileGroupConstructor<T extends ExternalAsset = ExternalAsset> {
|
|
59
59
|
CONNECTION_TIMEOUT: number;
|
|
60
|
-
CLIENT_SESSION: Map<ws, number>;
|
|
61
|
-
checkTimeout(client: ws): boolean;
|
|
60
|
+
CLIENT_SESSION: Map<ws.WebSocket, number>;
|
|
61
|
+
checkTimeout(client: ws.WebSocket): boolean;
|
|
62
62
|
cloneAsset(asset: T): T;
|
|
63
63
|
readonly prototype: IFileGroup<T>;
|
|
64
64
|
new(uri: string, assets: T[], abortable: boolean): IFileGroup<T>;
|