diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:29:30 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:41:21 +1000 |
commit | dbaf39237ae3a41b6b1ac6a6cd3486129599b815 (patch) | |
tree | 350cca4889d0804445eddbd8467d274b27307776 /src/util/schemas | |
parent | Remove the cdn storage location log (diff) | |
download | server-dbaf39237ae3a41b6b1ac6a6cd3486129599b815.tar.xz |
Prettier
Diffstat (limited to 'src/util/schemas')
43 files changed, 74 insertions, 59 deletions
diff --git a/src/util/schemas/ActivitySchema.ts b/src/util/schemas/ActivitySchema.ts index d316420e..5a3d205b 100644 --- a/src/util/schemas/ActivitySchema.ts +++ b/src/util/schemas/ActivitySchema.ts @@ -41,7 +41,8 @@ export const ActivitySchema = { $id: String, $sync_id: String, - $metadata: { // spotify + $metadata: { + // spotify $context_uri: String, album_id: String, artist_ids: [String], @@ -57,4 +58,4 @@ export interface ActivitySchema { status: Status; activities?: Activity[]; since?: number; // unix time (in milliseconds) of when the client went idle, or null if the client is not idle -} \ No newline at end of file +} diff --git a/src/util/schemas/BackupCodesChallengeSchema.ts b/src/util/schemas/BackupCodesChallengeSchema.ts index d6b519b7..8e2f0649 100644 --- a/src/util/schemas/BackupCodesChallengeSchema.ts +++ b/src/util/schemas/BackupCodesChallengeSchema.ts @@ -1,3 +1,3 @@ export interface BackupCodesChallengeSchema { password: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/BanCreateSchema.ts b/src/util/schemas/BanCreateSchema.ts index 876b2a89..834577dc 100644 --- a/src/util/schemas/BanCreateSchema.ts +++ b/src/util/schemas/BanCreateSchema.ts @@ -1,4 +1,4 @@ export interface BanCreateSchema { delete_message_days?: string; reason?: string; -}; \ No newline at end of file +} diff --git a/src/util/schemas/BanModeratorSchema.ts b/src/util/schemas/BanModeratorSchema.ts index 8efa2402..afb76433 100644 --- a/src/util/schemas/BanModeratorSchema.ts +++ b/src/util/schemas/BanModeratorSchema.ts @@ -4,4 +4,4 @@ export interface BanModeratorSchema { guild_id: string; executor_id: string; reason?: string | undefined; -}; \ No newline at end of file +} diff --git a/src/util/schemas/BanRegistrySchema.ts b/src/util/schemas/BanRegistrySchema.ts index 8680d3db..501f94dc 100644 --- a/src/util/schemas/BanRegistrySchema.ts +++ b/src/util/schemas/BanRegistrySchema.ts @@ -5,4 +5,4 @@ export interface BanRegistrySchema { executor_id: string; ip?: string; reason?: string | undefined; -}; \ No newline at end of file +} diff --git a/src/util/schemas/BulkDeleteSchema.ts b/src/util/schemas/BulkDeleteSchema.ts index 6a71e052..bfc4df65 100644 --- a/src/util/schemas/BulkDeleteSchema.ts +++ b/src/util/schemas/BulkDeleteSchema.ts @@ -1,3 +1,3 @@ export interface BulkDeleteSchema { messages: string[]; -} \ No newline at end of file +} diff --git a/src/util/schemas/ChannelModifySchema.ts b/src/util/schemas/ChannelModifySchema.ts index 835ea2d7..9a07f983 100644 --- a/src/util/schemas/ChannelModifySchema.ts +++ b/src/util/schemas/ChannelModifySchema.ts @@ -27,4 +27,4 @@ export interface ChannelModifySchema { flags?: number; default_thread_rate_limit_per_user?: number; video_quality_mode?: number; -} \ No newline at end of file +} diff --git a/src/util/schemas/CodesVerificationSchema.ts b/src/util/schemas/CodesVerificationSchema.ts index e8e2e7b4..73c371eb 100644 --- a/src/util/schemas/CodesVerificationSchema.ts +++ b/src/util/schemas/CodesVerificationSchema.ts @@ -2,4 +2,4 @@ export interface CodesVerificationSchema { key: string; nonce: string; regenerate?: boolean; -} \ No newline at end of file +} diff --git a/src/util/schemas/DmChannelCreateSchema.ts b/src/util/schemas/DmChannelCreateSchema.ts index 04b8ff69..1b0fe86d 100644 --- a/src/util/schemas/DmChannelCreateSchema.ts +++ b/src/util/schemas/DmChannelCreateSchema.ts @@ -1,4 +1,4 @@ export interface DmChannelCreateSchema { name?: string; recipients: string[]; -} \ No newline at end of file +} diff --git a/src/util/schemas/EmojiCreateSchema.ts b/src/util/schemas/EmojiCreateSchema.ts index 8e2a2307..34084713 100644 --- a/src/util/schemas/EmojiCreateSchema.ts +++ b/src/util/schemas/EmojiCreateSchema.ts @@ -3,4 +3,4 @@ export interface EmojiCreateSchema { image: string; require_colons?: boolean | null; roles?: string[]; -} \ No newline at end of file +} diff --git a/src/util/schemas/EmojiModifySchema.ts b/src/util/schemas/EmojiModifySchema.ts index cd5b7e3e..05d2d395 100644 --- a/src/util/schemas/EmojiModifySchema.ts +++ b/src/util/schemas/EmojiModifySchema.ts @@ -1,4 +1,4 @@ export interface EmojiModifySchema { name?: string; roles?: string[]; -} \ No newline at end of file +} diff --git a/src/util/schemas/GuildCreateSchema.ts b/src/util/schemas/GuildCreateSchema.ts index 9b5f7dc2..f3de7007 100644 --- a/src/util/schemas/GuildCreateSchema.ts +++ b/src/util/schemas/GuildCreateSchema.ts @@ -11,4 +11,4 @@ export interface GuildCreateSchema { guild_template_code?: string; system_channel_id?: string; rules_channel_id?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/GuildTemplateCreateSchema.ts b/src/util/schemas/GuildTemplateCreateSchema.ts index 7caefcb8..59db8428 100644 --- a/src/util/schemas/GuildTemplateCreateSchema.ts +++ b/src/util/schemas/GuildTemplateCreateSchema.ts @@ -1,4 +1,4 @@ export interface GuildTemplateCreateSchema { name: string; avatar?: string | null; -} \ No newline at end of file +} diff --git a/src/util/schemas/GuildUpdateWelcomeScreenSchema.ts b/src/util/schemas/GuildUpdateWelcomeScreenSchema.ts index 0022da6e..e271b83e 100644 --- a/src/util/schemas/GuildUpdateWelcomeScreenSchema.ts +++ b/src/util/schemas/GuildUpdateWelcomeScreenSchema.ts @@ -7,4 +7,4 @@ export interface GuildUpdateWelcomeScreenSchema { }[]; enabled?: boolean; description?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/InviteCreateSchema.ts b/src/util/schemas/InviteCreateSchema.ts index 83ae22dd..cac11147 100644 --- a/src/util/schemas/InviteCreateSchema.ts +++ b/src/util/schemas/InviteCreateSchema.ts @@ -8,4 +8,4 @@ export interface InviteCreateSchema { unique?: boolean; target_user?: string; target_user_type?: number; -} \ No newline at end of file +} diff --git a/src/util/schemas/LoginSchema.ts b/src/util/schemas/LoginSchema.ts index 543d236c..dc889d94 100644 --- a/src/util/schemas/LoginSchema.ts +++ b/src/util/schemas/LoginSchema.ts @@ -5,4 +5,4 @@ export interface LoginSchema { captcha_key?: string; login_source?: string; gift_code_sku_id?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/MemberChangeSchema.ts b/src/util/schemas/MemberChangeSchema.ts index 566d7e20..2367bef3 100644 --- a/src/util/schemas/MemberChangeSchema.ts +++ b/src/util/schemas/MemberChangeSchema.ts @@ -1,4 +1,4 @@ export interface MemberChangeSchema { roles?: string[]; nick?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/MemberNickChangeSchema.ts b/src/util/schemas/MemberNickChangeSchema.ts index ed9fdb7b..d863038c 100644 --- a/src/util/schemas/MemberNickChangeSchema.ts +++ b/src/util/schemas/MemberNickChangeSchema.ts @@ -1,3 +1,3 @@ export interface MemberNickChangeSchema { nick: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/MessageAcknowledgeSchema.ts b/src/util/schemas/MessageAcknowledgeSchema.ts index 1e7fb80d..194bb4b4 100644 --- a/src/util/schemas/MessageAcknowledgeSchema.ts +++ b/src/util/schemas/MessageAcknowledgeSchema.ts @@ -1,4 +1,4 @@ export interface MessageAcknowledgeSchema { manual?: boolean; mention_count?: number; -} \ No newline at end of file +} diff --git a/src/util/schemas/MessageCreateSchema.ts b/src/util/schemas/MessageCreateSchema.ts index 9d77c485..bf3470bb 100644 --- a/src/util/schemas/MessageCreateSchema.ts +++ b/src/util/schemas/MessageCreateSchema.ts @@ -30,4 +30,4 @@ export interface MessageCreateSchema { **/ attachments?: any[]; sticker_ids?: string[]; -} \ No newline at end of file +} diff --git a/src/util/schemas/MfaCodesSchema.ts b/src/util/schemas/MfaCodesSchema.ts index 226c43f1..ac05b9a4 100644 --- a/src/util/schemas/MfaCodesSchema.ts +++ b/src/util/schemas/MfaCodesSchema.ts @@ -1,4 +1,4 @@ export interface MfaCodesSchema { password: string; regenerate?: boolean; -} \ No newline at end of file +} diff --git a/src/util/schemas/ModifyGuildStickerSchema.ts b/src/util/schemas/ModifyGuildStickerSchema.ts index 06bf4ffe..159cc44f 100644 --- a/src/util/schemas/ModifyGuildStickerSchema.ts +++ b/src/util/schemas/ModifyGuildStickerSchema.ts @@ -12,4 +12,4 @@ export interface ModifyGuildStickerSchema { * @maxLength 200 */ tags: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/PruneSchema.ts b/src/util/schemas/PruneSchema.ts index 60601d81..bea5e2b4 100644 --- a/src/util/schemas/PruneSchema.ts +++ b/src/util/schemas/PruneSchema.ts @@ -3,4 +3,4 @@ export interface PruneSchema { * @min 0 */ days: number; -} \ No newline at end of file +} diff --git a/src/util/schemas/PurgeSchema.ts b/src/util/schemas/PurgeSchema.ts index 8916be92..f5ab0a20 100644 --- a/src/util/schemas/PurgeSchema.ts +++ b/src/util/schemas/PurgeSchema.ts @@ -1,4 +1,4 @@ export interface PurgeSchema { before: string; after: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/RegisterSchema.ts b/src/util/schemas/RegisterSchema.ts index c0cc3805..865f55b3 100644 --- a/src/util/schemas/RegisterSchema.ts +++ b/src/util/schemas/RegisterSchema.ts @@ -24,4 +24,4 @@ export interface RegisterSchema { captcha_key?: string; promotional_email_opt_in?: boolean; -} \ No newline at end of file +} diff --git a/src/util/schemas/RelationshipPostSchema.ts b/src/util/schemas/RelationshipPostSchema.ts index 3ff6eade..774c67f6 100644 --- a/src/util/schemas/RelationshipPostSchema.ts +++ b/src/util/schemas/RelationshipPostSchema.ts @@ -1,4 +1,4 @@ export interface RelationshipPostSchema { discriminator: string; username: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/RelationshipPutSchema.ts b/src/util/schemas/RelationshipPutSchema.ts index 455f854e..0a7f9720 100644 --- a/src/util/schemas/RelationshipPutSchema.ts +++ b/src/util/schemas/RelationshipPutSchema.ts @@ -2,4 +2,4 @@ import { RelationshipType } from "@fosscord/util"; export interface RelationshipPutSchema { type?: RelationshipType; -} \ No newline at end of file +} diff --git a/src/util/schemas/RoleModifySchema.ts b/src/util/schemas/RoleModifySchema.ts index adb0c1a6..f3f4a20e 100644 --- a/src/util/schemas/RoleModifySchema.ts +++ b/src/util/schemas/RoleModifySchema.ts @@ -7,4 +7,4 @@ export interface RoleModifySchema { position?: number; icon?: string; unicode_emoji?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/SelectProtocolSchema.ts b/src/util/schemas/SelectProtocolSchema.ts index 92958e97..0ba0c23b 100644 --- a/src/util/schemas/SelectProtocolSchema.ts +++ b/src/util/schemas/SelectProtocolSchema.ts @@ -1,12 +1,12 @@ export interface SelectProtocolSchema { protocol: "webrtc" | "udp"; data: - | string - | { - address: string; - port: number; - mode: string; - }; + | string + | { + address: string; + port: number; + mode: string; + }; sdp?: string; codecs?: { name: "opus" | "VP8" | "VP9" | "H264"; @@ -16,4 +16,4 @@ export interface SelectProtocolSchema { rtx_payload_type?: number | null; }[]; rtc_connection_id?: string; // uuid -} \ No newline at end of file +} diff --git a/src/util/schemas/TemplateCreateSchema.ts b/src/util/schemas/TemplateCreateSchema.ts index 3f98f692..160934f5 100644 --- a/src/util/schemas/TemplateCreateSchema.ts +++ b/src/util/schemas/TemplateCreateSchema.ts @@ -1,4 +1,4 @@ export interface TemplateCreateSchema { name: string; description?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/TemplateModifySchema.ts b/src/util/schemas/TemplateModifySchema.ts index 3e6efb74..f9c9d14b 100644 --- a/src/util/schemas/TemplateModifySchema.ts +++ b/src/util/schemas/TemplateModifySchema.ts @@ -1,4 +1,4 @@ export interface TemplateModifySchema { name: string; description?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/TotpDisableSchema.ts b/src/util/schemas/TotpDisableSchema.ts index 05192bfa..51446e1c 100644 --- a/src/util/schemas/TotpDisableSchema.ts +++ b/src/util/schemas/TotpDisableSchema.ts @@ -1,3 +1,3 @@ export interface TotpDisableSchema { code: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/TotpEnableSchema.ts b/src/util/schemas/TotpEnableSchema.ts index 7f6fb5a9..4e3551d9 100644 --- a/src/util/schemas/TotpEnableSchema.ts +++ b/src/util/schemas/TotpEnableSchema.ts @@ -2,4 +2,4 @@ export interface TotpEnableSchema { password: string; code?: string; secret?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/TotpSchema.ts b/src/util/schemas/TotpSchema.ts index 889cb443..941a92ec 100644 --- a/src/util/schemas/TotpSchema.ts +++ b/src/util/schemas/TotpSchema.ts @@ -1,6 +1,6 @@ export interface TotpSchema { - code: string, - ticket: string, - gift_code_sku_id?: string | null, - login_source?: string | null, -} \ No newline at end of file + code: string; + ticket: string; + gift_code_sku_id?: string | null; + login_source?: string | null; +} diff --git a/src/util/schemas/UserModifySchema.ts b/src/util/schemas/UserModifySchema.ts index 34e0f135..5327e34b 100644 --- a/src/util/schemas/UserModifySchema.ts +++ b/src/util/schemas/UserModifySchema.ts @@ -16,4 +16,4 @@ export interface UserModifySchema { code?: string; email?: string; discriminator?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/Validator.ts b/src/util/schemas/Validator.ts index b71bf6a1..e85cdf7b 100644 --- a/src/util/schemas/Validator.ts +++ b/src/util/schemas/Validator.ts @@ -3,7 +3,14 @@ import addFormats from "ajv-formats"; import fs from "fs"; import path from "path"; -const SchemaPath = path.join(__dirname, "..", "..", "..", "assets", "schemas.json"); +const SchemaPath = path.join( + __dirname, + "..", + "..", + "..", + "assets", + "schemas.json", +); const schemas = JSON.parse(fs.readFileSync(SchemaPath, { encoding: "utf8" })); export const ajv = new Ajv({ @@ -14,7 +21,7 @@ export const ajv = new Ajv({ coerceTypes: true, messages: true, strict: true, - strictRequired: true + strictRequired: true, }); addFormats(ajv); @@ -41,7 +48,14 @@ export const normalizeBody = (body: any = {}) => { } else { for (const [key, value] of Object.entries(object)) { if (value == null) { - if (key === "icon" || key === "avatar" || key === "banner" || key === "splash" || key === "discovery_splash") continue; + if ( + key === "icon" || + key === "avatar" || + key === "banner" || + key === "splash" || + key === "discovery_splash" + ) + continue; delete object[key]; } else if (typeof value === "object") { normalizeObject(value); @@ -51,4 +65,4 @@ export const normalizeBody = (body: any = {}) => { }; normalizeObject(body); return body; -}; \ No newline at end of file +}; diff --git a/src/util/schemas/VanityUrlSchema.ts b/src/util/schemas/VanityUrlSchema.ts index 28bf7f2b..4dd9b9da 100644 --- a/src/util/schemas/VanityUrlSchema.ts +++ b/src/util/schemas/VanityUrlSchema.ts @@ -4,4 +4,4 @@ export interface VanityUrlSchema { * @maxLength 20 */ code?: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/VoiceIdentifySchema.ts b/src/util/schemas/VoiceIdentifySchema.ts index d48de347..df023713 100644 --- a/src/util/schemas/VoiceIdentifySchema.ts +++ b/src/util/schemas/VoiceIdentifySchema.ts @@ -9,4 +9,4 @@ export interface VoiceIdentifySchema { rid: string; quality: number; }[]; -} \ No newline at end of file +} diff --git a/src/util/schemas/VoiceStateUpdateSchema.ts b/src/util/schemas/VoiceStateUpdateSchema.ts index 5f805f4d..79e93b07 100644 --- a/src/util/schemas/VoiceStateUpdateSchema.ts +++ b/src/util/schemas/VoiceStateUpdateSchema.ts @@ -15,8 +15,8 @@ export const VoiceStateUpdateSchema = { $channel_id: String, self_mute: Boolean, self_deaf: Boolean, - $self_video: Boolean, //required in docs but bots don't always send it + $self_video: Boolean, //required in docs but bots don't always send it $preferred_region: String, $request_to_speak_timestamp: Date, $suppress: Boolean, -}; \ No newline at end of file +}; diff --git a/src/util/schemas/VoiceVideoSchema.ts b/src/util/schemas/VoiceVideoSchema.ts index 837ee1e7..0ba519e1 100644 --- a/src/util/schemas/VoiceVideoSchema.ts +++ b/src/util/schemas/VoiceVideoSchema.ts @@ -12,6 +12,6 @@ export interface VoiceVideoSchema { rtx_ssrc: number; max_bitrate: number; max_framerate: number; - max_resolution: { type: string; width: number; height: number; }; + max_resolution: { type: string; width: number; height: number }; }[]; -} \ No newline at end of file +} diff --git a/src/util/schemas/WebhookCreateSchema.ts b/src/util/schemas/WebhookCreateSchema.ts index c32b642d..99f6a12f 100644 --- a/src/util/schemas/WebhookCreateSchema.ts +++ b/src/util/schemas/WebhookCreateSchema.ts @@ -5,4 +5,4 @@ export interface WebhookCreateSchema { */ name: string; avatar: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/WidgetModifySchema.ts b/src/util/schemas/WidgetModifySchema.ts index 3c84b3a1..26d4504f 100644 --- a/src/util/schemas/WidgetModifySchema.ts +++ b/src/util/schemas/WidgetModifySchema.ts @@ -1,4 +1,4 @@ export interface WidgetModifySchema { enabled: boolean; // whether the widget is enabled channel_id: string; // the widget channel id -} \ No newline at end of file +} diff --git a/src/util/schemas/index.ts b/src/util/schemas/index.ts index f86552f3..ae80de71 100644 --- a/src/util/schemas/index.ts +++ b/src/util/schemas/index.ts @@ -38,4 +38,4 @@ export * from "./VoiceStateUpdateSchema"; export * from "./VoiceVideoSchema"; export * from "./IdentifySchema"; export * from "./ActivitySchema"; -export * from "./LazyRequestSchema"; \ No newline at end of file +export * from "./LazyRequestSchema"; |