LocalMachinepacks.runMachine()

Run a machine in the specified local pack using the provided input values.

Usage

Hover over inputs/exits for more info.

var LocalMachinepacks = require('machinepack-localmachinepacks');


// Run a machine in the specified local pack using the provided input values.

LocalMachinepacks.runMachine({

machinepackPath: '/Users/mikermcneil/machinepack-foo/',

identity: 'foo-bar',

inputValues: [ { name: 'someInput', value: '===' } ],

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No machine with that identity exists in this machinepack.

notFound: function () {

 

},

// A configured input value does not correspond with a real input in this machine.

unknownInput: function () {

 

},

// Invalid machine definition

invalidMachine: function () {

 

},

// The return value could not be stringified into JSON - perhaps it contains circular references?

cantStringifyOutput: function (result) {

 

},

// OK.

success: function (whatHappened) {

 

},

});

Inputs

machinepackPath required

The path to the machinepack this machine is a part of (if path is not absolute, will be resolved from the current working directory)

'/Users/mikermcneil/machinepack-foo/'
identity required

The identity of the machine to run.

'foo-bar'
inputValues

A set of input name/value pairs.

[ { name: 'someInput', value: '===' } ]

Exits

error

An unexpected error occurred.

notFound

No machine with that identity exists in this machinepack.

unknownInput

A configured input value does not correspond with a real input in this machine.

invalidMachine

Invalid machine definition

cantStringifyOutput

The return value could not be stringified into JSON - perhaps it contains circular references?

{ outcome: 'success',
  output: '===',
  inspectedOutput: '{ stuff: "things" }',
  duration: 2948 }
success

OK.

{ outcome: 'success',
  output: '===',
  jsonStringifiedOutput: '{"stuff": "things"}',
  inspectedOutput: '{ stuff: "things" }',
  duration: 2948 }