simple-boot-core
Advanced tools
| import { Module } from "../module/Module"; | ||
| import { IntentEvent } from "../intent/IntentEvent"; | ||
| import { ConstructorType } from "../types/Types"; | ||
| import { Intent } from "../intent/Intent"; | ||
| import { RouterModule } from "./RouterModule"; | ||
| export declare class Router implements IntentEvent { | ||
| path: string; | ||
| childs: ConstructorType<Router>[]; | ||
| [name: string]: ConstructorType<Module> | any; | ||
| private _simstanceManager; | ||
| constructor(path?: string, childs?: ConstructorType<Router>[]); | ||
| publish(intent: Intent): void; | ||
| subscribe(intent: Intent): void; | ||
| getExecuteModule(intent: Intent, parentRouters: Router[]): RouterModule | undefined; | ||
| isRootUrl(parentRoots: string[], url: string): boolean; | ||
| routing(parentRoots: string[], path: string): RouterModule | undefined; | ||
| canActivate(url: Intent, module: RouterModule): Promise<ConstructorType<Module> | undefined>; | ||
| notFound(url: Intent): ConstructorType<Module> | undefined; | ||
| } |
+103
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| var __generator = (this && this.__generator) || function (thisArg, body) { | ||
| var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
| return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
| function verb(n) { return function (v) { return step([n, v]); }; } | ||
| function step(op) { | ||
| if (f) throw new TypeError("Generator is already executing."); | ||
| while (_) try { | ||
| if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
| if (y = 0, t) op = [op[0] & 2, t.value]; | ||
| switch (op[0]) { | ||
| case 0: case 1: t = op; break; | ||
| case 4: _.label++; return { value: op[1], done: false }; | ||
| case 5: _.label++; y = op[1]; op = [0]; continue; | ||
| case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
| default: | ||
| if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
| if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
| if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
| if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
| if (t[2]) _.ops.pop(); | ||
| _.trys.pop(); continue; | ||
| } | ||
| op = body.call(thisArg, _); | ||
| } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
| if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
| } | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Router = void 0; | ||
| var SimGlobal_1 = require("../global/SimGlobal"); | ||
| var RouterModule_1 = require("./RouterModule"); | ||
| var Router = (function () { | ||
| function Router(path, childs) { | ||
| if (path === void 0) { path = ''; } | ||
| if (childs === void 0) { childs = []; } | ||
| var _a; | ||
| this.path = path; | ||
| this.childs = childs; | ||
| this._simstanceManager = (_a = SimGlobal_1.SimGlobal().application) === null || _a === void 0 ? void 0 : _a.simstanceManager; | ||
| } | ||
| Router.prototype.publish = function (intent) { | ||
| var _a; | ||
| (_a = SimGlobal_1.SimGlobal().application) === null || _a === void 0 ? void 0 : _a.publishSimIntent(intent); | ||
| }; | ||
| Router.prototype.subscribe = function (intent) { | ||
| }; | ||
| Router.prototype.getExecuteModule = function (intent, parentRouters) { | ||
| var path = intent.pathname; | ||
| var routerStrings = parentRouters.slice(1).map(function (it) { return it.path || ''; }); | ||
| var isRoot = this.isRootUrl(routerStrings, path); | ||
| if (isRoot) { | ||
| parentRouters.push(this); | ||
| var module_1 = this.routing(routerStrings, path); | ||
| if (module_1 === null || module_1 === void 0 ? void 0 : module_1.module) { | ||
| return module_1; | ||
| } | ||
| else { | ||
| for (var _i = 0, _a = this.childs; _i < _a.length; _i++) { | ||
| var child = _a[_i]; | ||
| var route = this._simstanceManager.getOrNewSim(child); | ||
| var executeModule = route === null || route === void 0 ? void 0 : route.getExecuteModule(intent, parentRouters); | ||
| if (route && executeModule) { | ||
| return executeModule; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| Router.prototype.isRootUrl = function (parentRoots, url) { | ||
| return url.startsWith(parentRoots.join('') + (this.path || '')); | ||
| }; | ||
| Router.prototype.routing = function (parentRoots, path) { | ||
| var urlRoot = parentRoots.join('') + this.path; | ||
| var regex = new RegExp('^' + urlRoot, 'i'); | ||
| path = path.replace(regex, ''); | ||
| var fieldModule = this[path]; | ||
| if (fieldModule) { | ||
| return new RouterModule_1.RouterModule(this, fieldModule); | ||
| } | ||
| }; | ||
| Router.prototype.canActivate = function (url, module) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| return [2, module.module]; | ||
| }); | ||
| }); | ||
| }; | ||
| Router.prototype.notFound = function (url) { | ||
| return undefined; | ||
| }; | ||
| return Router; | ||
| }()); | ||
| exports.Router = Router; |
| import 'reflect-metadata'; | ||
| import { SimstanceManager } from "../simstance/SimstanceManager"; | ||
| import { Router } from "./Router"; | ||
| import { Intent } from "../intent/Intent"; | ||
| import { ConstructorType } from "../types/Types"; | ||
| import { RouterModule } from "./RouterModule"; | ||
| export declare class RouterManager { | ||
| private rootRouter; | ||
| private simstanceManager; | ||
| constructor(rootRouter: ConstructorType<Router>, simstanceManager: SimstanceManager); | ||
| routing(intent: Intent): Promise<RouterModule | undefined>; | ||
| } |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| var __generator = (this && this.__generator) || function (thisArg, body) { | ||
| var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
| return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
| function verb(n) { return function (v) { return step([n, v]); }; } | ||
| function step(op) { | ||
| if (f) throw new TypeError("Generator is already executing."); | ||
| while (_) try { | ||
| if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
| if (y = 0, t) op = [op[0] & 2, t.value]; | ||
| switch (op[0]) { | ||
| case 0: case 1: t = op; break; | ||
| case 4: _.label++; return { value: op[1], done: false }; | ||
| case 5: _.label++; y = op[1]; op = [0]; continue; | ||
| case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
| default: | ||
| if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
| if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
| if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
| if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
| if (t[2]) _.ops.pop(); | ||
| _.trys.pop(); continue; | ||
| } | ||
| op = body.call(thisArg, _); | ||
| } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
| if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
| } | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.RouterManager = void 0; | ||
| require("reflect-metadata"); | ||
| var RouterModule_1 = require("./RouterModule"); | ||
| var RouterManager = (function () { | ||
| function RouterManager(rootRouter, simstanceManager) { | ||
| this.rootRouter = rootRouter; | ||
| this.simstanceManager = simstanceManager; | ||
| } | ||
| RouterManager.prototype.routing = function (intent) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| var routers, rootRouter, executeModule, notFound, _i, _a, route, nf, _b; | ||
| return __generator(this, function (_c) { | ||
| switch (_c.label) { | ||
| case 0: | ||
| routers = []; | ||
| rootRouter = this.simstanceManager.getOrNewSim(this.rootRouter); | ||
| executeModule = rootRouter === null || rootRouter === void 0 ? void 0 : rootRouter.getExecuteModule(intent, routers); | ||
| if (!executeModule) { | ||
| notFound = void 0; | ||
| for (_i = 0, _a = routers.slice().reverse(); _i < _a.length; _i++) { | ||
| route = _a[_i]; | ||
| nf = route.notFound(intent); | ||
| if (nf) { | ||
| notFound = nf; | ||
| break; | ||
| } | ||
| } | ||
| notFound = notFound !== null && notFound !== void 0 ? notFound : rootRouter === null || rootRouter === void 0 ? void 0 : rootRouter.notFound(intent); | ||
| return [2, new RouterModule_1.RouterModule(rootRouter, notFound)]; | ||
| } | ||
| if (!executeModule.router) return [3, 2]; | ||
| _b = executeModule; | ||
| return [4, executeModule.router.canActivate(intent, executeModule)]; | ||
| case 1: | ||
| _b.module = _c.sent(); | ||
| return [2, executeModule]; | ||
| case 2: return [2, undefined]; | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
| return RouterManager; | ||
| }()); | ||
| exports.RouterManager = RouterManager; |
| import { Router } from './Router'; | ||
| import { Module } from "../module/Module"; | ||
| import { ConstructorType } from "../types/Types"; | ||
| export declare class RouterModule<R extends Router = Router, M extends Module = Module> { | ||
| router?: R | undefined; | ||
| module?: ConstructorType<M> | undefined; | ||
| constructor(router?: R | undefined, module?: ConstructorType<M> | undefined); | ||
| getModuleInstance<T = any>(): T; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.RouterModule = void 0; | ||
| var SimGlobal_1 = require("../global/SimGlobal"); | ||
| var RouterModule = (function () { | ||
| function RouterModule(router, module) { | ||
| this.router = router; | ||
| this.module = module; | ||
| } | ||
| RouterModule.prototype.getModuleInstance = function () { | ||
| return SimGlobal_1.SimGlobal().application.simstanceManager.getOrNewSim(this.module); | ||
| }; | ||
| return RouterModule; | ||
| }()); | ||
| exports.RouterModule = RouterModule; |
@@ -34,5 +34,5 @@ "use strict"; | ||
| else { | ||
| g; | ||
| return g; | ||
| } | ||
| }; | ||
| exports.SimGlobal = SimGlobal; |
| export declare class Intent<T = any, E = any> { | ||
| uri?: string | undefined; | ||
| uri: string; | ||
| data?: T | undefined; | ||
| event?: E | undefined; | ||
| constructor(uri?: string | undefined, data?: T | undefined, event?: E | undefined); | ||
| get scheme(): string | undefined; | ||
| constructor(uri: string, data?: T | undefined, event?: E | undefined); | ||
| get scheme(): string; | ||
| get paths(): string[]; | ||
| get params(): { | ||
| get fullPath(): string; | ||
| get pathname(): string; | ||
| get query(): string; | ||
| get queryParams(): { | ||
| [key: string]: string; | ||
| }; | ||
| } |
+32
-7
@@ -12,4 +12,3 @@ "use strict"; | ||
| get: function () { | ||
| var _a; | ||
| return (_a = this.uri) === null || _a === void 0 ? void 0 : _a.split('://')[0]; | ||
| return this.uri.split('://')[0]; | ||
| }, | ||
@@ -21,4 +20,4 @@ enumerable: false, | ||
| get: function () { | ||
| var _a, _b, _c; | ||
| return ((_c = (_b = (_a = this.uri) === null || _a === void 0 ? void 0 : _a.split('://')[1]) === null || _b === void 0 ? void 0 : _b.split('/')) !== null && _c !== void 0 ? _c : []).map(function (it) { return it.split('?')[0]; }); | ||
| var _a; | ||
| return ((_a = this.pathname.split('/')) !== null && _a !== void 0 ? _a : []); | ||
| }, | ||
@@ -28,7 +27,33 @@ enumerable: false, | ||
| }); | ||
| Object.defineProperty(Intent.prototype, "params", { | ||
| Object.defineProperty(Intent.prototype, "fullPath", { | ||
| get: function () { | ||
| var _a, _b, _c, _d; | ||
| var _a; | ||
| var paths = this.uri.split('://'); | ||
| return (_a = paths[paths.length >= 2 ? 1 : 0]) !== null && _a !== void 0 ? _a : ''; | ||
| }, | ||
| enumerable: false, | ||
| configurable: true | ||
| }); | ||
| Object.defineProperty(Intent.prototype, "pathname", { | ||
| get: function () { | ||
| var paths = this.fullPath.split('?'); | ||
| return paths[0]; | ||
| }, | ||
| enumerable: false, | ||
| configurable: true | ||
| }); | ||
| Object.defineProperty(Intent.prototype, "query", { | ||
| get: function () { | ||
| var _a; | ||
| var paths = this.fullPath.split('?'); | ||
| return (_a = paths[1]) !== null && _a !== void 0 ? _a : ''; | ||
| }, | ||
| enumerable: false, | ||
| configurable: true | ||
| }); | ||
| Object.defineProperty(Intent.prototype, "queryParams", { | ||
| get: function () { | ||
| var _a; | ||
| var param = {}; | ||
| (_d = (_c = (_b = (_a = this.uri) === null || _a === void 0 ? void 0 : _a.split('://')[1]) === null || _b === void 0 ? void 0 : _b.split('?')[1]) === null || _c === void 0 ? void 0 : _c.split('&')) === null || _d === void 0 ? void 0 : _d.forEach(function (it) { | ||
| (_a = this.query.split('&')) === null || _a === void 0 ? void 0 : _a.forEach(function (it) { | ||
| var a = it.split('='); | ||
@@ -35,0 +60,0 @@ param[a[0]] = a[1]; |
| import 'reflect-metadata'; | ||
| import { Subject } from 'rxjs'; | ||
| import { Intent } from './Intent'; | ||
| import { SimstanceManager } from '../simstance/SimstanceManager'; | ||
| import { Runnable } from '../run/Runnable'; | ||
| export declare class IntentManager implements Runnable { | ||
| export declare class IntentManager { | ||
| simstanceManager: SimstanceManager; | ||
| subject: Subject<Intent<any, any>>; | ||
| constructor(simstanceManager: SimstanceManager); | ||
| onNext(intent: Intent): void; | ||
| run(): void; | ||
| private extracted; | ||
| publish(it: Intent): void; | ||
| } |
+23
-33
@@ -5,43 +5,33 @@ "use strict"; | ||
| require("reflect-metadata"); | ||
| var rxjs_1 = require("rxjs"); | ||
| var IntentManager = (function () { | ||
| function IntentManager(simstanceManager) { | ||
| this.simstanceManager = simstanceManager; | ||
| this.subject = new rxjs_1.Subject(); | ||
| } | ||
| IntentManager.prototype.onNext = function (intent) { | ||
| this.subject.next(intent); | ||
| }; | ||
| IntentManager.prototype.run = function () { | ||
| IntentManager.prototype.publish = function (it) { | ||
| var _this = this; | ||
| this.subject.subscribe(function (it) { | ||
| var _a; | ||
| (_a = _this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getSimConfig(it.scheme).forEach(function (data) { | ||
| _this.extracted(data.type, it); | ||
| }); | ||
| }); | ||
| }; | ||
| IntentManager.prototype.extracted = function (key, it) { | ||
| var _a, _b; | ||
| var orNewSim = (_a = this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getOrNewSim(key); | ||
| if (orNewSim) { | ||
| if (it.paths.length > 0) { | ||
| var callthis_1 = orNewSim; | ||
| var lastProp_1 = ''; | ||
| it.paths.filter(function (i) { return i; }).forEach(function (i) { | ||
| callthis_1 = orNewSim; | ||
| orNewSim = orNewSim === null || orNewSim === void 0 ? void 0 : orNewSim[i]; | ||
| lastProp_1 = i; | ||
| }); | ||
| if (orNewSim && typeof orNewSim === 'function') { | ||
| orNewSim.call(callthis_1, it); | ||
| var _a; | ||
| (_a = this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getSimConfig(it.scheme).forEach(function (data) { | ||
| var _a, _b; | ||
| var orNewSim = (_a = _this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getOrNewSim(data.type); | ||
| if (orNewSim) { | ||
| if (it.paths.length > 0) { | ||
| var callthis_1 = orNewSim; | ||
| var lastProp_1 = ''; | ||
| it.paths.filter(function (i) { return i; }).forEach(function (i) { | ||
| callthis_1 = orNewSim; | ||
| orNewSim = orNewSim === null || orNewSim === void 0 ? void 0 : orNewSim[i]; | ||
| lastProp_1 = i; | ||
| }); | ||
| if (orNewSim && typeof orNewSim === 'function') { | ||
| orNewSim.call(callthis_1, it); | ||
| } | ||
| else if (orNewSim) { | ||
| callthis_1[lastProp_1] = it.data; | ||
| } | ||
| } | ||
| else if (orNewSim) { | ||
| callthis_1[lastProp_1] = it.data; | ||
| else { | ||
| (_b = orNewSim === null || orNewSim === void 0 ? void 0 : orNewSim.subscribe) === null || _b === void 0 ? void 0 : _b.call(orNewSim, it); | ||
| } | ||
| } | ||
| else { | ||
| (_b = orNewSim === null || orNewSim === void 0 ? void 0 : orNewSim.subscribe) === null || _b === void 0 ? void 0 : _b.call(orNewSim, it); | ||
| } | ||
| } | ||
| }); | ||
| }; | ||
@@ -48,0 +38,0 @@ return IntentManager; |
+1
-1
@@ -19,3 +19,3 @@ "use strict"; | ||
| var _a; | ||
| (_a = SimGlobal_1.SimGlobal().application) === null || _a === void 0 ? void 0 : _a.intentManager.onNext(intent); | ||
| (_a = SimGlobal_1.SimGlobal().application) === null || _a === void 0 ? void 0 : _a.publishSimIntent(intent); | ||
| }; | ||
@@ -22,0 +22,0 @@ Module.prototype.subscribe = function (intent) { |
+1
-1
| { | ||
| "name": "simple-boot-core", | ||
| "version": "1.0.5", | ||
| "version": "1.0.6", | ||
| "main": "SimpleApplication.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
| import { Runnable } from './run/Runnable'; | ||
| import { SimstanceManager } from "./simstance/SimstanceManager"; | ||
| import { SimOption } from "./SimOption"; | ||
| import { IntentManager } from "./intent/IntentManager"; | ||
| import { Intent } from "./intent/Intent"; | ||
| import { Router } from "./route/Router"; | ||
| import { Module } from "./module/Module"; | ||
| import { ConstructorType } from "./types/Types"; | ||
| import { RouterModule } from "./route/RouterModule"; | ||
| export declare class SimpleApplication implements Runnable { | ||
| rootRouter: ConstructorType<Router>; | ||
| option: SimOption; | ||
| simstanceManager: SimstanceManager; | ||
| intentManager: IntentManager; | ||
| constructor(option: SimOption); | ||
| private intentManager; | ||
| private routerManager; | ||
| constructor(rootRouter: ConstructorType<Router>, option?: SimOption); | ||
| run(): void; | ||
| publishIntent(i: Intent): void; | ||
| routing<R extends Router = Router, M extends Module = Module>(i: Intent): Promise<RouterModule<R, M>>; | ||
| } |
+58
-2
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| var __generator = (this && this.__generator) || function (thisArg, body) { | ||
| var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
| return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
| function verb(n) { return function (v) { return step([n, v]); }; } | ||
| function step(op) { | ||
| if (f) throw new TypeError("Generator is already executing."); | ||
| while (_) try { | ||
| if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
| if (y = 0, t) op = [op[0] & 2, t.value]; | ||
| switch (op[0]) { | ||
| case 0: case 1: t = op; break; | ||
| case 4: _.label++; return { value: op[1], done: false }; | ||
| case 5: _.label++; y = op[1]; op = [0]; continue; | ||
| case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
| default: | ||
| if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
| if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
| if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
| if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
| if (t[2]) _.ops.pop(); | ||
| _.trys.pop(); continue; | ||
| } | ||
| op = body.call(thisArg, _); | ||
| } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
| if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
| } | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,8 +42,13 @@ exports.SimpleApplication = void 0; | ||
| var SimstanceManager_1 = require("./simstance/SimstanceManager"); | ||
| var SimOption_1 = require("./SimOption"); | ||
| var IntentManager_1 = require("./intent/IntentManager"); | ||
| var RouterManager_1 = require("./route/RouterManager"); | ||
| var SimpleApplication = (function () { | ||
| function SimpleApplication(option) { | ||
| function SimpleApplication(rootRouter, option) { | ||
| if (option === void 0) { option = new SimOption_1.SimOption(); } | ||
| this.rootRouter = rootRouter; | ||
| this.option = option; | ||
| this.simstanceManager = new SimstanceManager_1.SimstanceManager(option); | ||
| this.intentManager = new IntentManager_1.IntentManager(this.simstanceManager); | ||
| this.routerManager = new RouterManager_1.RouterManager(this.rootRouter, this.simstanceManager); | ||
| SimGlobal_1.SimGlobal().application = this; | ||
@@ -17,6 +58,21 @@ } | ||
| this.simstanceManager.run(); | ||
| this.intentManager.run(); | ||
| }; | ||
| SimpleApplication.prototype.publishIntent = function (i) { | ||
| return this.intentManager.publish(i); | ||
| }; | ||
| SimpleApplication.prototype.routing = function (i) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| var promise; | ||
| return __generator(this, function (_a) { | ||
| switch (_a.label) { | ||
| case 0: return [4, this.routerManager.routing(i)]; | ||
| case 1: | ||
| promise = _a.sent(); | ||
| return [2, promise]; | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
| return SimpleApplication; | ||
| }()); | ||
| exports.SimpleApplication = SimpleApplication; |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
79544
25.56%70
9.38%1829
20.97%