@masonjames/emdash-smtp-marketplace 0.1.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 ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial marketplace-safe EmDash SMTP release
6
+ - HTTP API and OAuth-capable provider coverage for the marketplace-safe EmDash SMTP package
7
+ - Block Kit admin UI for provider configuration, testing, and delivery logs
8
+ - Ready for `emdash plugin bundle` and `emdash plugin publish`
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 ADDED
@@ -0,0 +1,62 @@
1
+ # `@masonjames/emdash-smtp-marketplace`
2
+
3
+ Marketplace-safe EmDash SMTP plugin package.
4
+
5
+ This package is designed for `emdash plugin bundle` / `emdash plugin publish` and for sandbox-compatible installs where delivery happens through HTTP API and OAuth-based providers. It publishes the same EmDash SMTP plugin identity (`emdash-smtp`) in standard/sandboxed form.
6
+
7
+ ## Includes
8
+
9
+ - marketplace-safe standard plugin descriptor
10
+ - sandbox entrypoint for EmDash marketplace bundles
11
+ - Block Kit admin pages for provider settings and delivery logs
12
+ - HTTP API and OAuth-capable provider coverage for the sandbox-safe EmDash SMTP package
13
+
14
+ ## Direct config install
15
+
16
+ ```bash
17
+ pnpm add @masonjames/emdash-smtp-marketplace
18
+ ```
19
+
20
+ ```ts
21
+ import { defineConfig } from "astro/config";
22
+ import emdash from "emdash/astro";
23
+ import { emdashSmtpMarketplace } from "@masonjames/emdash-smtp-marketplace";
24
+
25
+ export default defineConfig({
26
+ integrations: [
27
+ emdash({
28
+ sandboxRunner: "@emdash-cms/cloudflare/sandbox",
29
+ sandboxed: [emdashSmtpMarketplace()],
30
+ }),
31
+ ],
32
+ });
33
+ ```
34
+
35
+ ## Marketplace publishing
36
+
37
+ Run these commands from the repo root:
38
+
39
+ ```bash
40
+ pnpm validate:marketplace
41
+ pnpm bundle:marketplace
42
+ pnpm publish:marketplace
43
+ ```
44
+
45
+ That flow ultimately uses `emdash plugin publish --build` for `packages/emdash-smtp-marketplace`.
46
+
47
+ ## Limits of the sandbox variant
48
+
49
+ The marketplace-safe package intentionally excludes trusted-only transports:
50
+
51
+ - Generic SMTP
52
+ - local sendmail / PHP mail analogue
53
+
54
+ Use `@masonjames/emdash-smtp` instead when those transports are required.
55
+
56
+ ## Plugin ID
57
+
58
+ The marketplace distribution uses the same EmDash plugin ID as the trusted package:
59
+
60
+ - `emdash-smtp`
61
+
62
+ Do not install both variants on the same site at the same time.
@@ -0,0 +1,8 @@
1
+ import { PluginDescriptor } from "emdash";
2
+
3
+ //#region src/index.d.ts
4
+ declare const SMTP_MARKETPLACE_PLUGIN_ID = "emdash-smtp";
5
+ declare function emdashSmtpMarketplace(): PluginDescriptor;
6
+ //#endregion
7
+ export { SMTP_MARKETPLACE_PLUGIN_ID, emdashSmtpMarketplace };
8
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAUa,0BAAA;AAAA,iBAEG,qBAAA,CAAA,GAAyB,gBAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,26 @@
1
+ import { SMTP_ADMIN_PAGES, SMTP_ADMIN_WIDGETS, SMTP_PLUGIN_ID, SMTP_PLUGIN_VERSION, collectAllowedHosts } from "@masonjames/emdash-smtp-core";
2
+
3
+ //#region src/index.ts
4
+ const SMTP_MARKETPLACE_PLUGIN_ID = SMTP_PLUGIN_ID;
5
+ function emdashSmtpMarketplace() {
6
+ return {
7
+ id: SMTP_MARKETPLACE_PLUGIN_ID,
8
+ version: SMTP_PLUGIN_VERSION,
9
+ format: "standard",
10
+ entrypoint: "@masonjames/emdash-smtp-marketplace/sandbox",
11
+ capabilities: ["email:provide", "network:fetch"],
12
+ allowedHosts: collectAllowedHosts("marketplace"),
13
+ storage: { deliveryLogs: { indexes: [
14
+ "providerId",
15
+ "status",
16
+ "createdAt",
17
+ "source"
18
+ ] } },
19
+ adminPages: [...SMTP_ADMIN_PAGES],
20
+ adminWidgets: [...SMTP_ADMIN_WIDGETS]
21
+ };
22
+ }
23
+
24
+ //#endregion
25
+ export { SMTP_MARKETPLACE_PLUGIN_ID, emdashSmtpMarketplace };
26
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { PluginDescriptor } from \"emdash\";\n\nimport {\n\tcollectAllowedHosts,\n\tSMTP_ADMIN_PAGES,\n\tSMTP_ADMIN_WIDGETS,\n\tSMTP_PLUGIN_ID,\n\tSMTP_PLUGIN_VERSION,\n} from \"@masonjames/emdash-smtp-core\";\n\nexport const SMTP_MARKETPLACE_PLUGIN_ID = SMTP_PLUGIN_ID;\n\nexport function emdashSmtpMarketplace(): PluginDescriptor {\n\treturn {\n\t\tid: SMTP_MARKETPLACE_PLUGIN_ID,\n\t\tversion: SMTP_PLUGIN_VERSION,\n\t\tformat: \"standard\",\n\t\tentrypoint: \"@masonjames/emdash-smtp-marketplace/sandbox\",\n\t\tcapabilities: [\"email:provide\", \"network:fetch\"],\n\t\tallowedHosts: collectAllowedHosts(\"marketplace\"),\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\tadminPages: [...SMTP_ADMIN_PAGES],\n\t\tadminWidgets: [...SMTP_ADMIN_WIDGETS],\n\t};\n}\n"],"mappings":";;;AAUA,MAAa,6BAA6B;AAE1C,SAAgB,wBAA0C;AACzD,QAAO;EACN,IAAI;EACJ,SAAS;EACT,QAAQ;EACR,YAAY;EACZ,cAAc,CAAC,iBAAiB,gBAAgB;EAChD,cAAc,oBAAoB,cAAc;EAChD,SAAS,EACR,cAAc,EACb,SAAS;GAAC;GAAc;GAAU;GAAa;GAAS,EACxD,EACD;EACD,YAAY,CAAC,GAAG,iBAAiB;EACjC,cAAc,CAAC,GAAG,mBAAmB;EACrC"}
@@ -0,0 +1,7 @@
1
+ import * as emdash from "emdash";
2
+
3
+ //#region src/sandbox-entry.d.ts
4
+ declare const _default: emdash.StandardPluginDefinition;
5
+ //#endregion
6
+ export { _default as default };
7
+ //# sourceMappingURL=sandbox-entry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-entry.d.mts","names":[],"sources":["../src/sandbox-entry.ts"],"mappings":""}
@@ -0,0 +1,72 @@
1
+ import { createDeliveryLogRecord, deliverWithConfiguredProvider, handleAdminInteraction, isDeliveryReady, writeDeliveryLog } from "@masonjames/emdash-smtp-core";
2
+ import { definePlugin } from "emdash";
3
+
4
+ //#region src/sandbox-entry.ts
5
+ function createMarketplaceRuntime(ctx) {
6
+ return {
7
+ variant: "marketplace",
8
+ fetch: ctx.http ? (url, init) => ctx.http.fetch(url, init) : void 0
9
+ };
10
+ }
11
+ var sandbox_entry_default = definePlugin({
12
+ hooks: {
13
+ "email:deliver": {
14
+ exclusive: true,
15
+ handler: async (event, ctx) => {
16
+ const source = event.source || ctx.plugin.id;
17
+ try {
18
+ const result = await deliverWithConfiguredProvider({
19
+ ctx,
20
+ runtime: createMarketplaceRuntime(ctx),
21
+ message: event.message,
22
+ source
23
+ });
24
+ await writeDeliveryLog(ctx, createDeliveryLogRecord({
25
+ providerId: result.providerId,
26
+ status: "sent",
27
+ message: {
28
+ to: event.message.to,
29
+ subject: event.message.subject
30
+ },
31
+ source,
32
+ durationMs: result.durationMs,
33
+ remoteMessageId: result.remoteMessageId
34
+ }));
35
+ } catch (error) {
36
+ const err = error instanceof Error ? error : new Error(String(error));
37
+ await writeDeliveryLog(ctx, createDeliveryLogRecord({
38
+ providerId: "unknown",
39
+ status: "failed",
40
+ message: {
41
+ to: event.message.to,
42
+ subject: event.message.subject
43
+ },
44
+ source,
45
+ durationMs: 0,
46
+ errorMessage: err.message
47
+ }));
48
+ throw err;
49
+ }
50
+ }
51
+ },
52
+ "email:status": { handler: async (_event, ctx) => isDeliveryReady({
53
+ ctx,
54
+ runtime: createMarketplaceRuntime(ctx)
55
+ }) }
56
+ },
57
+ routes: { admin: { handler: (async (routeCtx, ctx) => {
58
+ return handleAdminInteraction({
59
+ ctx,
60
+ variant: "marketplace",
61
+ runtime: createMarketplaceRuntime(ctx),
62
+ interaction: routeCtx.input ?? {
63
+ type: "page_load",
64
+ page: "/providers"
65
+ }
66
+ });
67
+ }) } }
68
+ });
69
+
70
+ //#endregion
71
+ export { sandbox_entry_default as default };
72
+ //# sourceMappingURL=sandbox-entry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-entry.mjs","names":[],"sources":["../src/sandbox-entry.ts"],"sourcesContent":["import { definePlugin } from \"emdash\";\nimport type { PluginContext } from \"emdash\";\n\nimport {\n\tcreateDeliveryLogRecord,\n\tdeliverWithConfiguredProvider,\n\thandleAdminInteraction,\n\tisDeliveryReady,\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 \"@masonjames/emdash-smtp-core\";\n\nfunction createMarketplaceRuntime(ctx: PluginContext): DeliveryRuntime {\n\treturn {\n\t\tvariant: \"marketplace\",\n\t\tfetch: ctx.http ? (url, init) => ctx.http!.fetch(url, init) : undefined,\n\t};\n}\n\ninterface MarketplaceEmailDeliverEvent {\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\nexport default definePlugin({\n\thooks: {\n\t\t\"email:deliver\": {\n\t\t\texclusive: true,\n\t\t\thandler: async (event: MarketplaceEmailDeliverEvent, ctx: PluginContext) => {\n\t\t\t\tconst source = event.source || ctx.plugin.id;\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await deliverWithConfiguredProvider({\n\t\t\t\t\t\tctx: ctx as unknown as SmtpPluginContextLike,\n\t\t\t\t\t\truntime: createMarketplaceRuntime(ctx),\n\t\t\t\t\t\tmessage: event.message,\n\t\t\t\t\t\tsource,\n\t\t\t\t\t});\n\t\t\t\t\tawait writeDeliveryLog(\n\t\t\t\t\t\tctx as unknown as SmtpPluginContextLike,\n\t\t\t\t\t\tcreateDeliveryLogRecord({\n\t\t\t\t\t\t\tproviderId: result.providerId,\n\t\t\t\t\t\t\tstatus: \"sent\",\n\t\t\t\t\t\t\tmessage: {\n\t\t\t\t\t\t\t\tto: event.message.to,\n\t\t\t\t\t\t\t\tsubject: event.message.subject,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\tdurationMs: result.durationMs,\n\t\t\t\t\t\t\tremoteMessageId: result.remoteMessageId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst err = error instanceof Error ? error : new Error(String(error));\n\t\t\t\t\tawait writeDeliveryLog(\n\t\t\t\t\t\tctx as unknown as SmtpPluginContextLike,\n\t\t\t\t\t\tcreateDeliveryLogRecord({\n\t\t\t\t\t\t\tproviderId: \"unknown\",\n\t\t\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\t\t\tmessage: {\n\t\t\t\t\t\t\t\tto: event.message.to,\n\t\t\t\t\t\t\t\tsubject: event.message.subject,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\tdurationMs: 0,\n\t\t\t\t\t\t\terrorMessage: err.message,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t\"email:status\": {\n\t\t\thandler: async (_event: unknown, ctx: PluginContext) =>\n\t\t\t\tisDeliveryReady({\n\t\t\t\t\tctx: ctx as unknown as SmtpPluginContextLike,\n\t\t\t\t\truntime: createMarketplaceRuntime(ctx),\n\t\t\t\t}),\n\t\t},\n\t},\n\troutes: {\n\t\tadmin: {\n\t\t\thandler: (async (\n\t\t\t\trouteCtx: { input: unknown; request: unknown },\n\t\t\t\tctx: PluginContext,\n\t\t\t) => {\n\t\t\t\treturn handleAdminInteraction({\n\t\t\t\t\tctx: ctx as unknown as SmtpPluginContextLike,\n\t\t\t\t\tvariant: \"marketplace\",\n\t\t\t\t\truntime: createMarketplaceRuntime(ctx),\n\t\t\t\t\tinteraction: (routeCtx.input ?? { type: \"page_load\", page: \"/providers\" }) as AdminInteraction,\n\t\t\t\t});\n\t\t\t}) as never,\n\t\t},\n\t},\n});\n"],"mappings":";;;;AAkBA,SAAS,yBAAyB,KAAqC;AACtE,QAAO;EACN,SAAS;EACT,OAAO,IAAI,QAAQ,KAAK,SAAS,IAAI,KAAM,MAAM,KAAK,KAAK,GAAG;EAC9D;;AAaF,4BAAe,aAAa;CAC3B,OAAO;EACN,iBAAiB;GAChB,WAAW;GACX,SAAS,OAAO,OAAqC,QAAuB;IAC3E,MAAM,SAAS,MAAM,UAAU,IAAI,OAAO;AAC1C,QAAI;KACH,MAAM,SAAS,MAAM,8BAA8B;MAC7C;MACL,SAAS,yBAAyB,IAAI;MACtC,SAAS,MAAM;MACf;MACA,CAAC;AACF,WAAM,iBACL,KACA,wBAAwB;MACvB,YAAY,OAAO;MACnB,QAAQ;MACR,SAAS;OACR,IAAI,MAAM,QAAQ;OAClB,SAAS,MAAM,QAAQ;OACvB;MACD;MACA,YAAY,OAAO;MACnB,iBAAiB,OAAO;MACxB,CAAC,CACF;aACO,OAAO;KACf,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;AACrE,WAAM,iBACL,KACA,wBAAwB;MACvB,YAAY;MACZ,QAAQ;MACR,SAAS;OACR,IAAI,MAAM,QAAQ;OAClB,SAAS,MAAM,QAAQ;OACvB;MACD;MACA,YAAY;MACZ,cAAc,IAAI;MAClB,CAAC,CACF;AACD,WAAM;;;GAGR;EACD,gBAAgB,EACf,SAAS,OAAO,QAAiB,QAChC,gBAAgB;GACV;GACL,SAAS,yBAAyB,IAAI;GACtC,CAAC,EACH;EACD;CACD,QAAQ,EACP,OAAO,EACN,UAAU,OACT,UACA,QACI;AACJ,SAAO,uBAAuB;GACxB;GACL,SAAS;GACT,SAAS,yBAAyB,IAAI;GACtC,aAAc,SAAS,SAAS;IAAE,MAAM;IAAa,MAAM;IAAc;GACzE,CAAC;KAEH,EACD;CACD,CAAC"}
package/icon.png ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@masonjames/emdash-smtp-marketplace",
3
+ "version": "0.1.0",
4
+ "description": "Marketplace-safe SMTP and transactional email plugin for EmDash",
5
+ "type": "module",
6
+ "main": "dist/index.mjs",
7
+ "types": "dist/index.d.mts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.mjs",
11
+ "types": "./dist/index.d.mts"
12
+ },
13
+ "./sandbox": {
14
+ "import": "./dist/sandbox-entry.mjs",
15
+ "types": "./dist/sandbox-entry.d.mts"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "CHANGELOG.md",
22
+ "icon.png",
23
+ "screenshots"
24
+ ],
25
+ "keywords": [
26
+ "emdash",
27
+ "emdash-plugin",
28
+ "marketplace",
29
+ "smtp",
30
+ "email"
31
+ ],
32
+ "author": "Mason James",
33
+ "dependencies": {
34
+ "@masonjames/emdash-smtp-core": "0.1.0"
35
+ },
36
+ "peerDependencies": {
37
+ "emdash": ">=0.1.0"
38
+ },
39
+ "license": "MIT",
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/masonjames/emdash-smtp.git",
46
+ "directory": "packages/emdash-smtp-marketplace"
47
+ },
48
+ "homepage": "https://github.com/masonjames/emdash-smtp#readme",
49
+ "bugs": {
50
+ "url": "https://github.com/masonjames/emdash-smtp/issues"
51
+ },
52
+ "scripts": {
53
+ "build": "tsdown src/index.ts src/sandbox-entry.ts --format esm --dts --clean",
54
+ "test": "vitest run",
55
+ "typecheck": "tsc --noEmit -p tsconfig.json"
56
+ }
57
+ }