@loopback/context 4.0.0-alpha.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +116 -0
  3. package/dist/binding-config.d.ts +40 -0
  4. package/dist/binding-config.js +33 -0
  5. package/dist/binding-config.js.map +1 -0
  6. package/dist/binding-decorator.d.ts +45 -0
  7. package/dist/binding-decorator.js +118 -0
  8. package/dist/binding-decorator.js.map +1 -0
  9. package/dist/binding-filter.d.ts +108 -0
  10. package/dist/binding-filter.js +162 -0
  11. package/dist/binding-filter.js.map +1 -0
  12. package/dist/binding-inspector.d.ts +150 -0
  13. package/dist/binding-inspector.js +249 -0
  14. package/dist/binding-inspector.js.map +1 -0
  15. package/dist/binding-key.d.ts +66 -0
  16. package/dist/binding-key.js +121 -0
  17. package/dist/binding-key.js.map +1 -0
  18. package/dist/binding-sorter.d.ts +71 -0
  19. package/dist/binding-sorter.js +89 -0
  20. package/dist/binding-sorter.js.map +1 -0
  21. package/dist/binding.d.ts +577 -0
  22. package/dist/binding.js +788 -0
  23. package/dist/binding.js.map +1 -0
  24. package/dist/context-event.d.ts +23 -0
  25. package/dist/context-event.js +7 -0
  26. package/dist/context-event.js.map +1 -0
  27. package/dist/context-observer.d.ts +36 -0
  28. package/dist/context-observer.js +7 -0
  29. package/dist/context-observer.js.map +1 -0
  30. package/dist/context-subscription.d.ts +147 -0
  31. package/dist/context-subscription.js +317 -0
  32. package/dist/context-subscription.js.map +1 -0
  33. package/dist/context-tag-indexer.d.ts +42 -0
  34. package/dist/context-tag-indexer.js +135 -0
  35. package/dist/context-tag-indexer.js.map +1 -0
  36. package/dist/context-view.d.ts +209 -0
  37. package/dist/context-view.js +240 -0
  38. package/dist/context-view.js.map +1 -0
  39. package/dist/context.d.ts +513 -0
  40. package/dist/context.js +717 -0
  41. package/dist/context.js.map +1 -0
  42. package/dist/index.d.ts +52 -0
  43. package/dist/index.js +60 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/inject-config.d.ts +67 -0
  46. package/dist/inject-config.js +181 -0
  47. package/dist/inject-config.js.map +1 -0
  48. package/dist/inject.d.ts +250 -0
  49. package/dist/inject.js +535 -0
  50. package/dist/inject.js.map +1 -0
  51. package/dist/interception-proxy.d.ts +76 -0
  52. package/dist/interception-proxy.js +67 -0
  53. package/dist/interception-proxy.js.map +1 -0
  54. package/dist/interceptor-chain.d.ts +121 -0
  55. package/dist/interceptor-chain.js +148 -0
  56. package/dist/interceptor-chain.js.map +1 -0
  57. package/dist/interceptor.d.ts +138 -0
  58. package/dist/interceptor.js +299 -0
  59. package/dist/interceptor.js.map +1 -0
  60. package/dist/invocation.d.ts +101 -0
  61. package/dist/invocation.js +163 -0
  62. package/dist/invocation.js.map +1 -0
  63. package/dist/json-types.d.ts +28 -0
  64. package/{lib/src/provider.js → dist/json-types.js} +3 -3
  65. package/dist/json-types.js.map +1 -0
  66. package/dist/keys.d.ts +65 -0
  67. package/dist/keys.js +74 -0
  68. package/dist/keys.js.map +1 -0
  69. package/dist/provider.d.ts +31 -0
  70. package/{lib6/src → dist}/provider.js +2 -2
  71. package/dist/provider.js.map +1 -0
  72. package/dist/resolution-session.d.ts +180 -0
  73. package/dist/resolution-session.js +274 -0
  74. package/dist/resolution-session.js.map +1 -0
  75. package/dist/resolver.d.ts +46 -0
  76. package/dist/resolver.js +203 -0
  77. package/dist/resolver.js.map +1 -0
  78. package/dist/unique-id.d.ts +14 -0
  79. package/dist/unique-id.js +26 -0
  80. package/dist/unique-id.js.map +1 -0
  81. package/dist/value-promise.d.ts +134 -0
  82. package/dist/value-promise.js +277 -0
  83. package/dist/value-promise.js.map +1 -0
  84. package/package.json +49 -34
  85. package/src/binding-config.ts +73 -0
  86. package/src/binding-decorator.ts +136 -0
  87. package/src/binding-filter.ts +250 -0
  88. package/src/binding-inspector.ts +371 -0
  89. package/src/binding-key.ts +136 -0
  90. package/src/binding-sorter.ts +124 -0
  91. package/src/binding.ts +1107 -0
  92. package/src/context-event.ts +30 -0
  93. package/src/context-observer.ts +50 -0
  94. package/src/context-subscription.ts +402 -0
  95. package/src/context-tag-indexer.ts +147 -0
  96. package/src/context-view.ts +440 -0
  97. package/src/context.ts +1079 -0
  98. package/src/index.ts +58 -0
  99. package/src/inject-config.ts +239 -0
  100. package/src/inject.ts +796 -0
  101. package/src/interception-proxy.ts +127 -0
  102. package/src/interceptor-chain.ts +268 -0
  103. package/src/interceptor.ts +430 -0
  104. package/src/invocation.ts +269 -0
  105. package/src/json-types.ts +35 -0
  106. package/src/keys.ts +85 -0
  107. package/src/provider.ts +37 -0
  108. package/src/resolution-session.ts +414 -0
  109. package/src/resolver.ts +282 -0
  110. package/src/unique-id.ts +24 -0
  111. package/src/value-promise.ts +318 -0
  112. package/index.d.ts +0 -6
  113. package/index.js +0 -9
  114. package/lib/index.d.ts +0 -1
  115. package/lib/index.js +0 -12
  116. package/lib/index.js.map +0 -1
  117. package/lib/src/binding.d.ts +0 -98
  118. package/lib/src/binding.js +0 -169
  119. package/lib/src/binding.js.map +0 -1
  120. package/lib/src/context.d.ts +0 -14
  121. package/lib/src/context.js +0 -122
  122. package/lib/src/context.js.map +0 -1
  123. package/lib/src/index.d.ts +0 -10
  124. package/lib/src/index.js +0 -25
  125. package/lib/src/index.js.map +0 -1
  126. package/lib/src/inject.d.ts +0 -60
  127. package/lib/src/inject.js +0 -112
  128. package/lib/src/inject.js.map +0 -1
  129. package/lib/src/is-promise.d.ts +0 -1
  130. package/lib/src/is-promise.js +0 -15
  131. package/lib/src/is-promise.js.map +0 -1
  132. package/lib/src/provider.d.ts +0 -31
  133. package/lib/src/provider.js.map +0 -1
  134. package/lib/src/reflect.d.ts +0 -38
  135. package/lib/src/reflect.js +0 -143
  136. package/lib/src/reflect.js.map +0 -1
  137. package/lib/src/resolver.d.ts +0 -30
  138. package/lib/src/resolver.js +0 -141
  139. package/lib/src/resolver.js.map +0 -1
  140. package/lib6/index.d.ts +0 -1
  141. package/lib6/index.js +0 -12
  142. package/lib6/index.js.map +0 -1
  143. package/lib6/src/binding.d.ts +0 -98
  144. package/lib6/src/binding.js +0 -169
  145. package/lib6/src/binding.js.map +0 -1
  146. package/lib6/src/context.d.ts +0 -14
  147. package/lib6/src/context.js +0 -122
  148. package/lib6/src/context.js.map +0 -1
  149. package/lib6/src/index.d.ts +0 -10
  150. package/lib6/src/index.js +0 -25
  151. package/lib6/src/index.js.map +0 -1
  152. package/lib6/src/inject.d.ts +0 -60
  153. package/lib6/src/inject.js +0 -112
  154. package/lib6/src/inject.js.map +0 -1
  155. package/lib6/src/is-promise.d.ts +0 -1
  156. package/lib6/src/is-promise.js +0 -15
  157. package/lib6/src/is-promise.js.map +0 -1
  158. package/lib6/src/provider.d.ts +0 -31
  159. package/lib6/src/provider.js.map +0 -1
  160. package/lib6/src/reflect.d.ts +0 -38
  161. package/lib6/src/reflect.js +0 -143
  162. package/lib6/src/reflect.js.map +0 -1
  163. package/lib6/src/resolver.d.ts +0 -30
  164. package/lib6/src/resolver.js +0 -141
  165. package/lib6/src/resolver.js.map +0 -1
