@datawheel/tesseract-client
TypeScript icon, indicating that this package has built-in type declarations

0.4.3 • Public • Published

tesseract-client Build Status

A javascript client to fetch and work with entities from a tesseract-olap server. Heavily inspired by the mondrian-rest-client project, but with some added functionality.

Installation

npm install @datawheel/tesseract-client

Usage

The main classes you will want to use are Client and MultiClient.

import {Client as TesseractClient} from "@datawheel/tesseract-client";

const client = new TesseractClient(SERVER_URL);

MultiClient is a wrapper around the Client class, which allows you to use the same public methods as Client but with multiple remote servers at once.

import {MultiClient} from "@datawheel/tesseract-client";

const client = new MultiClient([SERVER1_URL, SERVER2_URL]);

Notice that MultiClient can accept a string or an array, while Client just accepts a string. If you intend to work with only one tesseract-olap server, you can use both classes, but Client will perform better.

All methods in the Client classes return a Promise for the item you are requesting. You can use .then() chaining or the async/await combo to work with the returned objects:

function getAllCubeNames(client) {
  return client.cubes().then(cubes => cubes.map(cube => cube.name));
}

async function getAllCubeNames(client) {
  const cubes = await client.cubes();
  return cubes.map(cube => cube.name);
}

We have a migration guide for users of mondrian-rest-client. The package also exports TypeScript definitions for most of the classes used.

Package Sidebar

Install

npm i @datawheel/tesseract-client

Weekly Downloads

1

Version

0.4.3

License

MIT

Unpacked Size

91 kB

Total Files

20

Last publish

Collaborators

  • palamago
  • scespinoza
  • davelandry
  • frabarz
  • jhmullen-dw