I am trying to integrate drizzle orm with electric sql. I got pretty much everything working (with some hacks), the last remaining thing is live queries with relational queries. So my approach is the following:
type RunLiveResult<T extends SQLiteRelationalQuery<any, any>> = T extends SQLiteRelationalQuery<any, infer R> ? R : never;
So basically electric-sql gives me a useLiveQuery hook where I pass the raw sql + params of the relational query. This works fine, but the return type is not correct. I did read the drizzle source code, there I found "mapRelationalRow" https://github.com/drizzle-team/drizzle-orm/blob/d535e0b667bec3aad6d238a71cebc23de30c455f/drizzle-orm/src/relations.ts#L659- the first 3 arguments are clear what to provide, but what about "buildQueryResultSelection" and "mapColumnValue" - are these properties on anything (exposed or not)