From cc30caa8aa383c168f0b4f956b97a77394ec0a59 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sat, 5 May 2018 20:09:21 -0500 Subject: [PATCH] Release 1.0.0-alpha.25 :rocket: - Implemented Metadata Passing to RPC and Streams --- .gitignore | 3 ++- package.json | 6 +++--- src/core/call.responser.ts | 7 ++++++- src/core/call.streamer.ts | 4 ++-- src/index.ts | 2 +- test/onixjs.acceptance.ts | 2 +- test/onixjs.core.unit.ts | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 86ca675..b611930 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ documentation dist dist6 package-lock.json -sdk:storage \ No newline at end of file +sdk:storage +.test \ No newline at end of file diff --git a/package.json b/package.json index 5fce35a..20f3fbc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onixjs/core", - "version": "1.0.0-alpha.24", + "version": "1.0.0-alpha.25", "description": "An Enterprise Grade NodeJS Platform that implements Industry Standards and Patterns in order to provide Connectivity, Stability, High-Availability and High-Performance.", "main": "dist/src/index.js", "scripts": { @@ -49,8 +49,7 @@ }, "dependencies": { "@onixjs/enumerable": "1.0.0-alpha.7", - "@onixjs/sdk": "^1.0.0-alpha.8", - "@types/uws": "^0.13.2", + "@onixjs/sdk": "^1.0.0-alpha.13.1", "finalhandler": "^1.1.1", "reflect-metadata": "^0.1.12", "router": "^1.3.2", @@ -61,6 +60,7 @@ "@types/mongoose": "^5.0.2", "@types/node": "^9.4.6", "@types/send": "^0.14.4", + "@types/uws": "^0.13.2", "ava": "^0.25.0", "coveralls": "^3.0.0", "dot": "^1.1.2", diff --git a/src/core/call.responser.ts b/src/core/call.responser.ts index a85ea01..8633cf7 100644 --- a/src/core/call.responser.ts +++ b/src/core/call.responser.ts @@ -138,6 +138,7 @@ export class CallResponser { ? await method.call( scope, operation.message.request.payload, + operation.message.request.metadata, ) : null; }, @@ -145,7 +146,11 @@ export class CallResponser { } else { // Else just call the requested method now. return method - ? await method.call(scope, operation.message.request.payload) + ? await method.call( + scope, + operation.message.request.payload, + operation.message.request.metadata, + ) : null; } }, diff --git a/src/core/call.streamer.ts b/src/core/call.streamer.ts index e241781..64cefb5 100644 --- a/src/core/call.streamer.ts +++ b/src/core/call.streamer.ts @@ -117,7 +117,7 @@ export class CallStreamer { ? method.call( scope, data => handler(slaveSubHandler(masterSubHandler(data))), - operation.message.request.payload, + operation.message.request.metadata, ) : null; }, @@ -128,7 +128,7 @@ export class CallStreamer { ? method.call( scope, data => handler(masterSubHandler(data)), - operation.message.request.payload, + operation.message.request.metadata, ) : null; } diff --git a/src/index.ts b/src/index.ts index 71f8f7a..0c4ded3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -40,7 +40,7 @@ export class OnixJS { * @description Current Onix Version. */ get version(): string { - return '1.0.0-alpha.24'; + return '1.0.0-alpha.25'; } /** * @property router diff --git a/test/onixjs.acceptance.ts b/test/onixjs.acceptance.ts index 300dd5c..405ec32 100644 --- a/test/onixjs.acceptance.ts +++ b/test/onixjs.acceptance.ts @@ -134,7 +134,7 @@ test('Onix rpc component stream', async t => { // Init SDK await client.init(); // Create a TodoApp Reference - const TodoAppRef: AppReference | Error = client.AppReference('TodoApp'); + const TodoAppRef: AppReference | Error = await client.AppReference('TodoApp'); // Verify we actually got a Reference and not an Error if (TodoAppRef instanceof AppReference) { const componentRef: ComponentReference = TodoAppRef.Module( diff --git a/test/onixjs.core.unit.ts b/test/onixjs.core.unit.ts index 99a9dbd..41a330d 100644 --- a/test/onixjs.core.unit.ts +++ b/test/onixjs.core.unit.ts @@ -37,7 +37,7 @@ import {CallResponser} from '../src/core/call.responser'; import * as WebSocket from 'uws'; import * as dot from 'dot'; import {CallStreamer} from '../src/core/call.streamer'; -import {NodeJS} from '@onixjs/sdk/dist/core/node.adapters'; +import {NodeJS} from '@onixjs/sdk/dist/adapters/node.adapters'; import {Utils} from '@onixjs/sdk/dist/utils'; import {Mongoose, Schema} from 'mongoose'; import {GroupMatch} from '../src/core/acl.group.match';