UNPKG

2.16 kBTypeScriptView Raw
1import { ConfigParams } from "pip-services3-commons-node";
2/**
3 * A set of utility functions to process connection parameters
4 */
5export declare class ConnectionUtils {
6 /**
7 * Concatinates two options by combining duplicated properties into comma-separated list
8 * @param options1 first options to merge
9 * @param options2 second options to merge
10 * @param keys when define it limits only to specific keys
11 */
12 static concat(options1: ConfigParams, options2: ConfigParams, ...keys: string[]): ConfigParams;
13 private static concatValues;
14 /**
15 * Parses URI into config parameters.
16 * The URI shall be in the following form:
17 * protocol://username@password@host1:port1,host2:port2,...?param1=abc&param2=xyz&...
18 *
19 * @param uri the URI to be parsed
20 * @param defaultProtocol a default protocol
21 * @param defaultPort a default port
22 * @returns a configuration parameters with URI elements
23 */
24 static parseUri(uri: string, defaultProtocol: string, defaultPort: number): ConfigParams;
25 /**
26 * Composes URI from config parameters.
27 * The result URI will be in the following form:
28 * protocol://username@password@host1:port1,host2:port2,...?param1=abc&param2=xyz&...
29 *
30 * @param options configuration parameters
31 * @param defaultProtocol a default protocol
32 * @param defaultPort a default port
33 * @returns a composed URI
34 */
35 static composeUri(options: ConfigParams, defaultProtocol: string, defaultPort: number): string;
36 /**
37 * Includes specified keys from the config parameters.
38 * @param options configuration parameters to be processed.
39 * @param keys a list of keys to be included.
40 * @returns a processed config parameters.
41 */
42 static include(options: ConfigParams, ...keys: string[]): ConfigParams;
43 /**
44 * Excludes specified keys from the config parameters.
45 * @param options configuration parameters to be processed.
46 * @param keys a list of keys to be excluded.
47 * @returns a processed config parameters.
48 */
49 static exclude(options: ConfigParams, ...keys: string[]): ConfigParams;
50}