@n8n-as-code/sync 0.10.0 → 0.12.0
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.
|
@@ -28,6 +28,10 @@ export declare class WorkflowSanitizer {
|
|
|
28
28
|
* IMPORTANT: Organization metadata (projectId, projectName, homeProject, isArchived)
|
|
29
29
|
* is explicitly EXCLUDED here as it's read-only API information stored locally
|
|
30
30
|
* for display purposes only.
|
|
31
|
+
*
|
|
32
|
+
* CRITICAL: We must preserve executionOrder from the original workflow if present,
|
|
33
|
+
* or default to "v1" if not specified. Without this, workflows may execute in the
|
|
34
|
+
* wrong order, causing agents to produce output before calling their tools.
|
|
31
35
|
*/
|
|
32
36
|
static cleanForPush(workflow: Partial<IWorkflow>): Partial<IWorkflow>;
|
|
33
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-sanitizer.d.ts","sourceRoot":"","sources":["../../src/services/workflow-sanitizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,iBAAiB;IAC1B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-sanitizer.d.ts","sourceRoot":"","sources":["../../src/services/workflow-sanitizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,iBAAiB;IAC1B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAqE/D;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAS5D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;CAmExE"}
|
|
@@ -5,7 +5,8 @@ export class WorkflowSanitizer {
|
|
|
5
5
|
*/
|
|
6
6
|
static cleanForStorage(workflow) {
|
|
7
7
|
const settings = { ...(workflow.settings || {}) };
|
|
8
|
-
// Remove instance-specific settings
|
|
8
|
+
// Remove instance-specific settings that should not be version-controlled
|
|
9
|
+
// IMPORTANT: executionOrder is PRESERVED because it affects workflow behavior
|
|
9
10
|
const keysToRemove = [
|
|
10
11
|
'executionUrl',
|
|
11
12
|
'availableInMCP',
|
|
@@ -13,7 +14,7 @@ export class WorkflowSanitizer {
|
|
|
13
14
|
'saveDataErrorExecution',
|
|
14
15
|
'saveManualExecutions',
|
|
15
16
|
'saveExecutionProgress',
|
|
16
|
-
'executionOrder',
|
|
17
|
+
// 'executionOrder', // ✅ KEPT - this affects execution behavior and must be preserved
|
|
17
18
|
'trialStartedAt'
|
|
18
19
|
];
|
|
19
20
|
keysToRemove.forEach(k => delete settings[k]);
|
|
@@ -92,9 +93,16 @@ export class WorkflowSanitizer {
|
|
|
92
93
|
* IMPORTANT: Organization metadata (projectId, projectName, homeProject, isArchived)
|
|
93
94
|
* is explicitly EXCLUDED here as it's read-only API information stored locally
|
|
94
95
|
* for display purposes only.
|
|
96
|
+
*
|
|
97
|
+
* CRITICAL: We must preserve executionOrder from the original workflow if present,
|
|
98
|
+
* or default to "v1" if not specified. Without this, workflows may execute in the
|
|
99
|
+
* wrong order, causing agents to produce output before calling their tools.
|
|
95
100
|
*/
|
|
96
101
|
static cleanForPush(workflow) {
|
|
97
|
-
//
|
|
102
|
+
// IMPORTANT: Preserve executionOrder from original workflow BEFORE calling cleanForStorage
|
|
103
|
+
// because cleanForStorage strips it out
|
|
104
|
+
const originalExecutionOrder = workflow.settings?.executionOrder;
|
|
105
|
+
// Start with cleanForStorage to get basic structure (but it removes executionOrder!)
|
|
98
106
|
const clean = this.cleanForStorage(workflow);
|
|
99
107
|
// Remove all fields that are not in the n8n API v1 PUT schema
|
|
100
108
|
// Keep only: name, nodes, connections, settings, staticData, triggerCount
|
|
@@ -106,24 +114,47 @@ export class WorkflowSanitizer {
|
|
|
106
114
|
result[key] = clean[key];
|
|
107
115
|
}
|
|
108
116
|
}
|
|
109
|
-
// Ensure settings is properly filtered
|
|
117
|
+
// Ensure settings is properly filtered and executionOrder is always set
|
|
118
|
+
// This runs for all workflows to guarantee executionOrder is present
|
|
119
|
+
const allowedSettings = [
|
|
120
|
+
'errorWorkflow',
|
|
121
|
+
'timezone',
|
|
122
|
+
'saveManualExecutions',
|
|
123
|
+
'saveDataErrorExecution',
|
|
124
|
+
'saveExecutionProgress',
|
|
125
|
+
'executionOrder'
|
|
126
|
+
];
|
|
127
|
+
const filteredSettings = {};
|
|
128
|
+
// If we have settings from clean, filter them
|
|
110
129
|
if (result.settings) {
|
|
111
|
-
const allowedSettings = [
|
|
112
|
-
'errorWorkflow',
|
|
113
|
-
'timezone',
|
|
114
|
-
'saveManualExecutions',
|
|
115
|
-
'saveDataErrorExecution',
|
|
116
|
-
'saveExecutionProgress',
|
|
117
|
-
'executionOrder'
|
|
118
|
-
];
|
|
119
|
-
const filteredSettings = {};
|
|
120
130
|
for (const settingKey of allowedSettings) {
|
|
121
131
|
if (result.settings[settingKey] !== undefined) {
|
|
122
132
|
filteredSettings[settingKey] = result.settings[settingKey];
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
|
-
result.settings = filteredSettings;
|
|
126
135
|
}
|
|
136
|
+
// CRITICAL: Always ensure executionOrder is set
|
|
137
|
+
//
|
|
138
|
+
// Background: When n8n API receives a workflow without executionOrder,
|
|
139
|
+
// it defaults to "v0" (legacy mode) which can cause execution order issues,
|
|
140
|
+
// especially with AI agents that need tools to execute before the final response.
|
|
141
|
+
//
|
|
142
|
+
// Strategy:
|
|
143
|
+
// - If workflow has EXPLICIT executionOrder (any value) → preserve it (respect user choice)
|
|
144
|
+
// - If workflow has NO executionOrder → default to "v1" (recommended by n8n)
|
|
145
|
+
//
|
|
146
|
+
// This ensures workflows created via n8n-as-code use proper execution order by default,
|
|
147
|
+
// while respecting explicit user choices (including v0 if they specifically want it).
|
|
148
|
+
const currentExecutionOrder = originalExecutionOrder || filteredSettings.executionOrder;
|
|
149
|
+
if (!currentExecutionOrder) {
|
|
150
|
+
// No executionOrder specified → default to v1 (recommended)
|
|
151
|
+
filteredSettings.executionOrder = 'v1';
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// Explicit executionOrder (v0, v1, v2, etc.) → preserve user choice
|
|
155
|
+
filteredSettings.executionOrder = currentExecutionOrder;
|
|
156
|
+
}
|
|
157
|
+
result.settings = filteredSettings;
|
|
127
158
|
return result;
|
|
128
159
|
}
|
|
129
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-sanitizer.js","sourceRoot":"","sources":["../../src/services/workflow-sanitizer.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IAC1B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,QAAmB;QACtC,MAAM,QAAQ,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,CAAC;QAElD,
|
|
1
|
+
{"version":3,"file":"workflow-sanitizer.js","sourceRoot":"","sources":["../../src/services/workflow-sanitizer.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IAC1B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,QAAmB;QACtC,MAAM,QAAQ,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,CAAC;QAElD,0EAA0E;QAC1E,8EAA8E;QAC9E,MAAM,YAAY,GAAG;YACjB,cAAc;YACd,gBAAgB;YAChB,cAAc;YACd,wBAAwB;YACxB,sBAAsB;YACtB,uBAAuB;YACvB,sFAAsF;YACtF,gBAAgB;SACnB,CAAC;QAEF,YAAY,CAAC,OAAO,C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