@betit/orion-node-sdk
Advanced tools
Comparing version 1.0.0-beta.8 to 1.0.0-beta.9
@@ -64,3 +64,3 @@ // @ts-check | ||
REQ.meta.time = new Date().toString(); | ||
REQ.callTimeout = 1100; | ||
REQ.timeout = 1100; | ||
SERVICE.call(REQ, (res) => { | ||
@@ -67,0 +67,0 @@ console.log('/examples-node/delay request id', REQ.getId()); |
@@ -33,9 +33,24 @@ "use strict"; | ||
const TODAY = new Date(); | ||
const HOURS = TODAY.getHours(); | ||
const MINUTES = TODAY.getMinutes(); | ||
const SECONDS = TODAY.getSeconds(); | ||
const MILISECONDS = TODAY.getMilliseconds(); | ||
return HOURS + ':' + MINUTES + ':' + SECONDS + ':' + MILISECONDS; | ||
let hours = TODAY.getHours(); | ||
if (hours < 10) { | ||
hours = '0' + hours; | ||
} | ||
let minutes = TODAY.getMinutes(); | ||
if (minutes < 10) { | ||
minutes = '0' + minutes; | ||
} | ||
let seconds = TODAY.getSeconds(); | ||
if (seconds < 10) { | ||
seconds = '0' + seconds; | ||
} | ||
let milliseconds = TODAY.getMilliseconds(); | ||
if (milliseconds < 10) { | ||
milliseconds = '0' + milliseconds; | ||
} | ||
if (milliseconds < 99) { | ||
milliseconds = '0' + milliseconds; | ||
} | ||
return hours + ':' + minutes + ':' + seconds + ':' + milliseconds; | ||
} | ||
} | ||
exports.Logger = Logger; |
@@ -7,3 +7,3 @@ export declare class Request { | ||
}; | ||
callTimeout: number; | ||
timeout: number; | ||
meta: { | ||
@@ -10,0 +10,0 @@ [key: string]: string; |
@@ -63,3 +63,3 @@ import { Options, Logger } from '../types/interfaces'; | ||
call(req: any, callback?: Function): void; | ||
getCallTimeout(path: string, timeout: number): any; | ||
private _getCallTimeout(path, timeout); | ||
private _call(route, req, callback); | ||
@@ -66,0 +66,0 @@ private _handle(path, callback, logging, prefix?); |
@@ -26,3 +26,4 @@ "use strict"; | ||
this.options = Object.assign({ | ||
callTimeout: 200 | ||
timeout: 200, | ||
timeouts: {}, | ||
}, options); | ||
@@ -111,6 +112,6 @@ this._codec = new codec_1.DefaultBinaryCodec(); | ||
} | ||
getCallTimeout(path, timeout) { | ||
_getCallTimeout(path, timeout) { | ||
let options = this.options; | ||
let specificCallTimeout = options.callTimeouts && options.callTimeouts[path]; | ||
return timeout || specificCallTimeout || options.callTimeout; | ||
let specificCallTimeout = options.timeout && options.timeouts[path]; | ||
return timeout || specificCallTimeout || options.timeout; | ||
} | ||
@@ -134,3 +135,3 @@ _call(route, req, callback) { | ||
} | ||
}, this.getCallTimeout(req.path, req.callTimeout)); | ||
}, this._getCallTimeout(req.path, req.timeout)); | ||
} | ||
@@ -188,9 +189,9 @@ _handle(path, callback, logging, prefix) { | ||
} | ||
const REQ = new request_1.Request(request.path, this._codec.encode(request.params)); | ||
REQ.callTimeout = request.callTimeout; | ||
REQ.tracerData = request.tracerData; | ||
REQ.meta = request.meta; | ||
let req = new request_1.Request(request.path, this._codec.encode(request.params)); | ||
req.timeout = request.timeout; | ||
req.tracerData = request.tracerData; | ||
req.meta = request.meta; | ||
DEBUG('calling:', route); | ||
DEBUG('sending request:', request); | ||
this._call(route, REQ, callback); | ||
this._call(route, req, callback); | ||
} | ||
@@ -197,0 +198,0 @@ _checkResponse(res) { |
@@ -64,3 +64,3 @@ "use strict"; | ||
*/ | ||
request(route, payload, callback, timeout = 1000) { | ||
request(route, payload, callback, timeout = 200) { | ||
DEBUG('sending request:', route); | ||
@@ -67,0 +67,0 @@ const SID = this._client.request(route, payload, { max: 1 }, response => { |
@@ -51,5 +51,5 @@ import { Request } from '../request/request'; | ||
logger?: Logger; | ||
callTimeout?: number; | ||
callTimeouts?: {}; | ||
timeout?: number; | ||
timeouts?: {}; | ||
service?: string; | ||
} |
{ | ||
"name": "@betit/orion-node-sdk", | ||
"version": "1.0.0-beta.8", | ||
"description": "Pluggable microservice framework", | ||
"version": "1.0.0-beta.9", | ||
"description": "SDK for orion microservice", | ||
"license": "MIT", | ||
"repository": "betit/orion", | ||
"repository": "betit/orion-node-sdk", | ||
"typings": "lib/orion.d.ts", | ||
@@ -11,13 +11,7 @@ "main": "lib/orion.js", | ||
"build": "tsc", | ||
"buildtest": "tsc --project test", | ||
"pretest": "npm run build && npm run buildtest", | ||
"test": "npm run lint && ava --verbose tmp", | ||
"coverage": "npm run pretest && nyc ava tmp", | ||
"covreport": "npm run coverage && nyc report --reporter=lcov > coverage.lcov && codecov", | ||
"stress": "npm run pretest && for i in {1..10}; do ava --verbose tmp; done", | ||
"test": "npm run lint && npm run build && node_modules/.bin/mocha ./test", | ||
"coverage": "istanbul cover node_modules/mocha/bin/_mocha ./test", | ||
"covreport": "npm run coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", | ||
"lint": "tslint --config tslint.json src/**/*.ts --exclude src/**/*.d.ts", | ||
"site": "rm -rf public && metalsmith && npm run build && jsdoc -c jsdoc.json", | ||
"prevsite": "metalsmith && jsdoc -c jsdoc.json", | ||
"ghpages": "npm run site && gh-pages -d public", | ||
"postpublish": "greenkeeper-postpublish" | ||
"ghpages": "npm run site && gh-pages -d public" | ||
}, | ||
@@ -36,18 +30,7 @@ "dependencies": { | ||
"@types/node": "8.0.24", | ||
"@types/request": "2.0.2", | ||
"@types/ws": "3.0.2", | ||
"ava": "0.22.0", | ||
"codecov": "2.3.0", | ||
"chai": "4.1.2", | ||
"coveralls": "2.13.1", | ||
"docdash": "0.4.0", | ||
"gh-pages": "1.0.0", | ||
"github-changes": "1.1.0", | ||
"greenkeeper-postpublish": "1.3.0", | ||
"handlebars": "4.0.10", | ||
"jsdoc": "3.5.4", | ||
"metalsmith": "2.3.0", | ||
"metalsmith-layouts": "1.8.1", | ||
"metalsmith-markdown": "0.2.1", | ||
"metalsmith-permalinks": "0.5.0", | ||
"nyc": "11.1.0", | ||
"istanbul": "0.4.5", | ||
"mocha": "4.0.1", | ||
"tslint": "5.6.0", | ||
@@ -54,0 +37,0 @@ "typescript": "2.4.2" |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
40525
8
43
1230
1
21