Skip to content

Commit

Permalink
move away from deprecated syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
cupsadarius committed Oct 8, 2021
1 parent d6c4663 commit c1d6fd5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## v1.4.0

- migrate from deprecated shorthand syntax for middleware

## v1.3.0

- allow newer nodejs versions
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

Add support for continuation local storage in moleculer action handlers.

## Current Version (v1.3.0)
## Current Version (v1.4.0)

- support [moleculer ^0.14.x](https://github.com/moleculerjs/moleculer)
- using [cls-hooked ^4.2.x](https://github.com/jeff-lewis/cls-hooked)
- accept nodejs: ^9
- accept nodejs: >=9

## Install

Expand Down
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ const uuid = require("uuid").v4;

const namespace = context.createNamespace(uuid());

const middleware = (handler) => {
return async (ctx) => {
return namespace.runPromise(async () => handler(ctx));
};
const middleware = {
localAction: function (next) {
return async (ctx) => {
return namespace.runPromise(async () => next(ctx));
};
},
};

const set = (key, value) => {
Expand All @@ -27,4 +29,3 @@ module.exports = {
get,
middleware,
};

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moleculer-cls",
"version": "1.3.1",
"version": "1.4.0",
"description": "Hooked Continuation-Local Storage for Moleculer",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit c1d6fd5

Please sign in to comment.