@domain.js/main 0.7.8 → 0.7.10
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/dist/deps/cache/Define.d.ts +5 -5
- package/dist/deps/defines.js +17 -17
- package/dist/deps/redis/index.d.ts +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.js +2 -2
- package/package.json +3 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import LRU from "lru-cache";
|
|
2
1
|
import Redis from "ioredis";
|
|
2
|
+
import LRU from "lru-cache";
|
|
3
3
|
import { SetRequired } from "type-fest";
|
|
4
4
|
export interface CnfDef {
|
|
5
5
|
cache?: {
|
|
@@ -12,13 +12,13 @@ export interface DepsDef {
|
|
|
12
12
|
LRU: typeof LRU;
|
|
13
13
|
IORedis: typeof Redis;
|
|
14
14
|
logger: {
|
|
15
|
-
info(message: string, extra?: any)
|
|
16
|
-
error(error: Error, extra?: any)
|
|
15
|
+
info: (message: string, extra?: any) => void;
|
|
16
|
+
error: (error: Error, extra?: any) => void;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
export interface PubSubDef {
|
|
20
|
-
pub: SetRequired<Partial<Redis
|
|
21
|
-
sub: SetRequired<Partial<Redis
|
|
20
|
+
pub: SetRequired<Partial<Redis>, "publish">;
|
|
21
|
+
sub: SetRequired<Partial<Redis>, "on" | "subscribe">;
|
|
22
22
|
}
|
|
23
23
|
export interface Cache extends LRU<string, string> {
|
|
24
24
|
caching: <T extends (...args: any[]) => Promise<any>>(func: T, life: number, getKey: (...args: Parameters<T>) => string, hit?: (hited: boolean) => void) => T;
|
package/dist/deps/defines.js
CHANGED
|
@@ -37,21 +37,21 @@ const schema = __importStar(require("./schema"));
|
|
|
37
37
|
const sequelize = __importStar(require("./sequelize"));
|
|
38
38
|
const signer = __importStar(require("./signer"));
|
|
39
39
|
module.exports = {
|
|
40
|
-
aes: aes,
|
|
41
|
-
cache: cache,
|
|
42
|
-
checker: checker,
|
|
43
|
-
counter: counter,
|
|
44
|
-
cron: cron,
|
|
45
|
-
frequency: frequency,
|
|
46
|
-
graceful: graceful,
|
|
47
|
-
hash: hash,
|
|
48
|
-
logger: logger,
|
|
49
|
-
myCia: myCia,
|
|
50
|
-
parallel: parallel,
|
|
51
|
-
redis: redis,
|
|
52
|
-
request: request,
|
|
53
|
-
rest: rest,
|
|
54
|
-
schema: schema,
|
|
55
|
-
sequelize: sequelize,
|
|
56
|
-
signer: signer,
|
|
40
|
+
"aes": aes,
|
|
41
|
+
"cache": cache,
|
|
42
|
+
"checker": checker,
|
|
43
|
+
"counter": counter,
|
|
44
|
+
"cron": cron,
|
|
45
|
+
"frequency": frequency,
|
|
46
|
+
"graceful": graceful,
|
|
47
|
+
"hash": hash,
|
|
48
|
+
"logger": logger,
|
|
49
|
+
"myCia": myCia,
|
|
50
|
+
"parallel": parallel,
|
|
51
|
+
"redis": redis,
|
|
52
|
+
"request": request,
|
|
53
|
+
"rest": rest,
|
|
54
|
+
"schema": schema,
|
|
55
|
+
"sequelize": sequelize,
|
|
56
|
+
"signer": signer,
|
|
57
57
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Redis from "ioredis";
|
|
1
|
+
import Redis, { RedisOptions } from "ioredis";
|
|
2
2
|
interface Cnf {
|
|
3
|
-
redis:
|
|
3
|
+
redis: RedisOptions;
|
|
4
4
|
}
|
|
5
5
|
interface Deps {
|
|
6
6
|
IORedis: typeof Redis;
|
|
@@ -12,7 +12,7 @@ interface Deps {
|
|
|
12
12
|
* @param cnf
|
|
13
13
|
* @returns An instance of ioredis
|
|
14
14
|
*/
|
|
15
|
-
export declare function Main(cnf: Cnf, deps: Deps): Redis
|
|
15
|
+
export declare function Main(cnf: Cnf, deps: Deps): Redis & {
|
|
16
16
|
update: (key: string, data: string) => Promise<void>;
|
|
17
17
|
};
|
|
18
18
|
export declare const Deps: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -28,12 +28,12 @@ export declare function Main<T extends Readonly<Array<keyof TDeps>>>(features: T
|
|
|
28
28
|
myCia: typeof import("./deps/myCia");
|
|
29
29
|
parallel: typeof import("./deps/parallel");
|
|
30
30
|
redis: typeof import("./deps/redis");
|
|
31
|
-
request: typeof import("./deps/request");
|
|
31
|
+
request: typeof import("./deps/request"); /** 这里之所以要浅拷贝,是为了避免多次初始化之间互相干扰 */
|
|
32
32
|
rest: typeof import("./deps/rest");
|
|
33
33
|
schema: typeof import("./deps/schema");
|
|
34
34
|
sequelize: typeof import("./deps/sequelize");
|
|
35
35
|
signer: typeof import("./deps/signer");
|
|
36
|
-
}[Include<"frequency", RemoveReadonlyArray<T>> | Include<"schema", RemoveReadonlyArray<T>> | Include<"logger", RemoveReadonlyArray<T>> | Include<"aes", RemoveReadonlyArray<T>> | Include<"request", RemoveReadonlyArray<T>> | Include<"
|
|
36
|
+
}[Include<"frequency", RemoveReadonlyArray<T>> | Include<"schema", RemoveReadonlyArray<T>> | Include<"logger", RemoveReadonlyArray<T>> | Include<"aes", RemoveReadonlyArray<T>> | Include<"request", RemoveReadonlyArray<T>> | Include<"redis", RemoveReadonlyArray<T>> | Include<"sequelize", RemoveReadonlyArray<T>> | Include<"cache", RemoveReadonlyArray<T>> | Include<"counter", RemoveReadonlyArray<T>> | Include<"cron", RemoveReadonlyArray<T>> | Include<"myCia", RemoveReadonlyArray<T>> | Include<"hash", RemoveReadonlyArray<T>> | Include<"rest", RemoveReadonlyArray<T>> | Include<"parallel", RemoveReadonlyArray<T>> | Include<"graceful", RemoveReadonlyArray<T>> | Include<"checker", RemoveReadonlyArray<T>> | Include<"signer", RemoveReadonlyArray<T>>]["Main"] extends (arg: infer R, ...args: any[]) => any ? R : {}>) => { [k in keyof Pick<{
|
|
37
37
|
aes: typeof import("./deps/aes");
|
|
38
38
|
cache: typeof import("./deps/cache");
|
|
39
39
|
checker: typeof import("./deps/checker");
|
|
@@ -46,7 +46,7 @@ export declare function Main<T extends Readonly<Array<keyof TDeps>>>(features: T
|
|
|
46
46
|
myCia: typeof import("./deps/myCia");
|
|
47
47
|
parallel: typeof import("./deps/parallel");
|
|
48
48
|
redis: typeof import("./deps/redis");
|
|
49
|
-
request: typeof import("./deps/request");
|
|
49
|
+
request: typeof import("./deps/request"); /** 这里之所以要浅拷贝,是为了避免多次初始化之间互相干扰 */
|
|
50
50
|
rest: typeof import("./deps/rest");
|
|
51
51
|
schema: typeof import("./deps/schema");
|
|
52
52
|
sequelize: typeof import("./deps/sequelize");
|
|
@@ -64,7 +64,7 @@ export declare function Main<T extends Readonly<Array<keyof TDeps>>>(features: T
|
|
|
64
64
|
myCia: typeof import("./deps/myCia");
|
|
65
65
|
parallel: typeof import("./deps/parallel");
|
|
66
66
|
redis: typeof import("./deps/redis");
|
|
67
|
-
request: typeof import("./deps/request");
|
|
67
|
+
request: typeof import("./deps/request"); /** 这里之所以要浅拷贝,是为了避免多次初始化之间互相干扰 */
|
|
68
68
|
rest: typeof import("./deps/rest");
|
|
69
69
|
schema: typeof import("./deps/schema");
|
|
70
70
|
sequelize: typeof import("./deps/sequelize");
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import * as crypto from "crypto";
|
|
1
2
|
/**
|
|
2
3
|
* Calculates the MD5 value of the given string
|
|
3
4
|
* @param str string or An object that contains a toString method that returns a string
|
|
4
5
|
* @returns hex md5 string
|
|
5
6
|
*/
|
|
6
|
-
export declare const md5: (
|
|
7
|
-
toString: () => string;
|
|
8
|
-
}) => string;
|
|
7
|
+
export declare const md5: (data: crypto.BinaryLike) => string;
|
|
9
8
|
/**
|
|
10
9
|
* Return random string
|
|
11
10
|
* @param len string length
|
package/dist/utils/index.js
CHANGED
|
@@ -37,9 +37,9 @@ const RAND_STR_DICT = {
|
|
|
37
37
|
* @param str string or An object that contains a toString method that returns a string
|
|
38
38
|
* @returns hex md5 string
|
|
39
39
|
*/
|
|
40
|
-
const md5 = (
|
|
40
|
+
const md5 = (data) => {
|
|
41
41
|
const hash = crypto.createHash("md5");
|
|
42
|
-
return hash.update(
|
|
42
|
+
return hash.update(data).digest().toString("hex");
|
|
43
43
|
};
|
|
44
44
|
exports.md5 = md5;
|
|
45
45
|
function randStr(len, type = "normal") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domain.js/main",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"description": "DDD framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@types/async": "^3.2.10",
|
|
56
56
|
"@types/crypto-js": "^4.0.2",
|
|
57
|
-
"@types/ioredis": "^4.28.1",
|
|
58
57
|
"@types/jest": "^27.0.3",
|
|
59
58
|
"@types/lodash": "^4.14.177",
|
|
60
59
|
"@types/lru-cache": "^5.1.1",
|
|
@@ -71,14 +70,14 @@
|
|
|
71
70
|
"crypto-js": "^4.1.1",
|
|
72
71
|
"csv-stringify": "^6.0.2",
|
|
73
72
|
"human-interval": "^2.0.1",
|
|
74
|
-
"ioredis": "^4.
|
|
73
|
+
"ioredis": "^5.4.1",
|
|
75
74
|
"lodash": "^4.17.21",
|
|
76
75
|
"lru-cache": "^6.0.0",
|
|
77
76
|
"moment": "^2.29.1",
|
|
78
77
|
"mysql2": "^2.3.3",
|
|
79
78
|
"restify": "^11.1.0",
|
|
80
79
|
"restify-errors": "^8.0.2",
|
|
81
|
-
"sequelize": "^6.37.
|
|
80
|
+
"sequelize": "^6.37.5",
|
|
82
81
|
"socket.io": "^4.4.1",
|
|
83
82
|
"type-fest": "^2.8.0",
|
|
84
83
|
"uuid": "^8.3.2",
|