1.0.7 • Published 4 years ago

amlenginewrapper v1.0.7

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

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
ParameterDescription
functionNameThe name of the function you want to call
pathThe path to the AML file you want to use
inputThe payload required by the function you want to use in JSON notationDefault value: {}
callbackThe 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
ParameterDescription
pathThe path to the AML file you want to use
indexThe name of the instance you want to append
internalElementThe internalElement you want to include in the instance hierarchy
callbackThe 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
ParameterDescription
pathThe path to the AML file you want to use
indexThe index of the instanceHierarchy you are trying to get
callbackThe 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
ParameterDescription
pathThe path to the AML file you want to use
unitClassLibNameThe name of the new SystemUnitClassLib
unitClassNameThe name of a UnitClass you want to include in the SystemUnitClassLibDefault value: null
indexThe index of the SystemUnitClassDefault value: null
callbackThe 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
ParameterDescription
pathThe path to the AML file you want to use
interfaceClassNameThe name of the new InterfaceClass
interfaceNameThe name of an interface you want to includeDefault value: null
callbackThe 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
ParameterDescription
pathThe path to the AML file you want to use
indexThe index of the InstanceHierarchy you want to append to
instanceElementThe name of the instanceElement you want to append
callbackThe 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
ParameterDescription
pathThe path to the AML file you want to use
indexerThe index of the instanceHierarchy that contains the element
newNameThe new name for the element
internalElementThe name of the element you want to rename
callbackThe 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
ParameterDescription
pathThe path to the AML file you want to validate
callbackThe 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
ParameterDescription
pathThe path to the AML file you want to repair
callbackThe 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

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago