Plugins for dynamically loaded functions

Hi all,
I’ve been looking at creating a plugin that manages my collection of API calls. Currently i have an api directory that has files of api methods that are exported to a index.ts file. I then have to import that file to use.

I am trying to think of a way to create a plugin that automatically catches new api functions and have them available in both components and store modules? Is this possible?

Currently i have…
@/store/apis/ {books, authors, stores).api.ts

E.g. @/store/apis/books.api.ts

export const getBookByID = async (id) => .....blah blah blah


export { getBookID, deleteBook, .........etc } from "@/store/apis/books"
export {getAuthor, ..........} from "@/store/apis/author"

And in a component do this

import { getBookId, getAuthor} from "@/store/apis"

What i have been trying to do is write a plugin that just lets me write…



await this.$api.getBookID("74324-234234234-4324242")

Oh, and have all the typescript and intelli-sense stuff too

Any help/ideas or pointers?
Is this even possible?