update to latest standards

This commit is contained in:
Philipp Kunz 2017-07-07 22:02:19 +02:00
parent f34358db81
commit 02065e36a6
31 changed files with 1613 additions and 810 deletions

View File

@ -1,20 +1,31 @@
image: hosttoday/ht-docker-node:npmts
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- test
- release
- trigger
- pages
testLEGACY:
stage: test
script:
- npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
@ -22,15 +33,40 @@ testSTABLE:
stage: test
script:
- npmci test stable
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
environment: npmjs-com_registry
script:
- npmci publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
script:
- npmci command yarn global add npmpage
- npmci command npmpage
tags:
- docker
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

10
dist/index.d.ts vendored
View File

@ -1,5 +1,5 @@
export * from "./smartsocket.classes.smartsocket";
export * from "./smartsocket.classes.smartsocketclient";
export * from "./smartsocket.classes.socketfunction";
export * from "./smartsocket.classes.socketrole";
export * from "./smartsocket.classes.socketconnection";
export * from './smartsocket.classes.smartsocket';
export * from './smartsocket.classes.smartsocketclient';
export * from './smartsocket.classes.socketfunction';
export * from './smartsocket.classes.socketrole';
export * from './smartsocket.classes.socketconnection';

3
dist/index.js vendored
View File

@ -2,6 +2,7 @@
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
// export main classes
__export(require("./smartsocket.classes.smartsocket"));
__export(require("./smartsocket.classes.smartsocketclient"));
@ -10,4 +11,4 @@ __export(require("./smartsocket.classes.socketfunction"));
__export(require("./smartsocket.classes.socketrole"));
__export(require("./smartsocket.classes.socketconnection"));
// need something more exposed? Create an issue on GitLab!
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBRUEsc0JBQXNCO0FBQ3RCLGlCQUFjLG1DQUFtQyxDQUFDLEVBQUE7QUFDbEQsaUJBQWMseUNBQXlDLENBQUMsRUFBQTtBQUV4RCxxQ0FBcUM7QUFDckMsaUJBQWMsc0NBQXNDLENBQUMsRUFBQTtBQUNyRCxpQkFBYyxrQ0FBa0MsQ0FBQyxFQUFBO0FBQ2pELGlCQUFjLHdDQUF3QyxDQUFDLEVBQUE7QUFFdkQsMERBQTBEIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUVBLHNCQUFzQjtBQUN0Qix1REFBaUQ7QUFDakQsNkRBQXVEO0FBRXZELHFDQUFxQztBQUNyQywwREFBb0Q7QUFDcEQsc0RBQWdEO0FBQ2hELDREQUFzRDtBQUV0RCwwREFBMEQifQ==

View File

