Skip to content

Commit

Permalink
update changelog, migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Dec 4, 2024
1 parent 98e1ed6 commit 32162b4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,10 @@ The Moleculer protocol supports headers in response, as well (`ctx.responseHeade
#### The `getCacheKey` and `opts.keygen` signature has been changed

Old signature: `getCacheKey(actionName, params, meta, keys, actionKeygen)`
Old signature: `keygen: (actionName, params, meta, keys, headers) => {}`

New signature: `getCacheKey(action, opts, ctx)`

New signature: `keygen: (action, opts, ctx) => {}`

#### Added `missingResponse` option to cacher options

Expand Down
47 changes: 46 additions & 1 deletion docs/MIGRATION_GUIDE_0.15.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,52 @@ module.exports = {

About new configuration options, check this documentation: https://kafka.js.org/docs/configuration

## The Fastest Validator options changed.
## Custom cacher keygen signatire changed

The old `(actionName, params, meta, keys, headers)` key generator function signature has been changed to `getCacheKey(action, opts, ctx)`. For old parameters, use `action.name`, `ctx.params`, `ctx.meta`, `opt.keys`, `ctx.headers` instead.

### Old way in action definition

```js
module.exports = {
name: "posts",
actions: {
list: {
cache: {
keygen: (actionName, params, meta, keys, headers) => {
return `${actionName}:${JSON.stringify(params)}`;
}
}
handler(ctx) {
// Do something...
}
}
}
};
```

### New way to receive a stream

```js
module.exports = {
name: "posts",
actions: {
list: {
cache: {
keygen: (action, opts, ctx) => {
return `${action.name}:${JSON.stringify(ctx.params)}`;
}
}
handler(ctx) {
// Do something...
}
}
}
};
```


## The Fastest Validator options changed

In 0.15 the `useNewCustomCheckFunction` default value is changed from `false` to `true`. It means, if you have old custom checker function in your parameter validation schemas, you should rewrite it to the new custom check function form.

Expand Down

0 comments on commit 32162b4

Please sign in to comment.