Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inversify

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inversify - npm Package Compare versions

Comparing version 3.0.0-beta.1 to 3.0.0-beta.2

amd/annotation/decorator_utils.js

2

dts/annotation/decorator_utils.d.ts

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare function tagParameter(annotationTarget: any, propertyName: string, parameterIndex: number, metadata: interfaces.Metadata): any;

@@ -3,0 +3,0 @@ declare function tagProperty(annotationTarget: any, propertyName: string, metadata: interfaces.Metadata): any;

@@ -1,3 +0,3 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare function inject(serviceIdentifier: interfaces.ServiceIdentifier<any>): (target: any, targetKey: string, index?: number) => any;
export default inject;
export { inject };
declare function injectable(): (target: any) => any;
export default injectable;
export { injectable };

@@ -1,3 +0,3 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare function multiInject(serviceIdentifier: interfaces.ServiceIdentifier<any>): (target: any, targetKey: string, index?: number) => any;
export default multiInject;
export { multiInject };
declare function named(name: string): (target: any, targetKey: string, index?: number) => any;
export default named;
export { named };
declare function tagged(metadataKey: string, metadataValue: any): (target: any, targetKey: string, index?: number) => any;
export default tagged;
export { tagged };
declare function targetName(name: string): (target: any, targetKey: string, index: number) => any;
export default targetName;
export { targetName };
declare function unmanaged(): (target: any, targetKey: string, index: number) => any;
export default unmanaged;
export { unmanaged };

@@ -6,2 +6,2 @@ declare enum BindingCount {

}
export default BindingCount;
export { BindingCount };

@@ -5,2 +5,2 @@ declare enum BindingScope {

}
export default BindingScope;
export { BindingScope };

@@ -11,2 +11,2 @@ declare enum BindingType {

}
export default BindingType;
export { BindingType };

@@ -1,4 +0,4 @@

import interfaces from "../interfaces/interfaces";
import BindingScope from "./binding_scope";
import BindingType from "./binding_type";
import { interfaces } from "../interfaces/interfaces";
import { BindingScope } from "./binding_scope";
import { BindingType } from "./binding_type";
declare class Binding<T> implements interfaces.Binding<T> {

@@ -21,2 +21,2 @@ guid: string;

}
export default Binding;
export { Binding };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class ContainerModule implements interfaces.ContainerModule {

@@ -7,2 +7,2 @@ guid: string;

}
export default ContainerModule;
export { ContainerModule };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class ContainerSnapshot implements interfaces.ContainerSnapshot {

@@ -7,2 +7,2 @@ bindings: interfaces.Lookup<interfaces.Binding<any>>;

}
export default ContainerSnapshot;
export { ContainerSnapshot };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class Container implements interfaces.Container {

@@ -19,2 +19,3 @@ guid: string;

restore(): void;
createChild(): Container;
parent: interfaces.Container;

@@ -28,5 +29,5 @@ applyMiddleware(...middlewares: interfaces.Middleware[]): void;

getAllNamed<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string): T[];
private _get<T>(isMultiInject, targetType, serviceIdentifier, key?, value?);
private _get<T>(avoidConstraints, isMultiInject, targetType, serviceIdentifier, key?, value?);
private _planAndResolve<T>();
}
export default Container;
export { Container };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class Lookup<T extends interfaces.Clonable<T>> implements interfaces.Lookup<T> {

@@ -13,2 +13,2 @@ private _map;

}
export default Lookup;
export { Lookup };

@@ -37,2 +37,3 @@ declare namespace interfaces {

interface NextArgs {
avoidConstraints: boolean;
contextInterceptor?: (contexts: Context) => Context;

@@ -125,2 +126,3 @@ isMultiInject: boolean;

restore(): void;
createChild(): Container;
}

@@ -196,2 +198,2 @@ interface Bind extends Function {

}
export default interfaces;
export { interfaces };

@@ -1,14 +0,14 @@

export { default as Container } from "./container/container";
export { default as ContainerModule } from "./container/container_module";
export { default as injectable } from "./annotation/injectable";
export { default as tagged } from "./annotation/tagged";
export { default as named } from "./annotation/named";
export { default as inject } from "./annotation/inject";
export { default as unmanaged } from "./annotation/unmanaged";
export { default as multiInject } from "./annotation/multi_inject";
export { default as targetName } from "./annotation/target_name";
export { default as guid } from "./utils/guid";
export { default as interfaces } from "./interfaces/interfaces";
export { Container } from "./container/container";
export { ContainerModule } from "./container/container_module";
export { injectable } from "./annotation/injectable";
export { tagged } from "./annotation/tagged";
export { named } from "./annotation/named";
export { inject } from "./annotation/inject";
export { unmanaged } from "./annotation/unmanaged";
export { multiInject } from "./annotation/multi_inject";
export { targetName } from "./annotation/target_name";
export { guid } from "./utils/guid";
export { interfaces } from "./interfaces/interfaces";
export { decorate } from "./annotation/decorator_utils";
export { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint } from "./syntax/constraint_helpers";
export { getServiceIdentifierAsString } from "./utils/serialization";

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class Context implements interfaces.Context {

@@ -9,2 +9,2 @@ guid: string;

}
export default Context;
export { Context };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class Metadata implements interfaces.Metadata {

@@ -8,2 +8,2 @@ key: string;

}
export default Metadata;
export { Metadata };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class Plan implements interfaces.Plan {

@@ -7,2 +7,2 @@ parentContext: interfaces.Context;

}
export default Plan;
export { Plan };

@@ -1,4 +0,4 @@

import interfaces from "../interfaces/interfaces";
import TargetType from "./target_type";
declare function plan(container: interfaces.Container, isMultiInject: boolean, targetType: TargetType, serviceIdentifier: interfaces.ServiceIdentifier<any>, key?: string, value?: any): interfaces.Context;
export default plan;
import { interfaces } from "../interfaces/interfaces";
import { TargetType } from "./target_type";
declare function plan(container: interfaces.Container, isMultiInject: boolean, targetType: TargetType, serviceIdentifier: interfaces.ServiceIdentifier<any>, key?: string, value?: any, avoidConstraints?: boolean): interfaces.Context;
export { plan };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class QueryableString implements interfaces.QueryableString {

@@ -11,2 +11,2 @@ private str;

}
export default QueryableString;
export { QueryableString };

@@ -1,3 +0,3 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare function getDependencies(func: Function): interfaces.Target[];
export default getDependencies;
export { getDependencies };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class Request implements interfaces.Request {

@@ -13,2 +13,2 @@ guid: string;

}
export default Request;
export { Request };

@@ -6,2 +6,2 @@ declare enum TargetType {

}
export default TargetType;
export { TargetType };

@@ -1,4 +0,4 @@

import interfaces from "../interfaces/interfaces";
import Metadata from "../planning/metadata";
import TargetType from "./target_type";
import { interfaces } from "../interfaces/interfaces";
import { Metadata } from "../planning/metadata";
import { TargetType } from "./target_type";
declare class Target implements interfaces.Target {

@@ -21,2 +21,2 @@ guid: string;

}
export default Target;
export { Target };

@@ -1,3 +0,3 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare function resolveInstance(constr: interfaces.Newable<any>, childRequests: interfaces.Request[], resolveRequest: (request: interfaces.Request) => any): any;
export default resolveInstance;
export { resolveInstance };

@@ -1,3 +0,3 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare function resolve<T>(context: interfaces.Context): T;
export default resolve;
export { resolve };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class BindingInSyntax<T> implements interfaces.BindingInSyntax<T> {

@@ -8,2 +8,2 @@ private _binding;

}
export default BindingInSyntax;
export { BindingInSyntax };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class BindingInWhenOnSyntax<T> implements interfaces.BindingInSyntax<T>, interfaces.BindingWhenSyntax<T>, interfaces.BindingOnSyntax<T> {

@@ -27,2 +27,2 @@ private _bindingInSyntax;

}
export default BindingInWhenOnSyntax;
export { BindingInWhenOnSyntax };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class BindingOnSyntax<T> implements interfaces.BindingOnSyntax<T> {

@@ -7,2 +7,2 @@ private _binding;

}
export default BindingOnSyntax;
export { BindingOnSyntax };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class BindingToSyntax<T> implements interfaces.BindingToSyntax<T> {

@@ -17,2 +17,2 @@ private _binding;

}
export default BindingToSyntax;
export { BindingToSyntax };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class BindingWhenOnSyntax<T> implements interfaces.BindingWhenSyntax<T>, interfaces.BindingOnSyntax<T> {

@@ -24,2 +24,2 @@ private _bindingWhenSyntax;

}
export default BindingWhenOnSyntax;
export { BindingWhenOnSyntax };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare class BindingWhenSyntax<T> implements interfaces.BindingWhenSyntax<T> {

@@ -21,2 +21,2 @@ private _binding;

}
export default BindingWhenSyntax;
export { BindingWhenSyntax };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare let traverseAncerstors: (request: interfaces.Request, constraint: interfaces.ConstraintFunction) => boolean;

@@ -3,0 +3,0 @@ declare let taggedConstraint: (key: string) => (value: any) => interfaces.ConstraintFunction;

declare function guid(): string;
export default guid;
export { guid };

@@ -1,2 +0,2 @@

import interfaces from "../interfaces/interfaces";
import { interfaces } from "../interfaces/interfaces";
declare function getServiceIdentifierAsString(serviceIdentifier: interfaces.ServiceIdentifier<any>): string;

@@ -3,0 +3,0 @@ declare function listRegisteredBindingsForServiceIdentifier(container: interfaces.Container, serviceIdentifier: string, getBindings: <T>(container: interfaces.Container, serviceIdentifier: interfaces.ServiceIdentifier<T>) => interfaces.Binding<T>[]): string;

@@ -1,2 +0,2 @@

import Metadata from "../planning/metadata";
import { Metadata } from "../planning/metadata";
import { tagParameter, tagProperty } from "./decorator_utils";

@@ -15,2 +15,2 @@ import * as METADATA_KEY from "../constants/metadata_keys";

}
export default inject;
export { inject };

