moleculer-microservices-spike icon indicating copy to clipboard operation
moleculer-microservices-spike copied to clipboard

[Snyk] Upgrade moleculer from 0.14.14 to 0.14.15

Open snyk-bot opened this issue 2 years ago • 0 comments

Snyk has created this PR to upgrade moleculer from 0.14.14 to 0.14.15.

merge advice :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


  • The recommended version is 1 version ahead of your current version.
  • The recommended version was released 21 days ago, on 2021-07-10.
Release notes
Package name: moleculer
  • 0.14.15 - 2021-07-10

    15 commits from 5 contributors.

    Changes

    • fix nats version in peerDependencies.
    • convert url to servers in nats@2. #954
    • add typing for mcall settled option. #957
    • revert TS ThisType issue in 0.14.14. #958
    • update dependencies
    • add useTag259ForMaps: false default option for CBOR serializer to keep the compatibility.
  • 0.14.14 - 2021-06-27

    105 commits from 11 contributors.

    New CBOR serializer #905

    CBOR (cbor-x) is a new serializer but faster than any other serializers.

    Example

    // moleculer.config.js
    module.exports = {
        logger: true,
        serializer: "CBOR"
    };

    Benchmark

    const res = await broker.mcall([
        { action: "posts.find", params: { limit: 2, offset: 0 },
        { action: "users.find", params: { limit: 2, sort: "username" } },
        { action: "service.notfound", params: { notfound: 1 } }
    ], { settled: true });
    console.log(res);

    The res will be something similar to

    [
        { status: "fulfilled", value: [/*... response of `posts.find`...*/] },
        { status: "fulfilled", value: [/*... response of `users.find`...*/] },
        { status: "rejected", reason: {/*... Rejected response/Error`...*/} }
    ]

    New MOLECULER_CONFIG environment variable in Runner

    In the Moleculer Runner, you can configure the configuration filename and path with the MOLECULER_CONFIG environment variable. It means, no need to specify the config file with --config argument.

    Supporting [email protected] in NATS transporter

    The new nats 2.x.x version has a new breaking API which has locked the NATS transporter for [email protected] library. As of this release, the NATS transporter supports both major versions of the nats library.

    The transporter automatically detects the version of the library and uses the correct API.

    Async custom validator functions and ctx as metadata

    Since [email protected], the FastestValidator supports async custom validators and you can pass metadata for custom validator functions.
    In Moleculer, the FastestValidator passes the ctx as metadata. It means you can access to the current context, service, broker and you can make async calls (e.g calling another service) in custom checker functions.

    Example

    // posts.service.js module.exports = { name: "posts", actions: { params: { $$async: true, owner: { type: "string", custom: async (value, errors, schema, name, parent, context) => { const ctx = context.meta;
                <span class="pl-k">const</span> <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">ctx</span><span class="pl-kos">.</span><span class="pl-en">call</span><span class="pl-kos">(</span><span class="pl-s">"users.isValid"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">id</span>: <span class="pl-s1">value</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
                <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">res</span> <span class="pl-c1">!==</span> <span class="pl-c1">true</span><span class="pl-kos">)</span>
                    <span class="pl-s1">errors</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">type</span>: <span class="pl-s">"invalidOwner"</span><span class="pl-kos">,</span> <span class="pl-c1">field</span>: <span class="pl-s">"owner"</span><span class="pl-kos">,</span> <span class="pl-c1">actual</span>: <span class="pl-s1">value</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
                <span class="pl-k">return</span> <span class="pl-s1">value</span><span class="pl-kos">;</span>
            <span class="pl-kos">}</span> <span class="pl-kos">}</span><span class="pl-kos">,</span> 
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-c">/* ... */</span>
    <span class="pl-kos">}</span>
    

    }

    Changes

    • fix node crash in encryption mode with TCP transporter. #849
    • expose Utils in typescript definition. #909
    • other d.ts improvements. #920, #922, #934, #950
    • fix etcd3 discoverer lease-loss issue #922
    • catch errors in Compression and Encryption middlewares. #850
    • using optional peer dependencies. #911
    • add relevant packet to to serialization and deserialization calls. #932
    • fix disabled balancer issue with external discoverer. #933
from moleculer GitHub release notes
Commit messages
Package name: moleculer
  • 93cceb7 0.14.15
  • 24db1ff Merge branch 'master' of github.com:moleculerjs/moleculer
  • f7ad927 add back forceExit
  • 10baf81 update changelog
  • 23b0670 Add additional cbor test for useTag259ForMaps
  • b39e8ac update cbor
  • f493ce4 update deps
  • fc14561 Merge pull request #958 from moonrailgun/moonrailgun/fix-949
  • a19e288 append this test in internal call
  • 45af2c2 fix typescript action problem in #949
  • cfd321c Merge pull request #957 from dprslt/fix-ts-settled
  • 1c233d1 fix(index.d.ts): broken syntax
  • 33d1791 Removing settled in CallingOptions
  • b929d8e Adding custom type definition for mcall
  • d6c4603 Adding typing for settled in CallingOptions
  • 55e8c77 Merge pull request #954 from moleculerjs/issue-953
  • 59b28fb test(nats): change test for check connect args
  • e66f76d test(nats): fix servers opts
  • 5e0c03b tests(nats): string params for nats 2.x transport
  • bbd5a3a fix(nats): change only for nats 2.x
  • 3d613d1 fix(nats): change options from url to servers
  • 25cb76c fix nats peer deps

Compare


Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

🧐 View latest project report

🛠 Adjust upgrade PR settings

🔕 Ignore this dependency or unsubscribe from future upgrade PRs

snyk-bot avatar Aug 01 '21 05:08 snyk-bot