1 | export type BindingAddress<T = unknown> = string | BindingKey<T>;
|
2 | export declare class BindingKey<ValueType> {
|
3 | readonly key: string;
|
4 | readonly propertyPath?: string | undefined;
|
5 | static readonly PROPERTY_SEPARATOR = "#";
|
6 | |
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | static create<V>(key: string, propertyPath?: string): BindingKey<V>;
|
22 | private constructor();
|
23 | toString(): string;
|
24 | /**
|
25 | * Get a binding address for retrieving a deep property of the object
|
26 | * bound to the current binding key.
|
27 | *
|
28 | * @param propertyPath - A dot-separated path to a (deep) property, e.g. "server.port".
|
29 | */
|
30 | deepProperty<PropertyValueType>(propertyPath: string): BindingKey<PropertyValueType>;
|
31 | /**
|
32 | * Validate the binding key format. Please note that `#` is reserved.
|
33 | * Returns a string representation of the binding key.
|
34 | *
|
35 | * @param key - Binding key, such as `a`, `a.b`, `a:b`, or `a/b`
|
36 | */
|
37 | static validate<T>(key: BindingAddress<T>): string;
|
38 | /**
|
39 | * Parse a string containing both the binding key and the path to the deeply
|
40 | * nested property to retrieve.
|
41 | *
|
42 | * @param keyWithPath - The key with an optional path,
|
43 | * e.g. "application.instance" or "config#rest.port".
|
44 | */
|
45 | static parseKeyWithPath<T>(keyWithPath: BindingAddress<T>): BindingKey<T>;
|
46 | /**
|
47 | * Name space for configuration binding keys
|
48 | */
|
49 | static CONFIG_NAMESPACE: string;
|
50 | /**
|
51 | * Build a binding key for the configuration of the given binding.
|
52 | * The format is `<key>:$config`
|
53 | *
|
54 | * @param key - Key of the target binding to be configured
|
55 | */
|
56 | static buildKeyForConfig<T>(key?: BindingAddress): BindingAddress<T>;
|
57 | /**
|
58 | * Generate a universally unique binding key.
|
59 | *
|
60 | * Please note the format of they generated key is not specified, you must
|
61 | * not rely on any specific formatting (e.g. UUID style).
|
62 | *
|
63 | * @param namespace - Namespace for the binding
|
64 | */
|
65 | static generate<T>(namespace?: string): BindingKey<T>;
|
66 | }
|