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<ServiceAuthToken> {
if (token === undefined || token.hasExpired()) {
token = await IdamClient.retrieveServiceToken()
}
return token
}
}
- 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
$ yarn add @hmcts/draft-store-client
or
$ npm install @hmcts/draft-store-client
Install dependencies by executing the following command:
$ yarn install
We use TSLint with StandardJS rules
Running the linting:
yarn lint
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