Accessing DB object from other sub-packages

Hi, hope you all are doing great.

How a sub-package can access the DB object used in cli ? I wonder if there is an approach to access the database layer from other sub-packages.

As I realized, we can’t add cli sub-package to other sub-packages using lerna. (Am I Right?) So we can’t use this lerna pattern to access cli files.


Exactly, lerna will prevent you from importing it cross-package. If you add an endpoint to Server.ts and a method to editor-ui/src/components/mixins/restApi.ts, you can route data from it to the client.

What are you looking to achieve?


Thanks @ivov , I don’t need to access db in frontend. I’ve created new sub-package, and I need to access db in this sub-package.

Do you have any idea ?

Hey @jellybean,

What are you actually trying to do, I can see you mentioned accessing DB objects like the CLI does but which objects specifically are you after? There is an undocumented internal API that can be used from the front end with the HTTP Request node that may do what you are after.

1 Like

What I want to do is totally relates to the backend, I see that there is no way to access cli files in other sub-packages, so I just decided to write the codes in cli, not other places.

Thanks :slight_smile: