This is the Action Object used within the GE FNM.
This library is mainly used within the communication-selector-module and the perform-action-module.
To get started with the repository in your project install it like this
yarn add @ge-fnm/action-object
npm i @ge-fnm/action-object
Here is an example of how to use it in a browser
import { v1, ActionTypeV1, CommunicationMethodV1 } from './action-object'
const obj = v1.create({
actionType: ActionTypeV1.GET,
commMethod: CommunicationMethodV1.JSONRPC,
modifyingValue: 'test',
path: ['hello', 'world'],
response: undefined,
uri: 'http://localhost:5000'
})
const serialized = obj.serialize()
const objAgain = v1.deserialize(serialized)
// objAgain now has all the same properties as obj except with an added 'id' property
// If you would like to initialize an ActionObject with a specific ID, you can do this:
// NOTE - unless for testing purposes you really shouldn't be doing this
const obj = v1.create({
actionType: ActionTypeV1.GET,
commMethod: CommunicationMethodV1.JSONRPC,
modifyingValue: 'test',
path: ['hello', 'world'],
response: undefined,
uri: 'http://localhost:5000'
}, "ThisIsAnOptionalID")
Please see CONTRIBUTING.md