ashuvssut (ashu)
ashuvssut (ashu)16mo ago

a field to know the invoker of the query/mutation's in ctx argument

I want a field in the ctx argument of the query / mutation to know about the invoker of the query/mutation More specifically, I just need to know whether the invoker is the client or an internal function (internalQuery, internalMutation or internalAction) MY USE CASE I want to skip the auth check if the invoker is an internal function
2 Replies
ashuvssut (ashu)
ashuvssut (ashu)OP16mo ago
OR we can have a private argument internal_payload that is only allowed to be set by an internal function. By this way, we can pass info from the internal function to the query/mutation. Client cannot set this argument internal_payload
lee
lee16mo ago
Thanks for the feature request! I'll bring it up with the team. In the meantime, you can construct this yourself: split the called query/mutation into an internal version and a public version. From the internal version, call myHelper(ctx, {...args, internal: true}) and from the public version call myHelper(ctx, {...args, internal: false}). Then call the internal version only from internal mutations/actions. Public queries and mutations can be called from the client, so if you want a special flag if the caller is internal, the callee should also be internal.

Did you find this page helpful?