mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
✨ Copy data on execution only if needed
This commit is contained in:
@@ -395,13 +395,9 @@ export class Redis implements INodeType {
|
||||
} else if (['delete', 'get', 'keys', 'set'].includes(operation)) {
|
||||
const items = this.getInputData();
|
||||
|
||||
if (items.length === 0) {
|
||||
items.push({ json: {} });
|
||||
}
|
||||
|
||||
let item: INodeExecutionData;
|
||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||
item = items[itemIndex];
|
||||
item = { json: {} };
|
||||
|
||||
if (operation === 'delete') {
|
||||
const keyDelete = this.getNodeParameter('key', itemIndex) as string;
|
||||
@@ -409,8 +405,6 @@ export class Redis implements INodeType {
|
||||
const clientDel = util.promisify(client.del).bind(client);
|
||||
// @ts-ignore
|
||||
await clientDel(keyDelete);
|
||||
|
||||
resolve(this.prepareOutputData(items));
|
||||
} else if (operation === 'get') {
|
||||
const propertyName = this.getNodeParameter('propertyName', itemIndex) as string;
|
||||
const keyGet = this.getNodeParameter('key', itemIndex) as string;
|
||||
@@ -418,8 +412,6 @@ export class Redis implements INodeType {
|
||||
|
||||
const value = await getValue(client, keyGet, keyType);
|
||||
set(item.json, propertyName, value);
|
||||
|
||||
resolve(this.prepareOutputData(items));
|
||||
} else if (operation === 'keys') {
|
||||
const keyPattern = this.getNodeParameter('keyPattern', itemIndex) as string;
|
||||
|
||||
@@ -439,18 +431,16 @@ export class Redis implements INodeType {
|
||||
for (const keyName of keys) {
|
||||
set(item.json, keyName, await promises[keyName]);
|
||||
}
|
||||
|
||||
resolve(this.prepareOutputData(items));
|
||||
} else if (operation === 'set') {
|
||||
const keySet = this.getNodeParameter('key', itemIndex) as string;
|
||||
const value = this.getNodeParameter('value', itemIndex) as string;
|
||||
const keyType = this.getNodeParameter('keyType', itemIndex) as string;
|
||||
|
||||
await setValue(client, keySet, value, keyType);
|
||||
|
||||
resolve(this.prepareOutputData(items));
|
||||
}
|
||||
}
|
||||
|
||||
resolve(this.prepareOutputData(items));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user