@xtr-dev/payload-automation 0.0.39 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +37 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -12,7 +12,7 @@ A comprehensive workflow automation plugin for PayloadCMS 3.x that enables visua
12
12
  - ⏰ **Scheduled Workflows** - Use webhook triggers with external cron services
13
13
  - 📊 **Execution Tracking** - Complete history and monitoring of workflow runs
14
14
  - 🔧 **Extensible Steps** - HTTP requests, document CRUD, email notifications
15
- - 🔍 **JSONPath Integration** - Dynamic data interpolation and transformation
15
+ - 🔧 **Handlebars Templates** - Dynamic data interpolation with automatic type conversion
16
16
 
17
17
  ## Installation
18
18
 
@@ -74,7 +74,7 @@ Make external API calls with comprehensive error handling and retry logic.
74
74
  - Support for GET, POST, PUT, DELETE, PATCH methods
75
75
  - Authentication: Bearer token, Basic auth, API key headers
76
76
  - Configurable timeouts and retry logic
77
- - JSONPath integration for dynamic URLs and request bodies
77
+ - Handlebars templates for dynamic URLs and request bodies
78
78
 
79
79
  **Error Handling:**
80
80
  HTTP Request steps use a **response-based success model** rather than status-code-based failures:
@@ -95,7 +95,7 @@ HTTP Request steps use a **response-based success model** rather than status-cod
95
95
  }
96
96
 
97
97
  // Use in workflow conditions:
98
- // "$.steps.apiRequest.output.status >= 400" to handle errors
98
+ // "{{steps.apiRequest.output.status}} >= 400" to handle errors
99
99
  ```
100
100
 
101
101
  This design allows workflows to handle HTTP errors gracefully rather than failing completely, enabling robust error handling and retry logic.
@@ -132,8 +132,8 @@ For network failures (timeouts, DNS errors, connection failures), the plugin pro
132
132
  }
133
133
 
134
134
  // Access in workflow conditions:
135
- // "$.steps.httpStep.errorDetails.errorType == 'timeout'"
136
- // "$.steps.httpStep.errorDetails.duration > 5000"
135
+ // "{{steps.httpStep.errorDetails.errorType}} == 'timeout'"
136
+ // "{{steps.httpStep.errorDetails.duration}} > 5000"
137
137
  ```
138
138
 
139
139
  ### Document Operations
@@ -147,11 +147,39 @@ For network failures (timeouts, DNS errors, connection failures), the plugin pro
147
147
 
148
148
  ## Data Resolution
149
149
 
150
- Use JSONPath to access workflow data:
150
+ Use Handlebars templates to access workflow data:
151
151
 
152
- - `$.trigger.doc.id` - Access trigger document
153
- - `$.steps.stepName.output` - Use previous step outputs
154
- - `$.context` - Access workflow context
152
+ - `{{trigger.doc.id}}` - Access trigger document
153
+ - `{{steps.stepName.output}}` - Use previous step outputs
154
+ - `{{context}}` - Access workflow context
155
+
156
+ ### Template Examples
157
+
158
+ ```json
159
+ {
160
+ "url": "https://api.example.com/posts/{{steps.createPost.output.id}}",
161
+ "message": "Post {{trigger.doc.title}} was updated by {{trigger.req.user.email}}",
162
+ "timeout": "{{steps.configStep.output.timeoutMs}}"
163
+ }
164
+ ```
165
+
166
+ ### Automatic Type Conversion
167
+
168
+ Handlebars templates automatically convert string results to appropriate types based on field names:
169
+
170
+ - **Numbers**: `timeout`, `retries`, `delay`, `port`, `count`, etc. → converted to numbers
171
+ - **Booleans**: `enabled`, `active`, `success`, `complete`, etc. → converted to booleans
172
+ - **Numeric strings**: `"5000"` → `5000`, `"3.14"` → `3.14`
173
+
174
+ ### Conditions
175
+
176
+ Conditions support Handlebars templates with comparison operators:
177
+
178
+ ```json
179
+ {
180
+ "condition": "{{trigger.doc.status}} == 'published'"
181
+ }
182
+ ```
155
183
 
156
184
  ## Requirements
157
185
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtr-dev/payload-automation",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "description": "PayloadCMS Automation Plugin - Comprehensive workflow automation system with visual workflow building, execution tracking, and step types",
5
5
  "license": "MIT",
6
6
  "type": "module",