@ackplus/nest-dynamic-templates 1.1.1 → 1.1.5
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/package.json +2 -2
- package/src/{index.ts → index.d.ts} +2 -14
- package/src/index.d.ts.map +1 -0
- package/src/index.js +25 -0
- package/src/lib/constant.d.ts +3 -0
- package/src/lib/constant.d.ts.map +1 -0
- package/src/lib/constant.js +5 -0
- package/src/lib/dto/create-template-layout.dto.d.ts +16 -0
- package/src/lib/dto/create-template-layout.dto.d.ts.map +1 -0
- package/src/lib/dto/create-template-layout.dto.js +86 -0
- package/src/lib/dto/create-template.dto.d.ts +18 -0
- package/src/lib/dto/create-template.dto.d.ts.map +1 -0
- package/src/lib/dto/create-template.dto.js +103 -0
- package/src/lib/dto/render-content-template-layout.dto.d.ts +8 -0
- package/src/lib/dto/render-content-template-layout.dto.d.ts.map +1 -0
- package/src/lib/dto/render-content-template-layout.dto.js +40 -0
- package/src/lib/dto/render-content-template.dto.d.ts +9 -0
- package/src/lib/dto/render-content-template.dto.d.ts.map +1 -0
- package/src/lib/dto/render-content-template.dto.js +46 -0
- package/src/lib/dto/render-template-layout.dto.d.ts +11 -0
- package/src/lib/dto/render-template-layout.dto.d.ts.map +1 -0
- package/src/lib/dto/render-template-layout.dto.js +66 -0
- package/src/lib/dto/render-template.dto.d.ts +15 -0
- package/src/lib/dto/render-template.dto.d.ts.map +1 -0
- package/src/lib/dto/render-template.dto.js +90 -0
- package/src/lib/dto/template-filter.dto.d.ts +9 -0
- package/src/lib/dto/template-filter.dto.d.ts.map +1 -0
- package/src/lib/dto/template-filter.dto.js +61 -0
- package/src/lib/dto/template-layout-filter.dto.d.ts +8 -0
- package/src/lib/dto/template-layout-filter.dto.d.ts.map +1 -0
- package/src/lib/dto/template-layout-filter.dto.js +60 -0
- package/src/lib/engines/language/html.engine.d.ts +10 -0
- package/src/lib/engines/language/html.engine.d.ts.map +1 -0
- package/src/lib/engines/language/html.engine.js +80 -0
- package/src/lib/engines/language/{index.ts → index.d.ts} +1 -0
- package/src/lib/engines/language/index.d.ts.map +1 -0
- package/src/lib/engines/language/index.js +11 -0
- package/src/lib/engines/language/markdown.engine.d.ts +10 -0
- package/src/lib/engines/language/markdown.engine.d.ts.map +1 -0
- package/src/lib/engines/language/markdown.engine.js +39 -0
- package/src/lib/engines/language/mjml.engine.d.ts +10 -0
- package/src/lib/engines/language/mjml.engine.d.ts.map +1 -0
- package/src/lib/engines/language/mjml.engine.js +75 -0
- package/src/lib/engines/language/text.engine.d.ts +8 -0
- package/src/lib/engines/language/text.engine.d.ts.map +1 -0
- package/src/lib/engines/language/text.engine.js +15 -0
- package/src/lib/engines/{language-engine.ts → language-engine.d.ts} +2 -7
- package/src/lib/engines/language-engine.d.ts.map +1 -0
- package/src/lib/engines/language-engine.js +6 -0
- package/src/lib/engines/template/ejs.engine.d.ts +11 -0
- package/src/lib/engines/template/ejs.engine.d.ts.map +1 -0
- package/src/lib/engines/template/ejs.engine.js +65 -0
- package/src/lib/engines/template/handlebars.engine.d.ts +11 -0
- package/src/lib/engines/template/handlebars.engine.d.ts.map +1 -0
- package/src/lib/engines/template/handlebars.engine.js +66 -0
- package/src/lib/engines/template/{index.ts → index.d.ts} +1 -0
- package/src/lib/engines/template/index.d.ts.map +1 -0
- package/src/lib/engines/template/index.js +11 -0
- package/src/lib/engines/template/nunjucks.engine.d.ts +17 -0
- package/src/lib/engines/template/nunjucks.engine.d.ts.map +1 -0
- package/src/lib/engines/template/{nunjucks.engine.ts → nunjucks.engine.js} +24 -30
- package/src/lib/engines/template/pug.engine.d.ts +13 -0
- package/src/lib/engines/template/pug.engine.d.ts.map +1 -0
- package/src/lib/engines/template/pug.engine.js +74 -0
- package/src/lib/engines/{template-engine.ts → template-engine.d.ts} +2 -6
- package/src/lib/engines/template-engine.d.ts.map +1 -0
- package/src/lib/engines/template-engine.js +6 -0
- package/src/lib/entities/template-layout.entity.d.ts +21 -0
- package/src/lib/entities/template-layout.entity.d.ts.map +1 -0
- package/src/lib/entities/template-layout.entity.js +120 -0
- package/src/lib/entities/template.entity.d.ts +22 -0
- package/src/lib/entities/template.entity.d.ts.map +1 -0
- package/src/lib/entities/template.entity.js +127 -0
- package/src/lib/errors/template.errors.d.ts +20 -0
- package/src/lib/errors/template.errors.d.ts.map +1 -0
- package/src/lib/errors/{template.errors.ts → template.errors.js} +22 -20
- package/src/lib/interfaces/{module-config.interface.ts → module-config.interface.d.ts} +2 -10
- package/src/lib/interfaces/module-config.interface.d.ts.map +1 -0
- package/src/lib/interfaces/module-config.interface.js +2 -0
- package/src/lib/interfaces/template.types.d.ts +23 -0
- package/src/lib/interfaces/template.types.d.ts.map +1 -0
- package/src/lib/interfaces/template.types.js +24 -0
- package/src/lib/nest-dynamic-templates.module.d.ts +11 -0
- package/src/lib/nest-dynamic-templates.module.d.ts.map +1 -0
- package/src/lib/nest-dynamic-templates.module.js +131 -0
- package/src/lib/services/template-config.service.d.ts +55 -0
- package/src/lib/services/template-config.service.d.ts.map +1 -0
- package/src/lib/services/{template-config.service.ts → template-config.service.js} +32 -43
- package/src/lib/services/template-engine.registry.d.ts +22 -0
- package/src/lib/services/template-engine.registry.d.ts.map +1 -0
- package/src/lib/services/template-engine.registry.js +93 -0
- package/src/lib/services/template-layout.service.d.ts +37 -0
- package/src/lib/services/template-layout.service.d.ts.map +1 -0
- package/src/lib/services/{template-layout.service.ts → template-layout.service.js} +101 -165
- package/src/lib/services/template.service.d.ts +39 -0
- package/src/lib/services/template.service.d.ts.map +1 -0
- package/src/lib/services/{template.service.ts → template.service.js} +137 -199
- package/src/test/helpers.d.ts +5 -0
- package/src/test/helpers.d.ts.map +1 -0
- package/src/test/{helpers.ts → helpers.js} +7 -5
- package/src/test/test-database.config.d.ts +5 -0
- package/src/test/test-database.config.d.ts.map +1 -0
- package/src/test/test-database.config.js +23 -0
- package/src/test/test.setup.d.ts +4 -0
- package/src/test/test.setup.d.ts.map +1 -0
- package/src/test/test.setup.js +30 -0
- package/eslint.config.mjs +0 -22
- package/jest.config.ts +0 -10
- package/project.json +0 -38
- package/src/lib/constant.ts +0 -2
- package/src/lib/dto/create-template-layout.dto.ts +0 -65
- package/src/lib/dto/create-template.dto.ts +0 -80
- package/src/lib/dto/render-content-template-layout.dto.ts +0 -32
- package/src/lib/dto/render-content-template.dto.ts +0 -37
- package/src/lib/dto/render-template-layout.dto.ts +0 -55
- package/src/lib/dto/render-template.dto.ts +0 -74
- package/src/lib/dto/template-filter.dto.ts +0 -52
- package/src/lib/dto/template-layout-filter.dto.ts +0 -51
- package/src/lib/engines/language/html.engine.ts +0 -49
- package/src/lib/engines/language/markdown.engine.ts +0 -37
- package/src/lib/engines/language/mjml.engine.ts +0 -44
- package/src/lib/engines/language/text.engine.ts +0 -15
- package/src/lib/engines/template/ejs.engine.ts +0 -33
- package/src/lib/engines/template/handlebars.engine.ts +0 -35
- package/src/lib/engines/template/pug.engine.ts +0 -43
- package/src/lib/entities/template-layout.entity.ts +0 -99
- package/src/lib/entities/template.entity.ts +0 -105
- package/src/lib/interfaces/template.types.ts +0 -25
- package/src/lib/nest-dynamic-templates.module.ts +0 -143
- package/src/lib/services/template-engine.registry.ts +0 -109
- package/src/test/nunjucks.service.spec.ts +0 -157
- package/src/test/pug.service.spec-temp +0 -254
- package/src/test/template-layout.service.spec.ts +0 -422
- package/src/test/template.service.spec.ts +0 -862
- package/src/test/test-database.config.ts +0 -24
- package/src/test/test-database.d.ts +0 -6
- package/src/test/test.setup.ts +0 -34
- package/src/types/ioredis.d.ts +0 -6
- package/src/types/mjml.d.ts +0 -5
- package/tsconfig.json +0 -17
- package/tsconfig.lib.json +0 -14
- package/tsconfig.spec.json +0 -15
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TemplateEngineEnum } from '../../interfaces/template.types';
|
|
2
|
+
import { TemplateEngine } from '../template-engine';
|
|
3
|
+
import type { ConfigureOptions } from 'nunjucks';
|
|
4
|
+
import { CustomEngineOptions, EngineOptions } from '../../interfaces/module-config.interface';
|
|
5
|
+
export declare class NunjucksEngine extends TemplateEngine {
|
|
6
|
+
private options?;
|
|
7
|
+
private customOptions?;
|
|
8
|
+
static engineName: TemplateEngineEnum;
|
|
9
|
+
private env;
|
|
10
|
+
constructor(options?: EngineOptions<ConfigureOptions>, customOptions?: CustomEngineOptions);
|
|
11
|
+
initNunjucks(): void;
|
|
12
|
+
render(content: string, data?: Record<string, any>): Promise<string>;
|
|
13
|
+
validate(content: string): Promise<boolean>;
|
|
14
|
+
registerFilter(name: string, filter: (...args: any[]) => any): void;
|
|
15
|
+
registerGlobal(name: string, global: (...args: any[]) => any): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=nunjucks.engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nunjucks.engine.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nest-dynamic-templates/src/lib/engines/template/nunjucks.engine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9F,qBAAa,cAAe,SAAQ,cAAc;IAMlC,OAAO,CAAC,OAAO,CAAC;IAAmC,OAAO,CAAC,aAAa,CAAC;IAJrF,OAAgB,UAAU,qBAA+B;IAEzD,OAAO,CAAC,GAAG,CAAc;gBAEL,OAAO,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAAU,aAAa,CAAC,EAAE,mBAAmB;IAK1G,YAAY;IAmBN,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBpE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjD,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG;IAI5D,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG;CAG/D"}
|
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
static override engineName = TemplateEngineEnum.NUNJUCKS;
|
|
10
|
-
|
|
11
|
-
private env: Environment;
|
|
12
|
-
|
|
13
|
-
constructor(private options?: EngineOptions<ConfigureOptions>, private customOptions?: CustomEngineOptions) {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NunjucksEngine = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const template_types_1 = require("../../interfaces/template.types");
|
|
6
|
+
const template_engine_1 = require("../template-engine");
|
|
7
|
+
class NunjucksEngine extends template_engine_1.TemplateEngine {
|
|
8
|
+
constructor(options, customOptions) {
|
|
14
9
|
super();
|
|
10
|
+
this.options = options;
|
|
11
|
+
this.customOptions = customOptions;
|
|
15
12
|
this.initNunjucks();
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
initNunjucks() {
|
|
19
15
|
const nunjucks = require('nunjucks');
|
|
20
|
-
|
|
21
|
-
const nunjucksOptions = omit(this.options, 'filters');
|
|
22
|
-
|
|
16
|
+
const nunjucksOptions = (0, lodash_1.omit)(this.options, 'filters');
|
|
23
17
|
this.env = nunjucks.configure({
|
|
24
18
|
autoescape: true,
|
|
25
19
|
throwOnUndefined: true,
|
|
26
20
|
...nunjucksOptions,
|
|
27
21
|
});
|
|
28
|
-
|
|
29
22
|
// Register filters immediately
|
|
30
23
|
if (this.customOptions?.filters) {
|
|
31
24
|
Object.entries(this.customOptions.filters).forEach(([name, filter]) => {
|
|
@@ -33,38 +26,39 @@ export class NunjucksEngine extends TemplateEngine {
|
|
|
33
26
|
});
|
|
34
27
|
}
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
async render(content: string, data?: Record<string, any>): Promise<string> {
|
|
29
|
+
async render(content, data) {
|
|
38
30
|
try {
|
|
39
31
|
return new Promise((resolve, reject) => {
|
|
40
|
-
this.env.renderString(content, data || {}, (err
|
|
32
|
+
this.env.renderString(content, data || {}, (err, result) => {
|
|
41
33
|
if (err) {
|
|
42
34
|
reject(err);
|
|
43
|
-
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
44
37
|
resolve(result);
|
|
45
38
|
}
|
|
46
39
|
});
|
|
47
40
|
});
|
|
48
|
-
}
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
49
43
|
throw new Error(`Failed to render Nunjucks template: ${error?.message || 'Unknown error'}`);
|
|
50
44
|
}
|
|
51
45
|
}
|
|
52
|
-
|
|
53
|
-
async validate(content: string): Promise<boolean> {
|
|
46
|
+
async validate(content) {
|
|
54
47
|
try {
|
|
55
48
|
// Use renderString with empty data to validate the template
|
|
56
49
|
await this.render(content, {});
|
|
57
50
|
return true;
|
|
58
|
-
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
59
53
|
return false;
|
|
60
54
|
}
|
|
61
55
|
}
|
|
62
|
-
|
|
63
|
-
registerFilter(name: string, filter: (...args: any[]) => any) {
|
|
56
|
+
registerFilter(name, filter) {
|
|
64
57
|
this.env.addFilter(name, filter);
|
|
65
58
|
}
|
|
66
|
-
|
|
67
|
-
registerGlobal(name: string, global: (...args: any[]) => any) {
|
|
59
|
+
registerGlobal(name, global) {
|
|
68
60
|
this.env.addGlobal(name, global);
|
|
69
61
|
}
|
|
70
62
|
}
|
|
63
|
+
exports.NunjucksEngine = NunjucksEngine;
|
|
64
|
+
NunjucksEngine.engineName = template_types_1.TemplateEngineEnum.NUNJUCKS;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Options } from 'pug';
|
|
2
|
+
import { TemplateEngineEnum } from '../../interfaces/template.types';
|
|
3
|
+
import { TemplateEngine } from '../template-engine';
|
|
4
|
+
import { CustomEngineOptions, EngineOptions } from '../../interfaces/module-config.interface';
|
|
5
|
+
export declare class PugEngine extends TemplateEngine {
|
|
6
|
+
private customOptions?;
|
|
7
|
+
static engineName: TemplateEngineEnum;
|
|
8
|
+
private options;
|
|
9
|
+
constructor(options?: EngineOptions<Options>, customOptions?: CustomEngineOptions);
|
|
10
|
+
render(content: string, data: any): Promise<string>;
|
|
11
|
+
validate(content: string): Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=pug.engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pug.engine.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nest-dynamic-templates/src/lib/engines/template/pug.engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9F,qBAAa,SAAU,SAAQ,cAAc;IAMK,OAAO,CAAC,aAAa,CAAC;IAJpE,OAAgB,UAAU,qBAA0B;IAEpD,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,EAAU,aAAa,CAAC,EAAE,mBAAmB;IAKnF,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBnD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CASpD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PugEngine = void 0;
|
|
37
|
+
const template_types_1 = require("../../interfaces/template.types");
|
|
38
|
+
const template_engine_1 = require("../template-engine");
|
|
39
|
+
class PugEngine extends template_engine_1.TemplateEngine {
|
|
40
|
+
constructor(options, customOptions) {
|
|
41
|
+
super();
|
|
42
|
+
this.customOptions = customOptions;
|
|
43
|
+
this.options = options || {};
|
|
44
|
+
}
|
|
45
|
+
async render(content, data) {
|
|
46
|
+
try {
|
|
47
|
+
const pug = await Promise.resolve().then(() => __importStar(require('pug')));
|
|
48
|
+
const template = pug.compile(content, {
|
|
49
|
+
...this.options,
|
|
50
|
+
filters: this.customOptions?.filters
|
|
51
|
+
});
|
|
52
|
+
return template({
|
|
53
|
+
...this.options.filters,
|
|
54
|
+
...data,
|
|
55
|
+
...this.customOptions?.filters
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw new Error(`Failed to render Pug template: ${error?.message || 'Unknown error'}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async validate(content) {
|
|
63
|
+
try {
|
|
64
|
+
const pug = await Promise.resolve().then(() => __importStar(require('pug')));
|
|
65
|
+
pug.compile(content, this.options);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.PugEngine = PugEngine;
|
|
74
|
+
PugEngine.engineName = template_types_1.TemplateEngineEnum.PUG;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export abstract class TemplateEngine {
|
|
3
|
-
|
|
1
|
+
export declare abstract class TemplateEngine {
|
|
4
2
|
static engineName: string;
|
|
5
|
-
|
|
6
3
|
abstract render(content: string, data?: Record<string, any>): Promise<string>;
|
|
7
|
-
|
|
8
4
|
abstract validate(content: string): Promise<boolean>;
|
|
9
|
-
|
|
10
5
|
}
|
|
6
|
+
//# sourceMappingURL=template-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-engine.d.ts","sourceRoot":"","sources":["../../../../../../packages/nest-dynamic-templates/src/lib/engines/template-engine.ts"],"names":[],"mappings":"AACA,8BAAsB,cAAc;IAEhC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAE7E,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAEvD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseEntity } from 'typeorm';
|
|
2
|
+
import { TemplateEngineEnum, TemplateLanguageEnum } from '../interfaces/template.types';
|
|
3
|
+
export declare class NestDynamicTemplateLayout extends BaseEntity {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
displayName?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
engine: TemplateEngineEnum;
|
|
10
|
+
language?: TemplateLanguageEnum;
|
|
11
|
+
content: string;
|
|
12
|
+
templateLayoutName?: string;
|
|
13
|
+
scope?: string;
|
|
14
|
+
scopeId?: string;
|
|
15
|
+
locale?: string;
|
|
16
|
+
previewContext?: Record<string, any>;
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=template-layout.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-layout.entity.d.ts","sourceRoot":"","sources":["../../../../../../packages/nest-dynamic-templates/src/lib/entities/template-layout.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqF,UAAU,EAAE,MAAM,SAAS,CAAC;AAExH,OAAO,EAAE,kBAAkB,EAAoB,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAI1G,qBAEa,yBAA0B,SAAQ,UAAU;IAIrD,EAAE,EAAE,MAAM,CAAC;IAOX,IAAI,EAAE,MAAM,CAAC;IAMb,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,IAAI,CAAC,EAAE,MAAM,CAAC;IASd,MAAM,EAAE,kBAAkB,CAAC;IAM3B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAMhC,OAAO,EAAE,MAAM,CAAC;IAMhB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAK5B,KAAK,CAAC,EAAE,MAAM,CAAC;IAKf,OAAO,CAAC,EAAE,MAAM,CAAC;IAKjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAKhB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAKrC,QAAQ,EAAE,OAAO,CAAC;IAIlB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NestDynamicTemplateLayout = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const class_validator_1 = require("class-validator");
|
|
7
|
+
const template_types_1 = require("../interfaces/template.types");
|
|
8
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
9
|
+
let NestDynamicTemplateLayout = class NestDynamicTemplateLayout extends typeorm_1.BaseEntity {
|
|
10
|
+
};
|
|
11
|
+
exports.NestDynamicTemplateLayout = NestDynamicTemplateLayout;
|
|
12
|
+
tslib_1.__decorate([
|
|
13
|
+
(0, swagger_1.ApiProperty)({ type: String, format: 'uuid', readOnly: true }),
|
|
14
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
16
|
+
], NestDynamicTemplateLayout.prototype, "id", void 0);
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
21
|
+
(0, class_validator_1.Matches)(/^[a-z0-9\-_]+$/, { message: 'Invalid template name format' }),
|
|
22
|
+
(0, typeorm_1.Column)(),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], NestDynamicTemplateLayout.prototype, "name", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
30
|
+
tslib_1.__metadata("design:type", String)
|
|
31
|
+
], NestDynamicTemplateLayout.prototype, "displayName", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
(0, class_validator_1.IsOptional)(),
|
|
36
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
38
|
+
], NestDynamicTemplateLayout.prototype, "description", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
44
|
+
tslib_1.__metadata("design:type", String)
|
|
45
|
+
], NestDynamicTemplateLayout.prototype, "type", void 0);
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateEngineEnum, type: String }),
|
|
48
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateEngineEnum),
|
|
49
|
+
(0, typeorm_1.Column)({
|
|
50
|
+
type: 'text',
|
|
51
|
+
enum: template_types_1.TemplateEngineEnum,
|
|
52
|
+
default: template_types_1.TemplateEngineEnum.NUNJUCKS
|
|
53
|
+
}),
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
|
+
], NestDynamicTemplateLayout.prototype, "engine", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateLanguageEnum, type: String, nullable: true }),
|
|
58
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateLanguageEnum),
|
|
59
|
+
(0, class_validator_1.IsOptional)(),
|
|
60
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
61
|
+
tslib_1.__metadata("design:type", String)
|
|
62
|
+
], NestDynamicTemplateLayout.prototype, "language", void 0);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
(0, class_validator_1.IsOptional)(),
|
|
67
|
+
(0, typeorm_1.Column)('text'),
|
|
68
|
+
tslib_1.__metadata("design:type", String)
|
|
69
|
+
], NestDynamicTemplateLayout.prototype, "content", void 0);
|
|
70
|
+
tslib_1.__decorate([
|
|
71
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
72
|
+
(0, class_validator_1.IsString)(),
|
|
73
|
+
(0, class_validator_1.IsOptional)(),
|
|
74
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
75
|
+
tslib_1.__metadata("design:type", String)
|
|
76
|
+
], NestDynamicTemplateLayout.prototype, "templateLayoutName", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
79
|
+
(0, class_validator_1.IsString)(),
|
|
80
|
+
(0, typeorm_1.Column)({ nullable: true, default: 'system' }),
|
|
81
|
+
tslib_1.__metadata("design:type", String)
|
|
82
|
+
], NestDynamicTemplateLayout.prototype, "scope", void 0);
|
|
83
|
+
tslib_1.__decorate([
|
|
84
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
85
|
+
(0, class_validator_1.IsString)(),
|
|
86
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
87
|
+
tslib_1.__metadata("design:type", String)
|
|
88
|
+
], NestDynamicTemplateLayout.prototype, "scopeId", void 0);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
91
|
+
(0, class_validator_1.IsString)(),
|
|
92
|
+
(0, typeorm_1.Column)({ nullable: true, default: 'en' }),
|
|
93
|
+
tslib_1.__metadata("design:type", String)
|
|
94
|
+
], NestDynamicTemplateLayout.prototype, "locale", void 0);
|
|
95
|
+
tslib_1.__decorate([
|
|
96
|
+
(0, swagger_1.ApiProperty)({ type: Object, nullable: true }),
|
|
97
|
+
(0, class_validator_1.IsOptional)(),
|
|
98
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
99
|
+
tslib_1.__metadata("design:type", Object)
|
|
100
|
+
], NestDynamicTemplateLayout.prototype, "previewContext", void 0);
|
|
101
|
+
tslib_1.__decorate([
|
|
102
|
+
(0, swagger_1.ApiProperty)({ type: Boolean }),
|
|
103
|
+
(0, class_validator_1.IsBoolean)(),
|
|
104
|
+
(0, typeorm_1.Column)({ default: true }),
|
|
105
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
106
|
+
], NestDynamicTemplateLayout.prototype, "isActive", void 0);
|
|
107
|
+
tslib_1.__decorate([
|
|
108
|
+
(0, swagger_1.ApiProperty)({ type: Date, readOnly: true }),
|
|
109
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
110
|
+
tslib_1.__metadata("design:type", Date)
|
|
111
|
+
], NestDynamicTemplateLayout.prototype, "createdAt", void 0);
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
(0, swagger_1.ApiProperty)({ type: Date, readOnly: true }),
|
|
114
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
115
|
+
tslib_1.__metadata("design:type", Date)
|
|
116
|
+
], NestDynamicTemplateLayout.prototype, "updatedAt", void 0);
|
|
117
|
+
exports.NestDynamicTemplateLayout = NestDynamicTemplateLayout = tslib_1.__decorate([
|
|
118
|
+
(0, typeorm_1.Entity)('nest_dynamic_template_layouts'),
|
|
119
|
+
(0, typeorm_1.Index)(['name', 'scope', 'scopeId', 'locale'], { unique: true })
|
|
120
|
+
], NestDynamicTemplateLayout);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseEntity } from 'typeorm';
|
|
2
|
+
import { TemplateEngineEnum, TemplateLanguageEnum } from '../interfaces/template.types';
|
|
3
|
+
export declare class NestDynamicTemplate extends BaseEntity {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
displayName?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
engine: TemplateEngineEnum;
|
|
10
|
+
language?: TemplateLanguageEnum;
|
|
11
|
+
subject?: string;
|
|
12
|
+
content: string;
|
|
13
|
+
templateLayoutName?: string;
|
|
14
|
+
scope?: string;
|
|
15
|
+
scopeId?: string;
|
|
16
|
+
locale?: string;
|
|
17
|
+
previewContext?: Record<string, any>;
|
|
18
|
+
isActive: boolean;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=template.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.entity.d.ts","sourceRoot":"","sources":["../../../../../../packages/nest-dynamic-templates/src/lib/entities/template.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwH,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3J,OAAO,EAAoB,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAK1G,qBAEa,mBAAoB,SAAQ,UAAU;IAI/C,EAAE,EAAE,MAAM,CAAC;IAOX,IAAI,EAAE,MAAM,CAAC;IAMb,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,IAAI,CAAC,EAAE,MAAM,CAAC;IASd,MAAM,EAAE,kBAAkB,CAAC;IAM3B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAMhC,OAAO,CAAC,EAAE,MAAM,CAAC;IAMjB,OAAO,EAAE,MAAM,CAAC;IAMhB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAK5B,KAAK,CAAC,EAAE,MAAM,CAAC;IAKf,OAAO,CAAC,EAAE,MAAM,CAAC;IAKjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAKhB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAKrC,QAAQ,EAAE,OAAO,CAAC;IAIlB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NestDynamicTemplate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const template_types_1 = require("../interfaces/template.types");
|
|
7
|
+
const class_validator_1 = require("class-validator");
|
|
8
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
9
|
+
let NestDynamicTemplate = class NestDynamicTemplate extends typeorm_1.BaseEntity {
|
|
10
|
+
};
|
|
11
|
+
exports.NestDynamicTemplate = NestDynamicTemplate;
|
|
12
|
+
tslib_1.__decorate([
|
|
13
|
+
(0, swagger_1.ApiProperty)({ type: String, format: 'uuid', readOnly: true }),
|
|
14
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
16
|
+
], NestDynamicTemplate.prototype, "id", void 0);
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
21
|
+
(0, class_validator_1.Matches)(/^[a-z0-9\-_]+$/, { message: 'Invalid template name format' }),
|
|
22
|
+
(0, typeorm_1.Column)(),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], NestDynamicTemplate.prototype, "name", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
30
|
+
tslib_1.__metadata("design:type", String)
|
|
31
|
+
], NestDynamicTemplate.prototype, "displayName", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
(0, class_validator_1.IsOptional)(),
|
|
36
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
38
|
+
], NestDynamicTemplate.prototype, "description", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
44
|
+
tslib_1.__metadata("design:type", String)
|
|
45
|
+
], NestDynamicTemplate.prototype, "type", void 0);
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateEngineEnum, type: String }),
|
|
48
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateEngineEnum),
|
|
49
|
+
(0, typeorm_1.Column)({
|
|
50
|
+
type: 'text',
|
|
51
|
+
enum: template_types_1.TemplateEngineEnum,
|
|
52
|
+
default: template_types_1.TemplateEngineEnum.NUNJUCKS
|
|
53
|
+
}),
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
|
+
], NestDynamicTemplate.prototype, "engine", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateLanguageEnum, type: String, nullable: true }),
|
|
58
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateLanguageEnum),
|
|
59
|
+
(0, class_validator_1.IsOptional)(),
|
|
60
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
61
|
+
tslib_1.__metadata("design:type", String)
|
|
62
|
+
], NestDynamicTemplate.prototype, "language", void 0);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
(0, class_validator_1.IsOptional)(),
|
|
67
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
68
|
+
tslib_1.__metadata("design:type", String)
|
|
69
|
+
], NestDynamicTemplate.prototype, "subject", void 0);
|
|
70
|
+
tslib_1.__decorate([
|
|
71
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
72
|
+
(0, class_validator_1.IsString)(),
|
|
73
|
+
(0, class_validator_1.IsOptional)(),
|
|
74
|
+
(0, typeorm_1.Column)('text'),
|
|
75
|
+
tslib_1.__metadata("design:type", String)
|
|
76
|
+
], NestDynamicTemplate.prototype, "content", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
79
|
+
(0, class_validator_1.IsString)(),
|
|
80
|
+
(0, class_validator_1.IsOptional)(),
|
|
81
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
82
|
+
tslib_1.__metadata("design:type", String)
|
|
83
|
+
], NestDynamicTemplate.prototype, "templateLayoutName", void 0);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
86
|
+
(0, class_validator_1.IsString)(),
|
|
87
|
+
(0, typeorm_1.Column)({ nullable: true, default: 'system' }),
|
|
88
|
+
tslib_1.__metadata("design:type", String)
|
|
89
|
+
], NestDynamicTemplate.prototype, "scope", void 0);
|
|
90
|
+
tslib_1.__decorate([
|
|
91
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
92
|
+
(0, class_validator_1.IsString)(),
|
|
93
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
94
|
+
tslib_1.__metadata("design:type", String)
|
|
95
|
+
], NestDynamicTemplate.prototype, "scopeId", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
98
|
+
(0, class_validator_1.IsString)(),
|
|
99
|
+
(0, typeorm_1.Column)({ nullable: true, default: 'en' }),
|
|
100
|
+
tslib_1.__metadata("design:type", String)
|
|
101
|
+
], NestDynamicTemplate.prototype, "locale", void 0);
|
|
102
|
+
tslib_1.__decorate([
|
|
103
|
+
(0, swagger_1.ApiProperty)({ type: Object, nullable: true }),
|
|
104
|
+
(0, class_validator_1.IsOptional)(),
|
|
105
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
106
|
+
tslib_1.__metadata("design:type", Object)
|
|
107
|
+
], NestDynamicTemplate.prototype, "previewContext", void 0);
|
|
108
|
+
tslib_1.__decorate([
|
|
109
|
+
(0, swagger_1.ApiProperty)({ type: Boolean }),
|
|
110
|
+
(0, class_validator_1.IsBoolean)(),
|
|
111
|
+
(0, typeorm_1.Column)({ default: true }),
|
|
112
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
113
|
+
], NestDynamicTemplate.prototype, "isActive", void 0);
|
|
114
|
+
tslib_1.__decorate([
|
|
115
|
+
(0, swagger_1.ApiProperty)({ type: Date, readOnly: true }),
|
|
116
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
117
|
+
tslib_1.__metadata("design:type", Date)
|
|
118
|
+
], NestDynamicTemplate.prototype, "createdAt", void 0);
|
|
119
|
+
tslib_1.__decorate([
|
|
120
|
+
(0, swagger_1.ApiProperty)({ type: Date, readOnly: true }),
|
|
121
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
122
|
+
tslib_1.__metadata("design:type", Date)
|
|
123
|
+
], NestDynamicTemplate.prototype, "updatedAt", void 0);
|
|
124
|
+
exports.NestDynamicTemplate = NestDynamicTemplate = tslib_1.__decorate([
|
|
125
|
+
(0, typeorm_1.Entity)('nest_dynamic_templates'),
|
|
126
|
+
(0, typeorm_1.Index)(['name', 'scope', 'scopeId', 'locale'], { unique: true })
|
|
127
|
+
], NestDynamicTemplate);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BadRequestException, InternalServerErrorException } from '@nestjs/common';
|
|
2
|
+
export declare class TemplateRenderError extends InternalServerErrorException {
|
|
3
|
+
constructor(operation: string, originalError: Error, templateName?: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class TemplateEngineError extends InternalServerErrorException {
|
|
6
|
+
constructor(engine: string, originalError: Error);
|
|
7
|
+
}
|
|
8
|
+
export declare class TemplateLanguageError extends InternalServerErrorException {
|
|
9
|
+
constructor(language: string, originalError: Error);
|
|
10
|
+
}
|
|
11
|
+
export declare class TemplateLayoutError extends InternalServerErrorException {
|
|
12
|
+
constructor(layoutName: string, originalError: Error);
|
|
13
|
+
}
|
|
14
|
+
export declare class TemplateContentError extends InternalServerErrorException {
|
|
15
|
+
constructor(contentType: string, originalError: Error);
|
|
16
|
+
}
|
|
17
|
+
export declare class TemplateValidationError extends BadRequestException {
|
|
18
|
+
constructor(field: string, value: any, reason: string);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=template.errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.errors.d.ts","sourceRoot":"","sources":["../../../../../../packages/nest-dynamic-templates/src/lib/errors/template.errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAEnF,qBAAa,mBAAoB,SAAQ,4BAA4B;gBACrD,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,CAAC,EAAE,MAAM;CAa7E;AAED,qBAAa,mBAAoB,SAAQ,4BAA4B;gBACrD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK;CAQnD;AAED,qBAAa,qBAAsB,SAAQ,4BAA4B;gBACvD,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK;CAQrD;AAED,qBAAa,mBAAoB,SAAQ,4BAA4B;gBACrD,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK;CAQvD;AAED,qBAAa,oBAAqB,SAAQ,4BAA4B;gBACtD,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK;CAQxD;AAED,qBAAa,uBAAwB,SAAQ,mBAAmB;gBAChD,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;CASxD"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateValidationError = exports.TemplateContentError = exports.TemplateLayoutError = exports.TemplateLanguageError = exports.TemplateEngineError = exports.TemplateRenderError = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
class TemplateRenderError extends common_1.InternalServerErrorException {
|
|
6
|
+
constructor(operation, originalError, templateName) {
|
|
5
7
|
const message = templateName
|
|
6
8
|
? `Failed to render template '${templateName}' during ${operation}: ${originalError.message}`
|
|
7
9
|
: `Failed to render content during ${operation}: ${originalError.message}`;
|
|
8
|
-
|
|
9
10
|
super({
|
|
10
11
|
message,
|
|
11
12
|
error: 'TEMPLATE_RENDER_ERROR',
|
|
@@ -15,9 +16,9 @@ export class TemplateRenderError extends InternalServerErrorException {
|
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
constructor(engine
|
|
19
|
+
exports.TemplateRenderError = TemplateRenderError;
|
|
20
|
+
class TemplateEngineError extends common_1.InternalServerErrorException {
|
|
21
|
+
constructor(engine, originalError) {
|
|
21
22
|
super({
|
|
22
23
|
message: `Template engine '${engine}' failed to render content: ${originalError.message}`,
|
|
23
24
|
error: 'TEMPLATE_ENGINE_ERROR',
|
|
@@ -26,9 +27,9 @@ export class TemplateEngineError extends InternalServerErrorException {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
constructor(language
|
|
30
|
+
exports.TemplateEngineError = TemplateEngineError;
|
|
31
|
+
class TemplateLanguageError extends common_1.InternalServerErrorException {
|
|
32
|
+
constructor(language, originalError) {
|
|
32
33
|
super({
|
|
33
34
|
message: `Language processor '${language}' failed to render content: ${originalError.message}`,
|
|
34
35
|
error: 'TEMPLATE_LANGUAGE_ERROR',
|
|
@@ -37,9 +38,9 @@ export class TemplateLanguageError extends InternalServerErrorException {
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
constructor(layoutName
|
|
41
|
+
exports.TemplateLanguageError = TemplateLanguageError;
|
|
42
|
+
class TemplateLayoutError extends common_1.InternalServerErrorException {
|
|
43
|
+
constructor(layoutName, originalError) {
|
|
43
44
|
super({
|
|
44
45
|
message: `Template layout '${layoutName}' failed to render: ${originalError.message}`,
|
|
45
46
|
error: 'TEMPLATE_LAYOUT_ERROR',
|
|
@@ -48,9 +49,9 @@ export class TemplateLayoutError extends InternalServerErrorException {
|
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
constructor(contentType
|
|
52
|
+
exports.TemplateLayoutError = TemplateLayoutError;
|
|
53
|
+
class TemplateContentError extends common_1.InternalServerErrorException {
|
|
54
|
+
constructor(contentType, originalError) {
|
|
54
55
|
super({
|
|
55
56
|
message: `Failed to process ${contentType} content: ${originalError.message}`,
|
|
56
57
|
error: 'TEMPLATE_CONTENT_ERROR',
|
|
@@ -59,9 +60,9 @@ export class TemplateContentError extends InternalServerErrorException {
|
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
constructor(field
|
|
63
|
+
exports.TemplateContentError = TemplateContentError;
|
|
64
|
+
class TemplateValidationError extends common_1.BadRequestException {
|
|
65
|
+
constructor(field, value, reason) {
|
|
65
66
|
super({
|
|
66
67
|
message: `Template validation failed for field '${field}': ${reason}`,
|
|
67
68
|
error: 'TEMPLATE_VALIDATION_ERROR',
|
|
@@ -71,3 +72,4 @@ export class TemplateValidationError extends BadRequestException {
|
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
}
|
|
75
|
+
exports.TemplateValidationError = TemplateValidationError;
|