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

@appolo/inject

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appolo/inject - npm Package Compare versions

Comparing version 8.0.7 to 8.0.8

31

index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.injectorAware = exports.bootstrapMethod = exports.bootstrapMethodAsync = exports.injectFactoryMethodAsync = exports.customParam = exports.initMethodAsync = exports.customInjectFn = exports.dynamicFactory = exports.injectLazy = exports.override = exports.factory = exports.lazy = exports.alias = exports.aliasFactory = exports.injectValue = exports.injectObjectProperty = exports.injectFactory = exports.injectDictionary = exports.injectArray = exports.initMethod = exports.injectFactoryMethod = exports.injectAlias = exports.injectAliasFactory = exports.inject = exports.singleton = exports.injectParam = exports.define = exports.InjectDefineSymbol = exports.Util = exports.Define = exports.createContainer = exports.Injector = void 0;
exports.injectorAware = exports.bootstrap = exports.bootstrapAsync = exports.factoryMethodAsync = exports.customParam = exports.initAsync = exports.customFn = exports.dynamicFactory = exports.override = exports.lazy = exports.alias = exports.aliasFactory = exports.value = exports.objectProperty = exports.factory = exports.dictionary = exports.array = exports.init = exports.factoryMethod = exports.inject = exports.singleton = exports.define = exports.InjectDefineSymbol = exports.Util = exports.Define = exports.createContainer = exports.Injector = void 0;
exports.default = require('./lib/inject');

@@ -15,28 +15,23 @@ var inject_1 = require("./lib/inject");

Object.defineProperty(exports, "define", { enumerable: true, get: function () { return decorators_1.define; } });
Object.defineProperty(exports, "injectParam", { enumerable: true, get: function () { return decorators_1.injectParam; } });
Object.defineProperty(exports, "singleton", { enumerable: true, get: function () { return decorators_1.singleton; } });
Object.defineProperty(exports, "inject", { enumerable: true, get: function () { return decorators_1.inject; } });
Object.defineProperty(exports, "injectAliasFactory", { enumerable: true, get: function () { return decorators_1.injectAliasFactory; } });
Object.defineProperty(exports, "injectAlias", { enumerable: true, get: function () { return decorators_1.injectAlias; } });
Object.defineProperty(exports, "injectFactoryMethod", { enumerable: true, get: function () { return decorators_1.injectFactoryMethod; } });
Object.defineProperty(exports, "initMethod", { enumerable: true, get: function () { return decorators_1.initMethod; } });
Object.defineProperty(exports, "injectArray", { enumerable: true, get: function () { return decorators_1.injectArray; } });
Object.defineProperty(exports, "injectDictionary", { enumerable: true, get: function () { return decorators_1.injectDictionary; } });
Object.defineProperty(exports, "injectFactory", { enumerable: true, get: function () { return decorators_1.injectFactory; } });
Object.defineProperty(exports, "injectObjectProperty", { enumerable: true, get: function () { return decorators_1.injectObjectProperty; } });
Object.defineProperty(exports, "injectValue", { enumerable: true, get: function () { return decorators_1.injectValue; } });
Object.defineProperty(exports, "factoryMethod", { enumerable: true, get: function () { return decorators_1.factoryMethod; } });
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return decorators_1.init; } });
Object.defineProperty(exports, "array", { enumerable: true, get: function () { return decorators_1.array; } });
Object.defineProperty(exports, "dictionary", { enumerable: true, get: function () { return decorators_1.dictionary; } });
Object.defineProperty(exports, "factory", { enumerable: true, get: function () { return decorators_1.factory; } });
Object.defineProperty(exports, "objectProperty", { enumerable: true, get: function () { return decorators_1.objectProperty; } });
Object.defineProperty(exports, "value", { enumerable: true, get: function () { return decorators_1.value; } });
Object.defineProperty(exports, "aliasFactory", { enumerable: true, get: function () { return decorators_1.aliasFactory; } });
Object.defineProperty(exports, "alias", { enumerable: true, get: function () { return decorators_1.alias; } });
Object.defineProperty(exports, "lazy", { enumerable: true, get: function () { return decorators_1.lazy; } });
Object.defineProperty(exports, "factory", { enumerable: true, get: function () { return decorators_1.factory; } });
Object.defineProperty(exports, "override", { enumerable: true, get: function () { return decorators_1.override; } });
Object.defineProperty(exports, "injectLazy", { enumerable: true, get: function () { return decorators_1.injectLazy; } });
Object.defineProperty(exports, "dynamicFactory", { enumerable: true, get: function () { return decorators_1.dynamicFactory; } });
Object.defineProperty(exports, "customInjectFn", { enumerable: true, get: function () { return decorators_1.customInjectFn; } });
Object.defineProperty(exports, "initMethodAsync", { enumerable: true, get: function () { return decorators_1.initMethodAsync; } });
Object.defineProperty(exports, "customFn", { enumerable: true, get: function () { return decorators_1.customFn; } });
Object.defineProperty(exports, "initAsync", { enumerable: true, get: function () { return decorators_1.initAsync; } });
Object.defineProperty(exports, "customParam", { enumerable: true, get: function () { return decorators_1.customParam; } });
Object.defineProperty(exports, "injectFactoryMethodAsync", { enumerable: true, get: function () { return decorators_1.injectFactoryMethodAsync; } });
Object.defineProperty(exports, "bootstrapMethodAsync", { enumerable: true, get: function () { return decorators_1.bootstrapMethodAsync; } });
Object.defineProperty(exports, "bootstrapMethod", { enumerable: true, get: function () { return decorators_1.bootstrapMethod; } });
Object.defineProperty(exports, "factoryMethodAsync", { enumerable: true, get: function () { return decorators_1.factoryMethodAsync; } });
Object.defineProperty(exports, "bootstrapAsync", { enumerable: true, get: function () { return decorators_1.bootstrapAsync; } });
Object.defineProperty(exports, "bootstrap", { enumerable: true, get: function () { return decorators_1.bootstrap; } });
Object.defineProperty(exports, "injectorAware", { enumerable: true, get: function () { return decorators_1.injectorAware; } });
//# sourceMappingURL=index.js.map

