@bymax-one/nest-notification 1.0.2 → 1.0.5
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 +68 -1
- package/README.md +3 -3
- package/dist/server/index.cjs +154 -147
- package/dist/server/index.mjs +154 -147
- package/package.json +5 -16
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,70 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.5] - 2026-08-08
|
|
11
|
+
|
|
12
|
+
**Documentation only.** `dist/` is byte-identical to `1.0.4`; no source file changed.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **The README understated the mutation score.** The badge and
|
|
17
|
+
`docs/mutation_testing_results.md` both record **100%** with no survivors, measured in the
|
|
18
|
+
2026-08-06 re-run — but the prose bullet beside them still said **98.17%**, and cited "857
|
|
19
|
+
of 873 viable seeded faults killed" from the pass before it. The badge and the report were
|
|
20
|
+
updated and the sentence between them was not, so the npm page has been claiming less than
|
|
21
|
+
the package delivers.
|
|
22
|
+
- The `[Unreleased]` compare link still pointed at `v1.0.3` after `1.0.4` shipped.
|
|
23
|
+
|
|
24
|
+
## [1.0.4] - 2026-08-06
|
|
25
|
+
|
|
26
|
+
**Published-artifact change, not a behavioural one.** `dist/` differs from `1.0.3` — this
|
|
27
|
+
bundler preserves comments and the source gained mutation-suppression notes — but no runtime
|
|
28
|
+
path changed. Measured by building both revisions and diffing the output.
|
|
29
|
+
|
|
30
|
+
### Documentation
|
|
31
|
+
|
|
32
|
+
- The mutation badge said **98%**; the measured score is **100.00%**.
|
|
33
|
+
|
|
34
|
+
### Tests
|
|
35
|
+
|
|
36
|
+
- OTP expiry is `now + ttlSeconds * 1000` and only its order of magnitude was checked. Dividing
|
|
37
|
+
instead of multiplying would expire a 300-second code 0.3 milliseconds after minting it, and
|
|
38
|
+
every failure would read as a delivery problem rather than an arithmetic one.
|
|
39
|
+
- A dotted template path stops at the first non-object. Without that guard `{{ name.0 }}` renders
|
|
40
|
+
the first letter of the string, and the same slip against `{{ token.0 }}` would put the first
|
|
41
|
+
character of a secret in an email.
|
|
42
|
+
|
|
43
|
+
## [1.0.3] - 2026-08-05
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- **`NotificationService` never received its channel services, and said the channels were
|
|
48
|
+
disabled.** Both constructor parameters carried `@Optional()` and no `@Inject`. Nest
|
|
49
|
+
reads three separate metadata keys here — `self:paramtypes` from `@Inject()`,
|
|
50
|
+
`design:paramtypes` from TypeScript, and `optional:paramtypes` from `@Optional()` — and
|
|
51
|
+
the third only says a dependency may be missing; it carries no token. The published
|
|
52
|
+
bundle is built by tsup/esbuild, which documents that it cannot emit `design:paramtypes`,
|
|
53
|
+
so neither key that names a dependency was present and both parameters resolved to
|
|
54
|
+
`undefined`.
|
|
55
|
+
|
|
56
|
+
With both channels configured, the module logged `Initialized with channels: email, otp`
|
|
57
|
+
while `getEnabledChannels()` returned `[]` and `dispatch()` threw `CHANNEL_DISABLED` —
|
|
58
|
+
an error that blamed a configuration that was correct. Both parameters now carry
|
|
59
|
+
`@Inject`, keeping `@Optional()`, which is the shape `@nestjs/jwt` uses for the same
|
|
60
|
+
situation.
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
|
|
64
|
+
- `emitDecoratorMetadata` is `false` in `tsconfig.json`. It was `true`, which was never
|
|
65
|
+
true of the artifact — tsup printed this on every build of this package:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
You have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The source now compiles the way the bundle is built, so a parameter that depends on
|
|
72
|
+
reflected types fails where it is cheap to see rather than in a consumer's process.
|
|
73
|
+
|
|
10
74
|
## [1.0.2] - 2026-08-04
|
|
11
75
|
|
|
12
76
|
### Security
|
|
@@ -115,7 +179,10 @@ rejected at startup rather than failing on the first send.
|
|
|
115
179
|
- **`forRootAsync` `useClass` / `useExisting`** — only `useFactory` is wired.
|
|
116
180
|
- **Multi-provider failover and routing.**
|
|
117
181
|
|
|
118
|
-
[
|
|
182
|
+
[1.0.4]: https://github.com/bymaxone/nest-notification/compare/v1.0.3...v1.0.4
|
|
183
|
+
[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.5...HEAD
|
|
185
|
+
[1.0.5]: https://github.com/bymaxone/nest-notification/compare/v1.0.4...v1.0.5
|
|
119
186
|
[1.0.2]: https://github.com/bymaxone/nest-notification/compare/v1.0.1...v1.0.2
|
|
120
187
|
[1.0.1]: https://github.com/bymaxone/nest-notification/compare/v1.0.0...v1.0.1
|
|
121
188
|
[1.0.0]: https://github.com/bymaxone/nest-notification/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<a href="https://www.npmjs.com/package/@bymax-one/nest-notification"><img src="https://img.shields.io/npm/dm/@bymax-one/nest-notification?style=flat-square&colorA=000000&colorB=000000" alt="npm downloads" /></a>
|
|
15
15
|
<a href="https://github.com/bymaxone/nest-notification/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/bymaxone/nest-notification/ci.yml?branch=main&style=flat-square&colorA=000000&label=CI" alt="CI status" /></a>
|
|
16
16
|
<a href="https://github.com/bymaxone/nest-notification/actions/workflows/ci.yml"><img src="https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square&colorA=000000" alt="coverage" /></a>
|
|
17
|
-
<a href="https://github.com/bymaxone/nest-notification/blob/main/docs/mutation_testing_results.md"><img src="https://img.shields.io/badge/mutation-
|
|
17
|
+
<a href="https://github.com/bymaxone/nest-notification/blob/main/docs/mutation_testing_results.md"><img src="https://img.shields.io/badge/mutation-100.00%25-brightgreen?style=flat-square&colorA=000000" alt="mutation score" /></a>
|
|
18
18
|
<a href="https://scorecard.dev/viewer/?uri=github.com/bymaxone/nest-notification"><img src="https://api.scorecard.dev/projects/github.com/bymaxone/nest-notification/badge?style=flat-square" alt="OpenSSF Scorecard" /></a>
|
|
19
19
|
<a href="https://github.com/bymaxone/nest-notification/blob/main/LICENSE"><img src="https://img.shields.io/github/license/bymaxone/nest-notification?style=flat-square&colorA=000000&colorB=000000" alt="license" /></a>
|
|
20
20
|
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" /></a>
|
|
@@ -634,7 +634,7 @@ 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
|
-
- ✅ **
|
|
637
|
+
- ✅ **100% mutation score** — verified with [Stryker](https://stryker-mutator.io/): every viable seeded fault killed, with **no survivors**, against a `break` threshold of 95. 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
638
|
- ✅ **384 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
|
|
@@ -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 **≥ 95%** (`break: 95`), currently **
|
|
647
|
+
| Mutation | Stryker score **≥ 95%** (`break: 95`), currently **100%** |
|
|
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
|
@@ -604,7 +604,10 @@ exports.EmailService = class EmailService {
|
|
|
604
604
|
return;
|
|
605
605
|
}
|
|
606
606
|
const totalBytes = attachments.reduce(
|
|
607
|
-
(sum, { content }) =>
|
|
607
|
+
(sum, { content }) => (
|
|
608
|
+
// Stryker disable next-line ConditionalExpression: equivalent — `Buffer.byteLength` answers a Buffer's own length, so both arms measure the same bytes; the conditional says where the number comes from
|
|
609
|
+
sum + (typeof content === "string" ? Buffer.byteLength(content) : content.length)
|
|
610
|
+
),
|
|
608
611
|
0
|
|
609
612
|
);
|
|
610
613
|
if (totalBytes > maxBytes) {
|
|
@@ -689,152 +692,6 @@ exports.EmailService = __decorateClass([
|
|
|
689
692
|
__decorateParam(2, common.Inject(BYMAX_NOTIFICATION_TEMPLATE_RENDERER)),
|
|
690
693
|
__decorateParam(3, common.Inject(BYMAX_NOTIFICATION_LOG_REPOSITORY))
|
|
691
694
|
], exports.EmailService);
|
|
692
|
-
exports.NotificationService = class NotificationService {
|
|
693
|
-
/**
|
|
694
|
-
* @param emailService - The email service, present only when the email channel is configured.
|
|
695
|
-
* @param otpService - The OTP service, present only when the OTP channel is configured.
|
|
696
|
-
*/
|
|
697
|
-
constructor(emailService, otpService) {
|
|
698
|
-
this.emailService = emailService;
|
|
699
|
-
this.otpService = otpService;
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* Dispatches a notification to the channel named in `input`.
|
|
703
|
-
*
|
|
704
|
-
* @param input - The channel-discriminated dispatch request.
|
|
705
|
-
* @returns The channel-discriminated result.
|
|
706
|
-
* @throws NotificationException `CHANNEL_DISABLED` (channel not configured) or
|
|
707
|
-
* `EMAIL_MISSING_BODY` (email payload has neither a template nor subject+html).
|
|
708
|
-
*/
|
|
709
|
-
async dispatch(input) {
|
|
710
|
-
if (input.channel === "email") {
|
|
711
|
-
return {
|
|
712
|
-
channel: "email",
|
|
713
|
-
messageId: await this.dispatchEmail(input.tenantId, input.payload)
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
return { channel: "otp", result: await this.dispatchOtp(input.tenantId, input.payload) };
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Lists the channels whose service is present and reports itself configured.
|
|
720
|
-
*
|
|
721
|
-
* @returns The enabled channels.
|
|
722
|
-
*/
|
|
723
|
-
getEnabledChannels() {
|
|
724
|
-
const channels = [];
|
|
725
|
-
if (this.emailService?.isConfigured()) {
|
|
726
|
-
channels.push("email");
|
|
727
|
-
}
|
|
728
|
-
if (this.otpService?.isConfigured()) {
|
|
729
|
-
channels.push("otp");
|
|
730
|
-
}
|
|
731
|
-
return channels;
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Returns the email service or throws when the email channel is not enabled.
|
|
735
|
-
*
|
|
736
|
-
* @returns The email service.
|
|
737
|
-
* @throws NotificationException `CHANNEL_DISABLED` when email is not configured.
|
|
738
|
-
*/
|
|
739
|
-
getEmail() {
|
|
740
|
-
if (!this.emailService) {
|
|
741
|
-
throw new NotificationException("CHANNEL_DISABLED", { channel: "email" });
|
|
742
|
-
}
|
|
743
|
-
return this.emailService;
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Returns the OTP service or throws when the OTP channel is not enabled.
|
|
747
|
-
*
|
|
748
|
-
* @returns The OTP service.
|
|
749
|
-
* @throws NotificationException `CHANNEL_DISABLED` when OTP is not configured.
|
|
750
|
-
*/
|
|
751
|
-
getOtp() {
|
|
752
|
-
if (!this.otpService) {
|
|
753
|
-
throw new NotificationException("CHANNEL_DISABLED", { channel: "otp" });
|
|
754
|
-
}
|
|
755
|
-
return this.otpService;
|
|
756
|
-
}
|
|
757
|
-
/** Routes an email dispatch to `sendTemplate` (template) or `send` (raw body). */
|
|
758
|
-
async dispatchEmail(tenantId, payload) {
|
|
759
|
-
const email = this.getEmail();
|
|
760
|
-
if (payload.template !== void 0) {
|
|
761
|
-
const input = this.toTemplateInput(tenantId, payload.template, payload);
|
|
762
|
-
return (await email.sendTemplate(input)).messageId;
|
|
763
|
-
}
|
|
764
|
-
if (payload.subject !== void 0 && payload.html !== void 0) {
|
|
765
|
-
const input = this.toSendInput(tenantId, payload.subject, payload.html, payload);
|
|
766
|
-
return (await email.send(input)).messageId;
|
|
767
|
-
}
|
|
768
|
-
throw new NotificationException("EMAIL_MISSING_BODY", {
|
|
769
|
-
hint: "payload requires either `template` OR `{ subject, html }`"
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
/** Routes an OTP dispatch by `action`, defaulting to `generate`. */
|
|
773
|
-
async dispatchOtp(tenantId, payload) {
|
|
774
|
-
const otp = this.getOtp();
|
|
775
|
-
const action = payload.action ?? "generate";
|
|
776
|
-
const ref = {
|
|
777
|
-
tenantId,
|
|
778
|
-
recipient: payload.recipient,
|
|
779
|
-
purpose: payload.purpose,
|
|
780
|
-
...payload.userId !== void 0 ? { userId: payload.userId } : {}
|
|
781
|
-
};
|
|
782
|
-
if (action === "verify") {
|
|
783
|
-
return otp.verify({ ...ref, code: payload.code ?? "" });
|
|
784
|
-
}
|
|
785
|
-
if (action === "consume") {
|
|
786
|
-
return otp.consume(ref);
|
|
787
|
-
}
|
|
788
|
-
return otp.generate(this.toGenerateInput(ref, payload));
|
|
789
|
-
}
|
|
790
|
-
/** Builds the `sendTemplate` input from a resolved template name and payload. */
|
|
791
|
-
toTemplateInput(tenantId, template, payload) {
|
|
792
|
-
return {
|
|
793
|
-
tenantId,
|
|
794
|
-
to: payload.to,
|
|
795
|
-
template,
|
|
796
|
-
data: payload.data ?? {},
|
|
797
|
-
...payload.locale !== void 0 ? { locale: payload.locale } : {},
|
|
798
|
-
...this.commonEmailFields(payload)
|
|
799
|
-
};
|
|
800
|
-
}
|
|
801
|
-
/** Builds the raw `send` input from a resolved subject/html and payload. */
|
|
802
|
-
toSendInput(tenantId, subject, html, payload) {
|
|
803
|
-
return {
|
|
804
|
-
tenantId,
|
|
805
|
-
to: payload.to,
|
|
806
|
-
subject,
|
|
807
|
-
html,
|
|
808
|
-
...payload.text !== void 0 ? { text: payload.text } : {},
|
|
809
|
-
...this.commonEmailFields(payload)
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
/** The optional envelope fields shared by both email paths. */
|
|
813
|
-
commonEmailFields(payload) {
|
|
814
|
-
return {
|
|
815
|
-
...payload.from !== void 0 ? { from: payload.from } : {},
|
|
816
|
-
...payload.fromName !== void 0 ? { fromName: payload.fromName } : {},
|
|
817
|
-
...payload.replyTo !== void 0 ? { replyTo: payload.replyTo } : {},
|
|
818
|
-
...payload.tags !== void 0 ? { tags: payload.tags } : {},
|
|
819
|
-
...payload.userId !== void 0 ? { userId: payload.userId } : {}
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
/** Builds the `generate` input from a reference and an OTP dispatch payload. */
|
|
823
|
-
toGenerateInput(ref, payload) {
|
|
824
|
-
return {
|
|
825
|
-
...ref,
|
|
826
|
-
...payload.deliverVia !== void 0 ? { deliverVia: payload.deliverVia } : {},
|
|
827
|
-
...payload.emailTemplate !== void 0 ? { emailTemplate: payload.emailTemplate } : {},
|
|
828
|
-
...payload.emailData !== void 0 ? { emailData: payload.emailData } : {},
|
|
829
|
-
...payload.locale !== void 0 ? { locale: payload.locale } : {}
|
|
830
|
-
};
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
exports.NotificationService = __decorateClass([
|
|
834
|
-
common.Injectable(),
|
|
835
|
-
__decorateParam(0, common.Optional()),
|
|
836
|
-
__decorateParam(1, common.Optional())
|
|
837
|
-
], exports.NotificationService);
|
|
838
695
|
var NUMERIC = "0123456789";
|
|
839
696
|
var ALPHA = "ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
840
697
|
var ALPHANUMERIC = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
@@ -1158,6 +1015,156 @@ exports.OtpService = __decorateClass([
|
|
|
1158
1015
|
__decorateParam(3, common.Inject(exports.EmailService))
|
|
1159
1016
|
], exports.OtpService);
|
|
1160
1017
|
|
|
1018
|
+
// src/server/services/notification.service.ts
|
|
1019
|
+
exports.NotificationService = class NotificationService {
|
|
1020
|
+
/**
|
|
1021
|
+
* @param emailService - The email service, present only when the email channel is configured.
|
|
1022
|
+
* @param otpService - The OTP service, present only when the OTP channel is configured.
|
|
1023
|
+
*/
|
|
1024
|
+
constructor(emailService, otpService) {
|
|
1025
|
+
this.emailService = emailService;
|
|
1026
|
+
this.otpService = otpService;
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Dispatches a notification to the channel named in `input`.
|
|
1030
|
+
*
|
|
1031
|
+
* @param input - The channel-discriminated dispatch request.
|
|
1032
|
+
* @returns The channel-discriminated result.
|
|
1033
|
+
* @throws NotificationException `CHANNEL_DISABLED` (channel not configured) or
|
|
1034
|
+
* `EMAIL_MISSING_BODY` (email payload has neither a template nor subject+html).
|
|
1035
|
+
*/
|
|
1036
|
+
async dispatch(input) {
|
|
1037
|
+
if (input.channel === "email") {
|
|
1038
|
+
return {
|
|
1039
|
+
channel: "email",
|
|
1040
|
+
messageId: await this.dispatchEmail(input.tenantId, input.payload)
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
return { channel: "otp", result: await this.dispatchOtp(input.tenantId, input.payload) };
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Lists the channels whose service is present and reports itself configured.
|
|
1047
|
+
*
|
|
1048
|
+
* @returns The enabled channels.
|
|
1049
|
+
*/
|
|
1050
|
+
getEnabledChannels() {
|
|
1051
|
+
const channels = [];
|
|
1052
|
+
if (this.emailService?.isConfigured()) {
|
|
1053
|
+
channels.push("email");
|
|
1054
|
+
}
|
|
1055
|
+
if (this.otpService?.isConfigured()) {
|
|
1056
|
+
channels.push("otp");
|
|
1057
|
+
}
|
|
1058
|
+
return channels;
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Returns the email service or throws when the email channel is not enabled.
|
|
1062
|
+
*
|
|
1063
|
+
* @returns The email service.
|
|
1064
|
+
* @throws NotificationException `CHANNEL_DISABLED` when email is not configured.
|
|
1065
|
+
*/
|
|
1066
|
+
getEmail() {
|
|
1067
|
+
if (!this.emailService) {
|
|
1068
|
+
throw new NotificationException("CHANNEL_DISABLED", { channel: "email" });
|
|
1069
|
+
}
|
|
1070
|
+
return this.emailService;
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Returns the OTP service or throws when the OTP channel is not enabled.
|
|
1074
|
+
*
|
|
1075
|
+
* @returns The OTP service.
|
|
1076
|
+
* @throws NotificationException `CHANNEL_DISABLED` when OTP is not configured.
|
|
1077
|
+
*/
|
|
1078
|
+
getOtp() {
|
|
1079
|
+
if (!this.otpService) {
|
|
1080
|
+
throw new NotificationException("CHANNEL_DISABLED", { channel: "otp" });
|
|
1081
|
+
}
|
|
1082
|
+
return this.otpService;
|
|
1083
|
+
}
|
|
1084
|
+
/** Routes an email dispatch to `sendTemplate` (template) or `send` (raw body). */
|
|
1085
|
+
async dispatchEmail(tenantId, payload) {
|
|
1086
|
+
const email = this.getEmail();
|
|
1087
|
+
if (payload.template !== void 0) {
|
|
1088
|
+
const input = this.toTemplateInput(tenantId, payload.template, payload);
|
|
1089
|
+
return (await email.sendTemplate(input)).messageId;
|
|
1090
|
+
}
|
|
1091
|
+
if (payload.subject !== void 0 && payload.html !== void 0) {
|
|
1092
|
+
const input = this.toSendInput(tenantId, payload.subject, payload.html, payload);
|
|
1093
|
+
return (await email.send(input)).messageId;
|
|
1094
|
+
}
|
|
1095
|
+
throw new NotificationException("EMAIL_MISSING_BODY", {
|
|
1096
|
+
hint: "payload requires either `template` OR `{ subject, html }`"
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
/** Routes an OTP dispatch by `action`, defaulting to `generate`. */
|
|
1100
|
+
async dispatchOtp(tenantId, payload) {
|
|
1101
|
+
const otp = this.getOtp();
|
|
1102
|
+
const action = payload.action ?? "generate";
|
|
1103
|
+
const ref = {
|
|
1104
|
+
tenantId,
|
|
1105
|
+
recipient: payload.recipient,
|
|
1106
|
+
purpose: payload.purpose,
|
|
1107
|
+
...payload.userId !== void 0 ? { userId: payload.userId } : {}
|
|
1108
|
+
};
|
|
1109
|
+
if (action === "verify") {
|
|
1110
|
+
return otp.verify({ ...ref, code: payload.code ?? "" });
|
|
1111
|
+
}
|
|
1112
|
+
if (action === "consume") {
|
|
1113
|
+
return otp.consume(ref);
|
|
1114
|
+
}
|
|
1115
|
+
return otp.generate(this.toGenerateInput(ref, payload));
|
|
1116
|
+
}
|
|
1117
|
+
/** Builds the `sendTemplate` input from a resolved template name and payload. */
|
|
1118
|
+
toTemplateInput(tenantId, template, payload) {
|
|
1119
|
+
return {
|
|
1120
|
+
tenantId,
|
|
1121
|
+
to: payload.to,
|
|
1122
|
+
template,
|
|
1123
|
+
data: payload.data ?? {},
|
|
1124
|
+
...payload.locale !== void 0 ? { locale: payload.locale } : {},
|
|
1125
|
+
...this.commonEmailFields(payload)
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
/** Builds the raw `send` input from a resolved subject/html and payload. */
|
|
1129
|
+
toSendInput(tenantId, subject, html, payload) {
|
|
1130
|
+
return {
|
|
1131
|
+
tenantId,
|
|
1132
|
+
to: payload.to,
|
|
1133
|
+
subject,
|
|
1134
|
+
html,
|
|
1135
|
+
...payload.text !== void 0 ? { text: payload.text } : {},
|
|
1136
|
+
...this.commonEmailFields(payload)
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
/** The optional envelope fields shared by both email paths. */
|
|
1140
|
+
commonEmailFields(payload) {
|
|
1141
|
+
return {
|
|
1142
|
+
...payload.from !== void 0 ? { from: payload.from } : {},
|
|
1143
|
+
...payload.fromName !== void 0 ? { fromName: payload.fromName } : {},
|
|
1144
|
+
...payload.replyTo !== void 0 ? { replyTo: payload.replyTo } : {},
|
|
1145
|
+
...payload.tags !== void 0 ? { tags: payload.tags } : {},
|
|
1146
|
+
...payload.userId !== void 0 ? { userId: payload.userId } : {}
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
/** Builds the `generate` input from a reference and an OTP dispatch payload. */
|
|
1150
|
+
toGenerateInput(ref, payload) {
|
|
1151
|
+
return {
|
|
1152
|
+
...ref,
|
|
1153
|
+
...payload.deliverVia !== void 0 ? { deliverVia: payload.deliverVia } : {},
|
|
1154
|
+
...payload.emailTemplate !== void 0 ? { emailTemplate: payload.emailTemplate } : {},
|
|
1155
|
+
...payload.emailData !== void 0 ? { emailData: payload.emailData } : {},
|
|
1156
|
+
...payload.locale !== void 0 ? { locale: payload.locale } : {}
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
exports.NotificationService = __decorateClass([
|
|
1161
|
+
common.Injectable(),
|
|
1162
|
+
__decorateParam(0, common.Optional()),
|
|
1163
|
+
__decorateParam(0, common.Inject(exports.EmailService)),
|
|
1164
|
+
__decorateParam(1, common.Optional()),
|
|
1165
|
+
__decorateParam(1, common.Inject(exports.OtpService))
|
|
1166
|
+
], exports.NotificationService);
|
|
1167
|
+
|
|
1161
1168
|
// src/server/bymax-notification.module.ts
|
|
1162
1169
|
var RAW_NOTIFICATION_OPTIONS = /* @__PURE__ */ Symbol("RAW_NOTIFICATION_OPTIONS");
|
|
1163
1170
|
exports.BymaxNotificationModule = class BymaxNotificationModule {
|
package/dist/server/index.mjs
CHANGED
|
@@ -602,7 +602,10 @@ var EmailService = class {
|
|
|
602
602
|
return;
|
|
603
603
|
}
|
|
604
604
|
const totalBytes = attachments.reduce(
|
|
605
|
-
(sum, { content }) =>
|
|
605
|
+
(sum, { content }) => (
|
|
606
|
+
// Stryker disable next-line ConditionalExpression: equivalent — `Buffer.byteLength` answers a Buffer's own length, so both arms measure the same bytes; the conditional says where the number comes from
|
|
607
|
+
sum + (typeof content === "string" ? Buffer.byteLength(content) : content.length)
|
|
608
|
+
),
|
|
606
609
|
0
|
|
607
610
|
);
|
|
608
611
|
if (totalBytes > maxBytes) {
|
|
@@ -687,152 +690,6 @@ EmailService = __decorateClass([
|
|
|
687
690
|
__decorateParam(2, Inject(BYMAX_NOTIFICATION_TEMPLATE_RENDERER)),
|
|
688
691
|
__decorateParam(3, Inject(BYMAX_NOTIFICATION_LOG_REPOSITORY))
|
|
689
692
|
], EmailService);
|
|
690
|
-
var NotificationService = class {
|
|
691
|
-
/**
|
|
692
|
-
* @param emailService - The email service, present only when the email channel is configured.
|
|
693
|
-
* @param otpService - The OTP service, present only when the OTP channel is configured.
|
|
694
|
-
*/
|
|
695
|
-
constructor(emailService, otpService) {
|
|
696
|
-
this.emailService = emailService;
|
|
697
|
-
this.otpService = otpService;
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Dispatches a notification to the channel named in `input`.
|
|
701
|
-
*
|
|
702
|
-
* @param input - The channel-discriminated dispatch request.
|
|
703
|
-
* @returns The channel-discriminated result.
|
|
704
|
-
* @throws NotificationException `CHANNEL_DISABLED` (channel not configured) or
|
|
705
|
-
* `EMAIL_MISSING_BODY` (email payload has neither a template nor subject+html).
|
|
706
|
-
*/
|
|
707
|
-
async dispatch(input) {
|
|
708
|
-
if (input.channel === "email") {
|
|
709
|
-
return {
|
|
710
|
-
channel: "email",
|
|
711
|
-
messageId: await this.dispatchEmail(input.tenantId, input.payload)
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
return { channel: "otp", result: await this.dispatchOtp(input.tenantId, input.payload) };
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Lists the channels whose service is present and reports itself configured.
|
|
718
|
-
*
|
|
719
|
-
* @returns The enabled channels.
|
|
720
|
-
*/
|
|
721
|
-
getEnabledChannels() {
|
|
722
|
-
const channels = [];
|
|
723
|
-
if (this.emailService?.isConfigured()) {
|
|
724
|
-
channels.push("email");
|
|
725
|
-
}
|
|
726
|
-
if (this.otpService?.isConfigured()) {
|
|
727
|
-
channels.push("otp");
|
|
728
|
-
}
|
|
729
|
-
return channels;
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Returns the email service or throws when the email channel is not enabled.
|
|
733
|
-
*
|
|
734
|
-
* @returns The email service.
|
|
735
|
-
* @throws NotificationException `CHANNEL_DISABLED` when email is not configured.
|
|
736
|
-
*/
|
|
737
|
-
getEmail() {
|
|
738
|
-
if (!this.emailService) {
|
|
739
|
-
throw new NotificationException("CHANNEL_DISABLED", { channel: "email" });
|
|
740
|
-
}
|
|
741
|
-
return this.emailService;
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* Returns the OTP service or throws when the OTP channel is not enabled.
|
|
745
|
-
*
|
|
746
|
-
* @returns The OTP service.
|
|
747
|
-
* @throws NotificationException `CHANNEL_DISABLED` when OTP is not configured.
|
|
748
|
-
*/
|
|
749
|
-
getOtp() {
|
|
750
|
-
if (!this.otpService) {
|
|
751
|
-
throw new NotificationException("CHANNEL_DISABLED", { channel: "otp" });
|
|
752
|
-
}
|
|
753
|
-
return this.otpService;
|
|
754
|
-
}
|
|
755
|
-
/** Routes an email dispatch to `sendTemplate` (template) or `send` (raw body). */
|
|
756
|
-
async dispatchEmail(tenantId, payload) {
|
|
757
|
-
const email = this.getEmail();
|
|
758
|
-
if (payload.template !== void 0) {
|
|
759
|
-
const input = this.toTemplateInput(tenantId, payload.template, payload);
|
|
760
|
-
return (await email.sendTemplate(input)).messageId;
|
|
761
|
-
}
|
|
762
|
-
if (payload.subject !== void 0 && payload.html !== void 0) {
|
|
763
|
-
const input = this.toSendInput(tenantId, payload.subject, payload.html, payload);
|
|
764
|
-
return (await email.send(input)).messageId;
|
|
765
|
-
}
|
|
766
|
-
throw new NotificationException("EMAIL_MISSING_BODY", {
|
|
767
|
-
hint: "payload requires either `template` OR `{ subject, html }`"
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
|
-
/** Routes an OTP dispatch by `action`, defaulting to `generate`. */
|
|
771
|
-
async dispatchOtp(tenantId, payload) {
|
|
772
|
-
const otp = this.getOtp();
|
|
773
|
-
const action = payload.action ?? "generate";
|
|
774
|
-
const ref = {
|
|
775
|
-
tenantId,
|
|
776
|
-
recipient: payload.recipient,
|
|
777
|
-
purpose: payload.purpose,
|
|
778
|
-
...payload.userId !== void 0 ? { userId: payload.userId } : {}
|
|
779
|
-
};
|
|
780
|
-
if (action === "verify") {
|
|
781
|
-
return otp.verify({ ...ref, code: payload.code ?? "" });
|
|
782
|
-
}
|
|
783
|
-
if (action === "consume") {
|
|
784
|
-
return otp.consume(ref);
|
|
785
|
-
}
|
|
786
|
-
return otp.generate(this.toGenerateInput(ref, payload));
|
|
787
|
-
}
|
|
788
|
-
/** Builds the `sendTemplate` input from a resolved template name and payload. */
|
|
789
|
-
toTemplateInput(tenantId, template, payload) {
|
|
790
|
-
return {
|
|
791
|
-
tenantId,
|
|
792
|
-
to: payload.to,
|
|
793
|
-
template,
|
|
794
|
-
data: payload.data ?? {},
|
|
795
|
-
...payload.locale !== void 0 ? { locale: payload.locale } : {},
|
|
796
|
-
...this.commonEmailFields(payload)
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
/** Builds the raw `send` input from a resolved subject/html and payload. */
|
|
800
|
-
toSendInput(tenantId, subject, html, payload) {
|
|
801
|
-
return {
|
|
802
|
-
tenantId,
|
|
803
|
-
to: payload.to,
|
|
804
|
-
subject,
|
|
805
|
-
html,
|
|
806
|
-
...payload.text !== void 0 ? { text: payload.text } : {},
|
|
807
|
-
...this.commonEmailFields(payload)
|
|
808
|
-
};
|
|
809
|
-
}
|
|
810
|
-
/** The optional envelope fields shared by both email paths. */
|
|
811
|
-
commonEmailFields(payload) {
|
|
812
|
-
return {
|
|
813
|
-
...payload.from !== void 0 ? { from: payload.from } : {},
|
|
814
|
-
...payload.fromName !== void 0 ? { fromName: payload.fromName } : {},
|
|
815
|
-
...payload.replyTo !== void 0 ? { replyTo: payload.replyTo } : {},
|
|
816
|
-
...payload.tags !== void 0 ? { tags: payload.tags } : {},
|
|
817
|
-
...payload.userId !== void 0 ? { userId: payload.userId } : {}
|
|
818
|
-
};
|
|
819
|
-
}
|
|
820
|
-
/** Builds the `generate` input from a reference and an OTP dispatch payload. */
|
|
821
|
-
toGenerateInput(ref, payload) {
|
|
822
|
-
return {
|
|
823
|
-
...ref,
|
|
824
|
-
...payload.deliverVia !== void 0 ? { deliverVia: payload.deliverVia } : {},
|
|
825
|
-
...payload.emailTemplate !== void 0 ? { emailTemplate: payload.emailTemplate } : {},
|
|
826
|
-
...payload.emailData !== void 0 ? { emailData: payload.emailData } : {},
|
|
827
|
-
...payload.locale !== void 0 ? { locale: payload.locale } : {}
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
NotificationService = __decorateClass([
|
|
832
|
-
Injectable(),
|
|
833
|
-
__decorateParam(0, Optional()),
|
|
834
|
-
__decorateParam(1, Optional())
|
|
835
|
-
], NotificationService);
|
|
836
693
|
var NUMERIC = "0123456789";
|
|
837
694
|
var ALPHA = "ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
838
695
|
var ALPHANUMERIC = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
@@ -1156,6 +1013,156 @@ OtpService = __decorateClass([
|
|
|
1156
1013
|
__decorateParam(3, Inject(EmailService))
|
|
1157
1014
|
], OtpService);
|
|
1158
1015
|
|
|
1016
|
+
// src/server/services/notification.service.ts
|
|
1017
|
+
var NotificationService = class {
|
|
1018
|
+
/**
|
|
1019
|
+
* @param emailService - The email service, present only when the email channel is configured.
|
|
1020
|
+
* @param otpService - The OTP service, present only when the OTP channel is configured.
|
|
1021
|
+
*/
|
|
1022
|
+
constructor(emailService, otpService) {
|
|
1023
|
+
this.emailService = emailService;
|
|
1024
|
+
this.otpService = otpService;
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Dispatches a notification to the channel named in `input`.
|
|
1028
|
+
*
|
|
1029
|
+
* @param input - The channel-discriminated dispatch request.
|
|
1030
|
+
* @returns The channel-discriminated result.
|
|
1031
|
+
* @throws NotificationException `CHANNEL_DISABLED` (channel not configured) or
|
|
1032
|
+
* `EMAIL_MISSING_BODY` (email payload has neither a template nor subject+html).
|
|
1033
|
+
*/
|
|
1034
|
+
async dispatch(input) {
|
|
1035
|
+
if (input.channel === "email") {
|
|
1036
|
+
return {
|
|
1037
|
+
channel: "email",
|
|
1038
|
+
messageId: await this.dispatchEmail(input.tenantId, input.payload)
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
return { channel: "otp", result: await this.dispatchOtp(input.tenantId, input.payload) };
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Lists the channels whose service is present and reports itself configured.
|
|
1045
|
+
*
|
|
1046
|
+
* @returns The enabled channels.
|
|
1047
|
+
*/
|
|
1048
|
+
getEnabledChannels() {
|
|
1049
|
+
const channels = [];
|
|
1050
|
+
if (this.emailService?.isConfigured()) {
|
|
1051
|
+
channels.push("email");
|
|
1052
|
+
}
|
|
1053
|
+
if (this.otpService?.isConfigured()) {
|
|
1054
|
+
channels.push("otp");
|
|
1055
|
+
}
|
|
1056
|
+
return channels;
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Returns the email service or throws when the email channel is not enabled.
|
|
1060
|
+
*
|
|
1061
|
+
* @returns The email service.
|
|
1062
|
+
* @throws NotificationException `CHANNEL_DISABLED` when email is not configured.
|
|
1063
|
+
*/
|
|
1064
|
+
getEmail() {
|
|
1065
|
+
if (!this.emailService) {
|
|
1066
|
+
throw new NotificationException("CHANNEL_DISABLED", { channel: "email" });
|
|
1067
|
+
}
|
|
1068
|
+
return this.emailService;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Returns the OTP service or throws when the OTP channel is not enabled.
|
|
1072
|
+
*
|
|
1073
|
+
* @returns The OTP service.
|
|
1074
|
+
* @throws NotificationException `CHANNEL_DISABLED` when OTP is not configured.
|
|
1075
|
+
*/
|
|
1076
|
+
getOtp() {
|
|
1077
|
+
if (!this.otpService) {
|
|
1078
|
+
throw new NotificationException("CHANNEL_DISABLED", { channel: "otp" });
|
|
1079
|
+
}
|
|
1080
|
+
return this.otpService;
|
|
1081
|
+
}
|
|
1082
|
+
/** Routes an email dispatch to `sendTemplate` (template) or `send` (raw body). */
|
|
1083
|
+
async dispatchEmail(tenantId, payload) {
|
|
1084
|
+
const email = this.getEmail();
|
|
1085
|
+
if (payload.template !== void 0) {
|
|
1086
|
+
const input = this.toTemplateInput(tenantId, payload.template, payload);
|
|
1087
|
+
return (await email.sendTemplate(input)).messageId;
|
|
1088
|
+
}
|
|
1089
|
+
if (payload.subject !== void 0 && payload.html !== void 0) {
|
|
1090
|
+
const input = this.toSendInput(tenantId, payload.subject, payload.html, payload);
|
|
1091
|
+
return (await email.send(input)).messageId;
|
|
1092
|
+
}
|
|
1093
|
+
throw new NotificationException("EMAIL_MISSING_BODY", {
|
|
1094
|
+
hint: "payload requires either `template` OR `{ subject, html }`"
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
/** Routes an OTP dispatch by `action`, defaulting to `generate`. */
|
|
1098
|
+
async dispatchOtp(tenantId, payload) {
|
|
1099
|
+
const otp = this.getOtp();
|
|
1100
|
+
const action = payload.action ?? "generate";
|
|
1101
|
+
const ref = {
|
|
1102
|
+
tenantId,
|
|
1103
|
+
recipient: payload.recipient,
|
|
1104
|
+
purpose: payload.purpose,
|
|
1105
|
+
...payload.userId !== void 0 ? { userId: payload.userId } : {}
|
|
1106
|
+
};
|
|
1107
|
+
if (action === "verify") {
|
|
1108
|
+
return otp.verify({ ...ref, code: payload.code ?? "" });
|
|
1109
|
+
}
|
|
1110
|
+
if (action === "consume") {
|
|
1111
|
+
return otp.consume(ref);
|
|
1112
|
+
}
|
|
1113
|
+
return otp.generate(this.toGenerateInput(ref, payload));
|
|
1114
|
+
}
|
|
1115
|
+
/** Builds the `sendTemplate` input from a resolved template name and payload. */
|
|
1116
|
+
toTemplateInput(tenantId, template, payload) {
|
|
1117
|
+
return {
|
|
1118
|
+
tenantId,
|
|
1119
|
+
to: payload.to,
|
|
1120
|
+
template,
|
|
1121
|
+
data: payload.data ?? {},
|
|
1122
|
+
...payload.locale !== void 0 ? { locale: payload.locale } : {},
|
|
1123
|
+
...this.commonEmailFields(payload)
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
/** Builds the raw `send` input from a resolved subject/html and payload. */
|
|
1127
|
+
toSendInput(tenantId, subject, html, payload) {
|
|
1128
|
+
return {
|
|
1129
|
+
tenantId,
|
|
1130
|
+
to: payload.to,
|
|
1131
|
+
subject,
|
|
1132
|
+
html,
|
|
1133
|
+
...payload.text !== void 0 ? { text: payload.text } : {},
|
|
1134
|
+
...this.commonEmailFields(payload)
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
/** The optional envelope fields shared by both email paths. */
|
|
1138
|
+
commonEmailFields(payload) {
|
|
1139
|
+
return {
|
|
1140
|
+
...payload.from !== void 0 ? { from: payload.from } : {},
|
|
1141
|
+
...payload.fromName !== void 0 ? { fromName: payload.fromName } : {},
|
|
1142
|
+
...payload.replyTo !== void 0 ? { replyTo: payload.replyTo } : {},
|
|
1143
|
+
...payload.tags !== void 0 ? { tags: payload.tags } : {},
|
|
1144
|
+
...payload.userId !== void 0 ? { userId: payload.userId } : {}
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
/** Builds the `generate` input from a reference and an OTP dispatch payload. */
|
|
1148
|
+
toGenerateInput(ref, payload) {
|
|
1149
|
+
return {
|
|
1150
|
+
...ref,
|
|
1151
|
+
...payload.deliverVia !== void 0 ? { deliverVia: payload.deliverVia } : {},
|
|
1152
|
+
...payload.emailTemplate !== void 0 ? { emailTemplate: payload.emailTemplate } : {},
|
|
1153
|
+
...payload.emailData !== void 0 ? { emailData: payload.emailData } : {},
|
|
1154
|
+
...payload.locale !== void 0 ? { locale: payload.locale } : {}
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
NotificationService = __decorateClass([
|
|
1159
|
+
Injectable(),
|
|
1160
|
+
__decorateParam(0, Optional()),
|
|
1161
|
+
__decorateParam(0, Inject(EmailService)),
|
|
1162
|
+
__decorateParam(1, Optional()),
|
|
1163
|
+
__decorateParam(1, Inject(OtpService))
|
|
1164
|
+
], NotificationService);
|
|
1165
|
+
|
|
1159
1166
|
// src/server/bymax-notification.module.ts
|
|
1160
1167
|
var RAW_NOTIFICATION_OPTIONS = /* @__PURE__ */ Symbol("RAW_NOTIFICATION_OPTIONS");
|
|
1161
1168
|
var BymaxNotificationModule = class {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bymax-one/nest-notification",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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",
|
|
@@ -69,16 +69,17 @@
|
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "pnpm clean && tsup",
|
|
71
71
|
"check:exports": "attw --pack .",
|
|
72
|
+
"check:mutants": "node scripts/check-mutation-directives.mjs",
|
|
72
73
|
"check:no-prisma": "grep -rq '@prisma/client' src; s=$?; [ $s -eq 1 ] && exit 0; [ $s -eq 0 ] && { echo check:no-prisma: found @prisma/client import in src/; exit 1; }; echo check:no-prisma: grep failed with exit $s; exit $s",
|
|
73
74
|
"check:published": "node scripts/check-published-surface.mjs",
|
|
74
75
|
"clean": "rm -rf dist coverage",
|
|
75
76
|
"lint": "eslint src scripts test",
|
|
76
77
|
"lint:fix": "eslint src scripts test --fix",
|
|
77
78
|
"mutation": "stryker run",
|
|
79
|
+
"mutation:full": "node -e \"require('node:fs').rmSync('reports/stryker-incremental.json',{force:true,recursive:true})\" && stryker run",
|
|
78
80
|
"mutation:dry-run": "stryker run --dryRunOnly",
|
|
79
|
-
"mutation:incremental": "stryker run --incremental",
|
|
80
81
|
"prepare": "husky",
|
|
81
|
-
"prepublishOnly": "pnpm clean && pnpm typecheck && pnpm test:types && pnpm lint && pnpm check:no-prisma && pnpm test:cov:all && pnpm build && pnpm check:published",
|
|
82
|
+
"prepublishOnly": "pnpm clean && pnpm typecheck && pnpm test:types && pnpm lint && pnpm check:mutants && pnpm check:no-prisma && pnpm test:cov:all && pnpm build && pnpm check:published",
|
|
82
83
|
"release": "npm publish --provenance --access public",
|
|
83
84
|
"size": "node scripts/check-size.mjs",
|
|
84
85
|
"smoke": "node scripts/dogfood-smoke-test.mjs",
|
|
@@ -237,24 +238,12 @@
|
|
|
237
238
|
"prettier --write"
|
|
238
239
|
]
|
|
239
240
|
},
|
|
240
|
-
"packageManager": "pnpm@
|
|
241
|
+
"packageManager": "pnpm@11.20.0",
|
|
241
242
|
"engines": {
|
|
242
243
|
"node": ">=24.0.0"
|
|
243
244
|
},
|
|
244
245
|
"publishConfig": {
|
|
245
246
|
"access": "public",
|
|
246
247
|
"registry": "https://registry.npmjs.org/"
|
|
247
|
-
},
|
|
248
|
-
"pnpm": {
|
|
249
|
-
"overrides": {
|
|
250
|
-
"brace-expansion@1": "^1.1.18",
|
|
251
|
-
"brace-expansion@2": "^2.1.4",
|
|
252
|
-
"brace-expansion@5": "^5.0.9",
|
|
253
|
-
"esbuild": "^0.28.1",
|
|
254
|
-
"fast-uri": "^3.1.5",
|
|
255
|
-
"js-yaml@3": "^3.15.0",
|
|
256
|
-
"js-yaml@4": "^4.3.0",
|
|
257
|
-
"qs": "^6.15.2"
|
|
258
|
-
}
|
|
259
248
|
}
|
|
260
249
|
}
|