moleculerjs / moleculer-repl

REPL module for Moleculer framework
http://moleculer.services/docs/moleculer-repl.html
MIT License
27 stars 25 forks source link

Unable to set meta when using call #69

Closed morkeleb closed 11 months ago

morkeleb commented 12 months ago

When I use the repel with JSON-strings it wont add meta to the call.

call v1.myService.action '{"run": true}' '{"myExtra": "data"}'

will call the service v1.myService.action with {run: true} but it wont add {myExtra: 'data'} to the meta of the request. The meta is always only { '$repl': true }.

I start the repl with:

  const broker = await startBroker();
  broker.repl()
AndreMaz commented 12 months ago

Hi @morkeleb

this should do the trick

call "math.add" --a 5 --#b Bob --$timeout 1
// params will be { a: 5 }, meta will be { b: 'Bob' } and options will be { timeout: 1 }

as an alternative you can use --loadFull flag (more info here: https://github.com/moleculerjs/moleculer-repl/pull/61)

morkeleb commented 12 months ago

Yes. But as stated in the documentation the following should work:

call [options] <actionName> [jsonParams] [meta]
icebob commented 11 months ago

@AndreMaz could you reproduce it, plz?

AndreMaz commented 11 months ago

@icebob the # (e.g, --#metaParam ) option is working fine. However, passing meta as JSON encoded as string was failing. This PR should fix it https://github.com/moleculerjs/moleculer-repl/pull/71