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

koatty_container

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koatty_container - npm Package Compare versions

Comparing version 1.6.16 to 1.7.0

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Changelog

## [1.7.0](https://github.com/koatty/koatty_container/compare/v1.6.16...v1.7.0) (2022-02-18)
### [1.6.16](https://github.com/koatty/koatty_container/compare/v1.6.16-0...v1.6.16) (2021-12-21)

@@ -7,0 +9,0 @@

22

dist/index.d.ts
/*!
* @Author: richen
* @Date: 2021-12-21 19:37:11
* @Date: 2022-02-18 11:55:10
* @License: BSD (3-Clause)

@@ -103,12 +103,2 @@ * @Copyright (c) - <richenlin(at)gmail.com>

/**
* Indicates that an decorated configuration as a property.
*
* @export
* @param {string} identifier configuration key
* @param {string} [type] configuration type
* @returns {PropertyDecorator}
*/
export declare const Config: typeof Value;
/**
* IOC Container

@@ -474,12 +464,2 @@ *

/**
* Indicates that an decorated configuration as a property.
*
* @export
* @param {string} identifier configuration key
* @param {string} [type] configuration type
* @returns {PropertyDecorator}
*/
export declare function Value(key?: string, type?: string): PropertyDecorator;
export { }
/*!
* @Author: richen
* @Date: 2021-12-21 19:37:00
* @Date: 2022-02-18 11:54:58
* @License: BSD (3-Clause)

@@ -50,3 +50,3 @@ * @Copyright (c) - <richenlin(at)gmail.com>

* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-12-21 16:50:52
* @LastEditTime: 2022-02-15 13:47:29
* @License: BSD (3-Clause)

@@ -110,3 +110,3 @@ * @Copyright (c) - <richenlin(at)gmail.com>

for (const n in metadata) {
if (!metadata.hasOwnProperty(n)) {
if (!Object.hasOwnProperty.call(metadata, n)) {
metadata[n] = metadata[n];

@@ -325,74 +325,3 @@ }

/*
* @Author: richen
* @Date: 2020-12-18 10:37:03
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-11-23 10:53:10
* @License: BSD (3-Clause)
* @Copyright (c) - <richenlin(at)gmail.com>
*/
/**
* Indicates that an decorated configuration as a property.
*
* @export
* @param {string} identifier configuration key
* @param {string} [type] configuration type
* @returns {PropertyDecorator}
*/
function Value(key, type) {
return (target, propertyKey) => {
// ###############
// PropertyDecorator is executed before ClassDecorator, resulting in that componentType cannot be obtained here...
// ###############
// const componentType = IOCContainer.getType(target);
// if (componentType === "MIDDLEWARE") {
// throw Error("Value decorator cannot be used in the middleware class. Please use app.config() to get the configuration.");
// }
// identifier = identifier || helper.camelCase(propertyKey, { pascalCase: true });
key = key || propertyKey;
IOCContainer.savePropertyData(TAGGED_ARGS, `${key !== null && key !== void 0 ? key : ""}|${type || "config"}`, target, propertyKey);
};
}
/**
* Indicates that an decorated configuration as a property.
*
* @export
* @param {string} identifier configuration key
* @param {string} [type] configuration type
* @returns {PropertyDecorator}
*/
const Config = Value;
/**
*
*
* @export
* @param {*} target
* @param {*} instance
* @param {Container} container
*/
function injectValue(target, instance, container) {
// const componentType = IOCContainer.getType(target);
// if (componentType === "MIDDLEWARE") {
// throw Error("Value decorator cannot be used in the middleware class. Please use app.config() to get the configuration.");
// }
const app = container.getApp();
if (!app || !app.config) {
return;
}
const metaData = RecursiveGetMetadata(TAGGED_ARGS, target);
// tslint:disable-next-line: forin
for (const metaKey in metaData) {
// logger.Debug(`Register inject ${IOCContainer.getIdentifier(target)} config key: ${metaKey} => value: ${metaData[metaKey]}`);
const propKeys = metaData[metaKey].split("|");
const [propKey, type] = propKeys;
Reflect.defineProperty(instance, metaKey, {
enumerable: true,
configurable: false,
writable: true,
value: app.config(propKey, type)
});
}
}
/**
* @ author: richen

@@ -771,4 +700,2 @@ * @ copyright: Copyright (c) - <richenlin(at)gmail.com>

injectAutowired(target, target.prototype, this);
// inject value
injectValue(target, target.prototype, this);
// inject AOP

@@ -1105,3 +1032,2 @@ injectAOP(target, target.prototype);

exports.BeforeEach = BeforeEach;
exports.Config = Config;
exports.Container = Container;

@@ -1115,5 +1041,4 @@ exports.IOCContainer = IOCContainer;

exports.TAGGED_PROP = TAGGED_PROP;
exports.Value = Value;
exports.getMethodNames = getMethodNames;
exports.getOriginMetadata = getOriginMetadata;
exports.getPropertyNames = getPropertyNames;
{
"name": "koatty_container",
"version": "1.6.16",
"version": "1.7.0",
"description": "IOC Container for Koatty.",

@@ -32,7 +32,2 @@ "scripts": {

},
"keywords": [
"IOC",
"koatty",
"thinkkoa"
],
"engines": {

@@ -89,8 +84,3 @@ "node": ">10.0.0"

"koatty_lib": "^1.x.x"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
{
"name": "koatty_container",
"version": "1.6.16",
"version": "1.7.0",
"description": "IOC Container for Koatty.",

@@ -32,7 +32,2 @@ "scripts": {

},
"keywords": [
"IOC",
"koatty",
"thinkkoa"
],
"engines": {

@@ -89,8 +84,3 @@ "node": ">10.0.0"

"koatty_lib": "^1.x.x"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}

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