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

@bobfrankston/mailx-sync

v0.1.10

Published

Platform-agnostic mail provider implementations + sync orchestration. Single source of truth for Gmail/IMAP/Outlook protocol code, consumed by both desktop (Node) and Android (WebView) — eliminates the parallel mailx-imap/mailx-store-web Gmail providers t

Readme

@bobfrankston/mailx-sync

Platform-agnostic mail provider implementations + sync orchestration interfaces. Single source of truth for protocol code consumed by both desktop (Node service) and Android (WebView).

Why this package exists

Before this extraction, mailx maintained parallel implementations of the same Gmail provider in two places:

  • mailx-imap/providers/gmail-api.ts — used by the Node desktop service
  • mailx-store-web/gmail-api-web.ts — used by the Android WebView

They drifted in practice. A 403-quota retry added to the desktop copy one day was missed in the web copy until users reported broken prefetch. Per programming.md's Economy of Mechanism rule (the operational TS-spirit example), platform-forking the same protocol logic is a textbook violation: TypeScript's value is one typed implementation imported everywhere it's needed, not separate "Node" and "browser" copies of the same algorithm.

What's in here

| Export | What it is | |---|---| | MailProvider (interface) | Protocol-agnostic provider contract — list folders, fetch messages, get UIDs, close. | | ProviderFolder, ProviderMessage, FetchOptions | Shared data shapes used at provider boundaries. | | GmailApiProvider | Gmail REST API. Bounded-concurrency batch fetch, 403-quota retry, exponential backoff. | | ImapProvider | Generic IMAP via iflow-direct's CompatImapClient. Auto-reconnect on broken pipe. | | OutlookApiProvider | Microsoft Graph for Outlook.com / Office 365. Skeleton — needs Azure app reg for production. | | SyncStorage, SyncBodyStore, SyncEventSink (interfaces) | What sync orchestration needs from the host platform's database / file store / event bus. Used to keep sync.ts (planned) platform-free. | | SyncFolder | Storage-side folder shape. |

Platform requirements

Pure TypeScript, no Node-specific imports. Runtime needs only:

  • globalThis.fetch — Node 18+ and all browsers/WebViews.
  • atob, Uint8Array, TextDecoder — universal.
  • A TCP byte-stream transport for ImapProvider (caller injects via TransportFactoryNodeTcpTransport on desktop, BridgeTcpTransport on Android).

How to instantiate

Desktop (Node service):

import { GmailApiProvider, ImapProvider } from "@bobfrankston/mailx-sync";
import { NodeTcpTransport } from "@bobfrankston/node-tcp-transport";

const gmail = new GmailApiProvider(() => getGmailToken());

const imap = new ImapProvider(
    { server: "imap.example.com", port: 993, username: "u", password: "p" },
    () => new NodeTcpTransport(),
);

Android (WebView Worker or main):

import { GmailApiProvider, ImapProvider } from "@bobfrankston/mailx-sync";
import { BridgeTcpTransport } from "@bobfrankston/tcp-transport";

const gmail = new GmailApiProvider(() => getGmailToken());

const imap = new ImapProvider(
    { server: "imap.example.com", port: 993, username: "u", password: "p" },
    () => new BridgeTcpTransport(),
);

Identical API. The only platform-specific bit is the transport factory, which the package consumer injects.

Back-compat shims

The earlier per-platform files now exist as thin re-exports so older import paths keep compiling:

  • mailx-imap/providers/gmail-api.ts re-exports GmailApiProvider.
  • mailx-imap/providers/types.ts re-exports the type interfaces.
  • mailx-imap/providers/outlook-api.ts re-exports OutlookApiProvider.
  • mailx-store-web/gmail-api-web.ts re-exports GmailApiProvider as GmailApiWebProvider.
  • mailx-store-web/imap-web-provider.ts re-exports ImapProvider as ImapWebProvider.
  • mailx-store-web/provider-types.ts re-exports the type interfaces.

Don't extend these shims — extend mailx-sync itself.

Future work (in mailx's TODO.md)

  • Sync orchestration (syncFolderViaApi, prefetchBodies) extracted to sync.ts consuming the SyncStorage/SyncBodyStore interfaces. Eliminates the "android-bootstrap.ts has its own simpler syncFolder" duplication.
  • Storage adapters in mailx-store and mailx-store-web that satisfy SyncStorage.
  • Outbox claim logic shared (currently desktop-only).

License

ISC