@loopback/context 4.0.0-alpha.8 → 4.1.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/LICENSE +25 -0
- package/README.md +116 -0
- package/dist/binding-config.d.ts +40 -0
- package/dist/binding-config.js +33 -0
- package/dist/binding-config.js.map +1 -0
- package/dist/binding-decorator.d.ts +45 -0
- package/dist/binding-decorator.js +118 -0
- package/dist/binding-decorator.js.map +1 -0
- package/dist/binding-filter.d.ts +108 -0
- package/dist/binding-filter.js +162 -0
- package/dist/binding-filter.js.map +1 -0
- package/dist/binding-inspector.d.ts +150 -0
- package/dist/binding-inspector.js +249 -0
- package/dist/binding-inspector.js.map +1 -0
- package/dist/binding-key.d.ts +66 -0
- package/dist/binding-key.js +121 -0
- package/dist/binding-key.js.map +1 -0
- package/dist/binding-sorter.d.ts +71 -0
- package/dist/binding-sorter.js +89 -0
- package/dist/binding-sorter.js.map +1 -0
- package/dist/binding.d.ts +577 -0
- package/dist/binding.js +788 -0
- package/dist/binding.js.map +1 -0
- package/dist/context-event.d.ts +23 -0
- package/dist/context-event.js +7 -0
- package/dist/context-event.js.map +1 -0
- package/dist/context-observer.d.ts +36 -0
- package/dist/context-observer.js +7 -0
- package/dist/context-observer.js.map +1 -0
- package/dist/context-subscription.d.ts +147 -0
- package/dist/context-subscription.js +317 -0
- package/dist/context-subscription.js.map +1 -0
- package/dist/context-tag-indexer.d.ts +42 -0
- package/dist/context-tag-indexer.js +135 -0
- package/dist/context-tag-indexer.js.map +1 -0
- package/dist/context-view.d.ts +209 -0
- package/dist/context-view.js +240 -0
- package/dist/context-view.js.map +1 -0
- package/dist/context.d.ts +513 -0
- package/dist/context.js +717 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/inject-config.d.ts +67 -0
- package/dist/inject-config.js +181 -0
- package/dist/inject-config.js.map +1 -0
- package/dist/inject.d.ts +250 -0
- package/dist/inject.js +535 -0
- package/dist/inject.js.map +1 -0
- package/dist/interception-proxy.d.ts +76 -0
- package/dist/interception-proxy.js +67 -0
- package/dist/interception-proxy.js.map +1 -0
- package/dist/interceptor-chain.d.ts +121 -0
- package/dist/interceptor-chain.js +148 -0
- package/dist/interceptor-chain.js.map +1 -0
- package/dist/interceptor.d.ts +138 -0
- package/dist/interceptor.js +299 -0
- package/dist/interceptor.js.map +1 -0
- package/dist/invocation.d.ts +101 -0
- package/dist/invocation.js +163 -0
- package/dist/invocation.js.map +1 -0
- package/dist/json-types.d.ts +28 -0
- package/{lib/src/provider.js → dist/json-types.js} +3 -3
- package/dist/json-types.js.map +1 -0
- package/dist/keys.d.ts +65 -0
- package/dist/keys.js +74 -0
- package/dist/keys.js.map +1 -0
- package/dist/provider.d.ts +31 -0
- package/{lib6/src → dist}/provider.js +2 -2
- package/dist/provider.js.map +1 -0
- package/dist/resolution-session.d.ts +180 -0
- package/dist/resolution-session.js +274 -0
- package/dist/resolution-session.js.map +1 -0
- package/dist/resolver.d.ts +46 -0
- package/dist/resolver.js +203 -0
- package/dist/resolver.js.map +1 -0
- package/dist/unique-id.d.ts +14 -0
- package/dist/unique-id.js +26 -0
- package/dist/unique-id.js.map +1 -0
- package/dist/value-promise.d.ts +134 -0
- package/dist/value-promise.js +277 -0
- package/dist/value-promise.js.map +1 -0
- package/package.json +49 -34
- package/src/binding-config.ts +73 -0
- package/src/binding-decorator.ts +136 -0
- package/src/binding-filter.ts +250 -0
- package/src/binding-inspector.ts +371 -0
- package/src/binding-key.ts +136 -0
- package/src/binding-sorter.ts +124 -0
- package/src/binding.ts +1107 -0
- package/src/context-event.ts +30 -0
- package/src/context-observer.ts +50 -0
- package/src/context-subscription.ts +402 -0
- package/src/context-tag-indexer.ts +147 -0
- package/src/context-view.ts +440 -0
- package/src/context.ts +1079 -0
- package/src/index.ts +58 -0
- package/src/inject-config.ts +239 -0
- package/src/inject.ts +796 -0
- package/src/interception-proxy.ts +127 -0
- package/src/interceptor-chain.ts +268 -0
- package/src/interceptor.ts +430 -0
- package/src/invocation.ts +269 -0
- package/src/json-types.ts +35 -0
- package/src/keys.ts +85 -0
- package/src/provider.ts +37 -0
- package/src/resolution-session.ts +414 -0
- package/src/resolver.ts +282 -0
- package/src/unique-id.ts +24 -0
- package/src/value-promise.ts +318 -0
- package/index.d.ts +0 -6
- package/index.js +0 -9
- package/lib/binding.d.ts +0 -75
- package/lib/binding.js +0 -103
- package/lib/binding.js.map +0 -1
- package/lib/context.d.ts +0 -14
- package/lib/context.js +0 -97
- package/lib/context.js.map +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -12
- package/lib/index.js.map +0 -1
- package/lib/inject.d.ts +0 -46
- package/lib/inject.js +0 -74
- package/lib/inject.js.map +0 -1
- package/lib/isPromise.d.ts +0 -1
- package/lib/isPromise.js +0 -15
- package/lib/isPromise.js.map +0 -1
- package/lib/reflect.d.ts +0 -39
- package/lib/reflect.js +0 -20
- package/lib/reflect.js.map +0 -1
- package/lib/resolver.d.ts +0 -30
- package/lib/resolver.js +0 -129
- package/lib/resolver.js.map +0 -1
- package/lib/src/binding.d.ts +0 -85
- package/lib/src/binding.js +0 -123
- package/lib/src/binding.js.map +0 -1
- package/lib/src/context.d.ts +0 -14
- package/lib/src/context.js +0 -97
- package/lib/src/context.js.map +0 -1
- package/lib/src/index.d.ts +0 -10
- package/lib/src/index.js +0 -27
- package/lib/src/index.js.map +0 -1
- package/lib/src/inject.d.ts +0 -46
- package/lib/src/inject.js +0 -74
- package/lib/src/inject.js.map +0 -1
- package/lib/src/isPromise.d.ts +0 -1
- package/lib/src/isPromise.js +0 -15
- package/lib/src/isPromise.js.map +0 -1
- package/lib/src/provider.d.ts +0 -29
- package/lib/src/provider.js.map +0 -1
- package/lib/src/reflect.d.ts +0 -38
- package/lib/src/reflect.js +0 -143
- package/lib/src/reflect.js.map +0 -1
- package/lib/src/resolver.d.ts +0 -34
- package/lib/src/resolver.js +0 -144
- package/lib/src/resolver.js.map +0 -1
- package/lib6/binding.d.ts +0 -75
- package/lib6/binding.js +0 -103
- package/lib6/binding.js.map +0 -1
- package/lib6/context.d.ts +0 -14
- package/lib6/context.js +0 -97
- package/lib6/context.js.map +0 -1
- package/lib6/index.d.ts +0 -1
- package/lib6/index.js +0 -12
- package/lib6/index.js.map +0 -1
- package/lib6/inject.d.ts +0 -46
- package/lib6/inject.js +0 -74
- package/lib6/inject.js.map +0 -1
- package/lib6/isPromise.d.ts +0 -1
- package/lib6/isPromise.js +0 -15
- package/lib6/isPromise.js.map +0 -1
- package/lib6/reflect.d.ts +0 -39
- package/lib6/reflect.js +0 -20
- package/lib6/reflect.js.map +0 -1
- package/lib6/resolver.d.ts +0 -30
- package/lib6/resolver.js +0 -129
- package/lib6/resolver.js.map +0 -1
- package/lib6/src/binding.d.ts +0 -85
- package/lib6/src/binding.js +0 -133
- package/lib6/src/binding.js.map +0 -1
- package/lib6/src/context.d.ts +0 -14
- package/lib6/src/context.js +0 -97
- package/lib6/src/context.js.map +0 -1
- package/lib6/src/index.d.ts +0 -10
- package/lib6/src/index.js +0 -27
- package/lib6/src/index.js.map +0 -1
- package/lib6/src/inject.d.ts +0 -46
- package/lib6/src/inject.js +0 -74
- package/lib6/src/inject.js.map +0 -1
- package/lib6/src/isPromise.d.ts +0 -1
- package/lib6/src/isPromise.js +0 -15
- package/lib6/src/isPromise.js.map +0 -1
- package/lib6/src/provider.d.ts +0 -29
- package/lib6/src/provider.js.map +0 -1
- package/lib6/src/reflect.d.ts +0 -38
- package/lib6/src/reflect.js +0 -143
- package/lib6/src/reflect.js.map +0 -1
- package/lib6/src/resolver.d.ts +0 -34
- package/lib6/src/resolver.js +0 -154
- package/lib6/src/resolver.js.map +0 -1
package/dist/keys.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ConfigurationResolver } from './binding-config';
|
|
2
|
+
import { BindingKey } from './binding-key';
|
|
3
|
+
/**
|
|
4
|
+
* Namespace for context tags
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace ContextTags {
|
|
7
|
+
const CLASS = "class";
|
|
8
|
+
const PROVIDER = "provider";
|
|
9
|
+
const DYNAMIC_VALUE_PROVIDER = "dynamicValueProvider";
|
|
10
|
+
/**
|
|
11
|
+
* Type of the artifact
|
|
12
|
+
*/
|
|
13
|
+
const TYPE = "type";
|
|
14
|
+
/**
|
|
15
|
+
* Namespace of the artifact
|
|
16
|
+
*/
|
|
17
|
+
const NAMESPACE = "namespace";
|
|
18
|
+
/**
|
|
19
|
+
* Name of the artifact
|
|
20
|
+
*/
|
|
21
|
+
const NAME = "name";
|
|
22
|
+
/**
|
|
23
|
+
* Binding key for the artifact
|
|
24
|
+
*/
|
|
25
|
+
const KEY = "key";
|
|
26
|
+
/**
|
|
27
|
+
* Binding tag to associate a configuration binding with the target binding key
|
|
28
|
+
*/
|
|
29
|
+
const CONFIGURATION_FOR = "configurationFor";
|
|
30
|
+
/**
|
|
31
|
+
* Binding tag for global interceptors
|
|
32
|
+
*/
|
|
33
|
+
const GLOBAL_INTERCEPTOR = "globalInterceptor";
|
|
34
|
+
/**
|
|
35
|
+
* Binding tag for global interceptors to specify sources of invocations that
|
|
36
|
+
* the interceptor should apply. The tag value can be a string or string[], such
|
|
37
|
+
* as `'route'` or `['route', 'proxy']`.
|
|
38
|
+
*/
|
|
39
|
+
const GLOBAL_INTERCEPTOR_SOURCE = "globalInterceptorSource";
|
|
40
|
+
/**
|
|
41
|
+
* Binding tag for group name of global interceptors
|
|
42
|
+
*/
|
|
43
|
+
const GLOBAL_INTERCEPTOR_GROUP = "globalInterceptorGroup";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Default namespace for global interceptors
|
|
47
|
+
*/
|
|
48
|
+
export declare const GLOBAL_INTERCEPTOR_NAMESPACE = "globalInterceptors";
|
|
49
|
+
/**
|
|
50
|
+
* Default namespace for local interceptors
|
|
51
|
+
*/
|
|
52
|
+
export declare const LOCAL_INTERCEPTOR_NAMESPACE = "interceptors";
|
|
53
|
+
/**
|
|
54
|
+
* Namespace for context bindings
|
|
55
|
+
*/
|
|
56
|
+
export declare namespace ContextBindings {
|
|
57
|
+
/**
|
|
58
|
+
* Binding key for ConfigurationResolver
|
|
59
|
+
*/
|
|
60
|
+
const CONFIGURATION_RESOLVER: BindingKey<ConfigurationResolver>;
|
|
61
|
+
/**
|
|
62
|
+
* Binding key for ordered groups of global interceptors
|
|
63
|
+
*/
|
|
64
|
+
const GLOBAL_INTERCEPTOR_ORDERED_GROUPS: BindingKey<string[]>;
|
|
65
|
+
}
|
package/dist/keys.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/context
|
|
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
|
+
exports.ContextBindings = exports.LOCAL_INTERCEPTOR_NAMESPACE = exports.GLOBAL_INTERCEPTOR_NAMESPACE = exports.ContextTags = void 0;
|
|
8
|
+
const binding_key_1 = require("./binding-key");
|
|
9
|
+
/**
|
|
10
|
+
* Namespace for context tags
|
|
11
|
+
*/
|
|
12
|
+
var ContextTags;
|
|
13
|
+
(function (ContextTags) {
|
|
14
|
+
ContextTags.CLASS = 'class';
|
|
15
|
+
ContextTags.PROVIDER = 'provider';
|
|
16
|
+
ContextTags.DYNAMIC_VALUE_PROVIDER = 'dynamicValueProvider';
|
|
17
|
+
/**
|
|
18
|
+
* Type of the artifact
|
|
19
|
+
*/
|
|
20
|
+
ContextTags.TYPE = 'type';
|
|
21
|
+
/**
|
|
22
|
+
* Namespace of the artifact
|
|
23
|
+
*/
|
|
24
|
+
ContextTags.NAMESPACE = 'namespace';
|
|
25
|
+
/**
|
|
26
|
+
* Name of the artifact
|
|
27
|
+
*/
|
|
28
|
+
ContextTags.NAME = 'name';
|
|
29
|
+
/**
|
|
30
|
+
* Binding key for the artifact
|
|
31
|
+
*/
|
|
32
|
+
ContextTags.KEY = 'key';
|
|
33
|
+
/**
|
|
34
|
+
* Binding tag to associate a configuration binding with the target binding key
|
|
35
|
+
*/
|
|
36
|
+
ContextTags.CONFIGURATION_FOR = 'configurationFor';
|
|
37
|
+
/**
|
|
38
|
+
* Binding tag for global interceptors
|
|
39
|
+
*/
|
|
40
|
+
ContextTags.GLOBAL_INTERCEPTOR = 'globalInterceptor';
|
|
41
|
+
/**
|
|
42
|
+
* Binding tag for global interceptors to specify sources of invocations that
|
|
43
|
+
* the interceptor should apply. The tag value can be a string or string[], such
|
|
44
|
+
* as `'route'` or `['route', 'proxy']`.
|
|
45
|
+
*/
|
|
46
|
+
ContextTags.GLOBAL_INTERCEPTOR_SOURCE = 'globalInterceptorSource';
|
|
47
|
+
/**
|
|
48
|
+
* Binding tag for group name of global interceptors
|
|
49
|
+
*/
|
|
50
|
+
ContextTags.GLOBAL_INTERCEPTOR_GROUP = 'globalInterceptorGroup';
|
|
51
|
+
})(ContextTags = exports.ContextTags || (exports.ContextTags = {}));
|
|
52
|
+
/**
|
|
53
|
+
* Default namespace for global interceptors
|
|
54
|
+
*/
|
|
55
|
+
exports.GLOBAL_INTERCEPTOR_NAMESPACE = 'globalInterceptors';
|
|
56
|
+
/**
|
|
57
|
+
* Default namespace for local interceptors
|
|
58
|
+
*/
|
|
59
|
+
exports.LOCAL_INTERCEPTOR_NAMESPACE = 'interceptors';
|
|
60
|
+
/**
|
|
61
|
+
* Namespace for context bindings
|
|
62
|
+
*/
|
|
63
|
+
var ContextBindings;
|
|
64
|
+
(function (ContextBindings) {
|
|
65
|
+
/**
|
|
66
|
+
* Binding key for ConfigurationResolver
|
|
67
|
+
*/
|
|
68
|
+
ContextBindings.CONFIGURATION_RESOLVER = binding_key_1.BindingKey.create(`${binding_key_1.BindingKey.CONFIG_NAMESPACE}.resolver`);
|
|
69
|
+
/**
|
|
70
|
+
* Binding key for ordered groups of global interceptors
|
|
71
|
+
*/
|
|
72
|
+
ContextBindings.GLOBAL_INTERCEPTOR_ORDERED_GROUPS = binding_key_1.BindingKey.create('globalInterceptor.orderedGroups');
|
|
73
|
+
})(ContextBindings = exports.ContextBindings || (exports.ContextBindings = {}));
|
|
74
|
+
//# sourceMappingURL=keys.js.map
|
package/dist/keys.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;AAGhE,+CAAyC;AAEzC;;GAEG;AACH,IAAiB,WAAW,CA2C3B;AA3CD,WAAiB,WAAW;IACb,iBAAK,GAAG,OAAO,CAAC;IAChB,oBAAQ,GAAG,UAAU,CAAC;IACtB,kCAAsB,GAAG,sBAAsB,CAAC;IAE7D;;OAEG;IACU,gBAAI,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACU,qBAAS,GAAG,WAAW,CAAC;IACrC;;OAEG;IACU,gBAAI,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACU,eAAG,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACU,6BAAiB,GAAG,kBAAkB,CAAC;IAEpD;;OAEG;IACU,8BAAkB,GAAG,mBAAmB,CAAC;IAEtD;;;;OAIG;IACU,qCAAyB,GAAG,yBAAyB,CAAC;IAEnE;;OAEG;IACU,oCAAwB,GAAG,wBAAwB,CAAC;AACnE,CAAC,EA3CgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QA2C3B;AAED;;GAEG;AACU,QAAA,4BAA4B,GAAG,oBAAoB,CAAC;AAEjE;;GAEG;AACU,QAAA,2BAA2B,GAAG,cAAc,CAAC;AAE1D;;GAEG;AACH,IAAiB,eAAe,CAe/B;AAfD,WAAiB,eAAe;IAC9B;;OAEG;IACU,sCAAsB,GACjC,wBAAU,CAAC,MAAM,CACf,GAAG,wBAAU,CAAC,gBAAgB,WAAW,CAC1C,CAAC;IAEJ;;OAEG;IACU,iDAAiC,GAAG,wBAAU,CAAC,MAAM,CAChE,iCAAiC,CAClC,CAAC;AACJ,CAAC,EAfgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAe/B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ValueOrPromise } from './value-promise';
|
|
2
|
+
/**
|
|
3
|
+
* Providers allow developers to compute injected values dynamically,
|
|
4
|
+
* with any dependencies required by the value getter injected automatically
|
|
5
|
+
* from the Context.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* export class DateProvider implements Provider<Date> {
|
|
11
|
+
* constructor(@inject('stringDate') private param: String){}
|
|
12
|
+
* value(): Date {
|
|
13
|
+
* return new Date(param);
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* ctx.bind('stringDate').to('2017-01-01')
|
|
18
|
+
* ctx.bind('provider_key').toProvider(DateProvider);
|
|
19
|
+
*
|
|
20
|
+
* const value = ctx.getAsync('provider_key');
|
|
21
|
+
* // value is a Date instance
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface Provider<T> {
|
|
25
|
+
/**
|
|
26
|
+
* @returns The value to inject to dependents.
|
|
27
|
+
* This method can return a promise too, in which case the IoC framework
|
|
28
|
+
* will resolve this promise to obtain the value to inject.
|
|
29
|
+
*/
|
|
30
|
+
value(): ValueOrPromise<T>;
|
|
31
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright IBM Corp.
|
|
3
|
-
// Node module: loopback
|
|
2
|
+
// Copyright IBM Corp. 2017,2018. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/context
|
|
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 });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Binding } from './binding';
|
|
2
|
+
import { BindingSelector } from './binding-filter';
|
|
3
|
+
import { Context } from './context';
|
|
4
|
+
import { Injection, InjectionMetadata } from './inject';
|
|
5
|
+
import { BoundValue, ValueOrPromise } from './value-promise';
|
|
6
|
+
/**
|
|
7
|
+
* A function to be executed with the resolution session
|
|
8
|
+
*/
|
|
9
|
+
export declare type ResolutionAction = (session: ResolutionSession) => ValueOrPromise<BoundValue>;
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper for bindings tracked by resolution sessions
|
|
12
|
+
*/
|
|
13
|
+
export interface BindingElement {
|
|
14
|
+
type: 'binding';
|
|
15
|
+
value: Readonly<Binding>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Wrapper for injections tracked by resolution sessions
|
|
19
|
+
*/
|
|
20
|
+
export interface InjectionElement {
|
|
21
|
+
type: 'injection';
|
|
22
|
+
value: Readonly<Injection>;
|
|
23
|
+
}
|
|
24
|
+
export interface InjectionDescriptor {
|
|
25
|
+
targetName: string;
|
|
26
|
+
bindingSelector: BindingSelector;
|
|
27
|
+
metadata: InjectionMetadata;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Binding or injection elements tracked by resolution sessions
|
|
31
|
+
*/
|
|
32
|
+
export declare type ResolutionElement = BindingElement | InjectionElement;
|
|
33
|
+
/**
|
|
34
|
+
* Object to keep states for a session to resolve bindings and their
|
|
35
|
+
* dependencies within a context
|
|
36
|
+
*/
|
|
37
|
+
export declare class ResolutionSession {
|
|
38
|
+
/**
|
|
39
|
+
* A stack of bindings for the current resolution session. It's used to track
|
|
40
|
+
* the path of dependency resolution and detect circular dependencies.
|
|
41
|
+
*/
|
|
42
|
+
readonly stack: ResolutionElement[];
|
|
43
|
+
/**
|
|
44
|
+
* Fork the current session so that a new one with the same stack can be used
|
|
45
|
+
* in parallel or future resolutions, such as multiple method arguments,
|
|
46
|
+
* multiple properties, or a getter function
|
|
47
|
+
* @param session - The current session
|
|
48
|
+
*/
|
|
49
|
+
static fork(session?: ResolutionSession): ResolutionSession | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Run the given action with the given binding and session
|
|
52
|
+
* @param action - A function to do some work with the resolution session
|
|
53
|
+
* @param binding - The current binding
|
|
54
|
+
* @param session - The current resolution session
|
|
55
|
+
*/
|
|
56
|
+
static runWithBinding(action: ResolutionAction, binding: Readonly<Binding>, session?: ResolutionSession): any;
|
|
57
|
+
/**
|
|
58
|
+
* Run the given action with the given injection and session
|
|
59
|
+
* @param action - A function to do some work with the resolution session
|
|
60
|
+
* @param binding - The current injection
|
|
61
|
+
* @param session - The current resolution session
|
|
62
|
+
*/
|
|
63
|
+
static runWithInjection(action: ResolutionAction, injection: Readonly<Injection>, session?: ResolutionSession): any;
|
|
64
|
+
/**
|
|
65
|
+
* Describe the injection for debugging purpose
|
|
66
|
+
* @param injection - Injection object
|
|
67
|
+
*/
|
|
68
|
+
static describeInjection(injection: Readonly<Injection>): InjectionDescriptor;
|
|
69
|
+
/**
|
|
70
|
+
* Push the injection onto the session
|
|
71
|
+
* @param injection - Injection The current injection
|
|
72
|
+
*/
|
|
73
|
+
pushInjection(injection: Readonly<Injection>): void;
|
|
74
|
+
/**
|
|
75
|
+
* Pop the last injection
|
|
76
|
+
*/
|
|
77
|
+
popInjection(): Readonly<Injection<any>>;
|
|
78
|
+
/**
|
|
79
|
+
* Getter for the current injection
|
|
80
|
+
*/
|
|
81
|
+
get currentInjection(): Readonly<Injection> | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Getter for the current binding
|
|
84
|
+
*/
|
|
85
|
+
get currentBinding(): Readonly<Binding> | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Enter the resolution of the given binding. If
|
|
88
|
+
* @param binding - Binding
|
|
89
|
+
*/
|
|
90
|
+
pushBinding(binding: Readonly<Binding>): void;
|
|
91
|
+
/**
|
|
92
|
+
* Exit the resolution of a binding
|
|
93
|
+
*/
|
|
94
|
+
popBinding(): Readonly<Binding>;
|
|
95
|
+
/**
|
|
96
|
+
* Getter for bindings on the stack
|
|
97
|
+
*/
|
|
98
|
+
get bindingStack(): Readonly<Binding>[];
|
|
99
|
+
/**
|
|
100
|
+
* Getter for injections on the stack
|
|
101
|
+
*/
|
|
102
|
+
get injectionStack(): Readonly<Injection>[];
|
|
103
|
+
/**
|
|
104
|
+
* Get the binding path as `bindingA --> bindingB --> bindingC`.
|
|
105
|
+
*/
|
|
106
|
+
getBindingPath(): string;
|
|
107
|
+
/**
|
|
108
|
+
* Get the injection path as `injectionA --> injectionB --> injectionC`.
|
|
109
|
+
*/
|
|
110
|
+
getInjectionPath(): string;
|
|
111
|
+
/**
|
|
112
|
+
* Get the resolution path including bindings and injections, for example:
|
|
113
|
+
* `bindingA --> @ClassA[0] --> bindingB --> @ClassB.prototype.prop1
|
|
114
|
+
* --> bindingC`.
|
|
115
|
+
*/
|
|
116
|
+
getResolutionPath(): string;
|
|
117
|
+
toString(): string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Options for binding/dependency resolution
|
|
121
|
+
*/
|
|
122
|
+
export interface ResolutionOptions {
|
|
123
|
+
/**
|
|
124
|
+
* A session to track bindings and injections
|
|
125
|
+
*/
|
|
126
|
+
session?: ResolutionSession;
|
|
127
|
+
/**
|
|
128
|
+
* A boolean flag to indicate if the dependency is optional. If it's set to
|
|
129
|
+
* `true` and the binding is not bound in a context, the resolution
|
|
130
|
+
* will return `undefined` instead of throwing an error.
|
|
131
|
+
*/
|
|
132
|
+
optional?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* A boolean flag to control if a proxy should be created to apply
|
|
135
|
+
* interceptors for the resolved value. It's only honored for bindings backed
|
|
136
|
+
* by a class.
|
|
137
|
+
*/
|
|
138
|
+
asProxyWithInterceptors?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Resolution options or session
|
|
142
|
+
*/
|
|
143
|
+
export declare type ResolutionOptionsOrSession = ResolutionOptions | ResolutionSession;
|
|
144
|
+
/**
|
|
145
|
+
* Normalize ResolutionOptionsOrSession to ResolutionOptions
|
|
146
|
+
* @param optionsOrSession - resolution options or session
|
|
147
|
+
*/
|
|
148
|
+
export declare function asResolutionOptions(optionsOrSession?: ResolutionOptionsOrSession): ResolutionOptions;
|
|
149
|
+
/**
|
|
150
|
+
* Contextual metadata for resolution
|
|
151
|
+
*/
|
|
152
|
+
export interface ResolutionContext<T = unknown> {
|
|
153
|
+
/**
|
|
154
|
+
* The context for resolution
|
|
155
|
+
*/
|
|
156
|
+
readonly context: Context;
|
|
157
|
+
/**
|
|
158
|
+
* The binding to be resolved
|
|
159
|
+
*/
|
|
160
|
+
readonly binding: Readonly<Binding<T>>;
|
|
161
|
+
/**
|
|
162
|
+
* The options used for resolution
|
|
163
|
+
*/
|
|
164
|
+
readonly options: ResolutionOptions;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Error for context binding resolutions and dependency injections
|
|
168
|
+
*/
|
|
169
|
+
export declare class ResolutionError extends Error {
|
|
170
|
+
readonly resolutionCtx: Partial<ResolutionContext>;
|
|
171
|
+
constructor(message: string, resolutionCtx: Partial<ResolutionContext>);
|
|
172
|
+
private static buildDetails;
|
|
173
|
+
/**
|
|
174
|
+
* Build the error message for the resolution to include more contextual data
|
|
175
|
+
* @param reason - Cause of the error
|
|
176
|
+
* @param resolutionCtx - Resolution context
|
|
177
|
+
*/
|
|
178
|
+
private static buildMessage;
|
|
179
|
+
private static describeResolutionContext;
|
|
180
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/context
|
|
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
|
+
exports.ResolutionError = exports.asResolutionOptions = exports.ResolutionSession = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const metadata_1 = require("@loopback/metadata");
|
|
10
|
+
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
|
|
11
|
+
const value_promise_1 = require("./value-promise");
|
|
12
|
+
const debugSession = (0, debug_1.default)('loopback:context:resolver:session');
|
|
13
|
+
const getTargetName = metadata_1.DecoratorFactory.getTargetName;
|
|
14
|
+
/**
|
|
15
|
+
* Type guard for binding elements
|
|
16
|
+
* @param element - A resolution element
|
|
17
|
+
*/
|
|
18
|
+
function isBinding(element) {
|
|
19
|
+
return element != null && element.type === 'binding';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Type guard for injection elements
|
|
23
|
+
* @param element - A resolution element
|
|
24
|
+
*/
|
|
25
|
+
function isInjection(element) {
|
|
26
|
+
return element != null && element.type === 'injection';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Object to keep states for a session to resolve bindings and their
|
|
30
|
+
* dependencies within a context
|
|
31
|
+
*/
|
|
32
|
+
class ResolutionSession {
|
|
33
|
+
constructor() {
|
|
34
|
+
/**
|
|
35
|
+
* A stack of bindings for the current resolution session. It's used to track
|
|
36
|
+
* the path of dependency resolution and detect circular dependencies.
|
|
37
|
+
*/
|
|
38
|
+
this.stack = [];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Fork the current session so that a new one with the same stack can be used
|
|
42
|
+
* in parallel or future resolutions, such as multiple method arguments,
|
|
43
|
+
* multiple properties, or a getter function
|
|
44
|
+
* @param session - The current session
|
|
45
|
+
*/
|
|
46
|
+
static fork(session) {
|
|
47
|
+
if (session === undefined)
|
|
48
|
+
return undefined;
|
|
49
|
+
const copy = new ResolutionSession();
|
|
50
|
+
copy.stack.push(...session.stack);
|
|
51
|
+
return copy;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Run the given action with the given binding and session
|
|
55
|
+
* @param action - A function to do some work with the resolution session
|
|
56
|
+
* @param binding - The current binding
|
|
57
|
+
* @param session - The current resolution session
|
|
58
|
+
*/
|
|
59
|
+
static runWithBinding(action, binding, session = new ResolutionSession()) {
|
|
60
|
+
// Start to resolve a binding within the session
|
|
61
|
+
session.pushBinding(binding);
|
|
62
|
+
return (0, value_promise_1.tryWithFinally)(() => action(session), () => session.popBinding());
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Run the given action with the given injection and session
|
|
66
|
+
* @param action - A function to do some work with the resolution session
|
|
67
|
+
* @param binding - The current injection
|
|
68
|
+
* @param session - The current resolution session
|
|
69
|
+
*/
|
|
70
|
+
static runWithInjection(action, injection, session = new ResolutionSession()) {
|
|
71
|
+
session.pushInjection(injection);
|
|
72
|
+
return (0, value_promise_1.tryWithFinally)(() => action(session), () => session.popInjection());
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Describe the injection for debugging purpose
|
|
76
|
+
* @param injection - Injection object
|
|
77
|
+
*/
|
|
78
|
+
static describeInjection(injection) {
|
|
79
|
+
const name = getTargetName(injection.target, injection.member, injection.methodDescriptorOrParameterIndex);
|
|
80
|
+
return {
|
|
81
|
+
targetName: name,
|
|
82
|
+
bindingSelector: injection.bindingSelector,
|
|
83
|
+
metadata: injection.metadata,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Push the injection onto the session
|
|
88
|
+
* @param injection - Injection The current injection
|
|
89
|
+
*/
|
|
90
|
+
pushInjection(injection) {
|
|
91
|
+
/* istanbul ignore if */
|
|
92
|
+
if (debugSession.enabled) {
|
|
93
|
+
debugSession('Enter injection:', ResolutionSession.describeInjection(injection));
|
|
94
|
+
}
|
|
95
|
+
this.stack.push({ type: 'injection', value: injection });
|
|
96
|
+
/* istanbul ignore if */
|
|
97
|
+
if (debugSession.enabled) {
|
|
98
|
+
debugSession('Resolution path:', this.getResolutionPath());
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Pop the last injection
|
|
103
|
+
*/
|
|
104
|
+
popInjection() {
|
|
105
|
+
const top = this.stack.pop();
|
|
106
|
+
if (!isInjection(top)) {
|
|
107
|
+
throw new Error('The top element must be an injection');
|
|
108
|
+
}
|
|
109
|
+
const injection = top.value;
|
|
110
|
+
/* istanbul ignore if */
|
|
111
|
+
if (debugSession.enabled) {
|
|
112
|
+
debugSession('Exit injection:', ResolutionSession.describeInjection(injection));
|
|
113
|
+
debugSession('Resolution path:', this.getResolutionPath() || '<empty>');
|
|
114
|
+
}
|
|
115
|
+
return injection;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Getter for the current injection
|
|
119
|
+
*/
|
|
120
|
+
get currentInjection() {
|
|
121
|
+
for (let i = this.stack.length - 1; i >= 0; i--) {
|
|
122
|
+
const element = this.stack[i];
|
|
123
|
+
if (isInjection(element))
|
|
124
|
+
return element.value;
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Getter for the current binding
|
|
130
|
+
*/
|
|
131
|
+
get currentBinding() {
|
|
132
|
+
for (let i = this.stack.length - 1; i >= 0; i--) {
|
|
133
|
+
const element = this.stack[i];
|
|
134
|
+
if (isBinding(element))
|
|
135
|
+
return element.value;
|
|
136
|
+
}
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Enter the resolution of the given binding. If
|
|
141
|
+
* @param binding - Binding
|
|
142
|
+
*/
|
|
143
|
+
pushBinding(binding) {
|
|
144
|
+
/* istanbul ignore if */
|
|
145
|
+
if (debugSession.enabled) {
|
|
146
|
+
debugSession('Enter binding:', binding.toJSON());
|
|
147
|
+
}
|
|
148
|
+
if (this.stack.find(i => isBinding(i) && i.value === binding)) {
|
|
149
|
+
const msg = `Circular dependency detected: ` +
|
|
150
|
+
`${this.getResolutionPath()} --> ${binding.key}`;
|
|
151
|
+
debugSession(msg);
|
|
152
|
+
throw new Error(msg);
|
|
153
|
+
}
|
|
154
|
+
this.stack.push({ type: 'binding', value: binding });
|
|
155
|
+
/* istanbul ignore if */
|
|
156
|
+
if (debugSession.enabled) {
|
|
157
|
+
debugSession('Resolution path:', this.getResolutionPath());
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Exit the resolution of a binding
|
|
162
|
+
*/
|
|
163
|
+
popBinding() {
|
|
164
|
+
const top = this.stack.pop();
|
|
165
|
+
if (!isBinding(top)) {
|
|
166
|
+
throw new Error('The top element must be a binding');
|
|
167
|
+
}
|
|
168
|
+
const binding = top.value;
|
|
169
|
+
/* istanbul ignore if */
|
|
170
|
+
if (debugSession.enabled) {
|
|
171
|
+
debugSession('Exit binding:', binding === null || binding === void 0 ? void 0 : binding.toJSON());
|
|
172
|
+
debugSession('Resolution path:', this.getResolutionPath() || '<empty>');
|
|
173
|
+
}
|
|
174
|
+
return binding;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Getter for bindings on the stack
|
|
178
|
+
*/
|
|
179
|
+
get bindingStack() {
|
|
180
|
+
return this.stack.filter(isBinding).map(e => e.value);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Getter for injections on the stack
|
|
184
|
+
*/
|
|
185
|
+
get injectionStack() {
|
|
186
|
+
return this.stack.filter(isInjection).map(e => e.value);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the binding path as `bindingA --> bindingB --> bindingC`.
|
|
190
|
+
*/
|
|
191
|
+
getBindingPath() {
|
|
192
|
+
return this.stack.filter(isBinding).map(describe).join(' --> ');
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get the injection path as `injectionA --> injectionB --> injectionC`.
|
|
196
|
+
*/
|
|
197
|
+
getInjectionPath() {
|
|
198
|
+
return this.injectionStack
|
|
199
|
+
.map(i => ResolutionSession.describeInjection(i).targetName)
|
|
200
|
+
.join(' --> ');
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get the resolution path including bindings and injections, for example:
|
|
204
|
+
* `bindingA --> @ClassA[0] --> bindingB --> @ClassB.prototype.prop1
|
|
205
|
+
* --> bindingC`.
|
|
206
|
+
*/
|
|
207
|
+
getResolutionPath() {
|
|
208
|
+
return this.stack.map(describe).join(' --> ');
|
|
209
|
+
}
|
|
210
|
+
toString() {
|
|
211
|
+
return this.getResolutionPath();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.ResolutionSession = ResolutionSession;
|
|
215
|
+
function describe(e) {
|
|
216
|
+
switch (e.type) {
|
|
217
|
+
case 'injection':
|
|
218
|
+
return '@' + ResolutionSession.describeInjection(e.value).targetName;
|
|
219
|
+
case 'binding':
|
|
220
|
+
return e.value.key;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Normalize ResolutionOptionsOrSession to ResolutionOptions
|
|
225
|
+
* @param optionsOrSession - resolution options or session
|
|
226
|
+
*/
|
|
227
|
+
function asResolutionOptions(optionsOrSession) {
|
|
228
|
+
// backwards compatibility
|
|
229
|
+
if (optionsOrSession instanceof ResolutionSession) {
|
|
230
|
+
return { session: optionsOrSession };
|
|
231
|
+
}
|
|
232
|
+
return optionsOrSession !== null && optionsOrSession !== void 0 ? optionsOrSession : {};
|
|
233
|
+
}
|
|
234
|
+
exports.asResolutionOptions = asResolutionOptions;
|
|
235
|
+
/**
|
|
236
|
+
* Error for context binding resolutions and dependency injections
|
|
237
|
+
*/
|
|
238
|
+
class ResolutionError extends Error {
|
|
239
|
+
constructor(message, resolutionCtx) {
|
|
240
|
+
super(ResolutionError.buildMessage(message, resolutionCtx));
|
|
241
|
+
this.resolutionCtx = resolutionCtx;
|
|
242
|
+
this.name = ResolutionError.name;
|
|
243
|
+
}
|
|
244
|
+
static buildDetails(resolutionCtx) {
|
|
245
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
246
|
+
return {
|
|
247
|
+
context: (_b = (_a = resolutionCtx.context) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '',
|
|
248
|
+
binding: (_d = (_c = resolutionCtx.binding) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : '',
|
|
249
|
+
resolutionPath: (_g = (_f = (_e = resolutionCtx.options) === null || _e === void 0 ? void 0 : _e.session) === null || _f === void 0 ? void 0 : _f.getResolutionPath()) !== null && _g !== void 0 ? _g : '',
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Build the error message for the resolution to include more contextual data
|
|
254
|
+
* @param reason - Cause of the error
|
|
255
|
+
* @param resolutionCtx - Resolution context
|
|
256
|
+
*/
|
|
257
|
+
static buildMessage(reason, resolutionCtx) {
|
|
258
|
+
const info = this.describeResolutionContext(resolutionCtx);
|
|
259
|
+
const message = `${reason} (${info})`;
|
|
260
|
+
return message;
|
|
261
|
+
}
|
|
262
|
+
static describeResolutionContext(resolutionCtx) {
|
|
263
|
+
const details = ResolutionError.buildDetails(resolutionCtx);
|
|
264
|
+
const items = [];
|
|
265
|
+
for (const [name, val] of Object.entries(details)) {
|
|
266
|
+
if (val !== '') {
|
|
267
|
+
items.push(`${name}: ${val}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return items.join(', ');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.ResolutionError = ResolutionError;
|
|
274
|
+
//# sourceMappingURL=resolution-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolution-session.js","sourceRoot":"","sources":["../src/resolution-session.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+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