@storyshelf/notify-email 0.0.0-stage → 0.5.3
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/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/email.d.mts +23 -0
- package/dist/email.mjs +51 -0
- package/dist/email.mjs.map +1 -0
- package/dist/http.d.mts +13 -0
- package/dist/http.mjs +44 -0
- package/dist/http.mjs.map +1 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -0
- package/dist/log.d.mts +12 -0
- package/dist/log.mjs +30 -0
- package/dist/log.mjs.map +1 -0
- package/dist/mailpit.d.mts +15 -0
- package/dist/mailpit.mjs +18 -0
- package/dist/mailpit.mjs.map +1 -0
- package/dist/smtp.d.mts +25 -0
- package/dist/smtp.mjs +76 -0
- package/dist/smtp.mjs.map +1 -0
- package/dist/types.d.mts +38 -0
- package/dist/types.mjs +20 -0
- package/dist/types.mjs.map +1 -0
- package/dist/version.mjs +12 -0
- package/dist/version.mjs.map +1 -0
- package/package.json +110 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Siddhant Gupta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @storyshelf/notify-email
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Email notification transport for StoryShelf: one SMTP/HTTP transport serves notification channels and (optionally) auth mail. Owns `nodemailer`; no other package imports it directly.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
nub add @storyshelf/notify-email
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { createShelfApp } from "@storyshelf/app";
|
|
15
|
+
import { createShelfAuth } from "@storyshelf/auth";
|
|
16
|
+
import { createEmailNotifier, smtpPreset } from "@storyshelf/notify-email";
|
|
17
|
+
|
|
18
|
+
const sender = smtpPreset({ host: "mail.example.com", port: 587, from: "shelf@example.com" });
|
|
19
|
+
const app = createShelfApp({
|
|
20
|
+
database,
|
|
21
|
+
storage,
|
|
22
|
+
notifiers: [createEmailNotifier(sender, { from: "shelf@example.com" })],
|
|
23
|
+
// Optional: invites and password resets share the same transport.
|
|
24
|
+
// auth: createShelfAuth({ db, secret, baseURL, emailSender: sender }),
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Presets: `smtpPreset` (corporate relay, Postfix, SES-over-SMTP), `mailpitPreset` (local dev, `localhost:1025`), `logPreset` (tests/unconfigured), `httpPreset` (Resend/Postmark-style JSON endpoint). See [Notifications](/guides/notifications/).
|
|
29
|
+
|
|
30
|
+
## Install notes
|
|
31
|
+
|
|
32
|
+
`smtpPreset` needs the optional `nodemailer` peer:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
nub add nodemailer
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Log and HTTP presets work without it.
|
|
39
|
+
|
|
40
|
+
## Subpaths
|
|
41
|
+
|
|
42
|
+
Each preset is importable on its own (root aggregates all):
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { smtpPreset, smtpPresetFromEnv } from "@storyshelf/notify-email/smtp";
|
|
46
|
+
import { mailpitPreset } from "@storyshelf/notify-email/mailpit";
|
|
47
|
+
import { logPreset } from "@storyshelf/notify-email/log";
|
|
48
|
+
import { httpPreset } from "@storyshelf/notify-email/http";
|
|
49
|
+
import { createEmailNotifier } from "@storyshelf/notify-email/email";
|
|
50
|
+
```
|
package/dist/email.d.mts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { EmailSender } from "@storyshelf/core/adapter/email-sender";
|
|
4
|
+
import { NotifierProvider } from "@storyshelf/core/adapter/notifier";
|
|
5
|
+
import { Logger } from "@storyshelf/core/logger";
|
|
6
|
+
//#region src/email.d.ts
|
|
7
|
+
/** Defaults applied when a channel omits sender identity. */
|
|
8
|
+
interface EmailNotifierDefaults {
|
|
9
|
+
from?: string;
|
|
10
|
+
replyTo?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create the `email` channel provider over a shared transport.
|
|
14
|
+
* The same {@link EmailSender} can also serve auth mail (invites, resets).
|
|
15
|
+
*/
|
|
16
|
+
declare function createEmailNotifier(sender: EmailSender, defaults?: EmailNotifierDefaults & {
|
|
17
|
+
logger?: Logger;
|
|
18
|
+
}): NotifierProvider;
|
|
19
|
+
/** Describe the email provider (name, version, config schema). */
|
|
20
|
+
declare function getMetadata(): NotifierProvider["metadata"];
|
|
21
|
+
//#endregion
|
|
22
|
+
export { EmailNotifierDefaults, createEmailNotifier, getMetadata };
|
|
23
|
+
//# sourceMappingURL=email.d.mts.map
|
package/dist/email.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { emailChannelConfigSchema } from "./types.mjs";
|
|
5
|
+
//#region src/email.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create the `email` channel provider over a shared transport.
|
|
8
|
+
* The same {@link EmailSender} can also serve auth mail (invites, resets).
|
|
9
|
+
*/
|
|
10
|
+
function createEmailNotifier(sender, defaults = {}) {
|
|
11
|
+
return {
|
|
12
|
+
metadata: getMetadata(),
|
|
13
|
+
create(opts) {
|
|
14
|
+
const config = emailChannelConfigSchema.parse(opts.config);
|
|
15
|
+
const logger = (opts.logger ?? defaults.logger)?.child({ component: "notify-email" });
|
|
16
|
+
return {
|
|
17
|
+
metadata: getMetadata(),
|
|
18
|
+
async send(input) {
|
|
19
|
+
logger?.debug({ channelId: input.channel.id }, "sending email notification");
|
|
20
|
+
await sender.send({
|
|
21
|
+
to: config.to,
|
|
22
|
+
subject: input.formatted.subject,
|
|
23
|
+
text: input.formatted.text,
|
|
24
|
+
html: input.formatted.html,
|
|
25
|
+
from: config.from ?? defaults.from,
|
|
26
|
+
replyTo: config.replyTo ?? defaults.replyTo
|
|
27
|
+
});
|
|
28
|
+
logger?.info({
|
|
29
|
+
channelId: input.channel.id,
|
|
30
|
+
to: config.to
|
|
31
|
+
}, "email sent");
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Describe the email provider (name, version, config schema). */
|
|
38
|
+
function getMetadata() {
|
|
39
|
+
return {
|
|
40
|
+
name: "Email",
|
|
41
|
+
version: globalThis.__PKG_VERSION__ ?? "0.0.0",
|
|
42
|
+
description: "Email notifications over a shared SMTP/HTTP transport",
|
|
43
|
+
kind: "email",
|
|
44
|
+
category: "notifier",
|
|
45
|
+
schema: emailChannelConfigSchema
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { createEmailNotifier, getMetadata };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=email.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.mjs","names":[],"sources":["../src/email.ts"],"sourcesContent":["import type { EmailSender } from \"@storyshelf/core/adapter/email-sender\";\nimport type { NotifierAdapter, NotifierProvider } from \"@storyshelf/core/adapter/notifier\";\nimport type { Logger } from \"@storyshelf/core/logger\";\nimport { emailChannelConfigSchema } from \"./types.ts\";\n\ndeclare const __PKG_VERSION__: string | undefined;\n\n/** Defaults applied when a channel omits sender identity. */\nexport interface EmailNotifierDefaults {\n from?: string;\n replyTo?: string;\n}\n\n/**\n * Create the `email` channel provider over a shared transport.\n * The same {@link EmailSender} can also serve auth mail (invites, resets).\n */\nexport function createEmailNotifier(\n sender: EmailSender,\n defaults: EmailNotifierDefaults & { logger?: Logger } = {},\n): NotifierProvider {\n return {\n metadata: getMetadata(),\n create(opts: { config: unknown; secret?: string; logger?: Logger }): NotifierAdapter {\n const config = emailChannelConfigSchema.parse(opts.config);\n const logger = (opts.logger ?? defaults.logger)?.child({ component: \"notify-email\" });\n return {\n metadata: getMetadata(),\n async send(input): Promise<void> {\n logger?.debug({ channelId: input.channel.id }, \"sending email notification\");\n await sender.send({\n to: config.to,\n subject: input.formatted.subject,\n text: input.formatted.text,\n html: input.formatted.html,\n from: config.from ?? defaults.from,\n replyTo: config.replyTo ?? defaults.replyTo,\n });\n logger?.info({ channelId: input.channel.id, to: config.to }, \"email sent\");\n },\n };\n },\n };\n}\n\n/** Describe the email provider (name, version, config schema). */\nexport function getMetadata(): NotifierProvider[\"metadata\"] {\n return {\n name: \"Email\",\n version: (globalThis as unknown as { __PKG_VERSION__?: string }).__PKG_VERSION__ ?? \"0.0.0\",\n description: \"Email notifications over a shared SMTP/HTTP transport\",\n kind: \"email\",\n category: \"notifier\",\n schema: emailChannelConfigSchema,\n };\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,oBACd,QACA,WAAwD,CAAC,GACvC;CAClB,OAAO;EACL,UAAU,YAAY;EACtB,OAAO,MAA8E;GACnF,MAAM,SAAS,yBAAyB,MAAM,KAAK,MAAM;GACzD,MAAM,UAAU,KAAK,UAAU,SAAS,OAAA,EAAS,MAAM,EAAE,WAAW,eAAe,CAAC;GACpF,OAAO;IACL,UAAU,YAAY;IACtB,MAAM,KAAK,OAAsB;KAC/B,QAAQ,MAAM,EAAE,WAAW,MAAM,QAAQ,GAAG,GAAG,4BAA4B;KAC3E,MAAM,OAAO,KAAK;MAChB,IAAI,OAAO;MACX,SAAS,MAAM,UAAU;MACzB,MAAM,MAAM,UAAU;MACtB,MAAM,MAAM,UAAU;MACtB,MAAM,OAAO,QAAQ,SAAS;MAC9B,SAAS,OAAO,WAAW,SAAS;KACtC,CAAC;KACD,QAAQ,KAAK;MAAE,WAAW,MAAM,QAAQ;MAAI,IAAI,OAAO;KAAG,GAAG,YAAY;IAC3E;GACF;EACF;CACF;AACF;;AAGA,SAAgB,cAA4C;CAC1D,OAAO;EACL,MAAM;EACN,SAAU,WAAuD,mBAAmB;EACpF,aAAa;EACb,MAAM;EACN,UAAU;EACV,QAAQ;CACV;AACF"}
|
package/dist/http.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { HttpPresetOptions } from "./types.mjs";
|
|
4
|
+
import { EmailSender } from "@storyshelf/core/adapter/email-sender";
|
|
5
|
+
import { Logger } from "@storyshelf/core/logger";
|
|
6
|
+
//#region src/http.d.ts
|
|
7
|
+
/** HTTP email-API preset (Resend/Postmark-style JSON endpoint). */
|
|
8
|
+
declare function httpPreset(options: HttpPresetOptions & {
|
|
9
|
+
logger?: Logger;
|
|
10
|
+
}): EmailSender;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { httpPreset };
|
|
13
|
+
//# sourceMappingURL=http.d.mts.map
|
package/dist/http.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { version } from "./version.mjs";
|
|
5
|
+
import { httpText } from "@storyshelf/core/utils";
|
|
6
|
+
//#region src/http.ts
|
|
7
|
+
/** HTTP email-API preset (Resend/Postmark-style JSON endpoint). */
|
|
8
|
+
function httpPreset(options) {
|
|
9
|
+
let logger = options.logger?.child({ component: "notify-email-http" });
|
|
10
|
+
return {
|
|
11
|
+
metadata: {
|
|
12
|
+
name: "HTTP",
|
|
13
|
+
version: version(),
|
|
14
|
+
kind: "email-http",
|
|
15
|
+
category: "notifier"
|
|
16
|
+
},
|
|
17
|
+
setLogger(next) {
|
|
18
|
+
logger = next.child({ component: "notify-email-http" });
|
|
19
|
+
},
|
|
20
|
+
async send(message) {
|
|
21
|
+
logger?.debug({
|
|
22
|
+
to: message.to,
|
|
23
|
+
subject: message.subject
|
|
24
|
+
}, "sending email via HTTP");
|
|
25
|
+
await httpText(options.url, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: options.headers,
|
|
28
|
+
json: {
|
|
29
|
+
from: message.from ?? options.from,
|
|
30
|
+
to: message.to,
|
|
31
|
+
subject: message.subject,
|
|
32
|
+
text: message.text,
|
|
33
|
+
html: message.html
|
|
34
|
+
},
|
|
35
|
+
logger
|
|
36
|
+
});
|
|
37
|
+
logger?.info({ to: message.to }, "email sent via HTTP");
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { httpPreset };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=http.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.mjs","names":[],"sources":["../src/http.ts"],"sourcesContent":["import type { EmailMessage, EmailSender } from \"@storyshelf/core/adapter/email-sender\";\nimport type { Logger } from \"@storyshelf/core/logger\";\nimport { httpText } from \"@storyshelf/core/utils\";\nimport type { HttpPresetOptions } from \"./types.ts\";\nimport { version } from \"./version.ts\";\n\n/** HTTP email-API preset (Resend/Postmark-style JSON endpoint). */\nexport function httpPreset(options: HttpPresetOptions & { logger?: Logger }): EmailSender {\n let logger = options.logger?.child({ component: \"notify-email-http\" });\n return {\n metadata: {\n name: \"HTTP\",\n version: version(),\n kind: \"email-http\",\n category: \"notifier\",\n },\n setLogger(next: Logger): void {\n logger = next.child({ component: \"notify-email-http\" });\n },\n async send(message: EmailMessage): Promise<void> {\n logger?.debug({ to: message.to, subject: message.subject }, \"sending email via HTTP\");\n await httpText(options.url, {\n method: \"POST\",\n headers: options.headers,\n json: {\n from: message.from ?? options.from,\n to: message.to,\n subject: message.subject,\n text: message.text,\n html: message.html,\n },\n logger,\n });\n logger?.info({ to: message.to }, \"email sent via HTTP\");\n },\n };\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,WAAW,SAA+D;CACxF,IAAI,SAAS,QAAQ,QAAQ,MAAM,EAAE,WAAW,oBAAoB,CAAC;CACrE,OAAO;EACL,UAAU;GACR,MAAM;GACN,SAAS,QAAQ;GACjB,MAAM;GACN,UAAU;EACZ;EACA,UAAU,MAAoB;GAC5B,SAAS,KAAK,MAAM,EAAE,WAAW,oBAAoB,CAAC;EACxD;EACA,MAAM,KAAK,SAAsC;GAC/C,QAAQ,MAAM;IAAE,IAAI,QAAQ;IAAI,SAAS,QAAQ;GAAQ,GAAG,wBAAwB;GACpF,MAAM,SAAS,QAAQ,KAAK;IAC1B,QAAQ;IACR,SAAS,QAAQ;IACjB,MAAM;KACJ,MAAM,QAAQ,QAAQ,QAAQ;KAC9B,IAAI,QAAQ;KACZ,SAAS,QAAQ;KACjB,MAAM,QAAQ;KACd,MAAM,QAAQ;IAChB;IACA;GACF,CAAC;GACD,QAAQ,KAAK,EAAE,IAAI,QAAQ,GAAG,GAAG,qBAAqB;EACxD;CACF;AACF"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { EmailNotifierDefaults, createEmailNotifier } from "./email.mjs";
|
|
4
|
+
import { EmailChannelConfig, HttpPresetOptions, SmtpPresetOptions, emailChannelConfigSchema } from "./types.mjs";
|
|
5
|
+
import { httpPreset } from "./http.mjs";
|
|
6
|
+
import { logPreset } from "./log.mjs";
|
|
7
|
+
import { mailpitPreset } from "./mailpit.mjs";
|
|
8
|
+
import { smtpPreset, smtpPresetFromEnv } from "./smtp.mjs";
|
|
9
|
+
export { type EmailChannelConfig, type EmailNotifierDefaults, type HttpPresetOptions, type SmtpPresetOptions, createEmailNotifier, emailChannelConfigSchema, httpPreset, logPreset, mailpitPreset, smtpPreset, smtpPresetFromEnv };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { emailChannelConfigSchema } from "./types.mjs";
|
|
5
|
+
import { createEmailNotifier } from "./email.mjs";
|
|
6
|
+
import { httpPreset } from "./http.mjs";
|
|
7
|
+
import { logPreset } from "./log.mjs";
|
|
8
|
+
import { smtpPreset, smtpPresetFromEnv } from "./smtp.mjs";
|
|
9
|
+
import { mailpitPreset } from "./mailpit.mjs";
|
|
10
|
+
//#region src/index.ts
|
|
11
|
+
/**
|
|
12
|
+
* Email notification transport: SMTP/Mailpit/log/HTTP presets plus the
|
|
13
|
+
* `email` channel provider. One transport serves notification channels
|
|
14
|
+
* and (optionally) auth mail — wire the same sender into both.
|
|
15
|
+
*/
|
|
16
|
+
//#endregion
|
|
17
|
+
export { createEmailNotifier, emailChannelConfigSchema, httpPreset, logPreset, mailpitPreset, smtpPreset, smtpPresetFromEnv };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { createEmailNotifier } from \"./email.ts\";\n/**\n * Email notification transport: SMTP/Mailpit/log/HTTP presets plus the\n * `email` channel provider. One transport serves notification channels\n * and (optionally) auth mail — wire the same sender into both.\n */\nimport { httpPreset } from \"./http.ts\";\nimport { logPreset } from \"./log.ts\";\nimport { mailpitPreset } from \"./mailpit.ts\";\nimport { smtpPreset, smtpPresetFromEnv } from \"./smtp.ts\";\n\n/** SMTP transport preset (corporate relay, Postfix, SES-over-SMTP). */\nexport { smtpPreset };\n/** SMTP sender from `SMTP_*` environment (undefined unless configured). */\nexport { smtpPresetFromEnv };\n/** Mailpit/Mailhog preset for local development (no real delivery). */\nexport { mailpitPreset };\n/** Log-only preset for tests and unconfigured servers (no delivery). */\nexport { logPreset };\n/** HTTP email-API preset (Resend/Postmark-style JSON endpoint). */\nexport { httpPreset };\n/** `email` channel provider over a shared transport. */\nexport { createEmailNotifier };\n\nexport type { EmailNotifierDefaults } from \"./email.ts\";\nexport type { EmailChannelConfig, HttpPresetOptions, SmtpPresetOptions } from \"./types.ts\";\nexport { emailChannelConfigSchema } from \"./types.ts\";\n"],"mappings":""}
|
package/dist/log.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { EmailSender } from "@storyshelf/core/adapter/email-sender";
|
|
4
|
+
import { Logger } from "@storyshelf/core/logger";
|
|
5
|
+
//#region src/log.d.ts
|
|
6
|
+
/** Log-only preset for tests and unconfigured servers (no delivery). */
|
|
7
|
+
declare function logPreset(options?: {
|
|
8
|
+
logger?: Logger;
|
|
9
|
+
}): EmailSender;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { logPreset };
|
|
12
|
+
//# sourceMappingURL=log.d.mts.map
|
package/dist/log.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { version } from "./version.mjs";
|
|
5
|
+
//#region src/log.ts
|
|
6
|
+
/** Log-only preset for tests and unconfigured servers (no delivery). */
|
|
7
|
+
function logPreset(options = {}) {
|
|
8
|
+
let logger = options.logger?.child({ component: "notify-email-log" });
|
|
9
|
+
return {
|
|
10
|
+
metadata: {
|
|
11
|
+
name: "Log",
|
|
12
|
+
version: version(),
|
|
13
|
+
kind: "email-log",
|
|
14
|
+
category: "notifier"
|
|
15
|
+
},
|
|
16
|
+
setLogger(next) {
|
|
17
|
+
logger = next.child({ component: "notify-email-log" });
|
|
18
|
+
},
|
|
19
|
+
async send(message) {
|
|
20
|
+
logger?.info({
|
|
21
|
+
to: message.to,
|
|
22
|
+
subject: message.subject
|
|
23
|
+
}, "email notification (log)");
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { logPreset };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=log.mjs.map
|
package/dist/log.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.mjs","names":[],"sources":["../src/log.ts"],"sourcesContent":["import type { EmailMessage, EmailSender } from \"@storyshelf/core/adapter/email-sender\";\nimport type { Logger } from \"@storyshelf/core/logger\";\nimport { version } from \"./version.ts\";\n\n/** Log-only preset for tests and unconfigured servers (no delivery). */\nexport function logPreset(options: { logger?: Logger } = {}): EmailSender {\n let logger = options.logger?.child({ component: \"notify-email-log\" });\n return {\n metadata: { name: \"Log\", version: version(), kind: \"email-log\", category: \"notifier\" },\n setLogger(next: Logger): void {\n logger = next.child({ component: \"notify-email-log\" });\n },\n // oxlint-disable-next-line eslint/require-await -- send is async by contract\n async send(message: EmailMessage): Promise<void> {\n logger?.info({ to: message.to, subject: message.subject }, \"email notification (log)\");\n },\n };\n}\n"],"mappings":";;;;;;AAKA,SAAgB,UAAU,UAA+B,CAAC,GAAgB;CACxE,IAAI,SAAS,QAAQ,QAAQ,MAAM,EAAE,WAAW,mBAAmB,CAAC;CACpE,OAAO;EACL,UAAU;GAAE,MAAM;GAAO,SAAS,QAAQ;GAAG,MAAM;GAAa,UAAU;EAAW;EACrF,UAAU,MAAoB;GAC5B,SAAS,KAAK,MAAM,EAAE,WAAW,mBAAmB,CAAC;EACvD;EAEA,MAAM,KAAK,SAAsC;GAC/C,QAAQ,KAAK;IAAE,IAAI,QAAQ;IAAI,SAAS,QAAQ;GAAQ,GAAG,0BAA0B;EACvF;CACF;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { EmailSender } from "@storyshelf/core/adapter/email-sender";
|
|
4
|
+
import { Logger } from "@storyshelf/core/logger";
|
|
5
|
+
//#region src/mailpit.d.ts
|
|
6
|
+
/** Mailpit/Mailhog preset for local development (no real delivery). */
|
|
7
|
+
declare function mailpitPreset(options?: {
|
|
8
|
+
from?: string;
|
|
9
|
+
host?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
}): EmailSender;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { mailpitPreset };
|
|
15
|
+
//# sourceMappingURL=mailpit.d.mts.map
|
package/dist/mailpit.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { smtpPreset } from "./smtp.mjs";
|
|
5
|
+
//#region src/mailpit.ts
|
|
6
|
+
/** Mailpit/Mailhog preset for local development (no real delivery). */
|
|
7
|
+
function mailpitPreset(options = {}) {
|
|
8
|
+
return smtpPreset({
|
|
9
|
+
host: options.host ?? "localhost",
|
|
10
|
+
port: options.port ?? 1025,
|
|
11
|
+
from: options.from ?? "storyshelf@localhost",
|
|
12
|
+
logger: options.logger
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { mailpitPreset };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=mailpit.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailpit.mjs","names":[],"sources":["../src/mailpit.ts"],"sourcesContent":["import type { EmailSender } from \"@storyshelf/core/adapter/email-sender\";\nimport type { Logger } from \"@storyshelf/core/logger\";\nimport { smtpPreset } from \"./smtp.ts\";\n\n/** Mailpit/Mailhog preset for local development (no real delivery). */\nexport function mailpitPreset(\n options: { from?: string; host?: string; port?: number; logger?: Logger } = {},\n): EmailSender {\n return smtpPreset({\n host: options.host ?? \"localhost\",\n port: options.port ?? 1025,\n from: options.from ?? \"storyshelf@localhost\",\n logger: options.logger,\n });\n}\n"],"mappings":";;;;;;AAKA,SAAgB,cACd,UAA4E,CAAC,GAChE;CACb,OAAO,WAAW;EAChB,MAAM,QAAQ,QAAQ;EACtB,MAAM,QAAQ,QAAQ;EACtB,MAAM,QAAQ,QAAQ;EACtB,QAAQ,QAAQ;CAClB,CAAC;AACH"}
|
package/dist/smtp.d.mts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { SmtpPresetOptions } from "./types.mjs";
|
|
4
|
+
import { EmailSender } from "@storyshelf/core/adapter/email-sender";
|
|
5
|
+
import { Logger } from "@storyshelf/core/logger";
|
|
6
|
+
//#region src/smtp.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* SMTP transport preset (corporate relay, Postfix, SES-over-SMTP).
|
|
9
|
+
*
|
|
10
|
+
* Requires the optional `nodemailer` peer (`nub add nodemailer`).
|
|
11
|
+
*/
|
|
12
|
+
declare function smtpPreset(options: SmtpPresetOptions & {
|
|
13
|
+
logger?: Logger;
|
|
14
|
+
}): EmailSender;
|
|
15
|
+
/**
|
|
16
|
+
* SMTP sender from the environment (`SMTP_HOST`, `SMTP_PORT`, `SMTP_SECURE`,
|
|
17
|
+
* `SMTP_USER`, `SMTP_PASS`, `SMTP_FROM`). Returns undefined unless
|
|
18
|
+
* `SMTP_HOST` is set, so unconfigured servers keep current behavior.
|
|
19
|
+
*
|
|
20
|
+
* Requires the optional `nodemailer` peer when a sender is built.
|
|
21
|
+
*/
|
|
22
|
+
declare function smtpPresetFromEnv(env?: Record<string, string | undefined>, logger?: Logger): EmailSender | undefined;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { smtpPreset, smtpPresetFromEnv };
|
|
25
|
+
//# sourceMappingURL=smtp.d.mts.map
|
package/dist/smtp.mjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { version } from "./version.mjs";
|
|
5
|
+
import nodemailer from "nodemailer";
|
|
6
|
+
//#region src/smtp.ts
|
|
7
|
+
/**
|
|
8
|
+
* SMTP transport preset (corporate relay, Postfix, SES-over-SMTP).
|
|
9
|
+
*
|
|
10
|
+
* Requires the optional `nodemailer` peer (`nub add nodemailer`).
|
|
11
|
+
*/
|
|
12
|
+
function smtpPreset(options) {
|
|
13
|
+
const transporter = nodemailer.createTransport({
|
|
14
|
+
host: options.host,
|
|
15
|
+
port: options.port,
|
|
16
|
+
secure: options.secure ?? options.port === 465,
|
|
17
|
+
auth: options.user ? {
|
|
18
|
+
user: options.user,
|
|
19
|
+
pass: options.pass
|
|
20
|
+
} : void 0
|
|
21
|
+
});
|
|
22
|
+
const from = options.from;
|
|
23
|
+
let logger = options.logger?.child({ component: "notify-email-smtp" });
|
|
24
|
+
return {
|
|
25
|
+
metadata: {
|
|
26
|
+
name: "SMTP",
|
|
27
|
+
version: version(),
|
|
28
|
+
kind: "email-smtp",
|
|
29
|
+
category: "notifier"
|
|
30
|
+
},
|
|
31
|
+
setLogger(next) {
|
|
32
|
+
logger = next.child({ component: "notify-email-smtp" });
|
|
33
|
+
},
|
|
34
|
+
async send(message) {
|
|
35
|
+
logger?.debug({
|
|
36
|
+
to: message.to,
|
|
37
|
+
subject: message.subject
|
|
38
|
+
}, "sending email");
|
|
39
|
+
await transporter.sendMail({
|
|
40
|
+
from: message.from ?? from,
|
|
41
|
+
to: message.to,
|
|
42
|
+
subject: message.subject,
|
|
43
|
+
text: message.text,
|
|
44
|
+
html: message.html,
|
|
45
|
+
replyTo: message.replyTo
|
|
46
|
+
});
|
|
47
|
+
logger?.info({ to: message.to }, "email sent");
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* SMTP sender from the environment (`SMTP_HOST`, `SMTP_PORT`, `SMTP_SECURE`,
|
|
53
|
+
* `SMTP_USER`, `SMTP_PASS`, `SMTP_FROM`). Returns undefined unless
|
|
54
|
+
* `SMTP_HOST` is set, so unconfigured servers keep current behavior.
|
|
55
|
+
*
|
|
56
|
+
* Requires the optional `nodemailer` peer when a sender is built.
|
|
57
|
+
*/
|
|
58
|
+
function smtpPresetFromEnv(env = process.env, logger) {
|
|
59
|
+
const host = env["SMTP_HOST"];
|
|
60
|
+
const from = env["SMTP_FROM"];
|
|
61
|
+
if (!host || !from) return;
|
|
62
|
+
const port = Number(env["SMTP_PORT"] ?? 587);
|
|
63
|
+
return smtpPreset({
|
|
64
|
+
host,
|
|
65
|
+
port: Number.isSafeInteger(port) && port > 0 ? port : 587,
|
|
66
|
+
secure: env["SMTP_SECURE"] === "1" || env["SMTP_SECURE"] === "true",
|
|
67
|
+
user: env["SMTP_USER"],
|
|
68
|
+
pass: env["SMTP_PASS"],
|
|
69
|
+
from,
|
|
70
|
+
logger
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { smtpPreset, smtpPresetFromEnv };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=smtp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smtp.mjs","names":[],"sources":["../src/smtp.ts"],"sourcesContent":["import type { EmailMessage, EmailSender } from \"@storyshelf/core/adapter/email-sender\";\nimport type { Logger } from \"@storyshelf/core/logger\";\nimport nodemailer from \"nodemailer\";\nimport type { SmtpPresetOptions } from \"./types.ts\";\nimport { version } from \"./version.ts\";\n\n/**\n * SMTP transport preset (corporate relay, Postfix, SES-over-SMTP).\n *\n * Requires the optional `nodemailer` peer (`nub add nodemailer`).\n */\nexport function smtpPreset(options: SmtpPresetOptions & { logger?: Logger }): EmailSender {\n const transporter = nodemailer.createTransport({\n host: options.host,\n port: options.port,\n secure: options.secure ?? options.port === 465,\n auth: options.user ? { user: options.user, pass: options.pass } : undefined,\n });\n const from = options.from;\n let logger = options.logger?.child({ component: \"notify-email-smtp\" });\n return {\n metadata: {\n name: \"SMTP\",\n version: version(),\n kind: \"email-smtp\",\n category: \"notifier\",\n },\n setLogger(next: Logger): void {\n logger = next.child({ component: \"notify-email-smtp\" });\n },\n async send(message: EmailMessage): Promise<void> {\n logger?.debug({ to: message.to, subject: message.subject }, \"sending email\");\n await transporter.sendMail({\n from: message.from ?? from,\n to: message.to,\n subject: message.subject,\n text: message.text,\n html: message.html,\n replyTo: message.replyTo,\n });\n logger?.info({ to: message.to }, \"email sent\");\n },\n };\n}\n\n/**\n * SMTP sender from the environment (`SMTP_HOST`, `SMTP_PORT`, `SMTP_SECURE`,\n * `SMTP_USER`, `SMTP_PASS`, `SMTP_FROM`). Returns undefined unless\n * `SMTP_HOST` is set, so unconfigured servers keep current behavior.\n *\n * Requires the optional `nodemailer` peer when a sender is built.\n */\nexport function smtpPresetFromEnv(\n env: Record<string, string | undefined> = process.env,\n logger?: Logger,\n): EmailSender | undefined {\n const host = env[\"SMTP_HOST\"];\n const from = env[\"SMTP_FROM\"];\n if (!host || !from) {\n return undefined;\n }\n const port = Number(env[\"SMTP_PORT\"] ?? 587);\n return smtpPreset({\n host,\n port: Number.isSafeInteger(port) && port > 0 ? port : 587,\n secure: env[\"SMTP_SECURE\"] === \"1\" || env[\"SMTP_SECURE\"] === \"true\",\n user: env[\"SMTP_USER\"],\n pass: env[\"SMTP_PASS\"],\n from,\n logger,\n });\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,WAAW,SAA+D;CACxF,MAAM,cAAc,WAAW,gBAAgB;EAC7C,MAAM,QAAQ;EACd,MAAM,QAAQ;EACd,QAAQ,QAAQ,UAAU,QAAQ,SAAS;EAC3C,MAAM,QAAQ,OAAO;GAAE,MAAM,QAAQ;GAAM,MAAM,QAAQ;EAAK,IAAI,KAAA;CACpE,CAAC;CACD,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,QAAQ,QAAQ,MAAM,EAAE,WAAW,oBAAoB,CAAC;CACrE,OAAO;EACL,UAAU;GACR,MAAM;GACN,SAAS,QAAQ;GACjB,MAAM;GACN,UAAU;EACZ;EACA,UAAU,MAAoB;GAC5B,SAAS,KAAK,MAAM,EAAE,WAAW,oBAAoB,CAAC;EACxD;EACA,MAAM,KAAK,SAAsC;GAC/C,QAAQ,MAAM;IAAE,IAAI,QAAQ;IAAI,SAAS,QAAQ;GAAQ,GAAG,eAAe;GAC3E,MAAM,YAAY,SAAS;IACzB,MAAM,QAAQ,QAAQ;IACtB,IAAI,QAAQ;IACZ,SAAS,QAAQ;IACjB,MAAM,QAAQ;IACd,MAAM,QAAQ;IACd,SAAS,QAAQ;GACnB,CAAC;GACD,QAAQ,KAAK,EAAE,IAAI,QAAQ,GAAG,GAAG,YAAY;EAC/C;CACF;AACF;;;;;;;;AASA,SAAgB,kBACd,MAA0C,QAAQ,KAClD,QACyB;CACzB,MAAM,OAAO,IAAI;CACjB,MAAM,OAAO,IAAI;CACjB,IAAI,CAAC,QAAQ,CAAC,MACZ;CAEF,MAAM,OAAO,OAAO,IAAI,gBAAgB,GAAG;CAC3C,OAAO,WAAW;EAChB;EACA,MAAM,OAAO,cAAc,IAAI,KAAK,OAAO,IAAI,OAAO;EACtD,QAAQ,IAAI,mBAAmB,OAAO,IAAI,mBAAmB;EAC7D,MAAM,IAAI;EACV,MAAM,IAAI;EACV;EACA;CACF,CAAC;AACH"}
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
/** Display toggles plus addressing for email channels. */
|
|
6
|
+
declare const emailChannelConfigSchema: z.ZodObject<{
|
|
7
|
+
to: z.ZodString;
|
|
8
|
+
from: z.ZodOptional<z.ZodString>;
|
|
9
|
+
replyTo: z.ZodOptional<z.ZodString>;
|
|
10
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
compact: "compact";
|
|
12
|
+
verbose: "verbose";
|
|
13
|
+
}>>;
|
|
14
|
+
subjectPrefix: z.ZodOptional<z.ZodString>;
|
|
15
|
+
includeAuthor: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
includeMessage: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
includeCounts: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
/** Email channel config (addressing + display toggles). */
|
|
20
|
+
type EmailChannelConfig = z.infer<typeof emailChannelConfigSchema>;
|
|
21
|
+
/** SMTP transport options for {@link smtpPreset}. */
|
|
22
|
+
interface SmtpPresetOptions {
|
|
23
|
+
host: string;
|
|
24
|
+
port: number;
|
|
25
|
+
secure?: boolean;
|
|
26
|
+
user?: string;
|
|
27
|
+
pass?: string;
|
|
28
|
+
from: string;
|
|
29
|
+
}
|
|
30
|
+
/** HTTP email-API options for {@link httpPreset} (Resend-style). */
|
|
31
|
+
interface HttpPresetOptions {
|
|
32
|
+
url: string;
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
from: string;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { EmailChannelConfig, HttpPresetOptions, SmtpPresetOptions, emailChannelConfigSchema };
|
|
38
|
+
//# sourceMappingURL=types.d.mts.map
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/types.ts
|
|
6
|
+
/** Display toggles plus addressing for email channels. */
|
|
7
|
+
const emailChannelConfigSchema = z.object({
|
|
8
|
+
to: z.string().min(1),
|
|
9
|
+
from: z.string().min(1).optional(),
|
|
10
|
+
replyTo: z.string().min(1).optional(),
|
|
11
|
+
style: z.enum(["compact", "verbose"]).optional(),
|
|
12
|
+
subjectPrefix: z.string().min(1).optional(),
|
|
13
|
+
includeAuthor: z.boolean().optional(),
|
|
14
|
+
includeMessage: z.boolean().optional(),
|
|
15
|
+
includeCounts: z.boolean().optional()
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { emailChannelConfigSchema };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** Display toggles plus addressing for email channels. */\nexport const emailChannelConfigSchema = z.object({\n to: z.string().min(1),\n from: z.string().min(1).optional(),\n replyTo: z.string().min(1).optional(),\n style: z.enum([\"compact\", \"verbose\"]).optional(),\n subjectPrefix: z.string().min(1).optional(),\n includeAuthor: z.boolean().optional(),\n includeMessage: z.boolean().optional(),\n includeCounts: z.boolean().optional(),\n});\n\n/** Email channel config (addressing + display toggles). */\nexport type EmailChannelConfig = z.infer<typeof emailChannelConfigSchema>;\n\n/** SMTP transport options for {@link smtpPreset}. */\nexport interface SmtpPresetOptions {\n host: string;\n port: number;\n secure?: boolean;\n user?: string;\n pass?: string;\n from: string;\n}\n\n/** HTTP email-API options for {@link httpPreset} (Resend-style). */\nexport interface HttpPresetOptions {\n url: string;\n headers?: Record<string, string>;\n from: string;\n}\n"],"mappings":";;;;;;AAGA,MAAa,2BAA2B,EAAE,OAAO;CAC/C,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CACjC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CACpC,OAAO,EAAE,KAAK,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,SAAS;CAC/C,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAC1C,eAAe,EAAE,QAAQ,CAAC,CAAC,SAAS;CACpC,gBAAgB,EAAE,QAAQ,CAAC,CAAC,SAAS;CACrC,eAAe,EAAE,QAAQ,CAAC,CAAC,SAAS;AACtC,CAAC"}
|
package/dist/version.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/version.ts
|
|
5
|
+
/** Package version injected at build via __PKG_VERSION__. */
|
|
6
|
+
function version() {
|
|
7
|
+
return globalThis.__PKG_VERSION__ ?? "0.0.0";
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { version };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=version.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.mjs","names":[],"sources":["../src/version.ts"],"sourcesContent":["declare const __PKG_VERSION__: string | undefined;\n\n/** Package version injected at build via __PKG_VERSION__. */\nexport function version(): string {\n return (globalThis as unknown as { __PKG_VERSION__?: string }).__PKG_VERSION__ ?? \"0.0.0\";\n}\n"],"mappings":";;;;;AAGA,SAAgB,UAAkB;CAChC,OAAQ,WAAuD,mBAAmB;AACpF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyshelf/notify-email",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.5.3",
|
|
4
|
+
"description": "Email notification transport for StoryShelf (SMTP, Mailpit, log, HTTP APIs).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"email",
|
|
7
|
+
"notifications",
|
|
8
|
+
"self-hosted",
|
|
9
|
+
"smtp",
|
|
10
|
+
"storybook"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/GuptaSiddhant/StoryShelf#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/GuptaSiddhant/StoryShelf/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Siddhant Gupta",
|
|
19
|
+
"url": "https://guptasiddhant.com"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/GuptaSiddhant/StoryShelf.git",
|
|
24
|
+
"directory": "packages/notify-email"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"types": "./dist/index.d.mts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"source": "./src/index.ts",
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./email": {
|
|
38
|
+
"source": "./src/email.ts",
|
|
39
|
+
"default": "./dist/email.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./http": {
|
|
42
|
+
"source": "./src/http.ts",
|
|
43
|
+
"default": "./dist/http.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./log": {
|
|
46
|
+
"source": "./src/log.ts",
|
|
47
|
+
"default": "./dist/log.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./mailpit": {
|
|
50
|
+
"source": "./src/mailpit.ts",
|
|
51
|
+
"default": "./dist/mailpit.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./smtp": {
|
|
54
|
+
"source": "./src/smtp.ts",
|
|
55
|
+
"default": "./dist/smtp.mjs"
|
|
56
|
+
},
|
|
57
|
+
"./package.json": "./package.json"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"exports": {
|
|
61
|
+
".": "./dist/index.mjs",
|
|
62
|
+
"./email": "./dist/email.mjs",
|
|
63
|
+
"./http": "./dist/http.mjs",
|
|
64
|
+
"./log": "./dist/log.mjs",
|
|
65
|
+
"./mailpit": "./dist/mailpit.mjs",
|
|
66
|
+
"./smtp": "./dist/smtp.mjs",
|
|
67
|
+
"./package.json": "./package.json"
|
|
68
|
+
},
|
|
69
|
+
"access": "public"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "tsdown",
|
|
73
|
+
"dev": "tsdown -w",
|
|
74
|
+
"fmt": "oxfmt ./src",
|
|
75
|
+
"lint": "oxlint --type-aware --type-check ./src",
|
|
76
|
+
"test": "vitest run",
|
|
77
|
+
"prepublishOnly": "nub run build"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@storyshelf/core": "0.5.3",
|
|
81
|
+
"zod": "^4.2.0"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@types/node": "^26.0.0",
|
|
85
|
+
"@types/nodemailer": "^8.0.2",
|
|
86
|
+
"@vitest/coverage-v8": "^4.0.0",
|
|
87
|
+
"nodemailer": "^10.0.12",
|
|
88
|
+
"oxfmt": "^0.65.0",
|
|
89
|
+
"oxlint": "^1.80.0",
|
|
90
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
91
|
+
"tsdown": "^0.22.14",
|
|
92
|
+
"typescript": "^7.0.2",
|
|
93
|
+
"vitest": "^5.0.0"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"nodemailer": "^10.0.12"
|
|
97
|
+
},
|
|
98
|
+
"peerDependenciesMeta": {
|
|
99
|
+
"nodemailer": {
|
|
100
|
+
"optional": true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"jsr": {
|
|
104
|
+
"runtimeCompat": {
|
|
105
|
+
"node": true,
|
|
106
|
+
"deno": false,
|
|
107
|
+
"browser": false,
|
|
108
|
+
"workerd": false,
|
|
109
|
+
"bun": true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|