@optimiser/common 1.0.365 → 1.0.367

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.
Files changed (69) hide show
  1. package/dist/aws/awsservices.d.ts +39 -39
  2. package/dist/aws/awsservices.js +398 -398
  3. package/dist/constants.d.ts +35 -35
  4. package/dist/constants.js +36 -36
  5. package/dist/enums/databasetype.enum.d.ts +7 -7
  6. package/dist/enums/databasetype.enum.js +11 -11
  7. package/dist/enums/log.enum.d.ts +22 -22
  8. package/dist/enums/log.enum.js +26 -26
  9. package/dist/index.d.ts +25 -25
  10. package/dist/index.js +69 -61
  11. package/dist/lib/activity.d.ts +1 -1
  12. package/dist/lib/activity.js +44 -44
  13. package/dist/lib/calculatedbsize.d.ts +15 -15
  14. package/dist/lib/calculatedbsize.js +75 -75
  15. package/dist/lib/connection.d.ts +116 -116
  16. package/dist/lib/connection.js +595 -595
  17. package/dist/lib/convertfilesize.d.ts +2 -2
  18. package/dist/lib/convertfilesize.js +15 -15
  19. package/dist/lib/countrycode.d.ts +2 -2
  20. package/dist/lib/countrycode.js +255 -255
  21. package/dist/lib/event.d.ts +26 -26
  22. package/dist/lib/event.js +252 -248
  23. package/dist/lib/helper.d.ts +94 -93
  24. package/dist/lib/helper.js +1016 -1009
  25. package/dist/lib/memoryserverclient.d.ts +40 -40
  26. package/dist/lib/memoryserverclient.js +256 -252
  27. package/dist/lib/operautilitycommon.d.ts +65 -65
  28. package/dist/lib/operautilitycommon.js +620 -620
  29. package/dist/lib/redis.d.ts +21 -21
  30. package/dist/lib/redis.js +46 -46
  31. package/dist/lib/socketidfromredis.d.ts +3 -3
  32. package/dist/lib/socketidfromredis.js +5 -5
  33. package/dist/lib/taskutils.d.ts +40 -40
  34. package/dist/lib/taskutils.js +656 -656
  35. package/dist/lib/utility.d.ts +300 -298
  36. package/dist/lib/utility.js +5626 -5621
  37. package/dist/lib/validateRequest.d.ts +3 -3
  38. package/dist/lib/validateRequest.js +13 -13
  39. package/dist/logs/auditlog.d.ts +25 -25
  40. package/dist/logs/auditlog.js +1033 -1029
  41. package/dist/logs/checklogtable.d.ts +3 -3
  42. package/dist/logs/checklogtable.js +67 -67
  43. package/dist/logs/log.table.d.ts +7 -7
  44. package/dist/logs/log.table.js +127 -127
  45. package/dist/modals/connection.modal.d.ts +32 -32
  46. package/dist/modals/connection.modal.js +2 -2
  47. package/dist/modals/globalNotification.modal.d.ts +8 -8
  48. package/dist/modals/globalNotification.modal.js +2 -2
  49. package/dist/modals/log.modal.d.ts +64 -64
  50. package/dist/modals/log.modal.js +2 -2
  51. package/dist/modals/mail.modal.d.ts +6 -6
  52. package/dist/modals/mail.modal.js +2 -2
  53. package/dist/modals/notificationData.modal.d.ts +29 -29
  54. package/dist/modals/notificationData.modal.js +2 -2
  55. package/dist/modals/redisconfig.modal.d.ts +6 -6
  56. package/dist/modals/redisconfig.modal.js +2 -2
  57. package/dist/modals/sqsconfig.modal.d.ts +8 -8
  58. package/dist/modals/sqsconfig.modal.js +2 -2
  59. package/dist/modals/utility.modal.d.ts +17 -17
  60. package/dist/modals/utility.modal.js +2 -2
  61. package/dist/utility/crypto.d.ts +4 -4
  62. package/dist/utility/crypto.js +43 -43
  63. package/dist/utility/errorHandler.d.ts +30 -30
  64. package/dist/utility/errorHandler.js +24 -24
  65. package/dist/utility/errorHandlerForServices.d.ts +22 -22
  66. package/dist/utility/errorHandlerForServices.js +19 -19
  67. package/dist/utility/mail.d.ts +21 -21
  68. package/dist/utility/mail.js +91 -87
  69. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
