Socket
Socket
Sign inDemoInstall

egg-aop

Package Overview
Dependencies
3
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.1 to 0.4.2

5

History.md
0.4.2 / 2018-04-19
==================
* fix: inject obejct define by metadata.
0.4.1 / 2018-04-19

@@ -3,0 +8,0 @@ ==================

2

lib/getInstance.d.ts

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

import { IocContext } from 'power-di';
export declare type InstanceSource = 'Context' | 'Application';

@@ -5,2 +6,3 @@ export declare type CreateInstanceHookFunction = (instance: any, app: any, ctx?: any) => any;

export declare const contextTypeSymbol: unique symbol;
export declare function injectInstance(ioc: IocContext, inst: any, app: any, ctx: any): void;
export declare function getInstance<T = any>(clsType: any, app: any, ctx: any): T;

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

exports.contextTypeSymbol = Symbol('contextType');
function injectInstance(ioc, inst, app, ctx) {
ioc.inject(inst, (_globalType, typeCls) => {
return getInstance(typeCls, app, ctx);
});
}
exports.injectInstance = injectInstance;
function getInstance(clsType, app, ctx) {

@@ -49,2 +55,3 @@ let ioc = undefined;

app.iocContext.register(value, clsType);
injectInstance(app.iocContext, value, app, ctx);
}

@@ -77,4 +84,5 @@ value = new Proxy(value, {

ioc.register(value, clsType);
injectInstance(ioc, value, app, ctx);
return value;
}
exports.getInstance = getInstance;

@@ -19,2 +19,8 @@

export function injectInstance(ioc: IocContext, inst: any, app: any, ctx: any) {
ioc.inject(inst, (_globalType, typeCls) => {
return getInstance(typeCls, app, ctx);
});
}
export function getInstance<T = any>(clsType: any, app: any, ctx: any): T {

@@ -59,2 +65,3 @@ let ioc: IocContext = undefined;

app.iocContext.register(value, clsType);
injectInstance(app.iocContext, value, app, ctx);
}

@@ -90,3 +97,4 @@

ioc.register(value, clsType);
injectInstance(ioc, value, app, ctx);
return value;
}

2

package.json
{
"name": "egg-aop",
"version": "0.4.1",
"version": "0.4.2",
"description": "aop for egg.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc