From 87835b81cbe5097e76ba5da28dfd12b59979e6bd Mon Sep 17 00:00:00 2001 From: evykassirer Date: Wed, 9 Oct 2024 18:55:51 -0700 Subject: [PATCH] state_data: Flesh out types for realm_schema. --- web/src/state_data.ts | 51 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/web/src/state_data.ts b/web/src/state_data.ts index 9ad8b3a7a1..7173e147de 100644 --- a/web/src/state_data.ts +++ b/web/src/state_data.ts @@ -261,14 +261,14 @@ const realm_schema = z.object({ max_icon_file_size_mib: z.number(), max_logo_file_size_mib: z.number(), max_message_length: z.number(), - max_stream_description_length: NOT_TYPED_YET, - max_stream_name_length: NOT_TYPED_YET, + max_stream_description_length: z.number(), + max_stream_name_length: z.number(), max_topic_length: z.number(), - password_min_guesses: NOT_TYPED_YET, - password_min_length: NOT_TYPED_YET, + password_min_guesses: z.number(), + password_min_length: z.number(), realm_add_custom_emoji_policy: z.number(), realm_allow_edit_history: z.boolean(), - realm_allow_message_editing: NOT_TYPED_YET, + realm_allow_message_editing: z.boolean(), realm_authentication_methods: z.record( z.object({ enabled: z.boolean(), @@ -308,8 +308,8 @@ const realm_schema = z.object({ ), realm_default_language: z.string(), realm_description: z.string(), - realm_digest_emails_enabled: NOT_TYPED_YET, - realm_digest_weekday: NOT_TYPED_YET, + realm_digest_emails_enabled: z.boolean(), + realm_digest_weekday: z.number(), realm_direct_message_initiator_group: z.number(), realm_direct_message_permission_group: z.number(), realm_disallow_disposable_email_addresses: z.boolean(), @@ -320,10 +320,15 @@ const realm_schema = z.object({ }), ), realm_edit_topic_policy: z.number(), - realm_email_auth_enabled: NOT_TYPED_YET, + realm_email_auth_enabled: z.boolean(), realm_email_changes_disabled: z.boolean(), realm_emails_restricted_to_domains: z.boolean(), - realm_embedded_bots: NOT_TYPED_YET, + realm_embedded_bots: z.array( + z.object({ + name: z.string(), + config: z.record(z.string()), + }), + ), realm_enable_guest_user_indicator: z.boolean(), realm_enable_read_receipts: z.boolean(), realm_enable_spectator_access: z.boolean(), @@ -338,9 +343,9 @@ const realm_schema = z.object({ // We currently ignore the `config` field in these objects. }), ), - realm_inline_image_preview: NOT_TYPED_YET, - realm_inline_url_embed_preview: NOT_TYPED_YET, - realm_invite_required: NOT_TYPED_YET, + realm_inline_image_preview: z.boolean(), + realm_inline_url_embed_preview: z.boolean(), + realm_invite_required: z.boolean(), realm_invite_to_realm_policy: z.number(), realm_invite_to_stream_policy: z.number(), realm_is_zephyr_mirror_realm: z.boolean(), @@ -355,7 +360,7 @@ const realm_schema = z.object({ realm_logo_source: z.string(), realm_logo_url: z.string(), realm_mandatory_topics: z.boolean(), - realm_message_content_allowed_in_email_notifications: NOT_TYPED_YET, + realm_message_content_allowed_in_email_notifications: z.boolean(), realm_message_content_edit_limit_seconds: z.number().nullable(), realm_message_content_delete_limit_seconds: z.number().nullable(), realm_message_retention_days: z.number(), @@ -368,7 +373,7 @@ const realm_schema = z.object({ realm_night_logo_source: z.string(), realm_night_logo_url: z.string(), realm_org_type: z.number(), - realm_password_auth_enabled: NOT_TYPED_YET, + realm_password_auth_enabled: z.boolean(), realm_plan_type: z.number(), realm_playgrounds: z.array( z.object({ @@ -380,21 +385,21 @@ const realm_schema = z.object({ ), realm_presence_disabled: z.boolean(), realm_push_notifications_enabled: z.boolean(), - realm_push_notifications_enabled_end_timestamp: NOT_TYPED_YET, + realm_push_notifications_enabled_end_timestamp: z.number().nullable(), realm_require_unique_names: z.boolean(), - realm_send_welcome_emails: NOT_TYPED_YET, + realm_send_welcome_emails: z.boolean(), realm_signup_announcements_stream_id: z.number(), realm_upload_quota_mib: z.nullable(z.number()), realm_url: z.string(), realm_video_chat_provider: z.number(), realm_waiting_period_threshold: z.number(), - realm_want_advertise_in_communities_directory: NOT_TYPED_YET, + realm_want_advertise_in_communities_directory: z.boolean(), realm_wildcard_mention_policy: z.number(), realm_zulip_update_announcements_stream_id: z.number(), server_avatar_changes_disabled: z.boolean(), - server_emoji_data_url: NOT_TYPED_YET, - server_inline_image_preview: NOT_TYPED_YET, - server_inline_url_embed_preview: NOT_TYPED_YET, + server_emoji_data_url: z.string(), + server_inline_image_preview: z.boolean(), + server_inline_url_embed_preview: z.boolean(), server_jitsi_server_url: z.nullable(z.string()), server_name_changes_disabled: z.boolean(), server_needs_upgrade: z.boolean(), @@ -410,10 +415,10 @@ const realm_schema = z.object({ server_typing_started_wait_period_milliseconds: z.number(), server_typing_stopped_wait_period_milliseconds: z.number(), server_web_public_streams_enabled: z.boolean(), - settings_send_digest_emails: NOT_TYPED_YET, + settings_send_digest_emails: z.boolean(), stop_words: z.array(z.string()), - upgrade_text_for_wide_organization_logo: NOT_TYPED_YET, - zulip_feature_level: NOT_TYPED_YET, + upgrade_text_for_wide_organization_logo: z.string(), + zulip_feature_level: z.number(), zulip_merge_base: z.string(), zulip_plan_is_not_limited: z.boolean(), zulip_version: z.string(),