kysely-data-api
kysely-data-api copied to clipboard
fix(driver): return Object for JSON columns and imply UTC for timestampz
Summary
This PR does a couple of things:
- Removes the
yarn.lock
file and references toyarn
in thepackage.json
scripts because this usespnpm
for the GitHub actions and everything else - Changes the
DataApiConnection.executeQuery
logic to be more type-savvy in the following ways:- The current implementation converts all
date
timestamp
andtimestamptz
columns intoDate
objects. However, in Postgres,timestamptz
columns are always stored in UTC and are converted to the system timezone upon retrieval. Therefore, implied UTC needs to be added to ensure that theDate
object is correct https://github.com/sst/kysely-data-api/issues/34 - The current implementation is capable of returning POJOs for
json
andjsonb
columns. This relieves us of needing to use theParseJSONResultsPlugin
which incorrectly and eagerly convert non-JSON column types into JSON. Given that the column type is available here, I think it makes a lot of sense to use that information
- The current implementation converts all
Given that this changes the return types, I've opted for a major version bump.