Skip to content

fix(plugins): pass emailPipeline to route handler context#340

Open
mvanhorn wants to merge 3 commits intoemdash-cms:mainfrom
mvanhorn:fix/215-plugin-route-email-context
Open

fix(plugins): pass emailPipeline to route handler context#340
mvanhorn wants to merge 3 commits intoemdash-cms:mainfrom
mvanhorn:fix/215-plugin-route-email-context

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented Apr 6, 2026

What does this PR do?

Closes #215

Plugin route handlers never received ctx.email because handlePluginApiRoute() in emdash-runtime.ts created PluginRouteRegistry with only { db }, missing emailPipeline. Hook handlers worked correctly because they used a separate context factory that received the pipeline via setContextFactory().

This PR passes emailPipeline to PluginRouteRegistry in the trusted plugin route path and adds a setEmailPipeline() method on PluginManager for deferred wiring.

Type of change

  • Bug fix
  • Feature (requires approved Discussion)
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm --silent lint:json | jq '.diagnostics | length' returns 0
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

AI-generated code disclosure

  • This PR includes AI-generated code

This contribution was developed with AI assistance (Codex).

mvanhorn added 2 commits April 6, 2026 16:03
Plugin route handlers never received ctx.email because the
PluginRouteRegistry in handlePluginApiRoute() was created with only
{ db }, missing emailPipeline. Hook handlers worked because they used
a different context factory that received the pipeline.

Passes emailPipeline to PluginRouteRegistry in emdash-runtime.ts and
adds a setEmailPipeline() method on PluginManager for future use.

Fixes emdash-cms#215
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 6, 2026

🦋 Changeset detected

Latest commit: ebe49d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-ai-moderation Patch
@emdash-cms/plugin-atproto Patch
@emdash-cms/plugin-audit-log Patch
@emdash-cms/plugin-color Patch
@emdash-cms/plugin-embeds Patch
@emdash-cms/plugin-forms Patch
@emdash-cms/plugin-webhook-notifier Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 6, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@340

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@340

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@340

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@340

emdash

npm i https://pkg.pr.new/emdash@340

create-emdash

npm i https://pkg.pr.new/create-emdash@340

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@340

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@340

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@340

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@340

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@340

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@340

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@340

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@340

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@340

commit: 32dee37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin route handlers missing ctx.email (and other context) — PluginRouteRegistry creates incomplete PluginContextFactory

1 participant