chatbot-nc 2.0.53 → 2.0.55
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/cjs/hashing/idObfuscation.d.ts +4 -3
- package/dist/cjs/hashing/idObfuscation.js +21 -37
- package/dist/cjs/hashing/idObfuscation.js.map +1 -1
- package/dist/esm/hashing/idObfuscation.d.ts +4 -3
- package/dist/esm/hashing/idObfuscation.js +21 -37
- package/dist/esm/hashing/idObfuscation.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import Hashids from "hashids";
|
|
2
1
|
declare class idObfuscationService {
|
|
3
|
-
private
|
|
4
|
-
|
|
2
|
+
private hashIds;
|
|
3
|
+
private config;
|
|
4
|
+
constructor();
|
|
5
|
+
private getHashIds;
|
|
5
6
|
/**
|
|
6
7
|
* This used to encode the id
|
|
7
8
|
* @param id pass id in string format only
|
|
@@ -15,41 +15,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const AWSSSM_1 = require("../aws/services/AWSSSM");
|
|
16
16
|
const SSMParameters_1 = require("../config/SSMParameters");
|
|
17
17
|
const hashids_1 = __importDefault(require("hashids"));
|
|
18
|
-
class defaultHashIds {
|
|
19
|
-
getHashIds() {
|
|
20
|
-
try {
|
|
21
|
-
let promise = new Promise((resolve) => {
|
|
22
|
-
console.log("In Promise");
|
|
23
|
-
let response = AWSSSM_1.SSM.getSSMParameter(SSMParameters_1.ssmParameter.idObfuscationSSM).then(result => {
|
|
24
|
-
return result;
|
|
25
|
-
});
|
|
26
|
-
resolve(response);
|
|
27
|
-
});
|
|
28
|
-
promise.then((result) => {
|
|
29
|
-
console.log("In Resolve then Promise", JSON.stringify(result));
|
|
30
|
-
this.config = result;
|
|
31
|
-
});
|
|
32
|
-
console.log("In Response", JSON.stringify(this.config));
|
|
33
|
-
return new hashids_1.default(this.config.Salt, +this.config.MinHashLength);
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
18
|
class idObfuscationService {
|
|
41
|
-
constructor(
|
|
42
|
-
this.
|
|
19
|
+
constructor() {
|
|
20
|
+
this.hashIds = new hashids_1.default();
|
|
21
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
yield this.getHashIds();
|
|
23
|
+
}))();
|
|
24
|
+
}
|
|
25
|
+
getHashIds() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
this.config = yield AWSSSM_1.SSM.getSSMParameter(SSMParameters_1.ssmParameter.idObfuscationSSM);
|
|
29
|
+
console.log("Config of Hash", JSON.stringify(this.config));
|
|
30
|
+
this.hashIds = yield new hashids_1.default(this.config.Salt, +this.config.MinHashLength);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
43
37
|
}
|
|
44
|
-
// private async getHashIds () {
|
|
45
|
-
// try {
|
|
46
|
-
// this.config = await SSM.getSSMParameter(ssmParameter.idObfuscationSSM);
|
|
47
|
-
// this.hashIds = await new Hashids(this.config.Salt, +this.config.MinHashLength);
|
|
48
|
-
// return;
|
|
49
|
-
// } catch (error) {
|
|
50
|
-
// throw error;
|
|
51
|
-
// }
|
|
52
|
-
// }
|
|
53
38
|
/**
|
|
54
39
|
* This used to encode the id
|
|
55
40
|
* @param id pass id in string format only
|
|
@@ -58,7 +43,7 @@ class idObfuscationService {
|
|
|
58
43
|
encode(id) {
|
|
59
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
45
|
try {
|
|
61
|
-
return yield this.
|
|
46
|
+
return yield this.hashIds.encode(id);
|
|
62
47
|
}
|
|
63
48
|
catch (error) {
|
|
64
49
|
throw error;
|
|
@@ -73,7 +58,7 @@ class idObfuscationService {
|
|
|
73
58
|
decode(id) {
|
|
74
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
60
|
try {
|
|
76
|
-
return yield this.
|
|
61
|
+
return yield this.hashIds.decode(id)[0];
|
|
77
62
|
}
|
|
78
63
|
catch (error) {
|
|
79
64
|
throw error;
|
|
@@ -81,7 +66,6 @@ class idObfuscationService {
|
|
|
81
66
|
});
|
|
82
67
|
}
|
|
83
68
|
}
|
|
84
|
-
let
|
|
85
|
-
let hashIds = new idObfuscationService(hashConfig);
|
|
69
|
+
let hashIds = new idObfuscationService();
|
|
86
70
|
exports.default = hashIds;
|
|
87
71
|
//# sourceMappingURL=idObfuscation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mDAA4C;AAC5C,2DAAuD;AACvD,sDAA8B;AAE9B,MAAM,oBAAoB;IAItB;QAHM,YAAO,GAAY,IAAI,iBAAO,EAAE,CAAC;QAIvC,CAAC,GAAQ,EAAE;YACP,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC,CAAA,CAAC,EAAE,CAAC;IACL,CAAC;IAEa,UAAU;;YACvB,IAAI;gBACA,IAAI,CAAC,MAAM,GAAG,MAAM,YAAG,CAAC,eAAe,CAAC,4BAAY,CAAC,gBAAgB,CAAC,CAAC;gBACvE,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC3D,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,iBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC/E,OAAO;aACV;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,KAAK,CAAC;aACf;QACF,CAAC;KAAA;IAED;;;;OAIG;IACG,MAAM,CAAC,EAAS;;YAErB,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;aACtC;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,KAAK,CAAC;aACf;QACF,CAAC;KAAA;IAED;;;;OAIG;IACG,MAAM,CAAC,EAAS;;YAErB,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACF,CAAC;KAAA;CACJ;AAED,IAAI,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;AACzC,kBAAe,OAAO,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import Hashids from "hashids";
|
|
2
1
|
declare class idObfuscationService {
|
|
3
|
-
private
|
|
4
|
-
|
|
2
|
+
private hashIds;
|
|
3
|
+
private config;
|
|
4
|
+
constructor();
|
|
5
|
+
private getHashIds;
|
|
5
6
|
/**
|
|
6
7
|
* This used to encode the id
|
|
7
8
|
* @param id pass id in string format only
|
|
@@ -10,41 +10,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { SSM } from "../aws/services/AWSSSM";
|
|
11
11
|
import { ssmParameter } from '../config/SSMParameters';
|
|
12
12
|
import Hashids from "hashids";
|
|
13
|
-
class defaultHashIds {
|
|
14
|
-
getHashIds() {
|
|
15
|
-
try {
|
|
16
|
-
let promise = new Promise((resolve) => {
|
|
17
|
-
console.log("In Promise");
|
|
18
|
-
let response = SSM.getSSMParameter(ssmParameter.idObfuscationSSM).then(result => {
|
|
19
|
-
return result;
|
|
20
|
-
});
|
|
21
|
-
resolve(response);
|
|
22
|
-
});
|
|
23
|
-
promise.then((result) => {
|
|
24
|
-
console.log("In Resolve then Promise", JSON.stringify(result));
|
|
25
|
-
this.config = result;
|
|
26
|
-
});
|
|
27
|
-
console.log("In Response", JSON.stringify(this.config));
|
|
28
|
-
return new Hashids(this.config.Salt, +this.config.MinHashLength);
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
13
|
class idObfuscationService {
|
|
36
|
-
constructor(
|
|
37
|
-
this.
|
|
14
|
+
constructor() {
|
|
15
|
+
this.hashIds = new Hashids();
|
|
16
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
yield this.getHashIds();
|
|
18
|
+
}))();
|
|
19
|
+
}
|
|
20
|
+
getHashIds() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
this.config = yield SSM.getSSMParameter(ssmParameter.idObfuscationSSM);
|
|
24
|
+
console.log("Config of Hash", JSON.stringify(this.config));
|
|
25
|
+
this.hashIds = yield new Hashids(this.config.Salt, +this.config.MinHashLength);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
38
32
|
}
|
|
39
|
-
// private async getHashIds () {
|
|
40
|
-
// try {
|
|
41
|
-
// this.config = await SSM.getSSMParameter(ssmParameter.idObfuscationSSM);
|
|
42
|
-
// this.hashIds = await new Hashids(this.config.Salt, +this.config.MinHashLength);
|
|
43
|
-
// return;
|
|
44
|
-
// } catch (error) {
|
|
45
|
-
// throw error;
|
|
46
|
-
// }
|
|
47
|
-
// }
|
|
48
33
|
/**
|
|
49
34
|
* This used to encode the id
|
|
50
35
|
* @param id pass id in string format only
|
|
@@ -53,7 +38,7 @@ class idObfuscationService {
|
|
|
53
38
|
encode(id) {
|
|
54
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
40
|
try {
|
|
56
|
-
return yield this.
|
|
41
|
+
return yield this.hashIds.encode(id);
|
|
57
42
|
}
|
|
58
43
|
catch (error) {
|
|
59
44
|
throw error;
|
|
@@ -68,7 +53,7 @@ class idObfuscationService {
|
|
|
68
53
|
decode(id) {
|
|
69
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
55
|
try {
|
|
71
|
-
return yield this.
|
|
56
|
+
return yield this.hashIds.decode(id)[0];
|
|
72
57
|
}
|
|
73
58
|
catch (error) {
|
|
74
59
|
throw error;
|
|
@@ -76,7 +61,6 @@ class idObfuscationService {
|
|
|
76
61
|
});
|
|
77
62
|
}
|
|
78
63
|
}
|
|
79
|
-
let
|
|
80
|
-
let hashIds = new idObfuscationService(hashConfig);
|
|
64
|
+
let hashIds = new idObfuscationService();
|
|
81
65
|
export default hashIds;
|
|
82
66
|
//# sourceMappingURL=idObfuscation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,oBAAoB;IAItB;QAHM,YAAO,GAAY,IAAI,OAAO,EAAE,CAAC;QAIvC,CAAC,GAAQ,EAAE;YACP,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC,CAAA,CAAC,EAAE,CAAC;IACL,CAAC;IAEa,UAAU;;YACvB,IAAI;gBACA,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;gBACvE,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC3D,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC/E,OAAO;aACV;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,KAAK,CAAC;aACf;QACF,CAAC;KAAA;IAED;;;;OAIG;IACG,MAAM,CAAC,EAAS;;YAErB,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;aACtC;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,KAAK,CAAC;aACf;QACF,CAAC;KAAA;IAED;;;;OAIG;IACG,MAAM,CAAC,EAAS;;YAErB,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACF,CAAC;KAAA;CACJ;AAED,IAAI,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;AACzC,eAAe,OAAO,CAAC"}
|