6.0.0 • Published 6 years ago

crest-client-core v6.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Crest Client Core

The core api for the crest-client starter project. Look here if you are thinking of building your own crest-client-mechanism package! Otherwise come over to crest-client

Crest Mechanisms

Crest Client, aims to be non-opinionated about libraries. Crest introduces 3 interfaces for handling the request lifecycle: 1. CacheMechanism 2. LogMechanism 3. HttpMechanism

/** 
 * CacheMechanism - a basic key value store for caching result sets.
 */
export interface CacheMechanism {
    set(key: string, data: any): Promise<void>;
    get(key: string): Promise<any>;
    clear(key: string): Promise<void>;
}

/** 
 * LogMechanism - provides a means to log events of the request lifecycle.
 * Provides 'Performance' class for key performance metrics.
 */
export interface LogMechanism {
    before(host: Host, request: Request): any;
    after(host: Host, request: Request, performance: Performance): any;
}

/** 
 * HttpMechanism - responsible for sending the http request. 
 * Should embed the authToken in the HTTP Authorization Header.
 * Upon success, should call the success function. Otherwise should call the error function with the specified error.
 */
export interface HttpMechanism {
    send(host: Host, request: Request, authToken: string, success: (output: any) => void, error: (error: CrestError) => void): any;
}
6.0.0

6 years ago

5.1.0

6 years ago

5.0.3

6 years ago

5.0.2

6 years ago

5.0.1

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.6.1

6 years ago

3.6.0

6 years ago

3.5.0

6 years ago

3.4.0

6 years ago

3.3.0

6 years ago

3.2.0

6 years ago