emdash-smtp 0.2.1 → 0.3.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 +0 -11
- package/README.md +2 -2
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +18 -24
- package/dist/plugin.mjs.map +1 -1
- package/package.json +12 -21
- package/LICENSE +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.2.1
|
|
4
|
-
|
|
5
|
-
- Strengthened README and package metadata messaging directing installers to `emdash-smtp` rather than the internal `emdash-smtp-core`/`emdash-smtp-node-transports` packages
|
|
6
|
-
- Refreshed interdependency pins to the matching 0.2.1 releases
|
|
7
|
-
|
|
8
|
-
## 0.2.0
|
|
9
|
-
|
|
10
|
-
- Renamed the trusted npm package to the unscoped `emdash-smtp`
|
|
11
|
-
- Kept the same EmDash plugin ID and `astro.config.mjs` registration flow
|
|
12
|
-
- Clarified the split between trusted npm installs and marketplace publication
|
|
13
|
-
|
|
14
3
|
## 0.1.0
|
|
15
4
|
|
|
16
5
|
- Initial trusted EmDash SMTP release
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ pnpm add emdash-smtp
|
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
import { defineConfig } from "astro/config";
|
|
26
|
-
import emdash from "emdash/astro";
|
|
26
|
+
import { emdash } from "emdash/astro";
|
|
27
27
|
import { emdashSmtp } from "emdash-smtp";
|
|
28
28
|
|
|
29
29
|
export default defineConfig({
|
|
@@ -49,7 +49,7 @@ Choose the trusted package if you need any of the following:
|
|
|
49
49
|
Choose one runtime path per site:
|
|
50
50
|
|
|
51
51
|
- `emdash-smtp` for trusted/npm installs
|
|
52
|
-
- `emdash-smtp-marketplace` for marketplace
|
|
52
|
+
- `emdash-smtp-marketplace` for marketplace/sandbox installs
|
|
53
53
|
- both distributions identify as `emdash-smtp` inside EmDash
|
|
54
54
|
|
|
55
55
|
If you need a user-installable marketplace listing and a first-party npm install path, publish both packages as a split pair.
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;iBAkFgB,YAAA,CAAA,GAAgB,cAAA"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SMTP_ADMIN_PAGES, SMTP_ADMIN_WIDGETS, SMTP_PLUGIN_ID, SMTP_PLUGIN_VERSION, collectAllowedHosts, createDeliveryLogRecord, deliverWithConfiguredProvider, handleAdminInteraction,
|
|
1
|
+
import { SMTP_ADMIN_PAGES, SMTP_ADMIN_WIDGETS, SMTP_PLUGIN_ID, SMTP_PLUGIN_VERSION, collectAllowedHosts, createDeliveryLogRecord, deliverWithConfiguredProvider, handleAdminInteraction, writeDeliveryLog } from "emdash-smtp-core";
|
|
2
2
|
import { definePlugin } from "emdash";
|
|
3
3
|
import { sendmailSend, smtpSend } from "emdash-smtp-node-transports";
|
|
4
4
|
|
|
@@ -53,30 +53,24 @@ function createPlugin() {
|
|
|
53
53
|
pages: [...SMTP_ADMIN_PAGES],
|
|
54
54
|
widgets: [...SMTP_ADMIN_WIDGETS]
|
|
55
55
|
},
|
|
56
|
-
hooks: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
throw err;
|
|
72
|
-
}
|
|
56
|
+
hooks: { "email:deliver": {
|
|
57
|
+
exclusive: true,
|
|
58
|
+
handler: async (event, ctx) => {
|
|
59
|
+
const source = event.source || ctx.plugin.id;
|
|
60
|
+
try {
|
|
61
|
+
await logSuccessfulDelivery(ctx, event, source, await deliverWithConfiguredProvider({
|
|
62
|
+
ctx,
|
|
63
|
+
runtime: createTrustedRuntime(ctx),
|
|
64
|
+
message: event.message,
|
|
65
|
+
source
|
|
66
|
+
}));
|
|
67
|
+
} catch (error) {
|
|
68
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
69
|
+
await logFailedDelivery(ctx, event, source, err);
|
|
70
|
+
throw err;
|
|
73
71
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
ctx,
|
|
77
|
-
runtime: createTrustedRuntime(ctx)
|
|
78
|
-
}) }
|
|
79
|
-
},
|
|
72
|
+
}
|
|
73
|
+
} },
|
|
80
74
|
routes: { admin: { handler: (async (routeCtx, ctx) => {
|
|
81
75
|
return handleAdminInteraction({
|
|
82
76
|
ctx,
|
package/dist/plugin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import { definePlugin } from \"emdash\";\nimport type { PluginContext, ResolvedPlugin } from \"emdash\";\n\nimport {\n\tcollectAllowedHosts,\n\tcreateDeliveryLogRecord,\n\tdeliverWithConfiguredProvider,\n\thandleAdminInteraction,\n\
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import { definePlugin } from \"emdash\";\nimport type { PluginContext, ResolvedPlugin } from \"emdash\";\n\nimport {\n\tcollectAllowedHosts,\n\tcreateDeliveryLogRecord,\n\tdeliverWithConfiguredProvider,\n\thandleAdminInteraction,\n\tSMTP_ADMIN_PAGES,\n\tSMTP_ADMIN_WIDGETS,\n\tSMTP_PLUGIN_ID,\n\tSMTP_PLUGIN_VERSION,\n\ttype AdminInteraction,\n\ttype DeliveryRuntime,\n\ttype SmtpPluginContextLike,\n\twriteDeliveryLog,\n} from \"emdash-smtp-core\";\nimport { sendmailSend, smtpSend } from \"emdash-smtp-node-transports\";\n\nfunction createTrustedRuntime(ctx: PluginContext): DeliveryRuntime {\n\treturn {\n\t\tvariant: \"trusted\",\n\t\tfetch: ctx.http ? (url, init) => ctx.http!.fetch(url, init) : undefined,\n\t\tsmtpSend,\n\t\tsendmailSend,\n\t};\n}\n\ninterface TrustedEmailDeliverEvent {\n\tmessage: {\n\t\tto: string;\n\t\tsubject: string;\n\t\ttext: string;\n\t\thtml?: string;\n\t};\n\tsource: string;\n}\n\nasync function logSuccessfulDelivery(\n\tctx: SmtpPluginContextLike,\n\tevent: TrustedEmailDeliverEvent,\n\tsource: string,\n\tresult: Awaited<ReturnType<typeof deliverWithConfiguredProvider>>,\n): Promise<void> {\n\tawait writeDeliveryLog(\n\t\tctx,\n\t\tcreateDeliveryLogRecord({\n\t\t\tproviderId: result.providerId,\n\t\t\tstatus: \"sent\",\n\t\t\tmessage: {\n\t\t\t\tto: event.message.to,\n\t\t\t\tsubject: event.message.subject,\n\t\t\t},\n\t\t\tsource,\n\t\t\tdurationMs: result.durationMs,\n\t\t\tremoteMessageId: result.remoteMessageId,\n\t\t}),\n\t);\n}\n\nasync function logFailedDelivery(\n\tctx: SmtpPluginContextLike,\n\tevent: TrustedEmailDeliverEvent,\n\tsource: string,\n\terror: Error,\n): Promise<void> {\n\tawait writeDeliveryLog(\n\t\tctx,\n\t\tcreateDeliveryLogRecord({\n\t\t\tproviderId: \"unknown\",\n\t\t\tstatus: \"failed\",\n\t\t\tmessage: {\n\t\t\t\tto: event.message.to,\n\t\t\t\tsubject: event.message.subject,\n\t\t\t},\n\t\t\tsource,\n\t\t\tdurationMs: 0,\n\t\t\terrorMessage: error.message,\n\t\t}),\n\t);\n}\n\nexport function createPlugin(): ResolvedPlugin {\n\treturn definePlugin({\n\t\tid: SMTP_PLUGIN_ID,\n\t\tversion: SMTP_PLUGIN_VERSION,\n\t\tcapabilities: [\"email:provide\", \"network:fetch\"],\n\t\tallowedHosts: collectAllowedHosts(\"trusted\"),\n\t\tstorage: {\n\t\t\tdeliveryLogs: {\n\t\t\t\tindexes: [\"providerId\", \"status\", \"createdAt\", \"source\"],\n\t\t\t},\n\t\t},\n\t\tadmin: {\n\t\t\tpages: [...SMTP_ADMIN_PAGES],\n\t\t\twidgets: [...SMTP_ADMIN_WIDGETS],\n\t\t},\n\t\thooks: {\n\t\t\t\"email:deliver\": {\n\t\t\t\texclusive: true,\n\t\t\t\thandler: async (event: TrustedEmailDeliverEvent, ctx: PluginContext) => {\n\t\t\t\t\tconst source = event.source || ctx.plugin.id;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await deliverWithConfiguredProvider({\n\t\t\t\t\t\t\tctx: ctx as unknown as SmtpPluginContextLike,\n\t\t\t\t\t\t\truntime: createTrustedRuntime(ctx),\n\t\t\t\t\t\t\tmessage: event.message,\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tawait logSuccessfulDelivery(\n\t\t\t\t\t\t\tctx as unknown as SmtpPluginContextLike,\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\tresult,\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst err = error instanceof Error ? error : new Error(String(error));\n\t\t\t\t\t\tawait logFailedDelivery(ctx as unknown as SmtpPluginContextLike, event, source, err);\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\troutes: {\n\t\t\tadmin: {\n\t\t\t\thandler: (async (\n\t\t\t\t\trouteCtx: { input: unknown; request: unknown },\n\t\t\t\t\tctx: PluginContext,\n\t\t\t\t) => {\n\t\t\t\t\treturn handleAdminInteraction({\n\t\t\t\t\t\tctx: ctx as unknown as SmtpPluginContextLike,\n\t\t\t\t\t\tvariant: \"trusted\",\n\t\t\t\t\t\truntime: createTrustedRuntime(ctx),\n\t\t\t\t\t\tinteraction: (routeCtx.input ?? { type: \"page_load\", page: \"/providers\" }) as AdminInteraction,\n\t\t\t\t\t});\n\t\t\t\t}) as never,\n\t\t\t},\n\t\t},\n\t});\n}\n\nexport default createPlugin;\n"],"mappings":";;;;;AAmBA,SAAS,qBAAqB,KAAqC;AAClE,QAAO;EACN,SAAS;EACT,OAAO,IAAI,QAAQ,KAAK,SAAS,IAAI,KAAM,MAAM,KAAK,KAAK,GAAG;EAC9D;EACA;EACA;;AAaF,eAAe,sBACd,KACA,OACA,QACA,QACgB;AAChB,OAAM,iBACL,KACA,wBAAwB;EACvB,YAAY,OAAO;EACnB,QAAQ;EACR,SAAS;GACR,IAAI,MAAM,QAAQ;GAClB,SAAS,MAAM,QAAQ;GACvB;EACD;EACA,YAAY,OAAO;EACnB,iBAAiB,OAAO;EACxB,CAAC,CACF;;AAGF,eAAe,kBACd,KACA,OACA,QACA,OACgB;AAChB,OAAM,iBACL,KACA,wBAAwB;EACvB,YAAY;EACZ,QAAQ;EACR,SAAS;GACR,IAAI,MAAM,QAAQ;GAClB,SAAS,MAAM,QAAQ;GACvB;EACD;EACA,YAAY;EACZ,cAAc,MAAM;EACpB,CAAC,CACF;;AAGF,SAAgB,eAA+B;AAC9C,QAAO,aAAa;EACnB,IAAI;EACJ,SAAS;EACT,cAAc,CAAC,iBAAiB,gBAAgB;EAChD,cAAc,oBAAoB,UAAU;EAC5C,SAAS,EACR,cAAc,EACb,SAAS;GAAC;GAAc;GAAU;GAAa;GAAS,EACxD,EACD;EACD,OAAO;GACN,OAAO,CAAC,GAAG,iBAAiB;GAC5B,SAAS,CAAC,GAAG,mBAAmB;GAChC;EACD,OAAO,EACN,iBAAiB;GAChB,WAAW;GACX,SAAS,OAAO,OAAiC,QAAuB;IACvE,MAAM,SAAS,MAAM,UAAU,IAAI,OAAO;AAC1C,QAAI;AAOH,WAAM,sBACL,KACA,OACA,QATc,MAAM,8BAA8B;MAC7C;MACL,SAAS,qBAAqB,IAAI;MAClC,SAAS,MAAM;MACf;MACA,CAAC,CAMD;aACO,OAAO;KACf,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;AACrE,WAAM,kBAAkB,KAAyC,OAAO,QAAQ,IAAI;AACpF,WAAM;;;GAGR,EACD;EACD,QAAQ,EACP,OAAO,EACN,UAAU,OACT,UACA,QACI;AACJ,UAAO,uBAAuB;IACxB;IACL,SAAS;IACT,SAAS,qBAAqB,IAAI;IAClC,aAAc,SAAS,SAAS;KAAE,MAAM;KAAa,MAAM;KAAc;IACzE,CAAC;MAEH,EACD;EACD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emdash-smtp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Trusted full-parity SMTP and transactional email plugin for EmDash",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -15,22 +15,18 @@
|
|
|
15
15
|
"types": "./dist/plugin.d.mts"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
"files": [
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"smtp",
|
|
27
|
-
"email",
|
|
28
|
-
"transactional-email"
|
|
29
|
-
],
|
|
18
|
+
"files": ["dist", "README.md", "CHANGELOG.md"],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsdown src/index.ts src/plugin.ts --format esm --dts --clean",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
23
|
+
"prepack": "pnpm build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": ["emdash", "emdash-plugin", "smtp", "email", "transactional-email"],
|
|
30
26
|
"author": "Mason James",
|
|
31
27
|
"dependencies": {
|
|
32
|
-
"emdash-smtp-core": "
|
|
33
|
-
"emdash-smtp-node-transports": "
|
|
28
|
+
"emdash-smtp-core": "workspace:*",
|
|
29
|
+
"emdash-smtp-node-transports": "workspace:*"
|
|
34
30
|
},
|
|
35
31
|
"peerDependencies": {
|
|
36
32
|
"emdash": ">=0.1.0"
|
|
@@ -47,10 +43,5 @@
|
|
|
47
43
|
"homepage": "https://github.com/masonjames/emdash-smtp#readme",
|
|
48
44
|
"bugs": {
|
|
49
45
|
"url": "https://github.com/masonjames/emdash-smtp/issues"
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"build": "tsdown src/index.ts src/plugin.ts --format esm --dts --clean",
|
|
53
|
-
"test": "vitest run",
|
|
54
|
-
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
55
46
|
}
|
|
56
|
-
}
|
|
47
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Mason James
|
|
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.
|