ArchitectureNodes

Pure Node

Pure nodes are computational units that perform side-effect-free operations in Xentom workflows. They transform input data into output data without interacting with external systems, modifying state, or triggering other nodes. Pure nodes are automatically evaluated when their outputs are needed by other nodes.

Key Characteristics

  • Side-Effect Free: No external interactions, state changes, or network calls
  • Automatic Evaluation: Executed automatically when their outputs are required
  • Data Transformation: Focus purely on computing outputs from inputs
  • Cannot Invoke: Cannot call other nodes or be invoked directly
  • Deterministic: Same inputs always produce the same outputs

Basic Structure

import * as i from '@xentom/integration-framework';

export const dataTransform = i.nodes.pure({
  // Optional: group your node in the UI
  group: 'Data/Transform',

  // Optional: custom display name
  displayName: 'Transform Data',

  // Optional: description for users and AI assistance
  description: 'Transforms input data using a specified mapping',

  // Input pins for data
  inputs: {
    data: i.pins.data({
      control: i.controls.expression({
        label: 'Input Data',
        placeholder: '{ "name": "John", "age": 30 }',
      }),
    }),
    mapping: i.pins.data({
      control: i.controls.expression({
        label: 'Field Mapping',
        defaultValue: {
          fullName: 'data.name',
          ageInMonths: 'data.age * 12',
        },
      }),
    }),
  },

  // Output pins for results
  outputs: {
    result: i.pins.data({
      displayName: 'Transformed Data',
      description: 'The data after applying the mapping',
    }),
  },

  // Run function: performs pure computation
  run({ inputs, outputs }) {
    // Apply transformation logic
    const result = {};
    for (const [key, expression] of Object.entries(inputs.mapping)) {
      result[key] = evaluateExpression(expression, {
        data: inputs.data
      });
    }

    // Assign to outputs - no next() call needed
    outputs.result = result;
  },
});

Configuration Options

Prop

Type

The Run Function

Pure nodes use a different execution model than callable nodes:

Parameters

The run function receives an options object with:

Prop

Type

Key Differences

  • No next() function: Pure nodes assign directly to the outputs object
  • Synchronous by design: While async is supported, pure operations should be fast
  • No execution pins: Pure nodes only have data inputs and outputs

Pure nodes provide the computational foundation for data processing in Xentom workflows. They enable complex data transformations while maintaining the principle of functional programming and ensuring predictable, testable behavior.

On this page