chatbot-nc 2.0.81 → 2.0.84
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/aws/index.d.ts +1 -0
- package/dist/cjs/aws/services/AESEncryptionUsingKMS.js +11 -20
- package/dist/cjs/aws/services/AESEncryptionUsingKMS.js.map +1 -1
- package/dist/cjs/aws/services/AWSChimeMeeting.js +15 -24
- package/dist/cjs/aws/services/AWSChimeMeeting.js.map +1 -1
- package/dist/cjs/aws/services/AWSCodepipeline.js +21 -34
- package/dist/cjs/aws/services/AWSCodepipeline.js.map +1 -1
- package/dist/cjs/aws/services/AWSComprehend.js +3 -12
- package/dist/cjs/aws/services/AWSComprehend.js.map +1 -1
- package/dist/cjs/aws/services/AWSConnect.js +135 -146
- package/dist/cjs/aws/services/AWSConnect.js.map +1 -1
- package/dist/cjs/aws/services/AWSConnectCases.js +12 -21
- package/dist/cjs/aws/services/AWSConnectCases.js.map +1 -1
- package/dist/cjs/aws/services/AWSConnectParticipant.js +12 -21
- package/dist/cjs/aws/services/AWSConnectParticipant.js.map +1 -1
- package/dist/cjs/aws/services/AWSCustomerProfiles.js +6 -15
- package/dist/cjs/aws/services/AWSCustomerProfiles.js.map +1 -1
- package/dist/cjs/aws/services/AWSDynamoDb.js +9 -18
- package/dist/cjs/aws/services/AWSDynamoDb.js.map +1 -1
- package/dist/cjs/aws/services/AWSGateway.js +6 -15
- package/dist/cjs/aws/services/AWSGateway.js.map +1 -1
- package/dist/cjs/aws/services/AWSGatewayManagement.js +6 -15
- package/dist/cjs/aws/services/AWSGatewayManagement.js.map +1 -1
- package/dist/cjs/aws/services/AWSLambda.js +4 -13
- package/dist/cjs/aws/services/AWSLambda.js.map +1 -1
- package/dist/cjs/aws/services/AWSLexModel.js +63 -72
- package/dist/cjs/aws/services/AWSLexModel.js.map +1 -1
- package/dist/cjs/aws/services/AWSLexRuntime.js +6 -15
- package/dist/cjs/aws/services/AWSLexRuntime.js.map +1 -1
- package/dist/cjs/aws/services/AWSPinpoint.js +9 -18
- package/dist/cjs/aws/services/AWSPinpoint.js.map +1 -1
- package/dist/cjs/aws/services/AWSPinpointSMSVoice.js +18 -27
- package/dist/cjs/aws/services/AWSPinpointSMSVoice.js.map +1 -1
- package/dist/cjs/aws/services/AWSQConnect.js +18 -27
- package/dist/cjs/aws/services/AWSQConnect.js.map +1 -1
- package/dist/cjs/aws/services/AWSS3.js +28 -37
- package/dist/cjs/aws/services/AWSS3.js.map +1 -1
- package/dist/cjs/aws/services/AWSSES.js +4 -13
- package/dist/cjs/aws/services/AWSSES.js.map +1 -1
- package/dist/cjs/aws/services/AWSSNS.js +11 -20
- package/dist/cjs/aws/services/AWSSNS.js.map +1 -1
- package/dist/cjs/aws/services/AWSSSM.d.ts +1 -0
- package/dist/cjs/aws/services/AWSSSM.js +42 -13
- package/dist/cjs/aws/services/AWSSSM.js.map +1 -1
- package/dist/cjs/aws/services/AWSSTS.js +3 -12
- package/dist/cjs/aws/services/AWSSTS.js.map +1 -1
- package/dist/cjs/aws/services/AWSTranslate.js +3 -12
- package/dist/cjs/aws/services/AWSTranslate.js.map +1 -1
- package/dist/cjs/communication/communicationService.js +29 -38
- package/dist/cjs/communication/communicationService.js.map +1 -1
- package/dist/cjs/communication/index.js +125 -148
- package/dist/cjs/communication/index.js.map +1 -1
- package/dist/cjs/hashing/idObfuscation.js +28 -42
- package/dist/cjs/hashing/idObfuscation.js.map +1 -1
- package/dist/cjs/hashing/index.js +141 -168
- package/dist/cjs/hashing/index.js.map +1 -1
- package/dist/cjs/repository/dynamodb.js +369 -398
- package/dist/cjs/repository/dynamodb.js.map +1 -1
- package/dist/cjs/shortner/index.js +20 -31
- package/dist/cjs/shortner/index.js.map +1 -1
- package/dist/cjs/utils/common.js +2 -11
- package/dist/cjs/utils/common.js.map +1 -1
- package/dist/cjs/utils/intent.js +24 -33
- package/dist/cjs/utils/intent.js.map +1 -1
- package/dist/cjs/webbookEvent/index.js +105 -128
- package/dist/cjs/webbookEvent/index.js.map +1 -1
- package/dist/esm/aws/index.d.ts +1 -0
- package/dist/esm/aws/services/AWSConnect.js +0 -2
- package/dist/esm/aws/services/AWSConnect.js.map +1 -1
- package/dist/esm/aws/services/AWSSSM.d.ts +1 -0
- package/dist/esm/aws/services/AWSSSM.js +39 -1
- package/dist/esm/aws/services/AWSSSM.js.map +1 -1
- package/dist/esm/hashing/idObfuscation.js +2 -1
- package/dist/esm/hashing/idObfuscation.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const communicationService_1 = require("./communicationService");
|
|
13
4
|
class BaseCommunicationService {
|
|
@@ -49,42 +40,36 @@ class BaseCommunicationService {
|
|
|
49
40
|
// throw error;
|
|
50
41
|
// }
|
|
51
42
|
// }
|
|
52
|
-
getToken(id, parentId) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
});
|
|
43
|
+
async getToken(id, parentId) {
|
|
44
|
+
try {
|
|
45
|
+
const token = await communicationService_1.LAMBDA.generateJWTToken("User", id, parentId === null || parentId === void 0 ? void 0 : parentId.toString());
|
|
46
|
+
//const token = await LAMBDA.generateJWTToken( "User", id, "0", "0","0" );
|
|
47
|
+
return token;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error("BaseCommunicationService : getPartnerToken : " + JSON.stringify(error.name));
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
64
53
|
}
|
|
65
|
-
getRefreshToken(id, parentId) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
});
|
|
54
|
+
async getRefreshToken(id, parentId) {
|
|
55
|
+
try {
|
|
56
|
+
const token = await communicationService_1.LAMBDA.generateRefreshJWTToken("User", id, parentId === null || parentId === void 0 ? void 0 : parentId.toString());
|
|
57
|
+
return token;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error("BaseCommunicationService : getRefreshToken : " + JSON.stringify(error.name));
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
76
63
|
}
|
|
77
|
-
verifyRefreshToken(token) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
});
|
|
64
|
+
async verifyRefreshToken(token) {
|
|
65
|
+
try {
|
|
66
|
+
const verifiedToken = await communicationService_1.LAMBDA.verifyRefreshJWTToken(token);
|
|
67
|
+
return verifiedToken;
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error("BaseCommunicationService : verifyRefreshToken : " + JSON.stringify(error.name));
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
88
73
|
}
|
|
89
74
|
/**
|
|
90
75
|
* This Function is used for Lambda to Api Call When you already have Token With you
|
|
@@ -97,49 +82,47 @@ class BaseCommunicationService {
|
|
|
97
82
|
* @param token
|
|
98
83
|
* @returns
|
|
99
84
|
*/
|
|
100
|
-
invokeLambdaApiWithToken(module, path, method, userType, jsonData, id, token) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
rawToken: token
|
|
115
|
-
});
|
|
116
|
-
// if (partnerId !== undefined && partnerId !== 0 && partnerId != null) {
|
|
117
|
-
// communicationRequest.merchantId = merchantId;
|
|
118
|
-
// communicationRequest.parentId = partnerId;
|
|
119
|
-
// communicationRequest.userType = userType;
|
|
120
|
-
// }
|
|
121
|
-
// console.log(JSON.stringify(communicationRequest))
|
|
122
|
-
//Act
|
|
123
|
-
try {
|
|
124
|
-
const resultString = yield communicationService_1.LAMBDA.invokeAPI(communicationRequest);
|
|
125
|
-
var resultJson = JSON.parse(Buffer.from(resultString.buffer).toString());
|
|
126
|
-
console.info(`response - ${resultString}`);
|
|
127
|
-
// statusCode = resultJson.statusCode === undefined ? 400:resultJson.statusCode ;
|
|
128
|
-
// response = resultJson.body;
|
|
129
|
-
let response = Object.assign({});
|
|
130
|
-
if (resultJson.statusCode != 404 && resultJson.body != "") {
|
|
131
|
-
response.body = JSON.parse(resultJson.body);
|
|
132
|
-
}
|
|
133
|
-
response.statusCode = resultJson.statusCode;
|
|
134
|
-
console.info("BaseCommunicationService : invokeLambdaApiWithToken : End : ");
|
|
135
|
-
return response;
|
|
136
|
-
// return resultJson;//JSON.parse(resultJson.body);
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
console.error(`BaseCommunicationService : invokeLambdaApiWithToken : Error : - ${error}`);
|
|
140
|
-
throw error;
|
|
141
|
-
}
|
|
85
|
+
async invokeLambdaApiWithToken(module, path, method, userType, jsonData, id, token) {
|
|
86
|
+
// async invokeLambdaApiWithToken (module:string, path: string, method:HttpMethod | string, merchantId:string, partnerId:string, jsonData: any, userType:string, token:string) {
|
|
87
|
+
console.info("BaseCommunicationService : invokeLambdaApiWithToken : Start : ");
|
|
88
|
+
// console.info(`path: ${path} - merchantId: ${merchantId}`);
|
|
89
|
+
// console.info(`request: ${JSON.stringify(jsonData)}`);
|
|
90
|
+
let communicationRequest = Object.assign({
|
|
91
|
+
moduleName: module,
|
|
92
|
+
method: method,
|
|
93
|
+
path: path,
|
|
94
|
+
jsonData: jsonData,
|
|
95
|
+
userType: userType,
|
|
96
|
+
id: id,
|
|
97
|
+
// parentId: merchantId,
|
|
98
|
+
rawToken: token
|
|
142
99
|
});
|
|
100
|
+
// if (partnerId !== undefined && partnerId !== 0 && partnerId != null) {
|
|
101
|
+
// communicationRequest.merchantId = merchantId;
|
|
102
|
+
// communicationRequest.parentId = partnerId;
|
|
103
|
+
// communicationRequest.userType = userType;
|
|
104
|
+
// }
|
|
105
|
+
// console.log(JSON.stringify(communicationRequest))
|
|
106
|
+
//Act
|
|
107
|
+
try {
|
|
108
|
+
const resultString = await communicationService_1.LAMBDA.invokeAPI(communicationRequest);
|
|
109
|
+
var resultJson = JSON.parse(Buffer.from(resultString.buffer).toString());
|
|
110
|
+
console.info(`response - ${resultString}`);
|
|
111
|
+
// statusCode = resultJson.statusCode === undefined ? 400:resultJson.statusCode ;
|
|
112
|
+
// response = resultJson.body;
|
|
113
|
+
let response = Object.assign({});
|
|
114
|
+
if (resultJson.statusCode != 404 && resultJson.body != "") {
|
|
115
|
+
response.body = JSON.parse(resultJson.body);
|
|
116
|
+
}
|
|
117
|
+
response.statusCode = resultJson.statusCode;
|
|
118
|
+
console.info("BaseCommunicationService : invokeLambdaApiWithToken : End : ");
|
|
119
|
+
return response;
|
|
120
|
+
// return resultJson;//JSON.parse(resultJson.body);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.error(`BaseCommunicationService : invokeLambdaApiWithToken : Error : - ${error}`);
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
143
126
|
}
|
|
144
127
|
/**
|
|
145
128
|
* This Function is used for Lambda to Api Call When you we dont have token
|
|
@@ -153,41 +136,39 @@ class BaseCommunicationService {
|
|
|
153
136
|
* @returns
|
|
154
137
|
*/
|
|
155
138
|
// async invokeLambdaApi (module:string, path:string, method:HttpMethod | string, userType:string, jsonData:any, merchant:string, partnerId:string)
|
|
156
|
-
invokeLambdaApi(module, path, method, userType, jsonData, id) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
id: id
|
|
168
|
-
});
|
|
169
|
-
// if (partnerId !== undefined && partnerId !== 0 && partnerId != null && partnerId !== "") {
|
|
170
|
-
// communicationRequest.merchantId = merchantId;
|
|
171
|
-
// communicationRequest.parentId = partnerId;
|
|
172
|
-
// communicationRequest.userType = userType;
|
|
173
|
-
// }
|
|
174
|
-
try {
|
|
175
|
-
const resultString = yield communicationService_1.LAMBDA.invokeLambdaAPI(communicationRequest);
|
|
176
|
-
var resultJson = JSON.parse(Buffer.from(resultString.buffer).toString());
|
|
177
|
-
console.info(`response - ${resultString}`);
|
|
178
|
-
let response = Object.create({});
|
|
179
|
-
if (resultJson.body != "") {
|
|
180
|
-
response.body = (yield this.isJSONString(resultJson.body)) ? JSON.parse(resultJson.body) : resultJson.body;
|
|
181
|
-
}
|
|
182
|
-
response.statusCode = resultJson.statusCode;
|
|
183
|
-
return response;
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
console.error("CommonService : invokeLambdaApi : Error : " + JSON.stringify(error.name));
|
|
187
|
-
console.error(`error occured while calling lambda api for path - ${path}`);
|
|
188
|
-
throw error;
|
|
189
|
-
}
|
|
139
|
+
async invokeLambdaApi(module, path, method, userType, jsonData, id) {
|
|
140
|
+
// console.log(`path: ${path} - merchantId: ${merchantId} request: ${JSON.stringify(jsonData)}`);
|
|
141
|
+
let communicationRequest = Object.create({
|
|
142
|
+
moduleName: module,
|
|
143
|
+
method: method,
|
|
144
|
+
path: path,
|
|
145
|
+
jsonData: jsonData,
|
|
146
|
+
userType: userType,
|
|
147
|
+
// parentId: merchantId,
|
|
148
|
+
// merchantId: merchantId
|
|
149
|
+
id: id
|
|
190
150
|
});
|
|
151
|
+
// if (partnerId !== undefined && partnerId !== 0 && partnerId != null && partnerId !== "") {
|
|
152
|
+
// communicationRequest.merchantId = merchantId;
|
|
153
|
+
// communicationRequest.parentId = partnerId;
|
|
154
|
+
// communicationRequest.userType = userType;
|
|
155
|
+
// }
|
|
156
|
+
try {
|
|
157
|
+
const resultString = await communicationService_1.LAMBDA.invokeLambdaAPI(communicationRequest);
|
|
158
|
+
var resultJson = JSON.parse(Buffer.from(resultString.buffer).toString());
|
|
159
|
+
console.info(`response - ${resultString}`);
|
|
160
|
+
let response = Object.create({});
|
|
161
|
+
if (resultJson.body != "") {
|
|
162
|
+
response.body = await this.isJSONString(resultJson.body) ? JSON.parse(resultJson.body) : resultJson.body;
|
|
163
|
+
}
|
|
164
|
+
response.statusCode = resultJson.statusCode;
|
|
165
|
+
return response;
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
console.error("CommonService : invokeLambdaApi : Error : " + JSON.stringify(error.name));
|
|
169
|
+
console.error(`error occured while calling lambda api for path - ${path}`);
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
191
172
|
}
|
|
192
173
|
/**
|
|
193
174
|
* This Function is used for Lambda to Lambda Handler Call
|
|
@@ -200,42 +181,38 @@ class BaseCommunicationService {
|
|
|
200
181
|
* @param token
|
|
201
182
|
* @returns
|
|
202
183
|
*/
|
|
203
|
-
invokeLambda(module, type, events) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
response.body = (yield this.isJSONString(resultJson.body)) ? JSON.parse(resultJson.body) : resultJson.body;
|
|
214
|
-
}
|
|
215
|
-
response.statusCode = resultJson.statusCode;
|
|
216
|
-
return response;
|
|
184
|
+
async invokeLambda(module, type, events) {
|
|
185
|
+
try {
|
|
186
|
+
const resultString = await communicationService_1.LAMBDA.invokeLambda(module, type, events);
|
|
187
|
+
if (resultString && !Object.keys(resultString).length)
|
|
188
|
+
return { statusCode: 200 };
|
|
189
|
+
var resultJson = JSON.parse(Buffer.from(resultString.buffer).toString());
|
|
190
|
+
console.info(`response - ${resultString}`);
|
|
191
|
+
let response = Object.create({});
|
|
192
|
+
if (resultJson.body != "") {
|
|
193
|
+
response.body = await this.isJSONString(resultJson.body) ? JSON.parse(resultJson.body) : resultJson.body;
|
|
217
194
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
195
|
+
response.statusCode = resultJson.statusCode;
|
|
196
|
+
return response;
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
console.error("CommonService : invokeLambda : Error : " + JSON.stringify(error.name));
|
|
200
|
+
console.error(`error occured while calling lambda for path - ${module}`);
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
224
203
|
}
|
|
225
204
|
/**
|
|
226
205
|
*
|
|
227
206
|
* @param str
|
|
228
207
|
* @returns
|
|
229
208
|
*/
|
|
230
|
-
isJSONString(str) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
});
|
|
209
|
+
async isJSONString(str) {
|
|
210
|
+
try {
|
|
211
|
+
return JSON.parse(str) && !!str;
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
239
216
|
}
|
|
240
217
|
}
|
|
241
218
|
exports.default = BaseCommunicationService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../communication/index.ts"],"names":[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,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,CAAC,cAAc,YAAY,EAAE,CAAC,CAAC;YAE3C,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACjC,IAAI,UAAU,CAAC,IAAI,IAAI,EAAE,EAAE;gBACvB,QAAQ,CAAC,IAAI,GAAI,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,UAAU,CAAC,IAAI,CAAA;aAC3G;YACD,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;YAC5C,OAAO,QAAQ,CAAC;SAEnB;QAAC,OAAO,KAAS,EAAE;YAChB,OAAO,CAAC,KAAK,CAAC,yCAAyC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YACtF,OAAO,CAAC,KAAK,CAAC,iDAAiD,MAAM,EAAE,CAAC,CAAC;YACzE,MAAM,KAAK,CAAC;SACf;IACN,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,YAAY,CAAC,GAAU;QAEnC,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;SACjC;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACJ;AA9OD,2CA8OC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -15,54 +6,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
6
|
const AWSSSM_1 = require("../aws/services/AWSSSM");
|
|
16
7
|
const SSMParameters_1 = require("../config/SSMParameters");
|
|
17
8
|
const hashids_1 = __importDefault(require("hashids"));
|
|
9
|
+
const config = AWSSSM_1.SSM.getSSM(SSMParameters_1.ssmParameter.idObfuscationSSM);
|
|
18
10
|
class idObfuscationService {
|
|
19
11
|
constructor() {
|
|
20
|
-
this.hashIds = new hashids_1.default();
|
|
21
|
-
(() =>
|
|
22
|
-
|
|
23
|
-
})
|
|
12
|
+
this.hashIds = new hashids_1.default(config.Salt, config.MinHashLength);
|
|
13
|
+
(async () => {
|
|
14
|
+
await this.getHashIds();
|
|
15
|
+
})();
|
|
24
16
|
}
|
|
25
|
-
getHashIds() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
});
|
|
17
|
+
async getHashIds() {
|
|
18
|
+
try {
|
|
19
|
+
this.config = await AWSSSM_1.SSM.getSSMParameter(SSMParameters_1.ssmParameter.idObfuscationSSM);
|
|
20
|
+
this.hashIds = await new hashids_1.default(this.config.Salt, +this.config.MinHashLength);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
36
26
|
}
|
|
37
27
|
/**
|
|
38
28
|
* This used to encode the id
|
|
39
29
|
* @param id pass id in string format only
|
|
40
30
|
* @returns this will return id is encoded format
|
|
41
31
|
*/
|
|
42
|
-
encode(id) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
});
|
|
32
|
+
async encode(id) {
|
|
33
|
+
try {
|
|
34
|
+
return await this.hashIds.encode(id);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
51
39
|
}
|
|
52
40
|
/**
|
|
53
41
|
* This is used to decode the id
|
|
54
42
|
* @param id pass encoded id is string format only
|
|
55
43
|
* @returns this will return the id in number
|
|
56
44
|
*/
|
|
57
|
-
decode(id) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
});
|
|
45
|
+
async decode(id) {
|
|
46
|
+
try {
|
|
47
|
+
return await this.hashIds.decode(id)[0];
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
66
52
|
}
|
|
67
53
|
}
|
|
68
54
|
let hashIds = new idObfuscationService();
|
|
@@ -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;AAC9B,MAAM,MAAM,GAAG,YAAG,CAAC,MAAM,CAAC,4BAAY,CAAC,gBAAgB,CAAC,CAAC;AAEzD,MAAM,oBAAoB;IAItB;QAHM,YAAO,GAAY,IAAI,iBAAO,CAAC,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