chatbot-nc 2.0.39 → 2.0.40
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.
|
@@ -111,35 +111,25 @@ class HashService {
|
|
|
111
111
|
deepUnHashedObject(request, properties) {
|
|
112
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
113
|
try {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
const result = {};
|
|
115
|
+
Object.keys(request).forEach((key) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
let requestKey = request[key];
|
|
117
|
+
// let timeZone = httpContext.get("TimeZone");
|
|
118
|
+
if (properties.includes(key) && (typeof requestKey === "string")) {
|
|
119
|
+
const hashedValue = requestKey;
|
|
120
|
+
result[key] = yield this.hashids.decode(hashedValue);
|
|
121
|
+
}
|
|
122
|
+
// else if (CoreUtils.isInputDateTime(requestKey)) {
|
|
123
|
+
// result[key] = CoreUtils.getUTCDate(requestKey, timeZone);
|
|
124
|
+
// } else if (CoreUtils.isInputDate(requestKey)) {
|
|
125
|
+
// let dateProperty = `${requestKey} 00:00:00`
|
|
126
|
+
// result[key] = CoreUtils.getUTCDate(dateProperty, timeZone);
|
|
127
|
+
// }
|
|
128
|
+
else {
|
|
129
|
+
// const value = requestKey;
|
|
130
|
+
result[key] = yield this.unHash(requestKey, properties);
|
|
118
131
|
}
|
|
119
|
-
else
|
|
120
|
-
acc[key] = yield this.unHash(hashedValue, properties);
|
|
121
|
-
return acc;
|
|
122
132
|
}), {});
|
|
123
|
-
yield Promise.all(result);
|
|
124
|
-
//const result: Record<string, any> = {};
|
|
125
|
-
// Object.keys(request).forEach(async (key) => {
|
|
126
|
-
// let requestKey = request[key]
|
|
127
|
-
// // let timeZone = httpContext.get("TimeZone");
|
|
128
|
-
// if (properties.includes(key) && (typeof requestKey === "string")) {
|
|
129
|
-
// const hashedValue = requestKey;
|
|
130
|
-
// result[key] = await this.hashids.decode(hashedValue);
|
|
131
|
-
// }
|
|
132
|
-
// // else if (CoreUtils.isInputDateTime(requestKey)) {
|
|
133
|
-
// // result[key] = CoreUtils.getUTCDate(requestKey, timeZone);
|
|
134
|
-
// // } else if (CoreUtils.isInputDate(requestKey)) {
|
|
135
|
-
// // let dateProperty = `${requestKey} 00:00:00`
|
|
136
|
-
// // result[key] = CoreUtils.getUTCDate(dateProperty, timeZone);
|
|
137
|
-
// // }
|
|
138
|
-
// else {
|
|
139
|
-
// // const value = requestKey;
|
|
140
|
-
// result[key] = await this.unHash(requestKey, properties);
|
|
141
|
-
// }
|
|
142
|
-
// }, {});
|
|
143
133
|
return result;
|
|
144
134
|
}
|
|
145
135
|
catch (error) {
|
|
@@ -164,54 +154,39 @@ class HashService {
|
|
|
164
154
|
deepHashedObject(response, properties, dateproperties) {
|
|
165
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
156
|
try {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// if (properties.includes(key)) {
|
|
170
|
-
// const unHashedValue = response[key];
|
|
171
|
-
// if (unHashedValue !== null && unHashedValue !== "" && unHashedValue != 0 && (typeof (unHashedValue) === 'number')) {
|
|
172
|
-
// result[key] = await this.hashids.encode("" + unHashedValue);
|
|
173
|
-
// } else {
|
|
174
|
-
// result[key] = unHashedValue;
|
|
175
|
-
// }
|
|
176
|
-
// } else {
|
|
177
|
-
// const value = response[key];
|
|
178
|
-
// // if (value instanceof Date && value != null) {
|
|
179
|
-
// // let timezone = 0;
|
|
180
|
-
// // if (httpContext.get("TimeZone")) {
|
|
181
|
-
// // timezone = parseInt(httpContext.get("TimeZone"))
|
|
182
|
-
// // }
|
|
183
|
-
// // let toMerchantTimeZone = TimeZoneConvertor.timeZoneConvert(timezone, moment(value).utc(true));
|
|
184
|
-
// // if (!toMerchantTimeZone) {
|
|
185
|
-
// // toMerchantTimeZone = moment(value).utc(true).format('MM-DD-YYYY HH:mm:ss')
|
|
186
|
-
// // }
|
|
187
|
-
// // if (dateproperties != undefined && Array.isArray(dateproperties) && dateproperties.includes(key)) {
|
|
188
|
-
// // toMerchantTimeZone = toMerchantTimeZone.substring(0, 10);
|
|
189
|
-
// // }
|
|
190
|
-
// // result[key] = toMerchantTimeZone;
|
|
191
|
-
// // } else
|
|
192
|
-
// result[key] = await this.hash(response[key], properties);
|
|
193
|
-
// // }
|
|
194
|
-
// }
|
|
195
|
-
// }, {});
|
|
196
|
-
// return result;
|
|
197
|
-
// // return camelcaseKeys(result);
|
|
198
|
-
let result = Object.keys(response).reduce((acc, key) => __awaiter(this, void 0, void 0, function* () {
|
|
199
|
-
const unHashedValue = response[key];
|
|
157
|
+
const result = {};
|
|
158
|
+
Object.keys(response).forEach((key) => __awaiter(this, void 0, void 0, function* () {
|
|
200
159
|
if (properties.includes(key)) {
|
|
160
|
+
const unHashedValue = response[key];
|
|
201
161
|
if (unHashedValue !== null && unHashedValue !== "" && unHashedValue != 0 && (typeof (unHashedValue) === 'number')) {
|
|
202
|
-
|
|
162
|
+
result[key] = yield this.hashids.encode("" + unHashedValue);
|
|
203
163
|
}
|
|
204
164
|
else {
|
|
205
|
-
|
|
165
|
+
result[key] = unHashedValue;
|
|
206
166
|
}
|
|
207
167
|
}
|
|
208
|
-
else
|
|
209
|
-
|
|
210
|
-
|
|
168
|
+
else {
|
|
169
|
+
const value = response[key];
|
|
170
|
+
// if (value instanceof Date && value != null) {
|
|
171
|
+
// let timezone = 0;
|
|
172
|
+
// if (httpContext.get("TimeZone")) {
|
|
173
|
+
// timezone = parseInt(httpContext.get("TimeZone"))
|
|
174
|
+
// }
|
|
175
|
+
// let toMerchantTimeZone = TimeZoneConvertor.timeZoneConvert(timezone, moment(value).utc(true));
|
|
176
|
+
// if (!toMerchantTimeZone) {
|
|
177
|
+
// toMerchantTimeZone = moment(value).utc(true).format('MM-DD-YYYY HH:mm:ss')
|
|
178
|
+
// }
|
|
179
|
+
// if (dateproperties != undefined && Array.isArray(dateproperties) && dateproperties.includes(key)) {
|
|
180
|
+
// toMerchantTimeZone = toMerchantTimeZone.substring(0, 10);
|
|
181
|
+
// }
|
|
182
|
+
// result[key] = toMerchantTimeZone;
|
|
183
|
+
// } else
|
|
184
|
+
result[key] = yield this.hash(response[key], properties);
|
|
185
|
+
// }
|
|
186
|
+
}
|
|
211
187
|
}), {});
|
|
212
|
-
yield Promise.all(result);
|
|
213
|
-
// return camelcaseKeys(result);
|
|
214
188
|
return result;
|
|
189
|
+
// return camelcaseKeys(result);
|
|
215
190
|
}
|
|
216
191
|
catch (error) {
|
|
217
192
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../hashing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAyC;AAEzC,MAAa,WAAW;IAGpB;IACA,CAAC;IAED;;;;OAIG;IACG,mBAAmB,CAAC,KAAa;;YACnC,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAAA,CAAC;QACxE,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,YAAY,CAAC,UAAe,EAAE,QAAa,EAAE,UAAe,EAAE,cAAoB;;YACpF,IAAI;gBACA,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;gBAC1B,IAAI,UAAU,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE;oBACpD,wCAAwC;oBACxC,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;iBAC5C;gBACD,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;gBACjE,OAAO,QAAQ,CAAC;aACnB;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM,KAAK,CAAC;aACf;QACL,CAAC;KAAA;IAED;;;;;;OAMG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G;wBAErG,iCAAiC;wBACjC,qFAAqF;wBACrF,QAAQ;wBAER,0GAA0G;wBAC1G,oEAAoE;wBACpE,QAAQ;wBAER,wCAAwC;wBACxC,SAAS;wBACT,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;wBACzD,IAAI;qBACP;gBACL,CAAC,CAAA,EAAE,EAAE,CAAC,CAAC;gBACP,OAAO,MAAM,CAAC;gBACd,gCAAgC;aAKnC;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM,KAAK,CAAC;aACf;QAEL,CAAC;KAAA;IAEa,eAAe,CAAC,UAAe,EAAE,UAAe,EAAE,cAAmB;;YAC/E,IAAI;gBACA,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAO,KAAU,EAAE,EAAE;oBACnD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;gBAC9D,CAAC,CAAA,CAAC,CAAC,CAAC;aACP;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM,KAAK,CAAC;aACf;QACL,CAAC;KAAA;CACJ;AAlMD,kCAkMC"}
|
|
@@ -108,35 +108,25 @@ export class HashService {
|
|
|
108
108
|
deepUnHashedObject(request, properties) {
|
|
109
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
110
|
try {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
const result = {};
|
|
112
|
+
Object.keys(request).forEach((key) => __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
let requestKey = request[key];
|
|
114
|
+
// let timeZone = httpContext.get("TimeZone");
|
|
115
|
+
if (properties.includes(key) && (typeof requestKey === "string")) {
|
|
116
|
+
const hashedValue = requestKey;
|
|
117
|
+
result[key] = yield this.hashids.decode(hashedValue);
|
|
118
|
+
}
|
|
119
|
+
// else if (CoreUtils.isInputDateTime(requestKey)) {
|
|
120
|
+
// result[key] = CoreUtils.getUTCDate(requestKey, timeZone);
|
|
121
|
+
// } else if (CoreUtils.isInputDate(requestKey)) {
|
|
122
|
+
// let dateProperty = `${requestKey} 00:00:00`
|
|
123
|
+
// result[key] = CoreUtils.getUTCDate(dateProperty, timeZone);
|
|
124
|
+
// }
|
|
125
|
+
else {
|
|
126
|
+
// const value = requestKey;
|
|
127
|
+
result[key] = yield this.unHash(requestKey, properties);
|
|
115
128
|
}
|
|
116
|
-
else
|
|
117
|
-
acc[key] = yield this.unHash(hashedValue, properties);
|
|
118
|
-
return acc;
|
|
119
129
|
}), {});
|
|
120
|
-
yield Promise.all(result);
|
|
121
|
-
//const result: Record<string, any> = {};
|
|
122
|
-
// Object.keys(request).forEach(async (key) => {
|
|
123
|
-
// let requestKey = request[key]
|
|
124
|
-
// // let timeZone = httpContext.get("TimeZone");
|
|
125
|
-
// if (properties.includes(key) && (typeof requestKey === "string")) {
|
|
126
|
-
// const hashedValue = requestKey;
|
|
127
|
-
// result[key] = await this.hashids.decode(hashedValue);
|
|
128
|
-
// }
|
|
129
|
-
// // else if (CoreUtils.isInputDateTime(requestKey)) {
|
|
130
|
-
// // result[key] = CoreUtils.getUTCDate(requestKey, timeZone);
|
|
131
|
-
// // } else if (CoreUtils.isInputDate(requestKey)) {
|
|
132
|
-
// // let dateProperty = `${requestKey} 00:00:00`
|
|
133
|
-
// // result[key] = CoreUtils.getUTCDate(dateProperty, timeZone);
|
|
134
|
-
// // }
|
|
135
|
-
// else {
|
|
136
|
-
// // const value = requestKey;
|
|
137
|
-
// result[key] = await this.unHash(requestKey, properties);
|
|
138
|
-
// }
|
|
139
|
-
// }, {});
|
|
140
130
|
return result;
|
|
141
131
|
}
|
|
142
132
|
catch (error) {
|
|
@@ -161,54 +151,39 @@ export class HashService {
|
|
|
161
151
|
deepHashedObject(response, properties, dateproperties) {
|
|
162
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
163
153
|
try {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
// if (properties.includes(key)) {
|
|
167
|
-
// const unHashedValue = response[key];
|
|
168
|
-
// if (unHashedValue !== null && unHashedValue !== "" && unHashedValue != 0 && (typeof (unHashedValue) === 'number')) {
|
|
169
|
-
// result[key] = await this.hashids.encode("" + unHashedValue);
|
|
170
|
-
// } else {
|
|
171
|
-
// result[key] = unHashedValue;
|
|
172
|
-
// }
|
|
173
|
-
// } else {
|
|
174
|
-
// const value = response[key];
|
|
175
|
-
// // if (value instanceof Date && value != null) {
|
|
176
|
-
// // let timezone = 0;
|
|
177
|
-
// // if (httpContext.get("TimeZone")) {
|
|
178
|
-
// // timezone = parseInt(httpContext.get("TimeZone"))
|
|
179
|
-
// // }
|
|
180
|
-
// // let toMerchantTimeZone = TimeZoneConvertor.timeZoneConvert(timezone, moment(value).utc(true));
|
|
181
|
-
// // if (!toMerchantTimeZone) {
|
|
182
|
-
// // toMerchantTimeZone = moment(value).utc(true).format('MM-DD-YYYY HH:mm:ss')
|
|
183
|
-
// // }
|
|
184
|
-
// // if (dateproperties != undefined && Array.isArray(dateproperties) && dateproperties.includes(key)) {
|
|
185
|
-
// // toMerchantTimeZone = toMerchantTimeZone.substring(0, 10);
|
|
186
|
-
// // }
|
|
187
|
-
// // result[key] = toMerchantTimeZone;
|
|
188
|
-
// // } else
|
|
189
|
-
// result[key] = await this.hash(response[key], properties);
|
|
190
|
-
// // }
|
|
191
|
-
// }
|
|
192
|
-
// }, {});
|
|
193
|
-
// return result;
|
|
194
|
-
// // return camelcaseKeys(result);
|
|
195
|
-
let result = Object.keys(response).reduce((acc, key) => __awaiter(this, void 0, void 0, function* () {
|
|
196
|
-
const unHashedValue = response[key];
|
|
154
|
+
const result = {};
|
|
155
|
+
Object.keys(response).forEach((key) => __awaiter(this, void 0, void 0, function* () {
|
|
197
156
|
if (properties.includes(key)) {
|
|
157
|
+
const unHashedValue = response[key];
|
|
198
158
|
if (unHashedValue !== null && unHashedValue !== "" && unHashedValue != 0 && (typeof (unHashedValue) === 'number')) {
|
|
199
|
-
|
|
159
|
+
result[key] = yield this.hashids.encode("" + unHashedValue);
|
|
200
160
|
}
|
|
201
161
|
else {
|
|
202
|
-
|
|
162
|
+
result[key] = unHashedValue;
|
|
203
163
|
}
|
|
204
164
|
}
|
|
205
|
-
else
|
|
206
|
-
|
|
207
|
-
|
|
165
|
+
else {
|
|
166
|
+
const value = response[key];
|
|
167
|
+
// if (value instanceof Date && value != null) {
|
|
168
|
+
// let timezone = 0;
|
|
169
|
+
// if (httpContext.get("TimeZone")) {
|
|
170
|
+
// timezone = parseInt(httpContext.get("TimeZone"))
|
|
171
|
+
// }
|
|
172
|
+
// let toMerchantTimeZone = TimeZoneConvertor.timeZoneConvert(timezone, moment(value).utc(true));
|
|
173
|
+
// if (!toMerchantTimeZone) {
|
|
174
|
+
// toMerchantTimeZone = moment(value).utc(true).format('MM-DD-YYYY HH:mm:ss')
|
|
175
|
+
// }
|
|
176
|
+
// if (dateproperties != undefined && Array.isArray(dateproperties) && dateproperties.includes(key)) {
|
|
177
|
+
// toMerchantTimeZone = toMerchantTimeZone.substring(0, 10);
|
|
178
|
+
// }
|
|
179
|
+
// result[key] = toMerchantTimeZone;
|
|
180
|
+
// } else
|
|
181
|
+
result[key] = yield this.hash(response[key], properties);
|
|
182
|
+
// }
|
|
183
|
+
}
|
|
208
184
|
}), {});
|
|
209
|
-
yield Promise.all(result);
|
|
210
|
-
// return camelcaseKeys(result);
|
|
211
185
|
return result;
|
|
186
|
+
// return camelcaseKeys(result);
|
|
212
187
|
}
|
|
213
188
|
catch (error) {
|
|
214
189
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../hashing/index.ts"],"names":[],"mappings":";;;;;;;;;AA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