@bearei/server-common 0.0.92 → 0.0.94
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/access/access.guard.js +4 -4
- package/dist/access/access.guard.js.map +1 -1
- package/dist/app.decorator.js +2 -2
- package/dist/app.decorator.js.map +1 -1
- package/dist/base/base.interface.d.ts +1 -1
- package/dist/base/base.service.js +8 -8
- package/dist/base/base.service.js.map +1 -1
- package/dist/external/external.service.js +2 -2
- package/dist/external/external.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/util/response.util.d.ts +1 -1
- package/dist/util/response.util.js +3 -3
- package/dist/util/response.util.js.map +1 -1
- package/dist/util/sign.util.d.ts +1 -1
- package/dist/util/sign.util.js +5 -5
- package/dist/util/sign.util.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const handleResponseEntity: <T>(omitKeys?: (keyof T)[]) => (object: T) => T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.handleResponseEntity = void 0;
|
|
4
|
+
const handleResponseEntity = (omitKeys) => (object) => {
|
|
5
5
|
const omitObjectKeys = [
|
|
6
6
|
...new Set(['privateId', 'deletedAt', 'entityStatus', 'version', ...(omitKeys ?? [])])
|
|
7
7
|
];
|
|
@@ -9,5 +9,5 @@ const processResponseEntity = (omitKeys) => (object) => {
|
|
|
9
9
|
omitObjectKeys.forEach(key => delete newObject[key]);
|
|
10
10
|
return newObject;
|
|
11
11
|
};
|
|
12
|
-
exports.
|
|
12
|
+
exports.handleResponseEntity = handleResponseEntity;
|
|
13
13
|
//# sourceMappingURL=response.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.util.js","sourceRoot":"","sources":["../../src/util/response.util.ts"],"names":[],"mappings":";;;AAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"response.util.js","sourceRoot":"","sources":["../../src/util/response.util.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAC7B,CAAI,QAAsB,EAAE,EAAE,CAC9B,CAAC,MAAS,EAAE,EAAE;IACV,MAAM,cAAc,GAAG;QACnB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;KAC1E,CAAA;IAEhB,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAC3C,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,EAAC,CAAC,EACxG,EAAE,CACA,CAAA;IAEN,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;IAEpD,OAAO,SAAS,CAAA;AACpB,CAAC,CAAA;AAfQ,QAAA,oBAAoB,wBAe5B"}
|
package/dist/util/sign.util.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const handleSignString: (object: Record<string, string | number>) => string;
|
|
2
2
|
export declare const sign: (saltRounds?: number) => (object: Record<string, string>) => Promise<string>;
|
|
3
3
|
export declare const signCompare: (data: Record<string, string> | string) => (hash: string) => Promise<boolean>;
|
package/dist/util/sign.util.js
CHANGED
|
@@ -23,11 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.signCompare = exports.sign = exports.
|
|
26
|
+
exports.signCompare = exports.sign = exports.handleSignString = void 0;
|
|
27
27
|
const bcrypt = __importStar(require("bcrypt"));
|
|
28
28
|
const app_interface_1 = require("../app.interface");
|
|
29
29
|
const error_util_1 = require("./error.util");
|
|
30
|
-
const
|
|
30
|
+
const handleSignString = (object) => {
|
|
31
31
|
const signString = `${Object.entries(object)
|
|
32
32
|
.sort((a, b) => a[0].toLowerCase().localeCompare(b[0].toLowerCase()))
|
|
33
33
|
.reduce((accumulator, [_, value]) => (value ? [...accumulator, value] : accumulator), [])
|
|
@@ -39,15 +39,15 @@ const processSignString = (object) => {
|
|
|
39
39
|
})(app_interface_1.APIError.BAD_REQUEST);
|
|
40
40
|
return signString;
|
|
41
41
|
};
|
|
42
|
-
exports.
|
|
42
|
+
exports.handleSignString = handleSignString;
|
|
43
43
|
const sign = (saltRounds = 10) => async (object) => {
|
|
44
|
-
const sign = (0, exports.
|
|
44
|
+
const sign = (0, exports.handleSignString)(object);
|
|
45
45
|
const salt = await bcrypt.genSalt(saltRounds);
|
|
46
46
|
return bcrypt.hash(sign, salt);
|
|
47
47
|
};
|
|
48
48
|
exports.sign = sign;
|
|
49
49
|
const signCompare = (data) => {
|
|
50
|
-
const sign = typeof data === 'string' ? data : (0, exports.
|
|
50
|
+
const sign = typeof data === 'string' ? data : (0, exports.handleSignString)(data);
|
|
51
51
|
return async (hash) => bcrypt.compare(sign, hash);
|
|
52
52
|
};
|
|
53
53
|
exports.signCompare = signCompare;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.util.js","sourceRoot":"","sources":["../../src/util/sign.util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oDAAyC;AACzC,6CAA0C;AAEnC,MAAM,
|
|
1
|
+
{"version":3,"file":"sign.util.js","sourceRoot":"","sources":["../../src/util/sign.util.ts"],"names":[],"mappings":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AE;IACjE,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,wBAAgB,EAAC,IAAI,CAAC,CAAA;IAErE,OAAO,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAC7D,CAAC,CAAA;AAJY,QAAA,WAAW,eAIvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bearei/server-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.94",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "bearei <bear_ei@outlook.com>",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"ts-loader": "^9.4.3",
|
|
71
71
|
"ts-node": "^10.9.1",
|
|
72
72
|
"tsconfig-paths": "^4.2.0",
|
|
73
|
-
"typescript": "^5.
|
|
73
|
+
"typescript": "^5.4.5",
|
|
74
74
|
"typescript-eslint": "^8.1.0"
|
|
75
75
|
},
|
|
76
76
|
"jest": {
|