{ "version": "2.2.0", "name": "Load Audit Logs", "description": "Load and paginate audit logs with tenant filtering", "trigger": { "type": "http", "method": "GET", "path": "/audit-logs" }, "nodes": [ { "id": "validate_context", "type": "operation", "op": "validate", "input": "{{ $context.tenantId }}", "validator": "required", "errorMessage": "tenantId is required for multi-tenant safety" }, { "id": "extract_pagination", "type": "operation", "op": "transform_data", "input": "{{ $json }}", "output": { "limit": "{{ Math.min($json.limit || 100, 500) }}", "offset": "{{ ($json.page || 1 - 1) * ($json.limit || 100) }}" } }, { "id": "fetch_logs", "type": "operation", "op": "database_read", "entity": "AuditLog", "params": { "filter": { "tenantId": "{{ $context.tenantId }}" }, "sort": {"timestamp": -1}, "limit": "{{ $steps.extract_pagination.output.limit }}", "offset": "{{ $steps.extract_pagination.output.offset }}" }, "output": "logs" }, { "id": "fetch_count", "type": "operation", "op": "database_count", "entity": "AuditLog", "params": { "filter": { "tenantId": "{{ $context.tenantId }}" } }, "output": "totalCount" }, { "id": "format_response", "type": "operation", "op": "transform_data", "input": "{{ $steps.fetch_logs.output }}", "output": { "logs": "{{ $steps.fetch_logs.output }}", "pagination": { "total": "{{ $steps.fetch_count.output }}", "limit": "{{ $steps.extract_pagination.output.limit }}", "offset": "{{ $steps.extract_pagination.output.offset }}", "hasMore": "{{ $steps.fetch_count.output > ($steps.extract_pagination.output.offset + $steps.extract_pagination.output.limit) }}" } } }, { "id": "return_success", "type": "action", "action": "http_response", "status": 200, "body": "{{ $steps.format_response.output }}" } ], "errorHandler": { "type": "action", "action": "http_response", "status": 500, "body": { "error": "Failed to load audit logs", "message": "{{ $error.message }}" } } }