summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-03-14 05:43:24 +0100
committerRory& <root@rory.gay>2026-03-14 05:43:42 +0100
commit8bb0b84b5e2260dc9bbd6cf90ca4dddeb91b1a02 (patch)
treea9206491206888ed464353c3c5570620b2ea3352 /src
parentRemove unused imports for entities (diff)
downloadserver-ts-8bb0b84b5e2260dc9bbd6cf90ca4dddeb91b1a02.tar.xz
Shorten imports
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/channels/#channel_id/messages/#message_id/index.ts2
-rw-r--r--src/api/routes/connections/#connection_name/authorize.ts2
-rw-r--r--src/api/routes/guilds/#guild_id/widget.png.ts2
-rw-r--r--src/cdn/routes/app-assets.ts2
-rw-r--r--src/cdn/routes/app-icons.ts2
-rw-r--r--src/cdn/routes/attachments.ts4
-rw-r--r--src/cdn/routes/avatar-decoration-presets.ts2
-rw-r--r--src/cdn/routes/avatars.ts2
-rw-r--r--src/cdn/routes/badge-icons.ts2
-rw-r--r--src/cdn/routes/banners.ts2
-rw-r--r--src/cdn/routes/channel-icons.ts2
-rw-r--r--src/cdn/routes/discover-splashes.ts2
-rw-r--r--src/cdn/routes/discovery-splashes.ts2
-rw-r--r--src/cdn/routes/emojis.ts2
-rw-r--r--src/cdn/routes/guild-profiles.ts2
-rw-r--r--src/cdn/routes/icons.ts2
-rw-r--r--src/cdn/routes/role-icons.ts2
-rw-r--r--src/cdn/routes/splashes.ts2
-rw-r--r--src/cdn/routes/stickers.ts2
-rw-r--r--src/cdn/routes/team-icons.ts2
-rw-r--r--src/cdn/util/basicCrdFileRouter.ts2
-rw-r--r--src/connections/BattleNet/index.ts4
-rw-r--r--src/connections/Discord/index.ts4
-rw-r--r--src/connections/EpicGames/index.ts4
-rw-r--r--src/connections/Facebook/index.ts4
-rw-r--r--src/connections/GitHub/index.ts4
-rw-r--r--src/connections/Reddit/index.ts4
-rw-r--r--src/connections/Spotify/index.ts4
-rw-r--r--src/connections/Twitch/index.ts4
-rw-r--r--src/connections/Twitter/index.ts4
-rw-r--r--src/connections/Xbox/index.ts4
-rw-r--r--src/connections/Youtube/index.ts4
-rw-r--r--src/gateway/Server.ts2
-rw-r--r--src/gateway/listener/listener.ts4
-rw-r--r--src/gateway/opcodes/VoiceStateUpdate.ts2
-rw-r--r--src/schemas/gateway/LazyRequestSchema.ts29
-rw-r--r--src/schemas/responses/AccountStandingResponse.ts3
-rw-r--r--src/schemas/responses/DiscoverableGuildsResponse.ts3
-rw-r--r--src/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts3
-rw-r--r--src/schemas/responses/GuildMessagesSearchResponse.ts3
-rw-r--r--src/schemas/responses/GuildRecommendationsResponse.ts3
-rw-r--r--src/schemas/responses/HubDirectoryEntriesResponse.ts3
-rw-r--r--src/schemas/responses/MemberJoinGuildResponse.ts2
-rw-r--r--src/schemas/responses/TokenResponse.ts3
-rw-r--r--src/schemas/responses/TypedResponses.ts3
-rw-r--r--src/schemas/responses/WebhookCreateResponse.ts3
-rw-r--r--src/schemas/uncategorised/ConnectedAccountSchema.ts20
-rw-r--r--src/schemas/uncategorised/GuildSubscriptionsBulkSchema.ts31
-rw-r--r--src/util/connections/ConnectionConfig.ts2
-rw-r--r--src/util/connections/RefreshableConnection.ts2
-rw-r--r--src/util/entities/Attachment.ts2
-rw-r--r--src/util/entities/BaseClass.ts7
-rw-r--r--src/util/entities/ConnectedAccount.ts2
-rw-r--r--src/util/entities/Member.ts3
-rw-r--r--src/util/entities/Message.ts2
-rw-r--r--src/util/interfaces/ConnectedAccount.ts18
-rw-r--r--src/util/util/Config.ts2
-rw-r--r--src/webrtc/Server.ts2
58 files changed, 124 insertions, 123 deletions
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 96ff98e1..233d1381 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
@@ -34,7 +34,7 @@ import { import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import multer from "multer"; -import { handleMessage, postHandleMessage, route } from "../../../../../util"; +import { handleMessage, postHandleMessage, route } from "@spacebar/api"; import { MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageEditSchema, ChannelType } from "@spacebar/schemas"; const router = Router({ mergeParams: true }); diff --git a/src/api/routes/connections/#connection_name/authorize.ts b/src/api/routes/connections/#connection_name/authorize.ts
index b74fd861..7d3d03eb 100644 --- a/src/api/routes/connections/#connection_name/authorize.ts +++ b/src/api/routes/connections/#connection_name/authorize.ts
@@ -18,7 +18,7 @@ import { route } from "@spacebar/api"; import { Request, Response, Router } from "express"; -import { ConnectionStore, FieldErrors } from "../../../../util"; +import { ConnectionStore, FieldErrors } from "@spacebar/util"; const router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/widget.png.ts b/src/api/routes/guilds/#guild_id/widget.png.ts
index 875761e6..ee623214 100644 --- a/src/api/routes/guilds/#guild_id/widget.png.ts +++ b/src/api/routes/guilds/#guild_id/widget.png.ts
@@ -24,7 +24,7 @@ import { Request, Response, Router } from "express"; import fs from "fs"; import { HTTPError } from "lambert-server"; import path from "path"; -import { storage } from "../../../../cdn/util/Storage"; +import { storage } from "@spacebar/cdn"; const router: Router = Router({ mergeParams: true }); diff --git a/src/cdn/routes/app-assets.ts b/src/cdn/routes/app-assets.ts
index 572cb3aa..149d8b35 100644 --- a/src/cdn/routes/app-assets.ts +++ b/src/cdn/routes/app-assets.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/app-icons.ts b/src/cdn/routes/app-icons.ts
index b8ab98b9..b67bc1fb 100644 --- a/src/cdn/routes/app-icons.ts +++ b/src/cdn/routes/app-icons.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/attachments.ts b/src/cdn/routes/attachments.ts
index 86a7f0c8..87d96a4c 100644 --- a/src/cdn/routes/attachments.ts +++ b/src/cdn/routes/attachments.ts
@@ -21,8 +21,8 @@ import { Request, Response, Router } from "express"; import imageSize from "image-size"; import { HTTPError } from "lambert-server"; import { multer } from "../util/multer"; -import { storage } from "../util/Storage"; -import { CloudAttachment } from "../../util/entities/CloudAttachment"; +import { storage } from "@spacebar/cdn"; +import { CloudAttachment } from "@spacebar/util"; import { fileTypeFromBuffer } from "file-type"; import { cache } from "../util/cache"; diff --git a/src/cdn/routes/avatar-decoration-presets.ts b/src/cdn/routes/avatar-decoration-presets.ts
index 736a281d..591e0ab1 100644 --- a/src/cdn/routes/avatar-decoration-presets.ts +++ b/src/cdn/routes/avatar-decoration-presets.ts
@@ -17,7 +17,7 @@ */ import { Router, Response, Request } from "express"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { HTTPError } from "lambert-server"; import { fileTypeFromBuffer } from "file-type"; import { cache } from "../util/cache"; diff --git a/src/cdn/routes/avatars.ts b/src/cdn/routes/avatars.ts
index 793bc45b..f2d539bd 100644 --- a/src/cdn/routes/avatars.ts +++ b/src/cdn/routes/avatars.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/badge-icons.ts b/src/cdn/routes/badge-icons.ts
index 829baeb1..33134e1a 100644 --- a/src/cdn/routes/badge-icons.ts +++ b/src/cdn/routes/badge-icons.ts
@@ -17,7 +17,7 @@ */ import { Router, Response, Request } from "express"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { HTTPError } from "lambert-server"; import { fileTypeFromBuffer } from "file-type"; import { cache } from "../util/cache"; diff --git a/src/cdn/routes/banners.ts b/src/cdn/routes/banners.ts
index 211643f9..979bdad0 100644 --- a/src/cdn/routes/banners.ts +++ b/src/cdn/routes/banners.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/channel-icons.ts b/src/cdn/routes/channel-icons.ts
index 946759dd..3b85d4e4 100644 --- a/src/cdn/routes/channel-icons.ts +++ b/src/cdn/routes/channel-icons.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/discover-splashes.ts b/src/cdn/routes/discover-splashes.ts
index d9822feb..e9c07cb1 100644 --- a/src/cdn/routes/discover-splashes.ts +++ b/src/cdn/routes/discover-splashes.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/discovery-splashes.ts b/src/cdn/routes/discovery-splashes.ts
index c9f8ddf7..9d6d81c7 100644 --- a/src/cdn/routes/discovery-splashes.ts +++ b/src/cdn/routes/discovery-splashes.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/emojis.ts b/src/cdn/routes/emojis.ts
index 761ad00e..f11af3ba 100644 --- a/src/cdn/routes/emojis.ts +++ b/src/cdn/routes/emojis.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/guild-profiles.ts b/src/cdn/routes/guild-profiles.ts
index 279b4361..9d27debf 100644 --- a/src/cdn/routes/guild-profiles.ts +++ b/src/cdn/routes/guild-profiles.ts
@@ -21,7 +21,7 @@ import crypto from "crypto"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { multer } from "../util/multer"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { cache } from "../util/cache"; diff --git a/src/cdn/routes/icons.ts b/src/cdn/routes/icons.ts
index c98313f4..6ddd49e9 100644 --- a/src/cdn/routes/icons.ts +++ b/src/cdn/routes/icons.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/role-icons.ts b/src/cdn/routes/role-icons.ts
index 2aaa6197..f169309c 100644 --- a/src/cdn/routes/role-icons.ts +++ b/src/cdn/routes/role-icons.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/splashes.ts b/src/cdn/routes/splashes.ts
index 8a501ec4..a10709d7 100644 --- a/src/cdn/routes/splashes.ts +++ b/src/cdn/routes/splashes.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/stickers.ts b/src/cdn/routes/stickers.ts
index 5821db67..a9206949 100644 --- a/src/cdn/routes/stickers.ts +++ b/src/cdn/routes/stickers.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/routes/team-icons.ts b/src/cdn/routes/team-icons.ts
index 103974da..c0e7e785 100644 --- a/src/cdn/routes/team-icons.ts +++ b/src/cdn/routes/team-icons.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/cdn/util/basicCrdFileRouter.ts b/src/cdn/util/basicCrdFileRouter.ts
index d489f373..7490d546 100644 --- a/src/cdn/util/basicCrdFileRouter.ts +++ b/src/cdn/util/basicCrdFileRouter.ts
@@ -18,7 +18,7 @@ import { Router, Response, Request } from "express"; import { Config, Snowflake } from "@spacebar/util"; -import { storage } from "../util/Storage"; +import { storage } from "@spacebar/cdn"; import { fileTypeFromBuffer } from "file-type"; import { HTTPError } from "lambert-server"; import crypto from "crypto"; diff --git a/src/connections/BattleNet/index.ts b/src/connections/BattleNet/index.ts
index 843ab79b..f7d08cbe 100644 --- a/src/connections/BattleNet/index.ts +++ b/src/connections/BattleNet/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; +import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; import { BattleNetSettings } from "./BattleNetSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; interface BattleNetConnectionUser { sub: string; diff --git a/src/connections/Discord/index.ts b/src/connections/Discord/index.ts
index ab44f4b3..f209a81b 100644 --- a/src/connections/Discord/index.ts +++ b/src/connections/Discord/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; +import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; import { DiscordSettings } from "./DiscordSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; interface UserResponse { id: string; diff --git a/src/connections/EpicGames/index.ts b/src/connections/EpicGames/index.ts
index 69c44cb0..959192e6 100644 --- a/src/connections/EpicGames/index.ts +++ b/src/connections/EpicGames/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; +import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; import { EpicGamesSettings } from "./EpicGamesSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; export interface UserResponse { accountId: string; diff --git a/src/connections/Facebook/index.ts b/src/connections/Facebook/index.ts
index b661cbe8..29317c2e 100644 --- a/src/connections/Facebook/index.ts +++ b/src/connections/Facebook/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; +import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; import { FacebookSettings } from "./FacebookSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; export interface FacebookErrorResponse { error: { diff --git a/src/connections/GitHub/index.ts b/src/connections/GitHub/index.ts
index 42dc0724..df64912a 100644 --- a/src/connections/GitHub/index.ts +++ b/src/connections/GitHub/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; +import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; import { GitHubSettings } from "./GitHubSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; interface UserResponse { login: string; diff --git a/src/connections/Reddit/index.ts b/src/connections/Reddit/index.ts
index 14faf4a6..781e097a 100644 --- a/src/connections/Reddit/index.ts +++ b/src/connections/Reddit/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; +import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; import { RedditSettings } from "./RedditSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; export interface UserResponse { verified: boolean; diff --git a/src/connections/Spotify/index.ts b/src/connections/Spotify/index.ts
index e1381cf2..2186396b 100644 --- a/src/connections/Spotify/index.ts +++ b/src/connections/Spotify/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util"; +import { ConnectedAccount, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util"; import wretch from "wretch"; import { SpotifySettings } from "./SpotifySettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, 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 84e8b3c0..5952caf1 100644 --- a/src/connections/Twitch/index.ts +++ b/src/connections/Twitch/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util"; +import { ConnectedAccount, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util"; import wretch from "wretch"; import { TwitchSettings } from "./TwitchSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; interface TwitchConnectionUserResponse { data: { diff --git a/src/connections/Twitter/index.ts b/src/connections/Twitter/index.ts
index 46b9289a..3c79515b 100644 --- a/src/connections/Twitter/index.ts +++ b/src/connections/Twitter/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util"; +import { ConnectedAccount, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util"; import wretch from "wretch"; import { TwitterSettings } from "./TwitterSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; interface TwitterUserResponse { data: { diff --git a/src/connections/Xbox/index.ts b/src/connections/Xbox/index.ts
index 184fe763..59d4a005 100644 --- a/src/connections/Xbox/index.ts +++ b/src/connections/Xbox/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; +import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; import { XboxSettings } from "./XboxSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; interface XboxUserResponse { IssueInstant: string; diff --git a/src/connections/Youtube/index.ts b/src/connections/Youtube/index.ts
index de452dff..2db9289f 100644 --- a/src/connections/Youtube/index.ts +++ b/src/connections/Youtube/index.ts
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; +import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; import { YoutubeSettings } from "./YoutubeSettings"; -import { ConnectionCallbackSchema } from "@spacebar/schemas"; +import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; interface YouTubeConnectionChannelListResult { items: { diff --git a/src/gateway/Server.ts b/src/gateway/Server.ts
index c6419cfa..72faa983 100644 --- a/src/gateway/Server.ts +++ b/src/gateway/Server.ts
@@ -22,7 +22,7 @@ import { checkToken, closeDatabase, Config, initDatabase, initEvent, Rights } fr import ws from "ws"; import { Connection, openConnections } from "./events/Connection"; import http from "http"; -import { cleanupOnStartup } from "./util/Utils"; +import { cleanupOnStartup } from "./util"; import { randomString } from "@spacebar/api"; import { setInterval } from "timers"; diff --git a/src/gateway/listener/listener.ts b/src/gateway/listener/listener.ts
index 3a7b626c..112f55bb 100644 --- a/src/gateway/listener/listener.ts +++ b/src/gateway/listener/listener.ts
@@ -31,11 +31,9 @@ import { Recipient, Relationship, } from "@spacebar/util"; -import { CLOSECODES, OPCODES } from "../util/Constants"; -import { Send } from "../util/Send"; +import { CLOSECODES, OPCODES, Send } from "../util"; import { WebSocket } from "@spacebar/gateway"; import { Channel as AMQChannel } from "amqplib"; -import * as console from "node:console"; import { PublicMember, RelationshipType } from "@spacebar/schemas"; import { bgRedBright } from "picocolors"; diff --git a/src/gateway/opcodes/VoiceStateUpdate.ts b/src/gateway/opcodes/VoiceStateUpdate.ts
index 89ead6e7..678afad8 100644 --- a/src/gateway/opcodes/VoiceStateUpdate.ts +++ b/src/gateway/opcodes/VoiceStateUpdate.ts
@@ -18,7 +18,7 @@ import { Payload, WebSocket } from "@spacebar/gateway"; import { Config, emitEvent, Guild, Member, VoiceServerUpdateEvent, VoiceState, VoiceStateUpdateEvent } from "@spacebar/util"; -import { genVoiceToken } from "../util/SessionUtils"; +import { genVoiceToken } from "@spacebar/gateway"; import { check } from "./instanceOf"; import { Region, VoiceStateUpdateSchema } from "@spacebar/schemas"; // TODO: check if a voice server is setup diff --git a/src/schemas/gateway/LazyRequestSchema.ts b/src/schemas/gateway/LazyRequestSchema.ts
index fcefe680..0433355c 100644 --- a/src/schemas/gateway/LazyRequestSchema.ts +++ b/src/schemas/gateway/LazyRequestSchema.ts
@@ -15,32 +15,3 @@ 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 LazyRequestSchema { - guild_id: string; - channels?: { - /** - * @items.type integer - * @minItems 2 - * @maxItems 2 - */ - [key: string]: number[][]; // puyo: changed from [number, number] because it breaks openapi - }; - activities?: boolean; - threads?: boolean; - typing?: true; - members?: string[]; - member_updates?: boolean; - thread_member_lists?: unknown[]; -} - -export const LazyRequestSchema = { - guild_id: String, - $activities: Boolean, - $channels: Object, - $typing: Boolean, - $threads: Boolean, - $members: [] as string[], - $member_updates: Boolean, - $thread_member_lists: [] as unknown[], -}; diff --git a/src/schemas/responses/AccountStandingResponse.ts b/src/schemas/responses/AccountStandingResponse.ts
index bbb8cd85..6f29ebef 100644 --- a/src/schemas/responses/AccountStandingResponse.ts +++ b/src/schemas/responses/AccountStandingResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Attachment } from "../../util/entities"; +// TODO: remove dependency on entities... +import { Attachment } from "@spacebar/util"; export enum AccountStandingState { ALL_GOOD = 100, diff --git a/src/schemas/responses/DiscoverableGuildsResponse.ts b/src/schemas/responses/DiscoverableGuildsResponse.ts
index 3e22c992..02c46f1c 100644 --- a/src/schemas/responses/DiscoverableGuildsResponse.ts +++ b/src/schemas/responses/DiscoverableGuildsResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Guild } from "../../util/entities"; +// TODO: remove dependency on entities +import { Guild } from "@spacebar/util"; export interface DiscoverableGuildsResponse { total: number; diff --git a/src/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts b/src/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts
index 6efeaba6..b2400e95 100644 --- a/src/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts +++ b/src/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Guild } from "../../util/entities"; +// TODO: remove dependency on entities +import { Guild } from "@spacebar/util"; export interface EmailDomainLookupVerifyCodeResponse { guild: Guild; diff --git a/src/schemas/responses/GuildMessagesSearchResponse.ts b/src/schemas/responses/GuildMessagesSearchResponse.ts
index 6777ad8a..555092ee 100644 --- a/src/schemas/responses/GuildMessagesSearchResponse.ts +++ b/src/schemas/responses/GuildMessagesSearchResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Attachment, Role } from "../../util/entities"; +// TODO: remove dependency on entities +import { Attachment, Role } from "@spacebar/util"; import { ActionRowComponent, Embed, MessageType, Poll, PublicUser } from "@spacebar/schemas"; export interface GuildMessagesSearchMessage { diff --git a/src/schemas/responses/GuildRecommendationsResponse.ts b/src/schemas/responses/GuildRecommendationsResponse.ts
index 04f9d1ef..c8fed072 100644 --- a/src/schemas/responses/GuildRecommendationsResponse.ts +++ b/src/schemas/responses/GuildRecommendationsResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Guild } from "../../util/entities"; +// TODO: remove dependency on entities +import { Guild } from "@spacebar/util"; export interface GuildRecommendationsResponse { recommended_guilds: Guild[]; diff --git a/src/schemas/responses/HubDirectoryEntriesResponse.ts b/src/schemas/responses/HubDirectoryEntriesResponse.ts
index 677199d3..c19b6a14 100644 --- a/src/schemas/responses/HubDirectoryEntriesResponse.ts +++ b/src/schemas/responses/HubDirectoryEntriesResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Guild } from "../../util/entities"; +// TODO: remove dependency on entities +import { Guild } from "@spacebar/util"; export interface HubDirectoryEntry { author_id: string; diff --git a/src/schemas/responses/MemberJoinGuildResponse.ts b/src/schemas/responses/MemberJoinGuildResponse.ts
index 1f9bc8c9..75081656 100644 --- a/src/schemas/responses/MemberJoinGuildResponse.ts +++ b/src/schemas/responses/MemberJoinGuildResponse.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Emoji, Role, Sticker } from "../../util/entities"; +import { Emoji, Role, Sticker } from "@spacebar/util"; import { GuildCreateResponse } from "@spacebar/schemas"; export interface MemberJoinGuildResponse { diff --git a/src/schemas/responses/TokenResponse.ts b/src/schemas/responses/TokenResponse.ts
index 0af06fd1..4a0c0834 100644 --- a/src/schemas/responses/TokenResponse.ts +++ b/src/schemas/responses/TokenResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { BackupCode, UserSettings } from "../../util/entities"; +// TODO: remove dependency on entities +import { BackupCode, UserSettings } from "@spacebar/util"; export interface TokenResponse { token: string; diff --git a/src/schemas/responses/TypedResponses.ts b/src/schemas/responses/TypedResponses.ts
index 13956ec8..13143a9f 100644 --- a/src/schemas/responses/TypedResponses.ts +++ b/src/schemas/responses/TypedResponses.ts
@@ -18,10 +18,11 @@ import { GeneralConfiguration, LimitsConfiguration } from "../../util/config/types"; import { DmChannelDTO } from "../../util/dtos"; -import { Application, BackupCode, Categories, Channel, Emoji, Guild, Invite, Member, Message, Role, Sticker, StickerPack, Template, Webhook } from "../../util/entities"; +import { Application, BackupCode, Categories, Channel, Emoji, Guild, Invite, Member, Message, Role, Sticker, StickerPack, Template, Webhook } from "@spacebar/util"; import { GuildVoiceRegion } from "./GuildVoiceRegionsResponse"; import { GuildBansResponse, GuildCreateResponse, PrivateUser, PublicMember, PublicUser } from "@spacebar/schemas"; +// TODO: remove this entire file! // removes internal properties from the guild class export type APIGuild = Omit<Guild, "afk_channel" | "template" | "owner" | "public_updates_channel" | "rules_channel" | "system_channel" | "widget_channel">; diff --git a/src/schemas/responses/WebhookCreateResponse.ts b/src/schemas/responses/WebhookCreateResponse.ts
index 1246c742..08d997fb 100644 --- a/src/schemas/responses/WebhookCreateResponse.ts +++ b/src/schemas/responses/WebhookCreateResponse.ts
@@ -16,7 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { User, Webhook } from "../../util/entities"; +// TODO: remove dependency on entities +import { User, Webhook } from "@spacebar/util"; export interface WebhookCreateResponse { user: User; diff --git a/src/schemas/uncategorised/ConnectedAccountSchema.ts b/src/schemas/uncategorised/ConnectedAccountSchema.ts
index c1d24d70..a754f9f4 100644 --- a/src/schemas/uncategorised/ConnectedAccountSchema.ts +++ b/src/schemas/uncategorised/ConnectedAccountSchema.ts
@@ -16,8 +16,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ConnectedAccountTokenData } from "../../util/interfaces"; - export interface ConnectedAccountSchema { external_id: string; user_id: string; @@ -34,3 +32,21 @@ export interface ConnectedAccountSchema { metadata_visibility?: number; two_way_link?: boolean; } + +export interface ConnectedAccountCommonOAuthTokenResponse { + access_token: string; + token_type: string; + scope: string; + refresh_token?: string; + expires_in?: number; +} + +export interface ConnectedAccountTokenData { + access_token: string; + token_type?: string; + scope?: string; + refresh_token?: string; + expires_in?: number; + expires_at?: number; + fetched_at: number; +} diff --git a/src/schemas/uncategorised/GuildSubscriptionsBulkSchema.ts b/src/schemas/uncategorised/GuildSubscriptionsBulkSchema.ts
index 32be9dd0..272110c5 100644 --- a/src/schemas/uncategorised/GuildSubscriptionsBulkSchema.ts +++ b/src/schemas/uncategorised/GuildSubscriptionsBulkSchema.ts
@@ -1,5 +1,3 @@ -import { LazyRequestSchema } from "../gateway/LazyRequestSchema"; - export interface GuildSubscriptionsBulkSchema { subscriptions: { [key: string]: GuildSubscriptionSchema }; } @@ -9,3 +7,32 @@ export type GuildSubscriptionSchema = Omit<LazyRequestSchema, "guild_id">; export const GuildSubscriptionsBulkSchema = { $subscriptions: Object, }; + +export interface LazyRequestSchema { + guild_id: string; + channels?: { + /** + * @items.type integer + * @minItems 2 + * @maxItems 2 + */ + [key: string]: number[][]; // puyo: changed from [number, number] because it breaks openapi + }; + activities?: boolean; + threads?: boolean; + typing?: true; + members?: string[]; + member_updates?: boolean; + thread_member_lists?: unknown[]; +} + +export const LazyRequestSchema = { + guild_id: String, + $activities: Boolean, + $channels: Object, + $typing: Boolean, + $threads: Boolean, + $members: [] as string[], + $member_updates: Boolean, + $thread_member_lists: [] as unknown[], +}; diff --git a/src/util/connections/ConnectionConfig.ts b/src/util/connections/ConnectionConfig.ts
index a5e0095a..c5da3878 100644 --- a/src/util/connections/ConnectionConfig.ts +++ b/src/util/connections/ConnectionConfig.ts
@@ -17,7 +17,7 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { ConnectionConfigEntity } from "../entities/ConnectionConfigEntity"; +import { ConnectionConfigEntity } from "../entities"; import { OrmUtils } from "../imports"; let config: any; diff --git a/src/util/connections/RefreshableConnection.ts b/src/util/connections/RefreshableConnection.ts
index 32cf36ac..3d7761f7 100644 --- a/src/util/connections/RefreshableConnection.ts +++ b/src/util/connections/RefreshableConnection.ts
@@ -17,8 +17,8 @@ */ import { ConnectedAccount } from "../entities"; -import { ConnectedAccountCommonOAuthTokenResponse } from "../interfaces"; import { Connection } from "./Connection"; +import { ConnectedAccountCommonOAuthTokenResponse } from "@spacebar/schemas"; /** * A connection that can refresh its token. diff --git a/src/util/entities/Attachment.ts b/src/util/entities/Attachment.ts
index c6858eb8..9dc9c3ac 100644 --- a/src/util/entities/Attachment.ts +++ b/src/util/entities/Attachment.ts
@@ -18,7 +18,7 @@ import { BeforeRemove, Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; import { URL } from "url"; -import { deleteFile } from "../util/cdn"; +import { deleteFile } from "../util"; import { BaseClass } from "./BaseClass"; import { getUrlSignature, NewUrlUserSignatureData, NewUrlSignatureData } from "../Signing"; diff --git a/src/util/entities/BaseClass.ts b/src/util/entities/BaseClass.ts
index ad8338e7..24a3aee1 100644 --- a/src/util/entities/BaseClass.ts +++ b/src/util/entities/BaseClass.ts
@@ -17,10 +17,9 @@ */ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, ColumnOptions, FindOptionsWhere, ObjectIdColumn, PrimaryColumn } from "typeorm"; -import { Snowflake } from "../util/Snowflake"; -import { getDatabase } from "../util/Database"; -import { OrmUtils } from "../imports/OrmUtils"; -import { annotationsKey, JsonNumber } from "../util/Decorators"; +import { Snowflake, getDatabase } from "../util"; +import { OrmUtils } from "../imports"; +import { annotationsKey } from "../util/Decorators"; export class BaseClassWithoutId extends BaseEntity { private get construct() { diff --git a/src/util/entities/ConnectedAccount.ts b/src/util/entities/ConnectedAccount.ts
index 7c5ffb55..6a5fed75 100644 --- a/src/util/entities/ConnectedAccount.ts +++ b/src/util/entities/ConnectedAccount.ts
@@ -17,9 +17,9 @@ */ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; -import { ConnectedAccountTokenData } from "../interfaces"; import { BaseClass } from "./BaseClass"; import { User } from "./User"; +import { ConnectedAccountTokenData } from "@spacebar/schemas"; @Entity({ name: "connected_accounts", diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts
index 401c51be..6d93cf5d 100644 --- a/src/util/entities/Member.ts +++ b/src/util/entities/Member.ts
@@ -21,8 +21,7 @@ import { BeforeInsert, BeforeUpdate, Column, Entity, Index, JoinColumn, JoinTabl import { Ban, Channel, PublicGuildRelations } from "."; import { ReadyGuildDTO } from "../dtos"; import { GuildCreateEvent, GuildDeleteEvent, GuildMemberAddEvent, GuildMemberRemoveEvent, GuildMemberUpdateEvent, MessageCreateEvent } from "../interfaces"; -import { Config, emitEvent } from "../util"; -import { DiscordApiErrors } from "../util/Constants"; +import { Config, emitEvent, DiscordApiErrors } from "../util"; import { BaseClassWithoutId } from "./BaseClass"; import { Guild } from "./Guild"; import { Message } from "./Message"; diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts
index bedd5aee..a4448a14 100644 --- a/src/util/entities/Message.ts +++ b/src/util/entities/Message.ts
@@ -20,7 +20,7 @@ import { User } from "./User"; import { Member } from "./Member"; import { Role } from "./Role"; import { Channel } from "./Channel"; -import { InteractionType } from "../interfaces/Interaction"; +import { InteractionType } from "../interfaces"; import { Application } from "./Application"; import { Column, CreateDateColumn, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, RelationId, FindOneOptions, Raw, Not, BaseEntity, In } from "typeorm"; import { BaseClass } from "./BaseClass"; diff --git a/src/util/interfaces/ConnectedAccount.ts b/src/util/interfaces/ConnectedAccount.ts
index 57cda25d..0433355c 100644 --- a/src/util/interfaces/ConnectedAccount.ts +++ b/src/util/interfaces/ConnectedAccount.ts
@@ -15,21 +15,3 @@ 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 ConnectedAccountCommonOAuthTokenResponse { - access_token: string; - token_type: string; - scope: string; - refresh_token?: string; - expires_in?: number; -} - -export interface ConnectedAccountTokenData { - access_token: string; - token_type?: string; - scope?: string; - refresh_token?: string; - expires_in?: number; - expires_at?: number; - fetched_at: number; -} diff --git a/src/util/util/Config.ts b/src/util/util/Config.ts
index 1cd24b90..27f0b450 100644 --- a/src/util/util/Config.ts +++ b/src/util/util/Config.ts
@@ -20,7 +20,7 @@ import { existsSync } from "fs"; import fs from "fs/promises"; import { OrmUtils } from ".."; import { ConfigValue } from "../config"; -import { ConfigEntity } from "../entities/Config"; +import { ConfigEntity } from "../entities"; import { JsonValue } from "@protobuf-ts/runtime"; // TODO: yaml instead of json diff --git a/src/webrtc/Server.ts b/src/webrtc/Server.ts
index bc26f3d1..ff98fe57 100644 --- a/src/webrtc/Server.ts +++ b/src/webrtc/Server.ts
@@ -21,7 +21,7 @@ import { closeDatabase, Config, initDatabase, initEvent } from "@spacebar/util"; import http from "http"; import ws from "ws"; import { Connection } from "./events/Connection"; -import { loadWebRtcLibrary, mediaServer, WRTC_PORT_MAX, WRTC_PORT_MIN, WRTC_PUBLIC_IP } from "./util/MediaServer"; +import { loadWebRtcLibrary, mediaServer, WRTC_PORT_MAX, WRTC_PORT_MIN, WRTC_PUBLIC_IP } from "./util"; import { green, yellow } from "picocolors"; export class Server {