1.4.0 • Published 4 years ago

@ge-fnm/perform-action-module v1.4.0

Weekly downloads
51
License
MIT
Repository
-
Last release
4 years ago

perform-action-module

This is the Perform Action Module used in the General Electric Field Network Manager

Coverage Status

This module works directly with the communication-selector-module and the action-object module This module requires a GE radio to work

I would like to use the library in my application

To install this module in your project, use one of the following commands

Install with yarn

yarn add @ge-fnm/perform-action-module

Install with npm

npm install @ge-fnm/perform-action-module

Usage in Node

import { Executer } from './perform-action-module'
// See @gefnm/action-object for more information on below
import {
  v1,
  ActionTypeV1,
  CommunicationMethodV1,
  ProtocolV1
} from '@ge-fnm/action-object'}

const executer = new Executer()
const URL = '0.0.0.0'

// Add client
let init = v1.create({
      version: 1,
      actionType: ActionTypeV1.INIT,
      commData: {
        commMethod: CommunicationMethodV1.HTTP,
        protocol: ProtocolV1.JSONRPC,
        username: 'myusername',
        password: 'mypassword'
      },
      modifyingValue: '',
      path: [],
      response: {
        error: null,
        data: null
      },
      uri: URL
    })
let serilizedClient = action.serialize()

executer.execute(serilizedClient)
.then(response => {
    // Execute command
    let action = v1.create({
      version: 1,
      actionType: ActionTypeV1.GET,
      commData: {
        commMethod: CommunicationMethodV1.HTTP,
        protocol: ProtocolV1.JSONRPC
      },
      modifyingValue: '',
      path: ['/if:interfaces/'],
      response: {
        error: null,
        data: null
      },
      uri: URL
    })
    let serilizedAction = action.serialize()
    executer.execute(serilizedAction)
    .then(response2 => {
        // response2 is an action object with response field filled out
    })
    .catch(error2 => {
        // handle action error
    })
})
.catch(error => {
    // handle unsuccessful client addition
})

Debugging

MacOS/Linux

DEBUG='ge-fnm:perform-action-module:*' yarn #to enable logging for only the perform-action-module
-or-
DEBUG='ge-fnm:perform-action-module:executer' yarn #to enable logging for only the perform-action-module executer
-or-
DEBUG='ge-fnm:perform-action-module:httpclient' yarn #to enable logging for only the perform-action-module httpclient
-or-
DEBUG='ge-fnm:perform-action-module:jsonrpc' yarn #to enable logging for only the perform-action-module jsonrpc protocol
-or-
DEBUG='ge-fnm:* yarn # for all logging related to ge-fnm
-or-
DEBUG=* yarn # enable logging for all installed node_modules that look for the env var DEBUG - please note, this is a lot. You probably dont want this

Powershell (Windows)

$Env:DEBUG='ge-fnm:perform-action-module'; yarn #to enable logging for only the perform-action-module
-or-
$Env:DEBUG='ge-fnm:perform-action-module:executer'; yarn #to enable logging for only the perform-action-module executer
-or-
$Env:DEBUG='ge-fnm:perform-action-module:httpclient'; yarn #to enable logging for only the perform-action-module httpclient
-or-
$Env:DEBUG='ge-fnm:perform-action-module:jsonrpc'; yarn #to enable logging for only the perform-action-module jsonrpc protocol
-or-
$Env:DEBUG='ge-fnm:*'; yarn # for all logging related to ge-fnm
-or-
$Env:DEBUG=*; yarn # enable logging for all installed node_modules that look for the env var DEBUG - please note, this is a lot. You probably dont want this
1.4.0

4 years ago

1.4.0-next.3

4 years ago

1.4.0-next.2

4 years ago

1.4.0-next.1

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.3.0-next.2

4 years ago

1.3.0-next.3

4 years ago

1.3.0-next.1

4 years ago

1.2.1

4 years ago

1.2.0-next.6

4 years ago

1.2.0-next.5

4 years ago

1.2.0-next.4

4 years ago

1.2.0

4 years ago

1.2.0-next.2

4 years ago

1.2.0-next.3

4 years ago

1.1.0-next.3

4 years ago

1.2.0-next.1

4 years ago

1.1.0

4 years ago

1.1.0-next.2

4 years ago

1.1.0-next.1

4 years ago

1.0.1-next.3

4 years ago

1.0.1-next.2

4 years ago

1.0.1-next.1

4 years ago

1.0.0

4 years ago

2.0.0-next.2

4 years ago

1.0.6-next.1

4 years ago

2.0.0-next.1

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago