|
Ran
|
Jobs
1
|
Files
140
|
Run time
1334min
|
Badge
README BADGES
|
push
github
feat: hooks round 5 (Option 2) - add before-user-created hook (#2034) ## Hooks Round 5 - Option 2 This PR contains Option 1 for implementing the `before-user-created` hook. See https://github.com/supabase/auth/pull/2032 for option 1. ### Summary This commit explores one possible implementation of this hook by: - Adding a `triggerBeforeUserCreated` method to the `*API` object in `internal/api/hooks.go` - Adding a `triggerBeforeUserCreatedExternal` method to the `*API` object in `internal/api/hooks.go` - Updating callers of `signupNewUser` to first call `triggerBeforeUserCreated` in: - internal/api/anonymous.go - internal/api/external.go - internal/api/invite.go - internal/api/mail.go - internal/api/signup.go - Updating callers of `signupNewUser` to first call `triggerBeforeUserCreatedExternal` in: - internal/api/external.go - internal/api/samlacs.go - internal/api/token_oidc.go - internal/api/web3.go - Add end to end tests in `internal/api/e2e_test.go` This has the benefit of being outside the transaction, but is a bit more complex. I make a best-effort to ensure I only trigger before-user-created when the user doesn't exist, but being outside the transaction there is a small chance for duplicate calls or calls that happen when a user already has been created. The main thought here is that we can document this behavior and the tradeoff is worth the benefits. ### Depends on [feat: hooks round 1](https://github.com/supabase/auth/pull/2023) - prepare package structure * renamed pkg `internal/hooks/v0hooks/v0http` -> `internal/hooks/hookshttp` [8a398ab](https://github.com/supabase/auth/pull/2023/commits/<a class=hub.com/supabase/auth/commit/8a398aba564267e4caa4c32bf661699d47d29174">8a398aba5) * renamed pkg `internal/hooks/v0hooks/v0pgfunc` -> `internal/hooks/hookspgfunc` [8a398ab](https://github.com/supabase/auth/pull/2023/commits/8a398aba564267e4caa4c32bf661699d47d29174) * use pkg `internal/e2e` for test setup in: * pkg `internal/hooks/hookspgfunc` [4d60288](ht... (continued)
181 of 277 new or added lines in 16 files covered. (65.34%)
2 existing lines in 2 files now uncovered.11284 of 16087 relevant lines covered (70.14%)
67.39 hits per line
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 2 |
67.44 |
-2.56% | internal/api/anonymous.go |
| 2 |
75.45 |
-0.05% | internal/api/external.go |
| 2 |
66.67 |
-0.33% | internal/api/signup.go |
| 2 |
87.7 |
-1.28% | internal/api/web3.go |
| 2 |
93.75 |
-2.97% | internal/hooks/hookspgfunc/hookspgfunc.go |
| 3 |
15.85 |
-0.26% | internal/api/token_oidc.go |
| 4 |
90.24 |
-9.76% | internal/hooks/v0hooks/v0hooks.go |
| 6 |
63.27 |
6.63% | internal/api/mail.go |
| 6 |
4.14 |
-0.08% | internal/api/samlacs.go |
| 6 |
96.1 |
-3.9% | internal/e2e/e2ehooks/e2ehooks.go |
| 9 |
65.08 |
-2.11% | internal/api/invite.go |
| 52 |
25.71 |
internal/api/hooks.go |
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 1 |
65.08 |
-2.11% | internal/api/invite.go |
| 1 |
68.21 |
0.51% | internal/api/token_refresh.go |
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 15402553041.1 | 140 |
70.14 |
GitHub Action Run |
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
|---|