@openinc/parse-server-opendash 3.28.0 → 3.29.0
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/features/config/helper/customOptions.js +1 -8
- package/dist/features/notifications/index.d.ts +3 -0
- package/dist/features/notifications/index.js +8 -1
- package/dist/features/notifications/services/initEmailTransport.d.ts +1 -0
- package/dist/features/notifications/services/initEmailTransport.js +45 -0
- package/dist/features/notifications/services/sendMails.d.ts +21 -0
- package/dist/features/notifications/services/sendMails.js +83 -0
- package/dist/features/notifications/states/EmailState.d.ts +39 -0
- package/dist/features/notifications/states/EmailState.js +58 -0
- package/dist/hooks/Core_Email.d.ts +0 -10
- package/dist/hooks/Core_Email.js +3 -79
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -5
- package/package.json +1 -1
|
@@ -276,14 +276,7 @@ exports.customoptions = {
|
|
|
276
276
|
public: true,
|
|
277
277
|
default: "false",
|
|
278
278
|
description: "Enable SMTP for sending e-mails.",
|
|
279
|
-
dependencies: [
|
|
280
|
-
"SMTP_HOST",
|
|
281
|
-
"SMTP_PORT",
|
|
282
|
-
"SMTP_USER",
|
|
283
|
-
"SMTP_PASS",
|
|
284
|
-
"SMTP_FROM",
|
|
285
|
-
"SMTP_SECURE",
|
|
286
|
-
],
|
|
279
|
+
dependencies: ["SMTP_HOST", "SMTP_PORT", "SMTP_FROM", "SMTP_SECURE"],
|
|
287
280
|
},
|
|
288
281
|
SMTP_HOST: {
|
|
289
282
|
env: "OPENINC_PARSE_SMTP_HOST",
|
|
@@ -2,3 +2,6 @@ export { FunctionKeys, NotificationInterface, NotificationMap, } from "./types/N
|
|
|
2
2
|
export { Notifications } from "./types/Notifications";
|
|
3
3
|
export { RegisteredNotification } from "./states/NotificationClass";
|
|
4
4
|
export { getAllNotifications, default as initNotifications, } from "./services/registerNotification";
|
|
5
|
+
export { EmailState } from "./states/EmailState";
|
|
6
|
+
export { sendSimpleEmail, sendTemplateEmail } from "./services/sendMails";
|
|
7
|
+
export { initEmailTransport } from "./services/initEmailTransport";
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.initNotifications = exports.getAllNotifications = exports.RegisteredNotification = exports.Notifications = void 0;
|
|
6
|
+
exports.initEmailTransport = exports.sendTemplateEmail = exports.sendSimpleEmail = exports.EmailState = exports.initNotifications = exports.getAllNotifications = exports.RegisteredNotification = exports.Notifications = void 0;
|
|
7
7
|
var Notifications_1 = require("./types/Notifications");
|
|
8
8
|
Object.defineProperty(exports, "Notifications", { enumerable: true, get: function () { return Notifications_1.Notifications; } });
|
|
9
9
|
var NotificationClass_1 = require("./states/NotificationClass");
|
|
@@ -11,3 +11,10 @@ Object.defineProperty(exports, "RegisteredNotification", { enumerable: true, get
|
|
|
11
11
|
var registerNotification_1 = require("./services/registerNotification");
|
|
12
12
|
Object.defineProperty(exports, "getAllNotifications", { enumerable: true, get: function () { return registerNotification_1.getAllNotifications; } });
|
|
13
13
|
Object.defineProperty(exports, "initNotifications", { enumerable: true, get: function () { return __importDefault(registerNotification_1).default; } });
|
|
14
|
+
var EmailState_1 = require("./states/EmailState");
|
|
15
|
+
Object.defineProperty(exports, "EmailState", { enumerable: true, get: function () { return EmailState_1.EmailState; } });
|
|
16
|
+
var sendMails_1 = require("./services/sendMails");
|
|
17
|
+
Object.defineProperty(exports, "sendSimpleEmail", { enumerable: true, get: function () { return sendMails_1.sendSimpleEmail; } });
|
|
18
|
+
Object.defineProperty(exports, "sendTemplateEmail", { enumerable: true, get: function () { return sendMails_1.sendTemplateEmail; } });
|
|
19
|
+
var initEmailTransport_1 = require("./services/initEmailTransport");
|
|
20
|
+
Object.defineProperty(exports, "initEmailTransport", { enumerable: true, get: function () { return initEmailTransport_1.initEmailTransport; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initEmailTransport(): Promise<void>;
|
|
@@ -0,0 +1,45 @@
|
|
|
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.initEmailTransport = initEmailTransport;
|
|
7
|
+
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
8
|
+
const nunjucks_1 = __importDefault(require("nunjucks"));
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const __1 = require("..");
|
|
11
|
+
const config_1 = require("../../config");
|
|
12
|
+
async function initEmailTransport() {
|
|
13
|
+
const emailState = __1.EmailState.getInstance();
|
|
14
|
+
try {
|
|
15
|
+
if (config_1.ConfigInstance.getInstance().getBoolean("SMTP_ENABLED")) {
|
|
16
|
+
const transportOptions = {
|
|
17
|
+
host: config_1.ConfigInstance.getInstance().get("SMTP_HOST"),
|
|
18
|
+
port: config_1.ConfigInstance.getInstance().getNumber("SMTP_PORT"),
|
|
19
|
+
secure: config_1.ConfigInstance.getInstance().getBoolean("SMTP_SECURE"),
|
|
20
|
+
ignoreTLS: config_1.ConfigInstance.getInstance().getBoolean("SMTP_IGNORE_TLS"),
|
|
21
|
+
};
|
|
22
|
+
if (config_1.ConfigInstance.getInstance().get("SMTP_USER") &&
|
|
23
|
+
config_1.ConfigInstance.getInstance().get("SMTP_PASS")) {
|
|
24
|
+
transportOptions.auth = {
|
|
25
|
+
user: config_1.ConfigInstance.getInstance().get("SMTP_USER"),
|
|
26
|
+
pass: config_1.ConfigInstance.getInstance().get("SMTP_PASS"),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const transport = nodemailer_1.default.createTransport(transportOptions);
|
|
30
|
+
await transport.verify();
|
|
31
|
+
emailState.setTransport(transport);
|
|
32
|
+
const templateDir = (0, path_1.resolve)(process.cwd(), config_1.ConfigInstance.getInstance().get("EMAIL_TEMPLATE_DIR"));
|
|
33
|
+
emailState.setEmailTemplateDir(templateDir);
|
|
34
|
+
nunjucks_1.default.configure(templateDir, { autoescape: true });
|
|
35
|
+
console.log("[@openinc/parse-server-opendash] Email transport initialized successfully");
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log("[@openinc/parse-server-opendash] SMTP disabled, skipping email transport initialization");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error(`Parse SMTP Adapter: Error when trying to establish the SMTP connection:`);
|
|
43
|
+
console.error(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Core_Email } from "../../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Send a simple email
|
|
4
|
+
* @param to The recipient email address
|
|
5
|
+
* @param subject The subject of the email
|
|
6
|
+
* @param text The plain text content of the email
|
|
7
|
+
* @returns The saved email object
|
|
8
|
+
*/
|
|
9
|
+
export declare function sendSimpleEmail(to: string, subject: string, text: string): Promise<Core_Email>;
|
|
10
|
+
/**
|
|
11
|
+
* Send a template email
|
|
12
|
+
* @param param0
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function sendTemplateEmail({ to, subject, fallback, template, data, }: {
|
|
16
|
+
to: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
fallback: string;
|
|
19
|
+
template: string;
|
|
20
|
+
data: any;
|
|
21
|
+
}): Promise<Core_Email>;
|
|
@@ -0,0 +1,83 @@
|
|
|
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.sendSimpleEmail = sendSimpleEmail;
|
|
7
|
+
exports.sendTemplateEmail = sendTemplateEmail;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const nunjucks_1 = __importDefault(require("nunjucks"));
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const types_1 = require("../../../types");
|
|
12
|
+
const EmailState_1 = require("../states/EmailState");
|
|
13
|
+
/**
|
|
14
|
+
* Send a simple email
|
|
15
|
+
* @param to The recipient email address
|
|
16
|
+
* @param subject The subject of the email
|
|
17
|
+
* @param text The plain text content of the email
|
|
18
|
+
* @returns The saved email object
|
|
19
|
+
*/
|
|
20
|
+
async function sendSimpleEmail(to, subject, text) {
|
|
21
|
+
const email = new types_1.Core_Email({
|
|
22
|
+
payload: {
|
|
23
|
+
to,
|
|
24
|
+
subject,
|
|
25
|
+
text,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
await email.save(null, { useMasterKey: true });
|
|
29
|
+
return email;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Send a template email
|
|
33
|
+
* @param param0
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
async function sendTemplateEmail({ to, subject, fallback, template, data, }) {
|
|
37
|
+
const email = new types_1.Core_Email({
|
|
38
|
+
payload: {
|
|
39
|
+
to,
|
|
40
|
+
subject: renderEmailTemplate("subject", template, data, subject),
|
|
41
|
+
text: renderEmailTemplate("txt", template, data, fallback),
|
|
42
|
+
html: renderEmailTemplate("html", template, data, undefined),
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
await email.save(null, { useMasterKey: true });
|
|
46
|
+
return email;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Validate if an email template exists in the specified directory
|
|
50
|
+
* @param templateDir The directory where email templates are stored
|
|
51
|
+
* @param template The specific template file to validate
|
|
52
|
+
* @returns Whether the template exists in the directory
|
|
53
|
+
*/
|
|
54
|
+
function validateEmailTemplate(templateDir, template) {
|
|
55
|
+
const templatePath = (0, path_1.join)(templateDir, template);
|
|
56
|
+
if (!fs_1.default.existsSync(templateDir)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (!fs_1.default.existsSync(templatePath)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Render an email template
|
|
66
|
+
* @param type The type of the email template (txt, html, subject)
|
|
67
|
+
* @param template The base name of the template file
|
|
68
|
+
* @param data The data to be used for rendering the template
|
|
69
|
+
* @param fallback The fallback content if the template is not found
|
|
70
|
+
* @returns The rendered email content
|
|
71
|
+
*/
|
|
72
|
+
function renderEmailTemplate(type, template, data, fallback) {
|
|
73
|
+
const emailState = EmailState_1.EmailState.getInstance();
|
|
74
|
+
const emailTemplateDir = emailState.getEmailTemplateDir();
|
|
75
|
+
const fullTemplate = template + "." + type;
|
|
76
|
+
if (validateEmailTemplate(emailTemplateDir, fullTemplate)) {
|
|
77
|
+
return nunjucks_1.default.render(fullTemplate, data);
|
|
78
|
+
}
|
|
79
|
+
if (type === "html") {
|
|
80
|
+
return renderEmailTemplate("txt", template, data, fallback);
|
|
81
|
+
}
|
|
82
|
+
return fallback || "";
|
|
83
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Transporter } from "nodemailer";
|
|
2
|
+
import SMTPTransport from "nodemailer/lib/smtp-transport";
|
|
3
|
+
/**
|
|
4
|
+
* Singleton class to manage email transport and template directory
|
|
5
|
+
*/
|
|
6
|
+
export declare class EmailState {
|
|
7
|
+
private static instance;
|
|
8
|
+
emailTemplateDir: string;
|
|
9
|
+
transport: Transporter<SMTPTransport.SentMessageInfo> | undefined;
|
|
10
|
+
private constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Get the singleton instance
|
|
13
|
+
*/
|
|
14
|
+
static getInstance(): EmailState;
|
|
15
|
+
/**
|
|
16
|
+
* Set the email transport
|
|
17
|
+
*/
|
|
18
|
+
setTransport(transport: Transporter<SMTPTransport.SentMessageInfo>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get the email transport
|
|
21
|
+
*/
|
|
22
|
+
getTransport(): Transporter<SMTPTransport.SentMessageInfo> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Set the email template directory
|
|
25
|
+
*/
|
|
26
|
+
setEmailTemplateDir(dir: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get the email template directory
|
|
29
|
+
*/
|
|
30
|
+
getEmailTemplateDir(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Check if email transport is configured and ready
|
|
33
|
+
*/
|
|
34
|
+
isConfigured(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Reset the singleton (useful for testing)
|
|
37
|
+
*/
|
|
38
|
+
static reset(): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailState = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Singleton class to manage email transport and template directory
|
|
6
|
+
*/
|
|
7
|
+
class EmailState {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.emailTemplateDir = "";
|
|
10
|
+
this.transport = undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get the singleton instance
|
|
14
|
+
*/
|
|
15
|
+
static getInstance() {
|
|
16
|
+
if (!EmailState.instance) {
|
|
17
|
+
EmailState.instance = new EmailState();
|
|
18
|
+
}
|
|
19
|
+
return EmailState.instance;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Set the email transport
|
|
23
|
+
*/
|
|
24
|
+
setTransport(transport) {
|
|
25
|
+
this.transport = transport;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the email transport
|
|
29
|
+
*/
|
|
30
|
+
getTransport() {
|
|
31
|
+
return this.transport;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Set the email template directory
|
|
35
|
+
*/
|
|
36
|
+
setEmailTemplateDir(dir) {
|
|
37
|
+
this.emailTemplateDir = dir;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get the email template directory
|
|
41
|
+
*/
|
|
42
|
+
getEmailTemplateDir() {
|
|
43
|
+
return this.emailTemplateDir;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if email transport is configured and ready
|
|
47
|
+
*/
|
|
48
|
+
isConfigured() {
|
|
49
|
+
return this.transport !== undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Reset the singleton (useful for testing)
|
|
53
|
+
*/
|
|
54
|
+
static reset() {
|
|
55
|
+
EmailState.instance = undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.EmailState = EmailState;
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import { Core_Email } from "../types";
|
|
2
|
-
export declare function initEmailTransport(): Promise<void>;
|
|
3
|
-
export declare function sendSimpleEmail(to: string, subject: string, text: string): Promise<Core_Email>;
|
|
4
|
-
export declare function sendTemplateEmail({ to, subject, fallback, template, data, }: {
|
|
5
|
-
to: string;
|
|
6
|
-
subject: string;
|
|
7
|
-
fallback: string;
|
|
8
|
-
template: string;
|
|
9
|
-
data: any;
|
|
10
|
-
}): Promise<Core_Email>;
|
|
11
1
|
export declare function init(): Promise<void>;
|
package/dist/hooks/Core_Email.js
CHANGED
|
@@ -1,92 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.initEmailTransport = initEmailTransport;
|
|
7
|
-
exports.sendSimpleEmail = sendSimpleEmail;
|
|
8
|
-
exports.sendTemplateEmail = sendTemplateEmail;
|
|
9
3
|
exports.init = init;
|
|
10
|
-
const fs_1 = __importDefault(require("fs"));
|
|
11
|
-
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
12
|
-
const nunjucks_1 = __importDefault(require("nunjucks"));
|
|
13
|
-
const path_1 = require("path");
|
|
14
4
|
const __1 = require("..");
|
|
15
5
|
const config_1 = require("../features/config");
|
|
6
|
+
const notifications_1 = require("../features/notifications");
|
|
16
7
|
const types_1 = require("../types");
|
|
17
|
-
let emailTemplateDir = "";
|
|
18
|
-
let transport = undefined;
|
|
19
|
-
async function initEmailTransport() {
|
|
20
|
-
try {
|
|
21
|
-
if (config_1.ConfigInstance.getInstance().getBoolean("SMTP_ENABLED")) {
|
|
22
|
-
transport = nodemailer_1.default.createTransport({
|
|
23
|
-
host: config_1.ConfigInstance.getInstance().get("SMTP_HOST"),
|
|
24
|
-
port: config_1.ConfigInstance.getInstance().getNumber("SMTP_PORT"),
|
|
25
|
-
secure: config_1.ConfigInstance.getInstance().getBoolean("SMTP_SECURE"),
|
|
26
|
-
ignoreTLS: config_1.ConfigInstance.getInstance().getBoolean("SMTP_IGNORE_TLS"),
|
|
27
|
-
auth: {
|
|
28
|
-
user: config_1.ConfigInstance.getInstance().get("SMTP_USER"),
|
|
29
|
-
pass: config_1.ConfigInstance.getInstance().get("SMTP_PASS"),
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
await transport.verify();
|
|
33
|
-
emailTemplateDir = (0, path_1.resolve)(process.cwd(), config_1.ConfigInstance.getInstance().get("EMAIL_TEMPLATE_DIR"));
|
|
34
|
-
nunjucks_1.default.configure(emailTemplateDir, { autoescape: true });
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error(`Parse SMTP Adapter: Error when trying to establish the SMTP connection:`);
|
|
39
|
-
console.error(error);
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async function sendSimpleEmail(to, subject, text) {
|
|
44
|
-
const email = new types_1.Core_Email({
|
|
45
|
-
payload: {
|
|
46
|
-
to,
|
|
47
|
-
subject,
|
|
48
|
-
text,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
await email.save(null, { useMasterKey: true });
|
|
52
|
-
return email;
|
|
53
|
-
}
|
|
54
|
-
async function sendTemplateEmail({ to, subject, fallback, template, data, }) {
|
|
55
|
-
const email = new types_1.Core_Email({
|
|
56
|
-
payload: {
|
|
57
|
-
to,
|
|
58
|
-
subject: renderEmailTemplate("subject", template, data, subject),
|
|
59
|
-
text: renderEmailTemplate("txt", template, data, fallback),
|
|
60
|
-
html: renderEmailTemplate("html", template, data, undefined),
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
await email.save(null, { useMasterKey: true });
|
|
64
|
-
return email;
|
|
65
|
-
}
|
|
66
|
-
function validateEmailTemplate(templateDir, template) {
|
|
67
|
-
const templatePath = (0, path_1.join)(templateDir, template);
|
|
68
|
-
if (!fs_1.default.existsSync(templateDir)) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
if (!fs_1.default.existsSync(templatePath)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
function renderEmailTemplate(type, template, data, fallback) {
|
|
77
|
-
const fullTemplate = template + "." + type;
|
|
78
|
-
if (validateEmailTemplate(emailTemplateDir, fullTemplate)) {
|
|
79
|
-
return nunjucks_1.default.render(fullTemplate, data);
|
|
80
|
-
}
|
|
81
|
-
if (type === "html") {
|
|
82
|
-
return renderEmailTemplate("txt", template, data, fallback);
|
|
83
|
-
}
|
|
84
|
-
return fallback || "";
|
|
85
|
-
}
|
|
86
8
|
async function init() {
|
|
87
9
|
(0, __1.beforeSaveHook)(types_1.Core_Email, async (request) => {
|
|
88
10
|
const { object } = request;
|
|
89
11
|
object.setACL(new Parse.ACL());
|
|
12
|
+
const emailState = notifications_1.EmailState.getInstance();
|
|
13
|
+
const transport = emailState.getTransport();
|
|
90
14
|
if (!transport) {
|
|
91
15
|
object.sent = false;
|
|
92
16
|
object.success = false;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Cloud as ParseCloud } from "parse";
|
|
2
2
|
import { Permission } from "./types";
|
|
3
|
-
export { sendSimpleEmail, sendTemplateEmail } from "./
|
|
3
|
+
export { sendSimpleEmail, sendTemplateEmail } from "./features/notifications";
|
|
4
4
|
/**
|
|
5
5
|
* Initializes the Cloud Code for open.DASH.
|
|
6
6
|
* This function performs various initialization tasks such as
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,6 @@ const types_1 = require("./types");
|
|
|
38
38
|
const notifications_1 = require("./features/notifications");
|
|
39
39
|
const permissions_1 = require("./features/permissions");
|
|
40
40
|
const settings_1 = require("./features/user/settings");
|
|
41
|
-
const Core_Email_1 = require("./hooks/Core_Email");
|
|
42
41
|
const importDocs_1 = require("./features/documentation/functions/importDocs");
|
|
43
42
|
const openservice_1 = require("./features/openservice");
|
|
44
43
|
const translations_1 = require("./features/translations");
|
|
@@ -49,9 +48,9 @@ dayjs_1.default.extend(weekday_1.default);
|
|
|
49
48
|
dayjs_1.default.extend(dayOfYear_1.default);
|
|
50
49
|
dayjs_1.default.extend(weekOfYear_1.default);
|
|
51
50
|
dayjs_1.default.extend(duration_1.default);
|
|
52
|
-
var
|
|
53
|
-
Object.defineProperty(exports, "sendSimpleEmail", { enumerable: true, get: function () { return
|
|
54
|
-
Object.defineProperty(exports, "sendTemplateEmail", { enumerable: true, get: function () { return
|
|
51
|
+
var notifications_2 = require("./features/notifications");
|
|
52
|
+
Object.defineProperty(exports, "sendSimpleEmail", { enumerable: true, get: function () { return notifications_2.sendSimpleEmail; } });
|
|
53
|
+
Object.defineProperty(exports, "sendTemplateEmail", { enumerable: true, get: function () { return notifications_2.sendTemplateEmail; } });
|
|
55
54
|
const PREFIX = "OD3_";
|
|
56
55
|
let config;
|
|
57
56
|
// const lang_deu = require("../i18n/deu.json");
|
|
@@ -85,7 +84,7 @@ async function init() {
|
|
|
85
84
|
config = config_1.ConfigInstance.getInstance();
|
|
86
85
|
await config.init(true);
|
|
87
86
|
await (0, translations_1.initTranslations)();
|
|
88
|
-
await (0,
|
|
87
|
+
await (0, notifications_1.initEmailTransport)();
|
|
89
88
|
await initWebPush();
|
|
90
89
|
await initSchema();
|
|
91
90
|
await initDefaultRoles();
|