Fork me on GitHub
#pathom
<
2020-07-08
>
cjmurphy01:07:34

Is there documentation on how to specify a mutation that requires particular input/s? My use case is a mutation that needs to know the current user (which is available via an output only current-user-resolver).

souenzzo02:07:54

@cjmurphy I just do (let [user-data (parser env [...])]) inside mutation But I think that you can do something with pc/transform too

souenzzo02:07:39

Also I'm trying to develop a "style guide" to help us to know/remember/develop that kind of "pattern" in EQL ecosystem :) https://github.com/souenzzo/eql-style-guide#pathom

cjmurphy06:07:23

Re. your style guide there is a comment that doesn't seem to apply to the code below it.

cjmurphy06:07:51

I called the parser again, but from a function so can explicitly see all the cases. As it happens the current user is in the env so I could have just grabbed directly.

cjmurphy06:07:40

What would make sense to me would be if inputs were 'first class citizens' for mutations, which I think can be done with a plugin. And I was just wondering if it had been documented. Possibly that's the pc/transform you mentioned. For me is seems nice to only use standard plugins.

cjmurphy20:07:39

Currently every mutation has 2 args, first being env and second being params. If inputs were first class citizens then there would be 3 args, with the extra one being inputs. I guess it is some kind of a plugin that would provide that. Not sure your code is that generic. I know @U066U8JQJ was experimenting with something that did that. Not sure if it was finished or documented.

wilkerlucio20:07:10

@cjmurphy they are different concerns, params are for mutations what input is for resolvers, but they are different in the sense that params are sent as-is, you can make a plugin to auto-resolve the params on mutations, the arity 3 could be a thing, but not sure at this moment

Eric Ihli18:07:13

I see this mutation in an example. Does pathom guarantee mutations are run in order? Does it depend on configuration (https://wilkerlucio.github.io/pathom/#_parallel_parser)? [(log-in ~credentials) (finish-log-in {})])

souenzzo19:07:45

@ericihli [(op-1 {}) (op-2 {})] ~> both MAY be executed at same time (parallel parser will, serial parser don't [{(op-1 {}) [(op-2 {})]}] -> op-2 will only start after op-1 finish. But in general, isn't a good idea compose mutations in EQL Prefer [(log-in+finish-log-in ~creds)]

🙏 3