@ -1,9 +1,7 @@
/// <reference types="socket.io" />
/// <reference types="q" />
import * as plugins from "./smartsocket.plugins";
import { Objectmap } from "lik";
import { SocketConnection } from "./smartsocket.classes.socketconnection";
import { SocketRole } from "./smartsocket.classes.socketrole";
import { Objectmap } from 'lik';
import { SocketConnection } from './smartsocket.classes.socketconnection';
import { SocketRole } from './smartsocket.classes.socketrole';
export interface ISmartsocketConstructorOptions {
port: number;
}
@ -13,10 +11,6 @@ export declare class Smartsocket {
openSockets: Objectmap<SocketConnection>;
socketRoles: Objectmap<SocketRole>;
constructor(optionsArg: ISmartsocketConstructorOptions);
/**
* the standard handler for new socket connections
*/
private _handleSocketConnection(socketArg);
/**
* starts listening to incling sockets:
*/
@ -25,9 +19,13 @@ export declare class Smartsocket {
/**
* allows call to specific client.
*/
clientCall(functionNameArg: string, dataArg: any, targetSocketConnectionArg: SocketConnection): plugins.q.Promise<{}>;
clientCall(functionNameArg: string, dataArg: any, targetSocketConnectionArg: SocketConnection): Promise<{}>;
/**
* adds socketRoles
*/
addSocketRoles(socketRolesArray: SocketRole[]): void;
/**
* the standard handler for new socket connections
*/
private _handleSocketConnection(socketArg);
}

View File

@ -1,10 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsocket.plugins");
// classes
const lik_1 = require("lik");
const smartsocket_classes_socketconnection_1 = require("./smartsocket.classes.socketconnection");
const smartsocket_classes_socketrequest_1 = require("./smartsocket.classes.socketrequest");
;
class Smartsocket {
constructor(optionsArg) {
this.openSockets = new lik_1.Objectmap();
@ -14,7 +14,7 @@ class Smartsocket {
*/
this.startServer = () => {
this.io = plugins.socketIo(this.options.port);
this.io.on("connection", (socketArg) => {
this.io.on('connection', (socketArg) => {
this._handleSocketConnection(socketArg);
});
};
@ -28,38 +28,14 @@ class Smartsocket {
};
this.options = optionsArg;
}
;
/**
* the standard handler for new socket connections
*/
_handleSocketConnection(socketArg) {
let socketConnection = new smartsocket_classes_socketconnection_1.SocketConnection({
alias: undefined,
authenticated: false,
role: undefined,
side: "server",
smartsocketHost: this,
socket: socketArg
});
plugins.beautylog.log("Socket connected. Trying to authenticate...");
this.openSockets.add(socketConnection);
socketConnection.authenticate()
.then(() => {
return socketConnection.listenToFunctionRequests();
})
.catch((err) => {
console.log(err);
});
}
;
// communication
/**
* allows call to specific client.
*/
clientCall(functionNameArg, dataArg, targetSocketConnectionArg) {
let done = plugins.q.defer();
let done = plugins.smartq.defer();
let socketRequest = new smartsocket_classes_socketrequest_1.SocketRequest({
side: "requesting",
side: 'requesting',
originSocketConnection: targetSocketConnectionArg,
shortId: plugins.shortid.generate(),
funcCallData: {
@ -73,7 +49,6 @@ class Smartsocket {
});
return done.promise;
}
;
/**
* adds socketRoles
*/
@ -81,10 +56,30 @@ class Smartsocket {
for (let socketRole of socketRolesArray) {
this.socketRoles.add(socketRole);
}
;
return;
}
;
/**
* the standard handler for new socket connections
*/
_handleSocketConnection(socketArg) {
let socketConnection = new smartsocket_classes_socketconnection_1.SocketConnection({
alias: undefined,
authenticated: false,
role: undefined,
side: 'server',
smartsocketHost: this,
socket: socketArg
});
plugins.beautylog.log('Socket connected. Trying to authenticate...');
this.openSockets.add(socketConnection);
socketConnection.authenticate()
.then(() => {
return socketConnection.listenToFunctionRequests();
})
.catch((err) => {
console.log(err);
});
}
}
exports.Smartsocket = Smartsocket;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zbWFydHNvY2tldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LmNsYXNzZXMuc21hcnRzb2NrZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHVCQUF1QixDQUFDLENBQUE7QUFHakQsVUFBVTtBQUNWLHNCQUEwQixLQUFLLENBQUMsQ0FBQTtBQUVoQyx1REFBaUMsd0NBQXdDLENBQUMsQ0FBQTtBQUMxRSxvREFBOEIscUNBQXFDLENBQUMsQ0FBQTtBQUtuRSxDQUFDO0FBRUY7SUFLSSxZQUFZLFVBQTBDO1FBRnRELGdCQUFXLEdBQUcsSUFBSSxlQUFTLEVBQW9CLENBQUM7UUFDaEQsZ0JBQVcsR0FBRyxJQUFJLGVBQVMsRUFBYyxDQUFDO1FBNEIxQzs7V0FFRztRQUNILGdCQUFXLEdBQUc7WUFDVixJQUFJLENBQUMsRUFBRSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUM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BbUZDIn0=

View File

@ -1,6 +1,4 @@
/// <reference types="q" />
import * as plugins from "./smartsocket.plugins";
import { SocketConnection } from "./smartsocket.classes.socketconnection";
import { SocketConnection } from './smartsocket.classes.socketconnection';
/**
* interface for class SmartsocketClient
*/
@ -22,7 +20,7 @@ export declare class SmartsocketClient {
/**
* connect the client to the server
*/
connect(): plugins.q.Promise<{}>;
disconnect(): plugins.q.Promise<{}>;
serverCall(functionNameArg: string, dataArg: any): plugins.q.Promise<{}>;
connect(): Promise<{}>;
disconnect(): Promise<{}>;
serverCall(functionNameArg: string, dataArg: any): Promise<{}>;
}

View File

@ -1,4 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsocket.plugins");
// import classes
const smartsocket_classes_socketconnection_1 = require("./smartsocket.classes.socketconnection");
@ -11,31 +12,30 @@ class SmartsocketClient {
this.serverPort = optionsArg.port;
this.serverPassword = optionsArg.password;
}
;
/**
* connect the client to the server
*/
connect() {
let done = plugins.q.defer();
plugins.beautylog.log("trying to connect...");
let done = plugins.smartq.defer();
plugins.beautylog.log('trying to connect...');
let socketUrl = `${this.serverUrl}:${this.serverPort}`;
this.socketConnection = new smartsocket_classes_socketconnection_1.SocketConnection({
alias: this.alias,
authenticated: false,
role: undefined,
side: "client",
side: 'client',
smartsocketHost: null,
socket: plugins.socketIoClient(socketUrl, { multiplex: false })
});
this.socketConnection.socket.on("requestAuth", () => {
console.log("server requested authentication");
this.socketConnection.socket.emit("dataAuth", {
this.socketConnection.socket.on('requestAuth', () => {
console.log('server requested authentication');
this.socketConnection.socket.emit('dataAuth', {
role: this.role,
password: this.serverPassword,
alias: this.alias
});
this.socketConnection.socket.on("authenticated", () => {
console.log("client is authenticated");
this.socketConnection.socket.on('authenticated', () => {
console.log('client is authenticated');
this.socketConnection.authenticated = true;
this.socketConnection.listenToFunctionRequests();
done.resolve();
@ -43,19 +43,18 @@ class SmartsocketClient {
});
return done.promise;
}
;
disconnect() {
let done = plugins.q.defer();
let done = plugins.smartq.defer();
this.socketConnection.socket.disconnect();
this.socketConnection = undefined;
plugins.beautylog.ok("disconnected!");
plugins.beautylog.ok('disconnected!');
done.resolve();
return done.promise;
}
serverCall(functionNameArg, dataArg) {
let done = plugins.q.defer();
let done = plugins.smartq.defer();
let socketRequest = new smartsocket_classes_socketrequest_1.SocketRequest({
side: "requesting",
side: 'requesting',
originSocketConnection: this.socketConnection,
shortId: plugins.shortid.generate(),
funcCallData: {
@ -69,7 +68,6 @@ class SmartsocketClient {
});
return done.promise;
}
;
}
exports.SmartsocketClient = SmartsocketClient;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zbWFydHNvY2tldGNsaWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LmNsYXNzZXMuc21hcnRzb2NrZXRjbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHVCQUl6QixDQUFDLENBSitDO0FBT2hELGlCQUFpQjtBQUNqQix1REFBaUMsd0NBQXdDLENBQUMsQ0FBQTtBQUUxRSxvREFBOEIscUNBQXFDLENBQUMsQ0FBQTtBQVlwRTtJQU9JLFlBQVksVUFBb0M7UUFDNUMsSUFBSSxDQUFDLEtBQUssR0FBRyxVQUFVLENBQUMsS0FBSyxDQUFDO1FBQzlCLElBQUksQ0FBQyxJQUFJLEdBQUcsVUFBVSxDQUFDLElBQUksQ0FBQztRQUM1QixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxHQUFHLENBQUE7UUFDL0IsSUFBSSxDQUFDLFVBQVUsR0FBRyxVQUFVLENBQUMsSUFBSSxDQUFDO1FBQ2xDLElBQUksQ0FBQyxjQUFjLEdBQUcsVUFBVSxDQUFDLFFBQVEsQ0FBQTtJQUM3QyxDQUFDOztJQUVEOztP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0FBVyxFQUFFLE9BQU87YUFDckI7U0FDRixDQUFDLENBQUE7UUFDRixhQUFhLENBQUMsUUFBUSxFQUFFO2FBQ3JCLElBQUksQ0FBQyxDQUFDLE9BQTRCO1lBQ2pDLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFBO1FBQ25DLENBQUMsQ0FBQyxDQUFBO1FBQ0osTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDckIsQ0FBQztDQUVGO0FBeEVELDhDQXdFQyJ9

View File

@ -1,14 +1,12 @@
/// <reference types="socket.io" />
/// <reference types="socket.io-client" />
/// <reference types="q" />
import * as plugins from "./smartsocket.plugins";
import { Objectmap } from "lik";
import { Smartsocket } from "./smartsocket.classes.smartsocket";
import { SocketRole } from "./smartsocket.classes.socketrole";
import { Objectmap } from 'lik';
import { Smartsocket } from './smartsocket.classes.smartsocket';
import { SocketRole } from './smartsocket.classes.socketrole';
/**
* defines is a SocketConnection is server or client side. Important for mesh setups.
*/
export declare type TSocketConnectionSide = "server" | "client";
export declare type TSocketConnectionSide = 'server' | 'client';
/**
* interface for constructor of class SocketConnection
*/
@ -24,9 +22,9 @@ export interface ISocketConnectionConstructorOptions {
* interface for authentication data
*/
export interface ISocketConnectionAuthenticationObject {
role: "coreflowContainer";
password: "somePassword";
alias: "coreflow1";
role: 'coreflowContainer';
password: 'somePassword';
alias: 'coreflow1';
}
export declare let allSocketConnections: Objectmap<SocketConnection>;
/**
@ -38,14 +36,14 @@ export declare class SocketConnection {
authenticated: boolean;
role: SocketRole;
smartsocketHost: Smartsocket;
socket: SocketIO.Socket | SocketIOClient.Socket;
socket: any;
constructor(optionsArg: ISocketConnectionConstructorOptions);
/**
* authenticate the socket
*/
authenticate(): plugins.q.Promise<{}>;
authenticate(): Promise<{}>;
/**
* listen to function requests
*/
listenToFunctionRequests(): plugins.q.Promise<{}>;
listenToFunctionRequests(): Promise<{}>;
}

View File

@ -1,10 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsocket.plugins");
const helpers = require("./smartsocket.helpers");
const lik_1 = require("lik");
const smartsocket_classes_socketrequest_1 = require("./smartsocket.classes.socketrequest");
;
;
// export classes
exports.allSocketConnections = new lik_1.Objectmap();
/**
@ -21,57 +20,54 @@ class SocketConnection {
this.socket = optionsArg.socket;
// standard behaviour that is always true
exports.allSocketConnections.add(this);
this.socket.on("disconnect", () => {
this.socket.on('disconnect', () => {
plugins.beautylog.info(`SocketConnection with >alias ${this.alias} on >side ${this.side} disconnected`);
exports.allSocketConnections.remove(this);
});
}
;
// authenticating --------------------------
/**
* authenticate the socket
*/
authenticate() {
let done = plugins.q.defer();
this.socket.on("dataAuth", (dataArg) => {
plugins.beautylog.log("received authentication data. now hashing and comparing...");
this.socket.removeListener("dataAuth", () => { });
let done = plugins.smartq.defer();
this.socket.on('dataAuth', (dataArg) => {
plugins.beautylog.log('received authentication data. now hashing and comparing...');
this.socket.removeListener('dataAuth', () => { });
if (helpers.checkPasswordForRole(dataArg, this.smartsocketHost)) {
this.alias = dataArg.alias;
this.authenticated = true;
this.role = helpers.getSocketRoleByName(dataArg.role, this.smartsocketHost);
this.socket.emit("authenticated");
this.socket.emit('authenticated');
plugins.beautylog.ok(`socket with >>alias ${this.alias} >>role ${this.role} is authenticated!`);
done.resolve(this);
}
else {
this.authenticated = false;
this.socket.disconnect();
done.reject("not authenticated");
done.reject('not authenticated');
}
;
});
this.socket.emit("requestAuth");
this.socket.emit('requestAuth');
return done.promise;
}
;
// listening -------------------------------
/**
* listen to function requests
*/
listenToFunctionRequests() {
let done = plugins.q.defer();
let done = plugins.smartq.defer();
if (this.authenticated) {
this.socket.on("function", (dataArg) => {
this.socket.on('function', (dataArg) => {
// check if requested function is available to the socket's scope
plugins.beautylog.log("function request received");
plugins.beautylog.log('function request received');
let referencedFunction = this.role.allowedFunctions.find((socketFunctionArg) => {
return socketFunctionArg.name === dataArg.funcCallData.funcName;
});
if (referencedFunction !== undefined) {
plugins.beautylog.ok("function in access scope");
plugins.beautylog.ok('function in access scope');
let localSocketRequest = new smartsocket_classes_socketrequest_1.SocketRequest({
side: "responding",
side: 'responding',
originSocketConnection: this,
shortId: dataArg.shortId,
funcCallData: dataArg.funcCallData
@ -79,11 +75,10 @@ class SocketConnection {
localSocketRequest.createResponse(); // takes care of creating response and sending it back
}
else {
plugins.beautylog.warn("function not existent or out of access scope");
plugins.beautylog.warn('function not existent or out of access scope');
}
;
});
this.socket.on("functionResponse", (dataArg) => {
this.socket.on('functionResponse', (dataArg) => {
plugins.beautylog.info(`received response for request with id ${dataArg.shortId}`);
let targetSocketRequest = helpers.getSocketRequestById(dataArg.shortId);
targetSocketRequest.handleResponse(dataArg);
@ -96,11 +91,8 @@ class SocketConnection {
plugins.beautylog.error(errMessage);
done.reject(errMessage);
}
;
return done.promise;
}
;
}
exports.SocketConnection = SocketConnection;
;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRjb25uZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRjb25uZWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLE9BQU8sV0FBTSx1QkFBdUIsQ0FBQyxDQUFBO0FBQ2pELE1BQVksT0FBTyxXQUFNLHVCQUF1QixDQUFDLENBQUE7QUFFakQsc0JBQXdCLEtBQUssQ0FBQyxDQUFBO0FBSzlCLG9EQUEyRSxxQ0FBcUMsQ0FBQyxDQUFBO0FBb0JoSCxDQUFDO0FBU0QsQ0FBQztBQUVGLGlCQUFpQjtBQUNOLDRCQUFvQixHQUFHLElBQUksZUFBUyxFQUFvQixDQUFDO0FBRXBFOztHQUVHO0FBQ0g7SUFPSSxZQUFZLFVBQStDO1FBSj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DQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDTixJQUFJLFVBQW9ELENBQUE7WUFDeEQsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsVUFBVSxDQUFDLENBQUE7WUFDbkMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUMsQ0FBQTtRQUN6QixDQUFDO1FBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDckIsQ0FBQztDQUlGO0FBOUZELDRDQThGQyJ9

View File

@ -1,7 +1,5 @@
/// <reference types="q" />
import * as plugins from "./smartsocket.plugins";
import { Objectmap } from "lik";
import { SocketRole } from "./smartsocket.classes.socketrole";
import { Objectmap } from 'lik';
import { SocketRole } from './smartsocket.classes.socketrole';
/**
* interface of the contructor options of class SocketFunction
*/
@ -35,12 +33,12 @@ export declare class SocketFunction {
* the constructor for SocketFunction
*/
constructor(optionsArg: ISocketFunctionConstructorOptions);
/**
* invokes the function of this SocketFunction
*/
invoke(dataArg: ISocketFunctionCall): Promise<any>;
/**
* notifies a role about access to this SocketFunction
*/
private _notifyRole(socketRoleArg);
/**
* invokes the function of this SocketFunction
*/
invoke(dataArg: ISocketFunctionCall): plugins.q.Promise<any>;
}

View File

@ -1,9 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsocket.plugins");
// import classes
const lik_1 = require("lik");
;
;
// export objects
exports.allSocketFunctions = new lik_1.Objectmap();
// export classes
@ -21,21 +20,13 @@ class SocketFunction {
for (let socketRoleArg of this.roles) {
this._notifyRole(socketRoleArg);
}
;
exports.allSocketFunctions.add(this); // map instance with Objectmap
}
;
/**
* notifies a role about access to this SocketFunction
*/
_notifyRole(socketRoleArg) {
socketRoleArg.addSocketFunction(this);
}
/**
* invokes the function of this SocketFunction
*/
invoke(dataArg) {
let done = plugins.q.defer();
let done = plugins.smartq.defer();
if (dataArg.funcName === this.name) {
this.funcDef(dataArg.funcDataArg)
.then((resultData) => {
@ -51,7 +42,12 @@ class SocketFunction {
}
return done.promise;
}
;
/**
* notifies a role about access to this SocketFunction
*/
_notifyRole(socketRoleArg) {
socketRoleArg.addSocketFunction(this);
}
}
exports.SocketFunction = SocketFunction;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRmdW5jdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LmNsYXNzZXMuc29ja2V0ZnVuY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHVCQUF1QixDQUFDLENBQUE7QUFFakQsaUJBQWlCO0FBQ2pCLHNCQUEwQixLQUFLLENBQUMsQ0FBQTtBQVkvQixDQUFDO0FBUUQsQ0FBQztBQVNGLGlCQUFpQjtBQUNOLDBCQUFrQixHQUFHLElBQUksZUFBUyxFQUFrQixDQUFDO0FBRWhFLGlCQUFpQjtBQUVqQjs7R0FFRztBQUNIO0lBS0k7O09BRUc7SUFDSCxZQUFZLFVBQTZDO1FBQ3JELElBQUksQ0FBQyxJQUFJLEdBQUcsVUFBVSxDQUFDLFFBQVEsQ0FBQztRQUNoQyxJQUFJLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQyxPQUFPLENBQUM7UUFDbEMsSUFBSSxDQUFDLEtBQUssR0FBRyxVQUFVLENBQUMsWUFBWSxDQUFDO1FBQ3JDLEdBQUcsQ0FBQyxDQUFDLElBQUksYUFBYSxJQUFJLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQSxDQUFDO1lBQ2xDLElBQUksQ0FBQyxXQUFXLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDcEMsQ0FBQztRQUFBLENBQUM7UUFDRiwwQkFBa0IsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMsQ0F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dCO29CQUMxQyxRQUFRLEVBQUUsSUFBSSxDQUFDLElBQUk7b0JBQ25CLFdBQVcsRUFBRSxVQUFVO2lCQUN4QixDQUFBO2dCQUNELElBQUksQ0FBQyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtZQUNoQyxDQUFDLENBQUMsQ0FBQTtRQUVOLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNOLE1BQU0sSUFBSSxLQUFLLENBQUMsK0RBQStELENBQUMsQ0FBQTtRQUNsRixDQUFDO1FBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDckIsQ0FBQztJQUVEOztPQUVHO0lBQ0ssV0FBVyxDQUFFLGFBQXlCO1FBQzVDLGFBQWEsQ0FBQyxpQkFBaUIsQ0FBQyxJQUFJLENBQUMsQ0FBQTtJQUN2QyxDQUFDO0NBQ0Y7QUE3Q0Qsd0NBNkNDIn0=

View File

@ -1,10 +1,9 @@
/// <reference types="q" />
import * as plugins from "./smartsocket.plugins";
import { ISocketFunctionCall } from "./smartsocket.classes.socketfunction";
import { Objectmap } from "lik";
import { SocketConnection } from "./smartsocket.classes.socketconnection";
export declare type TSocketRequestStatus = "new" | "pending" | "finished";
export declare type TSocketRequestSide = "requesting" | "responding";
import * as plugins from './smartsocket.plugins';
import { ISocketFunctionCall } from './smartsocket.classes.socketfunction';
import { Objectmap } from 'lik';
import { SocketConnection } from './smartsocket.classes.socketconnection';
export declare type TSocketRequestStatus = 'new' | 'pending' | 'finished';
export declare type TSocketRequestSide = 'requesting' | 'responding';
/**
* interface of constructor of class SocketRequest
*/
@ -29,12 +28,12 @@ export declare class SocketRequest {
shortid: string;
originSocketConnection: SocketConnection;
funcCallData: ISocketFunctionCall;
done: plugins.q.Deferred<{}>;
done: plugins.smartq.Deferred<{}>;
constructor(optionsArg: SocketRequestConstructorOptions);
/**
* dispatches a socketrequest from the requesting to the receiving side
*/
dispatch(): plugins.q.Promise<{}>;
dispatch(): Promise<{}>;
/**
* handles the response that is received by the requesting side
*/

View File

@ -1,24 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsocket.plugins");
const helpers = require("./smartsocket.helpers");
// import classes
const lik_1 = require("lik");
;
;
// export objects
exports.allSocketRequests = new lik_1.Objectmap();
// export classes
class SocketRequest {
constructor(optionsArg) {
this.status = "new";
this.done = plugins.q.defer();
this.status = 'new';
this.done = plugins.smartq.defer();
this.side = optionsArg.side;
this.shortid = optionsArg.shortId;
this.funcCallData = optionsArg.funcCallData;
this.originSocketConnection = optionsArg.originSocketConnection;
exports.allSocketRequests.add(this);
}
;
// requesting --------------------------
/**
* dispatches a socketrequest from the requesting to the receiving side
@ -28,15 +26,14 @@ class SocketRequest {
funcCallData: this.funcCallData,
shortId: this.shortid
};
this.originSocketConnection.socket.emit("function", requestData);
this.originSocketConnection.socket.emit('function', requestData);
return this.done.promise;
}
;
/**
* handles the response that is received by the requesting side
*/
handleResponse(responseDataArg) {
plugins.beautylog.log("handling response!");
plugins.beautylog.log('handling response!');
this.done.resolve(responseDataArg.funcCallData);
exports.allSocketRequests.remove(this);
}
@ -49,16 +46,15 @@ class SocketRequest {
plugins.beautylog.info(`invoking ${targetSocketFunction.name}`);
targetSocketFunction.invoke(this.funcCallData)
.then((resultData) => {
plugins.beautylog.log("got resultData. Sending it to requesting party.");
plugins.beautylog.log('got resultData. Sending it to requesting party.');
let requestData = {
funcCallData: resultData,
shortId: this.shortid
};
this.originSocketConnection.socket.emit("functionResponse", requestData);
this.originSocketConnection.socket.emit('functionResponse', requestData);
exports.allSocketRequests.remove(this);
});
}
}
exports.SocketRequest = SocketRequest;
;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRyZXF1ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzb2NrZXQuY2xhc3N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0QsSUFBSSxDQUFDLHNCQUFzQixDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsa0JBQWtCLEVBQUUsV0FBVyxDQUFDLENBQUE7WUFDeEUseUJBQWlCLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxDQUFBO1FBQ2hDLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQztDQUNGO0FBekRELHNDQXlEQyJ9

View File

@ -1,4 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// import classes
const lik_1 = require("lik");
/**
@ -16,4 +17,4 @@ class SocketRole {
}
}
exports.SocketRole = SocketRole;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRyb2xlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRyb2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQSxpQkFBaUI7QUFDakIsc0JBQTBCLEtBQUssQ0FBQyxDQUFBO0FBWWhDOztHQUVHO0FBQ0g7SUFJSSxZQUFZLFVBQTZCO1FBRHpDLHFCQUFnQixHQUFHLElBQUksZUFBUyxFQUFrQixDQUFDO1FBRS9DLElBQUksQ0FBQyxJQUFJLEdBQUcsVUFBVSxDQUFDLElBQUksQ0FBQztRQUM1QixJQUFJLENBQUMsWUFBWSxHQUFHLFVBQVUsQ0FBQyxZQUFZLENBQUM7SUFDaEQsQ0FBQzs7SUFDRCxpQkFBaUIsQ0FBQyxpQkFBZ0M7UUFDOUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLEdBQUcsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO0lBQ2pELENBQUM7QUFDTCxDQUFDO0FBWFksa0JBQVUsYUFXdEIsQ0FBQSJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRyb2xlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRyb2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsaUJBQWlCO0FBQ2pCLDZCQUFnQztBQVloQzs7R0FFRztBQUNIO0lBSUksWUFBWSxVQUE2QjtRQUR6QyxxQkFBZ0IsR0FBRyxJQUFJLGVBQVMsRUFBa0IsQ0FBQztRQUUvQyxJQUFJLENBQUMsSUFBSSxHQUFHLFVBQVUsQ0FBQyxJQUFJLENBQUM7UUFDNUIsSUFBSSxDQUFDLFlBQVksR0FBRyxVQUFVLENBQUMsWUFBWSxDQUFDO0lBQ2hELENBQUM7SUFBQSxDQUFDO0lBQ0YsaUJBQWlCLENBQUMsaUJBQWdDO1FBQzlDLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLENBQUMsQ0FBQztJQUNqRCxDQUFDO0NBQ0o7QUFYRCxnQ0FXQyJ9

View File

@ -1,4 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsocket.plugins");
const smartsocket_classes_socketfunction_1 = require("./smartsocket.classes.socketfunction");
const smartsocket_classes_socketrequest_1 = require("./smartsocket.classes.socketrequest");
@ -26,4 +27,4 @@ exports.getSocketRequestById = (shortIdArg, requestSide) => {
exports.getSocketRoleByName = (socketRoleNameArg, referenceSmartsocket) => {
return referenceSmartsocket.socketRoles.find((socketRoleArg) => { return socketRoleArg.name === socketRoleNameArg; });
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LmhlbHBlc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DQUFBLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDakgsQ0FBQyxDQUFBO0FBRUQsd0JBQXdCO0FBRXhCOztHQUVHO0FBQ1EsUUFBQSxvQkFBb0IsR0FBRyxDQUFDLFVBQWtCLEVBQUUsV0FBZ0M7SUFDbkYsTUFBTSxDQUFDLHFEQUFpQixDQUFDLElBQUksQ0FBQyxDQUFDLGdCQUFnQixPQUFPLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxPQUFPLEtBQUssVUFBVSxDQUFBLENBQUMsQ0FBQyxDQUFDLENBQUE7QUFDM0csQ0FBQyxDQUFBO0FBRUQscUJBQXFCO0FBRXJCOztHQUVHO0FBQ1EsUUFBQSxtQkFBbUIsR0FBRyxDQUFDLGlCQUF5QixFQUFDLG9CQUFnQztJQUN4RixNQUFNLENBQUMsb0JBQW9CLENBQUMsV0FBVyxDQUFDLElBQUksQ0FBQyxDQUFDLGFBQWEsT0FBTyxNQUFNLENBQUMsYUFBYSxDQUFDLElBQUksS0FBSyxpQkFBaUIsQ0FBQSxDQUFDLENBQUMsQ0FBQyxDQUFBO0FBQ3hILENBQUMsQ0FBQyJ9

View File

@ -1,9 +1,9 @@
import "typings-global";
export import beautylog = require("beautylog");
export import lik = require("lik");
export import nodehash = require("nodehash");
export import q = require("q");
export import shortid = require("shortid");
export import socketIo = require("socket.io");
export import socketIoClient = require("socket.io-client");
export import taskbuffer = require("taskbuffer");
import 'typings-global';
export import beautylog = require('beautylog');
export import lik = require('lik');
export import nodehash = require('nodehash');
export import smartq = require('smartq');
export import shortid = require('shortid');
export import socketIo = require('socket.io');
export import socketIoClient = require('socket.io-client');
export import taskbuffer = require('taskbuffer');

View File

@ -1,11 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
exports.beautylog = require("beautylog");
exports.lik = require("lik");
exports.nodehash = require("nodehash");
exports.q = require("q");
exports.smartq = require("smartq");
exports.shortid = require("shortid");
exports.socketIo = require("socket.io");
exports.socketIoClient = require("socket.io-client");
exports.taskbuffer = require("taskbuffer");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsV0FBRyxXQUFZLEtBQUssQ0FBQyxDQUFDO0FBQ3RCLGdCQUFRLFdBQVcsVUFBVSxDQUFDLENBQUM7QUFDL0IsU0FBQyxXQUFXLEdBQUcsQ0FBQyxDQUFDO0FBQ2pCLGVBQU8sV0FBVyxTQUFTLENBQUMsQ0FBQztBQUM3QixnQkFBUSxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ2hDLHNCQUFjLFdBQVcsa0JBQWtCLENBQUMsQ0FBQztBQUM3QyxrQkFBVSxXQUFXLFlBQVksQ0FBQyxDQUFDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFDdkIseUNBQThDO0FBQzlDLDZCQUFtQztBQUNuQyx1Q0FBNEM7QUFDNUMsbUNBQXdDO0FBQ3hDLHFDQUEwQztBQUMxQyx3Q0FBNkM7QUFDN0MscURBQTBEO0FBQzFELDJDQUFnRCJ9

View File

@ -1,5 +1,8 @@
{
"npmts":{
"coverageTreshold":50
"npmts":{},
"npmci": {
"globalNpmTools": [
"npmts"
]
}
}

View File

@ -18,22 +18,20 @@
},
"homepage": "https://gitlab.com/pushrocks/smartsocket#README",
"dependencies": {
"@types/q": "0.x.x",
"@types/shortid": "0.0.27",
"@types/socket.io": "^1.4.26",
"@types/socket.io-client": "^1.4.26",
"beautylog": "^5.0.23",
"lik": "^1.0.15",
"@types/shortid": "0.0.29",
"@types/socket.io": "^1.4.29",
"@types/socket.io-client": "^1.4.29",
"beautylog": "^6.1.10",
"lik": "^1.0.38",
"nodehash": "^1.0.4",
"q": "^1.4.1",
"shortid": "^2.2.6",
"socket.io": "^1.4.8",
"socket.io-client": "^1.4.8",
"taskbuffer": "^1.0.8"
"shortid": "^2.2.8",
"smartq": "^1.1.6",
"socket.io": "^2.0.3",
"socket.io-client": "^2.0.3",
"taskbuffer": "^1.0.17",
"typings-global": "^1.0.19"
},
"devDependencies": {
"npmts-g": "^5.2.8",
"should": "^11.1.0",
"typings-test": "^1.0.3"
"tapbundle": "^1.1.0"
}
}

1
test/test.d.ts vendored
View File

@ -1 +0,0 @@
import "typings-test";

View File

@ -1,108 +0,0 @@
"use strict";
require("typings-test");
const should = require("should");
const smartsocket = require("../dist/index");
const q = require("q");
const nodehash = require("nodehash");
let testSmartsocket;
let testSmartsocketClient;
let testSocketRole1;
let testSocketFunction1;
let testConfig = {
port: 3000
};
describe("smartsocket", function () {
describe("class Smartsocket", function () {
it("should create a new smartsocket", function () {
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port });
should(testSmartsocket).be.instanceOf(smartsocket.Smartsocket);
});
it("should start listening when .started is called", function () {
testSmartsocket.startServer();
});
});
describe("class SocketRole", function () {
it("should add a socketrole", function () {
testSocketRole1 = new smartsocket.SocketRole({
name: "testRole1",
passwordHash: nodehash.sha256FromStringSync("testPassword")
});
testSmartsocket.addSocketRoles([testSocketRole1]);
});
});
describe("class SocketFunction", function () {
it("should register a new Function", function () {
testSocketFunction1 = new smartsocket.SocketFunction({
funcName: "testFunction1",
funcDef: (dataArg) => {
let done = q.defer();
done.resolve(dataArg);
return done.promise;
},
allowedRoles: [testSocketRole1]
});
});
});
describe("class SmartsocketClient", function () {
it("should react to a new websocket connection from client", function (done) {
this.timeout(10000);
testSmartsocketClient = new smartsocket.SmartsocketClient({
port: testConfig.port,
url: "http://localhost",
password: "testPassword",
alias: "testClient1",
role: "testRole1"
});
testSmartsocketClient.connect()
.then(() => {
done();
});
});
it("client should disconnect and reconnect", function (done) {
this.timeout(10000);
testSmartsocketClient.disconnect()
.then(() => {
let done = q.defer();
setTimeout(() => {
testSmartsocketClient.connect()
.then(done.resolve);
}, 0);
return done.promise;
})
.then(() => {
done();
});
});
it("2 clients should connect in parallel", function () {
});
it("should be able to make a functionCall from client to server", function (done) {
this.timeout(5000);
testSmartsocketClient.serverCall("testFunction1", {
value1: "hello"
}).then((dataArg) => {
console.log(dataArg);
done();
});
});
it("should be able to make a functionCall from server to client", function (done) {
this.timeout(5000);
let targetSocket = (() => {
return smartsocket.allSocketConnections.find((socketConnectionArg) => {
return socketConnectionArg.alias === "testClient1";
});
})();
testSmartsocket.clientCall("testFunction1", {
value1: "helloFromServer"
}, targetSocket).then((dataArg) => {
console.log(dataArg);
done();
});
});
});
describe("terminating smartsocket", function () {
it("should close the server", function () {
testSmartsocket.closeServer();
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsTUFBTyxNQUFNLFdBQVcsUUFBUSxDQUFDLENBQUM7QUFFbEMsTUFBTyxXQUFXLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDOUMsTUFBTyxDQUFDLFdBQVcsR0FBRyxDQUFDLENBQUM7QUFDeEIsTUFBTyxRQUFRLFdBQVcsVUFBVSxDQUFDLENBQUM7QUFFdEMsSUFBSSxlQUF3QyxDQUFD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QUMsQ0FBQztZQUNuQixJQUFJLFlBQVksR0FBRyxDQUFDO2dCQUNoQixNQUFNLENBQUMsV0FBVyxDQUFDLG9CQUFvQixDQUFDLElBQUksQ0FBQyxDQUFDLG1CQUFtQjtvQkFDN0QsTUFBTSxDQUFDLG1CQUFtQixDQUFDLEtBQUssS0FBSyxhQUFhLENBQUM7Z0JBQ3ZELENBQUMsQ0FBQyxDQUFDO1lBQ1AsQ0FBQyxDQUFDLEVBQUUsQ0FBQztZQUNMLGVBQWUsQ0FBQyxVQUFVLENBQUMsZUFBZSxFQUFFO2dCQUN4QyxNQUFNLEVBQUUsaUJBQWlCO2FBQzVCLEVBQUUsWUFBWSxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsT0FBTztnQkFDMUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztnQkFDckIsSUFBSSxFQUFFLENBQUM7WUFDWCxDQUFDLENBQUMsQ0FBQztRQUNQLENBQUMsQ0FBQyxDQUFDO0lBRVAsQ0FBQyxDQUFDLENBQUM7SUFDSCxRQUFRLENBQUMseUJBQXlCLEVBQUU7UUFDaEMsRUFBRSxDQUFDLHlCQUF5QixFQUFFO1lBQzFCLGVBQWUsQ0FBQyxXQUFXLEVBQUUsQ0FBQztRQUNsQyxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUMifQ==

View File

@ -1,9 +1,9 @@
import "typings-test";
import should = require("should");
import socketIoClient = require("socket.io-client");
import smartsocket = require("../dist/index");
import q = require("q");
import nodehash = require("nodehash")
import { expect, tap } from 'tapbundle'
import socketIoClient = require('socket.io-client')
import smartsocket = require('../dist/index')
import smartq = require('smartq')
import nodehash = require('nodehash')
let testSmartsocket: smartsocket.Smartsocket
let testSmartsocketClient: smartsocket.SmartsocketClient
@ -14,99 +14,102 @@ let testConfig = {
port: 3000
}
describe("smartsocket", function () {
describe("class Smartsocket", function () {
it("should create a new smartsocket", function () {
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port });
should(testSmartsocket).be.instanceOf(smartsocket.Smartsocket);
});
it("should start listening when .started is called", function () {
testSmartsocket.startServer();
});
});
describe("class SocketRole", function () {
it("should add a socketrole", function () {
testSocketRole1 = new smartsocket.SocketRole({
name: "testRole1",
passwordHash: nodehash.sha256FromStringSync("testPassword")
});
testSmartsocket.addSocketRoles([testSocketRole1]);
});
// class smartsocket
tap.test('should create a new smartsocket', async () => {
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port })
expect(testSmartsocket).be.instanceOf(smartsocket.Smartsocket)
})
describe("class SocketFunction", function () {
it("should register a new Function", function () {
tap.test('should start listening when .started is called', async () => {
testSmartsocket.startServer()
})
// class socketrole
tap.test('should add a socketrole', async () => {
testSocketRole1 = new smartsocket.SocketRole({
name: 'testRole1',
passwordHash: nodehash.sha256FromStringSync('testPassword')
})
testSmartsocket.addSocketRoles([ testSocketRole1 ])
})
// class SocketFunction
tap.test('should register a new Function', async () => {
testSocketFunction1 = new smartsocket.SocketFunction({
funcName: "testFunction1",
funcName: 'testFunction1',
funcDef: (dataArg) => {
let done = q.defer();
done.resolve(dataArg);
return done.promise;
let done = smartq.defer()
done.resolve(dataArg)
return done.promise
},
allowedRoles: [ testSocketRole1 ]
});
});
});
describe("class SmartsocketClient", function () {
it("should react to a new websocket connection from client", function (done) {
this.timeout(10000);
})
})
// class SmartsocketClient
tap.test('should react to a new websocket connection from client',async () => {
let done = smartq.defer()
testSmartsocketClient = new smartsocket.SmartsocketClient({
port: testConfig.port,
url: "http://localhost",
password: "testPassword",
alias: "testClient1",
role: "testRole1"
});
url: 'http://localhost',
password: 'testPassword',
alias: 'testClient1',
role: 'testRole1'
})
testSmartsocketClient.connect()
.then(() => {
done();
});
});
it("client should disconnect and reconnect", function (done) {
this.timeout(10000);
done.resolve()
})
await done.promise
})
tap.test('client should disconnect and reconnect', async () => {
let done = smartq.defer()
testSmartsocketClient.disconnect()
.then(() => {
let done = q.defer();
let done = smartq.defer()
setTimeout(() => {
testSmartsocketClient.connect()
.then(done.resolve)
}, 0)
return done.promise;
return done.promise
})
.then(() => {
done();
});
});
it("2 clients should connect in parallel", function () {
});
it("should be able to make a functionCall from client to server", function (done) {
this.timeout(5000);
testSmartsocketClient.serverCall("testFunction1", {
value1: "hello"
done.resolve()
})
await done.promise
})
tap.test('2 clients should connect in parallel', async () => {
// nothing here
})
tap.test('should be able to make a functionCall from client to server', async () => {
let done = smartq.defer()
testSmartsocketClient.serverCall('testFunction1', {
value1: 'hello'
}).then((dataArg) => {
console.log(dataArg);
done();
});
});
it("should be able to make a functionCall from server to client", function (done) {
this.timeout(5000);
console.log(dataArg)
done.resolve()
})
await done.promise
})
tap.test('should be able to make a functionCall from server to client', async () => {
let done = smartq.defer()
let targetSocket = (() => {
return smartsocket.allSocketConnections.find((socketConnectionArg) => {
return socketConnectionArg.alias === "testClient1";
});
})();
testSmartsocket.clientCall("testFunction1", {
value1: "helloFromServer"
}, targetSocket).then((dataArg) => {
console.log(dataArg);
done();
});
});
});
describe("terminating smartsocket", function () {
it("should close the server", function () {
testSmartsocket.closeServer();
});
return socketConnectionArg.alias === 'testClient1'
})
});
})()
testSmartsocket.clientCall('testFunction1', {
value1: 'helloFromServer'
}, targetSocket).then((dataArg) => {
console.log(dataArg)
done.resolve()
})
})
// terminate
tap.test('should close the server', async () => {
testSmartsocket.closeServer()
})
tap.start()

View File

@ -1,12 +1,12 @@
import * as plugins from "./smartsocket.plugins";
import * as plugins from './smartsocket.plugins'
// export main classes
export * from "./smartsocket.classes.smartsocket";
export * from "./smartsocket.classes.smartsocketclient";
export * from './smartsocket.classes.smartsocket'
export * from './smartsocket.classes.smartsocketclient'
// export further classes and objects
export * from "./smartsocket.classes.socketfunction";
export * from "./smartsocket.classes.socketrole";
export * from "./smartsocket.classes.socketconnection";
export * from './smartsocket.classes.socketfunction'
export * from './smartsocket.classes.socketrole'
export * from './smartsocket.classes.socketconnection'
// need something more exposed? Create an issue on GitLab!

View File

@ -1,25 +1,76 @@
import * as plugins from "./smartsocket.plugins";
import * as helpers from "./smartsocket.helpers";
import * as plugins from './smartsocket.plugins'
import * as helpers from './smartsocket.helpers'
// classes
import { Objectmap } from "lik";
import { SocketFunction,ISocketFunctionCall} from "./smartsocket.classes.socketfunction";
import { SocketConnection } from "./smartsocket.classes.socketconnection";
import { SocketRequest } from "./smartsocket.classes.socketrequest";
import { SocketRole } from "./smartsocket.classes.socketrole";
import { Objectmap } from 'lik'
import { SocketFunction, ISocketFunctionCall } from './smartsocket.classes.socketfunction'
import { SocketConnection } from './smartsocket.classes.socketconnection'
import { SocketRequest } from './smartsocket.classes.socketrequest'
import { SocketRole } from './smartsocket.classes.socketrole'
export interface ISmartsocketConstructorOptions {
port: number;
};
port: number
}
export class Smartsocket {
options: ISmartsocketConstructorOptions
io: SocketIO.Server;
openSockets = new Objectmap<SocketConnection>();
socketRoles = new Objectmap<SocketRole>();
io: SocketIO.Server
openSockets = new Objectmap<SocketConnection>()
socketRoles = new Objectmap<SocketRole>()
constructor (optionsArg: ISmartsocketConstructorOptions) {
this.options = optionsArg;
};
this.options = optionsArg
}
/**
* starts listening to incling sockets:
*/
startServer = () => {
this.io = plugins.socketIo(this.options.port)
this.io.on('connection', (socketArg) => {
this._handleSocketConnection(socketArg)
})
}
closeServer = () => {
this.openSockets.forEach((socketObjectArg: SocketConnection) => {
plugins.beautylog.log(`disconnect socket with >>alias ${socketObjectArg.alias}`)
socketObjectArg.socket.disconnect()
})
this.openSockets.wipe()
this.io.close()
}
// communication
/**
* allows call to specific client.
*/
clientCall (functionNameArg: string, dataArg: any, targetSocketConnectionArg: SocketConnection) {
let done = plugins.smartq.defer()
let socketRequest = new SocketRequest({
side: 'requesting',
originSocketConnection: targetSocketConnectionArg,
shortId: plugins.shortid.generate(),
funcCallData: {
funcName: functionNameArg,
funcDataArg: dataArg
}
})
socketRequest.dispatch()
.then((dataArg: ISocketFunctionCall) => {
done.resolve(dataArg.funcDataArg)
})
return done.promise
}
/**
* adds socketRoles
*/
addSocketRoles (socketRolesArray: SocketRole[]): void {
for (let socketRole of socketRolesArray) {
this.socketRoles.add(socketRole)
}
return
}
/**
* the standard handler for new socket connections
@ -29,70 +80,19 @@ export class Smartsocket {
alias: undefined,
authenticated: false,
role: undefined,
side:"server",
side: 'server',
smartsocketHost: this,
socket: socketArg
});
plugins.beautylog.log("Socket connected. Trying to authenticate...")
this.openSockets.add(socketConnection);
})
plugins.beautylog.log('Socket connected. Trying to authenticate...')
this.openSockets.add(socketConnection)
socketConnection.authenticate()
.then(() => {
return socketConnection.listenToFunctionRequests();
return socketConnection.listenToFunctionRequests()
})
.catch((err) => {
console.log(err);
});
};
/**
* starts listening to incling sockets:
*/
startServer = () => {
this.io = plugins.socketIo(this.options.port);
this.io.on("connection", (socketArg) => {
this._handleSocketConnection(socketArg);
});
console.log(err)
})
}
closeServer = () => {
this.openSockets.forEach((socketObjectArg: SocketConnection) => {
plugins.beautylog.log(`disconnect socket with >>alias ${socketObjectArg.alias}`);
socketObjectArg.socket.disconnect();
});
this.openSockets.wipe();
this.io.close();
};
// communication
/**
* allows call to specific client.
*/
clientCall(functionNameArg:string,dataArg:any,targetSocketConnectionArg:SocketConnection){
let done = plugins.q.defer();
let socketRequest = new SocketRequest({
side:"requesting",
originSocketConnection:targetSocketConnectionArg,
shortId:plugins.shortid.generate(),
funcCallData:{
funcName: functionNameArg,
funcDataArg:dataArg
}
});
socketRequest.dispatch()
.then((dataArg:ISocketFunctionCall) => {
done.resolve(dataArg.funcDataArg);
});
return done.promise;
};
/**
* adds socketRoles
*/
addSocketRoles(socketRolesArray:SocketRole[]):void{
for(let socketRole of socketRolesArray){
this.socketRoles.add(socketRole);
};
return;
};
}

View File

@ -1,95 +1,95 @@
import * as plugins from "./smartsocket.plugins"
import * as plugins from './smartsocket.plugins'
// import interfaces
import { ISocketFunctionCall } from "./smartsocket.classes.socketfunction";
import { ISocketRequestDataObject } from "./smartsocket.classes.socketrequest"
import { ISocketFunctionCall } from './smartsocket.classes.socketfunction'
import { ISocketRequestDataObject } from './smartsocket.classes.socketrequest'
// import classes
import { SocketConnection } from "./smartsocket.classes.socketconnection";
import { SocketFunction } from "./smartsocket.classes.socketfunction";
import { SocketRequest } from "./smartsocket.classes.socketrequest";
import { SocketConnection } from './smartsocket.classes.socketconnection'
import { SocketFunction } from './smartsocket.classes.socketfunction'
import { SocketRequest } from './smartsocket.classes.socketrequest'
/**
* interface for class SmartsocketClient
*/
export interface ISmartsocketClientOptions {
port: number;
url: string;
alias:string; // an alias makes it easier to identify this client in a multo client environment
role:string;
password: string; // by setting a password access to functions can be limited
port: number
url: string
alias: string // an alias makes it easier to identify this client in a multo client environment
role: string
password: string // by setting a password access to functions can be limited
}
export class SmartsocketClient {
alias:string;
role:string;
socketConnection:SocketConnection;
serverUrl:string;
serverPort:number;
serverPassword:string;
alias: string
role: string
socketConnection: SocketConnection
serverUrl: string
serverPort: number
serverPassword: string
constructor(optionsArg: ISmartsocketClientOptions) {
this.alias = optionsArg.alias;
this.role = optionsArg.role;
this.alias = optionsArg.alias
this.role = optionsArg.role
this.serverUrl = optionsArg.url
this.serverPort = optionsArg.port;
this.serverPort = optionsArg.port
this.serverPassword = optionsArg.password
};
}
/**
* connect the client to the server
*/
connect () {
let done = plugins.q.defer();
plugins.beautylog.log("trying to connect...");
let socketUrl = `${this.serverUrl}:${this.serverPort}`;
let done = plugins.smartq.defer()
plugins.beautylog.log('trying to connect...')
let socketUrl = `${this.serverUrl}:${this.serverPort}`
this.socketConnection = new SocketConnection({
alias: this.alias,
authenticated: false,
role: undefined,
side:"client",
side: 'client',
smartsocketHost: null,
socket: plugins.socketIoClient(socketUrl, { multiplex: false })
});
this.socketConnection.socket.on("requestAuth", () => {
console.log("server requested authentication");
this.socketConnection.socket.emit("dataAuth", {
})
this.socketConnection.socket.on('requestAuth', () => {
console.log('server requested authentication')
this.socketConnection.socket.emit('dataAuth', {
role: this.role,
password: this.serverPassword,
alias: this.alias
});
this.socketConnection.socket.on("authenticated",() => {
console.log("client is authenticated");
this.socketConnection.authenticated = true;
this.socketConnection.listenToFunctionRequests();
done.resolve();
});
});
return done.promise;
};
})
this.socketConnection.socket.on('authenticated', () => {
console.log('client is authenticated')
this.socketConnection.authenticated = true
this.socketConnection.listenToFunctionRequests()
done.resolve()
})
})
return done.promise
}
disconnect () {
let done = plugins.q.defer();
this.socketConnection.socket.disconnect();
this.socketConnection = undefined;
plugins.beautylog.ok("disconnected!");
done.resolve();
return done.promise;
let done = plugins.smartq.defer()
this.socketConnection.socket.disconnect()
this.socketConnection = undefined
plugins.beautylog.ok('disconnected!')
done.resolve()
return done.promise
}
serverCall (functionNameArg: string, dataArg: any) {
let done = plugins.q.defer();
let done = plugins.smartq.defer()
let socketRequest = new SocketRequest({
side:"requesting",
side: 'requesting',
originSocketConnection: this.socketConnection,
shortId: plugins.shortid.generate(),
funcCallData: {
funcName: functionNameArg,
funcDataArg: dataArg
}
});
})
socketRequest.dispatch()
.then((dataArg: ISocketFunctionCall) => {
done.resolve(dataArg.funcDataArg);
});
return done.promise;
};
done.resolve(dataArg.funcDataArg)
})
return done.promise
}
}

View File

@ -1,70 +1,70 @@
import * as plugins from "./smartsocket.plugins";
import * as helpers from "./smartsocket.helpers";
import * as plugins from './smartsocket.plugins'
import * as helpers from './smartsocket.helpers'
import {Objectmap} from "lik";
import { Objectmap } from 'lik'
// import classes
import { Smartsocket } from "./smartsocket.classes.smartsocket"
import { SocketFunction } from "./smartsocket.classes.socketfunction";
import { SocketRequest, ISocketRequestDataObject, allSocketRequests } from "./smartsocket.classes.socketrequest";
import { SocketRole } from "./smartsocket.classes.socketrole";
import { Smartsocket } from './smartsocket.classes.smartsocket'
import { SocketFunction } from './smartsocket.classes.socketfunction'
import { SocketRequest, ISocketRequestDataObject, allSocketRequests } from './smartsocket.classes.socketrequest'
import { SocketRole } from './smartsocket.classes.socketrole'
// export interfaces
/**
* defines is a SocketConnection is server or client side. Important for mesh setups.
*/
export type TSocketConnectionSide = "server" | "client";
export type TSocketConnectionSide = 'server' | 'client'
/**
* interface for constructor of class SocketConnection
*/
export interface ISocketConnectionConstructorOptions {
alias: string;
authenticated: boolean;
role: SocketRole;
side: TSocketConnectionSide;
smartsocketHost: Smartsocket;
socket: SocketIO.Socket | SocketIOClient.Socket;
};
alias: string
authenticated: boolean
role: SocketRole
side: TSocketConnectionSide
smartsocketHost: Smartsocket
socket: SocketIO.Socket | SocketIOClient.Socket
}
/**
* interface for authentication data
*/
export interface ISocketConnectionAuthenticationObject {
role: "coreflowContainer",
password: "somePassword",
alias: "coreflow1"
};
role: 'coreflowContainer',
password: 'somePassword',
alias: 'coreflow1'
}
// export classes
export let allSocketConnections = new Objectmap<SocketConnection>();
export let allSocketConnections = new Objectmap<SocketConnection>()
/**
* class SocketConnection represents a websocket connection
*/
export class SocketConnection {
alias: string;
side:TSocketConnectionSide;
authenticated: boolean = false;
role: SocketRole;
smartsocketHost:Smartsocket;
socket: SocketIO.Socket | SocketIOClient.Socket;
alias: string
side: TSocketConnectionSide
authenticated: boolean = false
role: SocketRole
smartsocketHost: Smartsocket
socket: any //: SocketIO.Socket | SocketIOClient.Socket
constructor (optionsArg: ISocketConnectionConstructorOptions) {
this.alias = optionsArg.alias;
this.authenticated = optionsArg.authenticated;
this.role = optionsArg.role;
this.side = optionsArg.side;
this.smartsocketHost = optionsArg.smartsocketHost;
this.socket = optionsArg.socket;
this.alias = optionsArg.alias
this.authenticated = optionsArg.authenticated
this.role = optionsArg.role
this.side = optionsArg.side
this.smartsocketHost = optionsArg.smartsocketHost
this.socket = optionsArg.socket
// standard behaviour that is always true
allSocketConnections.add(this);
this.socket.on("disconnect", () => {
plugins.beautylog.info(`SocketConnection with >alias ${this.alias} on >side ${this.side} disconnected`);
allSocketConnections.remove(this);
});
};
allSocketConnections.add(this)
this.socket.on('disconnect', () => {
plugins.beautylog.info(`SocketConnection with >alias ${this.alias} on >side ${this.side} disconnected`)
allSocketConnections.remove(this)
})
}
// authenticating --------------------------
@ -72,26 +72,26 @@ export class SocketConnection {
* authenticate the socket
*/
authenticate () {
let done = plugins.q.defer();
this.socket.on("dataAuth", (dataArg:ISocketConnectionAuthenticationObject) => {
plugins.beautylog.log("received authentication data. now hashing and comparing...");
this.socket.removeListener("dataAuth", () => { });
let done = plugins.smartq.defer()
this.socket.on('dataAuth', (dataArg: ISocketConnectionAuthenticationObject) => {
plugins.beautylog.log('received authentication data. now hashing and comparing...')
this.socket.removeListener('dataAuth', () => { })
if (helpers.checkPasswordForRole(dataArg, this.smartsocketHost)) { // TODO: authenticate password
this.alias = dataArg.alias
this.authenticated = true;
this.role = helpers.getSocketRoleByName(dataArg.role,this.smartsocketHost);
this.socket.emit("authenticated");
plugins.beautylog.ok(`socket with >>alias ${this.alias} >>role ${this.role} is authenticated!`);
done.resolve(this);
this.authenticated = true
this.role = helpers.getSocketRoleByName(dataArg.role, this.smartsocketHost)
this.socket.emit('authenticated')
plugins.beautylog.ok(`socket with >>alias ${this.alias} >>role ${this.role} is authenticated!`)
done.resolve(this)
} else {
this.authenticated = false;
this.socket.disconnect();
done.reject("not authenticated");
};
});
this.socket.emit("requestAuth");
return done.promise;
};
this.authenticated = false
this.socket.disconnect()
done.reject('not authenticated')
}
})
this.socket.emit('requestAuth')
return done.promise
}
// listening -------------------------------
@ -99,42 +99,42 @@ export class SocketConnection {
* listen to function requests
*/
listenToFunctionRequests () {
let done = plugins.q.defer();
let done = plugins.smartq.defer()
if (this.authenticated) {
this.socket.on("function", (dataArg:ISocketRequestDataObject) => {
this.socket.on('function', (dataArg: ISocketRequestDataObject) => {
// check if requested function is available to the socket's scope
plugins.beautylog.log("function request received");
plugins.beautylog.log('function request received')
let referencedFunction: SocketFunction = this.role.allowedFunctions.find((socketFunctionArg) => {
return socketFunctionArg.name === dataArg.funcCallData.funcName;
});
return socketFunctionArg.name === dataArg.funcCallData.funcName
})
if (referencedFunction !== undefined) {
plugins.beautylog.ok!("function in access scope");
plugins.beautylog.ok!('function in access scope')
let localSocketRequest = new SocketRequest({
side:"responding",
side: 'responding',
originSocketConnection: this,
shortId: dataArg.shortId,
funcCallData: dataArg.funcCallData
});
localSocketRequest.createResponse(); // takes care of creating response and sending it back
})
localSocketRequest.createResponse() // takes care of creating response and sending it back
} else {
plugins.beautylog.warn("function not existent or out of access scope");
};
});
this.socket.on("functionResponse", (dataArg:ISocketRequestDataObject) => {
plugins.beautylog.info(`received response for request with id ${dataArg.shortId}`);
let targetSocketRequest = helpers.getSocketRequestById(dataArg.shortId);
targetSocketRequest.handleResponse(dataArg);
});
plugins.beautylog.log(`now listening to function requests for ${this.alias}`);
done.resolve(this);
plugins.beautylog.warn('function not existent or out of access scope')
}
})
this.socket.on('functionResponse', (dataArg: ISocketRequestDataObject) => {
plugins.beautylog.info(`received response for request with id ${dataArg.shortId}`)
let targetSocketRequest = helpers.getSocketRequestById(dataArg.shortId)
targetSocketRequest.handleResponse(dataArg)
})
plugins.beautylog.log(`now listening to function requests for ${this.alias}`)
done.resolve(this)
} else {
let errMessage: "socket needs to be authenticated first";
plugins.beautylog.error(errMessage);
done.reject(errMessage);
};
return done.promise;
};
let errMessage: 'socket needs to be authenticated first'
plugins.beautylog.error(errMessage)
done.reject(errMessage)
}
return done.promise
}
// sending ----------------------
};
}

View File

@ -1,8 +1,8 @@
import * as plugins from "./smartsocket.plugins";
import * as plugins from './smartsocket.plugins'
// import classes
import { Objectmap } from "lik";
import { SocketRole } from "./smartsocket.classes.socketrole";
import { Objectmap } from 'lik'
import { SocketRole } from './smartsocket.classes.socketrole'
// export interfaces
@ -10,18 +10,18 @@ import { SocketRole } from "./smartsocket.classes.socketrole";
* interface of the contructor options of class SocketFunction
*/
export interface ISocketFunctionConstructorOptions {
funcName: string;
funcDef: any;
allowedRoles: SocketRole[]; // all roles that are allowed to execute a SocketFunction
};
funcName: string
funcDef: any
allowedRoles: SocketRole[] // all roles that are allowed to execute a SocketFunction
}
/**
* interface of the Socket Function call, in other words the object that routes a call to a function
*/
export interface ISocketFunctionCall {
funcName:string;
funcDataArg:any;
};
funcName: string
funcDataArg: any
}
/**
* interface for function definition of SocketFunction
@ -31,7 +31,7 @@ export interface IFuncDef {
}
// export objects
export let allSocketFunctions = new Objectmap<SocketFunction>();
export let allSocketFunctions = new Objectmap<SocketFunction>()
// export classes
@ -39,35 +39,28 @@ export let allSocketFunctions = new Objectmap<SocketFunction>();
* class that respresents a function that can be transparently called using a SocketConnection
*/
export class SocketFunction {
name: string;
funcDef: IFuncDef;
roles: SocketRole[];
name: string
funcDef: IFuncDef
roles: SocketRole[]
/**
* the constructor for SocketFunction
*/
constructor (optionsArg: ISocketFunctionConstructorOptions) {
this.name = optionsArg.funcName;
this.funcDef = optionsArg.funcDef;
this.roles = optionsArg.allowedRoles;
this.name = optionsArg.funcName
this.funcDef = optionsArg.funcDef
this.roles = optionsArg.allowedRoles
for (let socketRoleArg of this.roles) {
this._notifyRole(socketRoleArg);
};
allSocketFunctions.add(this); // map instance with Objectmap
};
/**
* notifies a role about access to this SocketFunction
*/
private _notifyRole(socketRoleArg:SocketRole){
socketRoleArg.addSocketFunction(this);
this._notifyRole(socketRoleArg)
}
allSocketFunctions.add(this) // map instance with Objectmap
}
/**
* invokes the function of this SocketFunction
*/
invoke(dataArg:ISocketFunctionCall):plugins.q.Promise<any> {
let done = plugins.q.defer();
invoke (dataArg: ISocketFunctionCall): Promise<any> {
let done = plugins.smartq.defer()
if (dataArg.funcName === this.name) {
this.funcDef(dataArg.funcDataArg)
.then((resultData: any) => {
@ -75,13 +68,19 @@ export class SocketFunction {
funcName: this.name,
funcDataArg: resultData
}
done.resolve(funcResponseData);
});
done.resolve(funcResponseData)
})
} else {
throw new Error("SocketFunction.name does not match the data argument's .name!");
throw new Error("SocketFunction.name does not match the data argument's .name!")
}
return done.promise
}
return done.promise;
};
/**
* notifies a role about access to this SocketFunction
*/
private _notifyRole (socketRoleArg: SocketRole) {
socketRoleArg.addSocketFunction(this)
}
}

View File

@ -1,55 +1,55 @@
import * as plugins from "./smartsocket.plugins";
import * as helpers from "./smartsocket.helpers";
import * as plugins from './smartsocket.plugins'
import * as helpers from './smartsocket.helpers'
// import interfaces
import { ISocketFunctionCall } from "./smartsocket.classes.socketfunction";
import { ISocketFunctionCall } from './smartsocket.classes.socketfunction'
// import classes
import { Objectmap } from "lik";
import { SocketFunction } from "./smartsocket.classes.socketfunction";
import { SocketConnection } from "./smartsocket.classes.socketconnection";
import { Objectmap } from 'lik'
import { SocketFunction } from './smartsocket.classes.socketfunction'
import { SocketConnection } from './smartsocket.classes.socketconnection'
// export interfaces
export type TSocketRequestStatus = "new" | "pending" | "finished";
export type TSocketRequestSide = "requesting" | "responding";
export type TSocketRequestStatus = 'new' | 'pending' | 'finished'
export type TSocketRequestSide = 'requesting' | 'responding'
/**
* interface of constructor of class SocketRequest
*/
export interface SocketRequestConstructorOptions {
side: TSocketRequestSide;
originSocketConnection: SocketConnection;
shortId: string;
funcCallData?: ISocketFunctionCall;
};
side: TSocketRequestSide
originSocketConnection: SocketConnection
shortId: string
funcCallData?: ISocketFunctionCall
}
/**
* request object that is sent initially and may or may not receive a response
*/
export interface ISocketRequestDataObject {
funcCallData: ISocketFunctionCall;
shortId: string;
responseTimeout?: number;
};
funcCallData: ISocketFunctionCall
shortId: string
responseTimeout?: number
}
// export objects
export let allSocketRequests = new Objectmap<SocketRequest>();
export let allSocketRequests = new Objectmap<SocketRequest>()
// export classes
export class SocketRequest {
status: TSocketRequestStatus = "new";
side: TSocketRequestSide;
shortid: string;
originSocketConnection: SocketConnection;
status: TSocketRequestStatus = 'new'
side: TSocketRequestSide
shortid: string
originSocketConnection: SocketConnection
funcCallData: ISocketFunctionCall
done = plugins.q.defer();
done = plugins.smartq.defer()
constructor (optionsArg: SocketRequestConstructorOptions) {
this.side = optionsArg.side;
this.shortid = optionsArg.shortId;
this.funcCallData = optionsArg.funcCallData;
this.originSocketConnection = optionsArg.originSocketConnection;
allSocketRequests.add(this);
};
this.side = optionsArg.side
this.shortid = optionsArg.shortId
this.funcCallData = optionsArg.funcCallData
this.originSocketConnection = optionsArg.originSocketConnection
allSocketRequests.add(this)
}
// requesting --------------------------
@ -61,17 +61,17 @@ export class SocketRequest {
funcCallData: this.funcCallData,
shortId: this.shortid
}
this.originSocketConnection.socket.emit("function", requestData);
return this.done.promise;
};
this.originSocketConnection.socket.emit('function', requestData)
return this.done.promise
}
/**
* handles the response that is received by the requesting side
*/
handleResponse (responseDataArg: ISocketRequestDataObject) {
plugins.beautylog.log("handling response!");
this.done.resolve(responseDataArg.funcCallData);
allSocketRequests.remove(this);
plugins.beautylog.log('handling response!')
this.done.resolve(responseDataArg.funcCallData)
allSocketRequests.remove(this)
}
// responding --------------------------
@ -80,17 +80,17 @@ export class SocketRequest {
* creates the response on the responding side
*/
createResponse () {
let targetSocketFunction: SocketFunction = helpers.getSocketFunctionByName(this.funcCallData.funcName);
plugins.beautylog.info(`invoking ${targetSocketFunction.name}`);
let targetSocketFunction: SocketFunction = helpers.getSocketFunctionByName(this.funcCallData.funcName)
plugins.beautylog.info(`invoking ${targetSocketFunction.name}`)
targetSocketFunction.invoke(this.funcCallData)
.then((resultData) => {
plugins.beautylog.log("got resultData. Sending it to requesting party.")
plugins.beautylog.log('got resultData. Sending it to requesting party.')
let requestData: ISocketRequestDataObject = {
funcCallData: resultData,
shortId: this.shortid
};
this.originSocketConnection.socket.emit("functionResponse",requestData);
allSocketRequests.remove(this);
});
}
};
this.originSocketConnection.socket.emit('functionResponse', requestData)
allSocketRequests.remove(this)
})
}
}

View File

@ -1,9 +1,9 @@
import "typings-global";
export import beautylog = require("beautylog");
export import lik = require("lik");
export import nodehash = require("nodehash");
export import q = require("q");
export import shortid = require("shortid");
export import socketIo = require("socket.io");
export import socketIoClient = require("socket.io-client");
export import taskbuffer = require("taskbuffer");
import 'typings-global'
export import beautylog = require('beautylog')
export import lik = require('lik')
export import nodehash = require('nodehash')
export import smartq = require('smartq')
export import shortid = require('shortid')
export import socketIo = require('socket.io')
export import socketIoClient = require('socket.io-client')
export import taskbuffer = require('taskbuffer')

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}

898
yarn.lock Normal file
View File

@ -0,0 +1,898 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/chai-as-promised@0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77"
dependencies:
"@types/chai" "*"
"@types/promises-a-plus" "*"
"@types/chai-string@^1.1.30":
version "1.1.30"
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a"
dependencies:
"@types/chai" "*"
"@types/chai@*":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.1.tgz#37fea779617cfec3fd2b19a0247e8bbdd5133bf6"
"@types/chai@^3.4.35":
version "3.5.2"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
"@types/cron@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@types/cron/-/cron-1.2.1.tgz#95c1e432d6106ca34c92f0743638bc786c073faa"
"@types/lodash@4.x.x", "@types/lodash@^4.14.55", "@types/lodash@^4.14.67":
version "4.14.68"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.68.tgz#754fbab68bd2bbb69547dc8ce7574f7012eed7f6"
"@types/minimatch@2.x.x":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
"@types/node@*":
version "8.0.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.8.tgz#0dc4ca2c6f6fc69baee16c5e928c4a627f517ada"
"@types/promises-a-plus@*":
version "0.0.27"
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
"@types/q@0.x.x":
version "0.0.35"
resolved "https://registry.yarnpkg.com/@types/q/-/q-0.0.35.tgz#1893674fb15f138013ec108d233f68fc7df0f155"
"@types/q@1.x.x":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.0.2.tgz#41f0b0f6ae0eeed3a51b003e2e08cba5525b74f6"
"@types/shelljs@^0.7.2":
version "0.7.2"
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.2.tgz#c2bdb3fe80cd7a3da08750ca898ae44c589671f3"
dependencies:
"@types/node" "*"
"@types/shortid@0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/shortid/-/shortid-0.0.29.tgz#8093ee0416a6e2bf2aa6338109114b3fbffa0e9b"
"@types/socket.io-client@^1.4.29":
version "1.4.29"
resolved "https://registry.yarnpkg.com/@types/socket.io-client/-/socket.io-client-1.4.29.tgz#f8743070cee93175e36e0b6a77a8af73e58ccb32"
"@types/socket.io@^1.4.29":
version "1.4.29"
resolved "https://registry.yarnpkg.com/@types/socket.io/-/socket.io-1.4.29.tgz#86a6b3a9ab78cf9a900ceef85b9b68b6bea86712"
dependencies:
"@types/node" "*"
"@types/through2@0.x.x":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@types/through2/-/through2-0.4.1.tgz#0f008e174c1dc5f1cc7e00eb2d132b2cb67f7bd2"
dependencies:
"@types/node" "*"
"@types/which@^1.0.28":
version "1.0.28"
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
accepts@1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.3.tgz#c3ca7434938648c3e0d9c1e328dd68b622c284ca"
dependencies:
mime-types "~2.1.11"
negotiator "0.6.1"
after@0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f"
ansi-256-colors@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
arraybuffer.slice@0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz#f33b2159f0532a3f3107a272c0ccfbd1ad2979ca"
assertion-error@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
backo2@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947"
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
base64-arraybuffer@0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz#73926771923b5a19747ad666aa5cd4bf9c6e9ce8"
base64id@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/base64id/-/base64id-1.0.0.tgz#47688cb99bb6804f0e06d3e763b1c32e57d8e6b6"
beautycolor@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c"
dependencies:
ansi-256-colors "^1.1.0"
typings-global "^1.0.14"
beautylog@^6.1.10:
version "6.1.10"
resolved "https://registry.yarnpkg.com/beautylog/-/beautylog-6.1.10.tgz#9c27e566937684cb689f9372d98cfa5415d50b72"
dependencies:
"@types/lodash" "^4.14.55"
beautycolor "^1.0.7"
figlet "^1.2.0"
lodash "^4.17.4"
ora "^1.1.0"
smartenv "^2.0.0"
smartq "^1.1.1"
typings-global "^1.0.14"
better-assert@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/better-assert/-/better-assert-1.0.2.tgz#40866b9e1b9e0b55b481894311e68faffaebc522"
dependencies:
callsite "1.0.0"
bindings@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
blob@0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/blob/-/blob-0.0.4.tgz#bcf13052ca54463f30f9fc7e95b9a47630a94921"
brace-expansion@^1.1.7:
version "1.1.8"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
callsite@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20"
chai-as-promised@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6"
dependencies:
check-error "^1.0.2"
chai-string@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49"
chai@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
dependencies:
assertion-error "^1.0.1"
deep-eql "^0.1.3"
type-detect "^1.0.0"
chalk@^1.0.0, chalk@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
check-error@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
cli-cursor@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
dependencies:
restore-cursor "^2.0.0"
cli-spinners@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.0.0.tgz#ef987ed3d48391ac3dab9180b406a742180d6e6a"
component-bind@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/component-bind/-/component-bind-1.0.0.tgz#00c608ab7dcd93897c0009651b1d3a8e1e73bbd1"
component-emitter@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6"
component-inherit@0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
cookie@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
cron@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/cron/-/cron-1.2.1.tgz#3a86c09b41b8f261ac863a7cc85ea4735857eab2"
dependencies:
moment-timezone "^0.5.x"
debug@2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.3.3.tgz#40c453e67e6e13c901ddec317af8986cda9eff8c"
dependencies:
ms "0.7.2"
debug@~2.6.4, debug@~2.6.6:
version "2.6.8"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
dependencies:
ms "2.0.0"
deep-eql@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
dependencies:
type-detect "0.1.1"
define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
dependencies:
foreach "^2.0.5"
object-keys "^1.0.8"
early@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
dependencies:
beautycolor "^1.0.7"
smartq "^1.1.1"
typings-global "^1.0.16"
engine.io-client@~3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/engine.io-client/-/engine.io-client-3.1.1.tgz#415a9852badb14fa008fa3ef1e31608db6761325"
dependencies:
component-emitter "1.2.1"
component-inherit "0.0.3"
debug "~2.6.4"
engine.io-parser "~2.1.1"
has-cors "1.1.0"
indexof "0.0.1"
parsejson "0.0.3"
parseqs "0.0.5"
parseuri "0.0.5"
ws "~2.3.1"
xmlhttprequest-ssl "1.5.3"
yeast "0.1.2"
engine.io-parser@~2.1.0, engine.io-parser@~2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-2.1.1.tgz#e0fb3f0e0462f7f58bb77c1a52e9f5a7e26e4668"
dependencies:
after "0.8.2"
arraybuffer.slice "0.0.6"
base64-arraybuffer "0.1.5"
blob "0.0.4"
has-binary2 "~1.0.2"
engine.io@~3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-3.1.0.tgz#5ca438e3ce9fdbc915c4a21c8dd9e1266706e57e"
dependencies:
accepts "1.3.3"
base64id "1.0.0"
cookie "0.3.1"
debug "~2.6.4"
engine.io-parser "~2.1.0"
ws "~2.3.1"
optionalDependencies:
uws "~0.14.4"
es-abstract@^1.5.1:
version "1.7.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.7.0.tgz#dfade774e01bfcd97f96180298c449c8623fb94c"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.0"
is-callable "^1.1.3"
is-regex "^1.0.3"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.1"
is-symbol "^1.0.1"
es6-error@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98"
escape-string-regexp@^1.0.2:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
figlet@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.2.0.tgz#6c46537378fab649146b5a6143dda019b430b410"
foreach@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
function-bind@^1.0.2, function-bind@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"
glob@^7.0.0:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
dependencies:
ansi-regex "^2.0.0"
has-binary2@~1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/has-binary2/-/has-binary2-1.0.2.tgz#e83dba49f0b9be4d026d27365350d9f03f54be98"
dependencies:
isarray "2.0.1"
has-cors@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/has-cors/-/has-cors-1.1.0.tgz#5e474793f7ea9843d1bb99c23eef49ff126fff39"
has@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
dependencies:
function-bind "^1.0.2"
indexof@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d"
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2, inherits@~2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
interpret@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90"
is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-regex@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
dependencies:
has "^1.0.1"
is-symbol@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
isarray@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.1.tgz#a37d94ed9cda2d59865c9f76fe596ee1f338741e"
isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
leakage@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
dependencies:
es6-error "^4.0.2"
left-pad "^1.1.3"
memwatch-next "^0.3.0"
minimist "^1.2.0"
pretty-bytes "^4.0.2"
left-pad@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
lik@^1.0.32, lik@^1.0.38:
version "1.0.38"
resolved "https://registry.yarnpkg.com/lik/-/lik-1.0.38.tgz#ccff0abd3d9236a5e4b7d80d514c5c210f18469b"
dependencies:
"@types/lodash" "^4.14.67"
"@types/minimatch" "2.x.x"
"@types/q" "1.x.x"
lodash "^4.17.4"
minimatch "^3.0.4"
q "^1.5.0"
rxjs "^5.4.1"
smartq "^1.1.1"
typings-global "^1.0.19"
lodash@^4.17.4:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
log-symbols@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18"
dependencies:
chalk "^1.0.0"
memwatch-next@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
dependencies:
bindings "^1.2.1"
nan "^2.3.2"
mime-db@~1.27.0:
version "1.27.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1"
mime-types@~2.1.11:
version "2.1.15"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.15.tgz#a4ebf5064094569237b8cf70046776d09fc92aed"
dependencies:
mime-db "~1.27.0"
mimic-fn@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
brace-expansion "^1.1.7"
minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
moment-timezone@^0.5.x:
version "0.5.13"
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.13.tgz#99ce5c7d827262eb0f1f702044177f60745d7b90"
dependencies:
moment ">= 2.9.0"
"moment@>= 2.9.0":
version "2.18.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f"
ms@0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
nan@^2.3.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
negotiator@0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
nodehash@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/nodehash/-/nodehash-1.0.4.tgz#fd733397a0925b9b4bc19726f3c0e68850206e7f"
dependencies:
"@types/q" "0.x.x"
"@types/through2" "0.x.x"
q "^1.4.1"
through2 "^2.0.1"
typings-global "^1.0.6"
object-assign@~4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
object-component@0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291"
object-keys@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
object.getownpropertydescriptors@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.5.1"
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
dependencies:
wrappy "1"
onetime@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
dependencies:
mimic-fn "^1.0.0"
ora@^1.1.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-1.3.0.tgz#80078dd2b92a934af66a3ad72a5b910694ede51a"
dependencies:
chalk "^1.1.1"
cli-cursor "^2.1.0"
cli-spinners "^1.0.0"
log-symbols "^1.0.2"
parsejson@0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/parsejson/-/parsejson-0.0.3.tgz#ab7e3759f209ece99437973f7d0f1f64ae0e64ab"
dependencies:
better-assert "~1.0.0"
parseqs@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/parseqs/-/parseqs-0.0.5.tgz#d5208a3738e46766e291ba2ea173684921a8b89d"
dependencies:
better-assert "~1.0.0"
parseuri@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/parseuri/-/parseuri-0.0.5.tgz#80204a50d4dbb779bfdc6ebe2778d90e4bce320a"
dependencies:
better-assert "~1.0.0"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
path-parse@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
pretty-bytes@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
process-nextick-args@~1.0.6:
version "1.0.7"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"
q@^1.4.1, q@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
readable-stream@^2.1.5:
version "2.3.3"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c"
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.3"
isarray "~1.0.0"
process-nextick-args "~1.0.6"
safe-buffer "~5.1.1"
string_decoder "~1.0.3"
util-deprecate "~1.0.1"
rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
dependencies:
resolve "^1.1.6"
resolve@^1.1.6:
version "1.3.3"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5"
dependencies:
path-parse "^1.0.5"
restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
dependencies:
onetime "^2.0.0"
signal-exit "^3.0.2"
rxjs@^5.4.1:
version "5.4.2"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.2.tgz#2a3236fcbf03df57bae06fd6972fd99e5c08fcf7"
dependencies:
symbol-observable "^1.0.1"
safe-buffer@~5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7"
safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
semver@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
shelljs@^0.7.8:
version "0.7.8"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
dependencies:
glob "^7.0.0"
interpret "^1.0.0"
rechoir "^0.6.2"
shortid@^2.2.8:
version "2.2.8"
resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.8.tgz#033b117d6a2e975804f6f0969dbe7d3d0b355131"
signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
smartchai@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
dependencies:
"@types/chai" "^3.4.35"
"@types/chai-as-promised" "0.0.29"
"@types/chai-string" "^1.1.30"
chai "^3.5.0"
chai-as-promised "^6.0.0"
chai-string "^1.3.0"
smartdelay@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.3.tgz#5fd44dad77262d110702f0293efa80c072cfb579"
dependencies:
smartq "^1.1.1"
typings-global "^1.0.16"
smartenv@^2.0.0:
version "2.0.6"
resolved "https://registry.yarnpkg.com/smartenv/-/smartenv-2.0.6.tgz#b38c679b0c151b9af548f68c3a072c29d1417e8d"
dependencies:
lodash "^4.17.4"
smartq "^1.1.1"
typings-global "^1.0.14"
smartq@^1.1.1, smartq@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
dependencies:
typings-global "^1.0.19"
util.promisify "^1.0.0"
smartshell@^1.0.6:
version "1.0.8"
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.8.tgz#1535756c0fe8069f7e6da1e3f9cb6c8f77094e42"
dependencies:
"@types/shelljs" "^0.7.2"
"@types/which" "^1.0.28"
shelljs "^0.7.8"
smartq "^1.1.1"
typings-global "^1.0.19"
which "^1.2.14"
socket.io-adapter@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-1.1.0.tgz#c7aa46501dd556c2cb8a28af8ff95c0b5e1daa4c"
dependencies:
debug "2.3.3"
socket.io-client@^2.0.3, socket.io-client@~2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-2.0.3.tgz#6caf4aff9f85b19fd91b6ce13d69adb564f8873b"
dependencies:
backo2 "1.0.2"
base64-arraybuffer "0.1.5"
component-bind "1.0.0"
component-emitter "1.2.1"
debug "~2.6.4"
engine.io-client "~3.1.0"
has-cors "1.1.0"
indexof "0.0.1"
object-component "0.0.3"
parseqs "0.0.5"
parseuri "0.0.5"
socket.io-parser "~3.1.1"
to-array "0.1.4"
socket.io-parser@~3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-3.1.2.tgz#dbc2282151fc4faebbe40aeedc0772eba619f7f2"
dependencies:
component-emitter "1.2.1"
debug "~2.6.4"
has-binary2 "~1.0.2"
isarray "2.0.1"
socket.io@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-2.0.3.tgz#4359f06a24933ae6bd087798af78c680eae345e3"
dependencies:
debug "~2.6.6"
engine.io "~3.1.0"
object-assign "~4.1.1"
socket.io-adapter "~1.1.0"
socket.io-client "~2.0.2"
socket.io-parser "~3.1.1"
string_decoder@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab"
dependencies:
safe-buffer "~5.1.0"
strip-ansi@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
dependencies:
ansi-regex "^2.0.0"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
symbol-observable@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
tapbundle@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.0.tgz#e0547f683ae36260f639ecd7435df95f0af01683"
dependencies:
early "^2.1.1"
leakage "^0.3.0"
smartchai "^1.0.3"
smartdelay "^1.0.3"
smartq "^1.1.1"
typings-global "^1.0.19"
taskbuffer@^1.0.17:
version "1.0.17"
resolved "https://registry.yarnpkg.com/taskbuffer/-/taskbuffer-1.0.17.tgz#3d304cb80449ff536aacf92f8a051a34620c223e"
dependencies:
"@types/cron" "^1.2.1"
"@types/lodash" "4.x.x"
beautylog "^6.1.10"
cron "^1.2.1"
lik "^1.0.32"
lodash "^4.17.4"
rxjs "^5.4.1"
smartdelay "^1.0.3"
smartq "^1.1.1"
typings-global "^1.0.17"
through2@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
dependencies:
readable-stream "^2.1.5"
xtend "~4.0.1"
to-array@0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890"
type-detect@0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
type-detect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.17, typings-global@^1.0.19, typings-global@^1.0.6:
version "1.0.19"
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.19.tgz#3376a72d4de1e5541bf5702248ff64c3e6ea316c"
dependencies:
semver "^5.3.0"
smartshell "^1.0.6"
ultron@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.0.tgz#b07a2e6a541a815fc6a34ccd4533baec307ca864"
util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
util.promisify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
dependencies:
define-properties "^1.1.2"
object.getownpropertydescriptors "^2.0.3"
uws@~0.14.4:
version "0.14.5"
resolved "https://registry.yarnpkg.com/uws/-/uws-0.14.5.tgz#67aaf33c46b2a587a5f6666d00f7691328f149dc"
which@^1.2.14:
version "1.2.14"
resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5"
dependencies:
isexe "^2.0.0"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
ws@~2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-2.3.1.tgz#6b94b3e447cb6a363f785eaf94af6359e8e81c80"
dependencies:
safe-buffer "~5.0.1"
ultron "~1.1.0"
xmlhttprequest-ssl@1.5.3:
version "1.5.3"
resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz#185a888c04eca46c3e4070d99f7b49de3528992d"
xtend@~4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
yeast@0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"