chatbot-nc 2.0.39 → 2.0.41

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
- let result = Object.keys(request).reduce((acc, key) => __awaiter(this, void 0, void 0, function* () {
115
- const hashedValue = request[key];
116
- if (properties.includes(key) && (typeof hashedValue === "string")) {
117
- acc[key] = yield this.hashids.decode(hashedValue);
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
- // const result: Record<string, any> = {};
168
- // Object.keys(response).forEach(async (key) => {
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
- acc[key] = yield this.hashids.encode("" + unHashedValue);
162
+ result[key] = yield this.hashids.encode("" + unHashedValue);
203
163
  }
204
164
  else {
205
- acc[key] = unHashedValue;
165
+ result[key] = unHashedValue;
206
166
  }
207
167
  }
208
- else
209
- acc[key] = yield this.unHash(unHashedValue, properties);
210
- return acc;
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,cAAo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AAoE;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"}
@@ -6,6 +6,7 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
8
  import hashids from "./hashing/idObfuscation";
9
+ import log from "./logger";
9
10
  import UrlService from "./shortner";
10
11
  import { Utils } from "./utils";
11
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
12
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids, log };
package/dist/cjs/index.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.hashids = exports.UrlService = exports.HashService = exports.BaseDynamoDBRepository = exports.WebHookEvent = exports.BaseCommunicationService = exports.Utils = exports.ENUM = exports.axios = exports.AWS = void 0;
29
+ exports.log = exports.hashids = exports.UrlService = exports.HashService = exports.BaseDynamoDBRepository = exports.WebHookEvent = exports.BaseCommunicationService = exports.Utils = exports.ENUM = exports.axios = exports.AWS = void 0;
30
30
  const aws_1 = require("./aws");
31
31
  Object.defineProperty(exports, "AWS", { enumerable: true, get: function () { return aws_1.AWS; } });
32
32
  const axios_1 = __importDefault(require("axios"));
@@ -43,6 +43,8 @@ const hashing_1 = require("./hashing");
43
43
  Object.defineProperty(exports, "HashService", { enumerable: true, get: function () { return hashing_1.HashService; } });
44
44
  const idObfuscation_1 = __importDefault(require("./hashing/idObfuscation"));
45
45
  exports.hashids = idObfuscation_1.default;
46
+ const logger_1 = __importDefault(require("./logger"));
47
+ exports.log = logger_1.default;
46
48
  const shortner_1 = __importDefault(require("./shortner"));
47
49
  exports.UrlService = shortner_1.default;
48
50
  const utils_1 = require("./utils");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAYzB,oFAZM,SAAG,OAYN;AAXN,kDAAyB;AAYtB,gBAZI,eAAK,CAYJ;AAXR,6CAA+B;AAY5B,oBAAI;AAXP,kEAA0C;AAcvC,uBAdI,sBAAY,CAcJ;AAbf,qEAA2D;AAcxD,iCAdI,kBAAsB,CAcJ;AAbzB,oEAAuD;AAWpD,mCAXI,uBAAwB,CAWJ;AAV3B,uCAAwC;AAarC,4FAbM,qBAAW,OAaN;AAZd,4EAA8C;AAc3C,kBAdI,uBAAO,CAcJ;AAbV,0DAAoC;AAYjC,qBAZI,kBAAU,CAYJ;AAXb,mCAAgC;AAM7B,sFANM,aAAK,OAMN"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAazB,oFAbM,SAAG,OAaN;AAZN,kDAAyB;AAatB,gBAbI,eAAK,CAaJ;AAZR,6CAA+B;AAa5B,oBAAI;AAZP,kEAA0C;AAevC,uBAfI,sBAAY,CAeJ;AAdf,qEAA2D;AAexD,iCAfI,kBAAsB,CAeJ;AAdzB,oEAAuD;AAYpD,mCAZI,uBAAwB,CAYJ;AAX3B,uCAAwC;AAcrC,4FAdM,qBAAW,OAcN;AAbd,4EAA8C;AAe3C,kBAfI,uBAAO,CAeJ;AAdV,sDAA2B;AAexB,cAfI,gBAAG,CAeJ;AAdN,0DAAoC;AAYjC,qBAZI,kBAAU,CAYJ;AAXb,mCAAgC;AAM7B,sFANM,aAAK,OAMN"}