@@ -1,98 +0,0 @@
1
- import { Context } from './context';
2
- import { Constructor } from './resolver';
3
- import { Provider } from './provider';
4
- export declare type BoundValue = any;
5
- export declare type ValueOrPromise<T> = T | Promise<T>;
6
- export declare class Binding {
7
- isLocked: boolean;
8
- static PROPERTY_SEPARATOR: string;
9
- /**
10
- * Validate the binding key format. Please note that `#` is reserved.
11
- * @param key Binding key, such as `a, a.b, a:b, a/b
12
- */
13
- static validateKey(key: string): string;
14
- /**
15
- * Remove the segament that denotes a property path
16
- * @param key Binding key, such as `a, a.b, a:b, a/b, a.b#x, a:b#x.y, a/b#x.y`
17
- */
18
- static normalizeKey(key: string): string;
19
- /**
20
- * Get the property path separated by `#`
21
- * @param key Binding key
22
- */
23
- static getKeyPath(key: string): string | undefined;
24
- private readonly _key;
25
- private _tags;
26
- valueConstructor: Constructor<BoundValue>;
27
- constructor(_key: string, isLocked?: boolean);
28
- readonly key: string;
29
- readonly tags: Set<string>;
30
- /**
31
- * This is an internal function optimized for performance.
32
- * Users should use `@inject(key)` or `ctx.get(key)` instead.
33
- *
34
- * Get the value bound to this key. Depending on `isSync`, this
35
- * function returns either:
36
- * - the bound value
37
- * - a promise of the bound value
38
- *
39
- * Consumers wishing to consume sync values directly should use `isPromise`
40
- * to check the type of the returned value to decide how to handle it.
41
- *
42
- * ```
43
- * const result = binding.getValue(ctx);
44
- * if (isPromise(result)) {
45
- * result.then(doSomething)
46
- * } else {
47
- * doSomething(result);
48
- * }
49
- * ```
50
- */
51
- getValue(ctx: Context): BoundValue | Promise<BoundValue>;
52
- lock(): this;
53
- tag(tagName: string | string[]): this;
54
- /**
55
- * Bind the key to a constant value.
56
- *
57
- * @param value The bound value.
58
- *
59
- * @example
60
- *
61
- * ```ts
62
- * ctx.bind('appName').to('CodeHub');
63
- * ```
64
- */
65
- to(value: BoundValue): this;
66
- /**
67
- * Bind the key to a computed (dynamic) value.
68
- *
69
- * @param factoryFn The factory function creating the value.
70
- * Both sync and async functions are supported.
71
- *
72
- * @example
73
- *
74
- * ```ts
75
- * // synchronous
76
- * ctx.bind('now').toDynamicValue(() => Date.now());
77
- *
78
- * // asynchronous
79
- * ctx.bind('something').toDynamicValue(
80
- * async () => Promise.delay(10).then(doSomething)
81
- * );
82
- * ```
83
- */
84
- toDynamicValue(factoryFn: () => BoundValue | Promise<BoundValue>): this;
85
- /**
86
- * Bind the key to a BindingProvider
87
- */
88
- toProvider<T>(providerClass: Constructor<Provider<T>>): this;
89
- /**
90
- * Bind the key to an instance of the given class.
91
- *
92
- * @param ctor The class constructor to call. Any constructor
93
- * arguments must be annotated with `@inject` so that
94
- * we can resolve them from the context.
95
- */
96
- toClass<T>(ctor: Constructor<T>): this;
97
- unlock(): this;
98
- }
@@ -1,169 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: loopback
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const resolver_1 = require("./resolver");
8
- const is_promise_1 = require("./is-promise");
9
- // FIXME(bajtos) The binding class should be parameterized by the value
10
- // type stored
11
- class Binding {
12
- constructor(_key, isLocked = false) {
13
- this.isLocked = isLocked;
14
- this._tags = new Set();
15
- Binding.validateKey(_key);
16
- this._key = _key;
17
- }
18
- /**
19
- * Validate the binding key format. Please note that `#` is reserved.
20
- * @param key Binding key, such as `a, a.b, a:b, a/b
21
- */
22
- static validateKey(key) {
23
- if (!key)
24
- throw new Error('Binding key must be provided.');
25
- if (key.indexOf(Binding.PROPERTY_SEPARATOR) !== -1) {
26
- throw new Error(`Binding key ${key} cannot contain`
27
- + ` '${Binding.PROPERTY_SEPARATOR}'.`);
28
- }
29
- return key;
30
- }
31
- /**
32
- * Remove the segament that denotes a property path
33
- * @param key Binding key, such as `a, a.b, a:b, a/b, a.b#x, a:b#x.y, a/b#x.y`
34
- */
35
- static normalizeKey(key) {
36
- const index = key.indexOf(Binding.PROPERTY_SEPARATOR);
37
- if (index !== -1)
38
- key = key.substr(0, index);
39
- key = key.trim();
40
- return key;
41
- }
42
- /**
43
- * Get the property path separated by `#`
44
- * @param key Binding key
45
- */
46
- static getKeyPath(key) {
47
- const index = key.indexOf(Binding.PROPERTY_SEPARATOR);
48
- if (index !== -1)
49
- return key.substr(index + 1);
50
- return undefined;
51
- }
52
- get key() {
53
- return this._key;
54
- }
55
- get tags() {
56
- return this._tags;
57
- }
58
- /**
59
- * This is an internal function optimized for performance.
60
- * Users should use `@inject(key)` or `ctx.get(key)` instead.
61
- *
62
- * Get the value bound to this key. Depending on `isSync`, this
63
- * function returns either:
64
- * - the bound value
65
- * - a promise of the bound value
66
- *
67
- * Consumers wishing to consume sync values directly should use `isPromise`
68
- * to check the type of the returned value to decide how to handle it.
69
- *
70
- * ```
71
- * const result = binding.getValue(ctx);
72
- * if (isPromise(result)) {
73
- * result.then(doSomething)
74
- * } else {
75
- * doSomething(result);
76
- * }
77
- * ```
78
- */
79
- getValue(ctx) {
80
- return Promise.reject(new Error(`No value was configured for binding ${this._key}.`));
81
- }
82
- lock() {
83
- this.isLocked = true;
84
- return this;
85
- }
86
- tag(tagName) {
87
- if (typeof tagName === 'string') {
88
- this._tags.add(tagName);
89
- }
90
- else {
91
- tagName.forEach(t => {
92
- this._tags.add(t);
93
- });
94
- }
95
- return this;
96
- }
97
- /**
98
- * Bind the key to a constant value.
99
- *
100
- * @param value The bound value.
101
- *
102
- * @example
103
- *
104
- * ```ts
105
- * ctx.bind('appName').to('CodeHub');
106
- * ```
107
- */
108
- to(value) {
109
- this.getValue = () => value;
110
- return this;
111
- }
112
- /**
113
- * Bind the key to a computed (dynamic) value.
114
- *
115
- * @param factoryFn The factory function creating the value.
116
- * Both sync and async functions are supported.
117
- *
118
- * @example
119
- *
120
- * ```ts
121
- * // synchronous
122
- * ctx.bind('now').toDynamicValue(() => Date.now());
123
- *
124
- * // asynchronous
125
- * ctx.bind('something').toDynamicValue(
126
- * async () => Promise.delay(10).then(doSomething)
127
- * );
128
- * ```
129
- */
130
- toDynamicValue(factoryFn) {
131
- // TODO(bajtos) allow factoryFn with @inject arguments
132
- this.getValue = ctx => factoryFn();
133
- return this;
134
- }
135
- /**
136
- * Bind the key to a BindingProvider
137
- */
138
- toProvider(providerClass) {
139
- this.getValue = ctx => {
140
- const providerOrPromise = resolver_1.instantiateClass(providerClass, ctx);
141
- if (is_promise_1.isPromise(providerOrPromise)) {
142
- return providerOrPromise.then(p => p.value());
143
- }
144
- else {
145
- return providerOrPromise.value();
146
- }
147
- };
148
- return this;
149
- }
150
- /**
151
- * Bind the key to an instance of the given class.
152
- *
153
- * @param ctor The class constructor to call. Any constructor
154
- * arguments must be annotated with `@inject` so that
155
- * we can resolve them from the context.
156
- */
157
- toClass(ctor) {
158
- this.getValue = context => resolver_1.instantiateClass(ctor, context);
159
- this.valueConstructor = ctor;
160
- return this;
161
- }
162
- unlock() {
163
- this.isLocked = false;
164
- return this;
165
- }
166
- }
167
- Binding.PROPERTY_SEPARATOR = '#';
168
- exports.Binding = Binding;
169
- //# sourceMappingURL=binding.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/binding.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wBAAwB;AACxB,+CAA+C;AAC/C,gEAAgE;;AAGhE,yCAAyD;AACzD,6CAAuC;AAQvC,uEAAuE;AACvE,cAAc;AACd;IA4CE,YAAY,IAAY,EAAS,WAAoB,KAAK;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;QANlD,UAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;QAOrC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IA5CD;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,GAAW;QAC5B,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC3D,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,iBAAiB;kBAC/C,KAAK,OAAO,CAAC,kBAAkB,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,CAAC,GAAG,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,GAAW;QAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACtD,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;YAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC7C,GAAG,GAA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,KAAK,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,CAAC,SAAiD;QAC9D,sDAAsD;QACtD,IAAI,CAAC,QAAQ,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACI,UAAU,CAAI,aAAuC;QAC1D,IAAI,CAAC,QAAQ,GAAG,GAAG;YACjB,MAAM,iBAAiB,GAAG,2BAAgB,CACxC,aAAa,EACb,GAAG,CACJ,CAAC;YACF,EAAE,CAAC,CAAC,sBAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;gBACjC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;YACnC,CAAC;QACH,CAAC,CAAC;QACF,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAI,IAAoB;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,2BAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3D,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;;AA7KM,0BAAkB,GAAG,GAAG,CAAC;AADlC,0BA+KC"}
@@ -1,14 +0,0 @@
1
- import { Binding, BoundValue } from './binding';
2
- export declare class Context {
3
- private _parent;
4
- private registry;
5
- constructor(_parent?: Context);
6
- bind(key: string): Binding;
7
- contains(key: string): boolean;
8
- find(pattern?: string): Binding[];
9
- findByTag(pattern: string): Binding[];
10
- protected _mergeWithParent(childList: Binding[], parentList?: Binding[]): Binding[];
11
- get(key: string): Promise<BoundValue>;
12
- getSync(key: string): BoundValue;
13
- getBinding(key: string): Binding;
14
- }
@@ -1,122 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: loopback
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const binding_1 = require("./binding");
8
- const is_promise_1 = require("./is-promise");
9
- class Context {
10
- constructor(_parent) {
11
- this._parent = _parent;
12
- this.registry = new Map();
13
- }
14
- bind(key) {
15
- binding_1.Binding.validateKey(key);
16
- key = binding_1.Binding.normalizeKey(key);
17
- const keyExists = this.registry.has(key);
18
- if (keyExists) {
19
- const existingBinding = this.registry.get(key);
20
- const bindingIsLocked = existingBinding && existingBinding.isLocked;
21
- if (bindingIsLocked)
22
- throw new Error(`Cannot rebind key "${key}" to a locked binding`);
23
- }
24
- const binding = new binding_1.Binding(key);
25
- this.registry.set(key, binding);
26
- return binding;
27
- }
28
- contains(key) {
29
- key = binding_1.Binding.normalizeKey(key);
30
- return this.registry.has(key);
31
- }
32
- find(pattern) {
33
- let bindings = [];
34
- if (pattern) {
35
- // TODO(@superkhau): swap with production grade glob to regex lib
36
- pattern = binding_1.Binding.normalizeKey(pattern);
37
- const glob = new RegExp('^' + pattern.split('*').join('.*') + '$');
38
- this.registry.forEach(binding => {
39
- const isMatch = glob.test(binding.key);
40
- if (isMatch)
41
- bindings.push(binding);
42
- });
43
- }
44
- else {
45
- bindings = Array.from(this.registry.values());
46
- }
47
- const parentBindings = this._parent && this._parent.find(pattern);
48
- return this._mergeWithParent(bindings, parentBindings);
49
- }
50
- findByTag(pattern) {
51
- const bindings = [];
52
- // TODO(@superkhau): swap with production grade glob to regex lib
53
- const glob = new RegExp('^' + pattern.split('*').join('.*') + '$');
54
- this.registry.forEach(binding => {
55
- const isMatch = Array.from(binding.tags).some(tag => glob.test(tag));
56
- if (isMatch)
57
- bindings.push(binding);
58
- });
59
- const parentBindings = this._parent && this._parent.findByTag(pattern);
60
- return this._mergeWithParent(bindings, parentBindings);
61
- }
62
- _mergeWithParent(childList, parentList) {
63
- if (!parentList)
64
- return childList;
65
- const additions = parentList.filter(parentBinding => {
66
- // children bindings take precedence
67
- return !childList.some(childBinding => childBinding.key === parentBinding.key);
68
- });
69
- return childList.concat(additions);
70
- }
71
- get(key) {
72
- try {
73
- const path = binding_1.Binding.getKeyPath(key);
74
- const binding = this.getBinding(key);
75
- return Promise.resolve(binding.getValue(this)).then(val => getValue(val, path));
76
- }
77
- catch (err) {
78
- return Promise.reject(err);
79
- }
80
- }
81
- getSync(key) {
82
- const path = binding_1.Binding.getKeyPath(key);
83
- const binding = this.getBinding(key);
84
- const valueOrPromise = binding.getValue(this);
85
- if (is_promise_1.isPromise(valueOrPromise)) {
86
- throw new Error(`Cannot get ${key} synchronously: the value is a promise`);
87
- }
88
- return getValue(valueOrPromise, path);
89
- }
90
- getBinding(key) {
91
- key = binding_1.Binding.normalizeKey(key);
92
- const binding = this.registry.get(key);
93
- if (binding) {
94
- return binding;
95
- }
96
- if (this._parent) {
97
- return this._parent.getBinding(key);
98
- }
99
- throw new Error(`The key ${key} was not bound to any value.`);
100
- }
101
- }
102
- exports.Context = Context;
103
- /**
104
- * Get the value by `.` notation
105
- * @param obj The source value
106
- * @param path A path to the nested property, such as `x`, `x.y`, `x.length`,
107
- * or `x.0`
108
- */
109
- function getValue(obj, path) {
110
- if (!path)
111
- return obj;
112
- const props = path.split('.');
113
- let val = undefined;
114
- for (const p of props) {
115
- val = obj[p];
116
- if (val == null)
117
- return val;
118
- obj = val;
119
- }
120
- return val;
121
- }
122
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wBAAwB;AACxB,+CAA+C;AAC/C,g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,GAAG,CAAC;AACb,CAAC"}
@@ -1,10 +0,0 @@
1
- export { Binding, BoundValue } from './binding';
2
- export { Context } from './context';
3
- export { Constructor } from './resolver';
4
- export { inject } from './inject';
5
- export { NamespacedReflect } from './reflect';
6
- export { Provider } from './provider';
7
- export { isPromise } from './is-promise';
8
- export { instantiateClass } from './resolver';
9
- export { describeInjectedArguments, describeInjectedProperties, Injection } from './inject';
10
- export { Reflector } from './reflect';
package/lib/src/index.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2017. All Rights Reserved.
3
- // Node module: loopback
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var binding_1 = require("./binding");
8
- exports.Binding = binding_1.Binding;
9
- var context_1 = require("./context");
10
- exports.Context = context_1.Context;
11
- var inject_1 = require("./inject");
12
- exports.inject = inject_1.inject;
13
- var reflect_1 = require("./reflect");
14
- exports.NamespacedReflect = reflect_1.NamespacedReflect;
15
- var is_promise_1 = require("./is-promise");
16
- exports.isPromise = is_promise_1.isPromise;
17
- // internals for testing
18
- var resolver_1 = require("./resolver");
19
- exports.instantiateClass = resolver_1.instantiateClass;
20
- var inject_2 = require("./inject");
21
- exports.describeInjectedArguments = inject_2.describeInjectedArguments;
22
- exports.describeInjectedProperties = inject_2.describeInjectedProperties;
23
- var reflect_2 = require("./reflect");
24
- exports.Reflector = reflect_2.Reflector;
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,wBAAwB;AACxB,+CAA+C;AAC/C,gEAAgE;;AAEhE,qCAA8C;AAAtC,4BAAA,OAAO,CAAA;AACf,qCAAkC;AAA1B,4BAAA,OAAO,CAAA;AAEf,mCAAgC;AAAxB,0BAAA,MAAM,CAAA;AACd,qCAA4C;AAApC,sCAAA,iBAAiB,CAAA;AAEzB,2CAAuC;AAA/B,iCAAA,SAAS,CAAA;AAEjB,wBAAwB;AACxB,uCAA4C;AAApC,sCAAA,gBAAgB,CAAA;AACxB,mCAIkB;AAHhB,6CAAA,yBAAyB,CAAA;AACzB,8CAAA,0BAA0B,CAAA;AAG5B,qCAAoC;AAA5B,8BAAA,SAAS,CAAA"}
@@ -1,60 +0,0 @@
1
- import { BoundValue, ValueOrPromise } from './binding';
2
- import { Context } from './context';
3
- /**
4
- * A function to provide resolution of injected values
5
- */
6
- export interface ResolverFunction {
7
- (ctx: Context, injection: Injection): ValueOrPromise<BoundValue>;
8
- }
9
- /**
10
- * Descriptor for an injection point
11
- */
12
- export interface Injection {
13
- bindingKey: string;
14
- metadata?: {
15
- [attribute: string]: BoundValue;
16
- };
17
- resolve?: ResolverFunction;
18
- }
19
- /**
20
- * A decorator to annotate method arguments for automatic injection
21
- * by LoopBack IoC container.
22
- *
23
- * Usage - Typescript:
24
- *
25
- * ```ts
26
- * class InfoController {
27
- * @inject('authentication.user') public userName: string;
28
- *
29
- * constructor(@inject('application.name') public appName: string) {
30
- * }
31
- * // ...
32
- * }
33
- * ```
34
- *
35
- * Usage - JavaScript:
36
- *
37
- * - TODO(bajtos)
38
- *
39
- * @param bindingKey What binding to use in order to resolve the value of the
40
- * decorated constructor parameter or property.
41
- * @param metadata Optional metadata to help the injection
42
- * @param resolve Optional function to resolve the injection
43
- *
44
- */
45
- export declare function inject(bindingKey: string, metadata?: Object, resolve?: ResolverFunction): (target: any, propertyKey?: string | symbol | undefined, propertyDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void;
46
- /**
47
- * Return an array of injection objects for parameters
48
- * @param target The target class for constructor or static methods,
49
- * or the prototype for instance methods
50
- * @param methodName Method name, undefined for constructor
51
- */
52
- export declare function describeInjectedArguments(target: any, method?: string | symbol): Injection[];
53
- /**
54
- * Return a map of injection objects for properties
55
- * @param target The target class for static properties or
56
- * prototype for instance properties.
57
- */
58
- export declare function describeInjectedProperties(target: any): {
59
- [p: string]: Injection;
60
- };
package/lib/src/inject.js DELETED
@@ -1,112 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: loopback
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const reflect_1 = require("./reflect");
8
- const PARAMETERS_KEY = 'inject:parameters';
9
- const PROPERTIES_KEY = 'inject:properties';
10
- /**
11
- * A decorator to annotate method arguments for automatic injection
12
- * by LoopBack IoC container.
13
- *
14
- * Usage - Typescript:
15
- *
16
- * ```ts
17
- * class InfoController {
18
- * @inject('authentication.user') public userName: string;
19
- *
20
- * constructor(@inject('application.name') public appName: string) {
21
- * }
22
- * // ...
23
- * }
24
- * ```
25
- *
26
- * Usage - JavaScript:
27
- *
28
- * - TODO(bajtos)
29
- *
30
- * @param bindingKey What binding to use in order to resolve the value of the
31
- * decorated constructor parameter or property.
32
- * @param metadata Optional metadata to help the injection
33
- * @param resolve Optional function to resolve the injection
34
- *
35
- */
36
- function inject(bindingKey, metadata, resolve) {
37
- return function markParameterOrPropertyAsInjected(
38
- // tslint:disable-next-line:no-any
39
- target, propertyKey, propertyDescriptorOrParameterIndex) {
40
- if (typeof propertyDescriptorOrParameterIndex === 'number') {
41
- // The decorator is applied to a method parameter
42
- // Please note propertyKey is `undefined` for constructor
43
- const injectedArgs = reflect_1.Reflector.getOwnMetadata(PARAMETERS_KEY, target, propertyKey) || [];
44
- injectedArgs[propertyDescriptorOrParameterIndex] = {
45
- bindingKey,
46
- metadata,
47
- resolve,
48
- };
49
- reflect_1.Reflector.defineMetadata(PARAMETERS_KEY, injectedArgs, target, propertyKey);
50
- }
51
- else if (propertyKey) {
52
- if (typeof Object.getPrototypeOf(target) === 'function') {
53
- const prop = target.name + '.' + propertyKey.toString();
54
- throw new Error('@inject is not supported for a static property: ' + prop);
55
- }
56
- // The decorator is applied to a property
57
- const injections = reflect_1.Reflector.getOwnMetadata(PROPERTIES_KEY, target) || {};
58
- injections[propertyKey] = { bindingKey, metadata, resolve };
59
- reflect_1.Reflector.defineMetadata(PROPERTIES_KEY, injections, target);
60
- }
61
- else {
62
- throw new Error('@inject can only be used on properties or method parameters.');
63
- }
64
- };
65
- }
66
- exports.inject = inject;
67
- /**
68
- * Return an array of injection objects for parameters
69
- * @param target The target class for constructor or static methods,
70
- * or the prototype for instance methods
71
- * @param methodName Method name, undefined for constructor
72
- */
73
- function describeInjectedArguments(
74
- // tslint:disable-next-line:no-any
75
- target, method) {
76
- if (method) {
77
- return reflect_1.Reflector.getMetadata(PARAMETERS_KEY, target, method) || [];
78
- }
79
- else {
80
- return reflect_1.Reflector.getMetadata(PARAMETERS_KEY, target) || [];
81
- }
82
- }
83
- exports.describeInjectedArguments = describeInjectedArguments;
84
- /**
85
- * Return a map of injection objects for properties
86
- * @param target The target class for static properties or
87
- * prototype for instance properties.
88
- */
89
- function describeInjectedProperties(
90
- // tslint:disable-next-line:no-any
91
- target) {
92
- const metadata = {};
93
- let obj = target;
94
- while (true) {
95
- const m = reflect_1.Reflector.getOwnMetadata(PROPERTIES_KEY, obj);
96
- if (m) {
97
- // Adding non-existent properties
98
- for (const p in m) {
99
- if (!(p in metadata)) {
100
- metadata[p] = m[p];
101
- }
102
- }
103
- }
104
- // Recurse into the prototype chain
105
- obj = Object.getPrototypeOf(obj);
106
- if (!obj)
107
- break;
108
- }
109
- return metadata;
110
- }
111
- exports.describeInjectedProperties = describeInjectedProperties;
112
- //# sourceMappingURL=inject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject.js","sourceRoot":"","sources":["../../src/inject.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wBAAwB;AACxB,+CAA+C;AAC/C,gEAAgE;;AAGhE,uCAAoC;AAIpC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAC3C,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAkB3C;;;;;;;;;;;;;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. 2013,2017. All Rights Reserved.
3
- // Node module: loopback
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- function isPromise(value) {
8
- if (!value)
9
- return false;
10
- if (typeof value !== 'object' && typeof value !== 'function')
11
- return false;
12
- return typeof value.then === 'function';
13
- }
14
- exports.isPromise = isPromise;
15
- //# sourceMappingURL=is-promise.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-promise.js","sourceRoot":"","sources":["../../src/is-promise.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wBAAwB;AACxB,+CAA+C;AAC/C,gEAAgE;;AAEhE,mBAA6B,KAAqB;IAChD,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAAC,MAAM,CAAC,KAAK,CAAC;IACzB,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC;QAAC,MAAM,CAAC,KAAK,CAAC;IAC3E,MAAM,CAAC,OAAQ,KAAoB,CAAC,IAAI,KAAK,UAAU,CAAC;AAC1D,CAAC;AAJD,8BAIC"}