/
index.ts
44 lines (39 loc) · 1.03 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as Zaius from './Types';
import * as ODP from './Types';
import {Config, InternalConfig, setModuleScopedConfig} from './config/configure';
import {ODPClient} from './ODPClient';
/**
* An extension of ODPClient that allows changing the configuration after the client has been created.
* The purpose of this class is to allow managing module scoped instance of OCPClient.
*/
export class ReconfigurableODPClient extends ODPClient {
/**
* Configure the ODP SDK for use
*
*/
public configure(config: Config | InternalConfig | null): void {
setModuleScopedConfig(config);
}
}
export {ODPClient};
/**
* Module scoped way of utilizing the ODP Node SDK.
* @usage
* ```
*
* import {odp} from '@zaiusinc/node-sdk';
*
* // Send an event to ODP
* await odp.event(...);
* // Subscribe a customer by an identifier to a list
* await odp.list.subscribe(...);
* // etc
* ```
*/
export const odp = new ReconfigurableODPClient();
export {ODP};
/**
* For backward compatibility
*/
export const z = odp;
export {Zaius};