amlenginewrapper

1.0.7 • Public • Published

AMLEngineWrapper

Version 1.0.7

Wrapper for the AMLEngine.dll for Node.js

const wrapper = require('amlenginewrapper');

wrapper.validate("path/to/AML-File");

Installation

$ npm install amlenginewrapper

Usage

How to call a function

There are two possible ways to call the functions contained inside this wrapper. The first one is to use the call() method of the wrapper and call functions directly. This however requires you to know all required parameters of all the functions you want to use. The easier way to call a functions is to use the predefined handler of that function. The list of supported functions contains usage examples for all of those predifined functions.

How to handle the result of a function call

Function calls using return statements

The return value of a function can be accessed by assigning it to a variable, as shown in the example below.

var result = wrapper.getInstanceHierarchy(...);

Function calls using callbacks

You can also specify a callback to handle the result of a function, as shown in the example below.

function resultHandler(result) {
  console.log(result);
}

wrapper.getInstanceHierarchy(..., resultHandler);

Failed function calls

If a function call fails an error will be thrown, detailing the reason for the error. More information on Node.js handles errors can be found here.

List of supported functions

Usage examples

call

wrapper.call(functionName, path, input = {}, callback = null);
Description

This function offers the possibility to directly call a function inside the wrapper. Only use this function if you really have to. Most of the time using one of the functions below will be more convenient

Parameters
Parameter Description
functionName The name of the function you want to call
path The path to the AML file you want to use
input The payload required by the function you want to use in JSON notation
Default value: {}
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns what ever is specified for the function you specified


appendToInstanceHierarchy

wrapper.appendToInstanceHierarchy(path, instanceName, 
  internalElement = null, callback = null);
Description

This function appends a new instance hierarchy

Parameters
Parameter Description
path The path to the AML file you want to use
index The name of the instance you want to append
internalElement The internalElement you want to include in the instance hierarchy
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns a confirmation message, letting you know whether the operation was successful


getInstanceHierarchy

wrapper.getInstanceHierarchy(path, index, callback = null);
Description

This function returns a hierarchy element as string

Parameters
Parameter Description
path The path to the AML file you want to use
index The index of the instanceHierarchy you are trying to get
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns the InstanceHierarchy you were trying to get as a string


createSystemUnitClass

wrapper.createSystemUnitClass(path, unitClassLibName,
  unitClassName = null, index = null, callback = null);
Description

This function creates a new system unit class

Parameters
Parameter Description
path The path to the AML file you want to use
unitClassLibName The name of the new SystemUnitClassLib
unitClassName The name of a UnitClass you want to include in the SystemUnitClassLib
Default value: null
index The index of the SystemUnitClass
Default value: null
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns a confirmation message, letting you know whether the operation was successful


createInterfaceClass

wrapper.createInterfaceClass(path, interfaceClassName,
  interfaceName = null, callback = null);
Description

This function creates a new interface class

Parameters
Parameter Description
path The path to the AML file you want to use
interfaceClassName The name of the new InterfaceClass
interfaceName The name of an interface you want to include
Default value: null
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns a confirmation message, letting you know whether the operation was successful


appendInstanceElement

wrapper.appendInstanceElement(path, index, 
  instanceElement, callback = null);
Description

This function appends a new instance element

Parameters
Parameter Description
path The path to the AML file you want to use
index The index of the InstanceHierarchy you want to append to
instanceElement The name of the instanceElement you want to append
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns a confirmation message, letting you know whether the operation was successful


renameElement

wrapper.renameElement(path, index, data, callback = null);
Description

This function can be used to rename a given element

Parameters
Parameter Description
path The path to the AML file you want to use
indexer The index of the instanceHierarchy that contains the element
newName The new name for the element
internalElement The name of the element you want to rename
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns a confirmation message, letting you know whether the operation was successful


validate

wrapper.validate(path, callback = null);
Description

This function simply validates a file on a given path

Parameters
Parameter Description
path The path to the AML file you want to validate
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns the result of the validation


repair

wrapper.repair(path, callback = null);
Description

This function validates and repairs a given document

Parameters
Parameter Description
path The path to the AML file you want to repair
callback The callback function that should handle the result of this function call.
If no callback is specified the result will be returned by using a return statement.
See How to handle the result of a function call for more information.
Default value: null
Return value

This function returns the result of the repair

Readme

Keywords

none

Package Sidebar

Install

npm i amlenginewrapper

Weekly Downloads

9

Version

1.0.7

License

MIT

Unpacked Size

692 kB

Total Files

7

Last publish

Collaborators

  • inf18201