@bymax-one/nest-notification 1.0.5 → 1.1.0
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/CHANGELOG.md +31 -2
- package/README.md +3 -3
- package/dist/server/index.cjs +14 -4
- package/dist/server/index.d.cts +7 -4
- package/dist/server/index.d.ts +7 -4
- package/dist/server/index.mjs +14 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,34 @@ All notable changes to `@bymax-one/nest-notification` will be documented in this
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [1.1.0] - 2026-08-11
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **BREAKING: `ioredis` peer dependency moved to `^6.0.0`** (was `^5.0.0`; the ranges are
|
|
13
|
+
disjoint, so an ioredis 5 consumer no longer satisfies the contract). This lets a consumer that
|
|
14
|
+
also installs `@bymax-one/nest-queue@1.2.0` (which peers `ioredis ^6.0.0`) resolve a single
|
|
15
|
+
ioredis version instead of two. `RedisOtpStorage` never imports `ioredis`: it depends on the
|
|
16
|
+
locally declared structural `RedisLike` surface, so no runtime path changed. ioredis 6 keeps
|
|
17
|
+
`replyMapping: "legacy"` by default, so the reply shapes the Lua/TTL paths rely on are
|
|
18
|
+
unchanged. **Apply to a derived backend:** none — this is a library peer range; a consumer on
|
|
19
|
+
ioredis 5 must move to ioredis 6 to satisfy the new peer.
|
|
20
|
+
- **Stryker mutation gate raised to 100%.** `thresholds.break`, `thresholds.high`, and
|
|
21
|
+
`thresholds.low` in `stryker.config.json` are now all `100`, so any surviving (non-equivalent)
|
|
22
|
+
mutant fails the run rather than being tolerated above 95%. The score was already 100% with no
|
|
23
|
+
survivors; this makes the standard the gate.
|
|
24
|
+
|
|
25
|
+
## [1.0.6] - 2026-08-10
|
|
26
|
+
|
|
27
|
+
Remediation of a local audit's development-log privacy finding (merged in #55). No API changed.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **The no-op email provider no longer logs the recipient in clear, the subject, or the body.** The
|
|
32
|
+
development provider now logs only a first-initial mask of each recipient (`m***@example.com`).
|
|
33
|
+
The subject is dropped entirely: it is rendered from a consumer template that can interpolate an
|
|
34
|
+
OTP code, so logging it could persist a real code in a developer's log, violating the
|
|
35
|
+
never-log-codes invariant.
|
|
9
36
|
|
|
10
37
|
## [1.0.5] - 2026-08-08
|
|
11
38
|
|
|
@@ -181,7 +208,9 @@ rejected at startup rather than failing on the first send.
|
|
|
181
208
|
|
|
182
209
|
[1.0.4]: https://github.com/bymaxone/nest-notification/compare/v1.0.3...v1.0.4
|
|
183
210
|
[1.0.3]: https://github.com/bymaxone/nest-notification/compare/v1.0.2...v1.0.3
|
|
184
|
-
[Unreleased]: https://github.com/bymaxone/nest-notification/compare/v1.0.
|
|
211
|
+
[Unreleased]: https://github.com/bymaxone/nest-notification/compare/v1.0.6...HEAD
|
|
212
|
+
[1.1.0]: https://github.com/bymaxone/nest-notification/compare/v1.0.6...v1.1.0
|
|
213
|
+
[1.0.6]: https://github.com/bymaxone/nest-notification/compare/v1.0.5...v1.0.6
|
|
185
214
|
[1.0.5]: https://github.com/bymaxone/nest-notification/compare/v1.0.4...v1.0.5
|
|
186
215
|
[1.0.2]: https://github.com/bymaxone/nest-notification/compare/v1.0.1...v1.0.2
|
|
187
216
|
[1.0.1]: https://github.com/bymaxone/nest-notification/compare/v1.0.0...v1.0.1
|
package/README.md
CHANGED
|
@@ -634,8 +634,8 @@ When integrating `@bymax-one/nest-notification` in production, verify each of th
|
|
|
634
634
|
A one-time password is a credential, so the suite is held to a bar beyond "it runs" — every behavior is pinned so that a regression **fails a test**.
|
|
635
635
|
|
|
636
636
|
- ✅ **100% line coverage** — statements, branches, functions, and lines, enforced per file as a release gate across unit + e2e
|
|
637
|
-
- ✅ **100% mutation score** — verified with [Stryker](https://stryker-mutator.io/): every viable seeded fault killed, with **no survivors**, against a `break` threshold of
|
|
638
|
-
- ✅ **
|
|
637
|
+
- ✅ **100% mutation score** — verified with [Stryker](https://stryker-mutator.io/): every viable seeded fault killed, with **no survivors**, against a `break` threshold of 100. The equivalents that no test can kill carry their reason on the line they apply to, so the number is an accounting rather than a target
|
|
638
|
+
- ✅ **389 tests** — unit and end-to-end, spanning all three subpaths
|
|
639
639
|
- ✅ **Invariants asserted, not assumed** — the never-log-codes rule is a test (`JSON.stringify(entry).includes(code) === false`), not a review convention
|
|
640
640
|
- ✅ **Published shape verified** — `attw` resolves every entrypoint against the packed tarball, and a dogfood smoke test installs the package into a scratch consumer before any tag is cut
|
|
641
641
|
- ✅ **Every equivalent mutant documented** — the ones no test can kill carry an inline `// Stryker disable` with the reason, so the score is an accounting rather than a number
|
|
@@ -644,7 +644,7 @@ A one-time password is a credential, so the suite is held to a bar beyond "it ru
|
|
|
644
644
|
| -------------- | ---------------------------------------------------------------------- |
|
|
645
645
|
| Type safety | TypeScript `strict`, zero `any` |
|
|
646
646
|
| Coverage | **100%** line/branch/function/statement per file (`pnpm test:cov:all`) |
|
|
647
|
-
| Mutation | Stryker score
|
|
647
|
+
| Mutation | Stryker score **100%** (`break: 100`), no survivors |
|
|
648
648
|
| Lint | ESLint flat config + `eslint-plugin-security`, zero warnings |
|
|
649
649
|
| Bundle budgets | server < 30 KB · shared < 4 KB · react < 8 KB brotli (`pnpm size`) |
|
|
650
650
|
| Prisma-free | `pnpm check:no-prisma` — the library never imports `@prisma/client` |
|
package/dist/server/index.cjs
CHANGED
|
@@ -1552,6 +1552,13 @@ var CANONICAL_EMAIL_TEMPLATES = {
|
|
|
1552
1552
|
/** MFA disabled — variables: `name`, `appName`. */
|
|
1553
1553
|
MFA_DISABLED: "mfa_disabled"
|
|
1554
1554
|
};
|
|
1555
|
+
function maskEmail(address) {
|
|
1556
|
+
const at = address.lastIndexOf("@");
|
|
1557
|
+
if (at <= 0) {
|
|
1558
|
+
return "***";
|
|
1559
|
+
}
|
|
1560
|
+
return `${address[0]}***${address.slice(at)}`;
|
|
1561
|
+
}
|
|
1555
1562
|
exports.NoOpEmailProvider = class NoOpEmailProvider {
|
|
1556
1563
|
constructor() {
|
|
1557
1564
|
this.name = "noop";
|
|
@@ -1562,14 +1569,17 @@ exports.NoOpEmailProvider = class NoOpEmailProvider {
|
|
|
1562
1569
|
return true;
|
|
1563
1570
|
}
|
|
1564
1571
|
/**
|
|
1565
|
-
* Pretends to send: logs
|
|
1572
|
+
* Pretends to send: logs a masked recipient and returns a synthetic id.
|
|
1566
1573
|
*
|
|
1567
|
-
* @param options - The message to "send". Only `to`
|
|
1574
|
+
* @param options - The message to "send". Only a masked `to` is logged — never
|
|
1575
|
+
* the subject or the body, since a consumer template can interpolate an OTP
|
|
1576
|
+
* code into either.
|
|
1568
1577
|
* @returns A synthetic `messageId` prefixed with `noop-`.
|
|
1569
1578
|
*/
|
|
1570
1579
|
async send(options) {
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1580
|
+
const recipients = Array.isArray(options.to) ? options.to : [options.to];
|
|
1581
|
+
const masked = recipients.map(maskEmail).join(",");
|
|
1582
|
+
this.logger.debug(`[NoOpEmail] to=${masked}`);
|
|
1573
1583
|
return { messageId: `noop-${crypto.randomUUID()}` };
|
|
1574
1584
|
}
|
|
1575
1585
|
};
|
package/dist/server/index.d.cts
CHANGED
|
@@ -1251,8 +1251,9 @@ type CanonicalEmailTemplate = (typeof CANONICAL_EMAIL_TEMPLATES)[keyof typeof CA
|
|
|
1251
1251
|
* @fileoverview Development email provider that logs instead of sending.
|
|
1252
1252
|
* @layer infrastructure
|
|
1253
1253
|
*
|
|
1254
|
-
* Useful for local development without SMTP credentials. It logs only
|
|
1255
|
-
* recipient
|
|
1254
|
+
* Useful for local development without SMTP credentials. It logs only a MASKED
|
|
1255
|
+
* recipient — never the full address, and never the subject or the body, either
|
|
1256
|
+
* of which a consumer template can interpolate an OTP code or other PII into.
|
|
1256
1257
|
*
|
|
1257
1258
|
* DO NOT USE IN PRODUCTION.
|
|
1258
1259
|
*/
|
|
@@ -1264,9 +1265,11 @@ declare class NoOpEmailProvider implements IEmailProvider {
|
|
|
1264
1265
|
/** Always ready — the no-op provider has nothing to configure. */
|
|
1265
1266
|
isConfigured(): boolean;
|
|
1266
1267
|
/**
|
|
1267
|
-
* Pretends to send: logs
|
|
1268
|
+
* Pretends to send: logs a masked recipient and returns a synthetic id.
|
|
1268
1269
|
*
|
|
1269
|
-
* @param options - The message to "send". Only `to`
|
|
1270
|
+
* @param options - The message to "send". Only a masked `to` is logged — never
|
|
1271
|
+
* the subject or the body, since a consumer template can interpolate an OTP
|
|
1272
|
+
* code into either.
|
|
1270
1273
|
* @returns A synthetic `messageId` prefixed with `noop-`.
|
|
1271
1274
|
*/
|
|
1272
1275
|
send(options: EmailSendOptions): Promise<EmailSendResult>;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1251,8 +1251,9 @@ type CanonicalEmailTemplate = (typeof CANONICAL_EMAIL_TEMPLATES)[keyof typeof CA
|
|
|
1251
1251
|
* @fileoverview Development email provider that logs instead of sending.
|
|
1252
1252
|
* @layer infrastructure
|
|
1253
1253
|
*
|
|
1254
|
-
* Useful for local development without SMTP credentials. It logs only
|
|
1255
|
-
* recipient
|
|
1254
|
+
* Useful for local development without SMTP credentials. It logs only a MASKED
|
|
1255
|
+
* recipient — never the full address, and never the subject or the body, either
|
|
1256
|
+
* of which a consumer template can interpolate an OTP code or other PII into.
|
|
1256
1257
|
*
|
|
1257
1258
|
* DO NOT USE IN PRODUCTION.
|
|
1258
1259
|
*/
|
|
@@ -1264,9 +1265,11 @@ declare class NoOpEmailProvider implements IEmailProvider {
|
|
|
1264
1265
|
/** Always ready — the no-op provider has nothing to configure. */
|
|
1265
1266
|
isConfigured(): boolean;
|
|
1266
1267
|
/**
|
|
1267
|
-
* Pretends to send: logs
|
|
1268
|
+
* Pretends to send: logs a masked recipient and returns a synthetic id.
|
|
1268
1269
|
*
|
|
1269
|
-
* @param options - The message to "send". Only `to`
|
|
1270
|
+
* @param options - The message to "send". Only a masked `to` is logged — never
|
|
1271
|
+
* the subject or the body, since a consumer template can interpolate an OTP
|
|
1272
|
+
* code into either.
|
|
1270
1273
|
* @returns A synthetic `messageId` prefixed with `noop-`.
|
|
1271
1274
|
*/
|
|
1272
1275
|
send(options: EmailSendOptions): Promise<EmailSendResult>;
|
package/dist/server/index.mjs
CHANGED
|
@@ -1550,6 +1550,13 @@ var CANONICAL_EMAIL_TEMPLATES = {
|
|
|
1550
1550
|
/** MFA disabled — variables: `name`, `appName`. */
|
|
1551
1551
|
MFA_DISABLED: "mfa_disabled"
|
|
1552
1552
|
};
|
|
1553
|
+
function maskEmail(address) {
|
|
1554
|
+
const at = address.lastIndexOf("@");
|
|
1555
|
+
if (at <= 0) {
|
|
1556
|
+
return "***";
|
|
1557
|
+
}
|
|
1558
|
+
return `${address[0]}***${address.slice(at)}`;
|
|
1559
|
+
}
|
|
1553
1560
|
var NoOpEmailProvider = class {
|
|
1554
1561
|
constructor() {
|
|
1555
1562
|
this.name = "noop";
|
|
@@ -1560,14 +1567,17 @@ var NoOpEmailProvider = class {
|
|
|
1560
1567
|
return true;
|
|
1561
1568
|
}
|
|
1562
1569
|
/**
|
|
1563
|
-
* Pretends to send: logs
|
|
1570
|
+
* Pretends to send: logs a masked recipient and returns a synthetic id.
|
|
1564
1571
|
*
|
|
1565
|
-
* @param options - The message to "send". Only `to`
|
|
1572
|
+
* @param options - The message to "send". Only a masked `to` is logged — never
|
|
1573
|
+
* the subject or the body, since a consumer template can interpolate an OTP
|
|
1574
|
+
* code into either.
|
|
1566
1575
|
* @returns A synthetic `messageId` prefixed with `noop-`.
|
|
1567
1576
|
*/
|
|
1568
1577
|
async send(options) {
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1578
|
+
const recipients = Array.isArray(options.to) ? options.to : [options.to];
|
|
1579
|
+
const masked = recipients.map(maskEmail).join(",");
|
|
1580
|
+
this.logger.debug(`[NoOpEmail] to=${masked}`);
|
|
1571
1581
|
return { messageId: `noop-${randomUUID()}` };
|
|
1572
1582
|
}
|
|
1573
1583
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bymax-one/nest-notification",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Multi-channel notification library for NestJS — email, OTP, SMS, push — with pluggable providers and storage, multi-tenant by design, zero runtime dependencies.",
|
|
5
5
|
"author": "Bymax One <support@bymax.one>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@nestjs/core": "^11.1.18",
|
|
99
99
|
"reflect-metadata": "^0.2.0",
|
|
100
100
|
"rxjs": "^7.8.0",
|
|
101
|
-
"ioredis": "^
|
|
101
|
+
"ioredis": "^6.0.0",
|
|
102
102
|
"resend": "^4.0.0 || ^5.0.0 || ^6.0.0",
|
|
103
103
|
"@sendgrid/mail": "^8.0.0",
|
|
104
104
|
"@aws-sdk/client-ses": "^3.0.0",
|