edgedb-js
edgedb-js copied to clipboard
Update generator functions to make it easier to interop with other targets like ReScript
Hello,
I would like to build a custom generator for ReScript. More precisely a queries generator.
So I started to play with the $.analyzeQuery function. Unfortunately it returns the args and result type as a stringified TypeScript type. Would be nice if the function could return for example the fields property of the inCodec and outCodec.
Another "pain point" is that I have to duplicate a lot of code. For example how to read the config, how to get alle query files etc.
So a great addition again if the generateQueryFiles function could be more reusable.
Well, after realizing theses two issues I wanted to try out the "native" generator with a custom target. So I added some the new extension, changed the "impl" function, etc. Unfortunately there will be the walkCodec function again and all the codec stuff.
TLDR; I just want to change (without a lot of effort) how the EdgeDB types will be mapped to the "targeted" output types.
Cheers, Daniel
@dkirchhof
I'm an erstwhile ReScript developer myself, so I'm open to making it easier for that ecosystem to integrate with EdgeDB. I'll throw this on my "medium-term" list of pet projects. I'm happy to help review PRs if you end up digging into this sooner than I get to it.