> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quixa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Polyglot Scripting & Code Execution

> Execute sandboxed JavaScript, TypeScript, Python, cURL, and AWS Lambda code directly on the visual canvas.

While low-code visual nodes cover standard REST operations and data binding, complex business rules often require custom algorithms, dynamic cryptographic hashing, or specialized data filtering.

Quixa provides dedicated **Code Execution Nodes** supporting multiple language runtimes within isolated execution sandboxes.

```mermaid theme={null}
flowchart LR
    A["Fetch Statement (200 records)"] --> B["Script (Filter Disputed Items)"]
    B --> C["POST /dispute/batch"]
```

***

## 1. Supported Languages & Runtimes

* **JavaScript / TypeScript** (`component-javascript`, `component-typescript`): Fast V8 / Node.js sandbox for JSON manipulation and data reshaping.
* **Python** (`component-python`): Python runtime with math, datetime, and data science libraries for statistical modeling and algorithmic assertions.
* **cURL** (`component-curl`): Direct command-line cURL execution with raw output capture.
* **AWS Lambda** (`component-aws-lambda`): Serverless execution invoking remote AWS Lambda functions with IAM or API Gateway credentials.

***

## 2. Pre-Script & Post-Script Patterns

### Pre-Script: Dynamic Cryptographic Signing (HMAC-SHA256)

Before dispatching a secure API request, use a pre-script to compute custom signature headers:

```typescript theme={null}
import * as crypto from 'crypto';

// Access upstream variables and node payload
const secretKey = context.variables.apiSecretKey;
const timestamp = Math.floor(Date.now() / 1000).toString();
const payload = JSON.stringify(context.variables.requestPayload);

// Generate HMAC-SHA256 signature
const signature = crypto
  .createHmac('sha256', secretKey)
  .update(`${timestamp}.${payload}`)
  .digest('hex');

// Return values to be injected into downstream headers or body
return {
  timestamp,
  signature: `t=${timestamp},v1=${signature}`
};
```

Downstream HTTP nodes can immediately consume this output:

```http theme={null}
X-Signature: {{ResponseBinding.SignerScript.body.signature}}
X-Timestamp: {{ResponseBinding.SignerScript.body.timestamp}}
```

### Post-Script: Heavy Data Filtering & Aggregation

When an upstream service returns hundreds of records (e.g., 200 transaction history lines), use a post-script to isolate specific items:

```typescript theme={null}
const items = context.nodes.FetchTransactions.body.transactions || [];

// Filter only disputed or cancelled operations
const disputedTransactions = items
  .filter(tx => tx.status === 'DISPUTED' || tx.status === 'CANCELLED')
  .map(tx => ({
    transactionId: tx.id,
    amount: tx.amount,
    reason: tx.disputeReason || 'Unrecognized charge'
  }));

return {
  totalDisputed: disputedTransactions.length,
  items: disputedTransactions
};
```

***

## 3. The Scripting Context Object

Every script receives a structured `context` object providing read and write access to the workflow state:

| Context Property | Description | Example |
| :- | :- | :- |
| `context.nodes` | Read-only map of all previously executed nodes. | `context.nodes.Login.body.token` |
| `context.variables` | Flow-level and environment variables. | `context.variables.baseUrl` |
| `context.setVariable(key, val)` | Dynamically writes or updates a flow variable. | `context.setVariable('authToken', token)` |
| `context.log(...)` | Emits timestamped diagnostic logs into the step runner. | `context.log('Processed batch: ' + id)` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.