Sync Alexa Shopping List with Home Assistant

I updated the process in Node-RED to delete the items directly in Alexa after the synchronization finishes successfully.
in this way


its working fine
the principal part is the function definition:

let items = msg.payload;

// 1. Create the string for Home Assistant
let displayValues = items.map(item => item.value);
let hstMsg = { payload: displayValues.join(',') };

// 2. Prepare ALL items for deletion (No filter)
let itemsToDelete = items.map(i => {
    return {
        payload: {
            item: String(i.id),
            version: parseInt(i.version)
        }
    };
});

return [hstMsg, itemsToDelete];

and in Remove Item node like this: