@loopback/context 1.8.1 → 1.12.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,64 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.12.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@1.11.0...@loopback/context@1.12.0) (2019-04-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * **build:** add more TypeScript "strict" checks ([866aa2f](https://github.com/strongloop/loopback-next/commit/866aa2f))
12
+ * **context:** add `[@inject](https://github.com/inject).binding` and improve `[@inject](https://github.com/inject).setter` ([a396274](https://github.com/strongloop/loopback-next/commit/a396274))
13
+ * **context:** fix generic typing for BindingFilter ([372b406](https://github.com/strongloop/loopback-next/commit/372b406))
14
+
15
+
16
+
17
+
18
+
19
+ # [1.11.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@1.10.0...@loopback/context@1.11.0) (2019-04-11)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **context:** instantiate class with non-injected arguments ([6699825](https://github.com/strongloop/loopback-next/commit/6699825))
25
+
26
+
27
+ ### Features
28
+
29
+ * **context:** make Injection.metadata a required property ([dcc9cac](https://github.com/strongloop/loopback-next/commit/dcc9cac))
30
+
31
+
32
+
33
+
34
+
35
+ # [1.10.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@1.9.0...@loopback/context@1.10.0) (2019-04-09)
36
+
37
+
38
+ ### Features
39
+
40
+ * **context:** always pass the session to ResolverFunction ([bf36532](https://github.com/strongloop/loopback-next/commit/bf36532))
41
+
42
+
43
+
44
+
45
+
46
+ # [1.9.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@1.8.1...@loopback/context@1.9.0) (2019-04-05)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * **context:** clear binding cache upon scope or value getter changes ([122fe7b](https://github.com/strongloop/loopback-next/commit/122fe7b))
52
+
53
+
54
+ ### Features
55
+
56
+ * **context:** add a helper function to create a getter from binding filter ([41248f3](https://github.com/strongloop/loopback-next/commit/41248f3))
57
+ * **context:** add binding.toAlias() to resolve values from another binding ([15dcd16](https://github.com/strongloop/loopback-next/commit/15dcd16))
58
+ * **context:** pass resolution options into binding.getValue() ([705dcd5](https://github.com/strongloop/loopback-next/commit/705dcd5))
59
+
60
+
61
+
62
+
63
+
6
64
  ## [1.8.1](https://github.com/strongloop/loopback-next/compare/@loopback/context@1.8.0...@loopback/context@1.8.1) (2019-03-22)
7
65
 
8
66
  **Note:** Version bump only for package @loopback/context
@@ -3,8 +3,35 @@ import { BindingAddress } from './binding-key';
3
3
  /**
4
4
  * A function that filters bindings. It returns `true` to select a given
5
5
  * binding.
6
+ *
7
+ * TODO(semver-major): We might change this type in the future to either remove
8
+ * the `<ValueType>` or make it as type guard by asserting the matched binding
9
+ * to be typed with `<ValueType>`.
10
+ *
11
+ * **NOTE**: Originally, we allow filters to be tied with a single value type.
12
+ * This actually does not make much sense - the filter function is typically
13
+ * invoked on all bindings to find those ones matching the given criteria.
14
+ * Filters must be prepared to handle bindings of any value type. We learned
15
+ * about this problem after enabling TypeScript's `strictFunctionTypes` check,
16
+ * but decided to preserve `ValueType` argument for backwards compatibility.
17
+ * The `<ValueType>` represents the value type for matched bindings but it's
18
+ * not used for checking.
19
+ *
20
+ * Ideally, `BindingFilter` should be declared as a type guard as follows:
21
+ * ```ts
22
+ * export type BindingFilterGuard<ValueType = unknown> = (
23
+ * binding: Readonly<Binding<unknown>>,
24
+ * ) => binding is Readonly<Binding<ValueType>>;
25
+ * ```
26
+ *
27
+ * But TypeScript treats the following types as incompatible and does not accept
28
+ * type 1 for type 2.
29
+ *
30
+ * 1. `(binding: Readonly<Binding<unknown>>) => boolean`
31
+ * 2. `(binding: Readonly<Binding<unknown>>) => binding is Readonly<Binding<ValueType>>`
32
+ *
6
33
  */
7
- export declare type BindingFilter<ValueType = unknown> = (binding: Readonly<Binding<ValueType>>) => boolean;
34
+ export declare type BindingFilter<ValueType = unknown> = (binding: Readonly<Binding<unknown>>) => boolean;
8
35
  /**
9
36
  * Select binding(s) by key or a filter function
10
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"binding-filter.js","sourceRoot":"","sources":["../src/binding-filter.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;AAoBhE;;;GAGG;AACH,SAAgB,gBAAgB,CAC9B,eAAgC;IAEhC,OAAO,OAAO,eAAe,KAAK,UAAU,CAAC;AAC/C,CAAC;AAJD,4CAIC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,UAA+B;IACzD,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,YAAY,MAAM,EAAE;QAClE,MAAM,MAAM,GACV,OAAO,UAAU,KAAK,QAAQ;YAC5B,CAAC,CAAC,gBAAgB,CAAC,UAAU,CAAC;YAC9B,CAAC,CAAC,UAAU,CAAC;QACjB,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,MAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/D;SAAM;QACL,OAAO,CAAC,CAAC,EAAE;YACT,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE;gBAC1B,oCAAoC;gBACpC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;oBAAE,OAAO,KAAK,CAAC;aACjD;YACD,iCAAiC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;KACH;AACH,CAAC;AAjBD,kCAiBC;AAED;;;GAGG;AACH,SAAgB,WAAW,CACzB,UAA4C;IAE5C,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,MAAM,KAAK,GAAG,gB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CAA+C;IAC/C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjE,OAAO,IAAI,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;AACnC,CAAC"}
package/dist/binding.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BindingAddress } from './binding-key';
2
2
  import { Context } from './context';
3
3
  import { Provider } from './provider';
4
- import { ResolutionSession } from './resolution-session';
4
+ import { ResolutionOptions, ResolutionSession } from './resolution-session';
5
5
  import { BoundValue, Constructor, MapObject, ValueOrPromise } from './value-promise';
6
6
  /**
7
7
  * Scope for binding values
@@ -92,7 +92,11 @@ export declare enum BindingType {
92
92
  /**
93
93
  * A provider class with `value()` function to get the value
94
94
  */
95
- PROVIDER = "Provider"
95
+ PROVIDER = "Provider",
96
+ /**
97
+ * A alias to another binding key with optional path
98
+ */
99
+ ALIAS = "Alias"
96
100
  }
97
101
  export declare type TagMap = MapObject<any>;
98
102
  /**
@@ -142,6 +146,10 @@ export declare class Binding<T = BoundValue> {
142
146
  * @param result The calculated value for the binding
143
147
  */
144
148
  private _cacheValue;
149
+ /**
150
+ * Clear the cache
151
+ */
152
+ private _clearCache;
145
153
  /**
146
154
  * This is an internal function optimized for performance.
147
155
  * Users should use `@inject(key)` or `ctx.get(key)` instead.
@@ -167,6 +175,14 @@ export declare class Binding<T = BoundValue> {
167
175
  * @param session Optional session for binding and dependency resolution
168
176
  */
169
177
  getValue(ctx: Context, session?: ResolutionSession): ValueOrPromise<T>;
178
+ /**
179
+ * Returns a value or promise for this binding in the given context. The
180
+ * resolved value can be `undefined` if `optional` is set to `true` in
181
+ * `options`.
182
+ * @param ctx Context for the resolution
183
+ * @param options Optional options for binding and dependency resolution
184
+ */
185
+ getValue(ctx: Context, options?: ResolutionOptions): ValueOrPromise<T | undefined>;
170
186
  lock(): this;
171
187
  /**
172
188
  * Tag the binding with names or name/value objects. A tag has a name and
@@ -209,6 +225,11 @@ export declare class Binding<T = BoundValue> {
209
225
  * @param scope Default binding scope
210
226
  */
211
227
  applyDefaultScope(scope: BindingScope): this;
228
+ /**
229
+ * Set the `_getValue` function
230
+ * @param getValue getValue function
231
+ */
232
+ private _setValueGetter;
212
233
  /**
213
234
  * Bind the key to a constant value. The value must be already available
214
235
  * at binding time, it is not allowed to pass a Promise instance.
@@ -266,10 +287,19 @@ export declare class Binding<T = BoundValue> {
266
287
  * we can resolve them from the context.
267
288
  */
268
289
  toClass(ctor: Constructor<T>): this;
290
+ /**
291
+ * Bind the key to an alias of another binding
292
+ * @param keyWithPath Target binding key with optional path,
293
+ * such as `servers.RestServer.options#apiExplorer`
294
+ */
295
+ toAlias(keyWithPath: BindingAddress<T>): this;
296
+ /**
297
+ * Unlock the binding
298
+ */
269
299
  unlock(): this;
270
300
  /**
271
- * Apply a template function to set up the binding with scope, tags, and
272
- * other attributes as a group.
301
+ * Apply one or more template functions to set up the binding with scope,
302
+ * tags, and other attributes as a group.
273
303
  *
274
304
  * For example,
275
305
  * ```ts
@@ -279,9 +309,9 @@ export declare class Binding<T = BoundValue> {
279
309
  * const serverBinding = new Binding<RestServer>('servers.RestServer1');
280
310
  * serverBinding.apply(serverTemplate);
281
311
  * ```
282
- * @param templateFn A function to configure the binding
312
+ * @param templateFns One or more functions to configure the binding
283
313
  */
284
- apply(templateFn: BindingTemplate<T>): this;
314
+ apply(...templateFns: BindingTemplate<T>[]): this;
285
315
  toJSON(): Object;
286
316
  /**
287
317
  * A static method to create a binding so that we can do
package/dist/binding.js CHANGED
@@ -4,12 +4,12 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- const debugModule = require("debug");
7
+ const debugFactory = require("debug");
8
8
  const binding_key_1 = require("./binding-key");
9
9
  const resolution_session_1 = require("./resolution-session");
10
10
  const resolver_1 = require("./resolver");
11
11
  const value_promise_1 = require("./value-promise");
12
- const debug = debugModule('loopback:context:binding');
12
+ const debug = debugFactory('loopback:context:binding');
13
13
  /**
14
14
  * Scope for binding values
15
15
  */
@@ -102,6 +102,10 @@ var BindingType;
102
102
  * A provider class with `value()` function to get the value
103
103
  */
104
104
  BindingType["PROVIDER"] = "Provider";
105
+ /**
106
+ * A alias to another binding key with optional path
107
+ */
108
+ BindingType["ALIAS"] = "Alias";
105
109
  })(BindingType = exports.BindingType || (exports.BindingType = {}));
106
110
  /**
107
111
  * Binding represents an entry in the `Context`. Each binding has a key and a
@@ -160,30 +164,16 @@ class Binding {
160
164
  });
161
165
  }
162
166
  /**
163
- * This is an internal function optimized for performance.
164
- * Users should use `@inject(key)` or `ctx.get(key)` instead.
165
- *
166
- * Get the value bound to this key. Depending on `isSync`, this
167
- * function returns either:
168
- * - the bound value
169
- * - a promise of the bound value
170
- *
171
- * Consumers wishing to consume sync values directly should use `isPromise`
172
- * to check the type of the returned value to decide how to handle it.
173
- *
174
- * ```
175
- * const result = binding.getValue(ctx);
176
- * if (isPromiseLike(result)) {
177
- * result.then(doSomething)
178
- * } else {
179
- * doSomething(result);
180
- * }
181
- * ```
182
- *
183
- * @param ctx Context for the resolution
184
- * @param session Optional session for binding and dependency resolution
167
+ * Clear the cache
185
168
  */
186
- getValue(ctx, session) {
169
+ _clearCache() {
170
+ if (!this._cache)
171
+ return;
172
+ // WeakMap does not have a `clear` method
173
+ this._cache = new WeakMap();
174
+ }
175
+ // Implementation
176
+ getValue(ctx, optionsOrSession) {
187
177
  /* istanbul ignore if */
188
178
  if (debug.enabled) {
189
179
  debug('Get value for binding %s', this.key);
@@ -202,8 +192,12 @@ class Binding {
202
192
  }
203
193
  }
204
194
  }
195
+ const options = resolution_session_1.asResolutionOptions(optionsOrSession);
205
196
  if (this._getValue) {
206
- let result = resolution_session_1.ResolutionSession.runWithBinding(s => this._getValue(ctx, s), this, session);
197
+ let result = resolution_session_1.ResolutionSession.runWithBinding(s => {
198
+ const optionsWithSession = Object.assign({}, options, { session: s });
199
+ return this._getValue(ctx, optionsWithSession);
200
+ }, this, options.session);
207
201
  return this._cacheValue(ctx, result);
208
202
  }
209
203
  return Promise.reject(new Error(`No value was configured for binding ${this.key}.`));
@@ -263,6 +257,8 @@ class Binding {
263
257
  * @param scope Binding scope
264
258
  */
265
259
  inScope(scope) {
260
+ if (this._scope !== scope)
261
+ this._clearCache();
266
262
  this._scope = scope;
267
263
  return this;
268
264
  }
@@ -273,10 +269,19 @@ class Binding {
273
269
  */
274
270
  applyDefaultScope(scope) {
275
271
  if (!this._scope) {
276
- this._scope = scope;
272
+ this.inScope(scope);
277
273
  }
278
274
  return this;
279
275
  }
276
+ /**
277
+ * Set the `_getValue` function
278
+ * @param getValue getValue function
279
+ */
280
+ _setValueGetter(getValue) {
281
+ // Clear the cache
282
+ this._clearCache();
283
+ this._getValue = getValue;
284
+ }
280
285
  /**
281
286
  * Bind the key to a constant value. The value must be already available
282
287
  * at binding time, it is not allowed to pass a Promise instance.
@@ -314,7 +319,7 @@ class Binding {
314
319
  debug('Bind %s to constant:', this.key, value);
315
320
  }
316
321
  this._type = BindingType.CONSTANT;
317
- this._getValue = () => value;
322
+ this._setValueGetter(() => value);
318
323
  return this;
319
324
  }
320
325
  /**
@@ -341,7 +346,7 @@ class Binding {
341
346
  debug('Bind %s to dynamic value:', this.key, factoryFn);
342
347
  }
343
348
  this._type = BindingType.DYNAMIC_VALUE;
344
- this._getValue = ctx => factoryFn();
349
+ this._setValueGetter(ctx => factoryFn());
345
350
  return this;
346
351
  }
347
352
  /**
@@ -366,10 +371,10 @@ class Binding {
366
371
  debug('Bind %s to provider %s', this.key, providerClass.name);
367
372
  }
368
373
  this._type = BindingType.PROVIDER;
369
- this._getValue = (ctx, session) => {
370
- const providerOrPromise = resolver_1.instantiateClass(providerClass, ctx, session);
374
+ this._setValueGetter((ctx, options) => {
375
+ const providerOrPromise = resolver_1.instantiateClass(providerClass, ctx, options.session);
371
376
  return value_promise_1.transformValueOrPromise(providerOrPromise, p => p.value());
372
- };
377
+ });
373
378
  return this;
374
379
  }
375
380
  /**
@@ -385,17 +390,37 @@ class Binding {
385
390
  debug('Bind %s to class %s', this.key, ctor.name);
386
391
  }
387
392
  this._type = BindingType.CLASS;
388
- this._getValue = (ctx, session) => resolver_1.instantiateClass(ctor, ctx, session);
393
+ this._setValueGetter((ctx, options) => resolver_1.instantiateClass(ctor, ctx, options.session));
389
394
  this._valueConstructor = ctor;
390
395
  return this;
391
396
  }
397
+ /**
398
+ * Bind the key to an alias of another binding
399
+ * @param keyWithPath Target binding key with optional path,
400
+ * such as `servers.RestServer.options#apiExplorer`
401
+ */
402
+ toAlias(keyWithPath) {
403
+ /* istanbul ignore if */
404
+ if (debug.enabled) {
405
+ debug('Bind %s to alias %s', this.key, keyWithPath);
406
+ }
407
+ this._type = BindingType.ALIAS;
408
+ this._setValueGetter((ctx, optionsOrSession) => {
409
+ const options = resolution_session_1.asResolutionOptions(optionsOrSession);
410
+ return ctx.getValueOrPromise(keyWithPath, options);
411
+ });
412
+ return this;
413
+ }
414
+ /**
415
+ * Unlock the binding
416
+ */
392
417
  unlock() {
393
418
  this.isLocked = false;
394
419
  return this;
395
420
  }
396
421
  /**
397
- * Apply a template function to set up the binding with scope, tags, and
398
- * other attributes as a group.
422
+ * Apply one or more template functions to set up the binding with scope,
423
+ * tags, and other attributes as a group.
399
424
  *
400
425
  * For example,
401
426
  * ```ts
@@ -405,10 +430,12 @@ class Binding {
405
430
  * const serverBinding = new Binding<RestServer>('servers.RestServer1');
406
431
  * serverBinding.apply(serverTemplate);
407
432
  * ```
408
- * @param templateFn A function to configure the binding
433
+ * @param templateFns One or more functions to configure the binding
409
434
  */
410
- apply(templateFn) {
411
- templateFn(this);
435
+ apply(...templateFns) {
436
+ for (const fn of templateFns) {
437
+ fn(this);
438
+ }
412
439
  return this;
413
440
  }
414
441
  toJSON() {
@@ -1 +1 @@
1
- {"version":3,"file":"binding.js","sourceRoot":"","sources":["../src/binding.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E,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;SACrD;QACD,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;QAC/B,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,EAAE,gBAAgB,EAAE,EAAE;YAC7C,MAAM,OAAO,GAAG,wCAAmB,CAAC,gBAAgB,CAAC,CAAC;YACtD,OAAO,GAAG,CAAC,iBAAiB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,GAAG,WAAiC;QACxC,KAAK,MAAM,EAAE,IAAI,WAAW,EAAE;YAC5B,EAAE,CAAC,IAAI,CAAC,CAAC;SACV;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM;QACJ,kCAAkC;QAClC,MAAM,IAAI,GAA0B;YAClC,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;YACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;SACvB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAc,GAAsB;QAC7C,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrC,CAAC;CACF;AAlbD,0BAkbC"}
@@ -68,3 +68,10 @@ export declare class ContextView<T = unknown> extends EventEmitter implements Co
68
68
  */
69
69
  asGetter(session?: ResolutionSession): Getter<T[]>;
70
70
  }
71
+ /**
72
+ * Create a context view as a getter
73
+ * @param ctx Context object
74
+ * @param bindingFilter A function to match bindings
75
+ * @param session Resolution session
76
+ */
77
+ export declare function createViewGetter<T = unknown>(ctx: Context, bindingFilter: BindingFilter, session?: ResolutionSession): Getter<T[]>;
@@ -69,8 +69,9 @@ class ContextView extends events_1.EventEmitter {
69
69
  */
70
70
  findBindings() {
71
71
  debug('Finding matching bindings');
72
- this._cachedBindings = this.context.find(this.filter);
73
- return this._cachedBindings;
72
+ const found = this.context.find(this.filter);
73
+ this._cachedBindings = found;
74
+ return found;
74
75
  }
75
76
  /**
76
77
  * Listen on `bind` or `unbind` and invalidate the cache
@@ -132,4 +133,16 @@ class ContextView extends events_1.EventEmitter {
132
133
  }
133
134
  }
134
135
  exports.ContextView = ContextView;
136
+ /**
137
+ * Create a context view as a getter
138
+ * @param ctx Context object
139
+ * @param bindingFilter A function to match bindings
140
+ * @param session Resolution session
141
+ */
142
+ function createViewGetter(ctx, bindingFilter, session) {
143
+ const view = new ContextView(ctx, bindingFilter);
144
+ view.open();
145
+ return view.asGetter(session);
146
+ }
147
+ exports.createViewGetter = createViewGetter;
135
148
  //# sourceMappingURL=context-view.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-view.js","sourceRoot":"","sources":["../src/context-view.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;AAEhE,sCAAsC;AACtC,mCAAoC;AACpC,+BAA+B;AAU/B,6DAAuD;AACvD,mDAA2E;AAC3E,MAAM,KAAK,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,gBAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AACH,MAAa,WAAyB,SAAQ,qBAAY;IAMxD,YACqB,OAAgB,EACnB,MAAqB;QAErC,KAAK,EAAE,CAAC;QAHW,YAAO,GAAP,OAAO,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AC;AAChC,CAAC;AARD,4CAQC"}
package/dist/context.d.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import { ValueOrPromise } from '.';
4
3
  import { Binding, BindingTag } from './binding';
5
4
  import { BindingFilter } from './binding-filter';
6
5
  import { BindingAddress } from './binding-key';
7
- import { ContextView } from './context-view';
8
6
  import { ContextEventObserver, ContextEventType, ContextObserver, Subscription } from './context-observer';
9
- import { ResolutionOptions, ResolutionSession } from './resolution-session';
10
- import { BoundValue } from './value-promise';
7
+ import { ContextView } from './context-view';
8
+ import { ResolutionOptions, ResolutionOptionsOrSession, ResolutionSession } from './resolution-session';
9
+ import { BoundValue, ValueOrPromise } from './value-promise';
11
10
  /**
12
11
  * Context provides an implementation of Inversion of Control (IoC) container
13
12
  */
@@ -242,9 +241,11 @@ export declare class Context extends EventEmitter {
242
241
  *
243
242
  * @param keyWithPath The binding key, optionally suffixed with a path to the
244
243
  * (deeply) nested property to retrieve.
244
+ * @param session Optional session for resolution (accepted for backward
245
+ * compatibility)
245
246
  * @returns A promise of the bound value.
246
247
  */
247
- get<ValueType>(keyWithPath: BindingAddress<ValueType>): Promise<ValueType>;
248
+ get<ValueType>(keyWithPath: BindingAddress<ValueType>, session?: ResolutionSession): Promise<ValueType>;
248
249
  /**
249
250
  * Get the value bound to the given key, optionally return a (deep) property
250
251
  * of the bound value.
@@ -261,12 +262,11 @@ export declare class Context extends EventEmitter {
261
262
  *
262
263
  * @param keyWithPath The binding key, optionally suffixed with a path to the
263
264
  * (deeply) nested property to retrieve.
264
- * @param optionsOrSession Options or session for resolution. An instance of
265
- * `ResolutionSession` is accepted for backward compatibility.
265
+ * @param options Options for resolution.
266
266
  * @returns A promise of the bound value, or a promise of undefined when
267
267
  * the optional binding is not found.
268
268
  */
269
- get<ValueType>(keyWithPath: BindingAddress<ValueType>, optionsOrSession?: ResolutionOptions | ResolutionSession): Promise<ValueType | undefined>;
269
+ get<ValueType>(keyWithPath: BindingAddress<ValueType>, options: ResolutionOptions): Promise<ValueType | undefined>;
270
270
  /**
271
271
  * Get the synchronous value bound to the given key, optionally
272
272
  * return a (deep) property of the bound value.
@@ -287,11 +287,10 @@ export declare class Context extends EventEmitter {
287
287
  *
288
288
  * @param keyWithPath The binding key, optionally suffixed with a path to the
289
289
  * (deeply) nested property to retrieve.
290
- * * @param optionsOrSession Options or session for resolution. An instance of
291
- * `ResolutionSession` is accepted for backward compatibility.
290
+ * @param session Session for resolution (accepted for backward compatibility)
292
291
  * @returns A promise of the bound value.
293
292
  */
294
- getSync<ValueType>(keyWithPath: BindingAddress<ValueType>): ValueType;
293
+ getSync<ValueType>(keyWithPath: BindingAddress<ValueType>, session?: ResolutionSession): ValueType;
295
294
  /**
296
295
  * Get the synchronous value bound to the given key, optionally
297
296
  * return a (deep) property of the bound value.
@@ -312,11 +311,10 @@ export declare class Context extends EventEmitter {
312
311
  *
313
312
  * @param keyWithPath The binding key, optionally suffixed with a path to the
314
313
  * (deeply) nested property to retrieve.
315
- * * @param optionsOrSession Options or session for resolution. An instance of
316
- * `ResolutionSession` is accepted for backward compatibility.
314
+ * @param options Options for resolution.
317
315
  * @returns The bound value, or undefined when an optional binding is not found.
318
316
  */
319
- getSync<ValueType>(keyWithPath: BindingAddress<ValueType>, optionsOrSession?: ResolutionOptions | ResolutionSession): ValueType | undefined;
317
+ getSync<ValueType>(keyWithPath: BindingAddress<ValueType>, options?: ResolutionOptions): ValueType | undefined;
320
318
  /**
321
319
  * Look up a binding by key in the context and its ancestors. If no matching
322
320
  * binding is found, an error will be thrown.
@@ -337,6 +335,12 @@ export declare class Context extends EventEmitter {
337
335
  getBinding<ValueType>(key: BindingAddress<ValueType>, options?: {
338
336
  optional?: boolean;
339
337
  }): Binding<ValueType> | undefined;
338
+ /**
339
+ * Find or create a binding for the given key
340
+ * @param key Binding address
341
+ * @param policy Binding creation policy
342
+ */
343
+ findOrCreateBinding<T>(key: BindingAddress<T>, policy?: BindingCreationPolicy): Binding<T>;
340
344
  /**
341
345
  * Get the value bound to the given key.
342
346
  *
@@ -364,9 +368,28 @@ export declare class Context extends EventEmitter {
364
368
  * on how the binding is configured.
365
369
  * @internal
366
370
  */
367
- getValueOrPromise<ValueType>(keyWithPath: BindingAddress<ValueType>, optionsOrSession?: ResolutionOptions | ResolutionSession): ValueOrPromise<ValueType | undefined>;
371
+ getValueOrPromise<ValueType>(keyWithPath: BindingAddress<ValueType>, optionsOrSession?: ResolutionOptionsOrSession): ValueOrPromise<ValueType | undefined>;
368
372
  /**
369
373
  * Create a plain JSON object for the context
370
374
  */
371
375
  toJSON(): Object;
372
376
  }
377
+ /**
378
+ * Policy to control if a binding should be created for the context
379
+ */
380
+ export declare enum BindingCreationPolicy {
381
+ /**
382
+ * Always create a binding with the key for the context
383
+ */
384
+ ALWAYS_CREATE = "Always",
385
+ /**
386
+ * Never create a binding for the context. If the key is not bound in the
387
+ * context, throw an error.
388
+ */
389
+ NEVER_CREATE = "Never",
390
+ /**
391
+ * Create a binding if the key is not bound in the context. Otherwise, return
392
+ * the existing binding.
393
+ */
394
+ CREATE_IF_NOT_BOUND = "IfNotBound"
395
+ }