scripts/2016/stormpath-conversion/account-id-to-href
#!/usr/bin/env babel-node
import {getClient} from '../../../lib/stormpath'
import Commuter from '../../../lib/commuter/model'
getClient()
.then(client => {
return Commuter.iterateAndApply((commuters) => {
return commuters.filter(c => !!c.account).map(c => c.syncWithAccount(client))
}, {
tick: (commuters, count) => {
console.log(`${count}: Updated ${commuters.length} commuter(s)`)
}
})
})
.then(() => {
console.log(`FINISHED!`)
process.exit()
})
.catch(err => {
console.error(err)
console.error(err.stack)
process.exit(1)
})