@ackplus/nest-dynamic-templates 1.1.2 → 1.1.6
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 +1 -1
- package/src/index.js +25 -0
- package/src/lib/constant.js +5 -0
- package/src/lib/dto/create-template-layout.dto.js +86 -0
- package/src/lib/dto/create-template.dto.js +103 -0
- package/src/lib/dto/render-content-template-layout.dto.js +40 -0
- package/src/lib/dto/render-content-template.dto.js +46 -0
- package/src/lib/dto/render-template-layout.dto.js +66 -0
- package/src/lib/dto/render-template.dto.js +90 -0
- package/src/lib/dto/template-filter.dto.js +61 -0
- package/src/lib/dto/template-layout-filter.dto.js +60 -0
- package/src/lib/engines/language/html.engine.js +80 -0
- package/src/lib/engines/language/index.js +11 -0
- package/src/lib/engines/language/markdown.engine.js +39 -0
- package/src/lib/engines/language/mjml.engine.js +75 -0
- package/src/lib/engines/language/text.engine.js +15 -0
- package/src/lib/engines/language-engine.js +6 -0
- package/src/lib/engines/template/ejs.engine.js +65 -0
- package/src/lib/engines/template/handlebars.engine.js +66 -0
- package/src/lib/engines/template/index.js +11 -0
- package/src/lib/engines/template/nunjucks.engine.js +64 -0
- package/src/lib/engines/template/pug.engine.js +74 -0
- package/src/lib/engines/template-engine.js +6 -0
- package/src/lib/entities/template-layout.entity.js +120 -0
- package/src/lib/entities/template.entity.js +127 -0
- package/src/lib/errors/template.errors.js +75 -0
- package/src/lib/interfaces/module-config.interface.js +2 -0
- package/src/lib/interfaces/template.types.js +24 -0
- package/src/lib/nest-dynamic-templates.module.js +131 -0
- package/src/lib/services/template-config.service.js +101 -0
- package/src/lib/services/template-engine.registry.js +93 -0
- package/src/lib/services/template-layout.service.js +343 -0
- package/src/lib/services/template.service.js +414 -0
- package/src/test/helpers.js +33 -0
- package/src/test/test-database.config.js +23 -0
- package/src/test/test.setup.js +30 -0
package/package.json
CHANGED
package/src/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NestDynamicTemplatesEntities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const template_layout_entity_1 = require("./lib/entities/template-layout.entity");
|
|
6
|
+
const template_entity_1 = require("./lib/entities/template.entity");
|
|
7
|
+
tslib_1.__exportStar(require("./lib/nest-dynamic-templates.module"), exports);
|
|
8
|
+
// Services
|
|
9
|
+
tslib_1.__exportStar(require("./lib/services/template.service"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./lib/services/template-layout.service"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./lib/services/template-config.service"), exports);
|
|
12
|
+
// Interfaces
|
|
13
|
+
tslib_1.__exportStar(require("./lib/interfaces/module-config.interface"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./lib/interfaces/template.types"), exports);
|
|
15
|
+
// DTOs
|
|
16
|
+
tslib_1.__exportStar(require("./lib/dto/create-template.dto"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./lib/dto/render-template.dto"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./lib/dto/template-filter.dto"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./lib/dto/create-template-layout.dto"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./lib/dto/render-template-layout.dto"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./lib/dto/template-layout-filter.dto"), exports);
|
|
22
|
+
exports.NestDynamicTemplatesEntities = [
|
|
23
|
+
template_entity_1.NestDynamicTemplate,
|
|
24
|
+
template_layout_entity_1.NestDynamicTemplateLayout,
|
|
25
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NEST_DYNAMIC_TEMPLATES_ASYNC_OPTIONS_PROVIDER = exports.NEST_DYNAMIC_TEMPLATES_MODULE_CONFIG = void 0;
|
|
4
|
+
exports.NEST_DYNAMIC_TEMPLATES_MODULE_CONFIG = Symbol('NEST_DYNAMIC_TEMPLATES_MODULE_CONFIG');
|
|
5
|
+
exports.NEST_DYNAMIC_TEMPLATES_ASYNC_OPTIONS_PROVIDER = 'NEST_DYNAMIC_TEMPLATES_ASYNC_OPTIONS_PROVIDER';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateTemplateLayoutDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const template_types_1 = require("../interfaces/template.types");
|
|
7
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
+
class CreateTemplateLayoutDto {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.engine = template_types_1.TemplateEngineEnum.NUNJUCKS;
|
|
11
|
+
this.scope = 'system';
|
|
12
|
+
this.locale = 'en';
|
|
13
|
+
this.isActive = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.CreateTemplateLayoutDto = CreateTemplateLayoutDto;
|
|
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
|
+
tslib_1.__metadata("design:type", String)
|
|
23
|
+
], CreateTemplateLayoutDto.prototype, "name", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
tslib_1.__metadata("design:type", String)
|
|
29
|
+
], CreateTemplateLayoutDto.prototype, "type", void 0);
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String }),
|
|
32
|
+
(0, class_validator_1.IsString)(),
|
|
33
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
34
|
+
tslib_1.__metadata("design:type", String)
|
|
35
|
+
], CreateTemplateLayoutDto.prototype, "displayName", void 0);
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
(0, class_validator_1.IsOptional)(),
|
|
40
|
+
tslib_1.__metadata("design:type", String)
|
|
41
|
+
], CreateTemplateLayoutDto.prototype, "description", void 0);
|
|
42
|
+
tslib_1.__decorate([
|
|
43
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateEngineEnum, type: String }),
|
|
44
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateEngineEnum),
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
47
|
+
], CreateTemplateLayoutDto.prototype, "engine", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateLanguageEnum, type: String }),
|
|
50
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateLanguageEnum),
|
|
51
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
52
|
+
tslib_1.__metadata("design:type", String)
|
|
53
|
+
], CreateTemplateLayoutDto.prototype, "language", void 0);
|
|
54
|
+
tslib_1.__decorate([
|
|
55
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
56
|
+
(0, class_validator_1.IsString)(),
|
|
57
|
+
tslib_1.__metadata("design:type", String)
|
|
58
|
+
], CreateTemplateLayoutDto.prototype, "content", void 0);
|
|
59
|
+
tslib_1.__decorate([
|
|
60
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, default: 'system' }),
|
|
61
|
+
(0, class_validator_1.IsString)(),
|
|
62
|
+
(0, class_validator_1.IsOptional)(),
|
|
63
|
+
tslib_1.__metadata("design:type", String)
|
|
64
|
+
], CreateTemplateLayoutDto.prototype, "scope", void 0);
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String }),
|
|
67
|
+
(0, class_validator_1.IsString)(),
|
|
68
|
+
(0, class_validator_1.IsOptional)(),
|
|
69
|
+
tslib_1.__metadata("design:type", String)
|
|
70
|
+
], CreateTemplateLayoutDto.prototype, "scopeId", void 0);
|
|
71
|
+
tslib_1.__decorate([
|
|
72
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, nullable: true, default: 'en' }),
|
|
73
|
+
(0, class_validator_1.IsString)(),
|
|
74
|
+
(0, class_validator_1.IsOptional)(),
|
|
75
|
+
tslib_1.__metadata("design:type", String)
|
|
76
|
+
], CreateTemplateLayoutDto.prototype, "locale", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, swagger_1.ApiPropertyOptional)({ type: Object, nullable: true }),
|
|
79
|
+
(0, class_validator_1.IsOptional)(),
|
|
80
|
+
tslib_1.__metadata("design:type", Object)
|
|
81
|
+
], CreateTemplateLayoutDto.prototype, "previewContext", void 0);
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
(0, swagger_1.ApiPropertyOptional)({ type: Boolean, nullable: true }),
|
|
84
|
+
(0, class_validator_1.IsOptional)(),
|
|
85
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
86
|
+
], CreateTemplateLayoutDto.prototype, "isActive", void 0);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateTemplateDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const template_types_1 = require("../interfaces/template.types");
|
|
7
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
+
const class_transformer_1 = require("class-transformer");
|
|
9
|
+
class CreateTemplateDto {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.engine = template_types_1.TemplateEngineEnum.NUNJUCKS;
|
|
12
|
+
this.scope = 'system';
|
|
13
|
+
this.locale = 'en';
|
|
14
|
+
this.isActive = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CreateTemplateDto = CreateTemplateDto;
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
20
|
+
(0, class_validator_1.IsString)(),
|
|
21
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
22
|
+
(0, class_validator_1.Matches)(/^[a-z0-9\-_]+$/, { message: 'Invalid template name format' }),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], CreateTemplateDto.prototype, "name", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, nullable: true }),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], CreateTemplateDto.prototype, "templateLayoutName", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsOptional)(),
|
|
35
|
+
tslib_1.__metadata("design:type", String)
|
|
36
|
+
], CreateTemplateDto.prototype, "type", void 0);
|
|
37
|
+
tslib_1.__decorate([
|
|
38
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String }),
|
|
39
|
+
(0, class_validator_1.IsString)(),
|
|
40
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
42
|
+
], CreateTemplateDto.prototype, "displayName", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
45
|
+
(0, class_validator_1.IsString)(),
|
|
46
|
+
(0, class_validator_1.IsOptional)(),
|
|
47
|
+
tslib_1.__metadata("design:type", String)
|
|
48
|
+
], CreateTemplateDto.prototype, "description", void 0);
|
|
49
|
+
tslib_1.__decorate([
|
|
50
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateEngineEnum, type: String }),
|
|
51
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateEngineEnum),
|
|
52
|
+
(0, class_validator_1.IsOptional)(),
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
54
|
+
], CreateTemplateDto.prototype, "engine", void 0);
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateLanguageEnum, type: String }),
|
|
57
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateLanguageEnum),
|
|
58
|
+
tslib_1.__metadata("design:type", String)
|
|
59
|
+
], CreateTemplateDto.prototype, "language", void 0);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, swagger_1.ApiProperty)({ type: String, nullable: true }),
|
|
62
|
+
(0, class_validator_1.IsString)(),
|
|
63
|
+
(0, class_validator_1.IsOptional)(),
|
|
64
|
+
tslib_1.__metadata("design:type", String)
|
|
65
|
+
], CreateTemplateDto.prototype, "content", void 0);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, nullable: true }),
|
|
68
|
+
(0, class_validator_1.IsString)(),
|
|
69
|
+
(0, class_validator_1.IsOptional)(),
|
|
70
|
+
tslib_1.__metadata("design:type", String)
|
|
71
|
+
], CreateTemplateDto.prototype, "subject", void 0);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, default: 'system' }),
|
|
74
|
+
(0, class_validator_1.IsString)(),
|
|
75
|
+
(0, class_validator_1.IsOptional)(),
|
|
76
|
+
(0, class_transformer_1.Transform)(({ value }) => value || 'system'),
|
|
77
|
+
tslib_1.__metadata("design:type", String)
|
|
78
|
+
], CreateTemplateDto.prototype, "scope", void 0);
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String }),
|
|
81
|
+
(0, class_validator_1.IsString)(),
|
|
82
|
+
(0, class_validator_1.IsOptional)(),
|
|
83
|
+
tslib_1.__metadata("design:type", String)
|
|
84
|
+
], CreateTemplateDto.prototype, "scopeId", void 0);
|
|
85
|
+
tslib_1.__decorate([
|
|
86
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String, nullable: true, default: 'en' }),
|
|
87
|
+
(0, class_validator_1.IsString)(),
|
|
88
|
+
(0, class_validator_1.IsOptional)(),
|
|
89
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
90
|
+
(0, class_transformer_1.Transform)(({ value }) => value || 'en'),
|
|
91
|
+
tslib_1.__metadata("design:type", String)
|
|
92
|
+
], CreateTemplateDto.prototype, "locale", void 0);
|
|
93
|
+
tslib_1.__decorate([
|
|
94
|
+
(0, swagger_1.ApiPropertyOptional)({ type: Object, nullable: true }),
|
|
95
|
+
(0, class_validator_1.IsOptional)(),
|
|
96
|
+
tslib_1.__metadata("design:type", Object)
|
|
97
|
+
], CreateTemplateDto.prototype, "previewContext", void 0);
|
|
98
|
+
tslib_1.__decorate([
|
|
99
|
+
(0, swagger_1.ApiPropertyOptional)({ type: Boolean, nullable: true }),
|
|
100
|
+
(0, class_validator_1.IsBoolean)(),
|
|
101
|
+
(0, class_validator_1.IsOptional)(),
|
|
102
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
103
|
+
], CreateTemplateDto.prototype, "isActive", void 0);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderContentTemplateLayoutDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const template_types_1 = require("../interfaces/template.types");
|
|
7
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
+
const class_transformer_1 = require("class-transformer");
|
|
9
|
+
class RenderContentTemplateLayoutDto {
|
|
10
|
+
}
|
|
11
|
+
exports.RenderContentTemplateLayoutDto = RenderContentTemplateLayoutDto;
|
|
12
|
+
tslib_1.__decorate([
|
|
13
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
14
|
+
(0, class_validator_1.IsString)(),
|
|
15
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
16
|
+
tslib_1.__metadata("design:type", String)
|
|
17
|
+
], RenderContentTemplateLayoutDto.prototype, "content", void 0);
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateLanguageEnum, type: String }),
|
|
20
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateLanguageEnum),
|
|
21
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
22
|
+
(0, class_transformer_1.Transform)(({ value }) => value || template_types_1.TemplateLanguageEnum.HTML),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], RenderContentTemplateLayoutDto.prototype, "language", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateEngineEnum, type: String }),
|
|
27
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateEngineEnum),
|
|
28
|
+
(0, class_transformer_1.Transform)(({ value }) => value || template_types_1.TemplateEngineEnum.NUNJUCKS),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], RenderContentTemplateLayoutDto.prototype, "engine", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
33
|
+
type: String,
|
|
34
|
+
nullable: true,
|
|
35
|
+
description: 'The context of the template'
|
|
36
|
+
}),
|
|
37
|
+
(0, class_validator_1.IsObject)(),
|
|
38
|
+
(0, class_validator_1.IsOptional)(),
|
|
39
|
+
tslib_1.__metadata("design:type", Object)
|
|
40
|
+
], RenderContentTemplateLayoutDto.prototype, "context", void 0);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderContentTemplateDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const template_types_1 = require("../interfaces/template.types");
|
|
7
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
+
const class_transformer_1 = require("class-transformer");
|
|
9
|
+
class RenderContentTemplateDto {
|
|
10
|
+
}
|
|
11
|
+
exports.RenderContentTemplateDto = RenderContentTemplateDto;
|
|
12
|
+
tslib_1.__decorate([
|
|
13
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
14
|
+
(0, class_validator_1.IsString)(),
|
|
15
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
16
|
+
tslib_1.__metadata("design:type", String)
|
|
17
|
+
], RenderContentTemplateDto.prototype, "content", void 0);
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateLanguageEnum, type: String }),
|
|
20
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateLanguageEnum),
|
|
21
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
22
|
+
(0, class_transformer_1.Transform)(({ value }) => value || template_types_1.TemplateLanguageEnum.HTML),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], RenderContentTemplateDto.prototype, "language", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateEngineEnum, type: String }),
|
|
27
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateEngineEnum),
|
|
28
|
+
(0, class_transformer_1.Transform)(({ value }) => value || template_types_1.TemplateEngineEnum.NUNJUCKS),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], RenderContentTemplateDto.prototype, "engine", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
33
|
+
type: String,
|
|
34
|
+
nullable: true,
|
|
35
|
+
description: 'The context of the template'
|
|
36
|
+
}),
|
|
37
|
+
(0, class_validator_1.IsObject)(),
|
|
38
|
+
(0, class_validator_1.IsOptional)(),
|
|
39
|
+
tslib_1.__metadata("design:type", Object)
|
|
40
|
+
], RenderContentTemplateDto.prototype, "context", void 0);
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, swagger_1.ApiPropertyOptional)({ type: String }),
|
|
43
|
+
(0, class_validator_1.IsString)(),
|
|
44
|
+
(0, class_validator_1.IsOptional)(),
|
|
45
|
+
tslib_1.__metadata("design:type", String)
|
|
46
|
+
], RenderContentTemplateDto.prototype, "templateLayoutId", void 0);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderTemplateLayoutOutput = exports.RenderTemplateLayoutDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
7
|
+
class RenderTemplateLayoutDto {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.locale = 'en';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.RenderTemplateLayoutDto = RenderTemplateLayoutDto;
|
|
13
|
+
tslib_1.__decorate([
|
|
14
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'en',
|
|
17
|
+
description: 'The locale code, i.e en, fr, es, etc.'
|
|
18
|
+
}),
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.IsOptional)(),
|
|
21
|
+
tslib_1.__metadata("design:type", String)
|
|
22
|
+
], RenderTemplateLayoutDto.prototype, "locale", void 0);
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
27
|
+
tslib_1.__metadata("design:type", String)
|
|
28
|
+
], RenderTemplateLayoutDto.prototype, "name", void 0);
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
(0, swagger_1.ApiProperty)({
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'system',
|
|
33
|
+
description: 'The scope of the template, i.e user, organization, etc.'
|
|
34
|
+
}),
|
|
35
|
+
(0, class_validator_1.IsString)(),
|
|
36
|
+
tslib_1.__metadata("design:type", String)
|
|
37
|
+
], RenderTemplateLayoutDto.prototype, "scope", void 0);
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
40
|
+
type: String,
|
|
41
|
+
default: null,
|
|
42
|
+
description: 'The scope id of the template, i.e user id, organization id, etc.'
|
|
43
|
+
}),
|
|
44
|
+
(0, class_validator_1.IsString)(),
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
47
|
+
], RenderTemplateLayoutDto.prototype, "scopeId", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
50
|
+
type: String,
|
|
51
|
+
nullable: true,
|
|
52
|
+
description: 'The context of the template'
|
|
53
|
+
}),
|
|
54
|
+
(0, class_validator_1.IsObject)(),
|
|
55
|
+
(0, class_validator_1.IsOptional)(),
|
|
56
|
+
tslib_1.__metadata("design:type", Object)
|
|
57
|
+
], RenderTemplateLayoutDto.prototype, "context", void 0);
|
|
58
|
+
class RenderTemplateLayoutOutput {
|
|
59
|
+
}
|
|
60
|
+
exports.RenderTemplateLayoutOutput = RenderTemplateLayoutOutput;
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
63
|
+
(0, class_validator_1.IsString)(),
|
|
64
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
65
|
+
tslib_1.__metadata("design:type", String)
|
|
66
|
+
], RenderTemplateLayoutOutput.prototype, "content", void 0);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderTemplateOutputDTO = exports.RenderTemplateDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const template_types_1 = require("../interfaces/template.types");
|
|
7
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
+
class RenderTemplateDto {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.locale = 'en';
|
|
11
|
+
this.scope = 'system';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.RenderTemplateDto = RenderTemplateDto;
|
|
15
|
+
tslib_1.__decorate([
|
|
16
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'en',
|
|
19
|
+
description: 'The locale code, i.e en, fr, es, etc.'
|
|
20
|
+
}),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.IsOptional)(),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], RenderTemplateDto.prototype, "locale", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
29
|
+
(0, class_validator_1.ValidateIf)((object, value) => !object?.content),
|
|
30
|
+
tslib_1.__metadata("design:type", String)
|
|
31
|
+
], RenderTemplateDto.prototype, "name", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
36
|
+
(0, class_validator_1.ValidateIf)((object, value) => !object?.name),
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
38
|
+
], RenderTemplateDto.prototype, "content", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateLanguageEnum, type: String }),
|
|
41
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateLanguageEnum),
|
|
42
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
43
|
+
(0, class_validator_1.ValidateIf)((object, value) => !object?.name),
|
|
44
|
+
tslib_1.__metadata("design:type", String)
|
|
45
|
+
], RenderTemplateDto.prototype, "language", void 0);
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'system',
|
|
50
|
+
description: 'The scope of the template, i.e user, organization, etc.'
|
|
51
|
+
}),
|
|
52
|
+
(0, class_validator_1.IsString)(),
|
|
53
|
+
(0, class_validator_1.IsOptional)(),
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
|
+
], RenderTemplateDto.prototype, "scope", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
58
|
+
type: String,
|
|
59
|
+
default: null,
|
|
60
|
+
description: 'The scope id of the template, i.e user id, organization id, etc.'
|
|
61
|
+
}),
|
|
62
|
+
(0, class_validator_1.IsString)(),
|
|
63
|
+
(0, class_validator_1.IsOptional)(),
|
|
64
|
+
tslib_1.__metadata("design:type", String)
|
|
65
|
+
], RenderTemplateDto.prototype, "scopeId", void 0);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
68
|
+
type: String,
|
|
69
|
+
nullable: true,
|
|
70
|
+
description: 'The context of the template'
|
|
71
|
+
}),
|
|
72
|
+
(0, class_validator_1.IsObject)(),
|
|
73
|
+
(0, class_validator_1.IsOptional)(),
|
|
74
|
+
tslib_1.__metadata("design:type", Object)
|
|
75
|
+
], RenderTemplateDto.prototype, "context", void 0);
|
|
76
|
+
class RenderTemplateOutputDTO {
|
|
77
|
+
}
|
|
78
|
+
exports.RenderTemplateOutputDTO = RenderTemplateOutputDTO;
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
81
|
+
(0, class_validator_1.IsString)(),
|
|
82
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
83
|
+
tslib_1.__metadata("design:type", String)
|
|
84
|
+
], RenderTemplateOutputDTO.prototype, "content", void 0);
|
|
85
|
+
tslib_1.__decorate([
|
|
86
|
+
(0, swagger_1.ApiProperty)({ type: String }),
|
|
87
|
+
(0, class_validator_1.IsString)(),
|
|
88
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
89
|
+
tslib_1.__metadata("design:type", String)
|
|
90
|
+
], RenderTemplateOutputDTO.prototype, "subject", void 0);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateFilterDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
7
|
+
const template_types_1 = require("../interfaces/template.types");
|
|
8
|
+
class TemplateFilterDto {
|
|
9
|
+
}
|
|
10
|
+
exports.TemplateFilterDto = TemplateFilterDto;
|
|
11
|
+
tslib_1.__decorate([
|
|
12
|
+
(0, swagger_1.ApiProperty)({
|
|
13
|
+
type: String,
|
|
14
|
+
required: false,
|
|
15
|
+
description: 'Filter by scope (e.g., system, tenant, organization)'
|
|
16
|
+
}),
|
|
17
|
+
(0, class_validator_1.IsString)(),
|
|
18
|
+
(0, class_validator_1.IsOptional)(),
|
|
19
|
+
tslib_1.__metadata("design:type", String)
|
|
20
|
+
], TemplateFilterDto.prototype, "scope", void 0);
|
|
21
|
+
tslib_1.__decorate([
|
|
22
|
+
(0, swagger_1.ApiProperty)({
|
|
23
|
+
type: String,
|
|
24
|
+
required: false,
|
|
25
|
+
description: 'Filter by scope ID (e.g., tenant ID, organization ID)'
|
|
26
|
+
}),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], TemplateFilterDto.prototype, "scopeId", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({
|
|
33
|
+
enum: template_types_1.TemplateTypeEnum,
|
|
34
|
+
required: false,
|
|
35
|
+
description: 'Filter by template type'
|
|
36
|
+
}),
|
|
37
|
+
(0, class_validator_1.IsEnum)(template_types_1.TemplateTypeEnum),
|
|
38
|
+
(0, class_validator_1.IsOptional)(),
|
|
39
|
+
tslib_1.__metadata("design:type", String)
|
|
40
|
+
], TemplateFilterDto.prototype, "type", void 0);
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, swagger_1.ApiProperty)({
|
|
43
|
+
type: String,
|
|
44
|
+
required: false,
|
|
45
|
+
description: 'Filter by locale (e.g., en, fr, es)'
|
|
46
|
+
}),
|
|
47
|
+
(0, class_validator_1.IsString)(),
|
|
48
|
+
(0, class_validator_1.IsOptional)(),
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
50
|
+
], TemplateFilterDto.prototype, "locale", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, swagger_1.ApiProperty)({
|
|
53
|
+
type: [String],
|
|
54
|
+
required: false,
|
|
55
|
+
description: 'Exclude templates with these names'
|
|
56
|
+
}),
|
|
57
|
+
(0, class_validator_1.IsArray)(),
|
|
58
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
59
|
+
(0, class_validator_1.IsOptional)(),
|
|
60
|
+
tslib_1.__metadata("design:type", Array)
|
|
61
|
+
], TemplateFilterDto.prototype, "excludeNames", void 0);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateLayoutFilterDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
7
|
+
class TemplateLayoutFilterDto {
|
|
8
|
+
}
|
|
9
|
+
exports.TemplateLayoutFilterDto = TemplateLayoutFilterDto;
|
|
10
|
+
tslib_1.__decorate([
|
|
11
|
+
(0, swagger_1.ApiProperty)({
|
|
12
|
+
type: String,
|
|
13
|
+
required: false,
|
|
14
|
+
description: 'Filter by scope (e.g., system, tenant, organization)'
|
|
15
|
+
}),
|
|
16
|
+
(0, class_validator_1.IsString)(),
|
|
17
|
+
(0, class_validator_1.IsOptional)(),
|
|
18
|
+
tslib_1.__metadata("design:type", String)
|
|
19
|
+
], TemplateLayoutFilterDto.prototype, "scope", void 0);
|
|
20
|
+
tslib_1.__decorate([
|
|
21
|
+
(0, swagger_1.ApiProperty)({
|
|
22
|
+
type: String,
|
|
23
|
+
required: false,
|
|
24
|
+
description: 'Filter by scope ID (e.g., tenant ID, organization ID)'
|
|
25
|
+
}),
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
tslib_1.__metadata("design:type", String)
|
|
29
|
+
], TemplateLayoutFilterDto.prototype, "scopeId", void 0);
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
(0, swagger_1.ApiProperty)({
|
|
32
|
+
type: String,
|
|
33
|
+
required: false,
|
|
34
|
+
description: 'Filter by template type'
|
|
35
|
+
}),
|
|
36
|
+
(0, class_validator_1.IsString)(),
|
|
37
|
+
(0, class_validator_1.IsOptional)(),
|
|
38
|
+
tslib_1.__metadata("design:type", String)
|
|
39
|
+
], TemplateLayoutFilterDto.prototype, "type", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, swagger_1.ApiProperty)({
|
|
42
|
+
type: String,
|
|
43
|
+
required: false,
|
|
44
|
+
description: 'Filter by locale (e.g., en, fr, es)'
|
|
45
|
+
}),
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
49
|
+
], TemplateLayoutFilterDto.prototype, "locale", void 0);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, swagger_1.ApiProperty)({
|
|
52
|
+
type: [String],
|
|
53
|
+
required: false,
|
|
54
|
+
description: 'Exclude templates with these names'
|
|
55
|
+
}),
|
|
56
|
+
(0, class_validator_1.IsArray)(),
|
|
57
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
58
|
+
(0, class_validator_1.IsOptional)(),
|
|
59
|
+
tslib_1.__metadata("design:type", Array)
|
|
60
|
+
], TemplateLayoutFilterDto.prototype, "excludeNames", void 0);
|