dbos-inc / dbos-transact

The TypeScript framework for backends that scale
https://docs.dbos.dev
MIT License
335 stars 22 forks source link

Use dynamic import instead of require #425

Closed demetris-manikas closed 3 months ago

demetris-manikas commented 3 months ago

This PR adds a bit more of type safety.

I had to abandon the PoolConfig since "weirdly" enough the typeorm and pg interfaces don't align in at least two places

one is the type definition of the password property since unfortunately () => string | undefined !== () => string | () => undefined

and the other being the type definition of the ssl.pskCallback function.

I rearranged a few pieces for better readability.

I also added a small utility function that has proven very useful for me when dealing with enum like types.

Let me know what you think.

demetris-manikas commented 3 months ago

The build seems to hang at the typeorm test I guess. The dynamic loading seems to be ok in the dev env but failing during ci/cd. This may go far... Since I cannot debug this, and I understand you not wanting to get into this, feel free to reject this PR.

kraftp commented 3 months ago

Thanks for trying to do this! However, while the type safety may be nice, like you said the added complexity likely isn't worth it.