emdash-smtp 0.3.0 → 0.3.2

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 CHANGED
@@ -1,5 +1,16 @@
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
+
3
14
  ## 0.1.0
4
15
 
5
16
  - Initial trusted EmDash SMTP release
package/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
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/sandbox installs
52
+ - `emdash-smtp-marketplace` for marketplace or 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.mjs CHANGED
@@ -71,11 +71,11 @@ function createPlugin() {
71
71
  }
72
72
  }
73
73
  } },
74
- routes: { admin: { handler: (async (routeCtx, ctx) => {
74
+ routes: { admin: { handler: (async (routeCtx) => {
75
75
  return handleAdminInteraction({
76
- ctx,
76
+ ctx: routeCtx,
77
77
  variant: "trusted",
78
- runtime: createTrustedRuntime(ctx),
78
+ runtime: createTrustedRuntime(routeCtx),
79
79
  interaction: routeCtx.input ?? {
80
80
  type: "page_load",
81
81
  page: "/providers"
@@ -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\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"}
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: PluginContext & { input: unknown; request: unknown },\n\t\t\t\t) => {\n\t\t\t\t\treturn handleAdminInteraction({\n\t\t\t\t\t\tctx: routeCtx as unknown as SmtpPluginContextLike,\n\t\t\t\t\t\tvariant: \"trusted\",\n\t\t\t\t\t\truntime: createTrustedRuntime(routeCtx),\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,aACI;AACJ,UAAO,uBAAuB;IAC7B,KAAK;IACL,SAAS;IACT,SAAS,qBAAqB,SAAS;IACvC,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.0",
3
+ "version": "0.3.2",
4
4
  "description": "Trusted full-parity SMTP and transactional email plugin for EmDash",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -15,18 +15,22 @@
15
15
  "types": "./dist/plugin.d.mts"
16
16
  }
17
17
  },
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"],
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "keywords": [
24
+ "emdash",
25
+ "emdash-plugin",
26
+ "smtp",
27
+ "email",
28
+ "transactional-email"
29
+ ],
26
30
  "author": "Mason James",
27
31
  "dependencies": {
28
- "emdash-smtp-core": "workspace:*",
29
- "emdash-smtp-node-transports": "workspace:*"
32
+ "emdash-smtp-core": "0.3.2",
33
+ "emdash-smtp-node-transports": "0.3.2"
30
34
  },
31
35
  "peerDependencies": {
32
36
  "emdash": ">=0.1.0"
@@ -43,5 +47,10 @@
43
47
  "homepage": "https://github.com/masonjames/emdash-smtp#readme",
44
48
  "bugs": {
45
49
  "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"
46
55
  }
47
- }
56
+ }