@traeger-industry/codabix-debug-runtime
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.7 • Public • Published

codabix-debug-runtime

Debugging Runtime for custom script logic used in Codabix Middleware projects. This package enables the headless development and debugging of custom scripts in the development environment of your choice.

Getting started

1. Installation

Before you can start with developing and debugging, you have to install the package as follows:

npm install @traeger-industry/codabix-debug-runtime

Please note that any required dependencies are automatically installed by npm.

2. Import Modules

In constrast to the deveolopment of a script in Codabix' integrated development environment you have to import the modules used/required on your own.

Available modules are: codabix, guid, io, logger, net, runtime, timer

To use some or more of these modules, import them at the beginning of your script as follows:

import { codabix, logger } from "@traeger-industry/codabix-debug-runtime";

3. Setup Model (optional)

The package uses by default an existing Codabix Node Model in your project directory with the name "codabix-nodes.xml". If this file is missing any use of node related operations will fail. To generate a Codabix Node Model file you just need to switch to an existing Codabix Project and export the desired node tree to interact with from the node explorer in the Codabix backend. This can be done by selecting and right-clicking the top most node and choosing "Export Nodes as XML".

You can change the file path to your XML file as follows:

// default: "./codabix-nodes.xml"
codabix.Debug.model = "./my-nodes.xml";

Please note that adding, deleting or editing nodes and their values will not change the contents of the xml file!

4. Setup Runtime (optional)

You can configure the runtime to develop and test your implementation how it behaves in different scenarios. These scenarios can be configured using several options. The package uses a set of default options to imitate the communication with a resources limited component.

4.1 Node Value Metrics

A node value provided in Codabix provides not only the value itself. In addition with the intrinsic value the codabix.NodeValue provides the codabix.NodeValue.status member to indicate whether the value could be determined successfully. In the life runtime of Codabix the status can be provided by the component communicating with as well.

To imitate the case a component provides values with bad values you can configure the codabix.Debug.defaultStatus property like follows.

// default: true
codabix.Debug.defaultStatus = false;

If this property is changed to the value false every codabix.NodeValue will use the value codabix.NodeStatusValueEnum.Bad as the value of the codabix.NodeValue.status property; otherwise the value codabix.NodeStatusValueEnum.Good.

4.2 Communication Delays

In the life runtime of Codabix you are communicating with other components which might be limited by their resources and any response to a request (send to a component) can be delayed when reading and writing information.

To imitate the case of a delayed call to codabix.readNodeValueAsync() for a read-operation performed by your code you can configure a delay in milliseconds as part of the runtime options like follows.

// default: 1000
codabix.Debug.readDelay = 2000;

To imitate the case of a delayed call to codabix.writeNodeValueAsync() for a write-operation performed by your code you can configure a delay in milliseconds as part of the runtime options like follows.

// default: 1000
codabix.Debug.writeDelay = 500;

Changes

v.1.0.0-beta.6 (2024-03-26)

  • Minor fixes.

v.1.0.0-beta.5 (2024-03-22)

  • Added event handler exceptions to prevent node changes within listeners.

v.1.0.0-beta.4 (2024-03-12)

  • Fixed bug when creating nodes.

v.1.0.0-beta.3 (2024-03-12)

  • Minor fixes.

v1.0.0-beta.2 (2024-03-12)

  • Fixed bug when using findNode on "/Nodes".

v1.0.0-beta.1 (2024-03-12)

  • Fixed Types not being exported correctly.
  • Fixed typo in README.

v1.0.0-beta.0 (2023-07-17)

  • First beta version.

Package Sidebar

Install

npm i @traeger-industry/codabix-debug-runtime

Weekly Downloads

4

Version

1.0.0-beta.7

License

MIT

Unpacked Size

218 kB

Total Files

172

Last publish

Collaborators

  • deichenseer
  • dscharnagl