Files
metabuilder/packages/data_table/workflow/sorting.json
johndoe6345789 d1ca805d71 refactor(workflow): complete migration from JSON Script to n8n format
BREAKING CHANGE: MetaBuilder JSON Script v2.2.0 format is deprecated.
All workflows now use n8n schema exclusively.

Changes:
- Migrated all 133 .jsonscript files to standard .json format
- All workflows now conform to schemas/n8n-workflow.schema.json
- Removed 211 backup files created during migration
- Complete JSON Script to n8n schema transformation:
  * MetaBuilder nodes → n8n-compatible nodes with proper types
  * Custom parameters → standard n8n parameters
  * Edge arrays → adjacency map connections
  * Trigger objects → explicit triggers array
  * Single-file workflows → proper adjacency format

Impact:
 100% of workflows now n8n-compatible
 First-class variable support via schema
 Complex DAG topology via adjacency maps
 Multi-tenant safety maintained throughout
 All business logic preserved
 Ready for n8n tooling, import/export, and execution engines

Architecture:
- Workflows stored in /packages/*/workflow/*.json
- Schema validation via schemas/n8n-workflow.schema.json
- Support for variables, credentials, triggers, connections
- TypeVersion pinning for backward compatibility

Migration is complete. Codebase is now 100% n8n-based.
Next step: Update workflow executor to use n8n execution engine.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-22 18:53:26 +00:00

147 lines
3.6 KiB
JSON

{
"name": "Handle Data Table Sorting",
"active": false,
"nodes": [
{
"id": "extract_sort_params",
"name": "Extract Sort Params",
"type": "metabuilder.transform",
"typeVersion": 1,
"position": [
100,
100
],
"parameters": {
"name": "Extract Sort Params",
"typeVersion": 1,
"position": [
100,
100
],
"parameters": {
"name": "Extract Sort Params",
"typeVersion": 1,
"position": [
100,
100
],
"parameters": {
"input": "{{ $json }}",
"output": {
"sortBy": "{{ $json.sortBy || 'createdAt' }}",
"sortOrder": "{{ $json.sortOrder || 'desc' }}"
},
"operation": "transform_data"
}
}
}
},
{
"id": "validate_sort_fields",
"name": "Validate Sort Fields",
"type": "metabuilder.condition",
"typeVersion": 1,
"position": [
400,
100
],
"parameters": {
"name": "Validate Sort Fields",
"typeVersion": 1,
"position": [
400,
100
],
"parameters": {
"name": "Validate Sort Fields",
"typeVersion": 1,
"position": [
400,
100
],
"parameters": {
"condition": "{{ ['id', 'name', 'email', 'createdAt', 'updatedAt', 'status'].includes($steps.extract_sort_params.output.sortBy) }}",
"operation": "condition"
}
}
}
},
{
"id": "apply_sort",
"name": "Apply Sort",
"type": "metabuilder.transform",
"typeVersion": 1,
"position": [
700,
100
],
"parameters": {
"name": "Apply Sort",
"typeVersion": 1,
"position": [
700,
100
],
"parameters": {
"name": "Apply Sort",
"typeVersion": 1,
"position": [
700,
100
],
"parameters": {
"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; }) }}",
"operation": "transform_data"
}
}
}
},
{
"id": "return_sorted",
"name": "Return Sorted",
"type": "metabuilder.action",
"typeVersion": 1,
"position": [
100,
300
],
"parameters": {
"name": "Return Sorted",
"typeVersion": 1,
"position": [
100,
300
],
"parameters": {
"name": "Return Sorted",
"typeVersion": 1,
"position": [
100,
300
],
"parameters": {
"data": {
"sortBy": "{{ $steps.extract_sort_params.output.sortBy }}",
"sortOrder": "{{ $steps.extract_sort_params.output.sortOrder }}",
"data": "{{ $steps.apply_sort.output }}"
},
"action": "emit_event",
"event": "data_sorted"
}
}
}
}
],
"connections": {},
"staticData": {},
"meta": {},
"settings": {
"timezone": "UTC",
"executionTimeout": 3600,
"saveExecutionProgress": true,
"saveDataErrorExecution": "all",
"saveDataSuccessExecution": "all"
}
}