From d9060ce989be200342a3f31b24e05ac300107cb5 Mon Sep 17 00:00:00 2001 From: Scott Trinh Date: Fri, 27 Sep 2024 10:11:34 -0400 Subject: [PATCH] cqa --- edb/server/protocol/auth_ext/config.py | 1 + edb/server/protocol/auth_ext/webhook.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/edb/server/protocol/auth_ext/config.py b/edb/server/protocol/auth_ext/config.py index 40561e9f38c4..90105d044a85 100644 --- a/edb/server/protocol/auth_ext/config.py +++ b/edb/server/protocol/auth_ext/config.py @@ -87,6 +87,7 @@ class MagicLinkProviderConfig(ProviderConfig): name: Literal["builtin::local_magic_link"] token_time_to_live: statypes.Duration + @dataclass class WebhookConfig: events: list[str] diff --git a/edb/server/protocol/auth_ext/webhook.py b/edb/server/protocol/auth_ext/webhook.py index 261d2d6ed056..6ae756b496a6 100644 --- a/edb/server/protocol/auth_ext/webhook.py +++ b/edb/server/protocol/auth_ext/webhook.py @@ -139,4 +139,11 @@ async def send( ) result = json.loads(result_json) - return result[0]["id"] + match result[0]["id"]: + case str(id): + return id + case _: + raise ValueError( + "Expected single result with 'id' string property, got " + f"{result[0]!r}" + )