[refactor] move some of API stuff to Core

Overall idea is: Core and Database contain base stuff and don't import
API. And API imports from Core and Database.
Status Job ID Name Coverage
  Cabal
failed #11500
cabal

 
  Stack
skipped #11501
stack
 
  Bench
skipped #11502
allowed to fail manual
bench
 
  Test
skipped #11503
test
 
Name Stage Failure
failed
cabal Cabal There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job trace