Add version-aware settings filtering for n8n API compatibility

This commit adds automatic detection of n8n server version and filters
workflow settings properties based on what the target version supports.

Changes:
- Add n8n-version.ts service for version detection via /rest/settings
- Fix nested response structure handling (data.data.versionCli)
- Add N8nVersionInfo and N8nSettingsData types
- Update N8nApiClient with getVersion() and version-aware filtering
- Clean workflow settings before API update based on detected version

Version compatibility:
- n8n < 1.37.0: 7 core properties only
- n8n 1.37.0+: adds executionOrder
- n8n 1.119.0+: adds callerPolicy, callerIds, timeSavedPerExecution, availableInMCP

Fixes #466
This commit is contained in:
thesved
2025-12-04 19:49:18 +02:00
committed by Romuald Członkowski
parent 934124fa7b
commit a70d96a373
6 changed files with 684 additions and 92 deletions

View File

@@ -225,6 +225,28 @@ export interface HealthCheckResponse {
};
}
// n8n Version Information
export interface N8nVersionInfo {
version: string; // Full version string, e.g., "1.119.0"
major: number; // Major version number
minor: number; // Minor version number
patch: number; // Patch version number
}
// Settings data within the response
export interface N8nSettingsData {
n8nVersion?: string;
versionCli?: string;
instanceId?: string;
[key: string]: unknown;
}
// Response from /rest/settings endpoint (unauthenticated)
// The actual response wraps settings in a "data" property
export interface N8nSettingsResponse {
data?: N8nSettingsData;
}
// Request Parameter Types
export interface WorkflowListParams {
limit?: number;