-
Couldn't load subscription status.
- Fork 159
Description
Is your feature request related to a problem? Please describe.
Within the callback code of a @populatedBy directive I need to know wether the code is evaluated in context of a CREATE or UDPATE mutation. Depending on that, I need to return different values.
Describe the solution you'd like
It would be great to have the operation type passed to the callback function as a fourth argument. Either as plain string or as enum, I don't care about that. Since the callback is called from within translate-create.js resp. translate-update.js it should be easy to pass the operation type to the call of callbackBucket.resolveCallbacks() and then to await callbackFunction(cb.parent, {}, this.context, OPERATION_TYPE)
Describe alternatives you've considered
I have tried to use the @populatedBy directive twice on a field with different callback function names and different operation types each, one for CREATE and one for UPDATE - but this fails since the schema validator allows this directive only once per field.