@domain.js/main 0.7.9 → 0.7.11
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.
|
@@ -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;
|
|
@@ -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/deps/rest/utils.js
CHANGED
|
@@ -376,8 +376,11 @@ function Utils(cnf, deps) {
|
|
|
376
376
|
findOptFilter(params, name, where, Model.name);
|
|
377
377
|
});
|
|
378
378
|
if (!params._showDeleted) {
|
|
379
|
-
|
|
379
|
+
const rawAttributes = Model.getAttributes();
|
|
380
|
+
if ("isDeleted" in rawAttributes)
|
|
380
381
|
where.isDeleted = "no";
|
|
382
|
+
if ("deletedAt" in rawAttributes)
|
|
383
|
+
where.deletedAt = null;
|
|
381
384
|
}
|
|
382
385
|
// 将搜索条件添加到主条件上
|
|
383
386
|
const searchOptRes = searchOpt(Model, params._searchs, params.q);
|
|
@@ -392,10 +395,15 @@ function Utils(cnf, deps) {
|
|
|
392
395
|
_.each(filterAttrs, (name) => {
|
|
393
396
|
findOptFilter(params, `${x.as}.${name}`, includeWhere, x.as, name);
|
|
394
397
|
});
|
|
398
|
+
const rawAttributes = x.model.getAttributes();
|
|
395
399
|
if (!params._showDeleted) {
|
|
396
|
-
if (
|
|
397
|
-
|
|
398
|
-
|
|
400
|
+
if ("isDeleted" in rawAttributes) {
|
|
401
|
+
includeWhere[sequelize_1.Op.or] = [{ isDeleted: "no" }];
|
|
402
|
+
if (x.required === false)
|
|
403
|
+
includeWhere[sequelize_1.Op.or].push({ id: null });
|
|
404
|
+
}
|
|
405
|
+
if ("deletedAt" in rawAttributes) {
|
|
406
|
+
includeWhere[sequelize_1.Op.or] = [{ deletedAt: null }];
|
|
399
407
|
if (x.required === false)
|
|
400
408
|
includeWhere[sequelize_1.Op.or].push({ id: null });
|
|
401
409
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare function Main<T extends Readonly<Array<keyof TDeps>>>(features: T
|
|
|
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");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domain.js/main",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.11",
|
|
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",
|