# FlowDrop Node Processor

> Built-in node processor plugins for data processing, logic, I/O, and HTTP operations — plus shared services for data mapping and JSON schema validation.

## Overview

The `flowdrop_node_processor` module provides the standard library of NodeProcessor plugins that ship with FlowDrop. These cover common workflow operations: conditional branching, data transformation, HTTP requests, entity operations, text processing, and more.

The module also provides two shared services — a data mapper for transforming data between structures using PropertyAccessor, and a JSON schema validator — which are used by node processors and other FlowDrop modules.

## Dependencies

- [flowdrop](flowdrop.md) (NodeProcessor plugin type)
- [flowdrop_node_type](flowdrop_node_type.md) (node type definitions)

## Tips and Tricks

### Available Node Processors

The module ships with 30+ built-in processors organized by function:

**Logic & Control Flow:**

| Plugin | Description |
|--------|-------------|
| IfElse | Conditional branching based on expressions |
| BooleanGateway | Route execution based on boolean conditions |
| SwitchGateway | Multi-path routing based on value matching |
| AorB | Binary logic operation |
| Repeat | Loop/repeat operations |

**Data Processing:**

| Plugin | Description |
|--------|-------------|
| DataExtractor | Extract values from complex data structures |
| DataOperations | General data transformation operations |
| DataShaper | Reshape data between different structures |
| DataToDataframe | Convert data into dataframe format |
| DataToJson | Serialize data to JSON |
| JsonToData | Parse JSON into data structures |
| SplitText | Split text into parts |
| RegexExtractor | Extract data using regular expressions |
| Range | Generate numeric ranges |
| Calculator | Mathematical operations |

**I/O:**

| Plugin | Description |
|--------|-------------|
| TextInput | Accept text input |
| TextOutput | Produce text output |
| ChatInput | Accept chat-style input |
| ChatOutput | Produce chat-style output |
| MessageToData | Convert messages to structured data |

**Entity Operations:**

| Plugin | Description |
|--------|-------------|
| EntityQuery | Query Drupal entities |
| EntitySave | Create or update Drupal entities |
| EntityContext | Access entity context data |
| GetWorkflowData | Retrieve workflow-level data |

**Network:**

| Plugin | Description |
|--------|-------------|
| HttpRequest | Make HTTP requests to external APIs |

**Templates:**

| Plugin | Description |
|--------|-------------|
| PromptTemplate | Render prompt templates with variable substitution |

**Utility:**

| Plugin | Description |
|--------|-------------|
| Logger | Log data during execution |
| Messenger | Display Drupal messages |
| DateTime | Date and time operations |
| Note | Documentation node (no execution) |
| Nop | No-op node for structural purposes |
| Idea | Placeholder for planned functionality |

### Data Mapping Patterns

The `DataMapperService` uses Symfony's PropertyAccessor to map values between source and target structures. This is useful when connecting nodes with different data shapes:

```php
$mapper = \Drupal::service('flowdrop_node_processor.data_mapper');

// Map source data to target structure
$result = $mapper->map($sourceData, $mappingConfig);
```

## Developer API

### Services

| Service ID | Class | Description |
|-----------|-------|-------------|
| `flowdrop_node_processor.data_mapper` | `DataMapperService` | Maps data between source and target structures using PropertyAccessor |
| `flowdrop_node_processor.json_schema_validator` | `JsonSchemaValidator` | Validates data against JSON Schema definitions |

### JSON Schema Validation

```php
$validator = \Drupal::service('flowdrop_node_processor.json_schema_validator');

// Validate data against a schema
$errors = $validator->validate($data, $schema);
```

## References

- [flowdrop](flowdrop.md) — defines the NodeProcessor plugin type
- [flowdrop_node_type](flowdrop_node_type.md) — config entities that reference these processors
- [Defining Node — Quick Reference](../development/quick-reference/define-node.md)
- [FlowDrop Node Processor Concepts](../development/flowdrop-node-processor.md)
- [Gateway Nodes](../development/gateway-nodes.md)
