JavaScript client for draft store


1.2.14 years ago4 years agoMinified + gzip package size for @hmcts/draft-store-client in KB



Greenkeeper badge

Standard - JavaScript Style Guide

This is a client library for interacting with the draft store api

To configure the draft store client you need to:

  • Implement the ServiceAuthTokenFactory interface.
    export interface ServiceAuthTokenFactory {
       get (): Promise<ServiceAuthToken>
  • Sample implementation: ``` let token: ServiceAuthToken

export class ServiceAuthTokenFactoryImpl implements ServiceAuthTokenFactory{ async get (): Promise { if (token === undefined || token.hasExpired()) { token = await IdamClient.retrieveServiceToken() } return token } }

# API available with clients
* DraftService provides wrapper around creating DraftStoreClientFactory to save and delete draft documents   
* DraftStoreClientFactory is responsible for creating DraftStoreClients
* DraftStoreClient is responsible for search, save and delete of draft store data
* DraftMiddleware manages number of draft store client can be configured and is available if user is logged in

# To add library

yarn add @hmcts/draft-store-client

## Getting Started

### Prerequisites

* [Node.js](https://nodejs.org/) >= v8.0.0
* [yarn](https://yarnpkg.com/)

### Running the application

Install dependencies by executing the following command:

$ yarn install


Code style

We use TSLint with StandardJS rules

Running the linting: yarn lint

Running the tests

Mocha is used for writing tests.

Run them with:

$ yarn test

For test coverage:

$ yarn test:coverage


This project is licensed under the MIT License - see the LICENSE file for details

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.