npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aws-blocks/bb-email-client

v0.1.2

Published

Transactional email sending via Amazon SES.

Readme

@aws-blocks/bb-email-client

Transactional email sending via Amazon SES.

Usage

import { EmailClient } from '@aws-blocks/bb-email-client';

const emailClient = new EmailClient(scope, 'notifications', {
  fromAddress: '[email protected]',
  configurationSet: 'my-tracking-set', // optional
});

// Send a single email
const { messageId } = await emailClient.send({
  to: '[email protected]',
  subject: 'Welcome!',
  body: 'Thanks for signing up.',
  html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
});
console.log('Sent:', messageId);

// Send a batch of emails (uses SES SendBulkEmail API with inline templates — no setup required)
const result = await emailClient.sendBatch([
  { to: '[email protected]', subject: 'Hi Alice', body: 'Hello!' },
  { to: '[email protected]', subject: 'Hi Bob', body: 'Hello!' },
]);
const sent = result.results.filter(r => r.status === 'success').length;
const failed = result.results.filter(r => r.status === 'failed').length;
console.log(`Sent: ${sent}, Failed: ${failed}`);

API

new EmailClient(scope, id, options)

| Option | Type | Required | Description | |--------|------|----------|-------------| | fromAddress | string | ✅ | Verified sender email address | | replyTo | string[] | ❌ | Reply-to addresses | | configurationSet | string | ❌ | SES configuration set name |

emailClient.send(message): Promise<SendResult>

Send to one or more recipients. Returns { messageId: string }.

| Field | Type | Description | |-------|------|-------------| | message.to | string \| string[] | Recipient address(es) | | message.subject | string | Subject line | | message.body | string | Plain text body | | message.html | string? | HTML body (optional) | | message.cc | string[]? | CC addresses (optional) | | message.bcc | string[]? | BCC addresses (optional) |

emailClient.sendBatch(messages): Promise<SendBatchResult>

Send multiple messages using the SES SendBulkEmail API with inline templates. No stored SES template is required — each message's subject, body, and HTML are passed directly via TemplateContent.

Returns { results: Array<{ status, messageId?, error? }> }.

Never throws on send failures. Both partial and total failures are reported per-entry in the results array (with status: 'failed').

Each message in the array is an EmailMessage (same type as send()):

| Field | Type | Description | |-------|------|-------------| | to | string \| string[] | Recipient address(es) | | subject | string | Subject line | | body | string | Plain text body | | html | string? | HTML body (optional) | | cc | string[]? | CC addresses (optional) | | bcc | string[]? | BCC addresses (optional) |

Error Handling

import { EmailErrors } from '@aws-blocks/bb-email-client';
import { isBlocksError } from '@aws-blocks/core';

try {
  await emailClient.send({ to: '[email protected]', subject: 'Hi', body: 'Hello' });
} catch (e: unknown) {
  if (isBlocksError(e, EmailErrors.SendFailed)) {
    // General send failure — check error message for details
  }
  if (isBlocksError(e, EmailErrors.InvalidInput)) {
    // Malformed input (e.g. invalid email address)
  }
  if (isBlocksError(e, EmailErrors.DomainNotVerified)) {
    // Sending domain not verified in SES
  }
  if (isBlocksError(e, EmailErrors.AccountPaused)) {
    // Account sending is paused by AWS
  }
  if (isBlocksError(e, EmailErrors.RateLimited)) {
    // Transient — safe to retry after backoff
  }
}

Local Development

In local dev mode (npm run dev), emails are:

  • Logged to the console with format: [Email:{id}] → recipient | Subject: ... | Body: ...
  • Persisted to .bb-data/{fullId}/emails.json for inspection
  • Batch sends emit a rate-limit warning (simulating SES sandbox behavior)

Package Export Conditions

This package uses a custom "cdk" export condition:

{
  "exports": {
    ".": {
      "cdk": "./dist/index.cdk.js",
      "aws-runtime": "./dist/index.aws.js",
      "default": "./dist/index.mock.js"
    }
  }
}

Note: The "cdk" condition is a Blocks framework convention, resolved by the Blocks build toolchain (tsx with --conditions=cdk). It is not a built-in Node.js condition and will not resolve in standard node or ts-node unless you pass --conditions=cdk explicitly.

Limits

  • Per-message recipients: 50 recipients max per message (To + CC + BCC combined)
  • Batch API destinations: 50 destinations per SendBulkEmail API call (handled automatically via chunking)
  • Message size: 40 MB per message
  • SES sandbox rate: 1 email/sec (request production access for higher throughput)

Note: In local dev (mock), per-message recipient and size limits are enforced locally before sending (limit violations are recorded as failed entries). In the AWS runtime, these limits are enforced by SES itself, so the failure surfaces in the SES response rather than locally — the failure point differs between runtimes, but in both cases failures appear per-entry in results.