Release v0.2.0: shared email service and auth foundation polish#2
Merged
Conversation
Match the ampl.tools/auth header and footer to the live lab site: the AMPL logo links home, the header carries the bilingual lab-site nav, the locale toggle moves into the header, the footer shows the lab copyright, and the GitHub sign-in button uses the GitHub-native dark style.
Sign-out now submits a POST via buildLogoutHref instead of a link, the account widget handle is optional, NoAccess composes the Button primitive, the GitHub email lookup is guarded against malformed responses, and validateSession is verified to perform no writes.
A new ampl-email Worker provides one owned transactional-email path for the AMPL tools at ampl.tools/email: a service-binding send() method over Resend, a D1 send log with global suppression, a signature-verified bounce and complaint webhook, fail-closed monthly and daily quotas, a race-safe idempotency gate, and RFC 8058 one-click unsubscribe.
A new ./email subpath gives consumer tools two pure building blocks: an injection-safe bilingual branded HTML email shell (renderEmailShell) and an RFC 5545 .ics calendar builder (buildIcs), with a CONSUMING.md guide for wiring them to the email service.
Bump the package to 0.2.0, export the ./email subpath, add the email Worker scripts (deploy, D1 migrations, type generation), and update the shared TypeScript and test configuration for the email worker.
The email worker read RESEND_API_KEY, RESEND_WEBHOOK_SECRET, and UNSUB_HMAC_SECRET directly off Env, which only typed correctly when a local .dev.vars caused wrangler types to emit them. Cast the secrets locally at each use site, matching the auth worker, so typecheck no longer depends on generated secret types, and ignore the generated workers-email-configuration.d.ts (it carries only non-secret vars).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@ampl/kit v0.2.0
This release adds a shared transactional-email path for the AMPL tools and
brings the auth foundation to lab-site parity.
Shared email service (ampl-email)
A new Cloudflare Worker at
ampl.tools/emailgives every tool one owned,free-tier email path:
send()method over Resend (the API key never leavesthe email Worker)
@ampl/kit/email client surface
A new
./emailsubpath ships two pure building blocks for consumer tools:renderEmailShell— an injection-safe, bilingual branded HTML email shellbuildIcs— an RFC 5545.icscalendar builder (REQUEST/CANCEL, CRLFfolding, TEXT escaping)
See
CONSUMING.mdfor how to wire them to the email service.Auth foundation polish
bilingual lab-site nav, repositioned locale toggle, lab copyright, and a
GitHub-native dark sign-in button
buildLogoutHref; the account widgethandle is optional;
NoAccesscomposes theButtonprimitivevalidateSessionverified to perform no writes
Build
Bumps the package to 0.2.0, exports the
./emailsubpath, and types theemail Worker secrets at their use sites so builds are reproducible without
local secrets.