1 | // Copyright IBM Corp. and LoopBack contributors 2018,2020. All Rights Reserved.
|
2 | // Node module: @loopback/context
|
3 | // This file is licensed under the MIT License.
|
4 | // License text available at https://opensource.org/licenses/MIT
|
5 |
|
6 | import {ConfigurationResolver} from './binding-config';
|
7 | import {BindingKey} from './binding-key';
|
8 |
|
9 | /**
|
10 | * Namespace for context tags
|
11 | */
|
12 | export namespace ContextTags {
|
13 | export const CLASS = 'class';
|
14 | export const PROVIDER = 'provider';
|
15 | export const DYNAMIC_VALUE_PROVIDER = 'dynamicValueProvider';
|
16 |
|
17 | /**
|
18 | * Type of the artifact
|
19 | */
|
20 | export const TYPE = 'type';
|
21 | /**
|
22 | * Namespace of the artifact
|
23 | */
|
24 | export const NAMESPACE = 'namespace';
|
25 | /**
|
26 | * Name of the artifact
|
27 | */
|
28 | export const NAME = 'name';
|
29 | /**
|
30 | * Binding key for the artifact
|
31 | */
|
32 | export const KEY = 'key';
|
33 |
|
34 | /**
|
35 | * Binding tag to associate a configuration binding with the target binding key
|
36 | */
|
37 | export const CONFIGURATION_FOR = 'configurationFor';
|
38 |
|
39 | /**
|
40 | * Binding tag for global interceptors
|
41 | */
|
42 | export const GLOBAL_INTERCEPTOR = 'globalInterceptor';
|
43 |
|
44 | /**
|
45 | * Binding tag for global interceptors to specify sources of invocations that
|
46 | * the interceptor should apply. The tag value can be a string or string[], such
|
47 | * as `'route'` or `['route', 'proxy']`.
|
48 | */
|
49 | export const GLOBAL_INTERCEPTOR_SOURCE = 'globalInterceptorSource';
|
50 |
|
51 | /**
|
52 | * Binding tag for group name of global interceptors
|
53 | */
|
54 | export const GLOBAL_INTERCEPTOR_GROUP = 'globalInterceptorGroup';
|
55 | }
|
56 |
|
57 | /**
|
58 | * Default namespace for global interceptors
|
59 | */
|
60 | export const GLOBAL_INTERCEPTOR_NAMESPACE = 'globalInterceptors';
|
61 |
|
62 | /**
|
63 | * Default namespace for local interceptors
|
64 | */
|
65 | export const LOCAL_INTERCEPTOR_NAMESPACE = 'interceptors';
|
66 |
|
67 | /**
|
68 | * Namespace for context bindings
|
69 | */
|
70 | export namespace ContextBindings {
|
71 | /**
|
72 | * Binding key for ConfigurationResolver
|
73 | */
|
74 | export const CONFIGURATION_RESOLVER =
|
75 | BindingKey.create<ConfigurationResolver>(
|
76 | `${BindingKey.CONFIG_NAMESPACE}.resolver`,
|
77 | );
|
78 |
|
79 | /**
|
80 | * Binding key for ordered groups of global interceptors
|
81 | */
|
82 | export const GLOBAL_INTERCEPTOR_ORDERED_GROUPS = BindingKey.create<string[]>(
|
83 | 'globalInterceptor.orderedGroups',
|
84 | );
|
85 | }
|