context package
Classes
| Class | Description |
|---|---|
|
Binding represents an entry in the | |
|
Context provides an implementation of Inversion of Control (IoC) container | |
|
Manager for context observer subscriptions | |
|
This class is the key utility to implement dynamic extensions for extension points. For example, the RestServer can react to
| |
|
Resolver for configurations of bindings | |
|
A chain of generic interceptors to be invoked for the given context | |
|
A specialized InvocationContext for interceptors | |
|
A proxy handler that applies interceptors See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy | |
|
InvocationContext represents the context to invoke interceptors for a method. The context can be used to access metadata about the invocation as well as other dependencies. | |
|
Invocation source for injected proxies. It wraps a snapshot of the | |
|
Error for context binding resolutions and dependency injections | |
|
Object to keep states for a session to resolve bindings and their dependencies within a context |
Enumerations
| Enumeration | Description |
|---|---|
|
Policy to control if a binding should be created for the context | |
|
Scope for binding values | |
|
Type of the binding source |
Functions
| Function | Description |
|---|---|
|
Convert binding scope and tags as a template function | |
|
A factory function to create a template function to bind the target class as a class or | |
|
The | |
|
A factory function to create a template function to bind the target class as a | |
|
Normalize ResolutionOptionsOrSession to ResolutionOptions | |
|
Assert the target type inspected from TypeScript for injection to be the expected type. If the types don’t match, an error is thrown. | |
|
| |
|
Get the binding template for a class with binding metadata | |
|
Creates a binding compare function to sort bindings by tagged phase name. | |
|
Compare two values by the predefined order | |
|
Compose a list of interceptors as a single interceptor | |
|
Inject a property from | |
|
Create binding key for configuration of the binding | |
|
Create a binding from a class with decorated metadata. The class is attached to the binding as follows: - | |
|
createProxyWithInterceptors(target, context, session, source) |
Create a proxy that applies interceptors for method invocations |
|
Create a context view as a getter with the given filter | |
|
createViewGetter(ctx, bindingFilter, bindingComparator, session) |
Create a context view as a getter with the given filter and sort matched bindings by the comparator. |
|
Return an array of injection objects for parameters | |
|
Return a map of injection objects for properties | |
|
Create a binding filter from key pattern | |
|
Create a binding filter for the tag pattern | |
|
Get binding metadata for a class | |
|
Get nested properties of an object by path | |
|
| |
|
Check if the given class has | |
|
Create a tag value matcher function that returns | |
|
A decorator to annotate method arguments for automatic injection by LoopBack IoC container. | |
|
Decorate a class with binding configuration | |
|
Inspect injections for a binding created with | |
|
Inspect the target type for the injection to find out the corresponding JavaScript type | |
|
Create an instance of a class which constructor has arguments decorated with The function returns a class when all dependencies were resolved synchronously, or a Promise otherwise. | |
|
Decorator function | |
|
Invoke a chain of interceptors with the context | |
|
Invoke a method using dependency injection. Interceptors are invoked as part of the invocation. | |
|
invokeMethodWithInterceptors(context, target, methodName, args, options) |
Invoke a method with the given context |
|
Type guard for binding address | |
|
Type guard for BindingTagFilter | |
|
Check if the factory is a value factory provider class | |
|
Check whether a value is a Promise-like instance. Recognizes both native promises and third-party promise libraries. | |
|
Check if a class implements | |
|
mergeInterceptors(interceptorsFromSpec, existingInterceptors) |
Adding interceptors from the spec to the front of existing ones. Duplicate entries are eliminated from the spec side. For example:
|
|
Register an interceptor function or provider class to the given context | |
|
A binding template function to delete | |
|
resolveInjectedArguments(target, method, ctx, session, nonInjectedArgs) |
Given a function with arguments decorated with The function returns an argument array when all dependencies were resolved synchronously, or a Promise otherwise. |
|
Given a class with properties decorated with The function returns an argument array when all dependencies were resolved synchronously, or a Promise otherwise. | |
|
Resolve entries of an array into a new array with the same indexes. If one or more entries of the source array are resolved to a promise by the | |
|
Resolve entries of an object into a new object with the same keys. If one or more entries of the source object are resolved to a promise by the | |
|
Resolve an iterator of source values into a result until the evaluator returns | |
|
Sort bindings by phase names denoted by a tag and the predefined order | |
|
Transform a value or promise with a function that produces a new value or promise | |
|
Try to run an action that returns a promise or a value with error and final actions to mimic | |
|
Try to run an action that returns a promise or a value | |
|
A utility to generate uuid v4 |
Interfaces
| Interface | Description |
|---|---|
|
Compare function to sort an array of bindings. It is used by | |
|
Wrapper for bindings tracked by resolution sessions | |
|
A function that filters bindings. It returns | |
|
Options for binding.inspect() | |
|
Binding filter function that holds a binding tag pattern. | |
|
Injection metadata for | |
|
Resolver for configuration of bindings. It’s responsible for finding corresponding configuration for a given binding key. By default, | |
|
Options for context.inspect() | |
|
Observers of context bind/unbind events | |
|
An event emitted by a | |
|
A class with a static | |
|
Metadata for | |
|
Descriptor for an injection point | |
|
Wrapper for injections tracked by resolution sessions | |
|
An object to provide metadata for | |
|
Interceptor function to intercept method invocations | |
|
Options for an interceptor binding | |
|
An interface to represent the caller of the invocation | |
|
JSON array | |
|
JSON object | |
|
Event data for observer notifications | |
|
Providers allow developers to compute injected values dynamically, with any dependencies required by the value getter injected automatically from the Context. | |
|
Contextual metadata for resolution | |
|
Options for binding/dependency resolution | |
|
A function to provide resolution of injected values. | |
|
Subscription of context events. It’s modeled after https://github.com/tc39/proposal-observable. | |
|
A function to check if a given tag value is matched for |
Namespaces
| Namespace | Description |
|---|---|
|
Alias namespace It should have the same members as | |
|
Namespace for context bindings | |
|
Namespace for context tags | |
|
A namespace to host shortcuts for |
Variables
| Variable | Description |
|---|---|
|
A symbol that can be used to match binding tags by name regardless of the value. | |
|
Metadata key for binding metadata | |
|
Default namespace for global interceptors | |
|
Metadata key for method-level interceptors | |
|
Metadata key for method-level interceptors | |
|
Default namespace for local interceptors | |
|
A regular expression for testing uuid v4 PATTERN |
Type Aliases
| Type Alias | Description |
|---|---|
|
Binding source for | |
|
The intercepted variant of a function to return | |
|
Create the Promise type for | |
|
The proxy type for | |
|
Information for a binding event | |
|
Event listeners for binding events | |
|
Options to customize the binding created from a class | |
|
Binding metadata from | |
|
An object to configure binding scope and tags | |
|
Select binding(s) by key or a filter function | |
|
Source for the binding, including the type and value | |
|
Specification of parameters for | |
|
Binding tag can be a simple name or name/value pairs | |
|
A function as the template to configure bindings | |
|
Binding source for | |
|
Binding source for | |
|
A class constructor accepting arbitrary arguments. | |
|
Events emitted by a context | |
|
Synchronous listener for context events | |
|
Context event observer type - An instance of | |
|
Context event types. We support | |
|
Listen on | |
|
Binding source for | |
|
An interceptor function to be invoked in a chain for the given context. It serves as the base interface for various types of interceptors, such as method invocation interceptor or request/response processing interceptor. | |
|
Interceptor function or a binding key that resolves a generic interceptor function | |
|
The function injected by | |
|
Interceptor function or binding key that can be used as parameters for | |
|
Array of arguments for a method invocation | |
|
Options to control invocations | |
|
Return value for a method invocation | |
|
JSON primitive types: - string - number - boolean - null | |
|
JSON values - primitive - object - array | |
|
The | |
|
Any type except | |
|
Binding source for | |
|
A function to be executed with the resolution session | |
|
Binding or injection elements tracked by resolution sessions | |
|
Resolution options or session | |
|
The function injected by | |
|
Mapping artifact types to binding key namespaces (prefixes). | |
|
A factory function for | |
|
Representing a value or promise. This type is used to represent results of synchronous/asynchronous resolution of values. Note that we are using PromiseLike instead of native Promise to describe the asynchronous variant. This allows producers of async values to use any Promise implementation (e.g. Bluebird) instead of native Promises provided by JavaScript runtime. |