- interface MailConfig {
2
- SES_ACCESS_ID: string;
3
- SES_SECRET_KEY: string;
4
- SES_REGION: string;
5
- }
6
- export { MailConfig };
1
+ interface MailConfig {
2
+ SES_ACCESS_ID: string;
3
+ SES_SECRET_KEY: string;
4
+ SES_REGION: string;
5
+ }
6
+ export { MailConfig };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,29 +1,29 @@
1
- export interface MailData {
2
- from: {
3
- name: string;
4
- address: string;
5
- };
6
- to: string;
7
- subject: string;
8
- html: string;
9
- }
10
- export interface PushNotificationData {
11
- title: string;
12
- message: string;
13
- attr: string;
14
- endpoint?: string;
15
- keys?: {
16
- p256dh: string;
17
- auth: string;
18
- };
19
- }
20
- export interface SocketData {
21
- eventType: string;
22
- data: string;
23
- userId?: string;
24
- }
25
- export interface NotificationData {
26
- EmailObj?: MailData;
27
- PushNotificationObj?: PushNotificationData;
28
- SocketObj?: SocketData;
29
- }
1
+ export interface MailData {
2
+ from: {
3
+ name: string;
4
+ address: string;
5
+ };
6
+ to: string;
7
+ subject: string;
8
+ html: string;
9
+ }
10
+ export interface PushNotificationData {
11
+ title: string;
12
+ message: string;
13
+ attr: string;
14
+ endpoint?: string;
15
+ keys?: {
16
+ p256dh: string;
17
+ auth: string;
18
+ };
19
+ }
20
+ export interface SocketData {
21
+ eventType: string;
22
+ data: string;
23
+ userId?: string;
24
+ }
25
+ export interface NotificationData {
26
+ EmailObj?: MailData;
27
+ PushNotificationObj?: PushNotificationData;
28
+ SocketObj?: SocketData;
29
+ }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
- interface RedisConfig {
2
- REDIS_URL: string;
3
- REDIS_PORT: number;
4
- REDIS_PASS?: string;
5
- }
6
- export default RedisConfig;
1
+ interface RedisConfig {
2
+ REDIS_URL: string;
3
+ REDIS_PORT: number;
4
+ REDIS_PASS?: string;
5
+ }
6
+ export default RedisConfig;
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,8 @@
1
- export interface SQSConfig {
2
- QUEUE_URL: string;
3
- SQS_API_VERSION: string;
4
- SQS_REGION: string;
5
- SQS_ACCESSKEY_ID: string;
6
- SQS_SECRET_KEY: string;
7
- FCM_NOTIFICATION_SERVICE_ACCOUNT_KEY: string;
8
- }
1
+ export interface SQSConfig {
2
+ QUEUE_URL: string;
3
+ SQS_API_VERSION: string;
4
+ SQS_REGION: string;
5
+ SQS_ACCESSKEY_ID: string;
6
+ SQS_SECRET_KEY: string;
7
+ FCM_NOTIFICATION_SERVICE_ACCOUNT_KEY: string;
8
+ }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +1,17 @@
1
- import { ObjectId } from "mongodb";
2
- interface AnyObjectInterface {
3
- [key: string]: any;
4
- }
5
- interface callBackInterface {
6
- (name: any): void;
7
- }
8
- interface GetEncryptedURLOptions {
9
- recordIds: ObjectId[];
10
- companyId: string;
11
- secretKey: string;
12
- prefixUrl: string;
13
- apiUrl: string;
14
- fieldName: string;
15
- filterKey: string;
16
- }
17
- export { AnyObjectInterface, callBackInterface, GetEncryptedURLOptions };
1
+ import { ObjectId } from "mongodb";
2
+ interface AnyObjectInterface {
3
+ [key: string]: any;
4
+ }
5
+ interface callBackInterface {
6
+ (name: any): void;
7
+ }
8
+ interface GetEncryptedURLOptions {
9
+ recordIds: ObjectId[];
10
+ companyId: string;
11
+ secretKey: string;
12
+ prefixUrl: string;
13
+ apiUrl: string;
14
+ fieldName: string;
15
+ filterKey: string;
16
+ }
17
+ export { AnyObjectInterface, callBackInterface, GetEncryptedURLOptions };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { AnyObjectInterface } from "../modals/utility.modal";
2
- declare function encrypt(encryptionKey: string, text: string): AnyObjectInterface;
3
- declare function decrypt(encryptionKey: string, text: string): AnyObjectInterface;
4
- export { encrypt, decrypt };
1
+ import { AnyObjectInterface } from "../modals/utility.modal";
2
+ declare function encrypt(encryptionKey: string, text: string): AnyObjectInterface;
3
+ declare function decrypt(encryptionKey: string, text: string): AnyObjectInterface;
4
+ export { encrypt, decrypt };
@@ -1,43 +1,43 @@
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.decrypt = exports.encrypt = void 0;
7
- var crypto_1 = __importDefault(require("crypto"));
8
- //let ENCRYPTION_KEY = ""; //("5cb56228c917d540baa455b25cb56228").toString('binary'); // Must be 256 bits (32 characters)
9
- var IV_LENGTH = 16; // For AES, this is always 16
10
- function encrypt(encryptionKey, text) {
11
- var result = { "status": "failed", cipherText: null };
12
- try {
13
- var iv = crypto_1.default.randomBytes(IV_LENGTH);
14
- var cipher = crypto_1.default.createCipheriv('aes-256-cbc', Buffer.from(encryptionKey.toString()), iv);
15
- var encrypted = cipher.update(text);
16
- encrypted = Buffer.concat([encrypted, cipher.final()]);
17
- result.status = "success";
18
- result.cipherText = iv.toString('hex') + ':' + encrypted.toString('hex');
19
- }
20
- catch (ex) {
21
- result.error = ex;
22
- }
23
- return result;
24
- }
25
- exports.encrypt = encrypt;
26
- function decrypt(encryptionKey, text) {
27
- var result = { "status": "failed", plainText: null };
28
- try {
29
- var textParts = text.split(':');
30
- var iv = Buffer.from(textParts.shift(), 'hex');
31
- var encryptedText = Buffer.from(textParts.join(':'), 'hex');
32
- var decipher = crypto_1.default.createDecipheriv('aes-256-cbc', Buffer.from(encryptionKey.toString()), iv);
33
- var decrypted = decipher.update(encryptedText);
34
- decrypted = Buffer.concat([decrypted, decipher.final()]);
35
- result.status = "success";
36
- result.plainText = decrypted.toString();
37
- }
38
- catch (ex) {
39
- result.error = ex;
40
- }
41
- return result;
42
- }
43
- exports.decrypt = decrypt;
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.decrypt = exports.encrypt = void 0;
7
+ var crypto_1 = __importDefault(require("crypto"));
8
+ //let ENCRYPTION_KEY = ""; //("5cb56228c917d540baa455b25cb56228").toString('binary'); // Must be 256 bits (32 characters)
9
+ var IV_LENGTH = 16; // For AES, this is always 16
10
+ function encrypt(encryptionKey, text) {
11
+ var result = { "status": "failed", cipherText: null };
12
+ try {
13
+ var iv = crypto_1.default.randomBytes(IV_LENGTH);
14
+ var cipher = crypto_1.default.createCipheriv('aes-256-cbc', Buffer.from(encryptionKey.toString()), iv);
15
+ var encrypted = cipher.update(text);
16
+ encrypted = Buffer.concat([encrypted, cipher.final()]);
17
+ result.status = "success";
18
+ result.cipherText = iv.toString('hex') + ':' + encrypted.toString('hex');
19
+ }
20
+ catch (ex) {
21
+ result.error = ex;
22
+ }
23
+ return result;
24
+ }
25
+ exports.encrypt = encrypt;
26
+ function decrypt(encryptionKey, text) {
27
+ var result = { "status": "failed", plainText: null };
28
+ try {
29
+ var textParts = text.split(':');
30
+ var iv = Buffer.from(textParts.shift(), 'hex');
31
+ var encryptedText = Buffer.from(textParts.join(':'), 'hex');
32
+ var decipher = crypto_1.default.createDecipheriv('aes-256-cbc', Buffer.from(encryptionKey.toString()), iv);
33
+ var decrypted = decipher.update(encryptedText);
34
+ decrypted = Buffer.concat([decrypted, decipher.final()]);
35
+ result.status = "success";
36
+ result.plainText = decrypted.toString();
37
+ }
38
+ catch (ex) {
39
+ result.error = ex;
40
+ }
41
+ return result;
42
+ }
43
+ exports.decrypt = decrypt;
@@ -1,30 +1,30 @@
1
- /// <reference types="qs" />
2
- /// <reference types="node" />
3
- import { OPT_Request } from "../modals/connection.modal";
4
- declare function ErrorFormatter(err: Error, req: OPT_Request, config: {
5
- ErrorReportFrom: string;
6
- ErrorReportTo: string;
7
- }): {
8
- mailObj: {
9
- from: {
10
- name: string;
11
- address: string;
12
- };
13
- to: string;
14
- subject: string;
15
- html: string;
16
- };
17
- errorObj: {
18
- ErrorName: string;
19
- ErrorMessage: string;
20
- ErrorStack: string | undefined;
21
- ErrorTime: Date;
22
- ReqCookies: any;
23
- ReqBody: string;
24
- ReqParams: import("express-serve-static-core").ParamsDictionary;
25
- ReqQuery: import("qs").ParsedQs;
26
- ReqHeaders: import("http").IncomingHttpHeaders;
27
- ReqUrl: string;
28
- };
29
- };
30
- export default ErrorFormatter;
1
+ /// <reference types="qs" />
2
+ /// <reference types="node" />
3
+ import { OPT_Request } from "../modals/connection.modal";
4
+ declare function ErrorFormatter(err: Error, req: OPT_Request, config: {
5
+ ErrorReportFrom: string;
6
+ ErrorReportTo: string;
7
+ }): {
8
+ mailObj: {
9
+ from: {
10
+ name: string;
11
+ address: string;
12
+ };
13
+ to: string;
14
+ subject: string;
15
+ html: string;
16
+ };
17
+ errorObj: {
18
+ ErrorName: string;
19
+ ErrorMessage: string;
20
+ ErrorStack: string | undefined;
21
+ ErrorTime: Date;
22
+ ReqCookies: any;
23
+ ReqBody: string;
24
+ ReqParams: import("express-serve-static-core").ParamsDictionary;
25
+ ReqQuery: import("qs").ParsedQs;
26
+ ReqHeaders: import("http").IncomingHttpHeaders;
27
+ ReqUrl: string;
28
+ };
29
+ };
30
+ export default ErrorFormatter;
@@ -1,24 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function ErrorFormatter(err, req, config) {
4
- var errorObj = {
5
- 'ErrorName': err.name,
6
- 'ErrorMessage': err.message,
7
- 'ErrorStack': err.stack,
8
- 'ErrorTime': new Date(),
9
- 'ReqCookies': req.cookies,
10
- 'ReqBody': JSON.stringify(req.body),
11
- 'ReqParams': req.params,
12
- 'ReqQuery': req.query,
13
- 'ReqHeaders': req.headers,
14
- 'ReqUrl': req.protocol + '://' + req.get('host') + req.originalUrl
15
- };
16
- var mailObj = {
17
- from: { name: 'optimiser', address: config.ErrorReportFrom },
18
- to: config.ErrorReportTo,
19
- subject: 'Error Reporting',
20
- html: "\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <title>Error</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\n </head>\n <body style=\"margin: 0; padding: 0;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\t\n <tr>\n <td style=\"padding: 10px 0 30px 0;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\" style=\"border: 1px solid #cccccc; border-collapse: collapse;\">\n <tr>\n <td align=\"center\" bgcolor=\"#70bbd9\" style=\"padding: 40px 0 30px 0; color: #153643; font-size: 18px; font-weight: bold; font-family: Arial, sans-serif;\">\n There is an error in OPTIMISER. Please inform the developers \n </td>\n </tr>\n <tr>\n <td bgcolor=\"#ffffff\" style=\"padding: 40px 30px 40px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n \n <tr>\n <td style=\"padding: 20px 0 30px 0; color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;\">\n <pre> " + JSON.stringify(errorObj, null, 2) + " </pre>\n </td>\n </tr>\n \n </table>\n </td>\n </tr>\n <tr>\n <td bgcolor=\"#007EE3\" style=\"padding: 30px 30px 30px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n <tr>\n \n <td align=\"right\" width=\"25%\">\n <strong>TEAM OPTIMISER</string>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </body>\n </html>\n "
21
- };
22
- return { mailObj: mailObj, errorObj: errorObj };
23
- }
24
- exports.default = ErrorFormatter;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function ErrorFormatter(err, req, config) {
4
+ var errorObj = {
5
+ 'ErrorName': err.name,
6
+ 'ErrorMessage': err.message,
7
+ 'ErrorStack': err.stack,
8
+ 'ErrorTime': new Date(),
9
+ 'ReqCookies': req.cookies,
10
+ 'ReqBody': JSON.stringify(req.body),
11
+ 'ReqParams': req.params,
12
+ 'ReqQuery': req.query,
13
+ 'ReqHeaders': req.headers,
14
+ 'ReqUrl': req.protocol + '://' + req.get('host') + req.originalUrl
15
+ };
16
+ var mailObj = {
17
+ from: { name: 'optimiser', address: config.ErrorReportFrom },
18
+ to: config.ErrorReportTo,
19
+ subject: 'Error Reporting',
20
+ html: "\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <title>Error</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\n </head>\n <body style=\"margin: 0; padding: 0;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\t\n <tr>\n <td style=\"padding: 10px 0 30px 0;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\" style=\"border: 1px solid #cccccc; border-collapse: collapse;\">\n <tr>\n <td align=\"center\" bgcolor=\"#70bbd9\" style=\"padding: 40px 0 30px 0; color: #153643; font-size: 18px; font-weight: bold; font-family: Arial, sans-serif;\">\n There is an error in OPTIMISER. Please inform the developers \n </td>\n </tr>\n <tr>\n <td bgcolor=\"#ffffff\" style=\"padding: 40px 30px 40px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n \n <tr>\n <td style=\"padding: 20px 0 30px 0; color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;\">\n <pre> ".concat(JSON.stringify(errorObj, null, 2), " </pre>\n </td>\n </tr>\n \n </table>\n </td>\n </tr>\n <tr>\n <td bgcolor=\"#007EE3\" style=\"padding: 30px 30px 30px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n <tr>\n \n <td align=\"right\" width=\"25%\">\n <strong>TEAM OPTIMISER</string>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </body>\n </html>\n ")
21
+ };
22
+ return { mailObj: mailObj, errorObj: errorObj };
23
+ }
24
+ exports.default = ErrorFormatter;
@@ -1,22 +1,22 @@
1
- declare function ErrorFormatterForServices(err: Error, config: {
2
- ErrorReportFrom: string;
3
- ErrorReportTo: string;
4
- }, errorOrigin: string): {
5
- mailObj: {
6
- from: {
7
- name: string;
8
- address: string;
9
- };
10
- to: string;
11
- subject: string;
12
- html: string;
13
- };
14
- errorObj: {
15
- ErrorName: string;
16
- ErrorMessage: string;
17
- ErrorStack: string | undefined;
18
- ErrorTime: Date;
19
- ErrorOrigin: string;
20
- };
21
- };
22
- export default ErrorFormatterForServices;
1
+ declare function ErrorFormatterForServices(err: Error, config: {
2
+ ErrorReportFrom: string;
3
+ ErrorReportTo: string;
4
+ }, errorOrigin: string): {
5
+ mailObj: {
6
+ from: {
7
+ name: string;
8
+ address: string;
9
+ };
10
+ to: string;
11
+ subject: string;
12
+ html: string;
13
+ };
14
+ errorObj: {
15
+ ErrorName: string;
16
+ ErrorMessage: string;
17
+ ErrorStack: string | undefined;
18
+ ErrorTime: Date;
19
+ ErrorOrigin: string;
20
+ };
21
+ };
22
+ export default ErrorFormatterForServices;
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function ErrorFormatterForServices(err, config, errorOrigin) {
4
- var errorObj = {
5
- ErrorName: err.name,
6
- ErrorMessage: err.message,
7
- ErrorStack: err.stack,
8
- ErrorTime: new Date(),
9
- ErrorOrigin: errorOrigin
10
- };
11
- var mailObj = {
12
- from: { name: 'optimiser', address: config.ErrorReportFrom },
13
- to: config.ErrorReportTo,
14
- subject: 'Error Reporting',
15
- html: "\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <title>Error</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\n </head>\n <body style=\"margin: 0; padding: 0;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\t\n <tr>\n <td style=\"padding: 10px 0 30px 0;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\" style=\"border: 1px solid #cccccc; border-collapse: collapse;\">\n <tr>\n <td align=\"center\" bgcolor=\"#70bbd9\" style=\"padding: 40px 0 30px 0; color: #153643; font-size: 18px; font-weight: bold; font-family: Arial, sans-serif;\">\n There is an error in OPTIMISER - " + errorObj.ErrorOrigin + ". Please inform the developers \n </td>\n </tr>\n <tr>\n <td bgcolor=\"#ffffff\" style=\"padding: 40px 30px 40px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n \n <tr>\n <td style=\"padding: 20px 0 30px 0; color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;\">\n <pre> " + JSON.stringify(errorObj, null, 2) + " </pre>\n </td>\n </tr>\n \n </table>\n </td>\n </tr>\n <tr>\n <td bgcolor=\"#007EE3\" style=\"padding: 30px 30px 30px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n <tr>\n \n <td align=\"right\" width=\"25%\">\n <strong>TEAM OPTIMISER</string>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </body>\n </html>\n "
16
- };
17
- return { mailObj: mailObj, errorObj: errorObj };
18
- }
19
- exports.default = ErrorFormatterForServices;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function ErrorFormatterForServices(err, config, errorOrigin) {
4
+ var errorObj = {
5
+ ErrorName: err.name,
6
+ ErrorMessage: err.message,
7
+ ErrorStack: err.stack,
8
+ ErrorTime: new Date(),
9
+ ErrorOrigin: errorOrigin
10
+ };
11
+ var mailObj = {
12
+ from: { name: 'optimiser', address: config.ErrorReportFrom },
13
+ to: config.ErrorReportTo,
14
+ subject: 'Error Reporting',
15
+ html: "\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <title>Error</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\n </head>\n <body style=\"margin: 0; padding: 0;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\t\n <tr>\n <td style=\"padding: 10px 0 30px 0;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\" style=\"border: 1px solid #cccccc; border-collapse: collapse;\">\n <tr>\n <td align=\"center\" bgcolor=\"#70bbd9\" style=\"padding: 40px 0 30px 0; color: #153643; font-size: 18px; font-weight: bold; font-family: Arial, sans-serif;\">\n There is an error in OPTIMISER - ".concat(errorObj.ErrorOrigin, ". Please inform the developers \n </td>\n </tr>\n <tr>\n <td bgcolor=\"#ffffff\" style=\"padding: 40px 30px 40px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n \n <tr>\n <td style=\"padding: 20px 0 30px 0; color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;\">\n <pre> ").concat(JSON.stringify(errorObj, null, 2), " </pre>\n </td>\n </tr>\n \n </table>\n </td>\n </tr>\n <tr>\n <td bgcolor=\"#007EE3\" style=\"padding: 30px 30px 30px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n <tr>\n \n <td align=\"right\" width=\"25%\">\n <strong>TEAM OPTIMISER</string>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </body>\n </html>\n ")
16
+ };
17
+ return { mailObj: mailObj, errorObj: errorObj };
18
+ }
19
+ exports.default = ErrorFormatterForServices;
@@ -1,21 +1,21 @@
1
- import * as nodemailer from "nodemailer";
2
- import { MailConfig } from "../modals/mail.modal";
3
- /**
4
- *
5
- * @param mailData
6
- * @param config
7
- * @description if the config is missing, it will try to send mail via Global mail config
8
- */
9
- export declare function SendMail(mailData: nodemailer.SendMailOptions, config?: MailConfig): Promise<{
10
- statuscode: number;
11
- result: nodemailer.SentMessageInfo | Error;
12
- }>;
13
- /**
14
- * @description To set global Mail Config to send mail
15
- */
16
- export declare class MailSetup {
17
- static config: MailConfig;
18
- constructor(config: MailConfig);
19
- static isValidConfig(): boolean;
20
- static getConfig(): MailConfig;
21
- }
1
+ import * as nodemailer from "nodemailer";
2
+ import { MailConfig } from "../modals/mail.modal";
3
+ /**
4
+ *
5
+ * @param mailData
6
+ * @param config
7
+ * @description if the config is missing, it will try to send mail via Global mail config
8
+ */
9
+ export declare function SendMail(mailData: nodemailer.SendMailOptions, config?: MailConfig): Promise<{
10
+ statuscode: number;
11
+ result: nodemailer.SentMessageInfo | Error;
12
+ }>;
13
+ /**
14
+ * @description To set global Mail Config to send mail
15
+ */
16
+ export declare class MailSetup {
17
+ static config: MailConfig;
18
+ constructor(config: MailConfig);
19
+ static isValidConfig(): boolean;
20
+ static getConfig(): MailConfig;
21
+ }