vintasend-pug 0.4.3 → 0.4.7
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/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,YAAY,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PugEmailTemplateRendererFactory = void 0;
|
|
4
|
-
var pug_email_template_renderer_1 = require("./pug-email-template-renderer");
|
|
5
|
-
Object.defineProperty(exports, "PugEmailTemplateRendererFactory", { enumerable: true, get: function () { return pug_email_template_renderer_1.PugEmailTemplateRendererFactory; } });
|
|
1
|
+
export { PugEmailTemplateRendererFactory } from './pug-email-template-renderer';
|
|
@@ -17,3 +17,4 @@ export declare class PugEmailTemplateRenderer<Config extends BaseNotificationTyp
|
|
|
17
17
|
export declare class PugEmailTemplateRendererFactory<Config extends BaseNotificationTypeConfig> {
|
|
18
18
|
create(options?: pug.Options): PugEmailTemplateRenderer<Config>;
|
|
19
19
|
}
|
|
20
|
+
//# sourceMappingURL=pug-email-template-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pug-email-template-renderer.d.ts","sourceRoot":"","sources":["../src/pug-email-template-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,aAAa,EACd,MAAM,sFAAsF,CAAC;AAC9F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAE9E,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,qBAAa,wBAAwB,CAAC,MAAM,SAAS,0BAA0B,CAC7E,YAAW,yBAAyB,CAAC,MAAM,CAAC;IAIhC,OAAO,CAAC,OAAO;IAF3B,OAAO,CAAC,MAAM,CAA2B;gBAErB,OAAO,EAAE,GAAG,CAAC,OAAO;IAExC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAIhC,MAAM,CACV,YAAY,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAC1C,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,aAAa,CAAC;CAqB1B;AAED,qBAAa,+BAA+B,CAAC,MAAM,SAAS,0BAA0B;IACpF,MAAM,CAAC,OAAO,GAAE,GAAG,CAAC,OAAY;CAGjC"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PugEmailTemplateRendererFactory = exports.PugEmailTemplateRenderer = void 0;
|
|
7
|
-
const pug_1 = __importDefault(require("pug"));
|
|
8
|
-
class PugEmailTemplateRenderer {
|
|
1
|
+
import pug from 'pug';
|
|
2
|
+
export class PugEmailTemplateRenderer {
|
|
9
3
|
constructor(options) {
|
|
10
4
|
this.options = options;
|
|
11
5
|
this.logger = null;
|
|
@@ -17,23 +11,27 @@ class PugEmailTemplateRenderer {
|
|
|
17
11
|
this.logger = logger;
|
|
18
12
|
}
|
|
19
13
|
async render(notification, context) {
|
|
20
|
-
|
|
14
|
+
this.logger?.info(`Rendering email template for notification ${notification.id}`);
|
|
15
|
+
this.logger?.info(`Compiling body template: ${notification.bodyTemplate}`);
|
|
16
|
+
const bodyTemplate = pug.compileFile(notification.bodyTemplate, this.options);
|
|
21
17
|
if (!notification.subjectTemplate) {
|
|
18
|
+
this.logger?.info('Subject template missing');
|
|
22
19
|
throw new Error('Subject template is required');
|
|
23
20
|
}
|
|
24
|
-
|
|
21
|
+
this.logger?.info(`Compiling subject template: ${notification.subjectTemplate}`);
|
|
22
|
+
const subjectTemplate = pug.compileFile(notification.subjectTemplate, this.options);
|
|
25
23
|
return new Promise((resolve) => {
|
|
26
|
-
|
|
24
|
+
const rendered = {
|
|
27
25
|
subject: subjectTemplate(context),
|
|
28
26
|
body: bodyTemplate(context),
|
|
29
|
-
}
|
|
27
|
+
};
|
|
28
|
+
this.logger?.info(`Email template rendered successfully for notification ${notification.id}`);
|
|
29
|
+
resolve(rendered);
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
class PugEmailTemplateRendererFactory {
|
|
33
|
+
export class PugEmailTemplateRendererFactory {
|
|
35
34
|
create(options = {}) {
|
|
36
35
|
return new PugEmailTemplateRenderer(options);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
exports.PugEmailTemplateRendererFactory = PugEmailTemplateRendererFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vintasend-pug",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"pug": "^3.0.3",
|
|
18
|
-
"vintasend": "^0.4.
|
|
18
|
+
"vintasend": "^0.4.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/jest": "^
|
|
21
|
+
"@types/jest": "^30.0.0",
|
|
22
22
|
"@types/pug": "^2.0.10",
|
|
23
|
-
"jest": "^
|
|
24
|
-
"ts-jest": "^29.
|
|
25
|
-
"typescript": "^5.
|
|
23
|
+
"jest": "^30.2.0",
|
|
24
|
+
"ts-jest": "^29.4.6",
|
|
25
|
+
"typescript": "^5.9.3"
|
|
26
26
|
}
|
|
27
27
|
}
|