@fabalous/runtime-node
Advanced tools
Comparing version 0.0.8 to 0.0.9
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
@@ -13,4 +14,3 @@ var FabaEvent_1 = require("@fabalous/core/FabaEvent"); | ||
}(FabaEvent_1.default)); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = FabaAddNodeMediatorEvent; | ||
//# sourceMappingURL=FabaAddNodeMediatorEvent.js.map |
import FabaCoreCommand from "@fabalous/core/FabaCoreCommand"; | ||
import FabaEvent from "@fabalous/core/FabaEvent"; | ||
/** | ||
* Created by creativecode on 30.12.16. | ||
*/ | ||
export declare class FabaNodeCommand<TStore> extends FabaCoreCommand<TStore> { | ||
@@ -7,0 +4,0 @@ emitToUser(event: FabaEvent, user?: any): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var FabaCoreCommand_1 = require("@fabalous/core/FabaCoreCommand"); | ||
/** | ||
* Created by creativecode on 30.12.16. | ||
*/ | ||
var FabaNodeCommand = (function (_super) { | ||
tslib_1.__extends(FabaNodeCommand, _super); | ||
function FabaNodeCommand() { | ||
return _super.apply(this, arguments) || this; | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
@@ -12,0 +10,0 @@ FabaNodeCommand.prototype.emitToUser = function (event, user) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
@@ -7,3 +8,3 @@ var FabaCoreMediator_1 = require("@fabalous/core/FabaCoreMediator"); | ||
function FabaNodeMediator() { | ||
return _super.apply(this, arguments) || this; | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
@@ -10,0 +11,0 @@ FabaNodeMediator.prototype.addCommand = function (event, command) { |
import { Application } from "express/lib/application"; | ||
import FabaCore from "@fabalous/core/FabaCore"; | ||
import FabaStore from "@fabalous/core/FabaStore"; | ||
export default class FabaNodeRuntime extends FabaCore { | ||
import FabaStore from "@fabalous/core/store/FabaStore"; | ||
/** | ||
* Runtime class and startpoint for node Project's | ||
* | ||
* Extend this class with your own logic. | ||
* | ||
* Need an store (FabaStore) as argument | ||
*/ | ||
export default class FabaRuntimeNode extends FabaCore { | ||
app: Application; | ||
express: any; | ||
assign: any; | ||
constructor(data: FabaStore<any>); | ||
/** | ||
* Constructor expects an store and register the FabaNodeMediator | ||
* @param store FabaStore which is available for the commands | ||
*/ | ||
constructor(store: FabaStore<any>); | ||
/** | ||
* TODO: Reafactor or delete this? | ||
* | ||
* Parse objects and map it to value objects | ||
* @param obj | ||
* @returns {any} | ||
*/ | ||
parseObject(obj: any): any; | ||
/** | ||
* Start the Webserver to handle all HTTP requests | ||
*/ | ||
private startServer(); | ||
/** | ||
* Get the whole raw body of a request | ||
* @param req | ||
* @param res | ||
* @param next | ||
*/ | ||
private rawBody(req, res, next); | ||
private rawData(req, res, next); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var FabaCore_1 = require("@fabalous/core/FabaCore"); | ||
var FabaEvent_1 = require("@fabalous/core/FabaEvent"); | ||
var FabaNodeRuntime = (function (_super) { | ||
tslib_1.__extends(FabaNodeRuntime, _super); | ||
function FabaNodeRuntime(data) { | ||
var _this = _super.call(this, data) || this; | ||
/** | ||
* Runtime class and startpoint for node Project's | ||
* | ||
* Extend this class with your own logic. | ||
* | ||
* Need an store (FabaStore) as argument | ||
*/ | ||
var FabaRuntimeNode = (function (_super) { | ||
tslib_1.__extends(FabaRuntimeNode, _super); | ||
/** | ||
* Constructor expects an store and register the FabaNodeMediator | ||
* @param store FabaStore which is available for the commands | ||
*/ | ||
function FabaRuntimeNode(store) { | ||
var _this = _super.call(this, store) || this; | ||
_this.express = require('express'); | ||
@@ -17,3 +29,10 @@ _this.assign = require('object.assign').getPolyfill(); | ||
} | ||
FabaNodeRuntime.prototype.parseObject = function (obj) { | ||
/** | ||
* TODO: Reafactor or delete this? | ||
* | ||
* Parse objects and map it to value objects | ||
* @param obj | ||
* @returns {any} | ||
*/ | ||
FabaRuntimeNode.prototype.parseObject = function (obj) { | ||
for (var key in obj) { | ||
@@ -34,3 +53,6 @@ if (obj[key] != null && obj[key].className != null) { | ||
}; | ||
FabaNodeRuntime.prototype.startServer = function () { | ||
/** | ||
* Start the Webserver to handle all HTTP requests | ||
*/ | ||
FabaRuntimeNode.prototype.startServer = function () { | ||
var _this = this; | ||
@@ -64,5 +86,3 @@ this.app.use(function (req, res, next) { | ||
} | ||
var h = _this.assign(targetEvent, JSON.parse(req.rawBody)); | ||
h = _this.parseObject(h); | ||
h.dispatch().then(function (event) { | ||
_this.parseObject(_this.assign(targetEvent, body)).dispatch().then(function (event) { | ||
try { | ||
@@ -79,3 +99,9 @@ res.send(JSON.stringify(event)); | ||
}; | ||
FabaNodeRuntime.prototype.rawBody = function (req, res, next) { | ||
/** | ||
* Get the whole raw body of a request | ||
* @param req | ||
* @param res | ||
* @param next | ||
*/ | ||
FabaRuntimeNode.prototype.rawBody = function (req, res, next) { | ||
req.setEncoding('utf8'); | ||
@@ -90,16 +116,5 @@ req.rawBody = ''; | ||
}; | ||
FabaNodeRuntime.prototype.rawData = function (req, res, next) { | ||
req.setEncoding('utf8'); | ||
req.rawBody = ''; | ||
req.on('data', function (chunk) { | ||
req.rawBody += chunk; | ||
}); | ||
req.on('end', function () { | ||
next(); | ||
}); | ||
}; | ||
return FabaNodeRuntime; | ||
return FabaRuntimeNode; | ||
}(FabaCore_1.default)); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = FabaNodeRuntime; | ||
exports.default = FabaRuntimeNode; | ||
//# sourceMappingURL=FabaNodeRuntime.js.map |
{ | ||
"name": "@fabalous/runtime-node", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Fabalous Node runtime", | ||
@@ -10,3 +10,2 @@ "scripts": { | ||
"cleanSrc": "find . -name '*.js' -type f -delete", | ||
"install": "cp -Rf ./lib/* ./ && rm -r ./lib", | ||
"test": "jest --no-cache --watch" | ||
@@ -31,13 +30,12 @@ }, | ||
"dependencies": { | ||
"express": "^4.14.0", | ||
"socket.io": "^1.7.2", | ||
"source-map-support": "^0.4.8", | ||
"express": "^4.15.2", | ||
"socket.io": "^1.7.3", | ||
"source-map-support": "^0.4.14", | ||
"tracer": "^0.8.7" | ||
}, | ||
"devDependencies": { | ||
"@fabalous/core": "^0.2.37", | ||
"jasmine": "^2.5.2", | ||
"jest": "^18.0.0", | ||
"jest-cli": "^18.0.0", | ||
"ts-jest": "^18.0.0" | ||
"@fabalous/core": "^0.2.58", | ||
"jest": "^19.0.2", | ||
"jest-cli": "^19.0.2", | ||
"ts-jest": "^19.0.8" | ||
}, | ||
@@ -44,0 +42,0 @@ "jest": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
4
0
17088
16
333
2
Updatedexpress@^4.15.2
Updatedsocket.io@^1.7.3
Updatedsource-map-support@^0.4.14