Improve generated template (configuration of XataClient)
Is your feature request related to a problem? Please describe.
Inside the generated SDK, we have the following lines:
export const getXataClient = () => {
if (instance) return instance;
instance = new XataClient();
return instance;
};
The problem is that we can’t configure the XataClient() here since this is a generated file (so it will be erased at the next generation).
Describe the solution you'd like
Multiple ideas:
- Remove this
getXataClient()from the generated file and force people to write their adapter - Generate once a separate file for the
XataClientinstance (no override onxata codegen)
Describe alternatives you've considered
I can write a separate file for my XataClient() instance, but I still have this dead code on my codebase, which could lead to a mistake if somebody imports this getXataClient() instead of the custom one.
Since latest minor version we have the ability to rebuild xata.ts file keeping changes inside. It lacks some tests and an override flag so for now it's disabled by default, but we already have the solution built, it was just a matter of me not having the time to finish it and release it.