@vasrefil/api-toolkit 1.7.0 → 1.7.2
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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SendEmailPayloadI {
|
|
2
|
+
action_type: string;
|
|
3
|
+
from: string;
|
|
4
|
+
to: string;
|
|
5
|
+
subject: string;
|
|
6
|
+
html: string;
|
|
7
|
+
metadata?: object;
|
|
8
|
+
template_code?: string;
|
|
9
|
+
}
|
|
10
|
+
declare class EmailUtil_ {
|
|
11
|
+
send_email: (payload: SendEmailPayloadI) => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const EmailUtil: EmailUtil_;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailUtil = void 0;
|
|
4
|
+
const queue_1 = require("src/background-jobs/queue");
|
|
5
|
+
const helpers_1 = require("src/helpers");
|
|
6
|
+
class EmailUtil_ {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.send_email = async (payload) => {
|
|
9
|
+
try {
|
|
10
|
+
queue_1.EmailQueue.add(payload.action_type, {
|
|
11
|
+
...payload,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
const err = helpers_1.RequestHelper.get_error(error);
|
|
16
|
+
const message = 'Send Email error occured, please try again later';
|
|
17
|
+
console.log({ message, err, admin_message: err?.message });
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.EmailUtil = new EmailUtil_;
|
package/dist/utilities/index.js
CHANGED