I’m pretty new, too, but I distinctly remember seeing a bit about conditional upserts when I was reading the docs.
Definitely doesn’t cover the bulk part, but may help with the custom logic?
https://dgraph.io/docs/mutations/conditional-upsert/#example-of-conditional-upsert