@@ -13,2 +13,2 @@ import * as METADATA_KEY from "../constants/metadata_keys";

}
export default injectable;
export { injectable };

@@ -1,2 +0,2 @@

import Metadata from "../planning/metadata";
import { Metadata } from "../planning/metadata";
import { tagParameter, tagProperty } from "./decorator_utils";

@@ -15,2 +15,2 @@ import * as METADATA_KEY from "../constants/metadata_keys";

}
export default multiInject;
export { multiInject };

@@ -1,2 +0,2 @@

import Metadata from "../planning/metadata";
import { Metadata } from "../planning/metadata";
import { tagParameter, tagProperty } from "./decorator_utils";

@@ -15,2 +15,2 @@ import * as METADATA_KEY from "../constants/metadata_keys";

}
export default named;
export { named };

@@ -1,2 +0,2 @@

import Metadata from "../planning/metadata";
import { Metadata } from "../planning/metadata";
import { tagParameter, tagProperty } from "./decorator_utils";

@@ -14,2 +14,2 @@ function tagged(metadataKey, metadataValue) {

}
export default tagged;
export { tagged };

@@ -1,2 +0,2 @@

import Metadata from "../planning/metadata";
import { Metadata } from "../planning/metadata";
import { tagParameter } from "./decorator_utils";

@@ -10,2 +10,2 @@ import * as METADATA_KEY from "../constants/metadata_keys";

}
export default targetName;
export { targetName };

@@ -1,2 +0,2 @@

import Metadata from "../planning/metadata";
import { Metadata } from "../planning/metadata";
import { tagParameter } from "./decorator_utils";

@@ -10,2 +10,2 @@ import * as METADATA_KEY from "../constants/metadata_keys";

}
export default unmanaged;
export { unmanaged };

@@ -7,2 +7,2 @@ var BindingCount;

})(BindingCount || (BindingCount = {}));
export default BindingCount;
export { BindingCount };

@@ -6,2 +6,2 @@ var BindingScope;

})(BindingScope || (BindingScope = {}));
export default BindingScope;
export { BindingScope };

@@ -12,2 +12,2 @@ var BindingType;

})(BindingType || (BindingType = {}));
export default BindingType;
export { BindingType };

@@ -1,3 +0,3 @@

