In a Server Action how does one edit an object?

I was going to suggest RunJS at first, but then I saw that repeat can be configured.
RunJS is the best alternative to your pseudo-code.