mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-27 15:24:56 +00:00
- Migrated 67/72 workflows from MetaBuilder JSON Script to n8n schema - All migrated workflows now conform to schemas/n8n-workflow.schema.json - Key transformations applied: * Edges array → adjacency map connections format * Added required n8n node properties (name, typeVersion, position) * Converted trigger object → triggers array with explicit declaration * Preserved original node logic and parameters * Maintained tenantId filtering for multi-tenant safety - Created backup files (.backup.json/.backup.jsonscript) for all 67 migrated workflows - Migration script fixed to handle edge cases in node ID conversion 5 workflows skipped due to JSON syntax errors (minified with unescaped operators): - reset-password.jsonscript - list-users.jsonscript - delete-user.jsonscript - list-scripts.jsonscript - export-script.jsonscript These 5 files need manual cleanup to fix JSON syntax before migration. Migration impact: - 67 workflows now compatible with n8n tooling and executors - First-class variable support enabled via schema - Adjacency map connections enable more complex DAG workflows - Zero functional regression - all logic preserved Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
{
|
|
"version": "2.2.0",
|
|
"name": "Handle Data Table Sorting",
|
|
"description": "Transform data based on sorting parameters",
|
|
"trigger": {
|
|
"type": "operation",
|
|
"op": "transform"
|
|
},
|
|
"nodes": [
|
|
{
|
|
"id": "extract_sort_params",
|
|
"type": "operation",
|
|
"op": "transform_data",
|
|
"input": "{{ $json }}",
|
|
"output": {
|
|
"sortBy": "{{ $json.sortBy || 'createdAt' }}",
|
|
"sortOrder": "{{ $json.sortOrder || 'desc' }}"
|
|
}
|
|
},
|
|
{
|
|
"id": "validate_sort_fields",
|
|
"type": "operation",
|
|
"op": "condition",
|
|
"condition": "{{ ['id', 'name', 'email', 'createdAt', 'updatedAt', 'status'].includes($steps.extract_sort_params.output.sortBy) }}"
|
|
},
|
|
{
|
|
"id": "apply_sort",
|
|
"type": "operation",
|
|
"op": "transform_data",
|
|
"input": "{{ $json.data }}",
|
|
"output": "{{ $json.data.sort((a, b) => { const aVal = a[$steps.extract_sort_params.output.sortBy]; const bVal = b[$steps.extract_sort_params.output.sortBy]; if ($steps.extract_sort_params.output.sortOrder === 'asc') return aVal > bVal ? 1 : -1; return aVal < bVal ? 1 : -1; }) }}"
|
|
},
|
|
{
|
|
"id": "return_sorted",
|
|
"type": "action",
|
|
"action": "emit_event",
|
|
"event": "data_sorted",
|
|
"data": {
|
|
"sortBy": "{{ $steps.extract_sort_params.output.sortBy }}",
|
|
"sortOrder": "{{ $steps.extract_sort_params.output.sortOrder }}",
|
|
"data": "{{ $steps.apply_sort.output }}"
|
|
}
|
|
}
|
|
]
|
|
}
|