summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/applications/#application_id/bot/index.ts2
-rw-r--r--src/api/routes/applications/#application_id/index.ts2
-rw-r--r--src/api/routes/applications/index.ts2
-rw-r--r--src/api/routes/attachments/refresh-urls.ts2
-rw-r--r--src/api/routes/auth/forgot.ts3
-rw-r--r--src/api/routes/auth/login.ts5
-rw-r--r--src/api/routes/auth/mfa/totp.ts3
-rw-r--r--src/api/routes/auth/mfa/webauthn.ts2
-rw-r--r--src/api/routes/auth/register.ts2
-rw-r--r--src/api/routes/auth/reset.ts2
-rw-r--r--src/api/routes/auth/verify/view-backup-codes-challenge.ts3
-rw-r--r--src/api/routes/channels/#channel_id/attachments.ts5
-rw-r--r--src/api/routes/channels/#channel_id/directory-entries.ts2
-rw-r--r--src/api/routes/channels/#channel_id/greet.ts3
-rw-r--r--src/api/routes/channels/#channel_id/index.ts2
-rw-r--r--src/api/routes/channels/#channel_id/invites.ts3
-rw-r--r--src/api/routes/channels/#channel_id/messages/#message_id/index.ts5
-rw-r--r--src/api/routes/channels/#channel_id/messages/#message_id/reactions.ts4
-rw-r--r--src/api/routes/channels/#channel_id/messages/index.ts5
-rw-r--r--src/api/routes/channels/#channel_id/permissions.ts3
-rw-r--r--src/api/routes/channels/#channel_id/purge.ts2
-rw-r--r--src/api/routes/channels/#channel_id/webhooks.ts2
-rw-r--r--src/api/routes/channels/preload-messages.ts3
-rw-r--r--src/api/routes/collectibles-categories.ts2
-rw-r--r--src/api/routes/collectibles-shop.ts2
-rw-r--r--src/api/routes/connections/#connection_name/callback.ts2
-rw-r--r--src/api/routes/emojis/#emoji_id/source.ts4
-rw-r--r--src/api/routes/gifs/search.ts3
-rw-r--r--src/api/routes/gifs/trending-gifs.ts3
-rw-r--r--src/api/routes/gifs/trending.ts3
-rw-r--r--src/api/routes/guilds/#guild_id/auto-moderation/rules.ts3
-rw-r--r--src/api/routes/guilds/#guild_id/bans.ts4
-rw-r--r--src/api/routes/guilds/#guild_id/channels.ts3
-rw-r--r--src/api/routes/guilds/#guild_id/emojis.ts3
-rw-r--r--src/api/routes/guilds/#guild_id/index.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/members/#member_id/index.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/profile.ts3
-rw-r--r--src/api/routes/guilds/#guild_id/profile/index.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/roles/#role_id/index.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/roles/index.ts3
-rw-r--r--src/api/routes/guilds/#guild_id/stickers.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/vanity-url.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/voice-states/#user_id/index.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/welcome-screen.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/widget.ts3
-rw-r--r--src/api/routes/guilds/automations/email-domain-lookup.ts4
-rw-r--r--src/api/routes/guilds/index.ts2
-rw-r--r--src/api/routes/guilds/templates/index.ts3
-rw-r--r--src/api/routes/hub-waitlist.ts2
-rw-r--r--src/api/routes/oauth2/authorize.ts2
-rw-r--r--src/api/routes/read-states/ack-bulk.ts3
-rw-r--r--src/api/routes/reporting/menu/message.ts1
-rw-r--r--src/api/routes/safety-hub/@me/index.ts3
-rw-r--r--src/api/routes/safety-hub/suspended/@me.ts3
-rw-r--r--src/api/routes/teams.ts2
-rw-r--r--src/api/routes/users/#user_id/messages.ts3
-rw-r--r--src/api/routes/users/#user_id/profile.ts3
-rw-r--r--src/api/routes/users/#user_id/relationships.ts3
-rw-r--r--src/api/routes/users/@me/channels.ts8
-rw-r--r--src/api/routes/users/@me/collectibles-marketing.ts2
-rw-r--r--src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts8
-rw-r--r--src/api/routes/users/@me/guilds/#guild_id/settings.ts2
-rw-r--r--src/api/routes/users/@me/index.ts2
-rw-r--r--src/api/routes/users/@me/mfa/codes-verification.ts2
-rw-r--r--src/api/routes/users/@me/mfa/codes.ts2
-rw-r--r--src/api/routes/users/@me/mfa/totp/disable.ts2
-rw-r--r--src/api/routes/users/@me/mfa/totp/enable.ts2
-rw-r--r--src/api/routes/users/@me/mfa/webauthn/credentials/index.ts4
-rw-r--r--src/api/routes/users/@me/relationships.ts2
-rw-r--r--src/api/routes/users/@me/settings-proto/1.ts5
-rw-r--r--src/api/routes/users/@me/settings-proto/2.ts5
-rw-r--r--src/api/routes/users/@me/settings.ts5
-rw-r--r--src/api/routes/webhooks/#webhook_id/#token/github.ts3
-rw-r--r--src/api/routes/webhooks/#webhook_id/#token/index.ts2
-rw-r--r--src/api/routes/webhooks/#webhook_id/index.ts2
-rw-r--r--src/api/util/handlers/Message.ts7
-rw-r--r--src/api/util/handlers/Webhook.ts2
-rw-r--r--src/api/util/handlers/route.ts2
-rw-r--r--src/api/util/utility/EmbedHandlers.ts3
-rw-r--r--src/connections/BattleNet/index.ts2
-rw-r--r--src/connections/Discord/index.ts2
-rw-r--r--src/connections/EpicGames/index.ts2
-rw-r--r--src/connections/Facebook/index.ts2
-rw-r--r--src/connections/GitHub/index.ts2
-rw-r--r--src/connections/Reddit/index.ts2
-rw-r--r--src/connections/Spotify/index.ts2
-rw-r--r--src/connections/Twitch/index.ts2
-rw-r--r--src/connections/Twitter/index.ts2
-rw-r--r--src/connections/Xbox/index.ts2
-rw-r--r--src/connections/Youtube/index.ts2
-rw-r--r--src/gateway/events/Message.ts3
-rw-r--r--src/gateway/listener/listener.ts2
-rw-r--r--src/gateway/opcodes/GuildSubscriptionsBulk.ts2
-rw-r--r--src/gateway/opcodes/Identify.ts2
-rw-r--r--src/gateway/opcodes/LazyRequest.ts2
-rw-r--r--src/gateway/opcodes/PresenceUpdate.ts2
-rw-r--r--src/gateway/opcodes/RequestGuildMembers.ts2
-rw-r--r--src/gateway/opcodes/StreamCreate.ts2
-rw-r--r--src/gateway/opcodes/StreamDelete.ts2
-rw-r--r--src/gateway/opcodes/StreamWatch.ts2
-rw-r--r--src/gateway/opcodes/VoiceStateUpdate.ts2
-rw-r--r--src/schemas/Identifiers.ts30
-rw-r--r--src/schemas/api/developers/ApplicationCreateSchema.ts (renamed from src/schemas/ApplicationCreateSchema.ts)0
-rw-r--r--src/schemas/api/developers/ApplicationModifySchema.ts (renamed from src/schemas/ApplicationModifySchema.ts)0
-rw-r--r--src/schemas/api/developers/index.ts (renamed from src/schemas/UserSettingsSchema.ts)8
-rw-r--r--src/schemas/api/index.ts (renamed from src/schemas/GatewayBotResponse.ts)16
-rw-r--r--src/schemas/api/messages/Components.ts116
-rw-r--r--src/schemas/api/messages/Embeds.ts65
-rw-r--r--src/schemas/api/messages/Message.ts97
-rw-r--r--src/schemas/api/messages/Polls.ts48
-rw-r--r--src/schemas/api/messages/index.ts21
-rw-r--r--src/schemas/api/users/User.ts68
-rw-r--r--src/schemas/api/users/index.ts (renamed from src/schemas/GatewayResponse.ts)7
-rw-r--r--src/schemas/gateway/GatewayPayloadSchema.ts (renamed from src/schemas/GatewayPayloadSchema.ts)2
-rw-r--r--src/schemas/gateway/IdentifySchema.ts (renamed from src/schemas/IdentifySchema.ts)4
-rw-r--r--src/schemas/gateway/LazyRequestSchema.ts (renamed from src/schemas/LazyRequestSchema.ts)0
-rw-r--r--src/schemas/gateway/StreamCreateSchema.ts (renamed from src/schemas/StreamCreateSchema.ts)0
-rw-r--r--src/schemas/gateway/StreamDeleteSchema.ts (renamed from src/schemas/StreamDeleteSchema.ts)0
-rw-r--r--src/schemas/gateway/StreamWatchSchema.ts (renamed from src/schemas/StreamWatchSchema.ts)0
-rw-r--r--src/schemas/gateway/index.ts23
-rw-r--r--src/schemas/index.ts92
-rw-r--r--src/schemas/responses/DmMessagesResponseSchema.ts2
-rw-r--r--src/schemas/responses/GuildCreateResponse.ts3
-rw-r--r--src/schemas/responses/GuildMessagesSearchResponse.ts5
-rw-r--r--src/schemas/responses/MemberJoinGuildResponse.ts2
-rw-r--r--src/schemas/responses/TypedResponses.ts2
-rw-r--r--src/schemas/responses/UserRelationshipsResponse.ts3
-rw-r--r--src/schemas/responses/index.ts11
-rw-r--r--src/schemas/uncategorised/AckBulkSchema.ts (renamed from src/schemas/AckBulkSchema.ts)0
-rw-r--r--src/schemas/uncategorised/ActivitySchema.ts (renamed from src/schemas/ActivitySchema.ts)0
-rw-r--r--src/schemas/uncategorised/ApplicationAuthorizeSchema.ts (renamed from src/schemas/ApplicationAuthorizeSchema.ts)0
-rw-r--r--src/schemas/uncategorised/AutomodRuleSchema.ts (renamed from src/schemas/AutomodRuleSchema.ts)0
-rw-r--r--src/schemas/uncategorised/BackupCodesChallengeSchema.ts (renamed from src/schemas/BackupCodesChallengeSchema.ts)0
-rw-r--r--src/schemas/uncategorised/BanCreateSchema.ts (renamed from src/schemas/BanCreateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/BanModeratorSchema.ts (renamed from src/schemas/BanModeratorSchema.ts)0
-rw-r--r--src/schemas/uncategorised/BanRegistrySchema.ts (renamed from src/schemas/BanRegistrySchema.ts)0
-rw-r--r--src/schemas/uncategorised/BotModifySchema.ts (renamed from src/schemas/BotModifySchema.ts)0
-rw-r--r--src/schemas/uncategorised/BulkBanSchema.ts (renamed from src/schemas/BulkBanSchema.ts)0
-rw-r--r--src/schemas/uncategorised/BulkDeleteSchema.ts (renamed from src/schemas/BulkDeleteSchema.ts)0
-rw-r--r--src/schemas/uncategorised/ChannelModifySchema.ts (renamed from src/schemas/ChannelModifySchema.ts)0
-rw-r--r--src/schemas/uncategorised/ChannelPermissionOverwriteSchema.ts (renamed from src/schemas/ChannelPermissionOverwriteSchema.ts)0
-rw-r--r--src/schemas/uncategorised/ChannelReorderSchema.ts (renamed from src/schemas/ChannelReorderSchema.ts)0
-rw-r--r--src/schemas/uncategorised/CodesVerificationSchema.ts (renamed from src/schemas/CodesVerificationSchema.ts)0
-rw-r--r--src/schemas/uncategorised/ConnectedAccountSchema.ts (renamed from src/schemas/ConnectedAccountSchema.ts)2
-rw-r--r--src/schemas/uncategorised/ConnectionCallbackSchema.ts (renamed from src/schemas/ConnectionCallbackSchema.ts)0
-rw-r--r--src/schemas/uncategorised/ConnectionUpdateSchema.ts (renamed from src/schemas/ConnectionUpdateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/DmChannelCreateSchema.ts (renamed from src/schemas/DmChannelCreateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/EmailDomainLookupSchema.ts (renamed from src/schemas/EmailDomainLookupSchema.ts)0
-rw-r--r--src/schemas/uncategorised/EmailDomainLookupVerifyCodeSchema.ts (renamed from src/schemas/EmailDomainLookupVerifyCodeSchema.ts)0
-rw-r--r--src/schemas/uncategorised/EmojiCreateSchema.ts (renamed from src/schemas/EmojiCreateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/EmojiModifySchema.ts (renamed from src/schemas/EmojiModifySchema.ts)0
-rw-r--r--src/schemas/uncategorised/ForgotPasswordSchema.ts (renamed from src/schemas/ForgotPasswordSchema.ts)0
-rw-r--r--src/schemas/uncategorised/GreetRequestSchema.ts (renamed from src/schemas/GreetRequestSchema.ts)2
-rw-r--r--src/schemas/uncategorised/GuildCreateSchema.ts (renamed from src/schemas/GuildCreateSchema.ts)2
-rw-r--r--src/schemas/uncategorised/GuildSubscriptionsBulkSchema.ts (renamed from src/schemas/GuildSubscriptionsBulkSchema.ts)2
-rw-r--r--src/schemas/uncategorised/GuildTemplateCreateSchema.ts (renamed from src/schemas/GuildTemplateCreateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/GuildUpdateSchema.ts (renamed from src/schemas/GuildUpdateSchema.ts)2
-rw-r--r--src/schemas/uncategorised/GuildUpdateWelcomeScreenSchema.ts (renamed from src/schemas/GuildUpdateWelcomeScreenSchema.ts)0
-rw-r--r--src/schemas/uncategorised/HubWaitlistSignupSchema.ts (renamed from src/schemas/HubWaitlistSignupSchema.ts)0
-rw-r--r--src/schemas/uncategorised/InviteCreateSchema.ts (renamed from src/schemas/InviteCreateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/LoginResponse.ts (renamed from src/schemas/LoginResponse.ts)2
-rw-r--r--src/schemas/uncategorised/LoginSchema.ts (renamed from src/schemas/LoginSchema.ts)0
-rw-r--r--src/schemas/uncategorised/MemberChangeProfileSchema.ts (renamed from src/schemas/MemberChangeProfileSchema.ts)0
-rw-r--r--src/schemas/uncategorised/MemberChangeSchema.ts (renamed from src/schemas/MemberChangeSchema.ts)0
-rw-r--r--src/schemas/uncategorised/MemberNickChangeSchema.ts (renamed from src/schemas/MemberNickChangeSchema.ts)0
-rw-r--r--src/schemas/uncategorised/MessageAcknowledgeSchema.ts (renamed from src/schemas/MessageAcknowledgeSchema.ts)0
-rw-r--r--src/schemas/uncategorised/MessageCreateSchema.ts (renamed from src/schemas/MessageCreateSchema.ts)2
-rw-r--r--src/schemas/uncategorised/MessageEditSchema.ts (renamed from src/schemas/MessageEditSchema.ts)0
-rw-r--r--src/schemas/uncategorised/MfaCodesSchema.ts (renamed from src/schemas/MfaCodesSchema.ts)0
-rw-r--r--src/schemas/uncategorised/ModifyGuildStickerSchema.ts (renamed from src/schemas/ModifyGuildStickerSchema.ts)0
-rw-r--r--src/schemas/uncategorised/PasswordResetSchema.ts (renamed from src/schemas/PasswordResetSchema.ts)0
-rw-r--r--src/schemas/uncategorised/PreloadMessagesRequestSchema.ts (renamed from src/schemas/PreloadMessagesRequestSchema.ts)0
-rw-r--r--src/schemas/uncategorised/PruneSchema.ts (renamed from src/schemas/PruneSchema.ts)0
-rw-r--r--src/schemas/uncategorised/PurgeSchema.ts (renamed from src/schemas/PurgeSchema.ts)0
-rw-r--r--src/schemas/uncategorised/RefreshUrlsRequestSchema.ts (renamed from src/schemas/RefreshUrlsRequestSchema.ts)0
-rw-r--r--src/schemas/uncategorised/RegisterSchema.ts (renamed from src/schemas/RegisterSchema.ts)0
-rw-r--r--src/schemas/uncategorised/RelationshipPostSchema.ts (renamed from src/schemas/RelationshipPostSchema.ts)0
-rw-r--r--src/schemas/uncategorised/RelationshipPutSchema.ts (renamed from src/schemas/RelationshipPutSchema.ts)9
-rw-r--r--src/schemas/uncategorised/RequestGuildMembersSchema.ts (renamed from src/schemas/RequestGuildMembersSchema.ts)0
-rw-r--r--src/schemas/uncategorised/RoleModifySchema.ts (renamed from src/schemas/RoleModifySchema.ts)0
-rw-r--r--src/schemas/uncategorised/RolePositionUpdateSchema.ts (renamed from src/schemas/RolePositionUpdateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/SelectProtocolSchema.ts (renamed from src/schemas/SelectProtocolSchema.ts)0
-rw-r--r--src/schemas/uncategorised/SettingsProtoUpdateSchema.ts (renamed from src/schemas/SettingsProtoUpdateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/TeamCreateSchema.ts (renamed from src/schemas/TeamCreateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/TemplateCreateSchema.ts (renamed from src/schemas/TemplateCreateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/TemplateModifySchema.ts (renamed from src/schemas/TemplateModifySchema.ts)0
-rw-r--r--src/schemas/uncategorised/TotpDisableSchema.ts (renamed from src/schemas/TotpDisableSchema.ts)0
-rw-r--r--src/schemas/uncategorised/TotpEnableSchema.ts (renamed from src/schemas/TotpEnableSchema.ts)0
-rw-r--r--src/schemas/uncategorised/TotpSchema.ts (renamed from src/schemas/TotpSchema.ts)0
-rw-r--r--src/schemas/uncategorised/UploadAttachmentRequestSchema.ts (renamed from src/schemas/UploadAttachmentRequestSchema.ts)0
-rw-r--r--src/schemas/uncategorised/UserDeleteSchema.ts (renamed from src/schemas/UserDeleteSchema.ts)0
-rw-r--r--src/schemas/uncategorised/UserGuildSettingsSchema.ts (renamed from src/schemas/UserGuildSettingsSchema.ts)0
-rw-r--r--src/schemas/uncategorised/UserModifySchema.ts (renamed from src/schemas/UserModifySchema.ts)0
-rw-r--r--src/schemas/uncategorised/UserNoteUpdateSchema.ts (renamed from src/schemas/UserNoteUpdateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/UserProfileModifySchema.ts (renamed from src/schemas/UserProfileModifySchema.ts)0
-rw-r--r--src/schemas/uncategorised/UserSettingsSchema.ts71
-rw-r--r--src/schemas/uncategorised/VanityUrlSchema.ts (renamed from src/schemas/VanityUrlSchema.ts)0
-rw-r--r--src/schemas/uncategorised/VerifyEmailSchema.ts (renamed from src/schemas/VerifyEmailSchema.ts)0
-rw-r--r--src/schemas/uncategorised/VoiceStateUpdateSchema.ts (renamed from src/schemas/VoiceStateUpdateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/WebAuthnSchema.ts (renamed from src/schemas/WebAuthnSchema.ts)0
-rw-r--r--src/schemas/uncategorised/WebhookCreateSchema.ts (renamed from src/schemas/WebhookCreateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/WebhookExecuteSchema.ts (renamed from src/schemas/WebhookExecuteSchema.ts)2
-rwxr-xr-xsrc/schemas/uncategorised/WebhookUpdateSchema.ts (renamed from src/schemas/WebhookUpdateSchema.ts)0
-rw-r--r--src/schemas/uncategorised/WidgetModifySchema.ts (renamed from src/schemas/WidgetModifySchema.ts)0
-rw-r--r--src/schemas/uncategorised/index.ts93
-rw-r--r--src/schemas/webrtc/VoiceIdentifySchema.ts (renamed from src/schemas/VoiceIdentifySchema.ts)0
-rw-r--r--src/schemas/webrtc/VoiceVideoSchema.ts (renamed from src/schemas/VoiceVideoSchema.ts)0
-rw-r--r--src/schemas/webrtc/index.ts19
-rw-r--r--src/util/entities/EmbedCache.ts2
-rw-r--r--src/util/entities/Message.ts277
-rw-r--r--src/util/entities/Relationship.ts8
-rw-r--r--src/util/entities/UserSettings.ts19
-rw-r--r--src/util/entities/index.ts1
-rw-r--r--src/util/index.ts1
-rw-r--r--src/util/interfaces/Event.ts4
-rw-r--r--src/util/interfaces/Interaction.ts2
-rw-r--r--src/util/util/Gifs.ts2
-rw-r--r--src/webrtc/opcodes/Identify.ts6
-rw-r--r--src/webrtc/opcodes/SelectProtocol.ts2
-rw-r--r--src/webrtc/opcodes/Video.ts3
220 files changed, 851 insertions, 584 deletions
diff --git a/src/api/routes/applications/#application_id/bot/index.ts b/src/api/routes/applications/#application_id/bot/index.ts

index 0928af37..db1d0253 100644 --- a/src/api/routes/applications/#application_id/bot/index.ts +++ b/src/api/routes/applications/#application_id/bot/index.ts
@@ -19,7 +19,6 @@ import { route } from "@spacebar/api"; import { Application, - BotModifySchema, DiscordApiErrors, User, createAppBotUser, @@ -29,6 +28,7 @@ import { import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { verifyToken } from "node-2fa"; +import { BotModifySchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/applications/#application_id/index.ts b/src/api/routes/applications/#application_id/index.ts
index d6ba26fe..6701f867 100644 --- a/src/api/routes/applications/#application_id/index.ts +++ b/src/api/routes/applications/#application_id/index.ts
@@ -19,7 +19,6 @@ import { route } from "@spacebar/api"; import { Application, - ApplicationModifySchema, DiscordApiErrors, Guild, handleFile, @@ -27,6 +26,7 @@ import { import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { verifyToken } from "node-2fa"; +import { ApplicationModifySchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/applications/index.ts b/src/api/routes/applications/index.ts
index 54a01aa9..77f02fc1 100644 --- a/src/api/routes/applications/index.ts +++ b/src/api/routes/applications/index.ts
@@ -19,13 +19,13 @@ import { route } from "@spacebar/api"; import { Application, - ApplicationCreateSchema, Config, User, createAppBotUser, trimSpecial, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { ApplicationCreateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/attachments/refresh-urls.ts b/src/api/routes/attachments/refresh-urls.ts
index b04c12cc..76954c77 100644 --- a/src/api/routes/attachments/refresh-urls.ts +++ b/src/api/routes/attachments/refresh-urls.ts
@@ -18,11 +18,11 @@ import { route } from "@spacebar/api"; import { - RefreshUrlsRequestSchema, getUrlSignature, NewUrlSignatureData, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { RefreshUrlsRequestSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.post( diff --git a/src/api/routes/auth/forgot.ts b/src/api/routes/auth/forgot.ts
index 5b4a83cf..12bc9cb0 100644 --- a/src/api/routes/auth/forgot.ts +++ b/src/api/routes/auth/forgot.ts
@@ -17,8 +17,9 @@ */ import { getIpAdress, route, verifyCaptcha } from "@spacebar/api"; -import { Config, Email, ForgotPasswordSchema, User } from "@spacebar/util"; +import { Config, Email, User } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { ForgotPasswordSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.post( diff --git a/src/api/routes/auth/login.ts b/src/api/routes/auth/login.ts
index e76bb658..06e3fe43 100644 --- a/src/api/routes/auth/login.ts +++ b/src/api/routes/auth/login.ts
@@ -20,7 +20,6 @@ import { getIpAdress, route, verifyCaptcha } from "@spacebar/api"; import { Config, FieldErrors, - LoginSchema, User, WebAuthn, generateToken, @@ -29,6 +28,7 @@ import { import bcrypt from "bcrypt"; import crypto from "crypto"; import { Request, Response, Router } from "express"; +import { LoginSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); export default router; @@ -47,8 +47,7 @@ router.post( }, }), async (req: Request, res: Response) => { - const { login, password, captcha_key, undelete } = - req.body as LoginSchema; + const { login, password, captcha_key, undelete } = req.body as LoginSchema; const config = Config.get(); diff --git a/src/api/routes/auth/mfa/totp.ts b/src/api/routes/auth/mfa/totp.ts
index 225fd62e..cc6e8a25 100644 --- a/src/api/routes/auth/mfa/totp.ts +++ b/src/api/routes/auth/mfa/totp.ts
@@ -17,10 +17,11 @@ */ import { route } from "@spacebar/api"; -import { BackupCode, TotpSchema, User, generateToken } from "@spacebar/util"; +import { BackupCode, User, generateToken } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { verifyToken } from "node-2fa"; +import { TotpSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.post( diff --git a/src/api/routes/auth/mfa/webauthn.ts b/src/api/routes/auth/mfa/webauthn.ts
index d904373d..80ff57f0 100644 --- a/src/api/routes/auth/mfa/webauthn.ts +++ b/src/api/routes/auth/mfa/webauthn.ts
@@ -23,11 +23,11 @@ import { User, verifyWebAuthnToken, WebAuthn, - WebAuthnTotpSchema, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { ExpectedAssertionResult } from "fido2-lib"; import { HTTPError } from "lambert-server"; +import { WebAuthnTotpSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); function toArrayBuffer(buf: Buffer) { diff --git a/src/api/routes/auth/register.ts b/src/api/routes/auth/register.ts
index 2a048866..2db60abd 100644 --- a/src/api/routes/auth/register.ts +++ b/src/api/routes/auth/register.ts
@@ -27,7 +27,6 @@ import { Config, FieldErrors, Invite, - RegisterSchema, User, ValidRegistrationToken, generateToken, @@ -36,6 +35,7 @@ import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { MoreThan } from "typeorm"; +import { RegisterSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/auth/reset.ts b/src/api/routes/auth/reset.ts
index 90df676a..b14eb379 100644 --- a/src/api/routes/auth/reset.ts +++ b/src/api/routes/auth/reset.ts
@@ -22,11 +22,11 @@ import { Email, FieldErrors, generateToken, - PasswordResetSchema, User, } from "@spacebar/util"; import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; +import { PasswordResetSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/auth/verify/view-backup-codes-challenge.ts b/src/api/routes/auth/verify/view-backup-codes-challenge.ts
index 1889aaaf..811de508 100644 --- a/src/api/routes/auth/verify/view-backup-codes-challenge.ts +++ b/src/api/routes/auth/verify/view-backup-codes-challenge.ts
@@ -17,9 +17,10 @@ */ import { route } from "@spacebar/api"; -import { BackupCodesChallengeSchema, FieldErrors, User } from "@spacebar/util"; +import { FieldErrors, User } from "@spacebar/util"; import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; +import { BackupCodesChallengeSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.post( diff --git a/src/api/routes/channels/#channel_id/attachments.ts b/src/api/routes/channels/#channel_id/attachments.ts
index df9af9af..2c08931e 100644 --- a/src/api/routes/channels/#channel_id/attachments.ts +++ b/src/api/routes/channels/#channel_id/attachments.ts
@@ -21,13 +21,12 @@ import { Channel, Config, Permissions, - UploadAttachmentRequestSchema, - UploadAttachmentResponseSchema, User, } from "@spacebar/util"; import { Request, Response, Router } from "express"; -import { CloudAttachment } from "../../../../util/entities/CloudAttachment"; +import { CloudAttachment } from "@spacebar/util"; import fetch from "node-fetch-commonjs"; +import { UploadAttachmentRequestSchema, UploadAttachmentResponseSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/channels/#channel_id/directory-entries.ts b/src/api/routes/channels/#channel_id/directory-entries.ts
index ef01fb40..c07b1f75 100644 --- a/src/api/routes/channels/#channel_id/directory-entries.ts +++ b/src/api/routes/channels/#channel_id/directory-entries.ts
@@ -17,7 +17,7 @@ */ import { route } from "@spacebar/api"; -import { HubDirectoryEntriesResponse } from "@spacebar/util"; +import { HubDirectoryEntriesResponse } from "@spacebar/schemas"; import { Request, Response, Router } from "express"; const router = Router({ mergeParams: true }); diff --git a/src/api/routes/channels/#channel_id/greet.ts b/src/api/routes/channels/#channel_id/greet.ts
index 2052dd43..399e30a2 100644 --- a/src/api/routes/channels/#channel_id/greet.ts +++ b/src/api/routes/channels/#channel_id/greet.ts
@@ -17,9 +17,10 @@ */ import { route } from "@spacebar/api"; -import { Channel, emitEvent, GreetRequestSchema, Message, MessageCreateEvent, MessageType, Permissions, Sticker } from "@spacebar/util"; +import { Channel, emitEvent, Message, MessageCreateEvent, Permissions, Sticker } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { In } from "typeorm"; +import { GreetRequestSchema, MessageType } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/channels/#channel_id/index.ts b/src/api/routes/channels/#channel_id/index.ts
index 9efbfe89..cc43790a 100644 --- a/src/api/routes/channels/#channel_id/index.ts +++ b/src/api/routes/channels/#channel_id/index.ts
@@ -20,7 +20,6 @@ import { route } from "@spacebar/api"; import { Channel, ChannelDeleteEvent, - ChannelModifySchema, ChannelType, ChannelUpdateEvent, Recipient, @@ -28,6 +27,7 @@ import { handleFile, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { ChannelModifySchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); // TODO: delete channel diff --git a/src/api/routes/channels/#channel_id/invites.ts b/src/api/routes/channels/#channel_id/invites.ts
index 086c1eb3..b6ce0721 100644 --- a/src/api/routes/channels/#channel_id/invites.ts +++ b/src/api/routes/channels/#channel_id/invites.ts
@@ -17,9 +17,10 @@ */ import { randomString, route } from "@spacebar/api"; -import { Channel, Guild, Invite, InviteCreateEvent, InviteCreateSchema, PublicInviteRelation, User, emitEvent, isTextChannel } from "@spacebar/util"; +import { Channel, Guild, Invite, InviteCreateEvent, PublicInviteRelation, User, emitEvent, isTextChannel } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { InviteCreateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/index.ts b/src/api/routes/channels/#channel_id/messages/#message_id/index.ts
index 2439894d..bf35dc3d 100644 --- a/src/api/routes/channels/#channel_id/messages/#message_id/index.ts +++ b/src/api/routes/channels/#channel_id/messages/#message_id/index.ts
@@ -21,9 +21,7 @@ import { Channel, Message, MessageCreateEvent, - MessageCreateSchema, MessageDeleteEvent, - MessageEditSchema, MessageUpdateEvent, Snowflake, SpacebarApiErrors, @@ -32,13 +30,12 @@ import { getRights, uploadFile, NewUrlUserSignatureData, - MessageCreateAttachment, - MessageCreateCloudAttachment, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import multer from "multer"; import { handleMessage, postHandleMessage, route } from "../../../../../util"; +import { MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageEditSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); // TODO: message content/embed string length limit diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/reactions.ts b/src/api/routes/channels/#channel_id/messages/#message_id/reactions.ts
index f99d2145..97e7e6b0 100644 --- a/src/api/routes/channels/#channel_id/messages/#message_id/reactions.ts +++ b/src/api/routes/channels/#channel_id/messages/#message_id/reactions.ts
@@ -28,7 +28,6 @@ import { MessageReactionRemoveAllEvent, MessageReactionRemoveEmojiEvent, MessageReactionRemoveEvent, - PartialEmoji, PublicMemberProjection, PublicUserProjection, User, @@ -36,9 +35,10 @@ import { import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { In } from "typeorm"; +import { PartialEmoji } from "@spacebar/schemas" const router = Router({ mergeParams: true }); -// TODO: check if emoji is really an unicode emoji or a prperly encoded external emoji +// TODO: check if emoji is really an unicode emoji or a properly encoded external emoji function getEmoji(emoji: string): PartialEmoji { emoji = decodeURIComponent(emoji); diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts
index 6e240864..03d7ca54 100644 --- a/src/api/routes/channels/#channel_id/messages/index.ts +++ b/src/api/routes/channels/#channel_id/messages/index.ts
@@ -26,8 +26,6 @@ import { Member, Message, MessageCreateEvent, - MessageCreateSchema, - Reaction, ReadState, Rights, Snowflake, @@ -39,14 +37,13 @@ import { uploadFile, NewUrlSignatureData, NewUrlUserSignatureData, - MessageCreateCloudAttachment, - MessageCreateAttachment, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import multer from "multer"; import { FindManyOptions, FindOperator, LessThan, MoreThan, MoreThanOrEqual } from "typeorm"; import { URL } from "url"; +import { MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, Reaction } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/channels/#channel_id/permissions.ts b/src/api/routes/channels/#channel_id/permissions.ts
index 3fcde5ec..62b265e3 100644 --- a/src/api/routes/channels/#channel_id/permissions.ts +++ b/src/api/routes/channels/#channel_id/permissions.ts
@@ -16,11 +16,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Channel, ChannelPermissionOverwrite, ChannelPermissionOverwriteSchema, ChannelPermissionOverwriteType, ChannelUpdateEvent, emitEvent, Member, Role } from "@spacebar/util"; +import { Channel, ChannelPermissionOverwrite, ChannelPermissionOverwriteType, ChannelUpdateEvent, emitEvent, Member, Role } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { route } from "@spacebar/api"; +import { ChannelPermissionOverwriteSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); // TODO: Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel) diff --git a/src/api/routes/channels/#channel_id/purge.ts b/src/api/routes/channels/#channel_id/purge.ts
index 01f73b4d..c48a46ad 100644 --- a/src/api/routes/channels/#channel_id/purge.ts +++ b/src/api/routes/channels/#channel_id/purge.ts
@@ -21,7 +21,6 @@ import { Channel, Message, MessageDeleteBulkEvent, - PurgeSchema, emitEvent, getPermission, getRights, @@ -30,6 +29,7 @@ import { import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { Between, FindManyOptions, FindOperator, Not } from "typeorm"; +import { PurgeSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/channels/#channel_id/webhooks.ts b/src/api/routes/channels/#channel_id/webhooks.ts
index a2b43c05..2d0de323 100644 --- a/src/api/routes/channels/#channel_id/webhooks.ts +++ b/src/api/routes/channels/#channel_id/webhooks.ts
@@ -23,7 +23,6 @@ import { DiscordApiErrors, User, Webhook, - WebhookCreateSchema, WebhookType, handleFile, isTextChannel, @@ -33,6 +32,7 @@ import { import crypto from "crypto"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { WebhookCreateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/channels/preload-messages.ts b/src/api/routes/channels/preload-messages.ts
index 8ea23adf..47795703 100644 --- a/src/api/routes/channels/preload-messages.ts +++ b/src/api/routes/channels/preload-messages.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { Config, PreloadMessagesRequestSchema, Message, PreloadMessagesResponseSchema } from "@spacebar/util"; +import { Config, Message } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { PreloadMessagesRequestSchema, PreloadMessagesResponseSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.post( diff --git a/src/api/routes/collectibles-categories.ts b/src/api/routes/collectibles-categories.ts
index d662edbd..d2cac396 100644 --- a/src/api/routes/collectibles-categories.ts +++ b/src/api/routes/collectibles-categories.ts
@@ -18,7 +18,7 @@ import { route } from "@spacebar/api"; import { Request, Response, Router } from "express"; -import { CollectiblesCategoriesResponse } from "@spacebar/util"; +import { CollectiblesCategoriesResponse } from "@spacebar/schemas"; const router = Router({ mergeParams: true }); diff --git a/src/api/routes/collectibles-shop.ts b/src/api/routes/collectibles-shop.ts
index 066a1e17..b4c82f57 100644 --- a/src/api/routes/collectibles-shop.ts +++ b/src/api/routes/collectibles-shop.ts
@@ -18,7 +18,7 @@ import { route } from "@spacebar/api"; import { Request, Response, Router } from "express"; -import { CollectiblesShopResponse } from "@spacebar/util"; +import { CollectiblesShopResponse } from "@spacebar/schemas"; const router = Router({ mergeParams: true }); diff --git a/src/api/routes/connections/#connection_name/callback.ts b/src/api/routes/connections/#connection_name/callback.ts
index 40e0d01c..0852acd4 100644 --- a/src/api/routes/connections/#connection_name/callback.ts +++ b/src/api/routes/connections/#connection_name/callback.ts
@@ -18,12 +18,12 @@ import { route } from "@spacebar/api"; import { - ConnectionCallbackSchema, ConnectionStore, emitEvent, FieldErrors, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/emojis/#emoji_id/source.ts b/src/api/routes/emojis/#emoji_id/source.ts
index 28bfd3d3..61133f02 100644 --- a/src/api/routes/emojis/#emoji_id/source.ts +++ b/src/api/routes/emojis/#emoji_id/source.ts
@@ -19,14 +19,12 @@ import { route } from "@spacebar/api"; import { Emoji, - APIErrorResponse, DiscordApiErrors, - EmojiSourceResponse, Guild, Member, - EmojiGuild, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { APIErrorResponse, EmojiGuild, EmojiSourceResponse } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/gifs/search.ts b/src/api/routes/gifs/search.ts
index 6c338ccf..378e3981 100644 --- a/src/api/routes/gifs/search.ts +++ b/src/api/routes/gifs/search.ts
@@ -18,15 +18,14 @@ import { route } from "@spacebar/api"; import { - TenorMediaTypes, getGifApiKey, parseGifResult, - TenorGif, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import fetch from "node-fetch-commonjs"; import { ProxyAgent } from "proxy-agent"; import http from "http"; +import { TenorGif, TenorMediaTypes } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/gifs/trending-gifs.ts b/src/api/routes/gifs/trending-gifs.ts
index d0fdc7a1..48c2a3bf 100644 --- a/src/api/routes/gifs/trending-gifs.ts +++ b/src/api/routes/gifs/trending-gifs.ts
@@ -18,15 +18,14 @@ import { route } from "@spacebar/api"; import { - TenorMediaTypes, getGifApiKey, parseGifResult, - TenorGif, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import fetch from "node-fetch-commonjs"; import { ProxyAgent } from "proxy-agent"; import http from "http"; +import { TenorGif, TenorMediaTypes } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/gifs/trending.ts b/src/api/routes/gifs/trending.ts
index d858122a..bcbd450d 100644 --- a/src/api/routes/gifs/trending.ts +++ b/src/api/routes/gifs/trending.ts
@@ -18,8 +18,6 @@ import { route } from "@spacebar/api"; import { - TenorCategoriesResults, - TenorTrendingResults, getGifApiKey, parseGifResult, } from "@spacebar/util"; @@ -27,6 +25,7 @@ import { Request, Response, Router } from "express"; import fetch from "node-fetch-commonjs"; import { ProxyAgent } from "proxy-agent"; import http from "http"; +import { TenorCategoriesResults, TenorTrendingResults } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/auto-moderation/rules.ts b/src/api/routes/guilds/#guild_id/auto-moderation/rules.ts
index 15325534..e2a84f66 100644 --- a/src/api/routes/guilds/#guild_id/auto-moderation/rules.ts +++ b/src/api/routes/guilds/#guild_id/auto-moderation/rules.ts
@@ -17,9 +17,10 @@ */ import { route } from "@spacebar/api"; -import { User, AutomodRuleSchema, AutomodRule } from "@spacebar/util"; +import { User, AutomodRule } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { AutomodRuleSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/bans.ts b/src/api/routes/guilds/#guild_id/bans.ts
index ffae8077..69fa9476 100644 --- a/src/api/routes/guilds/#guild_id/bans.ts +++ b/src/api/routes/guilds/#guild_id/bans.ts
@@ -18,19 +18,17 @@ import { getIpAdress, route } from "@spacebar/api"; import { - APIBansArray, Ban, - BanRegistrySchema, DiscordApiErrors, GuildBanAddEvent, GuildBanRemoveEvent, - GuildBansResponse, Member, User, emitEvent, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { APIBansArray, BanRegistrySchema, GuildBansResponse } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/channels.ts b/src/api/routes/guilds/#guild_id/channels.ts
index fe383ec5..af4e029f 100644 --- a/src/api/routes/guilds/#guild_id/channels.ts +++ b/src/api/routes/guilds/#guild_id/channels.ts
@@ -19,13 +19,12 @@ import { route } from "@spacebar/api"; import { Channel, - ChannelModifySchema, - ChannelReorderSchema, ChannelUpdateEvent, Guild, emitEvent, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { ChannelModifySchema, ChannelReorderSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.get( diff --git a/src/api/routes/guilds/#guild_id/emojis.ts b/src/api/routes/guilds/#guild_id/emojis.ts
index 19109dc5..b770e5b6 100644 --- a/src/api/routes/guilds/#guild_id/emojis.ts +++ b/src/api/routes/guilds/#guild_id/emojis.ts
@@ -21,8 +21,6 @@ import { Config, DiscordApiErrors, Emoji, - EmojiCreateSchema, - EmojiModifySchema, GuildEmojisUpdateEvent, Member, Snowflake, @@ -31,6 +29,7 @@ import { handleFile, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { EmojiCreateSchema, EmojiModifySchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/index.ts b/src/api/routes/guilds/#guild_id/index.ts
index 2f138d7b..768e9ce6 100644 --- a/src/api/routes/guilds/#guild_id/index.ts +++ b/src/api/routes/guilds/#guild_id/index.ts
@@ -22,7 +22,6 @@ import { DiscordApiErrors, Guild, GuildUpdateEvent, - GuildUpdateSchema, Member, Permissions, SpacebarApiErrors, @@ -33,6 +32,7 @@ import { } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { GuildUpdateSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/members/#member_id/index.ts b/src/api/routes/guilds/#guild_id/members/#member_id/index.ts
index deaacd8c..feb3bade 100644 --- a/src/api/routes/guilds/#guild_id/members/#member_id/index.ts +++ b/src/api/routes/guilds/#guild_id/members/#member_id/index.ts
@@ -27,13 +27,13 @@ import { GuildMemberUpdateEvent, handleFile, Member, - MemberChangeSchema, PublicMemberProjection, PublicUserProjection, Role, Sticker, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { MemberChangeSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/profile.ts b/src/api/routes/guilds/#guild_id/profile.ts
index a079b507..1dbb97c4 100644 --- a/src/api/routes/guilds/#guild_id/profile.ts +++ b/src/api/routes/guilds/#guild_id/profile.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { Guild, GuildProfileResponse, GuildVisibilityLevel } from "@spacebar/util"; +import { Guild } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { GuildProfileResponse, GuildVisibilityLevel } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/profile/index.ts b/src/api/routes/guilds/#guild_id/profile/index.ts
index befb1b14..66e223d8 100644 --- a/src/api/routes/guilds/#guild_id/profile/index.ts +++ b/src/api/routes/guilds/#guild_id/profile/index.ts
@@ -22,10 +22,10 @@ import { GuildMemberUpdateEvent, handleFile, Member, - MemberChangeProfileSchema, OrmUtils, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { MemberChangeProfileSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/roles/#role_id/index.ts b/src/api/routes/guilds/#guild_id/roles/#role_id/index.ts
index 3e75f677..4ee63225 100644 --- a/src/api/routes/guilds/#guild_id/roles/#role_id/index.ts +++ b/src/api/routes/guilds/#guild_id/roles/#role_id/index.ts
@@ -24,10 +24,10 @@ import { handleFile, Member, Role, - RoleModifySchema, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { RoleModifySchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/roles/index.ts b/src/api/routes/guilds/#guild_id/roles/index.ts
index d2267700..8f671b15 100644 --- a/src/api/routes/guilds/#guild_id/roles/index.ts +++ b/src/api/routes/guilds/#guild_id/roles/index.ts
@@ -25,12 +25,11 @@ import { GuildRoleUpdateEvent, Member, Role, - RoleModifySchema, - RolePositionUpdateSchema, Snowflake, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { Not } from "typeorm"; +import { RoleModifySchema, RolePositionUpdateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/stickers.ts b/src/api/routes/guilds/#guild_id/stickers.ts
index 07fbfd58..beccc7e8 100644 --- a/src/api/routes/guilds/#guild_id/stickers.ts +++ b/src/api/routes/guilds/#guild_id/stickers.ts
@@ -20,7 +20,6 @@ import { route } from "@spacebar/api"; import { GuildStickersUpdateEvent, Member, - ModifyGuildStickerSchema, Snowflake, Sticker, StickerFormatType, @@ -33,6 +32,7 @@ import { import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import multer from "multer"; +import { ModifyGuildStickerSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.get( diff --git a/src/api/routes/guilds/#guild_id/vanity-url.ts b/src/api/routes/guilds/#guild_id/vanity-url.ts
index 2d63e6df..5261f679 100644 --- a/src/api/routes/guilds/#guild_id/vanity-url.ts +++ b/src/api/routes/guilds/#guild_id/vanity-url.ts
@@ -22,10 +22,10 @@ import { ChannelType, Guild, Invite, - VanityUrlSchema, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { VanityUrlSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/voice-states/#user_id/index.ts b/src/api/routes/guilds/#guild_id/voice-states/#user_id/index.ts
index 1944033a..6966f705 100644 --- a/src/api/routes/guilds/#guild_id/voice-states/#user_id/index.ts +++ b/src/api/routes/guilds/#guild_id/voice-states/#user_id/index.ts
@@ -25,9 +25,9 @@ import { getPermission, VoiceState, VoiceStateUpdateEvent, - VoiceStateUpdateSchema, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { VoiceStateUpdateSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); //TODO need more testing when community guild and voice stage channel are working diff --git a/src/api/routes/guilds/#guild_id/welcome-screen.ts b/src/api/routes/guilds/#guild_id/welcome-screen.ts
index fa28bda2..03907f60 100644 --- a/src/api/routes/guilds/#guild_id/welcome-screen.ts +++ b/src/api/routes/guilds/#guild_id/welcome-screen.ts
@@ -20,10 +20,10 @@ import { route } from "@spacebar/api"; import { Channel, Guild, - GuildUpdateWelcomeScreenSchema, Member, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { GuildUpdateWelcomeScreenSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/widget.ts b/src/api/routes/guilds/#guild_id/widget.ts
index 6773c366..7ea8dce0 100644 --- a/src/api/routes/guilds/#guild_id/widget.ts +++ b/src/api/routes/guilds/#guild_id/widget.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { Guild, WidgetModifySchema } from "@spacebar/util"; +import { Guild } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { WidgetModifySchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/automations/email-domain-lookup.ts b/src/api/routes/guilds/automations/email-domain-lookup.ts
index 889f85c2..b6d3338b 100644 --- a/src/api/routes/guilds/automations/email-domain-lookup.ts +++ b/src/api/routes/guilds/automations/email-domain-lookup.ts
@@ -18,14 +18,12 @@ import { route } from "@spacebar/api"; import { - EmailDomainLookupResponse, - EmailDomainLookupSchema, - EmailDomainLookupVerifyCodeSchema, FieldErrors, } from "@spacebar/util"; import emailProviders from "email-providers/all.json"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { EmailDomainLookupResponse, EmailDomainLookupSchema, EmailDomainLookupVerifyCodeSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/index.ts b/src/api/routes/guilds/index.ts
index c6965c30..0794eaa8 100644 --- a/src/api/routes/guilds/index.ts +++ b/src/api/routes/guilds/index.ts
@@ -21,11 +21,11 @@ import { Config, DiscordApiErrors, Guild, - GuildCreateSchema, Member, getRights, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { GuildCreateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/templates/index.ts b/src/api/routes/guilds/templates/index.ts
index 002347d3..7937e983 100644 --- a/src/api/routes/guilds/templates/index.ts +++ b/src/api/routes/guilds/templates/index.ts
@@ -17,10 +17,11 @@ */ import { route } from "@spacebar/api"; -import { Config, DiscordApiErrors, Guild, GuildTemplateCreateSchema, Member, Template } from "@spacebar/util"; +import { Config, DiscordApiErrors, Guild, Member, Template } from "@spacebar/util"; import { Request, Response, Router } from "express"; import fetch from "node-fetch-commonjs"; import { HTTPError } from "lambert-server"; +import { GuildTemplateCreateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/hub-waitlist.ts b/src/api/routes/hub-waitlist.ts
index 8a36e297..2d21ad63 100644 --- a/src/api/routes/hub-waitlist.ts +++ b/src/api/routes/hub-waitlist.ts
@@ -20,7 +20,7 @@ import { route } from "@spacebar/api"; import { HubWaitlistSignupResponse, HubWaitlistSignupSchema, -} from "@spacebar/util"; +} from "@spacebar/schemas"; import { Request, Response, Router } from "express"; const router = Router({ mergeParams: true }); diff --git a/src/api/routes/oauth2/authorize.ts b/src/api/routes/oauth2/authorize.ts
index 515d77be..54891a51 100644 --- a/src/api/routes/oauth2/authorize.ts +++ b/src/api/routes/oauth2/authorize.ts
@@ -20,7 +20,6 @@ import { route } from "@spacebar/api"; import { ApiError, Application, - ApplicationAuthorizeSchema, DiscordApiErrors, FieldErrors, Member, @@ -29,6 +28,7 @@ import { getPermission, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { ApplicationAuthorizeSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); // TODO: scopes, other oauth types diff --git a/src/api/routes/read-states/ack-bulk.ts b/src/api/routes/read-states/ack-bulk.ts
index 566cb4e4..475b223a 100644 --- a/src/api/routes/read-states/ack-bulk.ts +++ b/src/api/routes/read-states/ack-bulk.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { AckBulkSchema, ReadState } from "@spacebar/util"; +import { ReadState } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { AckBulkSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.post( diff --git a/src/api/routes/reporting/menu/message.ts b/src/api/routes/reporting/menu/message.ts
index 69dea24a..c72bc840 100644 --- a/src/api/routes/reporting/menu/message.ts +++ b/src/api/routes/reporting/menu/message.ts
@@ -18,7 +18,6 @@ import { route } from "@spacebar/api"; import { Request, Response, Router } from "express"; -import { CollectiblesCategoriesResponse } from "@spacebar/util"; const router = Router({ mergeParams: true }); diff --git a/src/api/routes/safety-hub/@me/index.ts b/src/api/routes/safety-hub/@me/index.ts
index 4bd14eb4..ea361eee 100644 --- a/src/api/routes/safety-hub/@me/index.ts +++ b/src/api/routes/safety-hub/@me/index.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { AccountStandingResponse, AccountStandingState, AppealEligibility, User } from "@spacebar/util"; +import { User } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { AccountStandingResponse, AccountStandingState, AppealEligibility } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/safety-hub/suspended/@me.ts b/src/api/routes/safety-hub/suspended/@me.ts
index 4bd14eb4..ea361eee 100644 --- a/src/api/routes/safety-hub/suspended/@me.ts +++ b/src/api/routes/safety-hub/suspended/@me.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { AccountStandingResponse, AccountStandingState, AppealEligibility, User } from "@spacebar/util"; +import { User } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { AccountStandingResponse, AccountStandingState, AppealEligibility } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/teams.ts b/src/api/routes/teams.ts
index 142248b6..a936fe81 100644 --- a/src/api/routes/teams.ts +++ b/src/api/routes/teams.ts
@@ -20,13 +20,13 @@ import { Request, Response, Router } from "express"; import { route } from "@spacebar/api"; import { Team, - TeamCreateSchema, TeamMember, TeamMemberRole, TeamMemberState, User, } from "@spacebar/util"; import { HTTPError } from "lambert-server"; +import { TeamCreateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/#user_id/messages.ts b/src/api/routes/users/#user_id/messages.ts
index 04708cfd..9ce0b369 100644 --- a/src/api/routes/users/#user_id/messages.ts +++ b/src/api/routes/users/#user_id/messages.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { Config, DmMessagesResponseSchema, Message, User } from "@spacebar/util"; +import { Config, Message, User } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { DmMessagesResponseSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.get( diff --git a/src/api/routes/users/#user_id/profile.ts b/src/api/routes/users/#user_id/profile.ts
index 30b4fb01..95940004 100644 --- a/src/api/routes/users/#user_id/profile.ts +++ b/src/api/routes/users/#user_id/profile.ts
@@ -28,13 +28,12 @@ import { PublicUser, PublicUserProjection, Relationship, - RelationshipType, User, - UserProfileModifySchema, UserUpdateEvent, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { In } from "typeorm"; +import { RelationshipType, UserProfileModifySchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/#user_id/relationships.ts b/src/api/routes/users/#user_id/relationships.ts
index e4af351f..c86b11aa 100644 --- a/src/api/routes/users/#user_id/relationships.ts +++ b/src/api/routes/users/#user_id/relationships.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { User, UserRelationsResponse } from "@spacebar/util"; +import { User } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { UserRelationsResponse } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/channels.ts b/src/api/routes/users/@me/channels.ts
index 5ee36da1..fa9ffe70 100644 --- a/src/api/routes/users/@me/channels.ts +++ b/src/api/routes/users/@me/channels.ts
@@ -17,13 +17,9 @@ */ import { route } from "@spacebar/api"; -import { - Channel, - DmChannelCreateSchema, - DmChannelDTO, - Recipient, -} from "@spacebar/util"; +import { Channel, DmChannelDTO, Recipient } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { DmChannelCreateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/collectibles-marketing.ts b/src/api/routes/users/@me/collectibles-marketing.ts
index 131f4370..c9f1a1d1 100644 --- a/src/api/routes/users/@me/collectibles-marketing.ts +++ b/src/api/routes/users/@me/collectibles-marketing.ts
@@ -18,7 +18,7 @@ import { route } from "@spacebar/api"; import { Request, Response, Router } from "express"; -import { CollectiblesMarketingResponse } from "@spacebar/util"; +import { CollectiblesMarketingResponse } from "@spacebar/schemas"; const router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts b/src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts
index f499d24d..f4b6ab14 100644 --- a/src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts +++ b/src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts
@@ -17,13 +17,9 @@ */ import { route } from "@spacebar/api"; -import { - ConnectedAccount, - ConnectionUpdateSchema, - DiscordApiErrors, - emitEvent, -} from "@spacebar/util"; +import { ConnectedAccount, DiscordApiErrors, emitEvent } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { ConnectionUpdateSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); // TODO: connection update schema diff --git a/src/api/routes/users/@me/guilds/#guild_id/settings.ts b/src/api/routes/users/@me/guilds/#guild_id/settings.ts
index 9d78773d..593006f6 100644 --- a/src/api/routes/users/@me/guilds/#guild_id/settings.ts +++ b/src/api/routes/users/@me/guilds/#guild_id/settings.ts
@@ -21,9 +21,9 @@ import { Channel, Member, OrmUtils, - UserGuildSettingsSchema, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { UserGuildSettingsSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/index.ts b/src/api/routes/users/@me/index.ts
index d05e1812..4d4c64b9 100644 --- a/src/api/routes/users/@me/index.ts +++ b/src/api/routes/users/@me/index.ts
@@ -25,11 +25,11 @@ import { handleFile, PrivateUserProjection, User, - UserModifySchema, UserUpdateEvent, } from "@spacebar/util"; import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; +import { UserModifySchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/mfa/codes-verification.ts b/src/api/routes/users/@me/mfa/codes-verification.ts
index 953648fb..6dba4bb0 100644 --- a/src/api/routes/users/@me/mfa/codes-verification.ts +++ b/src/api/routes/users/@me/mfa/codes-verification.ts
@@ -19,12 +19,12 @@ import { route } from "@spacebar/api"; import { BackupCode, - CodesVerificationSchema, DiscordApiErrors, User, generateMfaBackupCodes, } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { CodesVerificationSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/mfa/codes.ts b/src/api/routes/users/@me/mfa/codes.ts
index 48f3d268..389dc01d 100644 --- a/src/api/routes/users/@me/mfa/codes.ts +++ b/src/api/routes/users/@me/mfa/codes.ts
@@ -21,11 +21,11 @@ import { BackupCode, FieldErrors, generateMfaBackupCodes, - MfaCodesSchema, User, } from "@spacebar/util"; import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; +import { MfaCodesSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/mfa/totp/disable.ts b/src/api/routes/users/@me/mfa/totp/disable.ts
index 8ec65736..b266fcfe 100644 --- a/src/api/routes/users/@me/mfa/totp/disable.ts +++ b/src/api/routes/users/@me/mfa/totp/disable.ts
@@ -19,13 +19,13 @@ import { route } from "@spacebar/api"; import { BackupCode, - TotpDisableSchema, User, generateToken, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { verifyToken } from "node-2fa"; +import { TotpDisableSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/mfa/totp/enable.ts b/src/api/routes/users/@me/mfa/totp/enable.ts
index 774c7487..3d6f4a80 100644 --- a/src/api/routes/users/@me/mfa/totp/enable.ts +++ b/src/api/routes/users/@me/mfa/totp/enable.ts
@@ -18,7 +18,6 @@ import { route } from "@spacebar/api"; import { - TotpEnableSchema, User, generateMfaBackupCodes, generateToken, @@ -27,6 +26,7 @@ import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { verifyToken } from "node-2fa"; +import { TotpEnableSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/mfa/webauthn/credentials/index.ts b/src/api/routes/users/@me/mfa/webauthn/credentials/index.ts
index 78c7470d..1225cd34 100644 --- a/src/api/routes/users/@me/mfa/webauthn/credentials/index.ts +++ b/src/api/routes/users/@me/mfa/webauthn/credentials/index.ts
@@ -18,21 +18,19 @@ import { route } from "@spacebar/api"; import { - CreateWebAuthnCredentialSchema, DiscordApiErrors, FieldErrors, - GenerateWebAuthnCredentialsSchema, generateWebAuthnTicket, SecurityKey, User, verifyWebAuthnToken, WebAuthn, - WebAuthnPostSchema, } from "@spacebar/util"; import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; import { ExpectedAttestationResult } from "fido2-lib"; import { HTTPError } from "lambert-server"; +import { CreateWebAuthnCredentialSchema, GenerateWebAuthnCredentialsSchema, WebAuthnPostSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); const isGenerateSchema = ( diff --git a/src/api/routes/users/@me/relationships.ts b/src/api/routes/users/@me/relationships.ts
index 76746e3f..7b1780be 100644 --- a/src/api/routes/users/@me/relationships.ts +++ b/src/api/routes/users/@me/relationships.ts
@@ -24,12 +24,12 @@ import { Relationship, RelationshipAddEvent, RelationshipRemoveEvent, - RelationshipType, User, emitEvent, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { RelationshipType } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/settings-proto/1.ts b/src/api/routes/users/@me/settings-proto/1.ts
index 2eea291a..2ae3a55b 100644 --- a/src/api/routes/users/@me/settings-proto/1.ts +++ b/src/api/routes/users/@me/settings-proto/1.ts
@@ -21,14 +21,11 @@ import { Request, Response, Router } from "express"; import { emitEvent, OrmUtils, - SettingsProtoJsonResponse, - SettingsProtoResponse, - SettingsProtoUpdateJsonSchema, - SettingsProtoUpdateSchema, UserSettingsProtos, } from "@spacebar/util"; import { PreloadedUserSettings } from "discord-protos"; import { JsonValue } from "@protobuf-ts/runtime"; +import { SettingsProtoJsonResponse, SettingsProtoResponse, SettingsProtoUpdateJsonSchema, SettingsProtoUpdateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/settings-proto/2.ts b/src/api/routes/users/@me/settings-proto/2.ts
index 34cd3bfc..bfbcc81a 100644 --- a/src/api/routes/users/@me/settings-proto/2.ts +++ b/src/api/routes/users/@me/settings-proto/2.ts
@@ -21,14 +21,11 @@ import { Request, Response, Router } from "express"; import { emitEvent, OrmUtils, - SettingsProtoJsonResponse, - SettingsProtoResponse, - SettingsProtoUpdateJsonSchema, - SettingsProtoUpdateSchema, UserSettingsProtos, } from "@spacebar/util"; import { FrecencyUserSettings } from "discord-protos"; import { JsonValue } from "@protobuf-ts/runtime"; +import { SettingsProtoJsonResponse, SettingsProtoResponse, SettingsProtoUpdateJsonSchema, SettingsProtoUpdateSchema } from "@spacebar/schemas" const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/users/@me/settings.ts b/src/api/routes/users/@me/settings.ts
index 26d2f21b..82ca5add 100644 --- a/src/api/routes/users/@me/settings.ts +++ b/src/api/routes/users/@me/settings.ts
@@ -17,8 +17,9 @@ */ import { route } from "@spacebar/api"; -import { User, UserSettings, UserSettingsSchema } from "@spacebar/util"; +import { User, UserSettings } from "@spacebar/util"; import { Request, Response, Router } from "express"; +import { UserSettingsSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); @@ -66,7 +67,7 @@ router.patch( }); if (!user.settings) - user.settings = UserSettings.create(body); + user.settings = UserSettings.create(body as Partial<UserSettings>); else user.settings.assign(body); diff --git a/src/api/routes/webhooks/#webhook_id/#token/github.ts b/src/api/routes/webhooks/#webhook_id/#token/github.ts
index f5d098b3..eb9ec425 100644 --- a/src/api/routes/webhooks/#webhook_id/#token/github.ts +++ b/src/api/routes/webhooks/#webhook_id/#token/github.ts
@@ -1,8 +1,9 @@ import { getProxyUrl, route } from "@spacebar/api"; -import { capitalize, EmbedType, WebhookExecuteSchema } from "@spacebar/util"; +import { capitalize } from "@spacebar/util"; import { NextFunction, Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { executeWebhook } from "../../../../util/handlers/Webhook"; +import { EmbedType, WebhookExecuteSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); diff --git a/src/api/routes/webhooks/#webhook_id/#token/index.ts b/src/api/routes/webhooks/#webhook_id/#token/index.ts
index 18de03f1..fd9b8c36 100644 --- a/src/api/routes/webhooks/#webhook_id/#token/index.ts +++ b/src/api/routes/webhooks/#webhook_id/#token/index.ts
@@ -7,12 +7,12 @@ import { ValidateName, Webhook, WebhooksUpdateEvent, - WebhookUpdateSchema, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import multer from "multer"; import { executeWebhook } from "../../../../util/handlers/Webhook"; +import { WebhookUpdateSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.get( diff --git a/src/api/routes/webhooks/#webhook_id/index.ts b/src/api/routes/webhooks/#webhook_id/index.ts
index 213f9288..878985ee 100644 --- a/src/api/routes/webhooks/#webhook_id/index.ts +++ b/src/api/routes/webhooks/#webhook_id/index.ts
@@ -6,13 +6,13 @@ import { Webhook, WebhooksUpdateEvent, emitEvent, - WebhookUpdateSchema, Channel, handleFile, ValidateName, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; +import { WebhookUpdateSchema } from "@spacebar/schemas" const router = Router({ mergeParams: true }); router.get( diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts
index 1504faae..5cb7a56b 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -22,7 +22,6 @@ import { Attachment, Channel, Config, - Embed, EmbedCache, emitEvent, EVERYONE_MENTION, @@ -32,8 +31,6 @@ import { HERE_MENTION, Message, MessageCreateEvent, - MessageCreateSchema, - MessageType, MessageUpdateEvent, Role, ROLE_MENTION, @@ -45,14 +42,12 @@ import { handleFile, Permissions, normalizeUrl, - Reaction, - MessageCreateCloudAttachment, - MessageCreateAttachment, } from "@spacebar/util"; import { HTTPError } from "lambert-server"; import { In } from "typeorm"; import fetch from "node-fetch-commonjs"; import { CloudAttachment } from "../../../util/entities/CloudAttachment"; +import { Embed, MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageType, Reaction } from "@spacebar/schemas"; const allow_empty = false; // TODO: check webhook, application, system author, stickers // TODO: embed gifs/videos/images diff --git a/src/api/util/handlers/Webhook.ts b/src/api/util/handlers/Webhook.ts
index 4431766d..9040f74c 100644 --- a/src/api/util/handlers/Webhook.ts +++ b/src/api/util/handlers/Webhook.ts
@@ -10,11 +10,11 @@ import { uploadFile, ValidateName, Webhook, - WebhookExecuteSchema, } from "@spacebar/util"; import { Request, Response } from "express"; import { HTTPError } from "lambert-server"; import { MoreThan } from "typeorm"; +import { WebhookExecuteSchema } from "@spacebar/schemas" export const executeWebhook = async (req: Request, res: Response) => { const { wait } = req.query; diff --git a/src/api/util/handlers/route.ts b/src/api/util/handlers/route.ts
index 8425b8c2..24c3416d 100644 --- a/src/api/util/handlers/route.ts +++ b/src/api/util/handlers/route.ts
@@ -25,12 +25,12 @@ import { RightResolvable, Rights, SpacebarApiErrors, - ajv, getPermission, getRights, } from "@spacebar/util"; import { AnyValidateFunction } from "ajv/dist/core"; import { NextFunction, Request, Response } from "express"; +import { ajv } from "@spacebar/schemas" const ignoredRequestSchemas = [ // skip validation for settings proto JSON updates - TODO: figure out if this even possible to fix? diff --git a/src/api/util/utility/EmbedHandlers.ts b/src/api/util/utility/EmbedHandlers.ts
index 6dec3a1b..f93df3e2 100644 --- a/src/api/util/utility/EmbedHandlers.ts +++ b/src/api/util/utility/EmbedHandlers.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Config, Embed, EmbedImage, EmbedType } from "@spacebar/util"; +import { Config }from "@spacebar/util"; +import { Embed, EmbedImage, EmbedType } from "@spacebar/schemas"; import * as cheerio from "cheerio"; import crypto from "crypto"; import fetch, { RequestInit } from "node-fetch-commonjs"; diff --git a/src/connections/BattleNet/index.ts b/src/connections/BattleNet/index.ts
index 8f44944c..e9e03c8b 100644 --- a/src/connections/BattleNet/index.ts +++ b/src/connections/BattleNet/index.ts
@@ -20,12 +20,12 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, } from "@spacebar/util"; import wretch from "wretch"; import { BattleNetSettings } from "./BattleNetSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" interface BattleNetConnectionUser { sub: string; diff --git a/src/connections/Discord/index.ts b/src/connections/Discord/index.ts
index e5508f48..e1c98176 100644 --- a/src/connections/Discord/index.ts +++ b/src/connections/Discord/index.ts
@@ -20,12 +20,12 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, } from "@spacebar/util"; import wretch from "wretch"; import { DiscordSettings } from "./DiscordSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" interface UserResponse { id: string; diff --git a/src/connections/EpicGames/index.ts b/src/connections/EpicGames/index.ts
index cedfcd0a..3755f0dc 100644 --- a/src/connections/EpicGames/index.ts +++ b/src/connections/EpicGames/index.ts
@@ -20,12 +20,12 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, } from "@spacebar/util"; import wretch from "wretch"; import { EpicGamesSettings } from "./EpicGamesSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" export interface UserResponse { accountId: string; diff --git a/src/connections/Facebook/index.ts b/src/connections/Facebook/index.ts
index bcb90b4c..804b02ab 100644 --- a/src/connections/Facebook/index.ts +++ b/src/connections/Facebook/index.ts
@@ -20,12 +20,12 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, } from "@spacebar/util"; import wretch from "wretch"; import { FacebookSettings } from "./FacebookSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" export interface FacebookErrorResponse { error: { diff --git a/src/connections/GitHub/index.ts b/src/connections/GitHub/index.ts
index 78bf510e..bfda7d43 100644 --- a/src/connections/GitHub/index.ts +++ b/src/connections/GitHub/index.ts
@@ -20,12 +20,12 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, } from "@spacebar/util"; import wretch from "wretch"; import { GitHubSettings } from "./GitHubSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" interface UserResponse { login: string; diff --git a/src/connections/Reddit/index.ts b/src/connections/Reddit/index.ts
index 0db23731..192fa70a 100644 --- a/src/connections/Reddit/index.ts +++ b/src/connections/Reddit/index.ts
@@ -20,12 +20,12 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, } from "@spacebar/util"; import wretch from "wretch"; import { RedditSettings } from "./RedditSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" export interface UserResponse { verified: boolean; diff --git a/src/connections/Spotify/index.ts b/src/connections/Spotify/index.ts
index 4eb12602..2ba86408 100644 --- a/src/connections/Spotify/index.ts +++ b/src/connections/Spotify/index.ts
@@ -19,13 +19,13 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, RefreshableConnection, } from "@spacebar/util"; import wretch from "wretch"; import { SpotifySettings } from "./SpotifySettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" export interface UserResponse { display_name: string; diff --git a/src/connections/Twitch/index.ts b/src/connections/Twitch/index.ts
index 953669a1..5e9f2a8b 100644 --- a/src/connections/Twitch/index.ts +++ b/src/connections/Twitch/index.ts
@@ -19,13 +19,13 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, RefreshableConnection, } from "@spacebar/util"; import wretch from "wretch"; import { TwitchSettings } from "./TwitchSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" interface TwitchConnectionUserResponse { data: { diff --git a/src/connections/Twitter/index.ts b/src/connections/Twitter/index.ts
index eba8ceb5..fadc97e5 100644 --- a/src/connections/Twitter/index.ts +++ b/src/connections/Twitter/index.ts
@@ -19,13 +19,13 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, RefreshableConnection, } from "@spacebar/util"; import wretch from "wretch"; import { TwitterSettings } from "./TwitterSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" interface TwitterUserResponse { data: { diff --git a/src/connections/Xbox/index.ts b/src/connections/Xbox/index.ts
index 84066def..5fc18716 100644 --- a/src/connections/Xbox/index.ts +++ b/src/connections/Xbox/index.ts
@@ -20,12 +20,12 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, } from "@spacebar/util"; import wretch from "wretch"; import { XboxSettings } from "./XboxSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" interface XboxUserResponse { IssueInstant: string; diff --git a/src/connections/Youtube/index.ts b/src/connections/Youtube/index.ts
index 38edbb0d..4a84baf6 100644 --- a/src/connections/Youtube/index.ts +++ b/src/connections/Youtube/index.ts
@@ -20,12 +20,12 @@ import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, - ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, } from "@spacebar/util"; import wretch from "wretch"; import { YoutubeSettings } from "./YoutubeSettings"; +import { ConnectionCallbackSchema } from "@spacebar/schemas" interface YouTubeConnectionChannelListResult { items: { diff --git a/src/gateway/events/Message.ts b/src/gateway/events/Message.ts
index d430ecbd..6fb222b6 100644 --- a/src/gateway/events/Message.ts +++ b/src/gateway/events/Message.ts
@@ -17,13 +17,14 @@ */ import { CLOSECODES, OPCODES, Payload, WebSocket } from "@spacebar/gateway"; -import { ErlpackType, PayloadSchema } from "@spacebar/util"; +import { ErlpackType } from "@spacebar/util"; import fs from "fs/promises"; import BigIntJson from "json-bigint"; import path from "path"; import WS from "ws"; import OPCodeHandlers from "../opcodes"; import { check } from "../opcodes/instanceOf"; +import { PayloadSchema } from "@spacebar/schemas" const bigIntJson = BigIntJson({ storeAsString: true }); diff --git a/src/gateway/listener/listener.ts b/src/gateway/listener/listener.ts
index 58e8bb32..b51b3726 100644 --- a/src/gateway/listener/listener.ts +++ b/src/gateway/listener/listener.ts
@@ -26,7 +26,6 @@ import { Member, EVENTEnum, Relationship, - RelationshipType, Message, NewUrlUserSignatureData, } from "@spacebar/util"; @@ -36,6 +35,7 @@ import { WebSocket } from "@spacebar/gateway"; import { Channel as AMQChannel } from "amqplib"; import { Recipient } from "@spacebar/util"; import * as console from "node:console"; +import { RelationshipType } from "@spacebar/schemas" // TODO: close connection on Invalidated Token // TODO: check intent diff --git a/src/gateway/opcodes/GuildSubscriptionsBulk.ts b/src/gateway/opcodes/GuildSubscriptionsBulk.ts
index 66e28368..54fe78e2 100644 --- a/src/gateway/opcodes/GuildSubscriptionsBulk.ts +++ b/src/gateway/opcodes/GuildSubscriptionsBulk.ts
@@ -1,6 +1,6 @@ import { WebSocket, Payload } from "@spacebar/gateway"; import { onLazyRequest } from "./LazyRequest"; -import { GuildSubscriptionsBulkSchema } from "@spacebar/util"; +import { GuildSubscriptionsBulkSchema } from "@spacebar/schemas"; import { check } from "./instanceOf"; export async function onGuildSubscriptionsBulk( diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts
index 71b05613..8b71840a 100644 --- a/src/gateway/opcodes/Identify.ts +++ b/src/gateway/opcodes/Identify.ts
@@ -25,7 +25,6 @@ import { EVENTEnum, Guild, GuildOrUnavailable, - IdentifySchema, Intents, Member, MemberPrivateProjection, @@ -60,6 +59,7 @@ import { import { check } from "./instanceOf"; import { In } from "typeorm"; import { PreloadedUserSettings } from "discord-protos"; +import { IdentifySchema } from "@spacebar/schemas" // TODO: user sharding // TODO: check privileged intents, if defined in the config diff --git a/src/gateway/opcodes/LazyRequest.ts b/src/gateway/opcodes/LazyRequest.ts
index 41ec4024..94dc7517 100644 --- a/src/gateway/opcodes/LazyRequest.ts +++ b/src/gateway/opcodes/LazyRequest.ts
@@ -23,7 +23,6 @@ import { Member, Role, Session, - LazyRequestSchema, User, Presence, Channel, @@ -38,6 +37,7 @@ import { } from "@spacebar/gateway"; import murmur from "murmurhash-js/murmurhash3_gc"; import { check } from "./instanceOf"; +import { LazyRequestSchema } from "@spacebar/schemas" // TODO: only show roles/members that have access to this channel // TODO: config: to list all members (even those who are offline) sorted by role, or just those who are online diff --git a/src/gateway/opcodes/PresenceUpdate.ts b/src/gateway/opcodes/PresenceUpdate.ts
index 7730d426..13fa3ac4 100644 --- a/src/gateway/opcodes/PresenceUpdate.ts +++ b/src/gateway/opcodes/PresenceUpdate.ts
@@ -22,9 +22,9 @@ import { PresenceUpdateEvent, Session, User, - ActivitySchema, } from "@spacebar/util"; import { check } from "./instanceOf"; +import { ActivitySchema } from "@spacebar/schemas" export async function onPresenceUpdate(this: WebSocket, { d }: Payload) { const startTime = Date.now(); diff --git a/src/gateway/opcodes/RequestGuildMembers.ts b/src/gateway/opcodes/RequestGuildMembers.ts
index b550793f..034dce6b 100644 --- a/src/gateway/opcodes/RequestGuildMembers.ts +++ b/src/gateway/opcodes/RequestGuildMembers.ts
@@ -22,12 +22,12 @@ import { GuildMembersChunkEvent, Member, Presence, - RequestGuildMembersSchema, Session, } from "@spacebar/util"; import { WebSocket, Payload, OPCODES, Send } from "@spacebar/gateway"; import { check } from "./instanceOf"; import { FindManyOptions, ILike, In } from "typeorm"; +import { RequestGuildMembersSchema } from "@spacebar/schemas" export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) { const startTime = Date.now(); diff --git a/src/gateway/opcodes/StreamCreate.ts b/src/gateway/opcodes/StreamCreate.ts
index 3aa8e81a..3defc123 100644 --- a/src/gateway/opcodes/StreamCreate.ts +++ b/src/gateway/opcodes/StreamCreate.ts
@@ -12,13 +12,13 @@ import { Snowflake, Stream, StreamCreateEvent, - StreamCreateSchema, StreamServerUpdateEvent, StreamSession, VoiceState, VoiceStateUpdateEvent, } from "@spacebar/util"; import { check } from "./instanceOf"; +import { StreamCreateSchema } from "@spacebar/schemas" export async function onStreamCreate(this: WebSocket, data: Payload) { const startTime = Date.now(); diff --git a/src/gateway/opcodes/StreamDelete.ts b/src/gateway/opcodes/StreamDelete.ts
index a3ffb1bd..069d6b2a 100644 --- a/src/gateway/opcodes/StreamDelete.ts +++ b/src/gateway/opcodes/StreamDelete.ts
@@ -3,11 +3,11 @@ import { emitEvent, Stream, StreamDeleteEvent, - StreamDeleteSchema, VoiceState, VoiceStateUpdateEvent, } from "@spacebar/util"; import { check } from "./instanceOf"; +import { StreamDeleteSchema } from "@spacebar/schemas" export async function onStreamDelete(this: WebSocket, data: Payload) { const startTime = Date.now(); diff --git a/src/gateway/opcodes/StreamWatch.ts b/src/gateway/opcodes/StreamWatch.ts
index 3583bc2c..88bc0463 100644 --- a/src/gateway/opcodes/StreamWatch.ts +++ b/src/gateway/opcodes/StreamWatch.ts
@@ -11,10 +11,10 @@ import { StreamCreateEvent, StreamServerUpdateEvent, StreamSession, - StreamWatchSchema, } from "@spacebar/util"; import { check } from "./instanceOf"; import { Not } from "typeorm"; +import { StreamWatchSchema } from "@spacebar/schemas" export async function onStreamWatch(this: WebSocket, data: Payload) { const startTime = Date.now(); diff --git a/src/gateway/opcodes/VoiceStateUpdate.ts b/src/gateway/opcodes/VoiceStateUpdate.ts
index 92d18599..7d1a80e9 100644 --- a/src/gateway/opcodes/VoiceStateUpdate.ts +++ b/src/gateway/opcodes/VoiceStateUpdate.ts
@@ -26,10 +26,10 @@ import { VoiceServerUpdateEvent, VoiceState, VoiceStateUpdateEvent, - VoiceStateUpdateSchema, } from "@spacebar/util"; import { genVoiceToken } from "../util/SessionUtils"; import { check } from "./instanceOf"; +import { VoiceStateUpdateSchema } from "@spacebar/schemas" // TODO: check if a voice server is setup // Notice: Bot users respect the voice channel's user limit, if set. diff --git a/src/schemas/Identifiers.ts b/src/schemas/Identifiers.ts new file mode 100644
index 00000000..cb0a0e23 --- /dev/null +++ b/src/schemas/Identifiers.ts
@@ -0,0 +1,30 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +/** + * A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z + * ``` + * If we have a snowflake '266241948824764416' we can represent it as binary: + * + * 64 22 17 12 0 + * 000000111011000111100001101001000101000000 00001 00000 000000000000 + * number of ms since Discord epoch worker pid increment + * ``` + * @format snowflake + */ +export type Snowflake = string; \ No newline at end of file diff --git a/src/schemas/ApplicationCreateSchema.ts b/src/schemas/api/developers/ApplicationCreateSchema.ts
index 80956ec4..80956ec4 100644 --- a/src/schemas/ApplicationCreateSchema.ts +++ b/src/schemas/api/developers/ApplicationCreateSchema.ts
diff --git a/src/schemas/ApplicationModifySchema.ts b/src/schemas/api/developers/ApplicationModifySchema.ts
index a8717976..a8717976 100644 --- a/src/schemas/ApplicationModifySchema.ts +++ b/src/schemas/api/developers/ApplicationModifySchema.ts
diff --git a/src/schemas/UserSettingsSchema.ts b/src/schemas/api/developers/index.ts
index 0d23e757..10717b78 100644 --- a/src/schemas/UserSettingsSchema.ts +++ b/src/schemas/api/developers/index.ts
@@ -1,6 +1,6 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors + Copyright (C) 2025 Spacebar and Spacebar Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -15,7 +15,5 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -import { UserSettings } from "@spacebar/util"; - -export type UserSettingsSchema = Omit<Partial<UserSettings>, "index">; +export * from "./ApplicationCreateSchema"; +export * from "./ApplicationModifySchema"; diff --git a/src/schemas/GatewayBotResponse.ts b/src/schemas/api/index.ts
index c68ec09e..8e7520d1 100644 --- a/src/schemas/GatewayBotResponse.ts +++ b/src/schemas/api/index.ts
@@ -1,6 +1,6 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors + Copyright (C) 2025 Spacebar and Spacebar Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -15,14 +15,6 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -export interface GatewayBotResponse { - url: string; - shards: number; - session_start_limit: { - total: number; - remaining: number; - reset_after: number; - max_concurrency: number; - }; -} +export * from "./developers"; +export * from "./messages"; +export * from "./users"; diff --git a/src/schemas/api/messages/Components.ts b/src/schemas/api/messages/Components.ts new file mode 100644
index 00000000..1415dea0 --- /dev/null +++ b/src/schemas/api/messages/Components.ts
@@ -0,0 +1,116 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +import { PartialEmoji } from "@spacebar/schemas"; + +export interface MessageComponent { + type: MessageComponentType; +} + +export interface ActionRowComponent extends MessageComponent { + type: MessageComponentType.ActionRow; + components: ( + | ButtonComponent + | StringSelectMenuComponent + | SelectMenuComponent + | TextInputComponent + )[]; +} + +export interface ButtonComponent extends MessageComponent { + type: MessageComponentType.Button; + style: ButtonStyle; + label?: string; + emoji?: PartialEmoji; + custom_id?: string; + sku_id?: string; + url?: string; + disabled?: boolean; +} + +export enum ButtonStyle { + Primary = 1, + Secondary = 2, + Success = 3, + Danger = 4, + Link = 5, + Premium = 6, +} + +export interface SelectMenuComponent extends MessageComponent { + type: + | MessageComponentType.StringSelect + | MessageComponentType.UserSelect + | MessageComponentType.RoleSelect + | MessageComponentType.MentionableSelect + | MessageComponentType.ChannelSelect; + custom_id: string; + channel_types?: number[]; + placeholder?: string; + default_values?: SelectMenuDefaultOption[]; // only for non-string selects + min_values?: number; + max_values?: number; + disabled?: boolean; +} + +export interface SelectMenuOption { + label: string; + value: string; + description?: string; + emoji?: PartialEmoji; + default?: boolean; +} + +export interface SelectMenuDefaultOption { + id: string; + type: "user" | "role" | "channel"; +} + +export interface StringSelectMenuComponent extends SelectMenuComponent { + type: MessageComponentType.StringSelect; + options: SelectMenuOption[]; +} + +export interface TextInputComponent extends MessageComponent { + type: MessageComponentType.TextInput; + custom_id: string; + style: TextInputStyle; + label: string; + min_length?: number; + max_length?: number; + required?: boolean; + value?: string; + placeholder?: string; +} + +export enum TextInputStyle { + Short = 1, + Paragraph = 2, +} + +export enum MessageComponentType { + Script = 0, // self command script + ActionRow = 1, + Button = 2, + StringSelect = 3, + TextInput = 4, + UserSelect = 5, + RoleSelect = 6, + MentionableSelect = 7, + ChannelSelect = 8, +} \ No newline at end of file diff --git a/src/schemas/api/messages/Embeds.ts b/src/schemas/api/messages/Embeds.ts new file mode 100644
index 00000000..e97020b3 --- /dev/null +++ b/src/schemas/api/messages/Embeds.ts
@@ -0,0 +1,65 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export interface Embed { + title?: string; //title of embed + type?: EmbedType; // type of embed (always "rich" for webhook embeds) + description?: string; // description of embed + url?: string; // url of embed + timestamp?: Date; // timestamp of embed content + color?: number; // color code of the embed + footer?: { + text: string; + icon_url?: string; + proxy_icon_url?: string; + }; // footer object footer information + image?: EmbedImage; // image object image information + thumbnail?: EmbedImage; // thumbnail object thumbnail information + video?: EmbedImage; // video object video information + provider?: { + name?: string; + url?: string; + }; // provider object provider information + author?: { + name?: string; + url?: string; + icon_url?: string; + proxy_icon_url?: string; + }; // author object author information + fields?: { + name: string; + value: string; + inline?: boolean; + }[]; +} + +export enum EmbedType { + rich = "rich", + image = "image", + video = "video", + gifv = "gifv", + article = "article", + link = "link", +} + +export interface EmbedImage { + url?: string; + proxy_url?: string; + height?: number; + width?: number; +} diff --git a/src/schemas/api/messages/Message.ts b/src/schemas/api/messages/Message.ts new file mode 100644
index 00000000..64fbd27b --- /dev/null +++ b/src/schemas/api/messages/Message.ts
@@ -0,0 +1,97 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +import { PartialUser } from "@spacebar/schemas"; + +export enum MessageType { + DEFAULT = 0, + RECIPIENT_ADD = 1, + RECIPIENT_REMOVE = 2, + CALL = 3, + CHANNEL_NAME_CHANGE = 4, + CHANNEL_ICON_CHANGE = 5, + CHANNEL_PINNED_MESSAGE = 6, + GUILD_MEMBER_JOIN = 7, + USER_PREMIUM_GUILD_SUBSCRIPTION = 8, + USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9, + USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10, + USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11, + CHANNEL_FOLLOW_ADD = 12, + ACTION = 13, // /me messages + GUILD_DISCOVERY_DISQUALIFIED = 14, + GUILD_DISCOVERY_REQUALIFIED = 15, + ENCRYPTED = 16, + REPLY = 19, + APPLICATION_COMMAND = 20, // application command or self command invocation + ROUTE_ADDED = 41, // custom message routing: new route affecting that channel + ROUTE_DISABLED = 42, // custom message routing: given route no longer affecting that channel + SELF_COMMAND_SCRIPT = 43, // self command scripts + ENCRYPTION = 50, + CUSTOM_START = 63, + UNHANDLED = 255, +} + + +/** + * https://docs.discord.food/resources/message#partial-message-structure + */ +/* +export type PartialMessage = Pick<Message, "id"> + // & Pick<Message, "lobby_id"> + & Pick<Message, "channel_id"> + & Pick<Message, "type"> + & Pick<Message, "content"> + & Pick<Message, "author"> + & Pick<Message, "flags"> + & Pick<Message, "application_id"> + & { channel?: Channel } +// & Pick<Message, "recipient_id"> // TODO: ephemeral DM channels + ; + */ + +export interface PartialMessage { + id: string; + channel_id: string; + type: MessageType; + content: string; + author: PartialUser; + flags?: number; + application_id?: string; + // channel?: Channel; // TODO: ephemeral DM channels + // recipient_id?: string; // TODO: ephemeral DM channels +} + +export interface Reaction { + count: number; + //// not saved in the database // me: boolean; // whether the current user reacted using this emoji + emoji: PartialEmoji; + user_ids: string[]; +} + +export interface PartialEmoji { + id?: string; + name: string; + animated?: boolean; +} + +export interface AllowedMentions { + parse?: ("users" | "roles" | "everyone")[]; + roles?: string[]; + users?: string[]; + replied_user?: boolean; +} diff --git a/src/schemas/api/messages/Polls.ts b/src/schemas/api/messages/Polls.ts new file mode 100644
index 00000000..c75717db --- /dev/null +++ b/src/schemas/api/messages/Polls.ts
@@ -0,0 +1,48 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +import { PartialEmoji } from "@spacebar/schemas" + +export interface Poll { + question: PollMedia; + answers: PollAnswer[]; + expiry: Date; + allow_multiselect: boolean; + results?: PollResult; +} + +export interface PollMedia { + text?: string; + emoji?: PartialEmoji; +} + +export interface PollAnswer { + answer_id?: string; + poll_media: PollMedia; +} + +export interface PollResult { + is_finalized: boolean; + answer_counts: PollAnswerCount[]; +} + +export interface PollAnswerCount { + id: string; + count: number; + me_voted: boolean; +} diff --git a/src/schemas/api/messages/index.ts b/src/schemas/api/messages/index.ts new file mode 100644
index 00000000..95a8a659 --- /dev/null +++ b/src/schemas/api/messages/index.ts
@@ -0,0 +1,21 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ +export * from "./Components"; +export * from "./Embeds"; +export * from "./Message"; +export * from "./Polls"; diff --git a/src/schemas/api/users/User.ts b/src/schemas/api/users/User.ts new file mode 100644
index 00000000..89150655 --- /dev/null +++ b/src/schemas/api/users/User.ts
@@ -0,0 +1,68 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +import { Snowflake } from "@spacebar/schemas"; + +export interface PartialUser { + id: Snowflake; + username: string; + discriminator: string; + global_name?: string | null; + avatar: string | null; + avatar_decoration_data?: AvatarDecorationData | null; + collectibles?: Collectibles | null; + display_name_styles?: DisplayNameStyle | null; + primary_guild?: PrimaryGuild | null; + bot?: boolean; + system?: boolean; + banner?: string | null; + accent_color?: number | null; + public_flags?: number; +} + +export interface AvatarDecorationData { + asset: string; + sku_id: Snowflake; + expires_at: string | null; +} + +export interface Collectibles { + nameplate: NameplateData | null; +} + +export interface NameplateData { + asset: string; + sku_id: Snowflake; + label: string; + palette: string; + expires_at: number | null; +} + +export interface DisplayNameStyle { + font_id: number; + effect_id: number; + colors: number; +} + +export interface PrimaryGuild { + identity_enabled: boolean | null; + identity_guild_id: Snowflake | null; + tag: string | null; + badge: string | null; +} + diff --git a/src/schemas/GatewayResponse.ts b/src/schemas/api/users/index.ts
index 5b771edc..44fa1c5d 100644 --- a/src/schemas/GatewayResponse.ts +++ b/src/schemas/api/users/index.ts
@@ -1,6 +1,6 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors + Copyright (C) 2025 Spacebar and Spacebar Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -15,7 +15,4 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -export interface GatewayResponse { - url: string; -} +export * from "./User"; diff --git a/src/schemas/GatewayPayloadSchema.ts b/src/schemas/gateway/GatewayPayloadSchema.ts
index cb01f161..306f2c03 100644 --- a/src/schemas/GatewayPayloadSchema.ts +++ b/src/schemas/gateway/GatewayPayloadSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Tuple } from "lambert-server*"; +import { Tuple } from "lambert-server"; export const PayloadSchema = { op: Number, diff --git a/src/schemas/IdentifySchema.ts b/src/schemas/gateway/IdentifySchema.ts
index 0619dacc..7d0eedae 100644 --- a/src/schemas/IdentifySchema.ts +++ b/src/schemas/gateway/IdentifySchema.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ActivitySchema } from "@spacebar/util"; - // TODO: Need a way to allow camalCase and pascal_case without just duplicating the schema +import { ActivitySchema } from "@spacebar/schemas" + export const IdentifySchema = { token: String, $intents: BigInt, // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt diff --git a/src/schemas/LazyRequestSchema.ts b/src/schemas/gateway/LazyRequestSchema.ts
index ca07d37b..ca07d37b 100644 --- a/src/schemas/LazyRequestSchema.ts +++ b/src/schemas/gateway/LazyRequestSchema.ts
diff --git a/src/schemas/StreamCreateSchema.ts b/src/schemas/gateway/StreamCreateSchema.ts
index bb650791..bb650791 100644 --- a/src/schemas/StreamCreateSchema.ts +++ b/src/schemas/gateway/StreamCreateSchema.ts
diff --git a/src/schemas/StreamDeleteSchema.ts b/src/schemas/gateway/StreamDeleteSchema.ts
index 0e2aff75..0e2aff75 100644 --- a/src/schemas/StreamDeleteSchema.ts +++ b/src/schemas/gateway/StreamDeleteSchema.ts
diff --git a/src/schemas/StreamWatchSchema.ts b/src/schemas/gateway/StreamWatchSchema.ts
index 263bb11f..263bb11f 100644 --- a/src/schemas/StreamWatchSchema.ts +++ b/src/schemas/gateway/StreamWatchSchema.ts
diff --git a/src/schemas/gateway/index.ts b/src/schemas/gateway/index.ts new file mode 100644
index 00000000..bdd1c406 --- /dev/null +++ b/src/schemas/gateway/index.ts
@@ -0,0 +1,23 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ +export * from "./GatewayPayloadSchema"; +export * from "./IdentifySchema"; +export * from "./LazyRequestSchema"; +export * from "./StreamCreateSchema"; +export * from "./StreamDeleteSchema"; +export * from "./StreamWatchSchema"; diff --git a/src/schemas/index.ts b/src/schemas/index.ts
index 39710425..e6428d54 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts
@@ -1,100 +1,24 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2025 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -export * from "./AckBulkSchema"; -export * from "./ActivitySchema"; -export * from "./ApplicationAuthorizeSchema"; -export * from "./ApplicationCreateSchema"; -export * from "./ApplicationModifySchema"; -export * from "./AutomodRuleSchema"; -export * from "./BackupCodesChallengeSchema"; -export * from "./BanCreateSchema"; -export * from "./BanModeratorSchema"; -export * from "./BanRegistrySchema"; -export * from "./BotModifySchema"; -export * from "./ChannelModifySchema"; -export * from "./ChannelPermissionOverwriteSchema"; -export * from "./ChannelReorderSchema"; -export * from "./CodesVerificationSchema"; -export * from "./ConnectedAccountSchema"; -export * from "./ConnectionCallbackSchema"; -export * from "./ConnectionUpdateSchema"; -export * from "./DmChannelCreateSchema"; -export * from "./EmailDomainLookupSchema"; -export * from "./EmailDomainLookupVerifyCodeSchema"; -export * from "./EmojiCreateSchema"; -export * from "./EmojiModifySchema"; -export * from "./ForgotPasswordSchema"; -export * from "./GatewayPayloadSchema"; -export * from "./GreetRequestSchema"; -export * from "./GuildCreateSchema"; -export * from "./GuildSubscriptionsBulkSchema"; -export * from "./GuildTemplateCreateSchema"; -export * from "./GuildUpdateSchema"; -export * from "./GuildUpdateWelcomeScreenSchema"; -export * from "./HubWaitlistSignupSchema"; -export * from "./IdentifySchema"; -export * from "./InviteCreateSchema"; -export * from "./LazyRequestSchema"; -export * from "./LoginSchema"; -export * from "./MemberChangeProfileSchema"; -export * from "./MemberChangeSchema"; -export * from "./MessageAcknowledgeSchema"; -export * from "./MessageCreateSchema"; -export * from "./MessageEditSchema"; -export * from "./MfaCodesSchema"; -export * from "./ModifyGuildStickerSchema"; -export * from "./PreloadMessagesRequestSchema"; -export * from "./PasswordResetSchema"; -export * from "./PurgeSchema"; -export * from "./RefreshUrlsRequestSchema"; -export * from "./RegisterSchema"; -export * from "./RelationshipPostSchema"; -export * from "./RelationshipPutSchema"; -export * from "./RequestGuildMembersSchema"; +export * from "./api"; +export * from "./gateway"; export * from "./responses"; -export * from "./RoleModifySchema"; -export * from "./RolePositionUpdateSchema"; -export * from "./SelectProtocolSchema"; -export * from "./SettingsProtoUpdateSchema"; -export * from "./StreamCreateSchema"; -export * from "./StreamDeleteSchema"; -export * from "./StreamWatchSchema"; -export * from "./TeamCreateSchema"; -export * from "./TemplateCreateSchema"; -export * from "./TemplateModifySchema"; -export * from "./TotpDisableSchema"; -export * from "./TotpEnableSchema"; -export * from "./TotpSchema"; -export * from "./UploadAttachmentRequestSchema"; -export * from "./UserDeleteSchema"; -export * from "./UserGuildSettingsSchema"; -export * from "./UserModifySchema"; -export * from "./UserNoteUpdateSchema"; -export * from "./UserProfileModifySchema"; -export * from "./UserSettingsSchema"; +export * from "./uncategorised"; +export * from "./webrtc"; +export * from "./Identifiers"; export * from "./Validator"; -export * from "./VanityUrlSchema"; -export * from "./VoiceIdentifySchema"; -export * from "./VoiceStateUpdateSchema"; -export * from "./VoiceVideoSchema"; -export * from "./WebAuthnSchema"; -export * from "./WebhookCreateSchema"; -export * from "./WebhookExecuteSchema"; -export * from "./WebhookUpdateSchema"; -export * from "./WidgetModifySchema"; diff --git a/src/schemas/responses/DmMessagesResponseSchema.ts b/src/schemas/responses/DmMessagesResponseSchema.ts
index 8bce6e63..62347ef0 100644 --- a/src/schemas/responses/DmMessagesResponseSchema.ts +++ b/src/schemas/responses/DmMessagesResponseSchema.ts
@@ -16,6 +16,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { PartialMessage } from "@spacebar/util"; +import { PartialMessage } from "@spacebar/schemas" export type DmMessagesResponseSchema = PartialMessage[]; diff --git a/src/schemas/responses/GuildCreateResponse.ts b/src/schemas/responses/GuildCreateResponse.ts
index 50f5f2fc..79331d2a 100644 --- a/src/schemas/responses/GuildCreateResponse.ts +++ b/src/schemas/responses/GuildCreateResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { GuildUpdateSchema, GuildWelcomeScreen } from "@spacebar/util"; +import { GuildWelcomeScreen } from "@spacebar/util"; +import { GuildUpdateSchema } from "@spacebar/schemas" export interface GuildCreateResponse extends Omit<GuildUpdateSchema, "name"> { id: string; diff --git a/src/schemas/responses/GuildMessagesSearchResponse.ts b/src/schemas/responses/GuildMessagesSearchResponse.ts
index 376b684e..d42683e3 100644 --- a/src/schemas/responses/GuildMessagesSearchResponse.ts +++ b/src/schemas/responses/GuildMessagesSearchResponse.ts
@@ -17,14 +17,11 @@ */ import { - ActionRowComponent, Attachment, - Embed, - MessageType, - Poll, PublicUser, Role, } from "../../util/entities"; +import { ActionRowComponent, Embed, MessageType, Poll } from "@spacebar/schemas"; export interface GuildMessagesSearchMessage { id: string; diff --git a/src/schemas/responses/MemberJoinGuildResponse.ts b/src/schemas/responses/MemberJoinGuildResponse.ts
index 40002e11..1ef78eaa 100644 --- a/src/schemas/responses/MemberJoinGuildResponse.ts +++ b/src/schemas/responses/MemberJoinGuildResponse.ts
@@ -16,8 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { GuildCreateResponse } from "@spacebar/util"; import { Emoji, Role, Sticker } from "../../util/entities"; +import { GuildCreateResponse } from "@spacebar/schemas" export interface MemberJoinGuildResponse { guild: GuildCreateResponse; diff --git a/src/schemas/responses/TypedResponses.ts b/src/schemas/responses/TypedResponses.ts
index 86d0849e..bfab2255 100644 --- a/src/schemas/responses/TypedResponses.ts +++ b/src/schemas/responses/TypedResponses.ts
@@ -16,7 +16,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { GuildBansResponse, GuildCreateResponse } from "@spacebar/util"; import { GeneralConfiguration, LimitsConfiguration } from "../../util/config"; import { DmChannelDTO } from "../../util/dtos"; import { @@ -39,6 +38,7 @@ import { Webhook, } from "../../util/entities"; import { GuildVoiceRegion } from "./GuildVoiceRegionsResponse"; +import { GuildBansResponse, GuildCreateResponse } from "@spacebar/schemas" // removes internal properties from the guild class export type APIGuild = Omit< diff --git a/src/schemas/responses/UserRelationshipsResponse.ts b/src/schemas/responses/UserRelationshipsResponse.ts
index 1a3341f1..5bfb8f88 100644 --- a/src/schemas/responses/UserRelationshipsResponse.ts +++ b/src/schemas/responses/UserRelationshipsResponse.ts
@@ -15,7 +15,8 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { PublicUser, RelationshipType } from "../../util/entities"; +import { PublicUser } from "../../util/entities"; +import { RelationshipType } from "@spacebar/schemas" export interface UserRelationshipsResponse { id: string; diff --git a/src/schemas/responses/index.ts b/src/schemas/responses/index.ts
index dcf49f3c..3263c7e2 100644 --- a/src/schemas/responses/index.ts +++ b/src/schemas/responses/index.ts
@@ -1,24 +1,23 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2025 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -export * from "./AccountStandingResponse"; export * from "./APIErrorOrCaptchaResponse"; export * from "./APIErrorResponse"; +export * from "./AccountStandingResponse"; export * from "./BackupCodesChallengeResponse"; export * from "./CaptchaRequiredResponse"; export * from "./CollectiblesCategoriesResponse"; @@ -62,7 +61,7 @@ export * from "./UpdatesResponse"; export * from "./UploadAttachmentResponseSchema"; export * from "./UserNoteResponse"; export * from "./UserProfileResponse"; -export * from "./UserRelationshipsResponse"; export * from "./UserRelationsResponse"; +export * from "./UserRelationshipsResponse"; export * from "./WebAuthnCreateResponse"; export * from "./WebhookCreateResponse"; diff --git a/src/schemas/AckBulkSchema.ts b/src/schemas/uncategorised/AckBulkSchema.ts
index 5604c2fc..5604c2fc 100644 --- a/src/schemas/AckBulkSchema.ts +++ b/src/schemas/uncategorised/AckBulkSchema.ts
diff --git a/src/schemas/ActivitySchema.ts b/src/schemas/uncategorised/ActivitySchema.ts
index f168f967..f168f967 100644 --- a/src/schemas/ActivitySchema.ts +++ b/src/schemas/uncategorised/ActivitySchema.ts
diff --git a/src/schemas/ApplicationAuthorizeSchema.ts b/src/schemas/uncategorised/ApplicationAuthorizeSchema.ts
index 04b7b1ea..04b7b1ea 100644 --- a/src/schemas/ApplicationAuthorizeSchema.ts +++ b/src/schemas/uncategorised/ApplicationAuthorizeSchema.ts
diff --git a/src/schemas/AutomodRuleSchema.ts b/src/schemas/uncategorised/AutomodRuleSchema.ts
index 55cf2027..55cf2027 100644 --- a/src/schemas/AutomodRuleSchema.ts +++ b/src/schemas/uncategorised/AutomodRuleSchema.ts
diff --git a/src/schemas/BackupCodesChallengeSchema.ts b/src/schemas/uncategorised/BackupCodesChallengeSchema.ts
index 25f1b707..25f1b707 100644 --- a/src/schemas/BackupCodesChallengeSchema.ts +++ b/src/schemas/uncategorised/BackupCodesChallengeSchema.ts
diff --git a/src/schemas/BanCreateSchema.ts b/src/schemas/uncategorised/BanCreateSchema.ts
index 6d30ca22..6d30ca22 100644 --- a/src/schemas/BanCreateSchema.ts +++ b/src/schemas/uncategorised/BanCreateSchema.ts
diff --git a/src/schemas/BanModeratorSchema.ts b/src/schemas/uncategorised/BanModeratorSchema.ts
index cba1a5ed..cba1a5ed 100644 --- a/src/schemas/BanModeratorSchema.ts +++ b/src/schemas/uncategorised/BanModeratorSchema.ts
diff --git a/src/schemas/BanRegistrySchema.ts b/src/schemas/uncategorised/BanRegistrySchema.ts
index 4e768700..4e768700 100644 --- a/src/schemas/BanRegistrySchema.ts +++ b/src/schemas/uncategorised/BanRegistrySchema.ts
diff --git a/src/schemas/BotModifySchema.ts b/src/schemas/uncategorised/BotModifySchema.ts
index 7d94da23..7d94da23 100644 --- a/src/schemas/BotModifySchema.ts +++ b/src/schemas/uncategorised/BotModifySchema.ts
diff --git a/src/schemas/BulkBanSchema.ts b/src/schemas/uncategorised/BulkBanSchema.ts
index 48a7bac8..48a7bac8 100644 --- a/src/schemas/BulkBanSchema.ts +++ b/src/schemas/uncategorised/BulkBanSchema.ts
diff --git a/src/schemas/BulkDeleteSchema.ts b/src/schemas/uncategorised/BulkDeleteSchema.ts
index ca22f10d..ca22f10d 100644 --- a/src/schemas/BulkDeleteSchema.ts +++ b/src/schemas/uncategorised/BulkDeleteSchema.ts
diff --git a/src/schemas/ChannelModifySchema.ts b/src/schemas/uncategorised/ChannelModifySchema.ts
index 088ac459..088ac459 100644 --- a/src/schemas/ChannelModifySchema.ts +++ b/src/schemas/uncategorised/ChannelModifySchema.ts
diff --git a/src/schemas/ChannelPermissionOverwriteSchema.ts b/src/schemas/uncategorised/ChannelPermissionOverwriteSchema.ts
index 6e8b3402..6e8b3402 100644 --- a/src/schemas/ChannelPermissionOverwriteSchema.ts +++ b/src/schemas/uncategorised/ChannelPermissionOverwriteSchema.ts
diff --git a/src/schemas/ChannelReorderSchema.ts b/src/schemas/uncategorised/ChannelReorderSchema.ts
index 657ed420..657ed420 100644 --- a/src/schemas/ChannelReorderSchema.ts +++ b/src/schemas/uncategorised/ChannelReorderSchema.ts
diff --git a/src/schemas/CodesVerificationSchema.ts b/src/schemas/uncategorised/CodesVerificationSchema.ts
index 3c95e619..3c95e619 100644 --- a/src/schemas/CodesVerificationSchema.ts +++ b/src/schemas/uncategorised/CodesVerificationSchema.ts
diff --git a/src/schemas/ConnectedAccountSchema.ts b/src/schemas/uncategorised/ConnectedAccountSchema.ts
index 3c3e76ec..4bf4a3d6 100644 --- a/src/schemas/ConnectedAccountSchema.ts +++ b/src/schemas/uncategorised/ConnectedAccountSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccountTokenData } from "../util/interfaces"; +import { ConnectedAccountTokenData } from "../../util/interfaces"; export interface ConnectedAccountSchema { external_id: string; diff --git a/src/schemas/ConnectionCallbackSchema.ts b/src/schemas/uncategorised/ConnectionCallbackSchema.ts
index b66bfe20..b66bfe20 100644 --- a/src/schemas/ConnectionCallbackSchema.ts +++ b/src/schemas/uncategorised/ConnectionCallbackSchema.ts
diff --git a/src/schemas/ConnectionUpdateSchema.ts b/src/schemas/uncategorised/ConnectionUpdateSchema.ts
index f9f17b0d..f9f17b0d 100644 --- a/src/schemas/ConnectionUpdateSchema.ts +++ b/src/schemas/uncategorised/ConnectionUpdateSchema.ts
diff --git a/src/schemas/DmChannelCreateSchema.ts b/src/schemas/uncategorised/DmChannelCreateSchema.ts
index 510ff9c3..510ff9c3 100644 --- a/src/schemas/DmChannelCreateSchema.ts +++ b/src/schemas/uncategorised/DmChannelCreateSchema.ts
diff --git a/src/schemas/EmailDomainLookupSchema.ts b/src/schemas/uncategorised/EmailDomainLookupSchema.ts
index 43680aa4..43680aa4 100644 --- a/src/schemas/EmailDomainLookupSchema.ts +++ b/src/schemas/uncategorised/EmailDomainLookupSchema.ts
diff --git a/src/schemas/EmailDomainLookupVerifyCodeSchema.ts b/src/schemas/uncategorised/EmailDomainLookupVerifyCodeSchema.ts
index 9fe0bd46..9fe0bd46 100644 --- a/src/schemas/EmailDomainLookupVerifyCodeSchema.ts +++ b/src/schemas/uncategorised/EmailDomainLookupVerifyCodeSchema.ts
diff --git a/src/schemas/EmojiCreateSchema.ts b/src/schemas/uncategorised/EmojiCreateSchema.ts
index 5eae5a9a..5eae5a9a 100644 --- a/src/schemas/EmojiCreateSchema.ts +++ b/src/schemas/uncategorised/EmojiCreateSchema.ts
diff --git a/src/schemas/EmojiModifySchema.ts b/src/schemas/uncategorised/EmojiModifySchema.ts
index 5d33bf61..5d33bf61 100644 --- a/src/schemas/EmojiModifySchema.ts +++ b/src/schemas/uncategorised/EmojiModifySchema.ts
diff --git a/src/schemas/ForgotPasswordSchema.ts b/src/schemas/uncategorised/ForgotPasswordSchema.ts
index 0f9fc92d..0f9fc92d 100644 --- a/src/schemas/ForgotPasswordSchema.ts +++ b/src/schemas/uncategorised/ForgotPasswordSchema.ts
diff --git a/src/schemas/GreetRequestSchema.ts b/src/schemas/uncategorised/GreetRequestSchema.ts
index 545952d0..28d1fddc 100644 --- a/src/schemas/GreetRequestSchema.ts +++ b/src/schemas/uncategorised/GreetRequestSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { AllowedMentions } from "@spacebar/util"; +import { AllowedMentions } from "@spacebar/schemas"; export interface GreetRequestSchema { sticker_ids: string[]; diff --git a/src/schemas/GuildCreateSchema.ts b/src/schemas/uncategorised/GuildCreateSchema.ts
index 278a759c..a9790fa8 100644 --- a/src/schemas/GuildCreateSchema.ts +++ b/src/schemas/uncategorised/GuildCreateSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ChannelModifySchema } from "./index"; +import { ChannelModifySchema } from "@spacebar/schemas*"; export interface GuildCreateSchema { /** diff --git a/src/schemas/GuildSubscriptionsBulkSchema.ts b/src/schemas/uncategorised/GuildSubscriptionsBulkSchema.ts
index 86f00a3d..f4c8a1ae 100644 --- a/src/schemas/GuildSubscriptionsBulkSchema.ts +++ b/src/schemas/uncategorised/GuildSubscriptionsBulkSchema.ts
@@ -1,4 +1,4 @@ -import { LazyRequestSchema } from "./LazyRequestSchema"; +import { LazyRequestSchema } from "../gateway/LazyRequestSchema"; export interface GuildSubscriptionsBulkSchema { subscriptions: { [key: string]: GuildSubscriptionSchema }; diff --git a/src/schemas/GuildTemplateCreateSchema.ts b/src/schemas/uncategorised/GuildTemplateCreateSchema.ts
index 048de6f0..048de6f0 100644 --- a/src/schemas/GuildTemplateCreateSchema.ts +++ b/src/schemas/uncategorised/GuildTemplateCreateSchema.ts
diff --git a/src/schemas/GuildUpdateSchema.ts b/src/schemas/uncategorised/GuildUpdateSchema.ts
index 069be6cf..55ccf442 100644 --- a/src/schemas/GuildUpdateSchema.ts +++ b/src/schemas/uncategorised/GuildUpdateSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { GuildCreateSchema } from "@spacebar/util"; +import { GuildCreateSchema } from "@spacebar/schemas"; export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels"> { banner?: string | null; diff --git a/src/schemas/GuildUpdateWelcomeScreenSchema.ts b/src/schemas/uncategorised/GuildUpdateWelcomeScreenSchema.ts
index 8046aae6..8046aae6 100644 --- a/src/schemas/GuildUpdateWelcomeScreenSchema.ts +++ b/src/schemas/uncategorised/GuildUpdateWelcomeScreenSchema.ts
diff --git a/src/schemas/HubWaitlistSignupSchema.ts b/src/schemas/uncategorised/HubWaitlistSignupSchema.ts
index 8114b3d8..8114b3d8 100644 --- a/src/schemas/HubWaitlistSignupSchema.ts +++ b/src/schemas/uncategorised/HubWaitlistSignupSchema.ts
diff --git a/src/schemas/InviteCreateSchema.ts b/src/schemas/uncategorised/InviteCreateSchema.ts
index 92333e77..92333e77 100644 --- a/src/schemas/InviteCreateSchema.ts +++ b/src/schemas/uncategorised/InviteCreateSchema.ts
diff --git a/src/schemas/LoginResponse.ts b/src/schemas/uncategorised/LoginResponse.ts
index faf3f769..5c1e4f80 100644 --- a/src/schemas/LoginResponse.ts +++ b/src/schemas/uncategorised/LoginResponse.ts
@@ -1,4 +1,4 @@ -import { TokenResponse } from "./responses"; +import { TokenResponse } from "../responses"; export interface MFAResponse { ticket: string; diff --git a/src/schemas/LoginSchema.ts b/src/schemas/uncategorised/LoginSchema.ts
index 55b6a020..55b6a020 100644 --- a/src/schemas/LoginSchema.ts +++ b/src/schemas/uncategorised/LoginSchema.ts
diff --git a/src/schemas/MemberChangeProfileSchema.ts b/src/schemas/uncategorised/MemberChangeProfileSchema.ts
index d2d1481d..d2d1481d 100644 --- a/src/schemas/MemberChangeProfileSchema.ts +++ b/src/schemas/uncategorised/MemberChangeProfileSchema.ts
diff --git a/src/schemas/MemberChangeSchema.ts b/src/schemas/uncategorised/MemberChangeSchema.ts
index e1ee0969..e1ee0969 100644 --- a/src/schemas/MemberChangeSchema.ts +++ b/src/schemas/uncategorised/MemberChangeSchema.ts
diff --git a/src/schemas/MemberNickChangeSchema.ts b/src/schemas/uncategorised/MemberNickChangeSchema.ts
index 45890560..45890560 100644 --- a/src/schemas/MemberNickChangeSchema.ts +++ b/src/schemas/uncategorised/MemberNickChangeSchema.ts
diff --git a/src/schemas/MessageAcknowledgeSchema.ts b/src/schemas/uncategorised/MessageAcknowledgeSchema.ts
index 3ba71649..3ba71649 100644 --- a/src/schemas/MessageAcknowledgeSchema.ts +++ b/src/schemas/uncategorised/MessageAcknowledgeSchema.ts
diff --git a/src/schemas/MessageCreateSchema.ts b/src/schemas/uncategorised/MessageCreateSchema.ts
index f5037d66..8d278fc8 100644 --- a/src/schemas/MessageCreateSchema.ts +++ b/src/schemas/uncategorised/MessageCreateSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ActionRowComponent, Embed, PollAnswer, PollMedia } from "@spacebar/util"; +import { ActionRowComponent, Embed, PollAnswer, PollMedia } from "@spacebar/schemas" export type MessageCreateAttachment = { id: string; diff --git a/src/schemas/MessageEditSchema.ts b/src/schemas/uncategorised/MessageEditSchema.ts
index 002e5af9..002e5af9 100644 --- a/src/schemas/MessageEditSchema.ts +++ b/src/schemas/uncategorised/MessageEditSchema.ts
diff --git a/src/schemas/MfaCodesSchema.ts b/src/schemas/uncategorised/MfaCodesSchema.ts
index 1f66f08c..1f66f08c 100644 --- a/src/schemas/MfaCodesSchema.ts +++ b/src/schemas/uncategorised/MfaCodesSchema.ts
diff --git a/src/schemas/ModifyGuildStickerSchema.ts b/src/schemas/uncategorised/ModifyGuildStickerSchema.ts
index 95eb5415..95eb5415 100644 --- a/src/schemas/ModifyGuildStickerSchema.ts +++ b/src/schemas/uncategorised/ModifyGuildStickerSchema.ts
diff --git a/src/schemas/PasswordResetSchema.ts b/src/schemas/uncategorised/PasswordResetSchema.ts
index 15489a91..15489a91 100644 --- a/src/schemas/PasswordResetSchema.ts +++ b/src/schemas/uncategorised/PasswordResetSchema.ts
diff --git a/src/schemas/PreloadMessagesRequestSchema.ts b/src/schemas/uncategorised/PreloadMessagesRequestSchema.ts
index 7c5145b7..7c5145b7 100644 --- a/src/schemas/PreloadMessagesRequestSchema.ts +++ b/src/schemas/uncategorised/PreloadMessagesRequestSchema.ts
diff --git a/src/schemas/PruneSchema.ts b/src/schemas/uncategorised/PruneSchema.ts
index 88d2f6ec..88d2f6ec 100644 --- a/src/schemas/PruneSchema.ts +++ b/src/schemas/uncategorised/PruneSchema.ts
diff --git a/src/schemas/PurgeSchema.ts b/src/schemas/uncategorised/PurgeSchema.ts
index 2e887998..2e887998 100644 --- a/src/schemas/PurgeSchema.ts +++ b/src/schemas/uncategorised/PurgeSchema.ts
diff --git a/src/schemas/RefreshUrlsRequestSchema.ts b/src/schemas/uncategorised/RefreshUrlsRequestSchema.ts
index 9c1df548..9c1df548 100644 --- a/src/schemas/RefreshUrlsRequestSchema.ts +++ b/src/schemas/uncategorised/RefreshUrlsRequestSchema.ts
diff --git a/src/schemas/RegisterSchema.ts b/src/schemas/uncategorised/RegisterSchema.ts
index cfee0f02..cfee0f02 100644 --- a/src/schemas/RegisterSchema.ts +++ b/src/schemas/uncategorised/RegisterSchema.ts
diff --git a/src/schemas/RelationshipPostSchema.ts b/src/schemas/uncategorised/RelationshipPostSchema.ts
index 066ecfd8..066ecfd8 100644 --- a/src/schemas/RelationshipPostSchema.ts +++ b/src/schemas/uncategorised/RelationshipPostSchema.ts
diff --git a/src/schemas/RelationshipPutSchema.ts b/src/schemas/uncategorised/RelationshipPutSchema.ts
index 36d9877d..4d2438ee 100644 --- a/src/schemas/RelationshipPutSchema.ts +++ b/src/schemas/uncategorised/RelationshipPutSchema.ts
@@ -16,8 +16,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { RelationshipType } from "@spacebar/util"; - export interface RelationshipPutSchema { type?: RelationshipType; } + +export enum RelationshipType { + outgoing = 4, + incoming = 3, + blocked = 2, + friends = 1, +} \ No newline at end of file diff --git a/src/schemas/RequestGuildMembersSchema.ts b/src/schemas/uncategorised/RequestGuildMembersSchema.ts
index 9e60d26e..9e60d26e 100644 --- a/src/schemas/RequestGuildMembersSchema.ts +++ b/src/schemas/uncategorised/RequestGuildMembersSchema.ts
diff --git a/src/schemas/RoleModifySchema.ts b/src/schemas/uncategorised/RoleModifySchema.ts
index a6d18931..a6d18931 100644 --- a/src/schemas/RoleModifySchema.ts +++ b/src/schemas/uncategorised/RoleModifySchema.ts
diff --git a/src/schemas/RolePositionUpdateSchema.ts b/src/schemas/uncategorised/RolePositionUpdateSchema.ts
index 6bfd7f32..6bfd7f32 100644 --- a/src/schemas/RolePositionUpdateSchema.ts +++ b/src/schemas/uncategorised/RolePositionUpdateSchema.ts
diff --git a/src/schemas/SelectProtocolSchema.ts b/src/schemas/uncategorised/SelectProtocolSchema.ts
index d04adf71..d04adf71 100644 --- a/src/schemas/SelectProtocolSchema.ts +++ b/src/schemas/uncategorised/SelectProtocolSchema.ts
diff --git a/src/schemas/SettingsProtoUpdateSchema.ts b/src/schemas/uncategorised/SettingsProtoUpdateSchema.ts
index 2b930bc0..2b930bc0 100644 --- a/src/schemas/SettingsProtoUpdateSchema.ts +++ b/src/schemas/uncategorised/SettingsProtoUpdateSchema.ts
diff --git a/src/schemas/TeamCreateSchema.ts b/src/schemas/uncategorised/TeamCreateSchema.ts
index 5903a536..5903a536 100644 --- a/src/schemas/TeamCreateSchema.ts +++ b/src/schemas/uncategorised/TeamCreateSchema.ts
diff --git a/src/schemas/TemplateCreateSchema.ts b/src/schemas/uncategorised/TemplateCreateSchema.ts
index 9e562c9b..9e562c9b 100644 --- a/src/schemas/TemplateCreateSchema.ts +++ b/src/schemas/uncategorised/TemplateCreateSchema.ts
diff --git a/src/schemas/TemplateModifySchema.ts b/src/schemas/uncategorised/TemplateModifySchema.ts
index 49b02371..49b02371 100644 --- a/src/schemas/TemplateModifySchema.ts +++ b/src/schemas/uncategorised/TemplateModifySchema.ts
diff --git a/src/schemas/TotpDisableSchema.ts b/src/schemas/uncategorised/TotpDisableSchema.ts
index 29706f48..29706f48 100644 --- a/src/schemas/TotpDisableSchema.ts +++ b/src/schemas/uncategorised/TotpDisableSchema.ts
diff --git a/src/schemas/TotpEnableSchema.ts b/src/schemas/uncategorised/TotpEnableSchema.ts
index a80e06ac..a80e06ac 100644 --- a/src/schemas/TotpEnableSchema.ts +++ b/src/schemas/uncategorised/TotpEnableSchema.ts
diff --git a/src/schemas/TotpSchema.ts b/src/schemas/uncategorised/TotpSchema.ts
index 657b7e71..657b7e71 100644 --- a/src/schemas/TotpSchema.ts +++ b/src/schemas/uncategorised/TotpSchema.ts
diff --git a/src/schemas/UploadAttachmentRequestSchema.ts b/src/schemas/uncategorised/UploadAttachmentRequestSchema.ts
index 60bf89f6..60bf89f6 100644 --- a/src/schemas/UploadAttachmentRequestSchema.ts +++ b/src/schemas/uncategorised/UploadAttachmentRequestSchema.ts
diff --git a/src/schemas/UserDeleteSchema.ts b/src/schemas/uncategorised/UserDeleteSchema.ts
index 40fb778d..40fb778d 100644 --- a/src/schemas/UserDeleteSchema.ts +++ b/src/schemas/uncategorised/UserDeleteSchema.ts
diff --git a/src/schemas/UserGuildSettingsSchema.ts b/src/schemas/uncategorised/UserGuildSettingsSchema.ts
index 82edae9c..82edae9c 100644 --- a/src/schemas/UserGuildSettingsSchema.ts +++ b/src/schemas/uncategorised/UserGuildSettingsSchema.ts
diff --git a/src/schemas/UserModifySchema.ts b/src/schemas/uncategorised/UserModifySchema.ts
index 6d2998eb..6d2998eb 100644 --- a/src/schemas/UserModifySchema.ts +++ b/src/schemas/uncategorised/UserModifySchema.ts
diff --git a/src/schemas/UserNoteUpdateSchema.ts b/src/schemas/uncategorised/UserNoteUpdateSchema.ts
index 0a731279..0a731279 100644 --- a/src/schemas/UserNoteUpdateSchema.ts +++ b/src/schemas/uncategorised/UserNoteUpdateSchema.ts
diff --git a/src/schemas/UserProfileModifySchema.ts b/src/schemas/uncategorised/UserProfileModifySchema.ts
index 3dea257a..3dea257a 100644 --- a/src/schemas/UserProfileModifySchema.ts +++ b/src/schemas/uncategorised/UserProfileModifySchema.ts
diff --git a/src/schemas/uncategorised/UserSettingsSchema.ts b/src/schemas/uncategorised/UserSettingsSchema.ts new file mode 100644
index 00000000..b9d0ec8a --- /dev/null +++ b/src/schemas/uncategorised/UserSettingsSchema.ts
@@ -0,0 +1,71 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export interface UserSettingsSchema { + afk_timeout: number; + allow_accessibility_detection: boolean; + animate_emoji: boolean; + animate_stickers: number; + contact_sync_enabled: boolean; + convert_emoticons: boolean; + custom_status: CustomStatus | null; + default_guilds_restricted: boolean; + detect_platform_accounts: boolean; + developer_mode: boolean; + disable_games_tab: boolean; + enable_tts_command: boolean; + explicit_content_filter: number; + friend_discovery_flags: number; + friend_source_flags: FriendSourceFlags; + gateway_connected: boolean; + gif_auto_play: boolean; + guild_folders: GuildFolder[]; // every top guild is displayed as a "folder" + guild_positions: string[]; // guild ids ordered by position + inline_attachment_media: boolean; + inline_embed_media: boolean; + locale: string; // en_US + message_display_compact: boolean; + native_phone_integration_enabled: boolean; + render_embeds: boolean; + render_reactions: boolean; + restricted_guilds: string[]; + show_current_game: boolean; + status: "online" | "offline" | "dnd" | "idle" | "invisible"; + stream_notifications_enabled: boolean; + theme: "dark" | "light"; // dark + timezone_offset: number; // e.g -60 + view_nsfw_guilds: boolean +} + +export interface CustomStatus { + emoji_id?: string; + emoji_name?: string; + expires_at?: number; + text?: string; +} + +export interface GuildFolder { + color: number; + guild_ids: string[]; + id: number; + name: string; +} + +export interface FriendSourceFlags { + all: boolean; +} \ No newline at end of file diff --git a/src/schemas/VanityUrlSchema.ts b/src/schemas/uncategorised/VanityUrlSchema.ts
index 12d5abd6..12d5abd6 100644 --- a/src/schemas/VanityUrlSchema.ts +++ b/src/schemas/uncategorised/VanityUrlSchema.ts
diff --git a/src/schemas/VerifyEmailSchema.ts b/src/schemas/uncategorised/VerifyEmailSchema.ts
index ce297c5d..ce297c5d 100644 --- a/src/schemas/VerifyEmailSchema.ts +++ b/src/schemas/uncategorised/VerifyEmailSchema.ts
diff --git a/src/schemas/VoiceStateUpdateSchema.ts b/src/schemas/uncategorised/VoiceStateUpdateSchema.ts
index fda073e9..fda073e9 100644 --- a/src/schemas/VoiceStateUpdateSchema.ts +++ b/src/schemas/uncategorised/VoiceStateUpdateSchema.ts
diff --git a/src/schemas/WebAuthnSchema.ts b/src/schemas/uncategorised/WebAuthnSchema.ts
index 3f5e0da7..3f5e0da7 100644 --- a/src/schemas/WebAuthnSchema.ts +++ b/src/schemas/uncategorised/WebAuthnSchema.ts
diff --git a/src/schemas/WebhookCreateSchema.ts b/src/schemas/uncategorised/WebhookCreateSchema.ts
index 7bd0afa8..7bd0afa8 100644 --- a/src/schemas/WebhookCreateSchema.ts +++ b/src/schemas/uncategorised/WebhookCreateSchema.ts
diff --git a/src/schemas/WebhookExecuteSchema.ts b/src/schemas/uncategorised/WebhookExecuteSchema.ts
index b50a4cf6..d95606c3 100644 --- a/src/schemas/WebhookExecuteSchema.ts +++ b/src/schemas/uncategorised/WebhookExecuteSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Embed } from "../util/entities"; +import { Embed } from "@spacebar/schemas" import { MessageCreateAttachment, PollCreationSchema, diff --git a/src/schemas/WebhookUpdateSchema.ts b/src/schemas/uncategorised/WebhookUpdateSchema.ts
index bc276e44..bc276e44 100755 --- a/src/schemas/WebhookUpdateSchema.ts +++ b/src/schemas/uncategorised/WebhookUpdateSchema.ts
diff --git a/src/schemas/WidgetModifySchema.ts b/src/schemas/uncategorised/WidgetModifySchema.ts
index 50794d6f..50794d6f 100644 --- a/src/schemas/WidgetModifySchema.ts +++ b/src/schemas/uncategorised/WidgetModifySchema.ts
diff --git a/src/schemas/uncategorised/index.ts b/src/schemas/uncategorised/index.ts new file mode 100644
index 00000000..c0ebde0d --- /dev/null +++ b/src/schemas/uncategorised/index.ts
@@ -0,0 +1,93 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ +export * from "./AckBulkSchema"; +export * from "./ActivitySchema"; +export * from "./ApplicationAuthorizeSchema"; +export * from "./AutomodRuleSchema"; +export * from "./BackupCodesChallengeSchema"; +export * from "./BanCreateSchema"; +export * from "./BanModeratorSchema"; +export * from "./BanRegistrySchema"; +export * from "./BotModifySchema"; +export * from "./BulkBanSchema"; +export * from "./BulkDeleteSchema"; +export * from "./ChannelModifySchema"; +export * from "./ChannelPermissionOverwriteSchema"; +export * from "./ChannelReorderSchema"; +export * from "./CodesVerificationSchema"; +export * from "./ConnectedAccountSchema"; +export * from "./ConnectionCallbackSchema"; +export * from "./ConnectionUpdateSchema"; +export * from "./DmChannelCreateSchema"; +export * from "./EmailDomainLookupSchema"; +export * from "./EmailDomainLookupVerifyCodeSchema"; +export * from "./EmojiCreateSchema"; +export * from "./EmojiModifySchema"; +export * from "./ForgotPasswordSchema"; +export * from "./GreetRequestSchema"; +export * from "./GuildCreateSchema"; +export * from "./GuildSubscriptionsBulkSchema"; +export * from "./GuildTemplateCreateSchema"; +export * from "./GuildUpdateSchema"; +export * from "./GuildUpdateWelcomeScreenSchema"; +export * from "./HubWaitlistSignupSchema"; +export * from "./InviteCreateSchema"; +export * from "./LoginResponse"; +export * from "./LoginSchema"; +export * from "./MemberChangeProfileSchema"; +export * from "./MemberChangeSchema"; +export * from "./MemberNickChangeSchema"; +export * from "./MessageAcknowledgeSchema"; +export * from "./MessageCreateSchema"; +export * from "./MessageEditSchema"; +export * from "./MfaCodesSchema"; +export * from "./ModifyGuildStickerSchema"; +export * from "./PasswordResetSchema"; +export * from "./PreloadMessagesRequestSchema"; +export * from "./PruneSchema"; +export * from "./PurgeSchema"; +export * from "./RefreshUrlsRequestSchema"; +export * from "./RegisterSchema"; +export * from "./RelationshipPostSchema"; +export * from "./RelationshipPutSchema"; +export * from "./RequestGuildMembersSchema"; +export * from "./RoleModifySchema"; +export * from "./RolePositionUpdateSchema"; +export * from "./SelectProtocolSchema"; +export * from "./SettingsProtoUpdateSchema"; +export * from "./TeamCreateSchema"; +export * from "./TemplateCreateSchema"; +export * from "./TemplateModifySchema"; +export * from "./TotpDisableSchema"; +export * from "./TotpEnableSchema"; +export * from "./TotpSchema"; +export * from "./UploadAttachmentRequestSchema"; +export * from "./UserDeleteSchema"; +export * from "./UserGuildSettingsSchema"; +export * from "./UserModifySchema"; +export * from "./UserNoteUpdateSchema"; +export * from "./UserProfileModifySchema"; +export * from "./UserSettingsSchema"; +export * from "./VanityUrlSchema"; +export * from "./VerifyEmailSchema"; +export * from "./VoiceStateUpdateSchema"; +export * from "./WebAuthnSchema"; +export * from "./WebhookCreateSchema"; +export * from "./WebhookExecuteSchema"; +export * from "./WebhookUpdateSchema"; +export * from "./WidgetModifySchema"; diff --git a/src/schemas/VoiceIdentifySchema.ts b/src/schemas/webrtc/VoiceIdentifySchema.ts
index 82f846c3..82f846c3 100644 --- a/src/schemas/VoiceIdentifySchema.ts +++ b/src/schemas/webrtc/VoiceIdentifySchema.ts
diff --git a/src/schemas/VoiceVideoSchema.ts b/src/schemas/webrtc/VoiceVideoSchema.ts
index c621431b..c621431b 100644 --- a/src/schemas/VoiceVideoSchema.ts +++ b/src/schemas/webrtc/VoiceVideoSchema.ts
diff --git a/src/schemas/webrtc/index.ts b/src/schemas/webrtc/index.ts new file mode 100644
index 00000000..7be4af62 --- /dev/null +++ b/src/schemas/webrtc/index.ts
@@ -0,0 +1,19 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ +export * from "./VoiceIdentifySchema"; +export * from "./VoiceVideoSchema"; diff --git a/src/util/entities/EmbedCache.ts b/src/util/entities/EmbedCache.ts
index f9358b5b..2b481ad9 100644 --- a/src/util/entities/EmbedCache.ts +++ b/src/util/entities/EmbedCache.ts
@@ -18,7 +18,7 @@ import { BaseClass } from "./BaseClass"; import { Entity, Column } from "typeorm"; -import { Embed } from "./Message"; +import { Embed } from "@spacebar/schemas"; @Entity({ name: "embed_cache", diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts
index fcb9fbe8..6a383f21 100644 --- a/src/util/entities/Message.ts +++ b/src/util/entities/Message.ts
@@ -22,52 +22,14 @@ import { Role } from "./Role"; import { Channel } from "./Channel"; import { InteractionType } from "../interfaces/Interaction"; import { Application } from "./Application"; -import { - Column, - CreateDateColumn, - Entity, - Index, - JoinColumn, - JoinTable, - ManyToMany, - ManyToOne, - OneToMany, - RelationId, -} from "typeorm"; +import { Column, CreateDateColumn, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, RelationId } from "typeorm"; import { BaseClass } from "./BaseClass"; import { Guild } from "./Guild"; import { Webhook } from "./Webhook"; import { Sticker } from "./Sticker"; import { Attachment } from "./Attachment"; import { NewUrlUserSignatureData } from "../Signing"; - -export enum MessageType { - DEFAULT = 0, - RECIPIENT_ADD = 1, - RECIPIENT_REMOVE = 2, - CALL = 3, - CHANNEL_NAME_CHANGE = 4, - CHANNEL_ICON_CHANGE = 5, - CHANNEL_PINNED_MESSAGE = 6, - GUILD_MEMBER_JOIN = 7, - USER_PREMIUM_GUILD_SUBSCRIPTION = 8, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11, - CHANNEL_FOLLOW_ADD = 12, - ACTION = 13, // /me messages - GUILD_DISCOVERY_DISQUALIFIED = 14, - GUILD_DISCOVERY_REQUALIFIED = 15, - ENCRYPTED = 16, - REPLY = 19, - APPLICATION_COMMAND = 20, // application command or self command invocation - ROUTE_ADDED = 41, // custom message routing: new route affecting that channel - ROUTE_DISABLED = 42, // custom message routing: given route no longer affecting that channel - SELF_COMMAND_SCRIPT = 43, // self command scripts - ENCRYPTION = 50, - CUSTOM_START = 63, - UNHANDLED = 255, -} +import { ActionRowComponent, Embed, MessageType, PartialMessage, Poll, Reaction } from "@spacebar/schemas"; @Entity({ name: "messages", @@ -164,14 +126,10 @@ export class Message extends BaseClass { @ManyToMany(() => Sticker, { cascade: true, onDelete: "CASCADE" }) sticker_items?: Sticker[]; - @OneToMany( - () => Attachment, - (attachment: Attachment) => attachment.message, - { - cascade: true, - orphanedRowAction: "delete", - }, - ) + @OneToMany(() => Attachment, (attachment: Attachment) => attachment.message, { + cascade: true, + orphanedRowAction: "delete", + }) attachments?: Attachment[]; @Column({ type: "simple-json" }) @@ -270,232 +228,21 @@ export class Message extends BaseClass { return { id: this.id, // lobby_id: this.lobby_id, - channel_id: this.channel_id, + channel_id: this.channel_id!, type: this.type, - content: this.content, - author: this.author, + content: this.content!, + author: {...this.author!, avatar: this.author?.avatar ?? null }, flags: this.flags, application_id: this.application_id, - channel: this.channel, + //channel: this.channel, // TODO: ephemeral DM channels // recipient_id: this.recipient_id, // TODO: ephemeral DM channels - } + }; } withSignedAttachments(data: NewUrlUserSignatureData) { return { ...this, - attachments: this.attachments?.map((attachment: Attachment) => - Attachment.prototype.signUrls.call(attachment, data), - ), + attachments: this.attachments?.map((attachment: Attachment) => Attachment.prototype.signUrls.call(attachment, data)), }; } } - -/** - * https://docs.discord.food/resources/message#partial-message-structure - */ -export type PartialMessage = Pick<Message, "id"> - // & Pick<Message, "lobby_id"> - & Pick<Message, "channel_id"> - & Pick<Message, "type"> - & Pick<Message, "content"> - & Pick<Message, "author"> - & Pick<Message, "flags"> - & Pick<Message, "application_id"> - & { channel?: Channel } -// & Pick<Message, "recipient_id"> // TODO: ephemeral DM channels - ; - -export interface MessageComponent { - type: MessageComponentType; -} - -export interface ActionRowComponent extends MessageComponent { - type: MessageComponentType.ActionRow; - components: ( - | ButtonComponent - | StringSelectMenuComponent - | SelectMenuComponent - | TextInputComponent - )[]; -} - -export interface ButtonComponent extends MessageComponent { - type: MessageComponentType.Button; - style: ButtonStyle; - label?: string; - emoji?: PartialEmoji; - custom_id?: string; - sku_id?: string; - url?: string; - disabled?: boolean; -} - -export enum ButtonStyle { - Primary = 1, - Secondary = 2, - Success = 3, - Danger = 4, - Link = 5, - Premium = 6, -} - -export interface SelectMenuComponent extends MessageComponent { - type: - | MessageComponentType.StringSelect - | MessageComponentType.UserSelect - | MessageComponentType.RoleSelect - | MessageComponentType.MentionableSelect - | MessageComponentType.ChannelSelect; - custom_id: string; - channel_types?: number[]; - placeholder?: string; - default_values?: SelectMenuDefaultOption[]; // only for non-string selects - min_values?: number; - max_values?: number; - disabled?: boolean; -} - -export interface SelectMenuOption { - label: string; - value: string; - description?: string; - emoji?: PartialEmoji; - default?: boolean; -} - -export interface SelectMenuDefaultOption { - id: string; - type: "user" | "role" | "channel"; -} - -export interface StringSelectMenuComponent extends SelectMenuComponent { - type: MessageComponentType.StringSelect; - options: SelectMenuOption[]; -} - -export interface TextInputComponent extends MessageComponent { - type: MessageComponentType.TextInput; - custom_id: string; - style: TextInputStyle; - label: string; - min_length?: number; - max_length?: number; - required?: boolean; - value?: string; - placeholder?: string; -} - -export enum TextInputStyle { - Short = 1, - Paragraph = 2, -} - -export enum MessageComponentType { - Script = 0, // self command script - ActionRow = 1, - Button = 2, - StringSelect = 3, - TextInput = 4, - UserSelect = 5, - RoleSelect = 6, - MentionableSelect = 7, - ChannelSelect = 8, -} - -export interface Embed { - title?: string; //title of embed - type?: EmbedType; // type of embed (always "rich" for webhook embeds) - description?: string; // description of embed - url?: string; // url of embed - timestamp?: Date; // timestamp of embed content - color?: number; // color code of the embed - footer?: { - text: string; - icon_url?: string; - proxy_icon_url?: string; - }; // footer object footer information - image?: EmbedImage; // image object image information - thumbnail?: EmbedImage; // thumbnail object thumbnail information - video?: EmbedImage; // video object video information - provider?: { - name?: string; - url?: string; - }; // provider object provider information - author?: { - name?: string; - url?: string; - icon_url?: string; - proxy_icon_url?: string; - }; // author object author information - fields?: { - name: string; - value: string; - inline?: boolean; - }[]; -} - -export enum EmbedType { - rich = "rich", - image = "image", - video = "video", - gifv = "gifv", - article = "article", - link = "link", -} - -export interface EmbedImage { - url?: string; - proxy_url?: string; - height?: number; - width?: number; -} - -export interface Reaction { - count: number; - //// not saved in the database // me: boolean; // whether the current user reacted using this emoji - emoji: PartialEmoji; - user_ids: string[]; -} - -export interface PartialEmoji { - id?: string; - name: string; - animated?: boolean; -} - -export interface AllowedMentions { - parse?: ("users" | "roles" | "everyone")[]; - roles?: string[]; - users?: string[]; - replied_user?: boolean; -} - -export interface Poll { - question: PollMedia; - answers: PollAnswer[]; - expiry: Date; - allow_multiselect: boolean; - results?: PollResult; -} - -export interface PollMedia { - text?: string; - emoji?: PartialEmoji; -} - -export interface PollAnswer { - answer_id?: string; - poll_media: PollMedia; -} - -export interface PollResult { - is_finalized: boolean; - answer_counts: PollAnswerCount[]; -} - -export interface PollAnswerCount { - id: string; - count: number; - me_voted: boolean; -} diff --git a/src/util/entities/Relationship.ts b/src/util/entities/Relationship.ts
index 0fe89c35..0d787ff2 100644 --- a/src/util/entities/Relationship.ts +++ b/src/util/entities/Relationship.ts
@@ -26,13 +26,7 @@ import { } from "typeorm"; import { BaseClass } from "./BaseClass"; import { User } from "./User"; - -export enum RelationshipType { - outgoing = 4, - incoming = 3, - blocked = 2, - friends = 1, -} +import { RelationshipType } from "@spacebar/schemas"; @Entity({ name: "relationships", diff --git a/src/util/entities/UserSettings.ts b/src/util/entities/UserSettings.ts
index b7b455f0..b5e91355 100644 --- a/src/util/entities/UserSettings.ts +++ b/src/util/entities/UserSettings.ts
@@ -19,6 +19,7 @@ import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"; import { BaseClassWithoutId } from "./BaseClass"; import { User } from "./User"; +import { CustomStatus, FriendSourceFlags, GuildFolder } from "@spacebar/schemas" @Entity({ name: "user_settings", @@ -142,21 +143,3 @@ export class UserSettings extends BaseClassWithoutId { return settings; } } - -interface CustomStatus { - emoji_id?: string; - emoji_name?: string; - expires_at?: number; - text?: string; -} - -interface GuildFolder { - color: number; - guild_ids: string[]; - id: number; - name: string; -} - -interface FriendSourceFlags { - all: boolean; -} diff --git a/src/util/entities/index.ts b/src/util/entities/index.ts
index 4c95e83a..38190a44 100644 --- a/src/util/entities/index.ts +++ b/src/util/entities/index.ts
@@ -27,6 +27,7 @@ export * from "./BaseClass"; export * from "./Categories"; export * from "./Channel"; export * from "./ClientRelease"; +export * from "./CloudAttachment"; export * from "./Config"; export * from "./ConnectedAccount"; export * from "./ConnectionConfigEntity"; diff --git a/src/util/index.ts b/src/util/index.ts
index f2b526e0..dd2f7f32 100644 --- a/src/util/index.ts +++ b/src/util/index.ts
@@ -24,7 +24,6 @@ export * from "./util/index"; export * from "./interfaces/index"; export * from "./entities/index"; export * from "./dtos/index"; -export * from "@spacebar/schemas*"; export * from "./imports"; export * from "./config"; export * from "./connections"; diff --git a/src/util/interfaces/Event.ts b/src/util/interfaces/Event.ts
index 6692d33e..2e9ba525 100644 --- a/src/util/interfaces/Event.ts +++ b/src/util/interfaces/Event.ts
@@ -17,12 +17,10 @@ */ import { - RelationshipType, ConnectedAccount, Interaction, ApplicationCommand, Message, - PartialEmoji, Invite, Role, Emoji, @@ -41,10 +39,10 @@ import { ReadyUserGuildSettingsEntries, ReadyPrivateChannel, GuildOrUnavailable, - GuildCreateResponse, PublicVoiceState, } from "@spacebar/util"; import { JsonValue } from "@protobuf-ts/runtime"; +import { GuildCreateResponse, PartialEmoji, RelationshipType } from "@spacebar/schemas" export interface Event { guild_id?: string; diff --git a/src/util/interfaces/Interaction.ts b/src/util/interfaces/Interaction.ts
index d1295cf4..29fc931d 100644 --- a/src/util/interfaces/Interaction.ts +++ b/src/util/interfaces/Interaction.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { AllowedMentions, Embed } from "../entities/Message"; +import { Embed, AllowedMentions } from "@spacebar/schemas"; export interface Interaction { id: string; diff --git a/src/util/util/Gifs.ts b/src/util/util/Gifs.ts
index a5a5e64c..23152e81 100644 --- a/src/util/util/Gifs.ts +++ b/src/util/util/Gifs.ts
@@ -1,6 +1,6 @@ import { HTTPError } from "lambert-server"; import { Config } from "./Config"; -import { TenorGif } from ".."; +import { TenorGif } from "@spacebar/schemas"; export function parseGifResult(result: TenorGif) { return { diff --git a/src/webrtc/opcodes/Identify.ts b/src/webrtc/opcodes/Identify.ts
index 29b85e1d..3abb26d6 100644 --- a/src/webrtc/opcodes/Identify.ts +++ b/src/webrtc/opcodes/Identify.ts
@@ -19,11 +19,13 @@ import { CLOSECODES } from "@spacebar/gateway"; import { StreamSession, - validateSchema, - VoiceIdentifySchema, VoiceState, } from "@spacebar/util"; import { + validateSchema, + VoiceIdentifySchema, +} from "@spacebar/schemas"; +import { generateSsrc, mediaServer, Send, diff --git a/src/webrtc/opcodes/SelectProtocol.ts b/src/webrtc/opcodes/SelectProtocol.ts
index 4a2ee85d..2aa841f2 100644 --- a/src/webrtc/opcodes/SelectProtocol.ts +++ b/src/webrtc/opcodes/SelectProtocol.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { SelectProtocolSchema, validateSchema } from "@spacebar/util"; +import { SelectProtocolSchema, validateSchema } from "@spacebar/schemas"; import { VoiceOPCodes, VoicePayload, diff --git a/src/webrtc/opcodes/Video.ts b/src/webrtc/opcodes/Video.ts
index 2b327a00..1309fc4f 100644 --- a/src/webrtc/opcodes/Video.ts +++ b/src/webrtc/opcodes/Video.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Stream, validateSchema, VoiceVideoSchema } from "@spacebar/util"; +import { Stream } from "@spacebar/util"; import { mediaServer, Send, @@ -24,6 +24,7 @@ import { WebRtcWebSocket, } from "@spacebar/webrtc"; import type { WebRtcClient } from "@spacebarchat/spacebar-webrtc-types"; +import { validateSchema, VoiceVideoSchema } from "@spacebar/schemas"; export async function onVideo(this: WebRtcWebSocket, payload: VoicePayload) { if (!this.webRtcClient) return;