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.37 to 1.0.38

5

decorators/SimDecorator.d.ts
import 'reflect-metadata';
import { ConstructorType, GenericClassDecorator } from '../types/Types';
export declare enum Lifecycle {
Singleton = "Singleton",
Transient = "Transient"
}
export declare const sims: Map<ConstructorType<any>, Set<ConstructorType<any>>>;
export interface SimConfig {
scheme?: string;
scope?: Lifecycle;
type?: ConstructorType<any> | ConstructorType<any>[];

@@ -7,0 +12,0 @@ }

12

decorators/SimDecorator.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPostConstruct = exports.PostConstruct = exports.getSim = exports.Sim = exports.SimMetadataKey = exports.sims = void 0;
exports.getPostConstruct = exports.PostConstruct = exports.getSim = exports.Sim = exports.SimMetadataKey = exports.sims = exports.Lifecycle = void 0;
require("reflect-metadata");
var ReflectUtils_1 = require("../utils/reflect/ReflectUtils");
var Lifecycle;
(function (Lifecycle) {
Lifecycle["Singleton"] = "Singleton";
Lifecycle["Transient"] = "Transient";
})(Lifecycle = exports.Lifecycle || (exports.Lifecycle = {}));
exports.sims = new Map();
exports.SimMetadataKey = Symbol('Sim');
var simProcess = function (config, target) {
ReflectUtils_1.ReflectUtils.defineMetadata(exports.SimMetadataKey, {}, target);
var _a;
ReflectUtils_1.ReflectUtils.defineMetadata(exports.SimMetadataKey, config, target);
var adding = function (targetKey, target) {

@@ -17,2 +23,3 @@ var _a;

};
config.scope = (_a = config === null || config === void 0 ? void 0 : config.scope) !== null && _a !== void 0 ? _a : Lifecycle.Singleton;
if (Array.isArray(config === null || config === void 0 ? void 0 : config.type)) {

@@ -31,2 +38,3 @@ config === null || config === void 0 ? void 0 : config.type.forEach(function (it) {

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

@@ -33,0 +41,0 @@ simProcess({}, configOrTarget);

2

package.json
{
"name": "simple-boot-core",
"version": "1.0.37",
"version": "1.0.38",
"main": "SimpleApplication.js",

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

@@ -26,3 +26,3 @@ SIMPLE-BOOT-CORE

import {Sim} from 'simple-boot-core/decorators/SimDecorator';
@Sim()
@Sim
class User {

@@ -34,3 +34,3 @@ say() {

@Sim() @Router({ path: '', route: {'/user': User}})
@Sim @Router({ path: '', route: {'/user': User}})
class AppRouter {}

@@ -74,3 +74,3 @@

```typescript
@Sim()
@Sim
class ProjectService {

@@ -82,3 +82,3 @@ sum(x: number, y: number) {

@Sim()
@Sim
class User {

@@ -104,3 +104,3 @@

```typescript
@Sim()
@Sim
class User implements OnSimCreate {

@@ -126,3 +126,3 @@ onSimCreate(): void {

```typescript
@Sim()
@Sim
class User {

@@ -159,3 +159,3 @@

```typescript
@Sim()
@Sim
class User {

@@ -201,3 +201,3 @@

```typescript
@Sim()
@Sim
class GlobalAdvice {

@@ -215,3 +215,3 @@ @ExceptionHandler()

@Sim()
@Sim
class User {

@@ -253,3 +253,3 @@ say1() {

```typescript
@Sim()
@Sim
@Router({

@@ -271,3 +271,3 @@ path: '',

```typescript
@Sim()
@Sim
@Router({

@@ -303,3 +303,3 @@ path: '',

```typescript
@Sim()
@Sim
@Router({

@@ -306,0 +306,0 @@ path: ''

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

var ReflectUtils_1 = require("../utils/reflect/ReflectUtils");
var FunctionUtils_1 = require("../utils/function/FunctionUtils");
var Inject_1 = require("../decorators/inject/Inject");

@@ -78,6 +77,13 @@ var SimOption_1 = require("../SimOption");

var _this = this;
return Array.from(this._storage.keys()).map(function (it) { return new SimAtomic_1.SimAtomic(it, _this); });
var r = [];
Array.from(this._storage.values()).forEach(function (it) {
r.push.apply(r, Array.from(Array.from(it.keys())).map(function (sit) { return new SimAtomic_1.SimAtomic(sit, _this); }));
});
return r;
};
SimstanceManager.prototype.getSimConfig = function (scheme) {
var newVar = this.getSimAtomics().filter(function (it) { var _a; return scheme && it && scheme === ((_a = it === null || it === void 0 ? void 0 : it.getConfig()) === null || _a === void 0 ? void 0 : _a.scheme); }) || [];
var newVar = this.getSimAtomics().filter(function (it) {
var _a;
return scheme && it && scheme === ((_a = it === null || it === void 0 ? void 0 : it.getConfig()) === null || _a === void 0 ? void 0 : _a.scheme);
}) || [];
return newVar;

@@ -145,3 +151,8 @@ };

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); });
var newSim = this.newSim((_a = registed === null || registed === void 0 ? void 0 : registed.type) !== null && _a !== void 0 ? _a : targetKey, function (data) {
var _a, _b, _c;
if (((_c = (0, SimDecorator_1.getSim)((_b = (_a = registed === null || registed === void 0 ? void 0 : registed.type) !== null && _a !== void 0 ? _a : target) !== null && _b !== void 0 ? _b : targetKey)) === null || _c === void 0 ? void 0 : _c.scope) === SimDecorator_1.Lifecycle.Singleton) {
_this.set(targetKey, data, target);
}
});
(_b = newSim === null || newSim === void 0 ? void 0 : newSim.onSimCreate) === null || _b === void 0 ? void 0 : _b.call(newSim);

@@ -207,3 +218,2 @@ return newSim;

var paramTypes = ReflectUtils_1.ReflectUtils.getParameterTypes(target, targetKey);
var paramNames = FunctionUtils_1.FunctionUtils.getParameterNames(target, targetKey);
var injections = [];

@@ -228,4 +238,10 @@ var injects = (0, Inject_1.getInject)(target, targetKey);

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); });
if (token === Array && (inject_1.type || inject_1.scheme)) {
var p = [];
if (inject_1.type) {
p.push.apply(p, _this.getStoreSets(inject_1.type).map(function (it) { return _this.resolve(inject_1.type, it.type); }).reverse());
}
if (inject_1.scheme) {
p.push.apply(p, _this.getSimConfig(inject_1.scheme).map(function (it) { return it.value; }));
}
return p;

@@ -263,2 +279,3 @@ }

}
return undefined;
});

@@ -265,0 +282,0 @@ return injections;

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