nats-hemera
Advanced tools
Comparing version 0.1.60 to 0.1.61
{ | ||
"lerna": "2.0.0-beta.30", | ||
"version": "0.1.60" | ||
"version": "independent" | ||
} |
@@ -53,2 +53,3 @@ /*! | ||
this.meta$ = {} | ||
this.delegate$ = {} | ||
this.plugin$ = {} | ||
@@ -82,2 +83,4 @@ this.trace$ = {} | ||
ctx.meta$ = Hoek.merge(pattern.meta$ || {}, ctx.meta$) | ||
//Is only passed by msg | ||
ctx.delegate$ = pattern.delegate$ || {} | ||
@@ -103,2 +106,3 @@ //Tracing | ||
meta$: ctx.meta$, | ||
delegate$: ctx.delegate$, | ||
trace$: ctx.trace$, | ||
@@ -149,2 +153,3 @@ request$: request | ||
ctx.trace$ = msg.trace$ || {} | ||
ctx.delegate$ = msg.delegate$ || {} | ||
ctx.request$ = msg.request$ || {} | ||
@@ -230,4 +235,4 @@ } | ||
return this._topics | ||
} | ||
return this._topics | ||
} | ||
/** | ||
@@ -243,5 +248,5 @@ * | ||
this._extensions[type].subscribe(handler) | ||
this._extensions[type].subscribe(handler) | ||
} | ||
} | ||
/** | ||
@@ -248,0 +253,0 @@ * @param {any} plugin |
{ | ||
"name": "nats-hemera", | ||
"author": "Dustin Deus (https://github.com/StarpTech)", | ||
"version": "0.1.60", | ||
"version": "0.1.61", | ||
"main": "index.js", | ||
@@ -40,3 +40,3 @@ "homepage": "https://hemerajs.github.io/hemera/", | ||
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report text-lcov -- -R spec | node ./node_modules/coveralls/bin/coveralls.js", | ||
"lint": "eslint --ext .js,.vue lib test examples benchmark" | ||
"lint": "eslint --ext .js lib test examples benchmark" | ||
}, | ||
@@ -43,0 +43,0 @@ "engines": { |
@@ -226,3 +226,3 @@ # Hemera | ||
``` | ||
Will set the metadata only for this `act` and all nested `act` | ||
Will set the metadata only for this `act` and all nested operations. | ||
```js | ||
@@ -261,3 +261,3 @@ hemera.act({ topic: 'math', cmd: 'add', a: 1, b: 1, meta$: { a: 'test' } }, function (err, resp) { | ||
hemera.act({ topic: 'math', cmd: 'add', a: 1, b: 1, context$: 1 }, function (err, resp) { | ||
//or | ||
this.act({ topic: 'math', cmd: 'add', a: 1, b: 5 }, function (err, resp) { | ||
@@ -269,3 +269,13 @@ | ||
``` | ||
If you want to pass data only to the next you can use `delegate$` | ||
```js | ||
hemera.act({ topic: 'math', cmd: 'add', a: 1, b: 1, delegate$: { query: 'Select from Users' } }, function (err, resp) { | ||
this.act({ topic: 'math', cmd: 'add', a: 1, b: 5 }, function (err, resp) { | ||
//or | ||
this.delegate$.query = 'Select from Users' | ||
}); | ||
}); | ||
``` | ||
### Extension points | ||
@@ -404,19 +414,10 @@ You can extend the behavior by extension. | ||
#### Request | ||
```JSON | ||
{ | ||
"pattern": "<object>", | ||
"meta$": "<object>", | ||
"request$": "<object>" | ||
} | ||
pattern: "<object>", | ||
meta$: "<object>", | ||
delegate$: "<object>", | ||
trace$: "<object>", | ||
request$: "<object>", | ||
``` | ||
#### Response | ||
```JSON | ||
{ | ||
"result": "<any>", | ||
"error": "<serialized_error>", | ||
"meta$": "<object>", | ||
"response$": "<object>" | ||
} | ||
``` | ||
## Best practice | ||
@@ -423,0 +424,0 @@ |
Sorry, the diff of this file is not supported yet
820
507
46053