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

@singleton-sd/post-kit-types

v0.5.0

Published

Shared TypeScript contracts for the PostKit platform

Downloads

553

Readme

@singleton-sd/post-kit-types

Shared TypeScript contracts for the PostKit platform.

This package has no runtime dependencies — it is a pure types layer. All exports are TypeScript interfaces, type aliases, and enums.

Install

pnpm add @singleton-sd/post-kit-types

Contracts

Template source (Git-backed source files)

| Export | Description | |--------|-------------| | TemplateSourceMetadata | Contents of metadata.json — key, name, subject, variables list, schema version | | TemplatePreviewData | Contents of preview.json — sample variable values for preview and CI validation | | CompiledTemplate | Runtime artifact produced by post-kit-compiler — HTML + metadata + manifest | | TemplateManifest | Compilation provenance — commit SHA, timestamp, content hash | | TEMPLATE_SCHEMA_VERSION | Current schema version string ('1') |

API send (POST /emails/send)

| Export | Description | |--------|-------------| | SendRequest | Request body — template, to, variables | | SendResponse | Success response — id, status: 'sent' | | PostKitErrorResponse | Error response — error, code, correlationId | | PostKitErrorCode | Enum of stable machine-readable error codes |

Tenant

| Export | Description | |--------|-------------| | TenantContext | Resolved tenant identity — tenantId, environment | | TenantEnvironment | 'development' \| 'staging' \| 'production' | | TenantBranding | Optional branding defaults merged into template variables | | TemplateVariables | Record<string, string> — the fully merged variable map |

Error codes

import { PostKitErrorCode } from '@singleton-sd/post-kit-types';

switch (error.code) {
  case PostKitErrorCode.TEMPLATE_NOT_FOUND:  // 404 — template key not in storage
  case PostKitErrorCode.MISSING_VARIABLES:   // 422 — required variable absent
  case PostKitErrorCode.UNAUTHENTICATED:     // 401 — no valid credential
  case PostKitErrorCode.UNAUTHORIZED:        // 403 — credential maps to no tenant
  case PostKitErrorCode.INVALID_TEMPLATE:    // 422 — template artifact malformed
  case PostKitErrorCode.INVALID_RECIPIENT:   // 422 — recipient address invalid
  case PostKitErrorCode.PROVIDER_FAILURE:    // 502 — email provider error
  case PostKitErrorCode.STORAGE_FAILURE:     // 502 — blob storage error
  case PostKitErrorCode.IDEMPOTENCY_IN_PROGRESS: // 409 — same key still in flight
}

Usage example

import type { SendRequest, SendResponse, TenantContext } from '@singleton-sd/post-kit-types';

const request: SendRequest = {
  template: 'marketing.contact-us',
  to: '[email protected]',
  variables: {
    name: 'Jane Doe',
    email: '[email protected]',
    message: 'I would like to know more',
  },
};

Consumers

| Package / app | Uses | |---------------|------| | apps/api | SendRequest, SendResponse, PostKitErrorResponse, PostKitErrorCode, TenantContext, TenantBranding, TemplateVariables, CompiledTemplate | | post-kit-compiler | TemplateSourceMetadata, TemplatePreviewData, CompiledTemplate, TemplateManifest | | post-kit-publisher | CompiledTemplate, TenantContext | | post-kit-client | SendRequest, SendResponse, PostKitErrorResponse, PostKitErrorCode | | post-kit-editor | TemplateSourceMetadata, TemplatePreviewData, TenantBranding |

Contributing

This package is part of the PostKit monorepo. See AGENTS.md for the engineering workflow.

All exported names are a public API surface — treat them as stable. Breaking changes require a major version bump.