@tstdl/base 0.71.75 → 0.71.78
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/.eslintrc.js +9 -4
- package/examples/pdf/basic.js +1 -1
- package/examples/pdf/basic.js.map +1 -1
- package/examples/pdf/templates/hello-name.d.ts +5 -0
- package/examples/pdf/templates/hello-name.js +10 -0
- package/examples/pdf/templates/hello-name.js.map +1 -0
- package/module/module-base.js +1 -1
- package/module/module-base.js.map +1 -1
- package/package.json +9 -9
- package/templates/providers/file-template.provider.base.js +9 -3
- package/templates/providers/file-template.provider.base.js.map +1 -1
- package/templates/providers/file-template.provider.d.ts +1 -0
- package/templates/providers/file-template.provider.js +5 -1
- package/templates/providers/file-template.provider.js.map +1 -1
- package/templates/template.service.d.ts +1 -1
- package/templates/template.service.js +2 -0
- package/templates/template.service.js.map +1 -1
package/.eslintrc.js
CHANGED
|
@@ -37,16 +37,19 @@ module.exports = {
|
|
|
37
37
|
'@typescript-eslint/no-empty-interface': ['warn', { 'allowSingleExtends': true }],
|
|
38
38
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
39
39
|
'@typescript-eslint/no-extra-parens': 'off',
|
|
40
|
+
'@typescript-eslint/no-extraneous-class': 'off',
|
|
40
41
|
'@typescript-eslint/no-inferrable-types': ['warn', { ignoreParameters: true, ignoreProperties: true }],
|
|
41
42
|
'@typescript-eslint/no-invalid-void-type': 'off',
|
|
42
43
|
'@typescript-eslint/no-magic-numbers': ['off', { ignoreNumericLiteralTypes: true, ignoreEnums: true, ignore: [0, 1, 128, 256, 512, 1024, 2048, 4096], ignoreArrayIndexes: true }],
|
|
43
44
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
45
|
+
'@typescript-eslint/no-restricted-imports': 'off',
|
|
44
46
|
'@typescript-eslint/no-type-alias': 'off',
|
|
45
47
|
'@typescript-eslint/no-unnecessary-condition': ['error', { allowConstantLoopConditions: true }],
|
|
46
48
|
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
47
49
|
'@typescript-eslint/no-unused-vars-experimental': 'off',
|
|
48
50
|
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
|
|
49
51
|
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
|
|
52
|
+
'@typescript-eslint/no-useless-constructor': 'off',
|
|
50
53
|
'@typescript-eslint/object-curly-spacing': 'off',
|
|
51
54
|
'@typescript-eslint/prefer-readonly-parameter-types': ['off', { checkParameterProperties: false }],
|
|
52
55
|
'@typescript-eslint/quotes': ['warn', 'single'],
|
|
@@ -54,12 +57,12 @@ module.exports = {
|
|
|
54
57
|
'@typescript-eslint/sort-type-union-intersection-members': 'off',
|
|
55
58
|
'@typescript-eslint/space-before-function-paren': ['warn', { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
|
|
56
59
|
'@typescript-eslint/typedef': 'off',
|
|
57
|
-
"@typescript-eslint/no-restricted-imports": "off",
|
|
58
60
|
'array-bracket-newline': ['error', 'consistent'],
|
|
59
61
|
'array-element-newline': ['error', 'consistent'],
|
|
60
62
|
'camelcase': 'off',
|
|
61
|
-
'capitalized-comments':
|
|
63
|
+
'capitalized-comments': 'off',
|
|
62
64
|
'class-methods-use-this': 'off',
|
|
65
|
+
'complexity': ['warn', 25],
|
|
63
66
|
'dot-location': ['error', 'property'],
|
|
64
67
|
'eqeqeq': 'off',
|
|
65
68
|
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
@@ -73,10 +76,12 @@ module.exports = {
|
|
|
73
76
|
'linebreak-style': ['error', 'unix'],
|
|
74
77
|
'lines-around-comment': 'off',
|
|
75
78
|
'lines-between-class-members': 'off',
|
|
79
|
+
'max-classes-per-file': 'off',
|
|
76
80
|
'max-len': ['off', { code: 150 }],
|
|
81
|
+
'max-lines-per-function': ['warn', { 'max': 100, 'skipBlankLines': true, 'skipComments': true }],
|
|
77
82
|
'max-lines': 'off',
|
|
78
83
|
'max-params': 'off',
|
|
79
|
-
'max-statements': ['warn',
|
|
84
|
+
'max-statements': ['warn', 50],
|
|
80
85
|
'multiline-ternary': 'off',
|
|
81
86
|
'new-cap': 'off',
|
|
82
87
|
'newline-per-chained-call': 'off',
|
|
@@ -90,13 +95,13 @@ module.exports = {
|
|
|
90
95
|
'no-nested-ternary': 'off',
|
|
91
96
|
'no-plusplus': ['off', { allowForLoopAfterthoughts: true }],
|
|
92
97
|
'no-promise-executor-return': 'off',
|
|
98
|
+
'no-restricted-imports': 'off',
|
|
93
99
|
'no-ternary': 'off',
|
|
94
100
|
'no-undefined': 'off',
|
|
95
101
|
'no-underscore-dangle': 'off',
|
|
96
102
|
'no-void': 'off',
|
|
97
103
|
'object-curly-spacing': 'off',
|
|
98
104
|
'object-property-newline': ['warn', { allowAllPropertiesOnSameLine: true }],
|
|
99
|
-
"no-restricted-imports": "off",
|
|
100
105
|
'one-var': ['error', 'never'],
|
|
101
106
|
'operator-linebreak': ['warn', 'before'],
|
|
102
107
|
'padded-blocks': ['error', 'never'],
|
package/examples/pdf/basic.js
CHANGED
|
@@ -14,7 +14,7 @@ const path_1 = require("path");
|
|
|
14
14
|
templateProvider: file_template_provider_1.FileTemplateProvider,
|
|
15
15
|
templateRenderers: [mjml_template_renderer_1.MjmlTemplateRenderer, handlebars_template_renderer_1.HandlebarsTemplateRenderer]
|
|
16
16
|
});
|
|
17
|
-
(0, file_template_provider_1.configureFileTemplateProvider)({ basePath: (0, path_1.resolve)(__dirname
|
|
17
|
+
(0, file_template_provider_1.configureFileTemplateProvider)({ basePath: (0, path_1.resolve)(__dirname, 'templates') });
|
|
18
18
|
async function test() {
|
|
19
19
|
const service = await container_1.container.resolveAsync(pdf_service_1.PdfService);
|
|
20
20
|
const result = await service.renderTemplate('hello-name', { name: 'Max Mustermann' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../../source/examples/pdf/basic.ts"],"names":[],"mappings":";;AAAA,mDAA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
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const file_template_provider_1 = require("../../../templates/providers/file-template.provider");
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const template = (0, file_template_provider_1.fileTemplate)({
|
|
6
|
+
type: 'mjml-handlebars',
|
|
7
|
+
templateFile: (0, path_1.resolve)(__dirname.replace('dist', 'source'), 'hello-name.hbs')
|
|
8
|
+
});
|
|
9
|
+
exports.default = template;
|
|
10
|
+
//# sourceMappingURL=hello-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hello-name.js","sourceRoot":"","sources":["../../../../source/examples/pdf/templates/hello-name.ts"],"names":[],"mappings":";;AAAA,gGAA4E;AAC5E,+BAA+B;AAE/B,MAAM,QAAQ,GAAG,IAAA,qCAAY,EAAC;IAC5B,IAAI,EAAE,iBAAiB;IACvB,YAAY,EAAE,IAAA,cAAO,EAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7E,CAAC,CAAC;AAEH,kBAAe,QAAQ,CAAC"}
|
package/module/module-base.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-base.js","sourceRoot":"","sources":["../../source/module/module-base.ts"],"names":[],"mappings":";;;AAEA,oEAA+D;AAE/D,qCAAuC;AAEvC,MAAsB,UAAU;IAkB9B,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,oBAAW,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,IAAI,sCAAiB,EAAE,CAAC;IACnD,CAAC;IAdD,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAY,WAAW;QACrB,OAAO,oBAAW,CAAC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AAW,CAAC,IAAI,CAAC,MAAM,CAAE,CAAC,WAAW,EAAE,CAAC;IACjD,CAAC;IAUD,KAAK,CAAC,GAAG;QACP,IAAI,IAAI,CAAC,MAAM,IAAI,oBAAW,CAAC,OAAO,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;SACnE;QAED,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAE/B,IAAI;YACF,IAAI,CAAC,MAAM,GAAG,oBAAW,CAAC,OAAO,CAAC;YAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YACpD,MAAM,IAAI,CAAC,UAAU,CAAC;YACtB,IAAI,CAAC,MAAM,GAAG,oBAAW,CAAC,OAAO,CAAC;SACnC;QACD,OAAO,KAAc,EAAE;YACrB,IAAI,CAAC,MAAM,GAAG,oBAAW,CAAC,SAAS,CAAC;YACpC,MAAM,KAAK,CAAC;SACb;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,GAAgB,CAAC,CAAC,CAAC;IACtD,CAAC;CAGF;AAnDD,gCAmDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.78",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"pub": "npm run build:prod && rm -vf dist/test* && npm publish dist/"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"luxon": "^
|
|
18
|
+
"luxon": "^3.0",
|
|
19
19
|
"reflect-metadata": "^0.1",
|
|
20
20
|
"rxjs": "^7.5",
|
|
21
|
-
"type-fest": "^2.
|
|
21
|
+
"type-fest": "^2.16"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/chroma-js": "2.1",
|
|
25
25
|
"@types/koa__router": "8.0",
|
|
26
|
-
"@types/luxon": "2.
|
|
26
|
+
"@types/luxon": "2.4",
|
|
27
27
|
"@types/minio": "7.0",
|
|
28
28
|
"@types/mjml": "4.7",
|
|
29
29
|
"@types/node": "18",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@elastic/elasticsearch": "^8.2",
|
|
42
|
-
"@koa/router": "^
|
|
42
|
+
"@koa/router": "^12.0",
|
|
43
43
|
"@tstdl/angular": "^0.10",
|
|
44
44
|
"chroma-js": "^2.4",
|
|
45
45
|
"got": "^12.1",
|
|
46
46
|
"handlebars": "^4.7",
|
|
47
47
|
"koa": "^2.13",
|
|
48
48
|
"minio": "^7.0",
|
|
49
|
-
"mjml": "^4.
|
|
50
|
-
"mongodb": "
|
|
49
|
+
"mjml": "^4.13",
|
|
50
|
+
"mongodb": "4.7",
|
|
51
51
|
"nodemailer": "^6.7",
|
|
52
|
-
"puppeteer": "^15.
|
|
52
|
+
"puppeteer": "^15.4",
|
|
53
53
|
"superstruct": "^0.16",
|
|
54
|
-
"undici": "^5.
|
|
54
|
+
"undici": "^5.8",
|
|
55
55
|
"urlpattern-polyfill": "^4.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileTemplateProviderBase = void 0;
|
|
4
|
+
const bad_request_error_1 = require("../../error/bad-request.error");
|
|
4
5
|
const type_guards_1 = require("../../utils/type-guards");
|
|
5
6
|
const fs = require("fs/promises");
|
|
6
7
|
const path = require("path");
|
|
8
|
+
const keyPattern = /^[\w\-\/]+$/u;
|
|
7
9
|
class FileTemplateProviderBase {
|
|
8
10
|
constructor(schema, basePath, fileForwards) {
|
|
9
11
|
this.schema = schema;
|
|
@@ -11,9 +13,13 @@ class FileTemplateProviderBase {
|
|
|
11
13
|
this.fileForwards = new Map(fileForwards);
|
|
12
14
|
}
|
|
13
15
|
async get(key) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
if (!keyPattern.test(key)) {
|
|
17
|
+
throw new bad_request_error_1.BadRequestError('Illegal template key. Only a-z, A-Z, 0-9, _ and - are allowed.');
|
|
18
|
+
}
|
|
19
|
+
const filePath = path.resolve(this.basePath, `${key}.js`);
|
|
20
|
+
const templateModule = await Promise.resolve().then(() => require(filePath));
|
|
21
|
+
const fileContent = templateModule.default;
|
|
22
|
+
const fileTemplate = this.schema.parse(fileContent);
|
|
17
23
|
const result = {};
|
|
18
24
|
const entries = Object.entries(fileTemplate);
|
|
19
25
|
for (const [property, value] of entries) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-template.provider.base.js","sourceRoot":"","sources":["../../../source/templates/providers/file-template.provider.base.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"file-template.provider.base.js","sourceRoot":"","sources":["../../../source/templates/providers/file-template.provider.base.ts"],"names":[],"mappings":";;;AAAA,qEAA4D;AAG5D,yDAAkE;AAClE,kCAAkC;AAClC,6BAA6B;AAO7B,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC,MAAa,wBAAwB;IAKnC,YAAY,MAAiB,EAAE,QAAgB,EAAE,YAAiC;QAChF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,IAAI,C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O,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;gBAEtG,MAAM,CAAC,SAAS,CAAC,GAAG,OAAc,CAAC;gBACnC,SAAS;aACV;YAED,MAAM,IAAI,KAAK,CAAC,UAAU,OAAO,CAAC,QAAQ,EAAE,OAAO,SAAS,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;SAC7F;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AApDD,4DAoDC"}
|
|
@@ -19,3 +19,4 @@ export declare class FileTemplateProvider extends FileTemplateProviderBase<Templ
|
|
|
19
19
|
constructor(basePath: string);
|
|
20
20
|
}
|
|
21
21
|
export declare function configureFileTemplateProvider(config?: Partial<FileTemplateProviderConfig>): void;
|
|
22
|
+
export declare function fileTemplate<T extends FileTemplate>(template: T): T;
|
|
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.configureFileTemplateProvider = exports.FileTemplateProvider = exports.fileTemplateProviderConfig = void 0;
|
|
15
|
+
exports.fileTemplate = exports.configureFileTemplateProvider = exports.FileTemplateProvider = exports.fileTemplateProviderConfig = void 0;
|
|
16
16
|
const container_1 = require("../../container");
|
|
17
17
|
const schema_1 = require("../../schema");
|
|
18
18
|
const file_template_provider_base_1 = require("./file-template.provider.base");
|
|
@@ -40,4 +40,8 @@ function configureFileTemplateProvider(config = {}) {
|
|
|
40
40
|
exports.fileTemplateProviderConfig.basePath = config.basePath ?? exports.fileTemplateProviderConfig.basePath;
|
|
41
41
|
}
|
|
42
42
|
exports.configureFileTemplateProvider = configureFileTemplateProvider;
|
|
43
|
+
function fileTemplate(template) {
|
|
44
|
+
return template;
|
|
45
|
+
}
|
|
46
|
+
exports.fileTemplate = fileTemplate;
|
|
43
47
|
//# sourceMappingURL=file-template.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-template.provider.js","sourceRoot":"","sources":["../../../source/templates/providers/file-template.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAAwE;AAExE,yCAA6D;AAI7D,+EAAyE;AAe5D,QAAA,0BAA0B,GAA+B,EAAE,CAAC;AAEzE,MAAM,kBAAkB,GAAyB,IAAA,eAAM,EAAC;IACtD,IAAI,EAAE,IAAA,eAAM,GAAE;IACd,QAAQ,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,GAAE,CAAC;IAC5B,YAAY,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,GAAE,CAAC;IAChC,OAAO,EAAE,IAAA,iBAAQ,EAAC,IAAA,gBAAO,GAAE,CAAC;CAC7B,CAAC,CAAC;AAKH,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,sDAAgD;IAGxF,YAAyB,QAAgB;QACvC,KAAK,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AANY,oBAAoB;IAHhC,IAAA,qBAAS,EAAC;QACT,uBAAuB,EAAE,GAAG,EAAE,CAAC,kCAA0B,CAAC,QAAQ;KACnE,CAAC;IAIa,WAAA,IAAA,qBAAS,GAAE,CAAA;;GAHb,oBAAoB,CAMhC;AANY,oDAAoB;AAQjC,SAAgB,6BAA6B,CAAC,SAA8C,EAAE;IAC5F,kCAA0B,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,kCAA0B,CAAC,QAAQ,CAAC;AAC/F,CAAC;AAFD,sEAEC"}
|
|
1
|
+
{"version":3,"file":"file-template.provider.js","sourceRoot":"","sources":["../../../source/templates/providers/file-template.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAAwE;AAExE,yCAA6D;AAI7D,+EAAyE;AAe5D,QAAA,0BAA0B,GAA+B,EAAE,CAAC;AAEzE,MAAM,kBAAkB,GAAyB,IAAA,eAAM,EAAC;IACtD,IAAI,EAAE,IAAA,eAAM,GAAE;IACd,QAAQ,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,GAAE,CAAC;IAC5B,YAAY,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,GAAE,CAAC;IAChC,OAAO,EAAE,IAAA,iBAAQ,EAAC,IAAA,gBAAO,GAAE,CAAC;CAC7B,CAAC,CAAC;AAKH,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,sDAAgD;IAGxF,YAAyB,QAAgB;QACvC,KAAK,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AANY,oBAAoB;IAHhC,IAAA,qBAAS,EAAC;QACT,uBAAuB,EAAE,GAAG,EAAE,CAAC,kCAA0B,CAAC,QAAQ;KACnE,CAAC;IAIa,WAAA,IAAA,qBAAS,GAAE,CAAA;;GAHb,oBAAoB,CAMhC;AANY,oDAAoB;AAQjC,SAAgB,6BAA6B,CAAC,SAA8C,EAAE;IAC5F,kCAA0B,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,kCAA0B,CAAC,QAAQ,CAAC;AAC/F,CAAC;AAFD,sEAEC;AAED,SAAgB,YAAY,CAAyB,QAAW;IAC9D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAFD,oCAEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TemplateRendererProvider } from './template-renderer.provider';
|
|
2
2
|
import type { Template } from './template.model';
|
|
3
|
-
import
|
|
3
|
+
import { TemplateProvider } from './template.provider';
|
|
4
4
|
import type { TemplateRenderResult } from './template.renderer';
|
|
5
5
|
export declare class TemplateService {
|
|
6
6
|
private readonly templateProvider;
|
|
@@ -17,6 +17,7 @@ const container_1 = require("../container");
|
|
|
17
17
|
const helpers_1 = require("../utils/helpers");
|
|
18
18
|
const type_guards_1 = require("../utils/type-guards");
|
|
19
19
|
const template_renderer_provider_1 = require("./template-renderer.provider");
|
|
20
|
+
const template_provider_1 = require("./template.provider");
|
|
20
21
|
let TemplateService = class TemplateService {
|
|
21
22
|
constructor(templateProvider, templateRendererProvider) {
|
|
22
23
|
this.templateProvider = templateProvider ?? { get: () => (0, helpers_1._throw)(new Error('No template provider provided. Cannot render template-keys.')) };
|
|
@@ -31,6 +32,7 @@ let TemplateService = class TemplateService {
|
|
|
31
32
|
TemplateService = __decorate([
|
|
32
33
|
(0, container_1.singleton)(),
|
|
33
34
|
__param(0, (0, container_1.optional)()),
|
|
35
|
+
__param(0, (0, container_1.inject)(template_provider_1.TemplateProvider)),
|
|
34
36
|
__metadata("design:paramtypes", [Object, template_renderer_provider_1.TemplateRendererProvider])
|
|
35
37
|
], TemplateService);
|
|
36
38
|
exports.TemplateService = TemplateService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../source/templates/template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../source/templates/template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAA0D;AAC1D,8CAAyC;AACzC,sDAA+C;AAC/C,6EAAwE;AAExE,2DAAuD;AAIvD,IAAa,eAAe,GAA5B,MAAa,eAAe;IAI1B,YAAkD,gBAA8C,EAAE,wBAAkD;QAClJ,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAA,gBAAM,EAAC,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC,EAAE,CAAC;QAC5I,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;IAC3D,CAAC;IAID,KAAK,CAAC,MAAM,CAAgC,aAAyB,EAAE,eAAwB;QAC7F,MAAM,QAAQ,GAAG,IAAA,sBAAQ,EAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QAC1G,MAAM,QAAQ,GAAG,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClE,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACpD,CAAC;CACF,CAAA;AAhBY,eAAe;IAD3B,IAAA,qBAAS,GAAE;IAKG,WAAA,IAAA,oBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,kBAAM,EAAC,oCAAgB,CAAC,CAAA;6CAA2E,qDAAwB;GAJzI,eAAe,CAgB3B;AAhBY,0CAAe"}
|