simple-boot-core
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -1,33 +0,44 @@ | ||
import { ReflectUtils } from '../../utils/reflect/ReflectUtils'; | ||
import { MetaDataPropertyAtomic } from '../MetaDataAtomic'; | ||
import { ObjectUtils } from '../../utils/object/ObjectUtils'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getProtoBefores = exports.getBefores = exports.getBefore = exports.Before = exports.getProtoAfters = exports.getAfters = exports.getAfter = exports.After = void 0; | ||
var ReflectUtils_1 = require("../../utils/reflect/ReflectUtils"); | ||
var MetaDataAtomic_1 = require("../MetaDataAtomic"); | ||
var ObjectUtils_1 = require("../../utils/object/ObjectUtils"); | ||
var AfterMetadataKey = Symbol('After'); | ||
var BeforeMetadataKey = Symbol('Before'); | ||
export var After = function (data) { | ||
return ReflectUtils.metadata(AfterMetadataKey, data); | ||
var After = function (data) { | ||
return ReflectUtils_1.ReflectUtils.metadata(AfterMetadataKey, data); | ||
}; | ||
export var getAfter = function (target, propertyKey) { | ||
return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey); | ||
exports.After = After; | ||
var getAfter = function (target, propertyKey) { | ||
return ReflectUtils_1.ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey); | ||
}; | ||
export var getAfters = function (target) { | ||
return ObjectUtils.getAllProtoTypeName(target) | ||
.map(function (it) { return new MetaDataPropertyAtomic(target, getAfter(target, it), it); }) | ||
exports.getAfter = getAfter; | ||
var getAfters = function (target) { | ||
return ObjectUtils_1.ObjectUtils.getAllProtoTypeName(target) | ||
.map(function (it) { return new MetaDataAtomic_1.MetaDataPropertyAtomic(target, exports.getAfter(target, it), it); }) | ||
.filter(function (it) { return it.metaData !== undefined; }) || []; | ||
}; | ||
export var getProtoAfters = function (target, propertyKey, type) { | ||
return getAfters(target).filter(function (it) { var _a; return propertyKey === it.metaData.property && type === ((_a = it.metaData.type) === null || _a === void 0 ? void 0 : _a.prototype); }) || []; | ||
exports.getAfters = getAfters; | ||
var getProtoAfters = function (target, propertyKey, type) { | ||
return exports.getAfters(target).filter(function (it) { var _a; return propertyKey === it.metaData.property && type === ((_a = it.metaData.type) === null || _a === void 0 ? void 0 : _a.prototype); }) || []; | ||
}; | ||
export var Before = function (data) { | ||
return ReflectUtils.metadata(BeforeMetadataKey, data); | ||
exports.getProtoAfters = getProtoAfters; | ||
var Before = function (data) { | ||
return ReflectUtils_1.ReflectUtils.metadata(BeforeMetadataKey, data); | ||
}; | ||
export var getBefore = function (target, propertyKey) { | ||
return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey); | ||
exports.Before = Before; | ||
var getBefore = function (target, propertyKey) { | ||
return ReflectUtils_1.ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey); | ||
}; | ||
export var getBefores = function (target) { | ||
return ObjectUtils.getAllProtoTypeName(target) | ||
.map(function (it) { return new MetaDataPropertyAtomic(target, getBefore(target, it), it); }) | ||
exports.getBefore = getBefore; | ||
var getBefores = function (target) { | ||
return ObjectUtils_1.ObjectUtils.getAllProtoTypeName(target) | ||
.map(function (it) { return new MetaDataAtomic_1.MetaDataPropertyAtomic(target, exports.getBefore(target, it), it); }) | ||
.filter(function (it) { return it.metaData !== undefined; }) || []; | ||
}; | ||
export var getProtoBefores = function (target, propertyKey, type) { | ||
return getBefores(target).filter(function (it) { var _a; return propertyKey === it.metaData.property && type === ((_a = it.metaData.type) === null || _a === void 0 ? void 0 : _a.prototype); }) || []; | ||
exports.getBefores = getBefores; | ||
var getProtoBefores = function (target, propertyKey, type) { | ||
return exports.getBefores(target).filter(function (it) { var _a; return propertyKey === it.metaData.property && type === ((_a = it.metaData.type) === null || _a === void 0 ? void 0 : _a.prototype); }) || []; | ||
}; | ||
exports.getProtoBefores = getProtoBefores; |
@@ -1,8 +0,13 @@ | ||
import { ReflectUtils } from '../../utils/reflect/ReflectUtils'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getEventListener = exports.EventListener = void 0; | ||
var ReflectUtils_1 = require("../../utils/reflect/ReflectUtils"); | ||
var EventListenerMetadataKey = Symbol('EventListener'); | ||
export var EventListener = function (option) { | ||
return ReflectUtils.metadata(EventListenerMetadataKey, option); | ||
var EventListener = function (option) { | ||
return ReflectUtils_1.ReflectUtils.metadata(EventListenerMetadataKey, option); | ||
}; | ||
export var getEventListener = function (target, propertyKey) { | ||
return ReflectUtils.getMetadata(EventListenerMetadataKey, target, propertyKey); | ||
exports.EventListener = EventListener; | ||
var getEventListener = function (target, propertyKey) { | ||
return ReflectUtils_1.ReflectUtils.getMetadata(EventListenerMetadataKey, target, propertyKey); | ||
}; | ||
exports.getEventListener = getEventListener; |
@@ -1,19 +0,26 @@ | ||
import { ReflectUtils } from '../../utils/reflect/ReflectUtils'; | ||
import { MetaDataPropertyAtomic } from '../MetaDataAtomic'; | ||
import { ObjectUtils } from '../../utils/object/ObjectUtils'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTargetAndIncludeNullAndSortExceptionHandlers = exports.getExceptionHandlers = exports.getExceptionHandler = exports.ExceptionHandler = void 0; | ||
var ReflectUtils_1 = require("../../utils/reflect/ReflectUtils"); | ||
var MetaDataAtomic_1 = require("../MetaDataAtomic"); | ||
var ObjectUtils_1 = require("../../utils/object/ObjectUtils"); | ||
var ExceptionHandlerMetadataKey = Symbol('ExceptionHandler'); | ||
export var ExceptionHandler = function (target) { | ||
return ReflectUtils.metadata(ExceptionHandlerMetadataKey, target !== null && target !== void 0 ? target : null); | ||
var ExceptionHandler = function (target) { | ||
return ReflectUtils_1.ReflectUtils.metadata(ExceptionHandlerMetadataKey, target !== null && target !== void 0 ? target : null); | ||
}; | ||
export var getExceptionHandler = function (target, propertyKey) { | ||
return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target, propertyKey); | ||
exports.ExceptionHandler = ExceptionHandler; | ||
var getExceptionHandler = function (target, propertyKey) { | ||
return ReflectUtils_1.ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target, propertyKey); | ||
}; | ||
export var getExceptionHandlers = function (target) { | ||
return ObjectUtils.getAllProtoTypeName(target) | ||
.map(function (it) { return new MetaDataPropertyAtomic(target, getExceptionHandler(target, it), it, ReflectUtils.getParameterTypes(target, it)); }) | ||
exports.getExceptionHandler = getExceptionHandler; | ||
var getExceptionHandlers = function (target) { | ||
return ObjectUtils_1.ObjectUtils.getAllProtoTypeName(target) | ||
.map(function (it) { return new MetaDataAtomic_1.MetaDataPropertyAtomic(target, exports.getExceptionHandler(target, it), it, ReflectUtils_1.ReflectUtils.getParameterTypes(target, it)); }) | ||
.filter(function (it) { return it.metaData !== undefined; }) || []; | ||
}; | ||
export var getTargetAndIncludeNullAndSortExceptionHandlers = function (target, error) { | ||
return getExceptionHandlers(target).filter(function (it) { return it.metaData == null || ObjectUtils.isPrototypeOfTarget(it.metaData, error); }) | ||
.sort(function (a, b) { return ObjectUtils.getAllProtoType(a.metaData).length - ObjectUtils.getAllProtoType(b.metaData).length; }); | ||
exports.getExceptionHandlers = getExceptionHandlers; | ||
var getTargetAndIncludeNullAndSortExceptionHandlers = function (target, error) { | ||
return exports.getExceptionHandlers(target).filter(function (it) { return it.metaData == null || ObjectUtils_1.ObjectUtils.isPrototypeOfTarget(it.metaData, error); }) | ||
.sort(function (a, b) { return ObjectUtils_1.ObjectUtils.getAllProtoType(a.metaData).length - ObjectUtils_1.ObjectUtils.getAllProtoType(b.metaData).length; }); | ||
}; | ||
exports.getTargetAndIncludeNullAndSortExceptionHandlers = getTargetAndIncludeNullAndSortExceptionHandlers; |
@@ -1,17 +0,21 @@ | ||
import { ReflectUtils } from '../utils/reflect/ReflectUtils'; | ||
import { FunctionUtils } from "../utils/function/FunctionUtils"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getInject = exports.Inject = void 0; | ||
var ReflectUtils_1 = require("../utils/reflect/ReflectUtils"); | ||
var FunctionUtils_1 = require("../utils/function/FunctionUtils"); | ||
var InjectMetadataKey = Symbol('Inject'); | ||
export var Inject = function (type) { | ||
var Inject = function (type) { | ||
return function (target, propertyKey, parameterIndex) { | ||
if (!propertyKey || typeof target === 'function') { | ||
propertyKey = FunctionUtils.getParameterNames(target)[parameterIndex]; | ||
propertyKey = FunctionUtils_1.FunctionUtils.getParameterNames(target)[parameterIndex]; | ||
} | ||
else if (propertyKey && typeof target === 'object') { | ||
target = target[propertyKey]; | ||
propertyKey = FunctionUtils.getParameterNames(target)[parameterIndex]; | ||
propertyKey = FunctionUtils_1.FunctionUtils.getParameterNames(target)[parameterIndex]; | ||
} | ||
ReflectUtils.defineMetadata(InjectMetadataKey, type, target, propertyKey); | ||
ReflectUtils_1.ReflectUtils.defineMetadata(InjectMetadataKey, type, target, propertyKey); | ||
}; | ||
}; | ||
export var getInject = function (target, propertyKey) { | ||
exports.Inject = Inject; | ||
var getInject = function (target, propertyKey) { | ||
if (typeof target === 'object') { | ||
@@ -21,3 +25,3 @@ target = target.constructor; | ||
try { | ||
return ReflectUtils.getMetadata(InjectMetadataKey, target, propertyKey); | ||
return ReflectUtils_1.ReflectUtils.getMetadata(InjectMetadataKey, target, propertyKey); | ||
} | ||
@@ -27,1 +31,2 @@ catch (e) { | ||
}; | ||
exports.getInject = getInject; |
@@ -1,9 +0,13 @@ | ||
import { ReflectUtils } from '../utils/reflect/ReflectUtils'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getInjectable = exports.Injectable = void 0; | ||
var ReflectUtils_1 = require("../utils/reflect/ReflectUtils"); | ||
var InjectorbleMetadataKey = Symbol('Injectable'); | ||
export var Injectable = function (config) { | ||
var Injectable = function (config) { | ||
return function (target) { | ||
ReflectUtils.defineMetadata(InjectorbleMetadataKey, config, target); | ||
ReflectUtils_1.ReflectUtils.defineMetadata(InjectorbleMetadataKey, config, target); | ||
}; | ||
}; | ||
export var getInjectable = function (target) { | ||
exports.Injectable = Injectable; | ||
var getInjectable = function (target) { | ||
if (typeof target === 'object') { | ||
@@ -13,3 +17,3 @@ target = target.constructor; | ||
try { | ||
return ReflectUtils.getMetadata(InjectorbleMetadataKey, target); | ||
return ReflectUtils_1.ReflectUtils.getMetadata(InjectorbleMetadataKey, target); | ||
} | ||
@@ -19,1 +23,2 @@ catch (e) { | ||
}; | ||
exports.getInjectable = getInjectable; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -16,2 +17,4 @@ var extendStatics = function (d, b) { | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MetaDataPropertyAtomic = exports.MetaDataAtomic = void 0; | ||
var MetaDataAtomic = (function () { | ||
@@ -24,3 +27,3 @@ function MetaDataAtomic(target, metaData) { | ||
}()); | ||
export { MetaDataAtomic }; | ||
exports.MetaDataAtomic = MetaDataAtomic; | ||
var MetaDataPropertyAtomic = (function (_super) { | ||
@@ -44,2 +47,2 @@ __extends(MetaDataPropertyAtomic, _super); | ||
}(MetaDataAtomic)); | ||
export { MetaDataPropertyAtomic }; | ||
exports.MetaDataPropertyAtomic = MetaDataPropertyAtomic; |
@@ -1,11 +0,15 @@ | ||
import { SimGlobal } from '../global/SimGlobal'; | ||
import { ReflectUtils } from '../utils/reflect/ReflectUtils'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPostConstruct = exports.PostConstruct = exports.getSim = exports.Sim = void 0; | ||
var SimGlobal_1 = require("../global/SimGlobal"); | ||
var ReflectUtils_1 = require("../utils/reflect/ReflectUtils"); | ||
var SimMetadataKey = Symbol('Sim'); | ||
export var Sim = function (config) { | ||
var Sim = function (config) { | ||
return function (target) { | ||
ReflectUtils.defineMetadata(SimMetadataKey, config, target); | ||
SimGlobal().storage.add(target); | ||
ReflectUtils_1.ReflectUtils.defineMetadata(SimMetadataKey, config, target); | ||
SimGlobal_1.SimGlobal().storage.add(target); | ||
}; | ||
}; | ||
export var getSim = function (target) { | ||
exports.Sim = Sim; | ||
var getSim = function (target) { | ||
if (typeof target === 'object') { | ||
@@ -15,3 +19,3 @@ target = target.constructor; | ||
try { | ||
return ReflectUtils.getMetadata(SimMetadataKey, target); | ||
return ReflectUtils_1.ReflectUtils.getMetadata(SimMetadataKey, target); | ||
} | ||
@@ -21,8 +25,11 @@ catch (e) { | ||
}; | ||
exports.getSim = getSim; | ||
var PostConstructMetadataKey = Symbol('PostConstruct'); | ||
export var PostConstruct = function (target, propertyKey, descriptor) { | ||
ReflectUtils.defineMetadata(PostConstructMetadataKey, PostConstructMetadataKey, target, propertyKey); | ||
var PostConstruct = function (target, propertyKey, descriptor) { | ||
ReflectUtils_1.ReflectUtils.defineMetadata(PostConstructMetadataKey, PostConstructMetadataKey, target, propertyKey); | ||
}; | ||
export var getPostConstruct = function (target, propertyKey) { | ||
return ReflectUtils.getMetadata(PostConstructMetadataKey, target, propertyKey); | ||
exports.PostConstruct = PostConstruct; | ||
var getPostConstruct = function (target, propertyKey) { | ||
return ReflectUtils_1.ReflectUtils.getMetadata(PostConstructMetadataKey, target, propertyKey); | ||
}; | ||
exports.getPostConstruct = getPostConstruct; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimGlobal = void 0; | ||
var g = new (function () { | ||
@@ -23,3 +26,3 @@ function class_1() { | ||
} | ||
export var SimGlobal = function () { | ||
var SimGlobal = function () { | ||
if (global) { | ||
@@ -35,1 +38,2 @@ return global.SimGlobal; | ||
}; | ||
exports.SimGlobal = SimGlobal; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Intent = void 0; | ||
var Intent = (function () { | ||
@@ -38,2 +41,2 @@ function Intent(uri, data, event) { | ||
}()); | ||
export { Intent }; | ||
exports.Intent = Intent; |
@@ -1,1 +0,2 @@ | ||
export {}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -1,7 +0,10 @@ | ||
import 'reflect-metadata'; | ||
import { Subject } from 'rxjs'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IntentManager = void 0; | ||
require("reflect-metadata"); | ||
var rxjs_1 = require("rxjs"); | ||
var IntentManager = (function () { | ||
function IntentManager(simstanceManager) { | ||
this.simstanceManager = simstanceManager; | ||
this.subject = new Subject(); | ||
this.subject = new rxjs_1.Subject(); | ||
} | ||
@@ -46,2 +49,2 @@ IntentManager.prototype.onNext = function (intent) { | ||
}()); | ||
export { IntentManager }; | ||
exports.IntentManager = IntentManager; |
@@ -1,1 +0,2 @@ | ||
export {}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -1,2 +0,5 @@ | ||
import { SimGlobal } from "../global/SimGlobal"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Module = void 0; | ||
var SimGlobal_1 = require("../global/SimGlobal"); | ||
var Module = (function () { | ||
@@ -16,3 +19,3 @@ function Module() { | ||
var _a; | ||
(_a = SimGlobal().application) === null || _a === void 0 ? void 0 : _a.intentManager.onNext(intent); | ||
(_a = SimGlobal_1.SimGlobal().application) === null || _a === void 0 ? void 0 : _a.intentManager.onNext(intent); | ||
}; | ||
@@ -23,2 +26,2 @@ Module.prototype.subscribe = function (intent) { | ||
}()); | ||
export { Module }; | ||
exports.Module = Module; |
{ | ||
"name": "simple-boot-core", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"main": "SimpleApplication.js", | ||
@@ -64,9 +64,9 @@ "license": "MIT", | ||
"supertest": "^6.1.3", | ||
"ts-jest": "^26.5.4" | ||
"ts-jest": "^26.5.4", | ||
"typescript": "^4.2.3" | ||
}, | ||
"dependencies": { | ||
"reflect-metadata": "^0.1.13", | ||
"rxjs": "^6.6.7", | ||
"typescript": "^4.2.3" | ||
"rxjs": "^6.6.7" | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -16,3 +17,5 @@ var extendStatics = function (d, b) { | ||
})(); | ||
import { SimProxy } from './SimProxy'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimObjectProxyHandler = void 0; | ||
var SimProxy_1 = require("./SimProxy"); | ||
var SimObjectProxyHandler = (function (_super) { | ||
@@ -44,3 +47,3 @@ __extends(SimObjectProxyHandler, _super); | ||
return SimObjectProxyHandler; | ||
}(SimProxy)); | ||
export { SimObjectProxyHandler }; | ||
}(SimProxy_1.SimProxy)); | ||
exports.SimObjectProxyHandler = SimObjectProxyHandler; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimProxy = void 0; | ||
var SimProxy = (function () { | ||
@@ -15,2 +18,2 @@ function SimProxy() { | ||
}()); | ||
export { SimProxy }; | ||
exports.SimProxy = SimProxy; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -25,10 +26,12 @@ var extendStatics = function (d, b) { | ||
}; | ||
import { Module } from '../module/Module'; | ||
import { SimGlobal } from '../global/SimGlobal'; | ||
import { Sim } from '../decorators/SimDecorator'; | ||
import { getTargetAndIncludeNullAndSortExceptionHandlers } from '../decorators/exception/ExceptionDecorator'; | ||
import { getProtoAfters, getProtoBefores } from '../decorators/aop/AOPDecorator'; | ||
import { ObjectUtils } from '../utils/object/ObjectUtils'; | ||
import { SimProxy } from './SimProxy'; | ||
import { SimOption } from "../SimOption"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimProxyHandler = void 0; | ||
var Module_1 = require("../module/Module"); | ||
var SimGlobal_1 = require("../global/SimGlobal"); | ||
var SimDecorator_1 = require("../decorators/SimDecorator"); | ||
var ExceptionDecorator_1 = require("../decorators/exception/ExceptionDecorator"); | ||
var AOPDecorator_1 = require("../decorators/aop/AOPDecorator"); | ||
var ObjectUtils_1 = require("../utils/object/ObjectUtils"); | ||
var SimProxy_1 = require("./SimProxy"); | ||
var SimOption_1 = require("../SimOption"); | ||
var SimProxyHandler = (function (_super) { | ||
@@ -40,3 +43,3 @@ __extends(SimProxyHandler, _super); | ||
_this.simOption = simOption; | ||
_this.simstanceManager = (_a = SimGlobal().application) === null || _a === void 0 ? void 0 : _a.simstanceManager; | ||
_this.simstanceManager = (_a = SimGlobal_1.SimGlobal().application) === null || _a === void 0 ? void 0 : _a.simstanceManager; | ||
return _this; | ||
@@ -49,3 +52,3 @@ } | ||
var _a; | ||
value = (_a = this.simstanceManager) === null || _a === void 0 ? void 0 : _a.proxy(value, Module); | ||
value = (_a = this.simstanceManager) === null || _a === void 0 ? void 0 : _a.proxy(value, Module_1.Module); | ||
obj[prop] = value; | ||
@@ -68,3 +71,3 @@ if (this.simOption.simProxy) { | ||
catch (e) { | ||
var inHandler = getTargetAndIncludeNullAndSortExceptionHandlers(thisArg, e); | ||
var inHandler = ExceptionDecorator_1.getTargetAndIncludeNullAndSortExceptionHandlers(thisArg, e); | ||
if (inHandler.length > 0) { | ||
@@ -76,3 +79,3 @@ inHandler[inHandler.length - 1].call(e, thisArg, target, argumentsList); | ||
var sim = (_a = this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getOrNewSim(this.simOption.advice[i]); | ||
var inHandler_1 = getTargetAndIncludeNullAndSortExceptionHandlers(sim, e); | ||
var inHandler_1 = ExceptionDecorator_1.getTargetAndIncludeNullAndSortExceptionHandlers(sim, e); | ||
if (inHandler_1.length > 0) { | ||
@@ -90,5 +93,5 @@ inHandler_1[inHandler_1.length - 1].call(e, thisArg, target, argumentsList); | ||
var _a; | ||
var propertyName = ObjectUtils.getPrototypeName(obj, protoType); | ||
var propertyName = ObjectUtils_1.ObjectUtils.getPrototypeName(obj, protoType); | ||
if (propertyName) { | ||
getProtoBefores(obj, propertyName).forEach(function (it) { | ||
AOPDecorator_1.getProtoBefores(obj, propertyName).forEach(function (it) { | ||
it.call(obj, protoType, propertyName); | ||
@@ -98,3 +101,3 @@ }); | ||
var sim = (_a = this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getOrNewSim(this.simOption.advice[i]); | ||
var protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj)); | ||
var protoBefores = AOPDecorator_1.getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj)); | ||
protoBefores.forEach(function (it) { | ||
@@ -108,5 +111,5 @@ it.call(obj, protoType, propertyName); | ||
var _a; | ||
var propertyName = ObjectUtils.getPrototypeName(obj, protoType); | ||
var propertyName = ObjectUtils_1.ObjectUtils.getPrototypeName(obj, protoType); | ||
if (propertyName) { | ||
getProtoAfters(obj, propertyName).forEach(function (it) { | ||
AOPDecorator_1.getProtoAfters(obj, propertyName).forEach(function (it) { | ||
it.call(obj, protoType, propertyName); | ||
@@ -116,3 +119,3 @@ }); | ||
var sim = (_a = this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getOrNewSim(this.simOption.advice[i]); | ||
var protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj)); | ||
var protoBefores = AOPDecorator_1.getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj)); | ||
protoBefores.forEach(function (it) { | ||
@@ -125,7 +128,7 @@ it.call(obj, protoType, propertyName); | ||
SimProxyHandler = __decorate([ | ||
Sim(), | ||
__metadata("design:paramtypes", [SimOption]) | ||
SimDecorator_1.Sim(), | ||
__metadata("design:paramtypes", [SimOption_1.SimOption]) | ||
], SimProxyHandler); | ||
return SimProxyHandler; | ||
}(SimProxy)); | ||
export { SimProxyHandler }; | ||
}(SimProxy_1.SimProxy)); | ||
exports.SimProxyHandler = SimProxyHandler; |
@@ -1,1 +0,2 @@ | ||
export {}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimOption = void 0; | ||
var SimOption = (function () { | ||
@@ -20,2 +23,2 @@ function SimOption(advice, simProxy) { | ||
}()); | ||
export { SimOption }; | ||
exports.SimOption = SimOption; |
@@ -1,10 +0,13 @@ | ||
import { SimGlobal } from './global/SimGlobal'; | ||
import { SimstanceManager } from "./simstance/SimstanceManager"; | ||
import { IntentManager } from "./intent/IntentManager"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimpleApplication = void 0; | ||
var SimGlobal_1 = require("./global/SimGlobal"); | ||
var SimstanceManager_1 = require("./simstance/SimstanceManager"); | ||
var IntentManager_1 = require("./intent/IntentManager"); | ||
var SimpleApplication = (function () { | ||
function SimpleApplication(option) { | ||
this.option = option; | ||
this.simstanceManager = new SimstanceManager(option); | ||
this.intentManager = new IntentManager(this.simstanceManager); | ||
SimGlobal().application = this; | ||
this.simstanceManager = new SimstanceManager_1.SimstanceManager(option); | ||
this.intentManager = new IntentManager_1.IntentManager(this.simstanceManager); | ||
SimGlobal_1.SimGlobal().application = this; | ||
} | ||
@@ -17,2 +20,2 @@ SimpleApplication.prototype.run = function () { | ||
}()); | ||
export { SimpleApplication }; | ||
exports.SimpleApplication = SimpleApplication; |
@@ -1,6 +0,9 @@ | ||
import { SimGlobal } from '../global/SimGlobal'; | ||
import { getSim } from '../decorators/SimDecorator'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimAtomic = void 0; | ||
var SimGlobal_1 = require("../global/SimGlobal"); | ||
var SimDecorator_1 = require("../decorators/SimDecorator"); | ||
var SimAtomic = (function () { | ||
function SimAtomic(type, simstanceManager) { | ||
if (simstanceManager === void 0) { simstanceManager = (_a = SimGlobal().application) === null || _a === void 0 ? void 0 : _a.simstanceManager; } | ||
if (simstanceManager === void 0) { simstanceManager = (_a = SimGlobal_1.SimGlobal().application) === null || _a === void 0 ? void 0 : _a.simstanceManager; } | ||
var _a; | ||
@@ -12,3 +15,3 @@ this.type = type; | ||
get: function () { | ||
return getSim(this.type); | ||
return SimDecorator_1.getSim(this.type); | ||
}, | ||
@@ -28,2 +31,2 @@ enumerable: false, | ||
}()); | ||
export { SimAtomic }; | ||
exports.SimAtomic = SimAtomic; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -15,15 +16,17 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
}; | ||
import 'reflect-metadata'; | ||
import { SimNoSuch } from '../throwable/SimNoSuch'; | ||
import { Module } from '../module/Module'; | ||
import { getPostConstruct, PostConstruct } from '../decorators/SimDecorator'; | ||
import { SimGlobal } from '../global/SimGlobal'; | ||
import { ObjectUtils } from '../utils/object/ObjectUtils'; | ||
import { SimAtomic } from './SimAtomic'; | ||
import { ReflectUtils } from '../utils/reflect/ReflectUtils'; | ||
import { FunctionUtils } from '../utils/function/FunctionUtils'; | ||
import { getInject } from '../decorators/Inject'; | ||
import { SimObjectProxyHandler } from "../proxy/SimObjectProxyHandler"; | ||
import { SimOption } from "../SimOption"; | ||
import { SimProxyHandler } from "../proxy/SimProxyHandler"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimstanceManager = void 0; | ||
require("reflect-metadata"); | ||
var SimNoSuch_1 = require("../throwable/SimNoSuch"); | ||
var Module_1 = require("../module/Module"); | ||
var SimDecorator_1 = require("../decorators/SimDecorator"); | ||
var SimGlobal_1 = require("../global/SimGlobal"); | ||
var ObjectUtils_1 = require("../utils/object/ObjectUtils"); | ||
var SimAtomic_1 = require("./SimAtomic"); | ||
var ReflectUtils_1 = require("../utils/reflect/ReflectUtils"); | ||
var FunctionUtils_1 = require("../utils/function/FunctionUtils"); | ||
var Inject_1 = require("../decorators/Inject"); | ||
var SimObjectProxyHandler_1 = require("../proxy/SimObjectProxyHandler"); | ||
var SimOption_1 = require("../SimOption"); | ||
var SimProxyHandler_1 = require("../proxy/SimProxyHandler"); | ||
var SimstanceManager = (function () { | ||
@@ -34,3 +37,3 @@ function SimstanceManager(option) { | ||
this._storage.set(option.constructor, option); | ||
this._storage.set(SimOption, option); | ||
this._storage.set(SimOption_1.SimOption, option); | ||
} | ||
@@ -46,3 +49,3 @@ Object.defineProperty(SimstanceManager.prototype, "storage", { | ||
var _this = this; | ||
return Array.from(this._storage.keys()).map(function (it) { return new SimAtomic(it, _this); }); | ||
return Array.from(this._storage.keys()).map(function (it) { return new SimAtomic_1.SimAtomic(it, _this); }); | ||
}; | ||
@@ -96,3 +99,3 @@ SimstanceManager.prototype.getSimConfig = function (scheme) { | ||
} | ||
throw new SimNoSuch('no simple instance ' + target); | ||
throw new SimNoSuch_1.SimNoSuch('no simple instance ' + target); | ||
}; | ||
@@ -102,5 +105,5 @@ SimstanceManager.prototype.newSim = function (target, simCreateAfter) { | ||
this.callBindPostConstruct(r); | ||
var p = this.proxy(r, Module); | ||
var p = this.proxy(r, Module_1.Module); | ||
simCreateAfter === null || simCreateAfter === void 0 ? void 0 : simCreateAfter(p); | ||
if (p instanceof Module) { | ||
if (p instanceof Module_1.Module) { | ||
this.moduleObjectPropProxy(p); | ||
@@ -112,6 +115,6 @@ } | ||
var _this = this; | ||
var set = new Set(ObjectUtils.getAllProtoTypeName(obj)); | ||
var set = new Set(ObjectUtils_1.ObjectUtils.getAllProtoTypeName(obj)); | ||
set.forEach(function (it) { | ||
var _a; | ||
var postConstruct = getPostConstruct(obj, it); | ||
var postConstruct = SimDecorator_1.getPostConstruct(obj, it); | ||
if (postConstruct) { | ||
@@ -124,7 +127,7 @@ (_a = obj)[it].apply(_a, _this.getParameterSim(obj, it)); | ||
var _this = this; | ||
var paramTypes = ReflectUtils.getParameterTypes(target, targetKey); | ||
var paramNames = FunctionUtils.getParameterNames(target, targetKey); | ||
var paramTypes = ReflectUtils_1.ReflectUtils.getParameterTypes(target, targetKey); | ||
var paramNames = FunctionUtils_1.FunctionUtils.getParameterNames(target, targetKey); | ||
var injections = paramTypes.map(function (token, idx) { | ||
target = targetKey ? target[targetKey] : target; | ||
var inject = getInject(target, paramNames[idx]); | ||
var inject = Inject_1.getInject(target, paramNames[idx]); | ||
return _this.resolve(inject !== null && inject !== void 0 ? inject : token); | ||
@@ -146,3 +149,3 @@ }); | ||
} | ||
var protoTypeName = ObjectUtils.getProtoTypeName(target); | ||
var protoTypeName = ObjectUtils_1.ObjectUtils.getProtoTypeName(target); | ||
protoTypeName.forEach(function (it) { | ||
@@ -158,3 +161,3 @@ target[it] = new Proxy(target[it], _this.simProxyHandler); | ||
var prop = target[key]; | ||
if (prop instanceof Module) { | ||
if (prop instanceof Module_1.Module) { | ||
this.moduleObjectPropProxy(prop); | ||
@@ -164,3 +167,3 @@ } | ||
if (!('isProxy' in prop)) { | ||
target[key] = new Proxy(prop, new SimObjectProxyHandler()); | ||
target[key] = new Proxy(prop, new SimObjectProxyHandler_1.SimObjectProxyHandler()); | ||
} | ||
@@ -177,3 +180,3 @@ var _refModule = (target[key]).simObjectProxyHandler_refModule; | ||
var _this = this; | ||
SimGlobal().storage.forEach(function (data) { | ||
SimGlobal_1.SimGlobal().storage.forEach(function (data) { | ||
_this.register(data); | ||
@@ -184,5 +187,5 @@ }); | ||
__decorate([ | ||
PostConstruct, | ||
SimDecorator_1.PostConstruct, | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [SimProxyHandler]), | ||
__metadata("design:paramtypes", [SimProxyHandler_1.SimProxyHandler]), | ||
__metadata("design:returntype", void 0) | ||
@@ -192,2 +195,2 @@ ], SimstanceManager.prototype, "post", null); | ||
}()); | ||
export { SimstanceManager }; | ||
exports.SimstanceManager = SimstanceManager; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimError = void 0; | ||
var SimError = (function () { | ||
@@ -9,2 +12,2 @@ function SimError(message, name, stack) { | ||
}()); | ||
export { SimError }; | ||
exports.SimError = SimError; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -16,3 +17,5 @@ var extendStatics = function (d, b) { | ||
})(); | ||
import { SimError } from './SimError'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimNoSuch = void 0; | ||
var SimError_1 = require("./SimError"); | ||
var SimNoSuch = (function (_super) { | ||
@@ -24,3 +27,3 @@ __extends(SimNoSuch, _super); | ||
return SimNoSuch; | ||
}(SimError)); | ||
export { SimNoSuch }; | ||
}(SimError_1.SimError)); | ||
exports.SimNoSuch = SimNoSuch; |
@@ -1,1 +0,2 @@ | ||
export {}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -1,2 +0,5 @@ | ||
import { ValidUtils } from '../valid/ValidUtils'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ConvertUtils = void 0; | ||
var ValidUtils_1 = require("../valid/ValidUtils"); | ||
var ConvertUtils = (function () { | ||
@@ -46,7 +49,7 @@ function ConvertUtils() { | ||
ConvertUtils.toObject = function (obj) { | ||
if (ValidUtils.isMap(obj)) { | ||
if (ValidUtils_1.ValidUtils.isMap(obj)) { | ||
var map = obj; | ||
obj = this.mapToObj(map); | ||
} | ||
if (ValidUtils.isArray(obj)) { | ||
if (ValidUtils_1.ValidUtils.isArray(obj)) { | ||
var arr = obj; | ||
@@ -57,3 +60,3 @@ for (var i = 0; i < arr.length; i++) { | ||
} | ||
if (ValidUtils.isObject(obj)) { | ||
if (ValidUtils_1.ValidUtils.isObject(obj)) { | ||
for (var property in obj) { | ||
@@ -98,2 +101,2 @@ obj[property] = this.toObject(obj[property]); | ||
}()); | ||
export { ConvertUtils }; | ||
exports.ConvertUtils = ConvertUtils; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FunctionUtils = void 0; | ||
var FunctionUtils = (function () { | ||
@@ -33,2 +36,2 @@ function FunctionUtils() { | ||
}()); | ||
export { FunctionUtils }; | ||
exports.FunctionUtils = FunctionUtils; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ObjectUtils = void 0; | ||
var ObjectUtils = (function () { | ||
@@ -67,2 +70,2 @@ function ObjectUtils() { | ||
}()); | ||
export { ObjectUtils }; | ||
exports.ObjectUtils = ObjectUtils; |
@@ -1,2 +0,5 @@ | ||
import { ValidUtils } from '../valid/ValidUtils'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RandomUtils = void 0; | ||
var ValidUtils_1 = require("../valid/ValidUtils"); | ||
var RandomUtils = (function () { | ||
@@ -6,6 +9,6 @@ function RandomUtils() { | ||
RandomUtils.random = function (min, max) { | ||
if (ValidUtils.isNullOrUndefined(min)) { | ||
if (ValidUtils_1.ValidUtils.isNullOrUndefined(min)) { | ||
return Math.random(); | ||
} | ||
else if (!ValidUtils.isNullOrUndefined(min) && ValidUtils.isNullOrUndefined(max)) { | ||
else if (!ValidUtils_1.ValidUtils.isNullOrUndefined(min) && ValidUtils_1.ValidUtils.isNullOrUndefined(max)) { | ||
return Math.random() * (min || 0); | ||
@@ -44,2 +47,2 @@ } | ||
}()); | ||
export { RandomUtils }; | ||
exports.RandomUtils = RandomUtils; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ReflectUtils = void 0; | ||
var ReflectUtils = (function () { | ||
@@ -33,2 +36,2 @@ function ReflectUtils() { | ||
}()); | ||
export { ReflectUtils }; | ||
exports.ReflectUtils = ReflectUtils; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TypeUtils = void 0; | ||
var TypeUtils = (function () { | ||
@@ -6,2 +9,2 @@ function TypeUtils() { | ||
}()); | ||
export { TypeUtils }; | ||
exports.TypeUtils = TypeUtils; |
@@ -0,1 +1,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ValidUtils = void 0; | ||
var ValidUtils = (function () { | ||
@@ -70,2 +73,2 @@ function ValidUtils() { | ||
}()); | ||
export { ValidUtils }; | ||
exports.ValidUtils = ValidUtils; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63350
2
1512
12
- Removedtypescript@^4.2.3
- Removedtypescript@4.9.5(transitive)