n8n-nodes-variable 1.0.6 → 1.0.7
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.
|
@@ -581,7 +581,8 @@ function opIncrement(ctx, i, namespace, scopeLabel, get, set, has, direction) {
|
|
|
581
581
|
const initialValue = ctx.getNodeParameter('numericInitialValue', i, 0);
|
|
582
582
|
const opName = direction === 1 ? 'increment' : 'decrement';
|
|
583
583
|
let current;
|
|
584
|
-
|
|
584
|
+
const existed = has(key);
|
|
585
|
+
if (!existed) {
|
|
585
586
|
if (!initIfMissing) {
|
|
586
587
|
throw new Error(`Variable "${key}" does not exist in namespace "${namespace}". Enable "Initialize If Missing" to create it automatically.`);
|
|
587
588
|
}
|
|
@@ -602,7 +603,7 @@ function opIncrement(ctx, i, namespace, scopeLabel, get, set, has, direction) {
|
|
|
602
603
|
namespace,
|
|
603
604
|
key,
|
|
604
605
|
value: newValue,
|
|
605
|
-
previousValue:
|
|
606
|
+
previousValue: existed ? current : undefined,
|
|
606
607
|
};
|
|
607
608
|
}
|
|
608
609
|
function opAppendToArray(ctx, i, namespace, scopeLabel, get, set, has) {
|
|
@@ -717,7 +718,10 @@ function buildOutputItem(ctx, originalItem, updatedItemJson, result, outputMode,
|
|
|
717
718
|
};
|
|
718
719
|
}
|
|
719
720
|
if (outputMode === 'addField') {
|
|
720
|
-
|
|
721
|
+
// For Get Variable, use the dedicated output field name; otherwise use addFieldName
|
|
722
|
+
const fieldName = result.operation === 'get'
|
|
723
|
+
? ctx.getNodeParameter('getOutputFieldName', i, 'value')
|
|
724
|
+
: ctx.getNodeParameter('addFieldName', i, 'value');
|
|
721
725
|
return {
|
|
722
726
|
json: {
|
|
723
727
|
...updatedItemJson,
|