Skip to content

ilyhalight/jmap-yacl

Folders and files

NameName
Last commit message
Last commit date
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024
Apr 28, 2024
May 3, 2024
May 6, 2024
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024
Dec 17, 2024
Nov 25, 2024
Nov 25, 2024
Nov 25, 2024

Repository files navigation

jmap-yacl

GitHub Actions npm ru en

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:

  • JMAP standard according to RFC 8620 (without Push)
  • JMAP Mail standard according to RFC 8621

Inspiration:

Compliance with standards:

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::

  1. Ready-made methods for simple single requests to the server
  2. 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

  1. Install Bun

  2. Install dependencies:

bun install
  1. Run the build:
bun build:bun

Tests

The library has minimal test coverage to check its performance.

Run the tests:

bun test