mesg-foundation / js-sdk

Javascript mono-repo with all the tools to interact with MESG
https://mesg.com
4 stars 4 forks source link

Add any value for filter condition + support of reference for the compilation #203

Closed antho1404 closed 4 years ago

antho1404 commented 4 years ago

dependency: https://github.com/mesg-foundation/engine/pull/1739 related to:

You can now create a filter with conditions that are not only based on string value but also boolean and number.

Now the following filter in a process will be working

- type: filter
  conditions:
    foo: true
    bar: 42
    hello: "world"

We might add the support of array/object in another PR

What's in this PR:

For another PR

To test

You can use the following process to test

name: Test
steps:
  - type: trigger
    instance:
      src: https://github.com/mesg-foundation/service-webhook
    eventKey: request
  - type: filter
    conditions:
      foo: 10
  - type: task
    instance:
      src: https://github.com/mesg-foundation/service-js-function
    taskKey: execute
    inputs:
      code: "module.export = function(value) { return true }"
      inputs:
        foo: 42

and run with

mesg-cli-dev process:dev ~/Desktop/simple-process.yml --image mesg/engine:local

then test with

curl -XPOST http://localhost:3005/webhook --data '{"foo": 10}' -H "Content-Type: application/json"
github-actions[bot] commented 4 years ago

Please update the CHANGELOG of the associated library for your Pull Request to be accepted

antho1404 commented 4 years ago

closing in favor of https://github.com/mesg-foundation/js-sdk/pull/205

(this one has some fixes missing that are on the #205)