Commit d09d08d
feat: hooks round 3 - begin adding the Before and After user created hooks (#2028)
## Hooks Round 3
This PR will contain a series of commits preparing for the
implementation of before & after user created hooks. It takes the
feedback from #2012 into
consideration.
### Summary
Begin adding the Before and After user created hooks:
* update pkg `internal/conf`
[d5f5436](d5f5436)
* add `BeforeUserCreated` and `AfterUserCreated` to `HookConfiguration`
struct
* add test cases for `EmailValidationBlockedMX` to restore 100% test
coverage
* update pkg `internal/hooks/v0hooks`
[bd37fe2](bd37fe2)
* add `BeforeUserCreated` method to `v0hooks.Manager` struct
* add `AfterUserCreated` method to `v0hooks.Manager` struct
* add tests to reach 100% coverage
* add pkg `internal/e2e/e2ehooks`
[903e623](903e623)
* add `HookCall` to record calls to hooks
* add `Hook` struct to hold `[]*HookCall` for a given hook name
* add `HookRecorder` to hold one `Hook` object per hook name
* add `Instance` struct to hold the `httptest.Server` and `HookRecorder`
* add `AfterUserCreated` method to `v0hooks.Manager` struct
* add tests to reach 100% coverage in all `internal/e2e` packages
* update pkg `internal/hooks/v0hooks`
[829aec6](829aec6)
* fix struct and json tag to match to match the Metadata type
* update pkg `internal/hooks/v0hooks`
[ca67be0](ca67be0)
* remove `BeforeUserCreated` and `AfterUserCreated` methods
* add Before & After user created hooks in `InvokeHook`
* update pkg `internal/e2e/e2eapi`
[46c144e](46c144e)
* add comments in IOError tests involving `http.RoundTripper`
* update calls to `t.Fatal` to use `require`
### Depends on
[feat: hooks round 1](#2023) -
prepare package structure
* Renamed pkg `internal/hooks/v0hooks/v0http` ->
`internal/hooks/hookshttp`
[8a398ab](8a398ab)
* Renamed pkg `internal/hooks/v0hooks/v0pgfunc` ->
`internal/hooks/hookspgfunc`
[8a398ab](8a398ab)
* Use pkg `internal/e2e` for test setup in:
* pkg `internal/hooks/hookspgfunc`
[4d60288](4d60288)
* pkg `internal/hooks/v0hooks`
[4a7432b](4a7432b)
[feat: hooks round 2](#2025) -
remove indirection and simplify error handling
* update pkg `internal/api` to:
* uses `internal/hooks/v0hooks.Manager` instead of
`internal/hooks/hooks.Manager`
[aec5995](aec5995)
* remove pkg `internal/hooks/hooks.Manager`
[062da5d](062da5d)
* add pkg `internal/hooks/hookserrors`
[7e80afc](7e80afc)
* use pkg `internal/hooks/hookserrors` in `internal/hooks/v0hooks`
[57744e8](57744e8)
* update pkg `internal/hooks/v0hooks` with an `Enabled` method
[16cc4c9](16cc4c9)
---------
Co-authored-by: Chris Stockton <chris.stockton@supabase.io>1 parent d758acc commit d09d08d
File tree
11 files changed
+832
-82
lines changed- internal
- conf
- e2e
- e2eapi
- e2ehooks
- hooks/v0hooks
11 files changed
+832
-82
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
643 | 646 | | |
644 | 647 | | |
645 | 648 | | |
| |||
671 | 674 | | |
672 | 675 | | |
673 | 676 | | |
| 677 | + | |
| 678 | + | |
674 | 679 | | |
675 | 680 | | |
676 | 681 | | |
| |||
888 | 893 | | |
889 | 894 | | |
890 | 895 | | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
891 | 908 | | |
892 | 909 | | |
893 | 910 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
179 | 209 | | |
180 | 210 | | |
181 | 211 | | |
| |||
490 | 520 | | |
491 | 521 | | |
492 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
493 | 528 | | |
494 | 529 | | |
495 | 530 | | |
| |||
532 | 567 | | |
533 | 568 | | |
534 | 569 | | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
535 | 581 | | |
536 | 582 | | |
537 | 583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
97 | 120 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
99 | 105 | | |
100 | 106 | | |
101 | 107 | | |
| |||
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
116 | | - | |
| 122 | + | |
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
| 133 | + | |
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
| |||
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
145 | | - | |
| 151 | + | |
146 | 152 | | |
147 | 153 | | |
148 | 154 | | |
| |||
0 commit comments