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.20 to 1.0.21

4

decorators/SimDecorator.d.ts

@@ -7,6 +7,6 @@ import { ConstructorType, GenericClassDecorator } from '../types/Types';

path: string;
childs: {
route: {
[name: string]: ConstructorType<Object>;
};
childRouters?: ConstructorType<Object>[];
routers?: ConstructorType<Object>[];
}

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

{
"name": "simple-boot-core",
"version": "1.0.20",
"version": "1.0.21",
"main": "SimpleApplication.js",

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

@@ -11,6 +11,10 @@ SIMPLE-BOOT-CORE

simpleApplication.run();
simpleApplication.routing<CustomRouter, CustomModule>(new Intent('/b')).then(it => {
let moduleInstance = it.getModuleInstance<B>();
const url = '/users/d51515dd';
simpleApplication.routing<SimAtomic<any>, any>(new Intent(url)).then(it => {
console.log('--->', it.pathData);
let moduleInstance = it.getModuleInstance<User>();
moduleInstance.print();
console.log('-22->', moduleInstance);
});
```

@@ -21,33 +25,91 @@

import { A } from './A';
import { B } from './B';
import { Router, RouterConfig, Sim, SimConfig } from 'simple-boot-core/decorators/SimDecorator';
import { Intent } from 'simple-boot-core/intent/Intent';
import { ConstructorType } from 'simple-boot-core/types/Types';
import { UserRouter } from './users/UserRouter';
@Sim()
export class AppRouter extends CustomRouter {
'' = A;
'/' = A;
'/b' = B;
notFound(url: Intent): ConstructorType<Module> | undefined {
return super.notFound(url);
@Router({
route: {
'': A,
'/': A,
'/b': B,
'/b/:aa/vv': B
},
path: '',
routers: [UserRouter]
})
export class AppRouter {
constructor() {
}
notFound(url: Intent): ConstructorType<Object> | undefined {
console.log('notfound--->');
return undefined
}
}
```
```typescript
import {Sim} from "simple-boot-core/decorators/SimDecorator";
import {Intent} from "simple-boot-core/intent/Intent";
import {CustomModule} from "./CustomModule";
@Sim({scheme: 'A'})
export class A extends CustomModule {
constructor() {
super();
console.log('--->aA')
}
print(){
console.log('print')
}
gogo(intent: Intent) {
console.log('gogogo', intent);
}
}
import {Sim} from "simple-boot-core/decorators/SimDecorator";
import {A} from "./A";
import {UserNotFound} from "./exceptions/UserNotFound";
import {Intent} from "simple-boot-core/intent/Intent";
import {CustomSimOption} from "./CustomSimOption";
import {CustomModule} from "./CustomModule";
import {RouterManager} from "simple-boot-core/route/RouterManager";
import {SimstanceManager} from "simple-boot-core/simstance/SimstanceManager";
```
```typescript
@Sim()
export class B extends CustomModule {
constructor(private a: A, private option: CustomSimOption) {
constructor(private a: A, private option: CustomSimOption, private routerManager: RouterManager, private simstanceManager: SimstanceManager) {
super();
}
print() {
this.a.print();
console.log('bbb print')
console.log('bbb print', this.routerManager.activeRouterModule.pathData.aa)
}
err() {
this.publish(new Intent('A://gogo?a=55', 'ddddddddddd'));
this.publish(new Intent('A://gogo?bb=44&ff=44', '444'));
this.publish(new Intent('A://gogo?gg=55&sadfsdf=444', '55'));
// this.publish(new Intent('A://gogo?a=55', 'ddddddddddd'));
// this.publish(new Intent('A://gogo?bb=44&ff=44', '444'));
// this.publish(new Intent('A://gogo?gg=55&sadfsdf=444', '55'));
throw new UserNotFound('good');
}
}
```

@@ -94,4 +94,4 @@ "use strict";

}
else if (routerConfig.childRouters && routerConfig.childRouters.length > 0) {
for (var _i = 0, _a = routerConfig.childRouters; _i < _a.length; _i++) {
else if (routerConfig.routers && routerConfig.routers.length > 0) {
for (var _i = 0, _a = routerConfig.routers; _i < _a.length; _i++) {
var child = _a[_i];

@@ -116,7 +116,7 @@ var routerAtomic = new SimAtomic_1.SimAtomic(child);

var regex = new RegExp('^' + urlRoot, 'i');
for (var _i = 0, _a = Object.keys(routerData.childs).filter(function (it) { return !it.startsWith('_'); }); _i < _a.length; _i++) {
for (var _i = 0, _a = Object.keys(routerData.route).filter(function (it) { return !it.startsWith('_'); }); _i < _a.length; _i++) {
var it_1 = _a[_i];
var pathnameData = intent.getPathnameData(urlRoot + it_1);
if (pathnameData) {
var rm = new RouterModule_1.RouterModule(router, routerData.childs[it_1]);
var rm = new RouterModule_1.RouterModule(router, routerData.route[it_1]);
rm.pathData = pathnameData;

@@ -123,0 +123,0 @@ return rm;

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