Returning an API response to an Array in a loop

I have a db table which has a column which I want to hash and store in another column in the same table. Once the select query runs it triggers this query:

jsBcryptMakeArray.trigger({
    onSuccess:function(data) {
      updateBcryptNode.trigger({
        additionalScope: {
          BcryptDataArray: data
        }
      })
  }
});

which in turn triggers this query which builds the array which is passed to the update query.

const delay = async ms => new Promise(resolve => setTimeout(resolve, ms))
const array_key = getNewNodes.data.install_key;
let newData = [];

for (const install_key of array_key){

//const loop2 = async () => array_key.map(async install_key => {
    await delay(1000)
    await getBcrypt.trigger({
      additionalScope: { install_key }
    });

    newData.push({
    install_key: install_key,
    secure_key: getBcrypt.data.hash
		  })
}
return newData 

The problem I am having is that the secure_key value in the newData array doesn't change from the first iteration. When I watch the getBcrypt object in the left-hand panel I can see the response updating as each install_key is passed to it but for some reason the value of getBcrypt.data.hash gets stuck on the first response and doesn't inherit subsequent responses. I have forumed this one to death but couldn't work out what's the issue so I'd be so grateful if one of you kind folks could help me out. Many thanks in advance.

This is solved and here is the solution which uses temporary state variable state1. Maybe there is a more elegant way but it works

const array_key = getNewNodes.data.install_key;
let newData = [];
let i=0
for (const install_key of array_key){
 await getBcrypt.trigger({
  additionalScope: {install_key:install_key},
  onSuccess: function(data){
  state1.setIn([i],data)
   }
}
)
        newData.push({
        install_key: install_key,
      	secure_key: state1.value[i].hash
        })  

i++ }
return newData

Turns out this is not the solution. When testing it worked for the first 2 iterations but then it falls over itself and crashes out. Any ideas?

Something strange happening here. The following query triggers the subsequent one which should return a fresh array of newData each time it runs. But it doesn't. I can see the values of state1 and state 2 changing in the left panel but when console.log( state2.value[i],state1.value[i].hash) gives the values from the previous iteration. So how do I access the new values of state1 and state2?

jsBcryptMakeArray.trigger({
     	onSuccess:function(Data) {
      	updateBcryptNode.trigger({
        additionalScope: {
          BcryptDataArray: Data
        }
      })
      }
});
const array_key = getNewNodes.data.install_key;
let i=0
let newData = [];
newData.length = 0
for (const install_key of array_key){
 	await getBcrypt.trigger({
 		additionalScope: {install_key:install_key},
 		onSuccess: function(data){
		state1.setIn([i],data)
        state2.setIn([i],install_key)
	
  }})

newData.push({
        install_key: state2.value[i],
      	secure_key: state1.value[i].hash
       })
i++;
  
} return newData