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

@artus/injection

Package Overview
Dependencies
Maintainers
7
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@artus/injection - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

3

lib/container.d.ts
import { ContainerType, Identifier, InjectableMetadata, InjectableDefinition } from "./types";
export default class Container implements ContainerType {
protected registry: Map<Identifier, InjectableMetadata>;
private registry;
protected name: string;

@@ -11,4 +11,5 @@ constructor(name: string);

protected getValue(md: InjectableMetadata): any;
protected getMetadata(id: Identifier): InjectableMetadata | undefined;
private resolveParams;
private handleProps;
}

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

const errors_1 = require("./errors");
const mapType = Symbol['map_type'];
class Container {

@@ -14,3 +15,3 @@ constructor(name) {

get(id) {
const md = this.registry.get(id);
const md = this.getMetadata(id);
if (!md) {

@@ -23,3 +24,3 @@ throw new errors_1.NotFoundError(id);

var _a;
const md = this.registry.get(id);
const md = this.getMetadata(id);
if (!md) {

@@ -59,2 +60,9 @@ throw new errors_1.NotFoundError(id);

const md = Object.assign(Object.assign({}, options), { id, type, scope, constructorArgs: args, properties: props, initMethod: (_f = initMethodMd === null || initMethodMd === void 0 ? void 0 : initMethodMd.propertyName) !== null && _f !== void 0 ? _f : 'init' });
/**
* compatible with inject type identifier when identifier is string
*/
if (md.id !== type) {
md[mapType] = type;
this.registry.set(type, md);
}
this.registry.set(md.id, md);

@@ -67,3 +75,3 @@ if (md.eager && md.scope !== types_1.ScopeEnum.TRANSIENT) {

getDefinition(id) {
return this.registry.get(id);
return this.getMetadata(id);
}

@@ -84,2 +92,9 @@ getValue(md) {

}
getMetadata(id) {
const md = this.registry.get(id);
if (md && md[mapType]) {
return this.registry.get(md[mapType]);
}
return md;
}
resolveParams(clazz, args) {

@@ -86,0 +101,0 @@ var _a;

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

var _a;
const md = (_a = this.registry.get(id)) !== null && _a !== void 0 ? _a : this.parent.getDefinition(id);
const md = (_a = this.getMetadata(id)) !== null && _a !== void 0 ? _a : this.parent.getDefinition(id);
if (!md) {

@@ -32,3 +32,3 @@ throw new errors_1.NotFoundError(id);

var _a, _b;
const md = (_a = this.registry.get(id)) !== null && _a !== void 0 ? _a : this.parent.getDefinition(id);
const md = (_a = this.getMetadata(id)) !== null && _a !== void 0 ? _a : this.parent.getDefinition(id);
if (!md) {

@@ -35,0 +35,0 @@ throw new errors_1.NotFoundError(id);

{
"name": "@artus/injection",
"version": "0.1.2",
"version": "0.1.3",
"description": "A IoC Implemention for Artus.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib"
],
"scripts": {
"build": "rm -rf lib && tsc",
"build": "tsc -p ./tsconfig.build.json",
"prepublish": "npm run build",
"test": "jest --coverage --config ./jest.config.js"
},
"files":[
"lib"
],
"repository": {

@@ -16,0 +16,0 @@ "type": "git",

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