@classytic/notifications 2.7.0 → 2.8.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 +24 -0
- package/README.md +19 -1
- package/dist/providers/index.d.mts +13 -0
- package/dist/providers/index.mjs +33 -7
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@classytic/notifications` will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.8.0] — 2026-11-09
|
|
6
|
+
|
|
7
|
+
### Added: custom SMTP without authentication, and `requireTLS`
|
|
8
|
+
|
|
9
|
+
An IP-allow-listed relay (an enterprise mail gateway that accepts mail from known addresses and takes
|
|
10
|
+
no SMTP AUTH) could not be configured: `buildEmailTransport` always required `user` and `password`.
|
|
11
|
+
|
|
12
|
+
- `EmailPreset.authOptional` (set on `smtp` only). For such a preset, `user` and `password` both blank
|
|
13
|
+
(absent, empty or whitespace) builds the transport without `auth`. One without the other still
|
|
14
|
+
throws the same "SMTP user is required" / "Password is required" error. Every other preset keeps
|
|
15
|
+
requiring its key.
|
|
16
|
+
- `EmailCredentialData.requireTLS?: string | boolean` (boolean or the form strings `'true'` / `'false'`,
|
|
17
|
+
like `secure`; blank leaves it unset): passed to nodemailer as `requireTLS`, so the transport refuses
|
|
18
|
+
to send unless STARTTLS succeeds. Read only where the host may be overridden (`smtp`, `ses`).
|
|
19
|
+
- `getEmailCredentialSchema()` adds an optional `requireTLS` select; the `user` and `password`
|
|
20
|
+
descriptions say a relay may leave both blank.
|
|
21
|
+
|
|
22
|
+
Additive: a credential that worked before builds the same transport (no `requireTLS` key unless set).
|
|
23
|
+
Pinned by `tests/providers.email.auth-optional.test.ts` (including `testEmailCredential` against a fake
|
|
24
|
+
SMTP server: no `AUTH` command; `requireTLS` with no STARTTLS offered fails verification).
|
|
25
|
+
|
|
26
|
+
FLOW OCC adoption: `@spinekit/integrations`' email provider passes `requireTLS` through and lets the
|
|
27
|
+
administrator leave both fields blank for FLOW ICT's allow-listed relay (gap G-W1-INT-4).
|
|
28
|
+
|
|
5
29
|
## [2.7.0] — 2026-10-18
|
|
6
30
|
|
|
7
31
|
### Added — push delivery hints: `collapseKey`, `threadId`, `badge`
|
package/README.md
CHANGED
|
@@ -183,12 +183,30 @@ const channel = new EmailChannel({
|
|
|
183
183
|
| `sendgrid` | `smtp.sendgrid.net:587` | `apiKey` | User is the literal `apikey` |
|
|
184
184
|
| `mailgun` | `smtp.mailgun.org:465` | `user`, `password` | Per-domain SMTP creds |
|
|
185
185
|
| `ses` | `email-smtp.us-east-1.amazonaws.com:465` | `user`, `password` | SES IAM SMTP creds. Override `host` for other regions |
|
|
186
|
-
| `smtp` | user-supplied | `host`, `port`, `secure`, `user`, `password` | Any
|
|
186
|
+
| `smtp` | user-supplied | `host`, `port`, `secure`, `requireTLS`, `user`, `password` | Any SMTP server. Leave `user` and `password` both blank for a relay without auth (IP allow-listed) |
|
|
187
187
|
|
|
188
188
|
Host override is allowed only for `smtp` and `ses` (regional). Other
|
|
189
189
|
presets pin the host to prevent footguns like "I changed the host but
|
|
190
190
|
kept the Resend API key".
|
|
191
191
|
|
|
192
|
+
`requireTLS` (boolean or `'true'` / `'false'`, `smtp` and `ses` only)
|
|
193
|
+
makes the transport refuse to send unless STARTTLS succeeds. Custom SMTP
|
|
194
|
+
with `user` and `password` both blank builds a transport without `auth`
|
|
195
|
+
(a relay that allow-lists the sender by address); one without the other
|
|
196
|
+
still throws.
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// Enterprise relay, allow-listed by IP, STARTTLS required
|
|
200
|
+
await buildEmailTransport({
|
|
201
|
+
provider: 'smtp',
|
|
202
|
+
fromEmail: 'alerts@corp.example',
|
|
203
|
+
host: 'relay.corp.example',
|
|
204
|
+
port: 25,
|
|
205
|
+
secure: false,
|
|
206
|
+
requireTLS: true,
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
192
210
|
```typescript
|
|
193
211
|
// SES in eu-west-1
|
|
194
212
|
await buildEmailTransport({
|
|
@@ -45,6 +45,13 @@ interface EmailPreset {
|
|
|
45
45
|
* — prevents "changed host, kept the Resend key" footguns.
|
|
46
46
|
*/
|
|
47
47
|
allowHostOverride?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* `true` when the relay may take no SMTP AUTH: with BOTH `user` and
|
|
50
|
+
* `password` blank the transport is built without `auth` (an
|
|
51
|
+
* IP-allow-listed relay). One without the other is still an error.
|
|
52
|
+
* Only custom SMTP sets it; every preset keeps requiring its key.
|
|
53
|
+
*/
|
|
54
|
+
authOptional?: boolean;
|
|
48
55
|
/** Setup instructions surfaced in the Integrations UI. */
|
|
49
56
|
setupHint: string;
|
|
50
57
|
}
|
|
@@ -74,6 +81,12 @@ interface EmailCredentialData {
|
|
|
74
81
|
host?: string;
|
|
75
82
|
port?: string | number;
|
|
76
83
|
secure?: string | boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Refuse to send unless STARTTLS succeeds (nodemailer `requireTLS`).
|
|
86
|
+
* Boolean or the form strings `'true'` / `'false'`; blank leaves it
|
|
87
|
+
* unset. Read only where the host may be overridden (`smtp`, `ses`).
|
|
88
|
+
*/
|
|
89
|
+
requireTLS?: string | boolean;
|
|
77
90
|
}
|
|
78
91
|
/**
|
|
79
92
|
* Build a `nodemailer` `Transporter` from the credential blob.
|
package/dist/providers/index.mjs
CHANGED
|
@@ -59,7 +59,8 @@ const EMAIL_PRESETS = {
|
|
|
59
59
|
secure: false,
|
|
60
60
|
userSource: "user",
|
|
61
61
|
passSource: "password",
|
|
62
|
-
|
|
62
|
+
authOptional: true,
|
|
63
|
+
setupHint: "Use for SMTP servers without a preset. Standard auth-SMTP only — no OAuth-XOAUTH2. For a relay that accepts mail from allow-listed addresses without authentication, leave user and password both blank."
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
66
|
/** Convenience dropdown options for the credential UI. */
|
|
@@ -70,6 +71,14 @@ const EMAIL_PROVIDER_OPTIONS = Object.keys(EMAIL_PRESETS).map((name) => ({
|
|
|
70
71
|
|
|
71
72
|
//#endregion
|
|
72
73
|
//#region src/providers/email/transport.ts
|
|
74
|
+
function isBlank(value) {
|
|
75
|
+
return value === void 0 || value === null || String(value).trim() === "";
|
|
76
|
+
}
|
|
77
|
+
/** Boolean, or the form strings `'true'` / `'false'`; blank is `undefined`. */
|
|
78
|
+
function readFlag(value) {
|
|
79
|
+
if (typeof value === "boolean") return value;
|
|
80
|
+
if (typeof value === "string" && value.trim() !== "") return value.trim() === "true";
|
|
81
|
+
}
|
|
73
82
|
function resolveUser(data, userSource) {
|
|
74
83
|
if (userSource.startsWith("literal:")) return userSource.slice(8);
|
|
75
84
|
if (userSource === "user") {
|
|
@@ -102,6 +111,11 @@ async function buildEmailTransport(data) {
|
|
|
102
111
|
if (typeof data.secure === "boolean") secure = data.secure;
|
|
103
112
|
else if (typeof data.secure === "string") secure = data.secure === "true";
|
|
104
113
|
}
|
|
114
|
+
const requireTLS = allowOverride ? readFlag(data.requireTLS) : void 0;
|
|
115
|
+
const auth = preset.authOptional === true && preset.userSource === "user" && isBlank(data.user) && isBlank(preset.passSource === "apiKey" ? data.apiKey : data.password) ? void 0 : {
|
|
116
|
+
user: resolveUser(data, preset.userSource),
|
|
117
|
+
pass: resolvePass(data, preset.passSource)
|
|
118
|
+
};
|
|
105
119
|
let nodemailer;
|
|
106
120
|
try {
|
|
107
121
|
nodemailer = await import("nodemailer");
|
|
@@ -112,10 +126,8 @@ async function buildEmailTransport(data) {
|
|
|
112
126
|
host,
|
|
113
127
|
port,
|
|
114
128
|
secure,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
pass: resolvePass(data, preset.passSource)
|
|
118
|
-
}
|
|
129
|
+
...requireTLS !== void 0 ? { requireTLS } : {},
|
|
130
|
+
...auth ? { auth } : {}
|
|
119
131
|
});
|
|
120
132
|
}
|
|
121
133
|
/**
|
|
@@ -182,14 +194,14 @@ function getEmailCredentialSchema() {
|
|
|
182
194
|
displayName: "SMTP Username",
|
|
183
195
|
type: "text",
|
|
184
196
|
required: false,
|
|
185
|
-
description: "Gmail address, Mailgun SMTP user, or custom SMTP user."
|
|
197
|
+
description: "Gmail address, Mailgun SMTP user, or custom SMTP user. Custom SMTP: leave user and password both blank for a relay that accepts mail without authentication."
|
|
186
198
|
},
|
|
187
199
|
{
|
|
188
200
|
name: "password",
|
|
189
201
|
displayName: "SMTP Password",
|
|
190
202
|
type: "password",
|
|
191
203
|
required: false,
|
|
192
|
-
description: "Gmail app password, Mailgun SMTP password, or custom SMTP password."
|
|
204
|
+
description: "Gmail app password, Mailgun SMTP password, or custom SMTP password. Custom SMTP: leave both blank for a relay without authentication."
|
|
193
205
|
},
|
|
194
206
|
{
|
|
195
207
|
name: "host",
|
|
@@ -220,6 +232,20 @@ function getEmailCredentialSchema() {
|
|
|
220
232
|
label: "false (port 587 / STARTTLS)"
|
|
221
233
|
}],
|
|
222
234
|
description: "Custom SMTP only."
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "requireTLS",
|
|
238
|
+
displayName: "Require STARTTLS",
|
|
239
|
+
type: "select",
|
|
240
|
+
required: false,
|
|
241
|
+
options: [{
|
|
242
|
+
value: "true",
|
|
243
|
+
label: "true (refuse to send without STARTTLS)"
|
|
244
|
+
}, {
|
|
245
|
+
value: "false",
|
|
246
|
+
label: "false (use STARTTLS when offered)"
|
|
247
|
+
}],
|
|
248
|
+
description: "Custom SMTP only. With Secure false, refuse to send unless the relay upgrades to TLS."
|
|
223
249
|
}
|
|
224
250
|
];
|
|
225
251
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/notifications",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Multi-channel notifications (Email, SMS, Push, Webhook, Telegram) with rate limiting, delivery tracking, queue adapters, channel fallback, templates, retry — zero required dependencies",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -92,12 +92,13 @@
|
|
|
92
92
|
"build": "tsdown",
|
|
93
93
|
"dev": "tsdown --watch",
|
|
94
94
|
"test": "vitest run",
|
|
95
|
+
"check:skills": "node scripts/check-skills.mjs",
|
|
95
96
|
"test:watch": "vitest",
|
|
96
97
|
"test:coverage": "vitest run --coverage",
|
|
97
98
|
"test:live": "vitest run --config vitest.live.config.ts",
|
|
98
99
|
"typecheck": "tsc --noEmit && npm run typecheck:consumer",
|
|
99
100
|
"typecheck:consumer": "tsdown --logLevel warn && tsc --noEmit -p tsconfig.types.json",
|
|
100
|
-
"prepublishOnly": "npm run build && npm run typecheck && npm test",
|
|
101
|
+
"prepublishOnly": "npm run build && npm run check:skills && npm run typecheck && npm test",
|
|
101
102
|
"push": "classytic-push",
|
|
102
103
|
"publish:dry": "npm publish --dry-run --access public",
|
|
103
104
|
"publish:npm": "npm publish --access public",
|