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.38 to 1.0.39

route/RouteFilter.d.ts

3

decorators/exception/ExceptionDecorator.d.ts
import 'reflect-metadata';
import { ConstructorType, ReflectMethod } from '../../types/Types';
export declare enum ExceptionHandlerSituationType {
ERROR_OBJECT = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT"
ERROR_OBJECT = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT",
PARAMETER = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER"
}

@@ -6,0 +7,0 @@ export declare type ExceptionHandlerConfig = {

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

ExceptionHandlerSituationType["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
ExceptionHandlerSituationType["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
})(ExceptionHandlerSituationType = exports.ExceptionHandlerSituationType || (exports.ExceptionHandlerSituationType = {}));

@@ -12,0 +13,0 @@ var ExceptionHandlerMetadataKey = Symbol('ExceptionHandler');

@@ -20,2 +20,3 @@ import 'reflect-metadata';

containers: SituationTypeContainer[];
constructor(containers?: SituationTypeContainer[]);
push(...item: SituationTypeContainer[]): void;

@@ -22,0 +23,0 @@ get length(): number;

@@ -21,4 +21,8 @@ "use strict";

var SituationTypeContainers = (function () {
function SituationTypeContainers() {
function SituationTypeContainers(containers) {
var _a;
this.containers = [];
if (containers) {
(_a = this.containers).push.apply(_a, containers);
}
}

@@ -25,0 +29,0 @@ SituationTypeContainers.prototype.push = function () {

import { ConstructorType, GenericClassDecorator, ReflectMethod } from '../../types/Types';
import { RouteFilter } from '../../route/RouteFilter';
export declare type Filterss = (RouteFilter | ConstructorType<RouteFilter>)[];
export declare type Filters = RouteFilter | ConstructorType<RouteFilter> | Filterss;
export declare type RoteAndFilter = {
filters: Filters;
target: ConstructorType<Object>;
};
export declare type RouteTargetMethod = {
target: ConstructorType<Object>;
propertyKeys: (string | symbol)[];
filters?: Filterss;
};
export declare type RouteProperty = ConstructorType<Object> | [ConstructorType<Object>, any] | RouteTargetMethod | string;
export declare type RouteProperty = ConstructorType<Object> | RoteAndFilter | [ConstructorType<Object> | RoteAndFilter, any] | RouteTargetMethod | string;
export declare type Route = {

@@ -14,2 +22,3 @@ [name: string]: RouteProperty;

routers?: ConstructorType<Object>[];
filters?: Filters;
}

@@ -22,2 +31,3 @@ export declare const RouterMetadataKey: unique symbol;

path: string | string[];
filters?: Filters;
};

@@ -24,0 +34,0 @@ export declare type SaveRouteConfig = {

@@ -10,3 +10,4 @@ "use strict";

var _a;
config.route = ((_a = config.route) !== null && _a !== void 0 ? _a : {});
var _b, _c;
config.route = ((_b = config.route) !== null && _b !== void 0 ? _b : {});
var paths = Array.isArray(it.config.path) ? it.config.path : [it.config.path];

@@ -16,6 +17,14 @@ for (var _i = 0, paths_1 = paths; _i < paths_1.length; _i++) {

if (config.route[path]) {
config.route[path].propertyKeys.push(it.propertyKey);
var route = config.route[path];
route.propertyKeys.push(it.propertyKey);
route.filters = (_c = route.filters) !== null && _c !== void 0 ? _c : [];
if (Array.isArray(it.config.filters)) {
(_a = route.filters).push.apply(_a, it.config.filters);
}
else if (it.config.filters) {
route.filters.push(it.config.filters);
}
}
else {
config.route[path] = { target: target, propertyKeys: [it.propertyKey] };
config.route[path] = { target: target, propertyKeys: [it.propertyKey], filters: it.config.filters };
}

@@ -22,0 +31,0 @@ }

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

function Sim(configOrTarget) {
console.log('SimSim ', configOrTarget, typeof configOrTarget === 'function');
if (typeof configOrTarget === 'function') {

@@ -40,0 +39,0 @@ simProcess({}, configOrTarget);

@@ -10,2 +10,3 @@ export declare enum PublishType {

publishType?: PublishType;
sessionData: Map<string, any>;
constructor(uri: string, data?: T | undefined, event?: E | undefined);

@@ -12,0 +13,0 @@ get scheme(): string;

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

this.event = event;
this.sessionData = new Map();
}

@@ -16,0 +17,0 @@ Object.defineProperty(Intent.prototype, "scheme", {

{
"name": "simple-boot-core",
"version": "1.0.38",
"version": "1.0.39",
"main": "SimpleApplication.js",

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

@@ -9,3 +9,3 @@ import { SimstanceManager } from '../simstance/SimstanceManager';

set(obj: any, prop: string, value: any, receiver: any): boolean;
apply(target: Function, thisArg: any, argumentsList?: any): any;
apply(target: Function, thisArg: any, argumentsList?: any[]): any;
private executeExceptionHandler;

@@ -12,0 +12,0 @@ private getExceptionHandler;

@@ -43,4 +43,11 @@ "use strict";

this.aopBefore(thisArg, target);
r = target.apply(thisArg, argumentsList);
this.aopAfter(thisArg, target);
try {
r = target.apply(thisArg, argumentsList);
}
catch (e) {
throw e;
}
finally {
this.aopAfter(thisArg, target);
}
}

@@ -52,3 +59,3 @@ catch (e) {

var inHandler = inHandlers[0];
this.executeExceptionHandler(e, argumentsList, inHandler);
this.executeExceptionHandler(e, inHandler, argumentsList);
}

@@ -61,14 +68,18 @@ else {

};
SimProxyHandler.prototype.executeExceptionHandler = function (e, argumentsList, inHandler) {
var _a, _b;
SimProxyHandler.prototype.executeExceptionHandler = function (e, inHandler, argumentsList) {
var _a;
var otherStorage = new Map();
otherStorage.set(e.constructor, e);
var situationTypeContainer = new Inject_1.SituationTypeContainer({
var situationErrorTypeContainer = new Inject_1.SituationTypeContainer({
situationType: ExceptionDecorator_1.ExceptionHandlerSituationType.ERROR_OBJECT,
data: e
});
otherStorage.set(Inject_1.SituationTypeContainer, situationTypeContainer);
(_a = argumentsList) === null || _a === void 0 ? void 0 : _a.forEach(function (it) {
otherStorage.set(e.constructor, e);
var situationParameterTypeContainer = new Inject_1.SituationTypeContainer({
situationType: ExceptionDecorator_1.ExceptionHandlerSituationType.PARAMETER,
data: argumentsList
});
otherStorage.set(Inject_1.SituationTypeContainers, new Inject_1.SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
argumentsList === null || argumentsList === void 0 ? void 0 : argumentsList.forEach(function (it) {
otherStorage.set(it.constructor, it);
});
try {

@@ -85,4 +96,4 @@ this.simstanceManager.executeBindParameterSim({

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

@@ -89,0 +100,0 @@ }

@@ -209,5 +209,17 @@ "use strict";

RouterManager.prototype.getExecuteModule = function (router, intent, parentRouters) {
var _this = this;
var path = intent.pathname;
var routerConfig = router.getConfig(Router_1.RouterMetadataKey);
if (routerConfig) {
var filters = [];
if (Array.isArray(routerConfig.filters)) {
filters.push.apply(filters, routerConfig.filters);
}
else if (routerConfig.filters) {
filters.push(routerConfig.filters);
}
var noAccept = filters.some(function (it) { var _a; return ((_a = (typeof it === 'function' ? _this.simstanceManager.getOrNewSim(it) : it)) === null || _a === void 0 ? void 0 : _a.isAccept(intent)) === false; });
if (noAccept) {
return;
}
var routerStrings = parentRouters.slice(1).map(function (it) { var _a; return ((_a = it.getConfig(Router_1.RouterMetadataKey)) === null || _a === void 0 ? void 0 : _a.path) || ''; });

@@ -246,3 +258,3 @@ var isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);

if (pathnameData) {
var _b = this.findRouteProperty(routerData.route, it_1), child = _b.child, data = _b.data, propertyKeys = _b.propertyKeys;
var _b = this.findRouteProperty(routerData.route, it_1, intent), child = _b.child, data = _b.data, propertyKeys = _b.propertyKeys;
var rm = new RouterModule_1.RouterModule(this.simstanceManager, router, child);

@@ -257,3 +269,5 @@ rm.data = data;

};
RouterManager.prototype.findRouteProperty = function (route, propertyName) {
RouterManager.prototype.findRouteProperty = function (route, propertyName, intent) {
var _this = this;
var _a;
var child;

@@ -267,12 +281,44 @@ var data;

else if (typeof routeElement === 'string') {
return this.findRouteProperty(route, routeElement);
return this.findRouteProperty(route, routeElement, intent);
}
else if (Array.isArray(routeElement)) {
child = routeElement === null || routeElement === void 0 ? void 0 : routeElement[0];
var r = routeElement === null || routeElement === void 0 ? void 0 : routeElement[0];
if (typeof r === 'object' && 'filters' in r && 'target' in r) {
var filters = [];
if (Array.isArray(r.filters)) {
filters.push.apply(filters, r.filters);
}
else if (r.filters) {
filters.push(r.filters);
}
var noAccept = filters.some(function (it) { var _a; return ((_a = (typeof it === 'function' ? _this.simstanceManager.getOrNewSim(it) : it)) === null || _a === void 0 ? void 0 : _a.isAccept(intent)) === false; });
if (!noAccept) {
child = r.target;
}
}
else {
child = r;
}
data = routeElement === null || routeElement === void 0 ? void 0 : routeElement[1];
}
else if (typeof routeElement === 'object' && 'target' in routeElement && 'propertyKeys' in routeElement) {
child = routeElement.target;
propertyKeys = routeElement.propertyKeys;
var noAccept = (_a = routeElement.filters) === null || _a === void 0 ? void 0 : _a.filter(function (it) { return it; }).some(function (it) { var _a; return ((_a = (typeof it === 'function' ? _this.simstanceManager.getOrNewSim(it) : it)) === null || _a === void 0 ? void 0 : _a.isAccept(intent)) === false; });
if (!noAccept) {
child = routeElement.target;
propertyKeys = routeElement.propertyKeys;
}
}
else if (typeof routeElement === 'object' && 'filters' in routeElement && 'target' in routeElement) {
var filters = [];
if (Array.isArray(routeElement.filters)) {
filters.push.apply(filters, routeElement.filters);
}
else if (routeElement.filters) {
filters.push(routeElement.filters);
}
var noAccept = filters.some(function (it) { var _a; return ((_a = (typeof it === 'function' ? _this.simstanceManager.getOrNewSim(it) : it)) === null || _a === void 0 ? void 0 : _a.isAccept(intent)) === false; });
if (!noAccept) {
child = routeElement.target;
}
}
return {

@@ -279,0 +325,0 @@ child: child,

@@ -17,3 +17,3 @@ import { ConstructorType } from '../types/Types';

constructor(simstanceManager: SimstanceManager, router?: R | undefined, module?: ConstructorType<M> | undefined, routerChains?: R[]);
getModuleInstance<T = M>(propertyKey?: string | symbol, instanceBind?: boolean | any): T | undefined;
getModuleInstance<T = M>(): T | undefined;
executeModuleProperty(propertyKey: string | symbol, ...param: any[]): any;

@@ -20,0 +20,0 @@ get lastRouteChain(): R;

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