@e-mc/module 0.8.14 → 0.8.15
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 +7 -7
- package/index.js +18 -24
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.15/lib/index.d.ts
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -173,8 +173,8 @@ interface ModuleConstructor {
|
|
|
173
173
|
parseFunction(value: unknown, absolute: boolean, sync?: boolean): ((...args: unknown[]) => Promise<unknown> | unknown) | null;
|
|
174
174
|
asString(value: unknown, cacheKey?: boolean | "throws"): string;
|
|
175
175
|
asHash(data: BinaryLike, options: AsHashOptions): string;
|
|
176
|
-
asHash(data: BinaryLike,
|
|
177
|
-
asHash(data: BinaryLike, algorithm?:
|
|
176
|
+
asHash(data: BinaryLike, digest: unknown): string;
|
|
177
|
+
asHash(data: BinaryLike, algorithm?: NumString | AsHashOptions, digest?: unknown): string;
|
|
178
178
|
readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
|
|
179
179
|
toPosix(value: unknown, normalize: boolean): string;
|
|
180
180
|
toPosix(value: unknown, filename?: string, normalize?: boolean): string;
|
|
@@ -232,10 +232,10 @@ interface ModuleConstructor {
|
|
|
232
232
|
|
|
233
233
|
## References
|
|
234
234
|
|
|
235
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
236
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
237
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
238
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
235
|
+
- https://www.unpkg.com/@e-mc/types@0.8.15/lib/core.d.ts
|
|
236
|
+
- https://www.unpkg.com/@e-mc/types@0.8.15/lib/logger.d.ts
|
|
237
|
+
- https://www.unpkg.com/@e-mc/types@0.8.15/lib/module.d.ts
|
|
238
|
+
- https://www.unpkg.com/@e-mc/types@0.8.15/lib/node.d.ts
|
|
239
239
|
|
|
240
240
|
## LICENSE
|
|
241
241
|
|
package/index.js
CHANGED
|
@@ -714,7 +714,7 @@ class Module extends EventEmitter {
|
|
|
714
714
|
this[_f] = new AbortController();
|
|
715
715
|
this[_g] = null;
|
|
716
716
|
}
|
|
717
|
-
static get VERSION() { return "0.8.
|
|
717
|
+
static get VERSION() { return "0.8.15"; }
|
|
718
718
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
719
719
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
720
720
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -1231,40 +1231,34 @@ class Module extends EventEmitter {
|
|
|
1231
1231
|
}
|
|
1232
1232
|
return cacheKey ? (0, types_1.generateUUID)() : '';
|
|
1233
1233
|
}
|
|
1234
|
-
static asHash(data, algorithm,
|
|
1235
|
-
if (!algorithm && !
|
|
1234
|
+
static asHash(data, algorithm, digest) {
|
|
1235
|
+
if (!algorithm && !digest) {
|
|
1236
1236
|
return crypto.createHash("sha256").update(data).digest("hex");
|
|
1237
1237
|
}
|
|
1238
|
-
let options
|
|
1239
|
-
if (
|
|
1240
|
-
options =
|
|
1241
|
-
minLength = 0;
|
|
1242
|
-
}
|
|
1243
|
-
if (typeof algorithm === 'number') {
|
|
1244
|
-
minLength = algorithm;
|
|
1245
|
-
algorithm = undefined;
|
|
1246
|
-
}
|
|
1247
|
-
else if ((0, types_1.isObject)(algorithm)) {
|
|
1248
|
-
options = algorithm;
|
|
1249
|
-
algorithm = undefined;
|
|
1250
|
-
}
|
|
1251
|
-
if (options) {
|
|
1252
|
-
options = { ...options };
|
|
1253
|
-
if ('minLength' in options) {
|
|
1254
|
-
minLength = options.minLength;
|
|
1255
|
-
delete options.minLength;
|
|
1256
|
-
}
|
|
1238
|
+
let options;
|
|
1239
|
+
if ((0, types_1.isObject)(algorithm)) {
|
|
1240
|
+
options = { ...algorithm };
|
|
1257
1241
|
if ('algorithm' in options) {
|
|
1258
1242
|
algorithm = options.algorithm;
|
|
1259
1243
|
delete options.algorithm;
|
|
1260
1244
|
}
|
|
1245
|
+
else {
|
|
1246
|
+
algorithm = undefined;
|
|
1247
|
+
}
|
|
1261
1248
|
if ('digest' in options) {
|
|
1262
1249
|
digest = options.digest;
|
|
1263
1250
|
delete options.digest;
|
|
1264
1251
|
}
|
|
1252
|
+
else {
|
|
1253
|
+
digest = undefined;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
else if ((0, types_1.isObject)(digest)) {
|
|
1257
|
+
options = digest;
|
|
1258
|
+
digest = undefined;
|
|
1265
1259
|
}
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1260
|
+
else if (typeof digest !== 'string') {
|
|
1261
|
+
digest = undefined;
|
|
1268
1262
|
}
|
|
1269
1263
|
try {
|
|
1270
1264
|
return crypto.createHash(algorithm || "sha256", options).update(data).digest(digest || "hex");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.15",
|
|
4
4
|
"description": "Module base class for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.8.
|
|
23
|
+
"@e-mc/types": "0.8.15",
|
|
24
24
|
"abort-controller": "^3.0.0",
|
|
25
25
|
"chalk": "4.1.2",
|
|
26
26
|
"event-target-shim": "^5.0.1",
|