jmap-yacl
v1.2.0
Published
Yet another client lib for JMAP Protocol
Downloads
63
Maintainers
Readme
jmap-yacl
Another lightweight client library for working with the JMAP, which supports working with JavaScript, TypeScript, and also has built-in types for Typebox.
Installation
Install via Bun:
bun install jmap-yacl
Install via NPM:
npm install jmap-yacl
Information
The library was developed and tested using stalwart mail-server, work with other JMAP servers is not guaranteed (in theory it should be due to RFC compliance). Only basic authentication (username + password) is supported.
Implemented:
Inspiration:
Compliance with standards:
- RFC 8620 - The JSON Meta Application Protocol (JMAP)
- RFC 8621 - The JSON Meta Application Protocol (JMAP) for Mail
- RFC 7807 - Problem Details in HTTP APIs
Getting started
To start working with the API, you need to create a JMAP Client and authorize it. This can be done using a few lines below:
const client = new JMAPClient({
username: process.env.JMAP_USERNAME,
password: process.env.JMAP_PASSWORD,
});
await client.connect("https://YOURDOMAIN/.well-known/jmap");
In order to make a request to JMAP, you can use two types of requests::
- Ready-made methods for simple single requests to the server
- Raw requests, if you want to make a complex request to the server
const client = ...
// ready methods
const identityResponse = await client.identity.get({
accountId: "abc",
});
// raw requests
const identityResponse = await client.request<
JMAP.GetResponse<JMAPMail.Identity[]>
>("/jmap", {
using: [JMAP.Using.mail],
invocation: [
"Identity/get",
{
accountId: "abc",
},
"a",
],
});
Building
Install Bun
Install dependencies:
bun install
- Run the build:
bun build:bun
Tests
The library has minimal test coverage to check its performance.
Run the tests:
bun test