New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tanbo/di

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanbo/di - npm Package Compare versions

Comparing version 0.0.33 to 0.0.34

16

bundles/core/annotations.d.ts
import { Injector } from './injector';
import { Type } from './type';
import { ReflectiveDependency } from '@tanbo/core/reflective-provider';
export interface ClassDecoratorContextCallback {
(paramsTypes: any[], annotations: Annotations, constructor: Type<any>): any[] | void;
}
export interface ClassDecoratorInvokeFn {
(constructor: Type<any>, paramTypes: any[]): void;
}
export interface ClassDecoratorPreset {
invoke: ClassDecoratorInvokeFn;
}
export interface ClassAnnotation {
paramTypes: any[];
decoratorArguments: any[];
contextCallback: ClassDecoratorContextCallback;
invoke?: ClassDecoratorInvokeFn;
contextCallback?: ClassDecoratorContextCallback;
}
export interface ParamDecoratorConfig {
metadataGenerator: () => any;
reflectiveController?: (reflectiveDependency: ReflectiveDependency) => void;
}
export interface ParamAnnotation {
parameterIndex: number;
config: ParamDecoratorConfig;
decoratorArguments: any[];

@@ -36,2 +49,3 @@ }

getParamMetadata(token: any): ParamAnnotation[];
getParamMetadataKeys(): any[];
getPropMetadataKeys(): any[];

@@ -38,0 +52,0 @@ pushPropMetadata(token: any, params: PropertyAnnotation): void;

@@ -28,2 +28,5 @@ export class Annotations {

}
getParamMetadataKeys() {
return Array.from(this.params.keys());
}
getPropMetadataKeys() {

@@ -30,0 +33,0 @@ return Array.from(this.props.keys());

4

bundles/core/decorators.d.ts

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

import { Annotations, ClassDecoratorContextCallback, PropertyDecoratorContextCallback } from './annotations';
export declare function makeParamDecorator(token: any, ...params: any[]): ParameterDecorator;
import { Annotations, ClassDecoratorContextCallback, ParamDecoratorConfig, PropertyDecoratorContextCallback } from './annotations';
export declare function makeParamDecorator(token: any, config: ParamDecoratorConfig, ...params: any[]): ParameterDecorator;
export declare function makePropertyDecorator(token: any, contextCallback: PropertyDecoratorContextCallback): PropertyDecorator;

@@ -4,0 +4,0 @@ export declare function makeMethodDecorator(token: any, ...params: any[]): MethodDecorator;

import { Annotations } from './annotations';
export function makeParamDecorator(token, ...params) {
export function makeParamDecorator(token, config, ...params) {
return function (target, propertyKey, parameterIndex) {

@@ -7,2 +7,3 @@ const annotations = getAnnotations(target);

parameterIndex,
config,
decoratorArguments: params

@@ -9,0 +10,0 @@ });

@@ -9,3 +9,10 @@ import { makeParamDecorator, makePropertyDecorator } from './decorators';

else {
return makeParamDecorator(Inject, new Inject(token));
return makeParamDecorator(Inject, {
metadataGenerator() {
return new Inject(token);
},
reflectiveController(dep) {
dep.injectKey = token instanceof ForwardRef ? token.getRef() : token;
}
});
}

@@ -15,3 +22,10 @@ };

if (!(this instanceof Self)) {
return makeParamDecorator(Self);
return makeParamDecorator(Self, {
metadataGenerator() {
return new Self();
},
reflectiveController(dep) {
dep.visibility = Self;
}
});
}

@@ -21,3 +35,10 @@ };

if (!(this instanceof SkipSelf)) {
return makeParamDecorator(SkipSelf);
return makeParamDecorator(SkipSelf, {
metadataGenerator() {
return new SkipSelf();
},
reflectiveController(dep) {
dep.visibility = SkipSelf;
}
});
}

@@ -27,3 +48,10 @@ };

if (!(this instanceof Optional)) {
return makeParamDecorator(Optional);
return makeParamDecorator(Optional, {
metadataGenerator() {
return new Optional();
},
reflectiveController(dep) {
dep.visibility = Optional;
}
});
}

@@ -30,0 +58,0 @@ };

@@ -67,3 +67,3 @@ import { InjectFlags } from './injector';

if (provider.provide !== provider.useClass) {
cacheFn(provider.provide, instance);
cacheFn(provider.useClass, instance);
}

@@ -70,0 +70,0 @@ return instance;

{
"name": "@tanbo/di",
"version": "0.0.33",
"version": "0.0.34",
"description": "A dependency injection Library",

@@ -5,0 +5,0 @@ "main": "./bundles/public-api.js",

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