@@ -26,10 +26,9 @@ this release, 3 of these are now complete!
26
26
- ✅🎉 ** Eradicating eval - this release!**
27
27
- 🤔🔜 Polymorphism
28
28
29
- After 3 months of gruelling work, we’re proud to announce that the third of
30
- these, eradicating eval, is now addressed with the launch of
31
- ` [email protected] ` (used as the core execution engine in
32
-
29
+ We’re proud to announce that the third of these, eradicating eval, is now
30
+ addressed with the launch of
` [email protected] ` , and the approach has been
31
+ fully adopted and tested via incorporation into
` [email protected] ` .
33
32
34
33
</p >
35
34
@@ -38,7 +37,7 @@ these, eradicating eval, is now addressed with the launch of
38
37
Since the beginning, Gra* fast* has had the ability to add plan resolvers not
39
38
just to fields, not just to arguments, but also to input object fields
40
39
(including those within lists). This made Gra* fast* ’s planning really ergonomic
41
- for things like nested filters, which was great for PostGraphile! But it turns
40
+ for things like nested filters. But it turns
42
41
out it’s really problematic for certain shapes of input — planning would put
43
42
constraints on the variables compatible with the plan, requiring potentially
44
43
unlimited numbers of operation plans needing to be built for the same GraphQL
@@ -48,10 +47,10 @@ excessive time.
48
47
49
48
One particular user example that could cause 4 minutes of planning time from
50
49
just a 100kB input made it clear that we had overreached with using plan
51
- resolvers too deep into inputs; so we’ve scaled it back so that you can only add
52
- plan resolvers to fields and arguments, you can no longer attach ` applyPlan ` or
53
- ` inputPlan ` to input object fields. This was something that we used a lot
54
- internally (hence the huge time investment migrating away!) , but very few people
50
+ resolvers too deep into inputs; so we’ve scaled it back so that you can only
51
+ add plan resolvers to fields and arguments, you can no longer attach
52
+ ` applyPlan ` or ` inputPlan ` to input object fields. This was something that we
53
+ used a lot in PostGraphile and its various plugins , but very few people
55
54
(no-one?) used externally so it was ripe for removal.
56
55
57
56
That problematic query that took 4 minutes to plan before? It now takes 1.1ms to
@@ -61,22 +60,23 @@ plan, yielding a 200,000x speedup!
61
60
62
61
### What does this mean for my codebase?
63
62
64
- Hopefully good things! Please update to the latest ` @beta ` of all the
65
- PostGraphile and/or Gra* fast* related modules you’re using (including plugins)
66
- and for most users everything should work as before, only better.
63
+ Hopefully good things! Please update to the latest ` grafast@beta ` and for most
64
+ users everything should work as before, only better.
67
65
68
- I’ve outlined some of the most common changes you may need to make below, but if
69
- you are impacted by any other changes, please ask for help in the chat — AFAIK
70
- most of the other things that have had significant changes are used by almost
71
- no-one except me, so it doesn’t make sense for me to invest time documenting it
72
- here. If you’re curious, many items are documented in both the changelogs and
66
+ I’ve outlined some of the most common changes you may need to make below, but
67
+ if you are impacted by any other changes, please ask for help [ in the
68
+ chat] ( https://discord.gg/graphile ) — AFAIK most of the other things that have
69
+ had significant changes are used by almost no-one except me, so it doesn’t make
70
+ sense for me to invest time documenting it here since the software is still in
71
+ beta. If you’re curious, many items are documented in both the changelogs and
73
72
the pull requests where the changes occurred.
74
73
75
74
#### Change ` fieldArgs.get ` to ` fieldArgs.getRaw `
76
75
77
76
Because we’ve removed ` inputPlan ` , the ` fieldArgs.get(key) ` method is no more;
78
77
instead use ` fieldArgs.getRaw(key) ` which is equivalent unless the inputs had
79
- plans (which they cannot any more).
78
+ plans (which they cannot any more). You'd know if you had plans on your inputs,
79
+ it's very unlikely you did if you were writing your own Gra* fast* schema.
80
80
81
81
#### Converting ` applyPlan ` and ` inputPlan `
82
82
@@ -87,13 +87,13 @@ runtime application or transform of these inputs recursively via a single step
87
87
in our plan diagram.
88
88
89
89
We’ve managed to make this new runtime system very similar in shape to the old
90
- plan-time system, so PostGraphile plugins don’t need to change much — this was
91
- largely enabled by how closely we managed to get the Gra* fast* plan syntax to the
92
- syntax of code you would normally write at runtime. The first change is to
93
- rename ` applyPlan ` to ` apply ` , and ` inputPlan ` to ` baked ` . From there, your code
94
- might just work straight away, or it might need some more small tweaks (e.g.
95
- ` fieldArgs ` is no longer present, it’s been replaced with simply the runtime
96
- value of the current field).
90
+ plan-time system (largely enabled by how closely we managed to get the
91
+ Gra* fast* plan syntax to the syntax of code you would normally write at
92
+ runtime), so if you do need to transform any it shouldn't take much effort. The
93
+ first change is to rename ` applyPlan ` to ` apply ` , and ` inputPlan ` to ` baked ` .
94
+ From there, your code might just work straight away, or it might need some more
95
+ small tweaks (e.g. ` fieldArgs ` is no longer present, it’s been replaced with
96
+ simply the runtime value of the current field).
97
97
98
98
#### No more ` $step.eval*() `
99
99
@@ -102,6 +102,11 @@ you try and use them. They will likely be removed at some point after release,
102
102
so you should be sure to migrate away from using them at your earliest
103
103
opportunity. But you weren’t using them anyway… right?
104
104
105
+ If you were, a new ` .apply() ` pattern has been added to various steps to enable
106
+ you to specify runtime tweaks the step can apply as its executing, for example
107
+ changing the ` ORDER BY ` clause in an SQL query based on a variable argument.
108
+ You may want to adopt a similar pattern in your own step classes.
109
+
105
110
#### ExecutableStep renamed to Step
106
111
107
112
This one is more cosmetic…
0 commit comments