@@ -11,28 +11,23 @@ export default require('./lib/inject');

define,
injectParam,
singleton,
inject,
injectAliasFactory,
injectAlias,
injectFactoryMethod,
initMethod,
injectArray,
injectDictionary,
injectFactory,
injectObjectProperty,
injectValue,
factoryMethod,
init,
array,
dictionary,
factory,
objectProperty,
value,
aliasFactory,
alias,
lazy,
factory,
override,
injectLazy,
dynamicFactory,
customInjectFn,
initMethodAsync,
customFn,
initAsync,
customParam,
injectFactoryMethodAsync,
bootstrapMethodAsync,
bootstrapMethod,
factoryMethodAsync,
bootstrapAsync,
bootstrap,
injectorAware
} from './lib/decorators'
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.injectParam = exports.injectValue = exports.injectObjectProperty = exports.injectFactory = exports.injectDictionary = exports.injectArray = exports.injectAliasFactory = exports.injectAlias = exports.injectFactoryMethodAsync = exports.injectFactoryMethod = exports.customInjectFn = exports.injectLazy = exports.inject = exports.bootstrapMethodAsync = exports.bootstrapMethod = exports.initMethodAsync = exports.initMethod = exports.aliasFactory = exports.alias = exports.customParam = exports.override = exports.lazy = exports.dynamicFactory = exports.factory = exports.injectorAware = exports.singleton = exports.define = exports.InjectParamSymbol = exports.InjectDefineSymbol = exports.InjectDefinitionsSymbol = void 0;
exports.value = exports.objectProperty = exports.dictionary = exports.array = exports.factoryMethodAsync = exports.factoryMethod = exports.customFn = exports.inject = exports.bootstrapAsync = exports.bootstrap = exports.initAsync = exports.init = exports.aliasFactory = exports.alias = exports.customParam = exports.override = exports.lazy = exports.dynamicFactory = exports.factory = exports.injectorAware = exports.singleton = exports.define = exports.InjectParamSymbol = exports.InjectDefineSymbol = exports.InjectDefinitionsSymbol = void 0;
require("reflect-metadata");

