agrosner
08/15/2024, 6:38 PMdocumentTransform
, would that allow us to write our own custom clientside directives?mbonnin
08/15/2024, 6:56 PMagrosner
08/15/2024, 7:00 PMid
and another entityId
field then package those up into a model class.
using:
fieldName @trackable
would be amazing. im thinking it would add special rules around which fields to query for and similair to declarative caching, insert fields to query for id
, entityId
etc and maybe get fancy with custom defined rules for each type a dev could defineagrosner
08/15/2024, 7:01 PM@client
directive to add computed fields only available on client schemasagrosner
08/15/2024, 7:01 PMmbonnin
08/15/2024, 7:04 PM@trackable
does sound doablembonnin
08/15/2024, 7:05 PM@client
sounds a lot less doable š
. That's one of the oldest feature request in the repo.agrosner
08/15/2024, 7:11 PM@client sounds a lot less doable
. That's one of the oldest feature request in the repo.
be fun thing to think about how it could work. weāve managed to make mock schema that is split by build variant (debug / release) that enables you to write additional schema in either flavor, in this case debug
sources. then you can only depend on it in debug code up the chain. its a pain when you need to do something in main sources, duplicating code. but if it was simply a directive that is stripped out in operation registration existing in main sourcesā¦.this would become 100x easieragrosner
08/15/2024, 7:12 PMextend type SomeType
alongside main schema code. then you decorate the field with @client
. then youd need to write an adapter class that gets checked at compile time (somehow) and linked to that field in that specific operation in some wayagrosner
08/15/2024, 7:13 PMmbonnin
08/15/2024, 7:59 PM@client
, I think that's actually even easier than @trackable
.mbonnin
08/15/2024, 8:01 PM@client
would be on the field definition, and not field itself?)agrosner
08/15/2024, 9:09 PMdirective @client on FIELD | TYPE | etc
Full types on client only:
type ExtendedType @client {
}
usage:
someType: ExtendedType @client(adapter:"packageName.ExtendedTypeAdapter") # required otherwise will fail build
Existing Types
use the same directive, but require an adapter to get registered pointing to it
somefield: String @client(adapter:"packageName.ExtendedTypeAdapter") # required otherwise will fail build
agrosner
08/15/2024, 9:10 PM@ClientAdapter(paths = ["SomeQueryName.field.someField"]) // query paths, can use multiple
class MyClientAdapter: ClientFieldAdapter<String> {
suspend fun evaluate(...): String { // the parameter would be something about the operation document etc
}
}