import BindingType from "./binding_type";
import guid from "../utils/guid";
import { BindingType } from "./binding_type";
import { guid } from "../utils/guid";
var Binding = (function () {

@@ -33,2 +33,2 @@ function Binding(serviceIdentifier, defaultScope) {

}());
export default Binding;
export { Binding };

@@ -7,3 +7,3 @@ export var DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times.";

export var CANNOT_UNBIND = "Could not unbind serviceIdentifier:";
export var NOT_REGISTERED = "No bindings found for serviceIdentifier:";
export var NOT_REGISTERED = "No matching bindings found for serviceIdentifier:";
export var MISSING_INJECTABLE_ANNOTATION = "Missing required @injectable annotation in:";

@@ -10,0 +10,0 @@ export var MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:";

@@ -1,2 +0,2 @@

import guid from "../utils/guid";
import { guid } from "../utils/guid";
var ContainerModule = (function () {

@@ -9,2 +9,2 @@ function ContainerModule(registry) {

}());
export default ContainerModule;
export { ContainerModule };

@@ -12,2 +12,2 @@ var ContainerSnapshot = (function () {

}());
export default ContainerSnapshot;
export { ContainerSnapshot };

@@ -1,13 +0,13 @@

import Binding from "../bindings/binding";
import BindingScope from "../bindings/binding_scope";
import Lookup from "./lookup";
import plan from "../planning/planner";
import resolve from "../resolution/resolver";
import { Binding } from "../bindings/binding";
import { BindingScope } from "../bindings/binding_scope";
import { Lookup } from "./lookup";
import { plan } from "../planning/planner";
import { resolve } from "../resolution/resolver";
import { BindingToSyntax } from "../syntax/binding_to_syntax";
import { TargetType } from "../planning/target_type";
import { getServiceIdentifierAsString } from "../utils/serialization";
import { ContainerSnapshot } from "./container_snapshot";
import { guid } from "../utils/guid";
import * as ERROR_MSGS from "../constants/error_msgs";
import * as METADATA_KEY from "../constants/metadata_keys";
import BindingToSyntax from "../syntax/binding_to_syntax";
import TargetType from "../planning/target_type";
import { getServiceIdentifierAsString } from "../utils/serialization";
import ContainerSnapshot from "./container_snapshot";
import guid from "../utils/guid";
var Container = (function () {

@@ -120,2 +120,7 @@ function Container(containerOptions) {

};
Container.prototype.createChild = function () {
var child = new Container();
child.parent = this;
return child;
};
Object.defineProperty(Container.prototype, "parent", {

@@ -142,6 +147,6 @@ get: function () {

Container.prototype.get = function (serviceIdentifier) {
return this._get(false, TargetType.Variable, serviceIdentifier);
return this._get(false, false, TargetType.Variable, serviceIdentifier);
};
Container.prototype.getTagged = function (serviceIdentifier, key, value) {
return this._get(false, TargetType.Variable, serviceIdentifier, key, value);
return this._get(false, false, TargetType.Variable, serviceIdentifier, key, value);
};

@@ -152,6 +157,6 @@ Container.prototype.getNamed = function (serviceIdentifier, named) {

Container.prototype.getAll = function (serviceIdentifier) {
return this._get(true, TargetType.Variable, serviceIdentifier);
return this._get(true, true, TargetType.Variable, serviceIdentifier);
};
Container.prototype.getAllTagged = function (serviceIdentifier, key, value) {
return this._get(true, TargetType.Variable, serviceIdentifier, key, value);
return this._get(false, true, TargetType.Variable, serviceIdentifier, key, value);
};

@@ -161,5 +166,6 @@ Container.prototype.getAllNamed = function (serviceIdentifier, named) {

};
Container.prototype._get = function (isMultiInject, targetType, serviceIdentifier, key, value) {
Container.prototype._get = function (avoidConstraints, isMultiInject, targetType, serviceIdentifier, key, value) {
var result = null;
var args = {
avoidConstraints: avoidConstraints,
contextInterceptor: function (context) { return context; },

@@ -186,3 +192,3 @@ isMultiInject: isMultiInject,

return function (args) {
var context = plan(_this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value);
var context = plan(_this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value, args.avoidConstraints);
var result = resolve(args.contextInterceptor(context));

@@ -194,2 +200,2 @@ return result;

}());
export default Container;
export { Container };

@@ -77,2 +77,2 @@ import * as ERROR_MSGS from "../constants/error_msgs";

}());
export default Lookup;
export { Lookup };

@@ -1,13 +0,13 @@

export { default as Container } from "./container/container";
export { default as ContainerModule } from "./container/container_module";
export { default as injectable } from "./annotation/injectable";
export { default as tagged } from "./annotation/tagged";
export { default as named } from "./annotation/named";
export { default as inject } from "./annotation/inject";
export { default as unmanaged } from "./annotation/unmanaged";
export { default as multiInject } from "./annotation/multi_inject";
export { default as targetName } from "./annotation/target_name";
export { default as guid } from "./utils/guid";
export { Container } from "./container/container";
export { ContainerModule } from "./container/container_module";
export { injectable } from "./annotation/injectable";
export { tagged } from "./annotation/tagged";
export { named } from "./annotation/named";
export { inject } from "./annotation/inject";
export { unmanaged } from "./annotation/unmanaged";
export { multiInject } from "./annotation/multi_inject";
export { targetName } from "./annotation/target_name";
export { guid } from "./utils/guid";
export { decorate } from "./annotation/decorator_utils";
export { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint } from "./syntax/constraint_helpers";
export { getServiceIdentifierAsString } from "./utils/serialization";

@@ -1,2 +0,2 @@

import guid from "../utils/guid";
import { guid } from "../utils/guid";
var Context = (function () {

@@ -12,2 +12,2 @@ function Context(container) {

}());
export default Context;
export { Context };

@@ -17,2 +17,2 @@ import * as METADATA_KEY from "../constants/metadata_keys";

}());
export default Metadata;
export { Metadata };

@@ -8,2 +8,2 @@ var Plan = (function () {

}());
export default Plan;
export { Plan };

@@ -1,12 +0,12 @@

import Plan from "./plan";
import Context from "./context";
import Request from "./request";
import Target from "./target";
import { Plan } from "./plan";
import { Context } from "./context";
import { Request } from "./request";
import { Target } from "./target";
import { BindingType } from "../bindings/binding_type";
import { BindingCount } from "../bindings/binding_count";
import { getDependencies } from "./reflection_utils";
import { Metadata } from "../planning/metadata";
import { circularDependencyToException, getServiceIdentifierAsString, listRegisteredBindingsForServiceIdentifier, listMetadataForTarget } from "../utils/serialization";
import * as ERROR_MSGS from "../constants/error_msgs";
import BindingType from "../bindings/binding_type";
import BindingCount from "../bindings/binding_count";
import getDependencies from "./reflection_utils";
import Metadata from "../planning/metadata";
import * as METADATA_KEY from "../constants/metadata_keys";
import { circularDependencyToException, getServiceIdentifierAsString, listRegisteredBindingsForServiceIdentifier, listMetadataForTarget } from "../utils/serialization";
function _createTarget(isMultiInject, targetType, serviceIdentifier, name, key, value) {

@@ -22,6 +22,6 @@ var metadataKey = isMultiInject ? METADATA_KEY.MULTI_INJECT_TAG : METADATA_KEY.INJECT_TAG;

}
function _getActiveBindings(context, parentRequest, target) {
function _getActiveBindings(avoidConstraints, context, parentRequest, target) {
var bindings = getBindings(context.container, target.serviceIdentifier);
var activeBindings = [];
if (bindings.length > 1) {
if (bindings.length > 1 && avoidConstraints === false) {
activeBindings = bindings.filter(function (binding) {

@@ -62,3 +62,3 @@ var request = new Request(binding.serviceIdentifier, context, parentRequest, binding, target);

}
function _createSubRequests(serviceIdentifier, context, parentRequest, target) {
function _createSubRequests(avoidConstraints, serviceIdentifier, context, parentRequest, target) {
try {

@@ -68,3 +68,3 @@ var activeBindings = void 0;

if (parentRequest === null) {
activeBindings = _getActiveBindings(context, null, target);
activeBindings = _getActiveBindings(avoidConstraints, context, null, target);
childRequest_1 = new Request(serviceIdentifier, context, null, activeBindings, target);

@@ -75,3 +75,3 @@ var plan_1 = new Plan(context, childRequest_1);

else {
activeBindings = _getActiveBindings(context, parentRequest, target);
activeBindings = _getActiveBindings(avoidConstraints, context, parentRequest, target);
childRequest_1 = parentRequest.addChildRequest(target.serviceIdentifier, activeBindings, target);

@@ -90,3 +90,3 @@ }

dependencies.forEach(function (dependency) {
_createSubRequests(dependency.serviceIdentifier, context, subChildRequest, dependency);
_createSubRequests(false, dependency.serviceIdentifier, context, subChildRequest, dependency);
});

@@ -116,8 +116,9 @@ }

}
function plan(container, isMultiInject, targetType, serviceIdentifier, key, value) {
function plan(container, isMultiInject, targetType, serviceIdentifier, key, value, avoidConstraints) {
if (avoidConstraints === void 0) { avoidConstraints = false; }
var context = new Context(container);
var target = _createTarget(isMultiInject, targetType, serviceIdentifier, "", key, value);
_createSubRequests(serviceIdentifier, context, null, target);
_createSubRequests(avoidConstraints, serviceIdentifier, context, null, target);
return context;
}
export default plan;
export { plan };

@@ -25,2 +25,2 @@ var QueryableString = (function () {

}());
export default QueryableString;
export { QueryableString };

@@ -1,6 +0,6 @@

import * as METADATA_KEY from "../constants/metadata_keys";
import { getFunctionName } from "../utils/serialization";
import TargetType from "./target_type";
import Target from "./target";
import { TargetType } from "./target_type";
import { Target } from "./target";
import * as ERROR_MSGS from "../constants/error_msgs";
import * as METADATA_KEY from "../constants/metadata_keys";
function getDependencies(func) {

@@ -105,2 +105,2 @@ var constructorName = getFunctionName(func);

}
export default getDependencies;
export { getDependencies };

@@ -1,2 +0,2 @@

import guid from "../utils/guid";
import { guid } from "../utils/guid";
var Request = (function () {

@@ -20,2 +20,2 @@ function Request(serviceIdentifier, parentContext, parentRequest, bindings, target) {

}());
export default Request;
export { Request };

@@ -7,2 +7,2 @@ var TargetType;

})(TargetType || (TargetType = {}));
export default TargetType;
export { TargetType };

@@ -1,5 +0,5 @@

import Metadata from "../planning/metadata";
import QueryableString from "./queryable_string";
import { Metadata } from "../planning/metadata";
import { QueryableString } from "./queryable_string";
import { guid } from "../utils/guid";
import * as METADATA_KEY from "../constants/metadata_keys";
import guid from "../utils/guid";
var Target = (function () {

@@ -85,2 +85,2 @@ function Target(type, name, serviceIdentifier, namedOrTagged) {

}());
export default Target;
export { Target };

@@ -1,2 +0,2 @@

import TargetType from "../planning/target_type";
import { TargetType } from "../planning/target_type";
function _injectProperties(instance, childRequests, resolveRequest) {

@@ -35,2 +35,2 @@ var propertyInjectionsRequests = childRequests.filter(function (childRequest) {

}
export default resolveInstance;
export { resolveInstance };

@@ -1,6 +0,6 @@

import BindingScope from "../bindings/binding_scope";
import BindingType from "../bindings/binding_type";
import { BindingScope } from "../bindings/binding_scope";
import { BindingType } from "../bindings/binding_type";
import { getServiceIdentifierAsString } from "../utils/serialization";
import { resolveInstance } from "./instantiation";
import * as ERROR_MSGS from "../constants/error_msgs";
import { getServiceIdentifierAsString } from "../utils/serialization";
import resolveInstance from "./instantiation";
function _resolveRequest(request) {

@@ -65,2 +65,2 @@ var bindings = request.bindings;

}
export default resolve;
export { resolve };

@@ -1,3 +0,3 @@

import BindingScope from "../bindings/binding_scope";
import BindingWhenOnSyntax from "./binding_when_on_syntax";
import { BindingScope } from "../bindings/binding_scope";
import { BindingWhenOnSyntax } from "./binding_when_on_syntax";
var BindingInSyntax = (function () {

@@ -17,2 +17,2 @@ function BindingInSyntax(binding) {

}());
export default BindingInSyntax;
export { BindingInSyntax };

@@ -1,4 +0,4 @@

import BindingInSyntax from "./binding_in_syntax";
import BindingWhenSyntax from "./binding_when_syntax";
import BindingOnSyntax from "./binding_on_syntax";
import { BindingInSyntax } from "./binding_in_syntax";
import { BindingWhenSyntax } from "./binding_when_syntax";
import { BindingOnSyntax } from "./binding_on_syntax";
var BindingInWhenOnSyntax = (function () {

@@ -67,2 +67,2 @@ function BindingInWhenOnSyntax(binding) {

}());
export default BindingInWhenOnSyntax;
export { BindingInWhenOnSyntax };

@@ -1,2 +0,2 @@

import BindingWhenSyntax from "./binding_when_syntax";
import { BindingWhenSyntax } from "./binding_when_syntax";
var BindingOnSyntax = (function () {

@@ -12,2 +12,2 @@ function BindingOnSyntax(binding) {

}());
export default BindingOnSyntax;
export { BindingOnSyntax };

@@ -1,4 +0,4 @@

import BindingInWhenOnSyntax from "./binding_in_when_on_syntax";
import BindingWhenOnSyntax from "./binding_when_on_syntax";
import BindingType from "../bindings/binding_type";
import { BindingInWhenOnSyntax } from "./binding_in_when_on_syntax";
import { BindingWhenOnSyntax } from "./binding_when_on_syntax";
import { BindingType } from "../bindings/binding_type";
import * as ERROR_MSGS from "../constants/error_msgs";

@@ -66,2 +66,2 @@ var BindingToSyntax = (function () {

}());
export default BindingToSyntax;
export { BindingToSyntax };

@@ -1,3 +0,3 @@

import BindingWhenSyntax from "./binding_when_syntax";
import BindingOnSyntax from "./binding_on_syntax";
import { BindingWhenSyntax } from "./binding_when_syntax";
import { BindingOnSyntax } from "./binding_on_syntax";
var BindingWhenOnSyntax = (function () {

@@ -59,2 +59,2 @@ function BindingWhenOnSyntax(binding) {

}());
export default BindingWhenOnSyntax;
export { BindingWhenOnSyntax };

@@ -1,2 +0,2 @@

import BindingOnSyntax from "./binding_on_syntax";
import { BindingOnSyntax } from "./binding_on_syntax";
import { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint } from "./constraint_helpers";

@@ -94,2 +94,2 @@ var BindingWhenSyntax = (function () {

}());
export default BindingWhenSyntax;
export { BindingWhenSyntax };

@@ -0,3 +1,3 @@

import { Metadata } from "../planning/metadata";
import * as METADATA_KEY from "../constants/metadata_keys";
import Metadata from "../planning/metadata";
var traverseAncerstors = function (request, constraint) {

@@ -4,0 +4,0 @@ var parent = request.parentRequest;

@@ -10,2 +10,2 @@ function guid() {

}
export default guid;
export { guid };

@@ -7,3 +7,3 @@ "use strict";

return function (target, targetKey, index) {
var metadata = new metadata_1.default(METADATA_KEY.INJECT_TAG, serviceIdentifier);
var metadata = new metadata_1.Metadata(METADATA_KEY.INJECT_TAG, serviceIdentifier);
if (typeof index === "number") {

@@ -17,3 +17,2 @@ return decorator_utils_1.tagParameter(target, targetKey, index, metadata);

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = inject;
exports.inject = inject;

@@ -14,3 +14,2 @@ "use strict";

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = injectable;
exports.injectable = injectable;

@@ -7,3 +7,3 @@ "use strict";

return function (target, targetKey, index) {
var metadata = new metadata_1.default(METADATA_KEY.MULTI_INJECT_TAG, serviceIdentifier);
var metadata = new metadata_1.Metadata(METADATA_KEY.MULTI_INJECT_TAG, serviceIdentifier);
if (typeof index === "number") {

@@ -17,3 +17,2 @@ return decorator_utils_1.tagParameter(target, targetKey, index, metadata);

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = multiInject;
exports.multiInject = multiInject;

@@ -7,3 +7,3 @@ "use strict";

return function (target, targetKey, index) {
var metadata = new metadata_1.default(METADATA_KEY.NAMED_TAG, name);
var metadata = new metadata_1.Metadata(METADATA_KEY.NAMED_TAG, name);
if (typeof index === "number") {

@@ -17,3 +17,2 @@ return decorator_utils_1.tagParameter(target, targetKey, index, metadata);

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = named;
exports.named = named;

@@ -6,3 +6,3 @@ "use strict";

return function (target, targetKey, index) {
var metadata = new metadata_1.default(metadataKey, metadataValue);
var metadata = new metadata_1.Metadata(metadataKey, metadataValue);
if (typeof index === "number") {

@@ -16,3 +16,2 @@ return decorator_utils_1.tagParameter(target, targetKey, index, metadata);

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = tagged;
exports.tagged = tagged;

@@ -7,7 +7,6 @@ "use strict";

return function (target, targetKey, index) {
var metadata = new metadata_1.default(METADATA_KEY.NAME_TAG, name);
var metadata = new metadata_1.Metadata(METADATA_KEY.NAME_TAG, name);
return decorator_utils_1.tagParameter(target, targetKey, index, metadata);
};
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = targetName;
exports.targetName = targetName;

@@ -7,7 +7,6 @@ "use strict";

return function (target, targetKey, index) {
var metadata = new metadata_1.default(METADATA_KEY.UNMANAGED_TAG, true);
var metadata = new metadata_1.Metadata(METADATA_KEY.UNMANAGED_TAG, true);
return decorator_utils_1.tagParameter(target, targetKey, index, metadata);
};
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = unmanaged;
exports.unmanaged = unmanaged;

@@ -8,3 +8,2 @@ "use strict";

})(BindingCount || (BindingCount = {}));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingCount;
exports.BindingCount = BindingCount;

@@ -7,3 +7,2 @@ "use strict";

})(BindingScope || (BindingScope = {}));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingScope;
exports.BindingScope = BindingScope;

@@ -13,3 +13,2 @@ "use strict";

})(BindingType || (BindingType = {}));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingType;
exports.BindingType = BindingType;

@@ -6,7 +6,7 @@ "use strict";

function Binding(serviceIdentifier, defaultScope) {
this.guid = guid_1.default();
this.guid = guid_1.guid();
this.activated = false;
this.serviceIdentifier = serviceIdentifier;
this.scope = defaultScope;
this.type = binding_type_1.default.Invalid;
this.type = binding_type_1.BindingType.Invalid;
this.constraint = function (request) { return true; };

@@ -35,3 +35,2 @@ this.implementationType = null;

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Binding;
exports.Binding = Binding;

@@ -8,3 +8,3 @@ "use strict";

exports.CANNOT_UNBIND = "Could not unbind serviceIdentifier:";
exports.NOT_REGISTERED = "No bindings found for serviceIdentifier:";
exports.NOT_REGISTERED = "No matching bindings found for serviceIdentifier:";
exports.MISSING_INJECTABLE_ANNOTATION = "Missing required @injectable annotation in:";

@@ -11,0 +11,0 @@ exports.MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:";

@@ -5,3 +5,3 @@ "use strict";

function ContainerModule(registry) {
this.guid = guid_1.default();
this.guid = guid_1.guid();
this.registry = registry;

@@ -11,3 +11,2 @@ }

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = ContainerModule;
exports.ContainerModule = ContainerModule;

@@ -13,3 +13,2 @@ "use strict";

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = ContainerSnapshot;
exports.ContainerSnapshot = ContainerSnapshot;

@@ -7,4 +7,2 @@ "use strict";

var resolver_1 = require("../resolution/resolver");
var ERROR_MSGS = require("../constants/error_msgs");
var METADATA_KEY = require("../constants/metadata_keys");
var binding_to_syntax_1 = require("../syntax/binding_to_syntax");

@@ -15,2 +13,4 @@ var target_type_1 = require("../planning/target_type");

var guid_1 = require("../utils/guid");
var ERROR_MSGS = require("../constants/error_msgs");
var METADATA_KEY = require("../constants/metadata_keys");
var Container = (function () {

@@ -37,4 +37,4 @@ function Container(containerOptions) {

}
this.guid = guid_1.default();
this._bindingDictionary = new lookup_1.default();
this.guid = guid_1.guid();
this._bindingDictionary = new lookup_1.Lookup();
this._snapshots = [];

@@ -94,6 +94,6 @@ this._middleware = null;

Container.prototype.bind = function (serviceIdentifier) {
var defaultScope = (this.options.defaultScope === "transient") ? binding_scope_1.default.Transient : binding_scope_1.default.Singleton;
var binding = new binding_1.default(serviceIdentifier, defaultScope);
var defaultScope = (this.options.defaultScope === "transient") ? binding_scope_1.BindingScope.Transient : binding_scope_1.BindingScope.Singleton;
var binding = new binding_1.Binding(serviceIdentifier, defaultScope);
this._bindingDictionary.add(serviceIdentifier, binding);
return new binding_to_syntax_1.default(binding);
return new binding_to_syntax_1.BindingToSyntax(binding);
};

@@ -109,3 +109,3 @@ Container.prototype.unbind = function (serviceIdentifier) {

Container.prototype.unbindAll = function () {
this._bindingDictionary = new lookup_1.default();
this._bindingDictionary = new lookup_1.Lookup();
};

@@ -116,3 +116,3 @@ Container.prototype.isBound = function (serviceIdentifier) {

Container.prototype.snapshot = function () {
this._snapshots.push(container_snapshot_1.default.of(this._bindingDictionary.clone(), this._middleware));
this._snapshots.push(container_snapshot_1.ContainerSnapshot.of(this._bindingDictionary.clone(), this._middleware));
};

@@ -127,2 +127,7 @@ Container.prototype.restore = function () {

};
Container.prototype.createChild = function () {
var child = new Container();
child.parent = this;
return child;
};
Object.defineProperty(Container.prototype, "parent", {

@@ -149,6 +154,6 @@ get: function () {

Container.prototype.get = function (serviceIdentifier) {
return this._get(false, target_type_1.default.Variable, serviceIdentifier);
return this._get(false, false, target_type_1.TargetType.Variable, serviceIdentifier);
};
Container.prototype.getTagged = function (serviceIdentifier, key, value) {
return this._get(false, target_type_1.default.Variable, serviceIdentifier, key, value);
return this._get(false, false, target_type_1.TargetType.Variable, serviceIdentifier, key, value);
};

@@ -159,6 +164,6 @@ Container.prototype.getNamed = function (serviceIdentifier, named) {

Container.prototype.getAll = function (serviceIdentifier) {
return this._get(true, target_type_1.default.Variable, serviceIdentifier);
return this._get(true, true, target_type_1.TargetType.Variable, serviceIdentifier);
};
Container.prototype.getAllTagged = function (serviceIdentifier, key, value) {
return this._get(true, target_type_1.default.Variable, serviceIdentifier, key, value);
return this._get(false, true, target_type_1.TargetType.Variable, serviceIdentifier, key, value);
};

@@ -168,5 +173,6 @@ Container.prototype.getAllNamed = function (serviceIdentifier, named) {

};
Container.prototype._get = function (isMultiInject, targetType, serviceIdentifier, key, value) {
Container.prototype._get = function (avoidConstraints, isMultiInject, targetType, serviceIdentifier, key, value) {
var result = null;
var args = {
avoidConstraints: avoidConstraints,
contextInterceptor: function (context) { return context; },

@@ -193,4 +199,4 @@ isMultiInject: isMultiInject,

return function (args) {
var context = planner_1.default(_this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value);
var result = resolver_1.default(args.contextInterceptor(context));
var context = planner_1.plan(_this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value, args.avoidConstraints);
var result = resolver_1.resolve(args.contextInterceptor(context));
return result;

@@ -201,3 +207,2 @@ };

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Container;
exports.Container = Container;

@@ -78,3 +78,2 @@ "use strict";

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Lookup;
exports.Lookup = Lookup;
"use strict";
var container_1 = require("./container/container");
exports.Container = container_1.default;
exports.Container = container_1.Container;
var container_module_1 = require("./container/container_module");
exports.ContainerModule = container_module_1.default;
exports.ContainerModule = container_module_1.ContainerModule;
var injectable_1 = require("./annotation/injectable");
exports.injectable = injectable_1.default;
exports.injectable = injectable_1.injectable;
var tagged_1 = require("./annotation/tagged");
exports.tagged = tagged_1.default;
exports.tagged = tagged_1.tagged;
var named_1 = require("./annotation/named");
exports.named = named_1.default;
exports.named = named_1.named;
var inject_1 = require("./annotation/inject");
exports.inject = inject_1.default;
exports.inject = inject_1.inject;
var unmanaged_1 = require("./annotation/unmanaged");
exports.unmanaged = unmanaged_1.default;
exports.unmanaged = unmanaged_1.unmanaged;
var multi_inject_1 = require("./annotation/multi_inject");
exports.multiInject = multi_inject_1.default;
exports.multiInject = multi_inject_1.multiInject;
var target_name_1 = require("./annotation/target_name");
exports.targetName = target_name_1.default;
exports.targetName = target_name_1.targetName;
var guid_1 = require("./utils/guid");
exports.guid = guid_1.default;
exports.guid = guid_1.guid;
var decorator_utils_1 = require("./annotation/decorator_utils");

@@ -23,0 +23,0 @@ exports.decorate = decorator_utils_1.decorate;

@@ -5,3 +5,3 @@ "use strict";

function Context(container) {
this.guid = guid_1.default();
this.guid = guid_1.guid();
this.container = container;

@@ -14,3 +14,2 @@ }

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Context;
exports.Context = Context;

@@ -18,3 +18,2 @@ "use strict";

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Metadata;
exports.Metadata = Metadata;

@@ -9,3 +9,2 @@ "use strict";

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Plan;
exports.Plan = Plan;

@@ -6,3 +6,2 @@ "use strict";

var target_1 = require("./target");
var ERROR_MSGS = require("../constants/error_msgs");
var binding_type_1 = require("../bindings/binding_type");

@@ -12,10 +11,11 @@ var binding_count_1 = require("../bindings/binding_count");

var metadata_1 = require("../planning/metadata");
var serialization_1 = require("../utils/serialization");
var ERROR_MSGS = require("../constants/error_msgs");
var METADATA_KEY = require("../constants/metadata_keys");
var serialization_1 = require("../utils/serialization");
function _createTarget(isMultiInject, targetType, serviceIdentifier, name, key, value) {
var metadataKey = isMultiInject ? METADATA_KEY.MULTI_INJECT_TAG : METADATA_KEY.INJECT_TAG;
var injectMetadata = new metadata_1.default(metadataKey, serviceIdentifier);
var target = new target_1.default(targetType, name, serviceIdentifier, injectMetadata);
var injectMetadata = new metadata_1.Metadata(metadataKey, serviceIdentifier);
var target = new target_1.Target(targetType, name, serviceIdentifier, injectMetadata);
if (key !== undefined) {
var tagMetadata = new metadata_1.default(key, value);
var tagMetadata = new metadata_1.Metadata(key, value);
target.metadata.push(tagMetadata);

@@ -25,8 +25,8 @@ }

}
function _getActiveBindings(context, parentRequest, target) {
function _getActiveBindings(avoidConstraints, context, parentRequest, target) {
var bindings = getBindings(context.container, target.serviceIdentifier);
var activeBindings = [];
if (bindings.length > 1) {
if (bindings.length > 1 && avoidConstraints === false) {
activeBindings = bindings.filter(function (binding) {
var request = new request_1.default(binding.serviceIdentifier, context, parentRequest, binding, target);
var request = new request_1.Request(binding.serviceIdentifier, context, parentRequest, binding, target);
return binding.constraint(request);

@@ -43,3 +43,3 @@ });

switch (bindings.length) {
case binding_count_1.default.NoBindingsAvailable:
case binding_count_1.BindingCount.NoBindingsAvailable:
var serviceIdentifierString = serialization_1.getServiceIdentifierAsString(serviceIdentifier);

@@ -50,7 +50,7 @@ var msg = ERROR_MSGS.NOT_REGISTERED;

throw new Error(msg);
case binding_count_1.default.OnlyOneBindingAvailable:
case binding_count_1.BindingCount.OnlyOneBindingAvailable:
if (target.isArray() === false) {
return bindings;
}
case binding_count_1.default.MultipleBindingsAvailable:
case binding_count_1.BindingCount.MultipleBindingsAvailable:
default:

@@ -67,3 +67,3 @@ if (target.isArray() === false) {

}
function _createSubRequests(serviceIdentifier, context, parentRequest, target) {
function _createSubRequests(avoidConstraints, serviceIdentifier, context, parentRequest, target) {
try {

@@ -73,9 +73,9 @@ var activeBindings = void 0;

if (parentRequest === null) {
activeBindings = _getActiveBindings(context, null, target);
childRequest_1 = new request_1.default(serviceIdentifier, context, null, activeBindings, target);
var plan_2 = new plan_1.default(context, childRequest_1);
activeBindings = _getActiveBindings(avoidConstraints, context, null, target);
childRequest_1 = new request_1.Request(serviceIdentifier, context, null, activeBindings, target);
var plan_2 = new plan_1.Plan(context, childRequest_1);
context.addPlan(plan_2);
}
else {
activeBindings = _getActiveBindings(context, parentRequest, target);
activeBindings = _getActiveBindings(avoidConstraints, context, parentRequest, target);
childRequest_1 = parentRequest.addChildRequest(target.serviceIdentifier, activeBindings, target);

@@ -91,6 +91,6 @@ }

}
if (binding.type === binding_type_1.default.Instance) {
var dependencies = reflection_utils_1.default(binding.implementationType);
if (binding.type === binding_type_1.BindingType.Instance) {
var dependencies = reflection_utils_1.getDependencies(binding.implementationType);
dependencies.forEach(function (dependency) {
_createSubRequests(dependency.serviceIdentifier, context, subChildRequest, dependency);
_createSubRequests(false, dependency.serviceIdentifier, context, subChildRequest, dependency);
});

@@ -120,9 +120,9 @@ }

}
function plan(container, isMultiInject, targetType, serviceIdentifier, key, value) {
var context = new context_1.default(container);
function plan(container, isMultiInject, targetType, serviceIdentifier, key, value, avoidConstraints) {
if (avoidConstraints === void 0) { avoidConstraints = false; }
var context = new context_1.Context(container);
var target = _createTarget(isMultiInject, targetType, serviceIdentifier, "", key, value);
_createSubRequests(serviceIdentifier, context, null, target);
_createSubRequests(avoidConstraints, serviceIdentifier, context, null, target);
return context;
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = plan;
exports.plan = plan;

@@ -26,3 +26,2 @@ "use strict";

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = QueryableString;
exports.QueryableString = QueryableString;
"use strict";
var METADATA_KEY = require("../constants/metadata_keys");
var serialization_1 = require("../utils/serialization");

@@ -7,2 +6,3 @@ var target_type_1 = require("./target_type");

var ERROR_MSGS = require("../constants/error_msgs");
var METADATA_KEY = require("../constants/metadata_keys");
function getDependencies(func) {

@@ -19,2 +19,3 @@ var constructorName = serialization_1.getFunctionName(func);

}
exports.getDependencies = getDependencies;
function getTargets(func, isBaseClass) {

@@ -47,3 +48,3 @@ var constructorName = serialization_1.getFunctionName(func);

}
var target = new target_1.default(target_type_1.default.ConstructorArgument, metadata.targetName, serviceIndentifier);
var target = new target_1.Target(target_type_1.TargetType.ConstructorArgument, metadata.targetName, serviceIndentifier);
target.metadata = targetMetadata;

@@ -64,3 +65,3 @@ targets.push(target);

var serviceIndentifier = (metadata.inject || metadata.multiInject);
var target = new target_1.default(target_type_1.default.ClassProperty, targetName, serviceIndentifier);
var target = new target_1.Target(target_type_1.TargetType.ClassProperty, targetName, serviceIndentifier);
target.metadata = targetMetadata;

@@ -110,3 +111,1 @@ targets.push(target);

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = getDependencies;

@@ -6,3 +6,3 @@ "use strict";

if (target === void 0) { target = null; }
this.guid = guid_1.default();
this.guid = guid_1.guid();
this.serviceIdentifier = serviceIdentifier;

@@ -22,3 +22,2 @@ this.parentContext = parentContext;

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Request;
exports.Request = Request;

@@ -8,3 +8,2 @@ "use strict";

})(TargetType || (TargetType = {}));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = TargetType;
exports.TargetType = TargetType;
"use strict";
var metadata_1 = require("../planning/metadata");
var queryable_string_1 = require("./queryable_string");
var guid_1 = require("../utils/guid");
var METADATA_KEY = require("../constants/metadata_keys");
var guid_1 = require("../utils/guid");
var Target = (function () {
function Target(type, name, serviceIdentifier, namedOrTagged) {
this.guid = guid_1.default();
this.guid = guid_1.guid();
this.type = type;
this.serviceIdentifier = serviceIdentifier;
this.name = new queryable_string_1.default(name || "");
this.name = new queryable_string_1.QueryableString(name || "");
this.metadata = new Array();
var metadataItem = null;
if (typeof namedOrTagged === "string") {
metadataItem = new metadata_1.default(METADATA_KEY.NAMED_TAG, namedOrTagged);
metadataItem = new metadata_1.Metadata(METADATA_KEY.NAMED_TAG, namedOrTagged);
}
else if (namedOrTagged instanceof metadata_1.default) {
else if (namedOrTagged instanceof metadata_1.Metadata) {
metadataItem = namedOrTagged;

@@ -86,3 +86,2 @@ }

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Target;
exports.Target = Target;

@@ -5,3 +5,3 @@ "use strict";

var propertyInjectionsRequests = childRequests.filter(function (childRequest) {
return childRequest.target.type === target_type_1.default.ClassProperty;
return childRequest.target.type === target_type_1.TargetType.ClassProperty;
});

@@ -24,3 +24,3 @@ var propertyInjections = propertyInjectionsRequests.map(function (childRequest) {

var constructorInjectionsRequests = childRequests.filter(function (childRequest) {
return childRequest.target.type === target_type_1.default.ConstructorArgument;
return childRequest.target.type === target_type_1.TargetType.ConstructorArgument;
});

@@ -38,3 +38,2 @@ var constructorInjections = constructorInjectionsRequests.map(function (childRequest) {

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = resolveInstance;
exports.resolveInstance = resolveInstance;
"use strict";
var binding_scope_1 = require("../bindings/binding_scope");
var binding_type_1 = require("../bindings/binding_type");
var ERROR_MSGS = require("../constants/error_msgs");
var serialization_1 = require("../utils/serialization");
var instantiation_1 = require("./instantiation");
var ERROR_MSGS = require("../constants/error_msgs");
function _resolveRequest(request) {

@@ -22,3 +22,3 @@ var bindings = request.bindings;

var binding = bindings[0];
var isSingleton = binding.scope === binding_scope_1.default.Singleton;
var isSingleton = binding.scope === binding_scope_1.BindingScope.Singleton;
if (isSingleton && binding.activated === true) {

@@ -28,24 +28,24 @@ return binding.cache;

switch (binding.type) {
case binding_type_1.default.ConstantValue:
case binding_type_1.BindingType.ConstantValue:
result = binding.cache;
break;
case binding_type_1.default.DynamicValue:
case binding_type_1.BindingType.DynamicValue:
result = binding.dynamicValue(request.parentContext);
break;
case binding_type_1.default.Constructor:
case binding_type_1.BindingType.Constructor:
result = binding.implementationType;
break;
case binding_type_1.default.Factory:
case binding_type_1.BindingType.Factory:
result = binding.factory(request.parentContext);
break;
case binding_type_1.default.Function:
case binding_type_1.BindingType.Function:
result = binding.cache;
break;
case binding_type_1.default.Provider:
case binding_type_1.BindingType.Provider:
result = binding.provider(request.parentContext);
break;
case binding_type_1.default.Instance:
result = instantiation_1.default(binding.implementationType, childRequests, _resolveRequest);
case binding_type_1.BindingType.Instance:
result = instantiation_1.resolveInstance(binding.implementationType, childRequests, _resolveRequest);
break;
case binding_type_1.default.Invalid:
case binding_type_1.BindingType.Invalid:
default:

@@ -68,3 +68,2 @@ var serviceIdentifier = serialization_1.getServiceIdentifierAsString(request.serviceIdentifier);

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = resolve;
exports.resolve = resolve;

@@ -9,12 +9,11 @@ "use strict";

BindingInSyntax.prototype.inSingletonScope = function () {
this._binding.scope = binding_scope_1.default.Singleton;
return new binding_when_on_syntax_1.default(this._binding);
this._binding.scope = binding_scope_1.BindingScope.Singleton;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingInSyntax.prototype.inTransientScope = function () {
this._binding.scope = binding_scope_1.default.Transient;
return new binding_when_on_syntax_1.default(this._binding);
this._binding.scope = binding_scope_1.BindingScope.Transient;
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
return BindingInSyntax;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingInSyntax;
exports.BindingInSyntax = BindingInSyntax;

@@ -8,5 +8,5 @@ "use strict";

this._binding = binding;
this._bindingWhenSyntax = new binding_when_syntax_1.default(this._binding);
this._bindingOnSyntax = new binding_on_syntax_1.default(this._binding);
this._bindingInSyntax = new binding_in_syntax_1.default(binding);
this._bindingWhenSyntax = new binding_when_syntax_1.BindingWhenSyntax(this._binding);
this._bindingOnSyntax = new binding_on_syntax_1.BindingOnSyntax(this._binding);
this._bindingInSyntax = new binding_in_syntax_1.BindingInSyntax(binding);
}

@@ -69,3 +69,2 @@ BindingInWhenOnSyntax.prototype.inSingletonScope = function () {

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingInWhenOnSyntax;
exports.BindingInWhenOnSyntax = BindingInWhenOnSyntax;

@@ -9,7 +9,6 @@ "use strict";

this._binding.onActivation = handler;
return new binding_when_syntax_1.default(this._binding);
return new binding_when_syntax_1.BindingWhenSyntax(this._binding);
};
return BindingOnSyntax;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingOnSyntax;
exports.BindingOnSyntax = BindingOnSyntax;

@@ -11,5 +11,5 @@ "use strict";

BindingToSyntax.prototype.to = function (constructor) {
this._binding.type = binding_type_1.default.Instance;
this._binding.type = binding_type_1.BindingType.Instance;
this._binding.implementationType = constructor;
return new binding_in_when_on_syntax_1.default(this._binding);
return new binding_in_when_on_syntax_1.BindingInWhenOnSyntax(this._binding);
};

@@ -20,24 +20,24 @@ BindingToSyntax.prototype.toSelf = function () {

BindingToSyntax.prototype.toConstantValue = function (value) {
this._binding.type = binding_type_1.default.ConstantValue;
this._binding.type = binding_type_1.BindingType.ConstantValue;
this._binding.cache = value;
this._binding.dynamicValue = null;
this._binding.implementationType = null;
return new binding_when_on_syntax_1.default(this._binding);
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingToSyntax.prototype.toDynamicValue = function (func) {
this._binding.type = binding_type_1.default.DynamicValue;
this._binding.type = binding_type_1.BindingType.DynamicValue;
this._binding.cache = null;
this._binding.dynamicValue = func;
this._binding.implementationType = null;
return new binding_in_when_on_syntax_1.default(this._binding);
return new binding_in_when_on_syntax_1.BindingInWhenOnSyntax(this._binding);
};
BindingToSyntax.prototype.toConstructor = function (constructor) {
this._binding.type = binding_type_1.default.Constructor;
this._binding.type = binding_type_1.BindingType.Constructor;
this._binding.implementationType = constructor;
return new binding_when_on_syntax_1.default(this._binding);
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingToSyntax.prototype.toFactory = function (factory) {
this._binding.type = binding_type_1.default.Factory;
this._binding.type = binding_type_1.BindingType.Factory;
this._binding.factory = factory;
return new binding_when_on_syntax_1.default(this._binding);
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};

@@ -50,7 +50,7 @@ BindingToSyntax.prototype.toFunction = function (func) {

var bindingWhenOnSyntax = this.toConstantValue(func);
this._binding.type = binding_type_1.default.Function;
this._binding.type = binding_type_1.BindingType.Function;
return bindingWhenOnSyntax;
};
BindingToSyntax.prototype.toAutoFactory = function (serviceIdentifier) {
this._binding.type = binding_type_1.default.Factory;
this._binding.type = binding_type_1.BindingType.Factory;
this._binding.factory = function (context) {

@@ -61,12 +61,11 @@ return function () {

};
return new binding_when_on_syntax_1.default(this._binding);
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
BindingToSyntax.prototype.toProvider = function (provider) {
this._binding.type = binding_type_1.default.Provider;
this._binding.type = binding_type_1.BindingType.Provider;
this._binding.provider = provider;
return new binding_when_on_syntax_1.default(this._binding);
return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding);
};
return BindingToSyntax;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingToSyntax;
exports.BindingToSyntax = BindingToSyntax;

@@ -7,4 +7,4 @@ "use strict";

this._binding = binding;
this._bindingWhenSyntax = new binding_when_syntax_1.default(this._binding);
this._bindingOnSyntax = new binding_on_syntax_1.default(this._binding);
this._bindingWhenSyntax = new binding_when_syntax_1.BindingWhenSyntax(this._binding);
this._bindingOnSyntax = new binding_on_syntax_1.BindingOnSyntax(this._binding);
}

@@ -61,3 +61,2 @@ BindingWhenOnSyntax.prototype.when = function (constraint) {

}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingWhenOnSyntax;
exports.BindingWhenOnSyntax = BindingWhenOnSyntax;

@@ -10,7 +10,7 @@ "use strict";

this._binding.constraint = constraint;
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax.prototype.whenTargetNamed = function (name) {
this._binding.constraint = constraint_helpers_1.namedConstraint(name);
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -22,7 +22,7 @@ BindingWhenSyntax.prototype.whenTargetIsDefault = function () {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
BindingWhenSyntax.prototype.whenTargetTagged = function (tag, value) {
this._binding.constraint = constraint_helpers_1.taggedConstraint(tag)(value);
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -33,3 +33,3 @@ BindingWhenSyntax.prototype.whenInjectedInto = function (parent) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -40,3 +40,3 @@ BindingWhenSyntax.prototype.whenParentNamed = function (name) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -47,3 +47,3 @@ BindingWhenSyntax.prototype.whenParentTagged = function (tag, value) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -54,3 +54,3 @@ BindingWhenSyntax.prototype.whenAnyAncestorIs = function (ancestor) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -61,3 +61,3 @@ BindingWhenSyntax.prototype.whenNoAncestorIs = function (ancestor) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -68,3 +68,3 @@ BindingWhenSyntax.prototype.whenAnyAncestorNamed = function (name) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -75,3 +75,3 @@ BindingWhenSyntax.prototype.whenNoAncestorNamed = function (name) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -82,3 +82,3 @@ BindingWhenSyntax.prototype.whenAnyAncestorTagged = function (tag, value) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -89,3 +89,3 @@ BindingWhenSyntax.prototype.whenNoAncestorTagged = function (tag, value) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -96,3 +96,3 @@ BindingWhenSyntax.prototype.whenAnyAncestorMatches = function (constraint) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};

@@ -103,7 +103,6 @@ BindingWhenSyntax.prototype.whenNoAncestorMatches = function (constraint) {

};
return new binding_on_syntax_1.default(this._binding);
return new binding_on_syntax_1.BindingOnSyntax(this._binding);
};
return BindingWhenSyntax;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BindingWhenSyntax;
exports.BindingWhenSyntax = BindingWhenSyntax;
"use strict";
var metadata_1 = require("../planning/metadata");
var METADATA_KEY = require("../constants/metadata_keys");
var metadata_1 = require("../planning/metadata");
var traverseAncerstors = function (request, constraint) {

@@ -18,3 +18,3 @@ var parent = request.parentRequest;

};
constraint.metaData = new metadata_1.default(key, value);
constraint.metaData = new metadata_1.Metadata(key, value);
return constraint;

@@ -21,0 +21,0 @@ }; };

@@ -11,3 +11,2 @@ "use strict";

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = guid;
exports.guid = guid;
{
"name": "inversify",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"description": "A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.",

@@ -51,3 +51,3 @@ "main": "lib/inversify.js",

"gulp-sourcemaps": "^2.1.1",
"gulp-tslint": "^6.0.1",
"gulp-tslint": "^7.0.0",
"gulp-typescript": "^3.0.0",

@@ -75,3 +75,3 @@ "gulp-uglify": "^2.0.0",

"sinon": "^1.17.3",
"tslint": "^3.12.0",
"tslint": "^4.0.1",
"typescript": "^2.0.2",

@@ -78,0 +78,0 @@ "vinyl-buffer": "^1.0.0",

@@ -85,2 +85,3 @@ # InversifyJS

- [Reflect metadata](https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md)
- [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
- [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) (Only required if using [provider injection](https://github.com/inversify/InversifyJS#injecting-a-provider-asynchronous-factory))

@@ -127,3 +128,3 @@ - [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) (Only required if using [activation handlers](https://github.com/inversify/InversifyJS/blob/master/wiki/activation_handler.md))

export default TYPES;
export { TYPES };

@@ -142,3 +143,3 @@ ```

import "reflect-metadata";
import TYPES from "./types";
import { TYPES } from "./types";

@@ -206,3 +207,3 @@ @injectable()

export default myContainer;
export { myContainer };
```

@@ -216,3 +217,3 @@

```ts
import myContainer from "./inversify.config";
import { myContainer } from "./inversify.config";

@@ -219,0 +220,0 @@ var ninja = myContainer.get<Warrior>(TYPES.Warrior);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc