1 | // Copyright IBM Corp. 2018,2019. All Rights Reserved.
|
2 | // Node module: loopback-datasource-juggler
|
3 | // This file is licensed under the MIT License.
|
4 | // License text available at https://opensource.org/licenses/MIT
|
5 |
|
6 | import {Callback, DataSource, Options, PromiseOrVoid} from '..';
|
7 |
|
8 | // Copyright IBM Corp. 2018. All Rights Reserved.
|
9 | // Node module: loopback-datasource-juggler
|
10 | // This file is licensed under the MIT License.
|
11 | // License text available at https://opensource.org/licenses/MIT
|
12 |
|
13 | /**
|
14 | * Connector from `loopback-connector` module
|
15 | */
|
16 | export interface Connector {
|
17 | name: string; // Name/type of the connector
|
18 | dataSource?: DataSource;
|
19 | connect(callback?: Callback): PromiseOrVoid; // Connect to the underlying system
|
20 | disconnect(callback?: Callback): PromiseOrVoid; // Disconnect from the underlying system
|
21 | ping(callback?: Callback): PromiseOrVoid; // Ping the underlying system
|
22 | execute?(...args: any[]): Promise<any>;
|
23 | [property: string]: any; // Other properties that vary by connectors
|
24 | }
|
25 |
|
26 | /**
|
27 | * Base connector class
|
28 | */
|
29 | export declare class ConnectorBase implements Connector {
|
30 | name: string; // Name/type of the connector;
|
31 | dataSource?: DataSource;
|
32 | connect(callback?: Callback): PromiseOrVoid; // Connect to the underlying system
|
33 | disconnect(callback?: Callback): PromiseOrVoid; // Disconnect from the underlying system
|
34 | ping(callback?: Callback): PromiseOrVoid; // Ping the underlying system
|
35 | execute?(...args: any[]): Promise<any>;
|
36 |
|
37 | /**
|
38 | * Initialize the connector against the given data source
|
39 | *
|
40 | * @param {DataSource} dataSource The dataSource
|
41 | * @param {Function} [callback] The callback function
|
42 | */
|
43 | static initialize(dataSource: DataSource, callback?: Callback): void;
|
44 |
|
45 | constructor(settings?: Options);
|
46 | }
|
47 |
|
48 | export declare class Memory extends ConnectorBase {}
|
49 |
|
50 | export declare class KeyValueMemoryConnector extends ConnectorBase {}
|
51 |
|
52 | export declare class Transient extends ConnectorBase {}
|