Thank you for registering with {{ config('app.name') }}. Your account has been created successfully.
- Your workflow "{{ data.workflow_name }}" has {{ data.node_count }} nodes.
+
+
Order Update
+
+
+
Order #{{ order.orderNumber }}
+
Status: {{ order.status | title }}
+
Total: {{ order.totalAmount | currency }}
+
Order Date: {{ order.createdAt | date_format("%B %d, %Y") }}
+
+
+
+
Items Ordered:
+
+ {% for item in order.items %}
+ -
+ {{ item.productName }} -
+ Quantity: {{ item.quantity }} -
+ Price: {{ item.unitPrice | currency }}
+
{% endfor %}
+
+
- Generated at: {{ now() }}
- Request ID: {{ uuid() }}
- "#;
+ {% if order.trackingNumber %}
+
+
Tracking Information:
+
Your order is being shipped. Track your package: {{ order.trackingNumber }}
+
+ {% endif %}
- let data = json!({
- "name": "John Doe",
- "workflow_name": "HackerNews Summary",
- "node_count": 3,
- "results": [
- {"node_name": "RSS Feed", "status": "success"},
- {"node_name": "Content Fetch", "status": "success"},
- {"node_name": "AI Summary", "status": "completed"}
- ]
- });
-
- let result = engine.render_template(template, &data).unwrap();
- assert!(result.contains("Hello John Doe!"));
- assert!(result.contains("HackerNews Summary"));
- }
-
- #[test]
- fn test_json_path_filter() {
- let engine = TemplateEngine::new();
-
- let template = r#"
- Title: {{ data | json_path("$.title") }}
- First item: {{ data | json_path("$.items[0].name") }}
- "#;
-
- let data = json!({
- "title": "My Workflow",
- "items": [
- {"name": "First Item", "value": 1},
- {"name": "Second Item", "value": 2}
- ]
- });
-
- let result = engine.render_template(template, &data).unwrap();
- assert!(result.contains("Title: My Workflow"));
- assert!(result.contains("First item: First Item"));
- }
-}
+
+
Shipping Address:
+
+ {{ order.shippingAddress.street }}
+ {{ order.shippingAddress.city }}, {{ order.shippingAddress.state }} {{ order.shippingAddress.zipCode }}
+ {{ order.shippingAddress.country }}
+
+
+
+{% endblock %}
```
## 🔍 DATA TRANSFORMATION WITH JSONPATH
-### JsonPath Integration
+### JSONPath for Data Extraction
```rust
use jsonpath_rust::{JsonPathFinder, JsonPathQuery};
-use serde_json::Value;
-use anyhow::{Result, Context};
+use serde_json::{Value, json};
pub struct DataTransformer {
- template_engine: TemplateEngine,
+ // Internal state
}
impl DataTransformer {
- pub fn new() -> Self {
- Self {
- template_engine: TemplateEngine::new(),
+ pub fn extract_user_info(&self, api_response: &Value) -> Result