groupclaes / oe-connector-lib

Javascript library for OE-Connector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maintainability Test Coverage Known Vulnerabilities version

OE-Connector Library

Index

Prerequisites

In order to use this package you will need to have an instance of the oe-connector running. This library has been designed to work specifically and only with our in-house developed oe-connector.

The connector has been verified to work with OpenEdge version 11.6 and will propbably work with all next version we have not tested this on versions 12 and above.

Please note that this library will require an http connection to the oe-connector and thus data between the server and the client will be unencrypted.

Installation

npm i @groupclaes/oe-connector --save

Usage

Require oe-connector

const oe = require('@groupclaes/oe-connector')

Running procedures

// be sure to call oe.configure() or set env vars before running procedures

/** Run procedure without parameters or config */
or.run('getStats')

/** Run procedure testProcedure with parameters */
oe.run('testProcedure', [
    "string parameter",
    true,
    undefined
  ])

/** Run procedure testProcedure with parameters and options */
oe.run('testProcedure', [
    "string parameter",
    true,
    undefined
  ], {
    tw: 500,
    c: false
  })

Configuration

Configuration can be done through 2 different methods: at runtime in code or by using env vars

// configure oe-connector the js-way
oe.configure({
  username: 'username', // username for oe-connector
  password: 'password', // password for oe-connector
  app: 'custom-app', // app to use on oe-connector
  host: 'localhost', // oe-connector host must be a valid FQDN or hostname
  ssl: true, // use SSL to connect to host
  port: 5000, // port number
  tw: 60000, // time window in miliseconds
  c: false, // cache enabled
  ct: 3600000, // cache time in miliseconds
  parameterDefaults: { // there must reflect the default parameters in the oe-connector
    in: string,
    out: json
  }
})
// configure oe-connector with env vars
export OE_USERNAME=username
export OE_PASSWORD=password
export OE_APP=custom-app
export OE_HOST=localhost
export OE_SSL=true
export OE_PORT=5000
export OE_TIMEWINDOW=60000
export OE_PARAMDEF_IN=string
export OE_PARAMDEF_OUT=json

Note: Both configuration methods work interchangably with each other but vars set in env are allways used as fallback meaning vars set in configure() will have priority above env vars.

Docs

Documentation is coming later with release version 1.1

Credits

License under the MIT license
Huge thanks to Thibaut Nijs for providing oe-connector

About

Javascript library for OE-Connector

License:MIT License


Languages

Language:JavaScript 100.0%