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

simple-boot-core

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-boot-core - npm Package Compare versions

Comparing version 1.0.36 to 1.0.37

4

decorators/aop/AOPDecorator.d.ts

@@ -18,3 +18,3 @@ import 'reflect-metadata';

export declare const getAfters: (target: any) => MetaDataPropertyAtomic<any, AOPOption>[];
export declare const getProtoAfters: (target: any, propertyKey: string, type?: ConstructorType<any>) => MetaDataPropertyAtomic<any, AOPOption>[];
export declare const getProtoAfters: (target: any, propertyKey: string, type?: ConstructorType<any> | undefined) => MetaDataPropertyAtomic<any, AOPOption>[];
export declare const Before: (data: AOPOption) => {

@@ -26,3 +26,3 @@ (target: Function): void;

export declare const getBefores: (target: any) => MetaDataPropertyAtomic<any, AOPOption>[];
export declare const getProtoBefores: (target: any, propertyKey: string, type?: ConstructorType<any>) => MetaDataPropertyAtomic<any, AOPOption>[];
export declare const getProtoBefores: (target: any, propertyKey: string, type?: ConstructorType<any> | undefined) => MetaDataPropertyAtomic<any, AOPOption>[];
export declare class AroundForceReturn {

@@ -29,0 +29,0 @@ value: any;

@@ -42,2 +42,2 @@ import 'reflect-metadata';

export declare function Inject(config: InjectConfig): MethodParameter;
export declare const getInject: (target: ConstructorType<any> | Function | any, propertyKey?: string | symbol) => SaveInjectConfig[];
export declare const getInject: (target: ConstructorType<any> | Function | any, propertyKey?: string | symbol | undefined) => SaveInjectConfig[];

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

import "reflect-metadata";
import 'reflect-metadata';
export declare class MetaDataAtomic<T = any, M = any> {

@@ -3,0 +3,0 @@ target: T;

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

var _a;
if (null != target && undefined != target && typeof target === 'object') {
if (target !== null && undefined !== target && typeof target === 'object') {
target = target.constructor;

@@ -18,3 +18,2 @@ }

ReflectUtils_1.ReflectUtils.defineMetadata(exports.OnRouteMetadataKey, config, target, propertyKey);
var metadata = ReflectUtils_1.ReflectUtils.getMetadata(exports.OnRouteMetadataKey, target, propertyKey);
};

@@ -33,3 +32,3 @@ function OnRoute(configOrTarget, propertyKey, descriptor) {

var getOnRoute = function (target, propertyKey) {
if (null != target && undefined != target && typeof target === 'object') {
if (target !== null && undefined !== target && typeof target === 'object') {
target = target.constructor;

@@ -36,0 +35,0 @@ }

import 'reflect-metadata';
import { ConstructorType, GenericClassDecorator } from '../types/Types';
export declare const sims: Set<ConstructorType<any>>;
export declare const sims: Map<ConstructorType<any>, Set<ConstructorType<any>>>;
export interface SimConfig {
scheme?: string;
type?: ConstructorType<any> | ConstructorType<any>[];
}

@@ -7,0 +8,0 @@ export declare const SimMetadataKey: unique symbol;

@@ -6,13 +6,32 @@ "use strict";

var ReflectUtils_1 = require("../utils/reflect/ReflectUtils");
exports.sims = new Set();
exports.sims = new Map();
exports.SimMetadataKey = Symbol('Sim');
function Sim(config) {
if (typeof config === 'function') {
ReflectUtils_1.ReflectUtils.defineMetadata(exports.SimMetadataKey, {}, config);
exports.sims.add(config);
var simProcess = function (config, target) {
ReflectUtils_1.ReflectUtils.defineMetadata(exports.SimMetadataKey, {}, target);
var adding = function (targetKey, target) {
var _a;
if (target === void 0) { target = targetKey; }
var items = (_a = exports.sims.get(targetKey)) !== null && _a !== void 0 ? _a : new Set();
items.add(target);
exports.sims.set(targetKey, items);
};
if (Array.isArray(config === null || config === void 0 ? void 0 : config.type)) {
config === null || config === void 0 ? void 0 : config.type.forEach(function (it) {
adding(it, target);
});
}
else if (config.type) {
adding(config === null || config === void 0 ? void 0 : config.type, target);
}
else {
adding(target);
}
};
function Sim(configOrTarget) {
if (typeof configOrTarget === 'function') {
simProcess({}, configOrTarget);
}
else {
return function (target) {
ReflectUtils_1.ReflectUtils.defineMetadata(exports.SimMetadataKey, config, target);
exports.sims.add(target);
simProcess(configOrTarget, target);
};

@@ -19,0 +38,0 @@ }

import { ConstructorType, MethodParameter, ReflectField } from '../../types/Types';
export declare const Valid: MethodParameter;
export declare const getValidIndex: (target: ConstructorType<any> | Function | any, propertyKey?: string | symbol) => number[];
export declare const getValidIndex: (target: ConstructorType<any> | Function | any, propertyKey?: string | symbol | undefined) => number[];
export declare type Validator = (value: any, ...params: any[]) => boolean;

@@ -5,0 +5,0 @@ export declare type SaveValidator = {

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

var _a;
if (null != target && undefined != target && typeof target === 'object') {
if (target !== null && undefined !== target && typeof target === 'object') {
target = target.constructor;

@@ -25,0 +25,0 @@ }

{
"name": "simple-boot-core",
"version": "1.0.36",
"version": "1.0.37",
"main": "SimpleApplication.js",

@@ -5,0 +5,0 @@ "license": "MIT",

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

SimProxyHandler.prototype.executeExceptionHandler = function (e, argumentsList, inHandler) {
var _a;
var _a, _b;
var otherStorage = new Map();

@@ -69,3 +69,3 @@ otherStorage.set(e.constructor, e);

otherStorage.set(Inject_1.SituationTypeContainer, situationTypeContainer);
argumentsList === null || argumentsList === void 0 ? void 0 : argumentsList.forEach(function (it) {
(_a = argumentsList) === null || _a === void 0 ? void 0 : _a.forEach(function (it) {
otherStorage.set(e.constructor, e);

@@ -84,3 +84,3 @@ });

var exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
if (((_a = exceptionHandler === null || exceptionHandler === void 0 ? void 0 : exceptionHandler.length) !== null && _a !== void 0 ? _a : 0) > 0) {
if (((_b = exceptionHandler === null || exceptionHandler === void 0 ? void 0 : exceptionHandler.length) !== null && _b !== void 0 ? _b : 0) > 0) {
this.executeExceptionHandler(e, argumentsList, exceptionHandler[0]);

@@ -87,0 +87,0 @@ }

import { Intent } from '../intent/Intent';
import { ConstructorType } from '../types/Types';
import { RouterModule } from './RouterModule';
import { SimAtomic } from '../simstance/SimAtomic';
import { SimstanceManager } from '../simstance/SimstanceManager';

@@ -8,3 +9,3 @@ export declare class RouterManager {

private rootRouter?;
activeRouterModule?: RouterModule;
activeRouterModule?: RouterModule<SimAtomic, any>;
constructor(simstanceManager: SimstanceManager, rootRouter?: ConstructorType<any> | undefined);

@@ -14,3 +15,3 @@ routingMap(prefix?: string, router?: ConstructorType<any> | undefined): {

};
routing(intent: Intent): Promise<RouterModule>;
routing<R = SimAtomic, M = any>(intent: Intent): Promise<RouterModule<R, M>>;
private getExecuteModule;

@@ -17,0 +18,0 @@ private isRootUrl;

@@ -25,8 +25,8 @@ import 'reflect-metadata';

simAtomic<T>(type: ConstructorType<T>): SimAtomic<T>;
getInstance<T>(type: ConstructorType<T>): NonNullable<T>;
getInstance<T>(type: ConstructorType<T>): T;
sim<T>(type: ConstructorType<T>): T | undefined;
publishIntent(i: string, data?: any): any[];
publishIntent(i: Intent): any[];
routing<R = SimAtomic, M = any>(i: string, data?: any): Promise<RouterModule>;
routing<R = SimAtomic, M = any>(i: Intent): Promise<RouterModule>;
routing<R = SimAtomic, M = any>(i: string, data?: any): Promise<RouterModule<R, M>>;
routing<R = SimAtomic, M = any>(i: Intent): Promise<RouterModule<R, M>>;
}

@@ -23,8 +23,8 @@ "use strict";

this.simstanceManager = new SimstanceManager_1.SimstanceManager(option);
this.simstanceManager.storage.set(SimpleApplication, this);
this.simstanceManager.set(SimpleApplication, this);
this.intentManager = new IntentManager_1.IntentManager(this.simstanceManager);
this.routerManager = new RouterManager_1.RouterManager(this.simstanceManager, this.rootRouter);
this.simstanceManager.storage.set(SimstanceManager_1.SimstanceManager, this.simstanceManager);
this.simstanceManager.storage.set(IntentManager_1.IntentManager, this.intentManager);
this.simstanceManager.storage.set(RouterManager_1.RouterManager, this.routerManager);
this.simstanceManager.set(SimstanceManager_1.SimstanceManager, this.simstanceManager);
this.simstanceManager.set(IntentManager_1.IntentManager, this.intentManager);
this.simstanceManager.set(RouterManager_1.RouterManager, this.routerManager);
}

@@ -31,0 +31,0 @@ SimpleApplication.prototype.getSimstanceManager = function () {

@@ -17,3 +17,3 @@ import 'reflect-metadata';

constructor(option: SimOption);
get storage(): Map<ConstructorType<any>, any>;
get storage(): Map<ConstructorType<any>, Map<ConstructorType<any>, any>>;
getSimAtomics(): SimAtomic[];

@@ -25,7 +25,15 @@ getSimConfig(scheme: string | undefined): SimAtomic<any>[];

}): SimAtomic<any> | undefined;
getOrNewSim<T>(k?: ConstructorType<T>): T | undefined;
getOrNewSims<T>(k: ConstructorType<T>): T[];
register(target: ConstructorType<any>): void;
set(target: ConstructorType<any>, obj: any): void;
resolve<T>(target: ConstructorType<any>): T;
getStoreSets<T>(targetKey: ConstructorType<T>): {
type: ConstructorType<T>;
instance?: T;
}[];
getStoreSet<T>(targetKey: ConstructorType<T>, target?: ConstructorType<any>): {
type: ConstructorType<T>;
instance?: T;
} | undefined;
getStoreInstance<T>(targetKey: ConstructorType<T>, target?: ConstructorType<any>): T | undefined;
getOrNewSim<T>(target?: ConstructorType<T>): T | undefined;
register(keyType: ConstructorType<any>, regTyps: Set<ConstructorType<any>>): void;
set(targetKey: ConstructorType<any>, obj: any, target?: ConstructorType<any>): void;
resolve<T>(targetKey: ConstructorType<any>, target?: ConstructorType<any>): T;
newSim<T>(target: ConstructorType<T>, simCreateAfter?: (data: T) => void, otherStorage?: Map<ConstructorType<any>, any>): T;

@@ -32,0 +40,0 @@ callBindPostConstruct(obj: any): void;

@@ -63,5 +63,5 @@ "use strict";

this._storage = new Map();
this._storage.set(SimstanceManager, this);
this._storage.set(option.constructor, option);
this._storage.set(SimOption_1.SimOption, option);
this.set(SimstanceManager, this);
this.set(option.constructor, option);
this.set(SimOption_1.SimOption, option);
this.simProxyHandler = new SimProxyHandler_1.SimProxyHandler(this, option);

@@ -96,52 +96,55 @@ }

};
SimstanceManager.prototype.getOrNewSim = function (k) {
if (k) {
var newVar = this.storage.get(k);
if (!newVar) {
newVar = this.resolve(k);
SimstanceManager.prototype.getStoreSets = function (targetKey) {
var _a, _b, _c;
var map = this.storage.get(targetKey);
var datas = ((_c = Array.from((_b = (_a = map === null || map === void 0 ? void 0 : map.entries) === null || _a === void 0 ? void 0 : _a.call(map)) !== null && _b !== void 0 ? _b : [])) !== null && _c !== void 0 ? _c : []).reverse();
return datas.map(function (it) { return ({ type: it[0], instance: it[1] }); });
};
SimstanceManager.prototype.getStoreSet = function (targetKey, target) {
var _a;
return (_a = this.getStoreSets(targetKey).find(function (it) { return it.type === target; })) !== null && _a !== void 0 ? _a : this.getStoreSets(targetKey)[0];
};
SimstanceManager.prototype.getStoreInstance = function (targetKey, target) {
var _a;
return (_a = this.getStoreSet(targetKey, target)) === null || _a === void 0 ? void 0 : _a.instance;
};
SimstanceManager.prototype.getOrNewSim = function (target) {
if (target) {
var registed = this.getStoreSet(target);
if ((registed === null || registed === void 0 ? void 0 : registed.type) && !(registed === null || registed === void 0 ? void 0 : registed.instance)) {
return this.resolve(target);
}
return newVar;
return registed === null || registed === void 0 ? void 0 : registed.instance;
}
};
SimstanceManager.prototype.getOrNewSims = function (k) {
var _this = this;
var list = new Array(0);
this.storage.forEach(function (value, key, mapObject) {
var sw = false;
if (value && value instanceof k) {
sw = true;
SimstanceManager.prototype.register = function (keyType, regTyps) {
var _a;
var itemMap = (_a = this._storage.get(keyType)) !== null && _a !== void 0 ? _a : new Map();
regTyps.forEach(function (it) {
if (!itemMap.has(it)) {
itemMap.set(it, undefined);
}
else if (key === k || k.isPrototypeOf(key)) {
sw = true;
}
if (sw) {
if (!value) {
value = _this.resolve(key);
}
list.push(value);
}
});
return list;
this._storage.set(keyType, itemMap);
};
SimstanceManager.prototype.register = function (target) {
if (!this._storage.has(target)) {
this._storage.set(target, undefined);
}
SimstanceManager.prototype.set = function (targetKey, obj, target) {
var _a;
if (target === void 0) { target = targetKey; }
var itemMap = (_a = this._storage.get(targetKey)) !== null && _a !== void 0 ? _a : new Map();
itemMap.set(target, obj);
this._storage.set(targetKey, itemMap);
};
SimstanceManager.prototype.set = function (target, obj) {
this._storage.set(target, obj);
};
SimstanceManager.prototype.resolve = function (target) {
SimstanceManager.prototype.resolve = function (targetKey, target) {
var _this = this;
var _a, _b, _c;
var registed = this._storage.get(target);
if (registed) {
return registed;
var _a, _b, _c, _d;
var registed = this.getStoreSet(targetKey, target);
if (registed === null || registed === void 0 ? void 0 : registed.instance) {
return registed.instance;
}
if (this._storage.has(target) && undefined === registed) {
var newSim = this.newSim(target, function (data) { return _this._storage.set(target, data); });
(_a = newSim === null || newSim === void 0 ? void 0 : newSim.onSimCreate) === null || _a === void 0 ? void 0 : _a.call(newSim);
if (this._storage.has(targetKey) && undefined === (registed === null || registed === void 0 ? void 0 : registed.instance)) {
var newSim = this.newSim((_a = registed === null || registed === void 0 ? void 0 : registed.type) !== null && _a !== void 0 ? _a : targetKey, function (data) { return _this.set(targetKey, data, target); });
(_b = newSim === null || newSim === void 0 ? void 0 : newSim.onSimCreate) === null || _b === void 0 ? void 0 : _b.call(newSim);
return newSim;
}
var simNoSuch = new SimNoSuch_1.SimNoSuch('SimNoSuch: no simple instance ' + 'name:' + ((_c = (_b = target === null || target === void 0 ? void 0 : target.prototype) === null || _b === void 0 ? void 0 : _b.constructor) === null || _c === void 0 ? void 0 : _c.name) + ',' + target);
var simNoSuch = new SimNoSuch_1.SimNoSuch('SimNoSuch: no simple instance ' + 'name:' + ((_d = (_c = targetKey === null || targetKey === void 0 ? void 0 : targetKey.prototype) === null || _c === void 0 ? void 0 : _c.constructor) === null || _d === void 0 ? void 0 : _d.name) + ',' + targetKey);
console.error(simNoSuch);

@@ -223,2 +226,6 @@ throw simNoSuch;

var obj = otherStorage === null || otherStorage === void 0 ? void 0 : otherStorage.get(token);
if (token === Array && inject_1.type) {
var p = _this.getStoreSets(inject_1.type).map(function (it) { return _this.resolve(inject_1.type, it.type); });
return p;
}
if (inject_1.situationType && otherStorage) {

@@ -283,4 +290,4 @@ var situations = otherStorage.get(Inject_1.SituationTypeContainers);

});
SimDecorator_1.sims.forEach(function (data) {
_this.register(data);
SimDecorator_1.sims.forEach(function (regTypes, k) {
_this.register(k, regTypes);
});

@@ -287,0 +294,0 @@ this.callBindPostConstruct(this);

import 'reflect-metadata';
import { ConstructorType } from '../../types/Types';
export declare class ReflectUtils {
static getParameterTypes(target: any, propertyKey?: string | symbol): any[];
static getParameterTypes(target: any, propertyKey?: string | symbol): ConstructorType<any>[];
static getReturnType(target: any, propertyKey: string | symbol): any;

@@ -5,0 +6,0 @@ static getType(target: any, propertyKey?: string | symbol): any;

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