Skip to content

Repository files navigation

Xtate.DataModel.EcmaScript

NuGet CodeQL License: AGPL-3.0-or-later

Xtate.DataModel.EcmaScript adds an ECMAScript data-model handler to Xtate.Core. It uses Jint to evaluate SCXML expressions and executable content identified by datamodel="ecmascript".

Features

  • Evaluates value, condition, location, script, and external-script expressions.
  • Supports SCXML foreach, inline content, external data, and custom actions.
  • Converts between Jint values and Xtate DataModelValue/DataModelList values.
  • Exposes the active Jint version through the data-model variables.
  • Registers as a scoped Xtate data-model handler through Xtate.IoC.

Installation

dotnet add package Xtate.DataModel.EcmaScript

Usage

Register the ECMAScript handler alongside the Xtate modules used by the application:

using Xtate.DataModel.EcmaScript.DependencyInjection;
using Xtate.IoC;

var services = new ServiceCollection();
services.AddModule<EcmaScriptDataModelHandlerModule>();

An SCXML document can then select the handler with datamodel="ecmascript":

<scxml xmlns="http://www.w3.org/2005/07/scxml"
       version="1.0"
       datamodel="ecmascript"
       initial="done">
  <datamodel>
    <data id="message" expr="'Hello from ECMAScript'" />
  </datamodel>
  <final id="done" />
</scxml>

Supported frameworks

The library targets .NET 11, .NET 10, .NET 9, .NET 8, .NET Standard 2.0, and .NET Framework 4.6.2.

Building from source

git clone https://github.com/TSSArt/Xtate.DataModel.EcmaScript.git
cd Xtate.DataModel.EcmaScript
dotnet restore
dotnet build Xtate.DataModel.EcmaScript.sln
dotnet test Xtate.DataModel.EcmaScript.sln

Repository layout

Path Description
src/Xtate.DataModel.EcmaScript Handler, engine, evaluators, wrappers, and resources
test/Xtate.DataModel.EcmaScript.Test MSTest behavior and integration tests
.github/instructions Path-specific guidance for coding agents
.github/workflows Security analysis and publishing workflows
.agents Repository guide for maintainers and coding agents

Contributing

Contributions are welcome. Read the repository guide, follow .editorconfig, and add focused tests for expression, conversion, or execution behavior changes.

Use GitHub Issues for bug reports and feature requests.

License

Xtate.DataModel.EcmaScript is licensed under the GNU Affero General Public License v3.0 or later.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages