@mvrx/wbxml
@mvrx/wbxml is a zero-dependency WBXML parser and encoder for Exchange
ActiveSync 14.1. It’s independent of AECS-1 and @mvrx/mail — a standalone
protocol codec that happens to live in the same monorepo, MIT licensed so it can
be embedded anywhere without copyleft obligations (see Licensing).
It works on Cloudflare Workers, Node.js 18+, Deno, Bun, and browsers — no native modules, no Node.js-only APIs.
Install
npm install @mvrx/wbxml
Usage
import { decode, encode } from "@mvrx/wbxml";
// Parse a WBXML binary buffer from an EAS response
const tree = decode(wbxmlBuffer);
console.log(tree.tag); // "Sync"
console.log(tree.children); // [{ tag: "Collections", ... }]
// Build and encode an EAS request
const buffer = encode({
tag: "Sync",
namespace: "AirSync",
children: [
{
tag: "Collections",
children: [
{
tag: "Collection",
children: [
{ tag: "SyncKey", text: "0" },
{ tag: "CollectionId", text: "inbox" },
],
},
],
},
],
});
decode() turns a WBXML binary buffer into a plain tree of { tag, namespace?, attributes?, children?, text? } nodes. encode() does the reverse — build the
same tree shape and get back a binary buffer ready to send as an EAS request
body.
Runtime compatibility
| Runtime | Supported |
|---|---|
| Cloudflare Workers | Yes |
| Node.js 18+ | Yes |
| Deno | Yes |
| Bun | Yes |
| Browser | Yes |
Relationship to AECS-1
@mvrx/wbxml is not part of the AECS-1 specification. It exists because
Exchange ActiveSync — a protocol still in wide enterprise use — encodes its
XML payloads as compact binary WBXML rather than plain text. If you’re building
an inbound pipeline that needs to talk to EAS-based mail systems as well as
normalize the resulting messages to NormalizedEmail, you’d typically decode
WBXML first with this package, then hand the resulting XML/data to your own EAS
response mapper — AECS-1’s parse() (in @mvrx/mail) is scoped to RFC 5322/MIME
sources, not EAS payloads directly.