@ackplus/nest-dynamic-templates 1.1.10 → 1.1.11
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/README.md +121 -539
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +19 -15
- package/dist/test/helpers.d.ts +0 -4
- package/dist/test/helpers.js +0 -34
- package/dist/test/helpers.js.map +0 -1
- package/dist/test/test-database.config.d.ts +0 -4
- package/dist/test/test-database.config.js +0 -24
- package/dist/test/test-database.config.js.map +0 -1
- package/dist/test/test.setup.d.ts +0 -3
- package/dist/test/test.setup.js +0 -29
- package/dist/test/test.setup.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ackplus/nest-dynamic-templates",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "A powerful and flexible
|
|
3
|
+
"version": "1.1.11",
|
|
4
|
+
"description": "A powerful and flexible dynamic template rendering library for NestJS applications with support for Nunjucks, Handlebars, EJS, MJML, and more.",
|
|
5
5
|
"author": "AckPlus",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
11
15
|
},
|
|
12
16
|
"files": [
|
|
13
17
|
"dist",
|
|
@@ -17,17 +21,17 @@
|
|
|
17
21
|
],
|
|
18
22
|
"keywords": [
|
|
19
23
|
"nestjs",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
24
|
+
"template",
|
|
25
|
+
"rendering",
|
|
26
|
+
"mjml",
|
|
27
|
+
"handlebars",
|
|
28
|
+
"nunjucks",
|
|
29
|
+
"ejs",
|
|
30
|
+
"pug",
|
|
31
|
+
"email",
|
|
32
|
+
"html",
|
|
33
|
+
"dynamic-content",
|
|
34
|
+
"typeorm"
|
|
31
35
|
],
|
|
32
36
|
"repository": {
|
|
33
37
|
"type": "git",
|
package/dist/test/helpers.d.ts
DELETED
package/dist/test/helpers.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.engineFilters = void 0;
|
|
4
|
-
exports.engineFilters = {
|
|
5
|
-
formatDate: (date, format) => {
|
|
6
|
-
const year = date.getFullYear();
|
|
7
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
8
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
9
|
-
switch (format) {
|
|
10
|
-
case 'YYYY-MM-DD':
|
|
11
|
-
return `${year}-${month}-${day}`;
|
|
12
|
-
case 'MM/DD/YY':
|
|
13
|
-
return `${month}/${day}/${String(year).slice(-2)}`;
|
|
14
|
-
case 'MMMM D, YYYY':
|
|
15
|
-
return date.toLocaleDateString('en-US', {
|
|
16
|
-
year: 'numeric',
|
|
17
|
-
month: 'long',
|
|
18
|
-
day: 'numeric'
|
|
19
|
-
});
|
|
20
|
-
default:
|
|
21
|
-
return `${year}-${month}-${day}`;
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
formatCurrency: (amount, currency) => {
|
|
25
|
-
const formatter = new Intl.NumberFormat('en-US', {
|
|
26
|
-
style: 'currency',
|
|
27
|
-
currency: currency,
|
|
28
|
-
minimumFractionDigits: 2,
|
|
29
|
-
maximumFractionDigits: 2
|
|
30
|
-
});
|
|
31
|
-
return formatter.format(amount);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=helpers.js.map
|
package/dist/test/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/test/helpers.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IACzB,UAAU,EAAE,CAAC,IAAU,EAAE,MAAc,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAEpD,QAAQ,MAAM,EAAE,CAAC;YACb,KAAK,YAAY;gBACb,OAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;YACrC,KAAK,UAAU;gBACX,OAAO,GAAG,KAAK,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,KAAK,cAAc;gBACf,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE;oBACpC,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,MAAM;oBACb,GAAG,EAAE,SAAS;iBACjB,CAAC,CAAC;YACP;gBACI,OAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;QACzC,CAAC;IACL,CAAC;IACD,cAAc,EAAE,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE;QACjD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YAC7C,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,QAAQ;YAClB,qBAAqB,EAAE,CAAC;YACxB,qBAAqB,EAAE,CAAC;SAC3B,CAAC,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACJ,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testRedisConfig = exports.testDatabaseConfig = void 0;
|
|
4
|
-
const template_entity_1 = require("../lib/entities/template.entity");
|
|
5
|
-
const template_layout_entity_1 = require("../lib/entities/template-layout.entity");
|
|
6
|
-
exports.testDatabaseConfig = {
|
|
7
|
-
type: 'sqlite',
|
|
8
|
-
database: ':memory:',
|
|
9
|
-
entities: [template_entity_1.NestDynamicTemplate, template_layout_entity_1.NestDynamicTemplateLayout],
|
|
10
|
-
logging: ['error', 'warn'],
|
|
11
|
-
synchronize: true,
|
|
12
|
-
dropSchema: true,
|
|
13
|
-
};
|
|
14
|
-
exports.testRedisConfig = {
|
|
15
|
-
type: 'single',
|
|
16
|
-
options: {
|
|
17
|
-
host: 'localhost',
|
|
18
|
-
port: 6379,
|
|
19
|
-
retryStrategy: (times) => {
|
|
20
|
-
return Math.min(times * 50, 2000);
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=test-database.config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-database.config.js","sourceRoot":"","sources":["../../src/test/test-database.config.ts"],"names":[],"mappings":";;;AAEA,qEAAsE;AACtE,mFAAmF;AAEtE,QAAA,kBAAkB,GAAyB;IACpD,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,CAAC,qCAAmB,EAAE,kDAAyB,CAAC;IAC1D,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;CACnB,CAAC;AAEW,QAAA,eAAe,GAAuB;IAC/C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACL,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,CAAC,KAAa,EAAE,EAAE;YAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;KACJ;CACJ,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { NestDynamicTemplatesModuleConfig } from '../lib/interfaces/module-config.interface';
|
|
2
|
-
export declare function createTestModule(options?: Partial<NestDynamicTemplatesModuleConfig>): Promise<import("@nestjs/testing").TestingModule>;
|
|
3
|
-
export declare function createTestApp(options?: Partial<NestDynamicTemplatesModuleConfig>): Promise<import("@nestjs/common").INestApplication<any>>;
|
package/dist/test/test.setup.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTestModule = createTestModule;
|
|
4
|
-
exports.createTestApp = createTestApp;
|
|
5
|
-
const testing_1 = require("@nestjs/testing");
|
|
6
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
7
|
-
const test_database_config_1 = require("./test-database.config");
|
|
8
|
-
const template_layout_entity_1 = require("../lib/entities/template-layout.entity");
|
|
9
|
-
const template_entity_1 = require("../lib/entities/template.entity");
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const nest_dynamic_templates_module_1 = require("../lib/nest-dynamic-templates.module");
|
|
12
|
-
async function createTestModule(options = {}) {
|
|
13
|
-
const moduleRef = await testing_1.Test.createTestingModule({
|
|
14
|
-
imports: [
|
|
15
|
-
typeorm_1.TypeOrmModule.forRoot(test_database_config_1.testDatabaseConfig),
|
|
16
|
-
typeorm_1.TypeOrmModule.forFeature([template_entity_1.NestDynamicTemplate, template_layout_entity_1.NestDynamicTemplateLayout]),
|
|
17
|
-
nest_dynamic_templates_module_1.NestDynamicTemplatesModule.forRoot(options),
|
|
18
|
-
],
|
|
19
|
-
}).compile();
|
|
20
|
-
return moduleRef;
|
|
21
|
-
}
|
|
22
|
-
async function createTestApp(options = {}) {
|
|
23
|
-
const moduleRef = await createTestModule(options);
|
|
24
|
-
const app = moduleRef.createNestApplication();
|
|
25
|
-
app.useGlobalPipes(new common_1.ValidationPipe());
|
|
26
|
-
await app.init();
|
|
27
|
-
return app;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=test.setup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.setup.js","sourceRoot":"","sources":["../../src/test/test.setup.ts"],"names":[],"mappings":";;AASA,4CAYC;AAED,sCAUC;AAjCD,6CAAuC;AACvC,6CAAgD;AAChD,iEAA4D;AAC5D,mFAAmF;AACnF,qEAAsE;AACtE,2CAAgD;AAEhD,wFAAkF;AAE3E,KAAK,UAAU,gBAAgB,CAAC,UAAqD,EAAE;IAE1F,MAAM,SAAS,GAAG,MAAM,cAAI,CAAC,mBAAmB,CAAC;QAC7C,OAAO,EAAE;YACL,uBAAa,CAAC,OAAO,CAAC,yCAAkB,CAAC;YACzC,uBAAa,CAAC,UAAU,CAAC,CAAC,qCAAmB,EAAE,kDAAyB,CAAC,CAAC;YAE1E,0DAA0B,CAAC,OAAO,CAAC,OAAO,CAAC;SAC9C;KACJ,CAAC,CAAC,OAAO,EAAE,CAAC;IAEb,OAAO,SAAS,CAAC;AACrB,CAAC;AAEM,KAAK,UAAU,aAAa,CAAC,UAAqD,EAAE;IAEvF,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,SAAS,CAAC,qBAAqB,EAAE,CAAC;IAG9C,GAAG,CAAC,cAAc,CAAC,IAAI,uBAAc,EAAE,CAAC,CAAC;IAEzC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACjB,OAAO,GAAG,CAAC;AACf,CAAC"}
|