Hello everyone!
I'm a heavy user of the Zapier Store in code blocks (Javascript).
Recently the data sent to the storage encountered a sudden increase and sometimes I got a full store (cleaning it everyday does not help).
I wanted to adopt a FIFO approach, for which if the number of records in the store > 450, I would delete the first record created in the Store.
I've been trying the following:
let found = false;
let secret = "mySuperSecret";
let store = StoreClient(secret);
// Get the amount of data included in the Storage
let res = await fetch("https://store.zapier.com/api/records?secret=" + secret);
let body = await res.json();
let length= Object.keys(body).length;
console.log(length);
let value = await store.get(inputData.importantInfo);
if (value == "published"){
found = true;
callback(null, {result:"Store Record already found"});
} else {
// Check if the number of records is higher than the limit
if (length>450){
// Delete the first record in the Storage (FIFO)
store.list_pop('userMail', location='head') // Does not work
}
// Set the new storage value
store.list_push(inputData.importantInfo, "published");
callback(null, {result:"Storage value (" + inputData.importantInfo + ") set to 'published'"});
}
But I had no success. I guess the list_pop method is for Python only.
Did anybody try something like this and found the solution?
Does anybody have a better idea?
Thanks a lot!