@@ -0,0 +1,3 @@
1
+ import winston from "winston";
2
+ declare let log: winston.Logger;
3
+ export default log;
@@ -1,73 +1,80 @@
1
1
  "use strict";
2
- // import winston from "winston";
3
- // const config = require('./loggerTransports');
4
- // export default class Logger {
5
- // getLogger(module) {
6
- // const logType = process.env.LOG_TYPE || 'console';
7
- // const level = process.env.LOG_LEVEL || "info";
8
- // let logger;
9
- // console.log(logType);
10
- // switch (logType) {
11
- // case 'off':
12
- // console.log('Logging is off');
13
- // logger = winston.createLogger(config.offTransport());
14
- // logger.cli();
15
- // break;
16
- // case 'console':
17
- // console.log('***********Logging to console***********');
18
- // logger = winston.createLogger(config.consoleTransport());
19
- // logger.format = winston.format.combine(winston.format.colorize(), winston.format.simple())
20
- // break;
21
- // case 'aws':
22
- // console.log('***********Logging to aws****************');
23
- // logger = winston.createLogger(config.awsTransport(module));
24
- // break;
25
- // case 'file':
26
- // console.log('***********Logging to file****************');
27
- // logger = winston.createLogger(config.fileTransport());
28
- // break;
29
- // default:
30
- // console.log('***********Default chosen:Logging to console***********');
31
- // logger = (config.consoleTransport());
32
- // logger.cli();
33
- // break;
34
- // }
35
- // logger.level = level;
36
- // logger.format = this.getRequestLogFormatter();
37
- // // Call exceptions.handle with a transport to handle exceptions
38
- // // logger.exceptions.handle(
39
- // // new winston.transports.File({ filename: 'exceptions.log' })
40
- // // );
41
- // /* const DailyRotateFile = require('winston-daily-rotate-file');
42
- // logger.configure({
43
- // level: 'verbose',
44
- // transports: [
45
- // new DailyRotateFile(opts)
46
- // ]
47
- // });*/
48
- // logger.exitOnError = false; //winston will not exit after logging an uncaughtException
49
- // return logger;
50
- // }
51
- // getRequestLogFormatter() {
52
- // const { combine, timestamp, printf } = winston.format;
53
- // return combine(
54
- // timestamp({
55
- // format: 'YYYY-MM-DD HH:mm:ss'
56
- // }),
57
- // // [${info.label}] winston.format.label({ label: path.basename(process.mainModule.filename) }),
58
- // winston.format.printf(info => `${info.timestamp} ${info.level} : ${info.message}`)
59
- // );
60
- // }
61
- // logError(err, req, res, next) {
62
- // logger.error(err)
63
- // next();
64
- // }
65
- // logRequest(req, res, next, log) {
66
- // log.info('hello');
67
- // next();
68
- // }
69
- // getLog() {
70
- // return this.logger;
71
- // }
72
- // }
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const winston_1 = __importDefault(require("winston"));
16
+ const loggerTransports_1 = require("./loggerTransports");
17
+ class Logger {
18
+ constructor() {
19
+ this.logger = new winston_1.default.Logger((0, loggerTransports_1.consoleTransport)());
20
+ (() => __awaiter(this, void 0, void 0, function* () {
21
+ yield this.getLogger();
22
+ }))();
23
+ }
24
+ getLogger() {
25
+ const logType = process.env.LOG_TYPE || 'console';
26
+ const level = process.env.LOG_LEVEL || "info";
27
+ switch (logType) {
28
+ case 'off':
29
+ console.log('Logging is off');
30
+ this.logger = new winston_1.default.Logger((0, loggerTransports_1.offTransport)());
31
+ // this.logger = winston.createLogger(config.offTransport());
32
+ // this.logger.cli();
33
+ break;
34
+ case 'console':
35
+ console.log('***********Logging to console***********');
36
+ this.logger = new winston_1.default.Logger((0, loggerTransports_1.consoleTransport)());
37
+ this.logger.format = winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.simple());
38
+ break;
39
+ // case 'aws':
40
+ // console.log('***********Logging to aws****************');
41
+ // this.logger = winston.createLogger(awsTransport(module));
42
+ // break;
43
+ case 'file':
44
+ console.log('***********Logging to file****************');
45
+ this.logger = new winston_1.default.Logger((0, loggerTransports_1.fileTransport)());
46
+ break;
47
+ default:
48
+ console.log('***********Default chosen:Logging to console***********');
49
+ // this.logger = consoleTransport();
50
+ // this.logger.cli();
51
+ break;
52
+ }
53
+ this.logger.level = level;
54
+ this.logger.format = this.getRequestLogFormatter();
55
+ // Call exceptions.handle with a transport to handle exceptions
56
+ // this.logger.exceptions.handle(
57
+ // new winston.transports.File({ filename: 'exceptions.log' })
58
+ // );
59
+ /* const DailyRotateFile = require('winston-daily-rotate-file');
60
+ this.logger.configure({
61
+ level: 'verbose',
62
+ transports: [
63
+ new DailyRotateFile(opts)
64
+ ]
65
+ });*/
66
+ this.logger.exitOnError = false; //winston will not exit after logging an uncaughtException
67
+ return this.logger;
68
+ }
69
+ getRequestLogFormatter() {
70
+ const { combine, timestamp, printf } = winston_1.default.format;
71
+ return combine(timestamp({
72
+ format: 'YYYY-MM-DD HH:mm:ss'
73
+ }),
74
+ // [${info.label}] winston.format.label({ label: path.basename(process.mainModule.filename) }),
75
+ winston_1.default.format.printf(info => `${info.timestamp} ${info.level} : ${info.message}`));
76
+ }
77
+ }
78
+ let log = new Logger().getLogger();
79
+ exports.default = log;
73
80
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../logger/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,gDAAgD;AAEhD,gCAAgC;AAEhC,0BAA0B;AAC1B,6DAA6D;AAC7D,yDAAyD;AACzD,sBAAsB;AACtB,gCAAgC;AAChC,6BAA6B;AAC7B,0BAA0B;AAC1B,iDAAiD;AACjD,wEAAwE;AACxE,gCAAgC;AAChC,yBAAyB;AAEzB,8BAA8B;AAC9B,2EAA2E;AAC3E,4EAA4E;AAC5E,6GAA6G;AAC7G,yBAAyB;AAGzB,0BAA0B;AAC1B,4EAA4E;AAC5E,8EAA8E;AAC9E,yBAAyB;AAEzB,2BAA2B;AAC3B,6EAA6E;AAC7E,yEAAyE;AACzE,yBAAyB;AAEzB,uBAAuB;AACvB,0FAA0F;AAC1F,wDAAwD;AACxD,gCAAgC;AAChC,yBAAyB;AAEzB,YAAY;AACZ,gCAAgC;AAChC,yDAAyD;AACzD,0EAA0E;AAC1E,uCAAuC;AACvC,6EAA6E;AAC7E,gBAAgB;AAEhB,0EAA0E;AAC1E,6BAA6B;AAC7B,gCAAgC;AAChC,4BAA4B;AAC5B,yCAAyC;AACzC,gBAAgB;AAChB,gBAAgB;AAChB,iGAAiG;AACjG,yBAAyB;AACzB,QAAQ;AAER,iCAAiC;AACjC,iEAAiE;AAEjE,0BAA0B;AAC1B,0BAA0B;AAC1B,gDAAgD;AAChD,kBAAkB;AAClB,gHAAgH;AAChH,kGAAkG;AAElG,aAAa;AACb,QAAQ;AAER,sCAAsC;AACtC,4BAA4B;AAC5B,kBAAkB;AAClB,QAAQ;AAER,wCAAwC;AACxC,6BAA6B;AAC7B,kBAA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AC,GAAG,CAAC,4CAA4C,CAAC,CAAC;gBAC1D,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAO,CAAC,MAAM,CAAC,IAAA,gCAAa,GAAE,CAAC,CAAC;gBAClD,MAAM;YACV;gBACI,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;gBACvE,oCAAoC;gBACpC,qBAAqB;gBACrB,MAAM;SAEb;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACnD,+DAA+D;QAC/D,iCAAiC;QACjC,kEAAkE;QAClE,KAAK;QAEP;;;;;;eAMO;QACL,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC,0DAA0D;QAC3F,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEO,sBAAsB;QAC1B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,iBAAO,CAAC,MAAM,CAAC;QACtD,OAAO,OAAO,CACV,SAAS,CAAC;YACN,MAAM,EAAE,qBAAqB;SAChC,CAAC;QACF,iGAAiG;QACjG,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAEtF,CAAC;IACN,CAAC;CAeJ;AAED,IAAI,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC;AACnC,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,11 @@
1
+ import winston from "winston";
2
+ declare const offTransport: () => {
3
+ transports: never[];
4
+ };
5
+ declare const consoleTransport: () => {
6
+ transports: winston.transports.ConsoleTransportInstance[];
7
+ };
8
+ declare const fileTransport: () => {
9
+ transports: winston.transports.FileTransportInstance[];
10
+ };
11
+ export { offTransport, consoleTransport, fileTransport };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fileTransport = exports.consoleTransport = exports.offTransport = void 0;
7
+ const winston_1 = __importDefault(require("winston"));
8
+ // const awsEnv = (process.env.NODE_ENVIRONMENT || "dev");
9
+ // const awsRegion = (process.env.AWS_DEFAULT_REGION || "us-east-2");
10
+ // AWS.config.update({ region: awsRegion });
11
+ const offTransport = () => {
12
+ return {
13
+ transports: []
14
+ };
15
+ };
16
+ exports.offTransport = offTransport;
17
+ const consoleTransport = () => {
18
+ return {
19
+ transports: [
20
+ new (winston_1.default.transports.Console)({ level: 'info' })
21
+ /*,
22
+ new (winstonAwsCloudWatch)({
23
+ level: 'info',
24
+ timestamp: () => {
25
+ return new Date().toString()
26
+ },
27
+ json: true,
28
+ //logGroupName: 'apfTest', // REQUIRED
29
+ logGroupName: logGroup,//rachna
30
+ logStreamName: functionName,//rachna
31
+ // logStreamName: module, // REQUIRED
32
+ //logStreamName: 'invoicing', // REQUIRED
33
+
34
+ createLogGroup: true,
35
+ createLogStream: true,
36
+ awsRegion: awsRegion,
37
+ formatLog: function (item) {
38
+ return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
39
+ }
40
+ })*/
41
+ /* new (winston.transports.Console)({ level: 'info' ,format: winston.format.combine(
42
+ winston.format.timestamp(),
43
+ winston.format.colorize(),
44
+ winston.format.simple(),
45
+ winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
46
+ )}),*/
47
+ ]
48
+ };
49
+ };
50
+ exports.consoleTransport = consoleTransport;
51
+ // Replaces the previous transports with those in the
52
+ // new configuration wholesale.
53
+ //
54
+ // const DailyRotateFile = require('winston-daily-rotate-file');
55
+ // logger.configure({
56
+ // level: 'verbose',
57
+ // transports: [
58
+ // new DailyRotateFile(opts)
59
+ // ]
60
+ // });
61
+ const fileTransport = () => {
62
+ return {
63
+ transports: [
64
+ // - Write to all logs with level `info` and below to `combined.log`
65
+ // - Write all logs error (and below) to `error.log`.
66
+ new winston_1.default.transports.File({ filename: 'error.log', level: 'error' }),
67
+ new winston_1.default.transports.File({ filename: 'invoicing.log' }),
68
+ ]
69
+ };
70
+ };
71
+ exports.fileTransport = fileTransport;
72
+ //# sourceMappingURL=loggerTransports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loggerTransports.js","sourceRoot":"","sources":["../../../logger/loggerTransports.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,0DAA0D;AAC1D,qEAAqE;AACrE,4CAA4C;AAE5C,MAAM,YAAY,GAAG,GAAG,EAAE;IACtB,OAAO;QACH,UAAU,EAAE,EAAE;KACjB,CAAC;AACN,CAAC,CAAA;AA2GQ,oCAAY;AAzGrB,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC1B,OAAO;QACH,UAAU,EAAE;YACR,IAAI,CAAC,iBAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;YACnD;;;;;;;;;;;;;;;;;;;gBAmBI;YACP;;;;;mBAKO;SACP;KACJ,CAAC;AACN,CAAC,CAAA;AAyEsB,4CAAgB;AAvEvC,qDAAqD;AACrD,+BAA+B;AAC/B,EAAE;AACF,gEAAgE;AAChE,qBAAqB;AACrB,sBAAsB;AACtB,kBAAkB;AAClB,gCAAgC;AAChC,MAAM;AACN,MAAM;AAEN,MAAM,aAAa,GAAG,GAAG,EAAE;IACvB,OAAO;QACH,UAAU,EAAE;YAChB,qEAAqE;YACrE,qDAAqD;YACrD,IAAI,iBAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YACtE,IAAI,iBAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;SACrD;KACJ,CAAC;AACN,CAAC,CAAA;AAmDwC,sCAAa"}
@@ -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
- let result = Object.keys(request).reduce((acc, key) => __awaiter(this, void 0, void 0, function* () {
112
- const hashedValue = request[key];
113
- if (properties.includes(key) && (typeof hashedValue === "string")) {
114
- acc[key] = yield this.hashids.decode(hashedValue);
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
- // const result: Record<string, any> = {};
165
- // Object.keys(response).forEach(async (key) => {
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
- acc[key] = yield this.hashids.encode("" + unHashedValue);
159
+ result[key] = yield this.hashids.encode("" + unHashedValue);
200
160
  }
201
161
  else {
202
- acc[key] = unHashedValue;
162
+ result[key] = unHashedValue;
203
163
  }
204
164
  }
205
- else
206
- acc[key] = yield this.unHash(unHashedValue, properties);
207
- return acc;
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":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,OAAO,WAAW;IAGpB;IACA,CAAC;IAED;;;;OAIG;IACG,mBAAmB,CAAC,KAAa;;YACnC,OAAO,UAAU,CAAC,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;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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"}
@@ -6,6 +6,7 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
8
  import hashids from "./hashing/idObfuscation";
9
+ import log from "./logger";
9
10
  import UrlService from "./shortner";
10
11
  import { Utils } from "./utils";
11
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
12
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids, log };
package/dist/esm/index.js CHANGED
@@ -6,7 +6,8 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
8
  import hashids from "./hashing/idObfuscation";
