@zola_do/email 0.2.16 → 0.2.18

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 CHANGED
@@ -475,3 +475,15 @@ ISC
475
475
  - [Contributing](../../CONTRIBUTING.md)
476
476
  - [Code of Conduct](../../CODE_OF_CONDUCT.md)
477
477
  - [Security Policy](../../SECURITY.md)
478
+
479
+ ## Configuration Validation
480
+
481
+ Validate SMTP settings before bootstrap when the consuming app wants fail-fast startup:
482
+
483
+ ```typescript
484
+ import { validateEmailEnv } from '@zola_do/email';
485
+
486
+ validateEmailEnv();
487
+ ```
488
+
489
+ Required variables: `EMAIL_SMTP`, `EMAIL_SMTP_PORT`, `EMAIL_SMTP_USERNAME`, `EMAIL_SMTP_PASSWORD`.
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './email.config';
2
2
  export * from './email.service';
3
3
  export * from './email.module';
4
4
  export * from './email-transport.interface';
5
+ export * from './validate-email-env.helper';
package/dist/index.js CHANGED
@@ -18,4 +18,5 @@ __exportStar(require("./email.config"), exports);
18
18
  __exportStar(require("./email.service"), exports);
19
19
  __exportStar(require("./email.module"), exports);
20
20
  __exportStar(require("./email-transport.interface"), exports);
21
+ __exportStar(require("./validate-email-env.helper"), exports);
21
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,kDAAgC;AAChC,iDAA+B;AAC/B,8DAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,kDAAgC;AAChC,iDAA+B;AAC/B,8DAA4C;AAC5C,8DAA4C"}
@@ -0,0 +1,4 @@
1
+ export type ValidateEmailEnvOptions = {
2
+ required?: boolean;
3
+ };
4
+ export declare function validateEmailEnv(options?: ValidateEmailEnvOptions): void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateEmailEnv = validateEmailEnv;
4
+ function validateEmailEnv(options = {}) {
5
+ const { required = true } = options;
6
+ if (!required) {
7
+ return;
8
+ }
9
+ for (const key of [
10
+ 'EMAIL_SMTP',
11
+ 'EMAIL_SMTP_PORT',
12
+ 'EMAIL_SMTP_USERNAME',
13
+ 'EMAIL_SMTP_PASSWORD',
14
+ ]) {
15
+ if (!process.env[key]) {
16
+ throw new Error(`${key} is required`);
17
+ }
18
+ }
19
+ const port = Number(process.env.EMAIL_SMTP_PORT);
20
+ if (!Number.isInteger(port) || port <= 0) {
21
+ throw new Error('EMAIL_SMTP_PORT must be a positive integer');
22
+ }
23
+ }
24
+ //# sourceMappingURL=validate-email-env.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-email-env.helper.js","sourceRoot":"","sources":["../src/validate-email-env.helper.ts"],"names":[],"mappings":";;AAIA,4CAqBC;AArBD,SAAgB,gBAAgB,CAAC,UAAmC,EAAE;IACpE,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACpC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,KAAK,MAAM,GAAG,IAAI;QAChB,YAAY;QACZ,iBAAiB;QACjB,qBAAqB;QACrB,qBAAqB;KACtB,EAAE,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACjD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zola_do/email",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "description": "Email service for NestJS",
5
5
  "author": "zolaDO",
6
6
  "license": "ISC",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@nestjs-modules/mailer": "^2.3.6",
41
41
  "handlebars": "^4.7.9",
42
- "nodemailer": "^8.0.7"
42
+ "nodemailer": "^9.0.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/nodemailer": "^7.0.11",