@@ -50,8 +50,16 @@ const define_1 = require("./define");

function factory(factory) {
if (factory === false) {
return EmptyFunction;
}
return addDefinitionClass("factory", []);
return function (target, propertyKey, descriptor) {
if (propertyKey) {
injectFactory(factory).apply(this, arguments);
}
else {
addDefinitionClass("factory", []).apply(this, arguments);
singleton().apply(this, arguments);
}
};
}
exports.factory = factory;
function injectFactory(factory) {
return addDefinitionProperty("injectFactory", [util_1.Util.getClassNameOrId(factory)], true);
}
function dynamicFactory(factory) {

@@ -61,9 +69,16 @@ return addDefinitionClass("dynamicFactory", [factory]);

exports.dynamicFactory = dynamicFactory;
function lazy(lazy) {
if (lazy === false) {
return EmptyFunction;
}
return addDefinitionClass("lazy", []);
function lazy(inject) {
return function (target, propertyKey, descriptor) {
if (propertyKey) {
injectLazy(inject).apply(this, arguments);
}
else {
addDefinitionClass("lazy", []).apply(this, arguments);
}
};
}
exports.lazy = lazy;
function injectLazy(inject) {
return addDefinitionProperty("injectLazy", [util_1.Util.getClassNameOrId(inject)], true);
}
function override() {

@@ -77,6 +92,6 @@ return addDefinitionClass("override", []);

exports.customParam = customParam;
function alias(alias) {
function alias(alias, indexBy) {
return function (target, propertyKey, descriptor) {
if (propertyKey) {
injectAlias(alias).apply(this, arguments);
injectAlias(alias, indexBy).apply(this, arguments);
}

@@ -89,6 +104,6 @@ else {

exports.alias = alias;
function aliasFactory(aliasFactory) {
function aliasFactory(aliasFactory, indexBy) {
return function (target, propertyKey, descriptor) {
if (propertyKey) {
injectAliasFactory(aliasFactory).apply(this, arguments);
injectAliasFactory(aliasFactory, indexBy).apply(this, arguments);
}

@@ -101,21 +116,21 @@ else {

exports.aliasFactory = aliasFactory;
function initMethod() {
function init() {
return addDefinitionProperty("initMethod", []);
}
exports.initMethod = initMethod;
function initMethodAsync() {
exports.init = init;
function initAsync() {
return addDefinitionProperty("initMethodAsync", []);
}
exports.initMethodAsync = initMethodAsync;
function bootstrapMethod() {
exports.initAsync = initAsync;
function bootstrap() {
return addDefinitionProperty("bootstrapMethod", []);
}
exports.bootstrapMethod = bootstrapMethod;
function bootstrapMethodAsync() {
exports.bootstrap = bootstrap;
function bootstrapAsync() {
return addDefinitionProperty("bootstrapMethodAsync", []);
}
exports.bootstrapMethodAsync = bootstrapMethodAsync;
exports.bootstrapAsync = bootstrapAsync;
function inject(inject) {
return function (target, propertyKey, descriptor) {
if (!propertyKey) {
if (!propertyKey || typeof descriptor == "number") {
injectParam(inject).apply(this, arguments);

@@ -129,31 +144,25 @@ }

exports.inject = inject;
function injectLazy(inject) {
return addDefinitionProperty("injectLazy", [util_1.Util.getClassNameOrId(inject)], true);
}
exports.injectLazy = injectLazy;
function customInjectFn(fn) {
function customFn(fn) {
return addDefinitionProperty("injectLazyFn", [fn], true);
}
exports.customInjectFn = customInjectFn;
function injectFactoryMethod(factoryMethod) {
exports.customFn = customFn;
function factoryMethod(factoryMethod) {
return addDefinitionProperty("injectFactoryMethod", [util_1.Util.getClassNameOrId(factoryMethod)], true);
}
exports.injectFactoryMethod = injectFactoryMethod;
function injectFactoryMethodAsync(factoryMethod) {
exports.factoryMethod = factoryMethod;
function factoryMethodAsync(factoryMethod) {
return addDefinitionProperty("injectFactoryMethodAsync", [util_1.Util.getClassNameOrId(factoryMethod)], true);
}
exports.injectFactoryMethodAsync = injectFactoryMethodAsync;
exports.factoryMethodAsync = factoryMethodAsync;
function injectAlias(alias, indexBy) {
return addDefinitionProperty("injectAlias", [alias, indexBy], true);
}
exports.injectAlias = injectAlias;
function injectAliasFactory(alias, indexBy) {
return addDefinitionProperty("injectAliasFactory", [alias, indexBy], true);
}
exports.injectAliasFactory = injectAliasFactory;
function injectArray(arr) {
function array(arr) {
return addDefinitionProperty("injectArray", [(arr || []).map(item => ({ ref: util_1.Util.getClassNameOrId(item) }))], true);
}
exports.injectArray = injectArray;
function injectDictionary(dic) {
exports.array = array;
function dictionary(dic) {
let args = Object.keys(dic).map(key => ({

@@ -165,15 +174,11 @@ key: key,

}
exports.injectDictionary = injectDictionary;
function injectFactory(factory) {
return addDefinitionProperty("injectFactory", [util_1.Util.getClassNameOrId(factory)], true);
}
exports.injectFactory = injectFactory;
function injectObjectProperty(object, propertyName) {
exports.dictionary = dictionary;
function objectProperty(object, propertyName) {
return addDefinitionProperty("injectObjectProperty", [util_1.Util.getClassNameOrId(object), propertyName], true);
}
exports.injectObjectProperty = injectObjectProperty;
function injectValue(value) {
exports.objectProperty = objectProperty;
function value(value) {
return addDefinitionProperty("injectValue", [value]);
}
exports.injectValue = injectValue;
exports.value = value;
function injectParam(name) {

@@ -201,3 +206,2 @@ return function (target, propertyKey, index) {

}
exports.injectParam = injectParam;
//# sourceMappingURL=decorators.js.map

@@ -61,9 +61,20 @@ import "reflect-metadata";

export function factory(factory?: boolean): (fn: Function) => void {
if (factory === false) {
return EmptyFunction;
export function factory(factory?: string | Class): (fn: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void {
return function (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) {
if (propertyKey) {
injectFactory(factory).apply(this, arguments)
} else {
addDefinitionClass("factory", []).apply(this, arguments);
singleton().apply(this, arguments)
}
}
return addDefinitionClass("factory", [])
}
function injectFactory(factory?: string | Class): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
return addDefinitionProperty("injectFactory", [Util.getClassNameOrId(factory)], true);
}
export function dynamicFactory(factory?: boolean): (fn: Function) => void {

@@ -73,8 +84,15 @@ return addDefinitionClass("dynamicFactory", [factory])

export function lazy(lazy?: boolean): (fn: Function) => void {
if (lazy === false) {
return EmptyFunction;
export function lazy(inject?: string | Class): (fn: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void {
return function (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) {
if (propertyKey) {
injectLazy(inject).apply(this, arguments)
} else {
addDefinitionClass("lazy", []).apply(this, arguments);
}
}
}
return addDefinitionClass("lazy", [])
function injectLazy(inject?: string | Class): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => any {
return addDefinitionProperty("injectLazy", [Util.getClassNameOrId(inject)], true);
}

@@ -93,7 +111,7 @@

export function alias(alias: string): (fn: Function, propertyKey?: string, descriptor?: PropertyDescriptor) => void {
export function alias(alias: string, indexBy?: string): (fn: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void {
return function (target: any, propertyKey: string, descriptor?: PropertyDescriptor) {
if (propertyKey) {
injectAlias(alias).apply(this, arguments)
injectAlias(alias, indexBy).apply(this, arguments)
} else {

@@ -107,7 +125,7 @@ addDefinitionClass("alias", [alias]).apply(this, arguments);

export function aliasFactory(aliasFactory: string): (fn: Function, propertyKey?: string, descriptor?: PropertyDescriptor) => void {
export function aliasFactory(aliasFactory: string, indexBy?: string): (fn: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void {
return function (target: any, propertyKey: string, descriptor?: PropertyDescriptor) {
if (propertyKey) {
injectAliasFactory(aliasFactory).apply(this, arguments)
injectAliasFactory(aliasFactory, indexBy).apply(this, arguments)
} else {

@@ -121,3 +139,3 @@ addDefinitionClass("aliasFactory", [aliasFactory]).apply(this, arguments)

export function initMethod(): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function init(): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -127,3 +145,3 @@ return addDefinitionProperty("initMethod", []);

export function initMethodAsync(): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function initAsync(): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -133,3 +151,3 @@ return addDefinitionProperty("initMethodAsync", []);

export function bootstrapMethod(): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function bootstrap(): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -139,3 +157,3 @@ return addDefinitionProperty("bootstrapMethod", []);

export function bootstrapMethodAsync(): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function bootstrapAsync(): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -148,3 +166,3 @@ return addDefinitionProperty("bootstrapMethodAsync", []);

return function (target: any, propertyKey: string, descriptor?: PropertyDescriptor) {
if (!propertyKey) {
if (!propertyKey || typeof descriptor == "number") {
injectParam(inject).apply(this, arguments)

@@ -158,7 +176,4 @@ } else {

export function injectLazy(inject?: string | Class): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => any {
return addDefinitionProperty("injectLazy", [Util.getClassNameOrId(inject)], true);
}
export function customInjectFn(fn: Function) {
export function customFn(fn: Function) {

@@ -169,3 +184,3 @@ return addDefinitionProperty("injectLazyFn", [fn], true);

export function injectFactoryMethod(factoryMethod: string | Class): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function factoryMethod(factoryMethod: string | Class): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -175,3 +190,3 @@ return addDefinitionProperty("injectFactoryMethod", [Util.getClassNameOrId(factoryMethod)], true);

export function injectFactoryMethodAsync(factoryMethod: string | Class): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function factoryMethodAsync(factoryMethod: string | Class): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -181,3 +196,3 @@ return addDefinitionProperty("injectFactoryMethodAsync", [Util.getClassNameOrId(factoryMethod)], true);

export function injectAlias(alias: string, indexBy?: string): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
function injectAlias(alias: string, indexBy?: string): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -187,3 +202,3 @@ return addDefinitionProperty("injectAlias", [alias, indexBy], true);

export function injectAliasFactory(alias: string, indexBy?: string): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
function injectAliasFactory(alias: string, indexBy?: string): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -193,3 +208,3 @@ return addDefinitionProperty("injectAliasFactory", [alias, indexBy], true);

export function injectArray(arr: (string | Class)[]): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function array(arr: (string | Class)[]): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -199,3 +214,3 @@ return addDefinitionProperty("injectArray", [(arr || []).map(item => ({ref: Util.getClassNameOrId(item)}))], true);

export function injectDictionary(dic: { [index: string]: (string | Class) }): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function dictionary(dic: { [index: string]: (string | Class) }): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -210,13 +225,9 @@

export function injectFactory(factory?: string | Class): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
return addDefinitionProperty("injectFactory", [Util.getClassNameOrId(factory)], true);
}
export function objectProperty(object: string | Class, propertyName: string): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function injectObjectProperty(object: string | Class, propertyName: string): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
return addDefinitionProperty("injectObjectProperty", [Util.getClassNameOrId(object), propertyName], true);
}
export function injectValue(value: any): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {
export function value(value: any): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => void {

@@ -226,3 +237,3 @@ return addDefinitionProperty("injectValue", [value]);

export function injectParam(name?: string | Class) {
function injectParam(name?: string | Class) {
return function (target: any, propertyKey: string, index: number) {

@@ -229,0 +240,0 @@ let args = [];

@@ -34,3 +34,3 @@ {

"main": "./index.js",
"version": "8.0.7",
"version": "8.0.8",
"license": "MIT",

@@ -37,0 +37,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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