9
+ import log from "./logger";
9
10
  import UrlService from "./shortner";
10
11
  import { Utils } from "./utils";
11
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
12
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids, log };
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,sBAAsB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,wBAAwB,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACJ,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,OAAO,EACT,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,sBAAsB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,wBAAwB,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACJ,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,OAAO,EACP,GAAG,EACL,CAAA"}
@@ -0,0 +1,3 @@
1
+ import winston from "winston";
2
+ declare let log: winston.Logger;
3
+ export default log;
@@ -1,73 +1,75 @@
1
- "use strict";
2
- // import winston from "winston";
3
- // const config = require('./loggerTransports');
4
- // export default class Logger {
5
- // getLogger(module) {
6
- // const logType = process.env.LOG_TYPE || 'console';
7
- // const level = process.env.LOG_LEVEL || "info";
8
- // let logger;
9
- // console.log(logType);
10
- // switch (logType) {
11
- // case 'off':
12
- // console.log('Logging is off');
13
- // logger = winston.createLogger(config.offTransport());
14
- // logger.cli();
15
- // break;
16
- // case 'console':
17
- // console.log('***********Logging to console***********');
18
- // logger = winston.createLogger(config.consoleTransport());
19
- // logger.format = winston.format.combine(winston.format.colorize(), winston.format.simple())
20
- // break;
21
- // case 'aws':
22
- // console.log('***********Logging to aws****************');
23
- // logger = winston.createLogger(config.awsTransport(module));
24
- // break;
25
- // case 'file':
26
- // console.log('***********Logging to file****************');
27
- // logger = winston.createLogger(config.fileTransport());
28
- // break;
29
- // default:
30
- // console.log('***********Default chosen:Logging to console***********');
31
- // logger = (config.consoleTransport());
32
- // logger.cli();
33
- // break;
34
- // }
35
- // logger.level = level;
36
- // logger.format = this.getRequestLogFormatter();
37
- // // Call exceptions.handle with a transport to handle exceptions
38
- // // logger.exceptions.handle(
39
- // // new winston.transports.File({ filename: 'exceptions.log' })
40
- // // );
41
- // /* const DailyRotateFile = require('winston-daily-rotate-file');
42
- // logger.configure({
43
- // level: 'verbose',
44
- // transports: [
45
- // new DailyRotateFile(opts)
46
- // ]
47
- // });*/
48
- // logger.exitOnError = false; //winston will not exit after logging an uncaughtException
49
- // return logger;
50
- // }
51
- // getRequestLogFormatter() {
52
- // const { combine, timestamp, printf } = winston.format;
53
- // return combine(
54
- // timestamp({
55
- // format: 'YYYY-MM-DD HH:mm:ss'
56
- // }),
57
- // // [${info.label}] winston.format.label({ label: path.basename(process.mainModule.filename) }),
58
- // winston.format.printf(info => `${info.timestamp} ${info.level} : ${info.message}`)
59
- // );
60
- // }
61
- // logError(err, req, res, next) {
62
- // logger.error(err)
63
- // next();
64
- // }
65
- // logRequest(req, res, next, log) {
66
- // log.info('hello');
67
- // next();
68
- // }
69
- // getLog() {
70
- // return this.logger;
71
- // }
72
- // }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import winston from "winston";
11
+ import { offTransport, fileTransport, consoleTransport } from "./loggerTransports";
12
+ class Logger {
13
+ constructor() {
14
+ this.logger = new winston.Logger(consoleTransport());
15
+ (() => __awaiter(this, void 0, void 0, function* () {
16
+ yield this.getLogger();
17
+ }))();
18
+ }
19
+ getLogger() {
20
+ const logType = process.env.LOG_TYPE || 'console';
21
+ const level = process.env.LOG_LEVEL || "info";
22
+ switch (logType) {
23
+ case 'off':
24
+ console.log('Logging is off');
25
+ this.logger = new winston.Logger(offTransport());
26
+ // this.logger = winston.createLogger(config.offTransport());
27
+ // this.logger.cli();
28
+ break;
29
+ case 'console':
30
+ console.log('***********Logging to console***********');
31
+ this.logger = new winston.Logger(consoleTransport());
32
+ this.logger.format = winston.format.combine(winston.format.colorize(), winston.format.simple());
33
+ break;
34
+ // case 'aws':
35
+ // console.log('***********Logging to aws****************');
36
+ // this.logger = winston.createLogger(awsTransport(module));
37
+ // break;
38
+ case 'file':
39
+ console.log('***********Logging to file****************');
40
+ this.logger = new winston.Logger(fileTransport());
41
+ break;
42
+ default:
43
+ console.log('***********Default chosen:Logging to console***********');
44
+ // this.logger = consoleTransport();
45
+ // this.logger.cli();
46
+ break;
47
+ }
48
+ this.logger.level = level;
49
+ this.logger.format = this.getRequestLogFormatter();
50
+ // Call exceptions.handle with a transport to handle exceptions
51
+ // this.logger.exceptions.handle(
52
+ // new winston.transports.File({ filename: 'exceptions.log' })
53
+ // );
54
+ /* const DailyRotateFile = require('winston-daily-rotate-file');
55
+ this.logger.configure({
56
+ level: 'verbose',
57
+ transports: [
58
+ new DailyRotateFile(opts)
59
+ ]
60
+ });*/
61
+ this.logger.exitOnError = false; //winston will not exit after logging an uncaughtException
62
+ return this.logger;
63
+ }
64
+ getRequestLogFormatter() {
65
+ const { combine, timestamp, printf } = winston.format;
66
+ return combine(timestamp({
67
+ format: 'YYYY-MM-DD HH:mm:ss'
68
+ }),
69
+ // [${info.label}] winston.format.label({ label: path.basename(process.mainModule.filename) }),
70
+ winston.format.printf(info => `${info.timestamp} ${info.level} : ${info.message}`));
71
+ }
72
+ }
73
+ let log = new Logger().getLogger();
74
+ export default log;
73
75
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../logger/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,gDAAgD;AAEhD,gCAAgC;AAEhC,0BAA0B;AAC1B,6DAA6D;AAC7D,yDAAyD;AACzD,sBAAsB;AACtB,gCAAgC;AAChC,6BAA6B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AAI,CAAC,sBAAsB,EAAE,CAAC;QACnD,+DAA+D;QAC/D,iCAAiC;QACjC,kEAAkE;QAClE,KAAK;QAEP;;;;;;eAMO;QACL,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC,0DAA0D;QAC3F,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEO,sBAAsB;QAC1B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;QACtD,OAAO,OAAO,CACV,SAAS,CAAC;YACN,MAAM,EAAE,qBAAqB;SAChC,CAAC;QACF,iGAAiG;QACjG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAEtF,CAAC;IACN,CAAC;CAeJ;AAED,IAAI,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC;AACnC,eAAe,GAAG,CAAC"}
@@ -0,0 +1,11 @@
1
+ import winston from "winston";
2
+ declare const offTransport: () => {
3
+ transports: never[];
4
+ };
5
+ declare const consoleTransport: () => {
6
+ transports: winston.transports.ConsoleTransportInstance[];
7
+ };
8
+ declare const fileTransport: () => {
9
+ transports: winston.transports.FileTransportInstance[];
10
+ };
11
+ export { offTransport, consoleTransport, fileTransport };
@@ -0,0 +1,105 @@
1
+ import winston from "winston";
2
+ // const awsEnv = (process.env.NODE_ENVIRONMENT || "dev");
3
+ // const awsRegion = (process.env.AWS_DEFAULT_REGION || "us-east-2");
4
+ // AWS.config.update({ region: awsRegion });
5
+ const offTransport = () => {
6
+ return {
7
+ transports: []
8
+ };
9
+ };
10
+ const consoleTransport = () => {
11
+ return {
12
+ transports: [
13
+ new (winston.transports.Console)({ level: 'info' })
14
+ /*,
15
+ new (winstonAwsCloudWatch)({
16
+ level: 'info',
17
+ timestamp: () => {
18
+ return new Date().toString()
19
+ },
20
+ json: true,
21
+ //logGroupName: 'apfTest', // REQUIRED
22
+ logGroupName: logGroup,//rachna
23
+ logStreamName: functionName,//rachna
24
+ // logStreamName: module, // REQUIRED
25
+ //logStreamName: 'invoicing', // REQUIRED
26
+
27
+ createLogGroup: true,
28
+ createLogStream: true,
29
+ awsRegion: awsRegion,
30
+ formatLog: function (item) {
31
+ return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
32
+ }
33
+ })*/
34
+ /* new (winston.transports.Console)({ level: 'info' ,format: winston.format.combine(
35
+ winston.format.timestamp(),
36
+ winston.format.colorize(),
37
+ winston.format.simple(),
38
+ winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
39
+ )}),*/
40
+ ]
41
+ };
42
+ };
43
+ // Replaces the previous transports with those in the
44
+ // new configuration wholesale.
45
+ //
46
+ // const DailyRotateFile = require('winston-daily-rotate-file');
47
+ // logger.configure({
48
+ // level: 'verbose',
49
+ // transports: [
50
+ // new DailyRotateFile(opts)
51
+ // ]
52
+ // });
53
+ const fileTransport = () => {
54
+ return {
55
+ transports: [
56
+ // - Write to all logs with level `info` and below to `combined.log`
57
+ // - Write all logs error (and below) to `error.log`.
58
+ new winston.transports.File({ filename: 'error.log', level: 'error' }),
59
+ new winston.transports.File({ filename: 'invoicing.log' }),
60
+ ]
61
+ };
62
+ };
63
+ // const awsTransport = (module) => {
64
+ // const awsConfig = {
65
+ // region: region
66
+ // }
67
+ // // const client = elasticsearch.Client({
68
+ // // hosts: hosts,
69
+ // // connectionClass: awses,
70
+ // // log: 'trace'
71
+ // // });
72
+ // //Configuring AWS Credentials once
73
+ // AWS.config.update({
74
+ // region: region
75
+ // });
76
+ // return {
77
+ // transports: [
78
+ // new (winstonAwsCloudWatch)({
79
+ // level: 'info',
80
+ // timestamp: () => {
81
+ // return new Date().toString()
82
+ // },
83
+ // json: true,
84
+ // logGroupName: 'AuroCXTest', // REQUIRED
85
+ // logStreamName: module, // REQUIRED
86
+ // //logStreamName: 'invoicing', // REQUIRED
87
+ // createLogGroup: true,
88
+ // createLogStream: true,
89
+ // awsRegion: awsRegion,
90
+ // formatLog: function (item:any) {
91
+ // return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
92
+ // }
93
+ // }),
94
+ // // new (WinstonElasticsearch)({
95
+ // // level: 'info',
96
+ // // client: client,
97
+ // // formatLog: function (item) {
98
+ // // return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
99
+ // // }
100
+ // // })
101
+ // ]
102
+ // };
103
+ // }
104
+ export { offTransport, consoleTransport, fileTransport };
105
+ //# sourceMappingURL=loggerTransports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loggerTransports.js","sourceRoot":"","sources":["../../../logger/loggerTransports.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,0DAA0D;AAC1D,qEAAqE;AACrE,4CAA4C;AAE5C,MAAM,YAAY,GAAG,GAAG,EAAE;IACtB,OAAO;QACH,UAAU,EAAE,EAAE;KACjB,CAAC;AACN,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC1B,OAAO;QACH,UAAU,EAAE;YACR,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;YACnD;;;;;;;;;;;;;;;;;;;gBAmBI;YACP;;;;;mBAKO;SACP;KACJ,CAAC;AACN,CAAC,CAAA;AAED,qDAAqD;AACrD,+BAA+B;AAC/B,EAAE;AACF,gEAAgE;AAChE,qBAAqB;AACrB,sBAAsB;AACtB,kBAAkB;AAClB,gCAAgC;AAChC,MAAM;AACN,MAAM;AAEN,MAAM,aAAa,GAAG,GAAG,EAAE;IACvB,OAAO;QACH,UAAU,EAAE;YAChB,qEAAqE;YACrE,qDAAqD;YACrD,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YACtE,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;SACrD;KACJ,CAAC;AACN,CAAC,CAAA;AAGD,qCAAqC;AACrC,0BAA0B;AAC1B,yBAAyB;AACzB,QAAQ;AAER,+CAA+C;AAC/C,2BAA2B;AAC3B,qCAAqC;AACrC,0BAA0B;AAC1B,aAAa;AAEb,yCAAyC;AACzC,0BAA0B;AAC1B,yBAAyB;AACzB,UAAU;AAEV,eAAe;AACf,wBAAwB;AACxB,2CAA2C;AAC3C,iCAAiC;AACjC,qCAAqC;AACrC,mDAAmD;AACnD,qBAAqB;AACrB,8BAA8B;AAC9B,0DAA0D;AAG1D,qDAAqD;AACrD,4DAA4D;AAE5D,wCAAwC;AACxC,yCAAyC;AACzC,wCAAwC;AACxC,mDAAmD;AACnD,gGAAgG;AAChG,oBAAoB;AACpB,kBAAkB;AAClB,8CAA8C;AAC9C,oCAAoC;AACpC,qCAAqC;AACrC,kDAAkD;AAClD,mGAAmG;AACnG,uBAAuB;AACvB,oBAAoB;AACpB,YAAY;AACZ,SAAS;AACT,IAAI;AAEJ,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatbot-nc",
3
- "version": "2.0.39",
3
+ "version": "2.0.41",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",