Make it so the parent resolver returns a failed field named `foo` as
`__error_foo` containing the error message. This field can then be
picked up by the child resolver in order to produce a local error.
Moreover, this fixes the test for writeonly tokens, which used to create
a table in a db, and then try querying from a separate db, which ended
up not testing what it was supposed to at all.
I also changed the way mutations are guarded (the end result is pretty
much the same)
I removed the `readonlyGqlPostHandler` thingy from airgql,
as it seemed to be a slightly worse version of the existing more
general gql post handler. The one difference is that it was trying
to use the readonly db directory, although the token already protected
the queries to reading only, so this didn't matter. Moreover, the
writeonly endpoint was also using the readonly directory, which seemed
like a mistake (I removed that handler as well in favour of passing the
`writeonly` access mode to the existing handler).
I also fixed a TODO, making it so the readonly airsequel-cli handler
takes the edition into account.
- I realised by PK querying doesn't need arguments like filter, limit or
offset, so I removed the argument name collision logic I added in the
last commit
- I implemented the actual logic for querying by PK. The code is a lot
shorter due to the new introspection system
- I moved the normal queries to the new introspection system for
consistency.
- I moved the logic of "coerce columns without a datatype" away from the
resolver and into the "sql -> gql" converter as to be able to reuse the
default introspection resolver which simply looks up fields into the
parent resolver's result.
- I added some comments documenting the Introspection.Resolver stuff and
it's behaviour
- Make column names containing "_by_pk" disallowed on the client side (I
technically already did that on the server side with the previous
commit, but this makes it nicer)
- Implement the actual introspection logic
- If a primary key has a "reserved" argument name (i.e. a name we use
for built in airsequel arguments) like "filter" or "limit", then we
rename that to pk from <name> to <name>_. This might technically still
create collisions in the rare case where both <name> and <name>_ are
columns that are part of the same primary key, but I don't think that
matters in practice. The hasura playground doesn't seem to do any
renaming (I tried it in the playground), so we could also not do that at
all I guess...
So far we were going off the primary_key flag given to us by sqlite, but
this flag is only set to true for one column when using multi-column
primary keys.
Moreover, this commit also implements a `isRowid` property on
`ColumnEntry`, which is both there for convenience, and to reuse the
"proper" (i.e., taking into account rowid columns named _rowid_) rowid
detection logic.