diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 162ce935..61c93ca2 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -16,6 +16,14 @@
+
+
+
@@ -39,53 +47,57 @@
- {
- "keyToString": {
- "NIXITCH_NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix",
- "NIXITCH_NIX_CONF_DIR": "",
- "NIXITCH_NIX_OTHER_STORES": "",
- "NIXITCH_NIX_PATH": "/home/Rory/.nix-defexpr/channels:nixpkgs=/nix/store/wb6agba4kfsxpbnb5hzlq58vkjzvbsk6-source",
- "NIXITCH_NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/Rory /home/Rory/.local/state/nix/profile /nix/profile /home/Rory/.nix-profile",
- "NIXITCH_NIX_REMOTE": "",
- "NIXITCH_NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/Rory",
- "Node.js.Server.ts.executor": "Debug",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.git.unshallow": "true",
- "javascript.nodejs.core.library.configured.version": "24.8.0",
- "javascript.nodejs.core.library.typings.version": "24.7.0",
- "last_opened_file_path": "/home/Rory/git/spacebar/server/src/admin-api/routes/v0",
- "node.js.detected.package.eslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_interpreter_path": "node",
- "nodejs_package_manager_path": "npm",
- "npm.Start API.executor": "Run",
- "npm.Start CDN.executor": "Run",
- "npm.Start Gateway.executor": "Run",
- "npm.build.executor": "Run",
- "npm.start.executor": "Debug",
- "prettierjs.PrettierConfiguration.Package": "/home/Rory/git/spacebar/server/node_modules/prettier",
- "settings.editor.selected.configurable": "preferences.pluginManager",
- "ts.external.directory.path": "/home/Rory/git/spacebar/server-master/node_modules/typescript/lib"
+
+}]]>
+
+
+
-
-
-
-
+
+
+
+
+
@@ -132,7 +144,7 @@
-
+
diff --git a/assets/openapi.json b/assets/openapi.json
index 28880401..6a4563a2 100644
Binary files a/assets/openapi.json and b/assets/openapi.json differ
diff --git a/assets/schemas.json b/assets/schemas.json
index 656a9e9d..614ca9e9 100644
Binary files a/assets/schemas.json and b/assets/schemas.json differ
diff --git a/package.json b/package.json
index 13a41028..6cf45c2a 100644
--- a/package.json
+++ b/package.json
@@ -5,10 +5,10 @@
"scripts": {
"prepare": "husky install",
"postinstall": "npx patch-package",
- "start": "node dist/bundle/start.js",
- "start:api": "node dist/api/start.js",
- "start:cdn": "node dist/cdn/start.js",
- "start:gateway": "node dist/gateway/start.js",
+ "start": "node --enable-source-maps dist/bundle/start.js",
+ "start:api": "node --enable-source-maps dist/api/start.js",
+ "start:cdn": "node --enable-source-maps dist/cdn/start.js",
+ "start:gateway": "node --enable-source-maps dist/gateway/start.js",
"build": "npm run build:src && npm run generate:schema && npm run generate:openapi",
"build:src": "tsc -b -v",
"watch": "tsc -w -b .",
diff --git a/scripts/genIndex.js b/scripts/genIndex.js
new file mode 100644
index 00000000..701a7566
--- /dev/null
+++ b/scripts/genIndex.js
@@ -0,0 +1,69 @@
+/*
+ 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 .
+*/
+
+const fs = require("fs");
+const path = require("path");
+
+let content = `/*
+ Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
+ Copyright (C) ${new Date().getFullYear()} 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 .
+*/
+`;
+
+// node scripts/genIndex.js /path/to/dir
+const targetDir = process.argv[2];
+if (!targetDir) {
+ console.error("Please provide a target directory.");
+ process.exit(1);
+}
+
+if (fs.existsSync(path.join(targetDir, "index.js")) || fs.existsSync(path.join(targetDir, "index.ts"))) {
+ console.error("index.js or index.ts already exists in the target directory.");
+ process.exit(1);
+}
+
+const dirs = fs.readdirSync(targetDir).filter(f => fs.statSync(path.join(targetDir, f)).isDirectory());
+for (const dir of dirs) {
+ content += `export * from "./${dir}";\n`;
+}
+
+const files = fs.readdirSync(targetDir).filter(f => f.endsWith(".js") || f.endsWith(".ts"));
+for (const file of files) {
+ const filePath = path.join(targetDir, file);
+ const stat = fs.statSync(filePath);
+ if (stat.isFile()) {
+ const ext = path.extname(file);
+ const base = path.basename(file, ext);
+ content += `export * from "./${base}";\n`;
+ }
+}
+
+fs.writeFileSync(path.join(targetDir, "index.ts"), content);
\ No newline at end of file
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 .
*/
-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);
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 .
*/
-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 .
+*/
+
+/**
+ * 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
similarity index 100%
rename from src/schemas/ApplicationCreateSchema.ts
rename to src/schemas/api/developers/ApplicationCreateSchema.ts
diff --git a/src/schemas/ApplicationModifySchema.ts b/src/schemas/api/developers/ApplicationModifySchema.ts
similarity index 100%
rename from src/schemas/ApplicationModifySchema.ts
rename to src/schemas/api/developers/ApplicationModifySchema.ts
diff --git a/src/schemas/UserSettingsSchema.ts b/src/schemas/api/developers/index.ts
similarity index 80%
rename from src/schemas/UserSettingsSchema.ts
rename to 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 .
*/
-
-import { UserSettings } from "@spacebar/util";
-
-export type UserSettingsSchema = Omit, "index">;
+export * from "./ApplicationCreateSchema";
+export * from "./ApplicationModifySchema";
diff --git a/src/schemas/GatewayBotResponse.ts b/src/schemas/api/index.ts
similarity index 75%
rename from src/schemas/GatewayBotResponse.ts
rename to 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 .
*/
-
-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 .
+*/
+
+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 .
+*/
+
+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 .
+*/
+
+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
+ // & Pick
+ & Pick
+ & Pick
+ & Pick
+ & Pick
+ & Pick
+ & Pick
+ & { channel?: Channel }
+// & Pick // 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 .
+*/
+
+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 .
+*/
+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 .
+*/
+
+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
similarity index 87%
rename from src/schemas/GatewayResponse.ts
rename to 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 .
*/
-
-export interface GatewayResponse {
- url: string;
-}
+export * from "./User";
diff --git a/src/schemas/GatewayPayloadSchema.ts b/src/schemas/gateway/GatewayPayloadSchema.ts
similarity index 95%
rename from src/schemas/GatewayPayloadSchema.ts
rename to 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 .
*/
-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
similarity index 98%
rename from src/schemas/IdentifySchema.ts
rename to 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 .
*/
-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
similarity index 100%
rename from src/schemas/LazyRequestSchema.ts
rename to src/schemas/gateway/LazyRequestSchema.ts
diff --git a/src/schemas/StreamCreateSchema.ts b/src/schemas/gateway/StreamCreateSchema.ts
similarity index 100%
rename from src/schemas/StreamCreateSchema.ts
rename to src/schemas/gateway/StreamCreateSchema.ts
diff --git a/src/schemas/StreamDeleteSchema.ts b/src/schemas/gateway/StreamDeleteSchema.ts
similarity index 100%
rename from src/schemas/StreamDeleteSchema.ts
rename to src/schemas/gateway/StreamDeleteSchema.ts
diff --git a/src/schemas/StreamWatchSchema.ts b/src/schemas/gateway/StreamWatchSchema.ts
similarity index 100%
rename from src/schemas/StreamWatchSchema.ts
rename to 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 .
+*/
+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 .
*/
-
-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 .
*/
-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 .
*/
-import { GuildUpdateSchema, GuildWelcomeScreen } from "@spacebar/util";
+import { GuildWelcomeScreen } from "@spacebar/util";
+import { GuildUpdateSchema } from "@spacebar/schemas"
export interface GuildCreateResponse extends Omit {
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 .
*/
-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 .
*/
-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 .
*/
-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 .
*/
-
-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
similarity index 100%
rename from src/schemas/AckBulkSchema.ts
rename to src/schemas/uncategorised/AckBulkSchema.ts
diff --git a/src/schemas/ActivitySchema.ts b/src/schemas/uncategorised/ActivitySchema.ts
similarity index 100%
rename from src/schemas/ActivitySchema.ts
rename to src/schemas/uncategorised/ActivitySchema.ts
diff --git a/src/schemas/ApplicationAuthorizeSchema.ts b/src/schemas/uncategorised/ApplicationAuthorizeSchema.ts
similarity index 100%
rename from src/schemas/ApplicationAuthorizeSchema.ts
rename to src/schemas/uncategorised/ApplicationAuthorizeSchema.ts
diff --git a/src/schemas/AutomodRuleSchema.ts b/src/schemas/uncategorised/AutomodRuleSchema.ts
similarity index 100%
rename from src/schemas/AutomodRuleSchema.ts
rename to src/schemas/uncategorised/AutomodRuleSchema.ts
diff --git a/src/schemas/BackupCodesChallengeSchema.ts b/src/schemas/uncategorised/BackupCodesChallengeSchema.ts
similarity index 100%
rename from src/schemas/BackupCodesChallengeSchema.ts
rename to src/schemas/uncategorised/BackupCodesChallengeSchema.ts
diff --git a/src/schemas/BanCreateSchema.ts b/src/schemas/uncategorised/BanCreateSchema.ts
similarity index 100%
rename from src/schemas/BanCreateSchema.ts
rename to src/schemas/uncategorised/BanCreateSchema.ts
diff --git a/src/schemas/BanModeratorSchema.ts b/src/schemas/uncategorised/BanModeratorSchema.ts
similarity index 100%
rename from src/schemas/BanModeratorSchema.ts
rename to src/schemas/uncategorised/BanModeratorSchema.ts
diff --git a/src/schemas/BanRegistrySchema.ts b/src/schemas/uncategorised/BanRegistrySchema.ts
similarity index 100%
rename from src/schemas/BanRegistrySchema.ts
rename to src/schemas/uncategorised/BanRegistrySchema.ts
diff --git a/src/schemas/BotModifySchema.ts b/src/schemas/uncategorised/BotModifySchema.ts
similarity index 100%
rename from src/schemas/BotModifySchema.ts
rename to src/schemas/uncategorised/BotModifySchema.ts
diff --git a/src/schemas/BulkBanSchema.ts b/src/schemas/uncategorised/BulkBanSchema.ts
similarity index 100%
rename from src/schemas/BulkBanSchema.ts
rename to src/schemas/uncategorised/BulkBanSchema.ts
diff --git a/src/schemas/BulkDeleteSchema.ts b/src/schemas/uncategorised/BulkDeleteSchema.ts
similarity index 100%
rename from src/schemas/BulkDeleteSchema.ts
rename to src/schemas/uncategorised/BulkDeleteSchema.ts
diff --git a/src/schemas/ChannelModifySchema.ts b/src/schemas/uncategorised/ChannelModifySchema.ts
similarity index 100%
rename from src/schemas/ChannelModifySchema.ts
rename to src/schemas/uncategorised/ChannelModifySchema.ts
diff --git a/src/schemas/ChannelPermissionOverwriteSchema.ts b/src/schemas/uncategorised/ChannelPermissionOverwriteSchema.ts
similarity index 100%
rename from src/schemas/ChannelPermissionOverwriteSchema.ts
rename to src/schemas/uncategorised/ChannelPermissionOverwriteSchema.ts
diff --git a/src/schemas/ChannelReorderSchema.ts b/src/schemas/uncategorised/ChannelReorderSchema.ts
similarity index 100%
rename from src/schemas/ChannelReorderSchema.ts
rename to src/schemas/uncategorised/ChannelReorderSchema.ts
diff --git a/src/schemas/CodesVerificationSchema.ts b/src/schemas/uncategorised/CodesVerificationSchema.ts
similarity index 100%
rename from src/schemas/CodesVerificationSchema.ts
rename to src/schemas/uncategorised/CodesVerificationSchema.ts
diff --git a/src/schemas/ConnectedAccountSchema.ts b/src/schemas/uncategorised/ConnectedAccountSchema.ts
similarity index 94%
rename from src/schemas/ConnectedAccountSchema.ts
rename to 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 .
*/
-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
similarity index 100%
rename from src/schemas/ConnectionCallbackSchema.ts
rename to src/schemas/uncategorised/ConnectionCallbackSchema.ts
diff --git a/src/schemas/ConnectionUpdateSchema.ts b/src/schemas/uncategorised/ConnectionUpdateSchema.ts
similarity index 100%
rename from src/schemas/ConnectionUpdateSchema.ts
rename to src/schemas/uncategorised/ConnectionUpdateSchema.ts
diff --git a/src/schemas/DmChannelCreateSchema.ts b/src/schemas/uncategorised/DmChannelCreateSchema.ts
similarity index 100%
rename from src/schemas/DmChannelCreateSchema.ts
rename to src/schemas/uncategorised/DmChannelCreateSchema.ts
diff --git a/src/schemas/EmailDomainLookupSchema.ts b/src/schemas/uncategorised/EmailDomainLookupSchema.ts
similarity index 100%
rename from src/schemas/EmailDomainLookupSchema.ts
rename to src/schemas/uncategorised/EmailDomainLookupSchema.ts
diff --git a/src/schemas/EmailDomainLookupVerifyCodeSchema.ts b/src/schemas/uncategorised/EmailDomainLookupVerifyCodeSchema.ts
similarity index 100%
rename from src/schemas/EmailDomainLookupVerifyCodeSchema.ts
rename to src/schemas/uncategorised/EmailDomainLookupVerifyCodeSchema.ts
diff --git a/src/schemas/EmojiCreateSchema.ts b/src/schemas/uncategorised/EmojiCreateSchema.ts
similarity index 100%
rename from src/schemas/EmojiCreateSchema.ts
rename to src/schemas/uncategorised/EmojiCreateSchema.ts
diff --git a/src/schemas/EmojiModifySchema.ts b/src/schemas/uncategorised/EmojiModifySchema.ts
similarity index 100%
rename from src/schemas/EmojiModifySchema.ts
rename to src/schemas/uncategorised/EmojiModifySchema.ts
diff --git a/src/schemas/ForgotPasswordSchema.ts b/src/schemas/uncategorised/ForgotPasswordSchema.ts
similarity index 100%
rename from src/schemas/ForgotPasswordSchema.ts
rename to src/schemas/uncategorised/ForgotPasswordSchema.ts
diff --git a/src/schemas/GreetRequestSchema.ts b/src/schemas/uncategorised/GreetRequestSchema.ts
similarity index 94%
rename from src/schemas/GreetRequestSchema.ts
rename to 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 .
*/
-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
similarity index 94%
rename from src/schemas/GuildCreateSchema.ts
rename to 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 .
*/
-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
similarity index 79%
rename from src/schemas/GuildSubscriptionsBulkSchema.ts
rename to 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
similarity index 100%
rename from src/schemas/GuildTemplateCreateSchema.ts
rename to src/schemas/uncategorised/GuildTemplateCreateSchema.ts
diff --git a/src/schemas/GuildUpdateSchema.ts b/src/schemas/uncategorised/GuildUpdateSchema.ts
similarity index 96%
rename from src/schemas/GuildUpdateSchema.ts
rename to 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 .
*/
-import { GuildCreateSchema } from "@spacebar/util";
+import { GuildCreateSchema } from "@spacebar/schemas";
export interface GuildUpdateSchema extends Omit {
banner?: string | null;
diff --git a/src/schemas/GuildUpdateWelcomeScreenSchema.ts b/src/schemas/uncategorised/GuildUpdateWelcomeScreenSchema.ts
similarity index 100%
rename from src/schemas/GuildUpdateWelcomeScreenSchema.ts
rename to src/schemas/uncategorised/GuildUpdateWelcomeScreenSchema.ts
diff --git a/src/schemas/HubWaitlistSignupSchema.ts b/src/schemas/uncategorised/HubWaitlistSignupSchema.ts
similarity index 100%
rename from src/schemas/HubWaitlistSignupSchema.ts
rename to src/schemas/uncategorised/HubWaitlistSignupSchema.ts
diff --git a/src/schemas/InviteCreateSchema.ts b/src/schemas/uncategorised/InviteCreateSchema.ts
similarity index 100%
rename from src/schemas/InviteCreateSchema.ts
rename to src/schemas/uncategorised/InviteCreateSchema.ts
diff --git a/src/schemas/LoginResponse.ts b/src/schemas/uncategorised/LoginResponse.ts
similarity index 84%
rename from src/schemas/LoginResponse.ts
rename to 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
similarity index 100%
rename from src/schemas/LoginSchema.ts
rename to src/schemas/uncategorised/LoginSchema.ts
diff --git a/src/schemas/MemberChangeProfileSchema.ts b/src/schemas/uncategorised/MemberChangeProfileSchema.ts
similarity index 100%
rename from src/schemas/MemberChangeProfileSchema.ts
rename to src/schemas/uncategorised/MemberChangeProfileSchema.ts
diff --git a/src/schemas/MemberChangeSchema.ts b/src/schemas/uncategorised/MemberChangeSchema.ts
similarity index 100%
rename from src/schemas/MemberChangeSchema.ts
rename to src/schemas/uncategorised/MemberChangeSchema.ts
diff --git a/src/schemas/MemberNickChangeSchema.ts b/src/schemas/uncategorised/MemberNickChangeSchema.ts
similarity index 100%
rename from src/schemas/MemberNickChangeSchema.ts
rename to src/schemas/uncategorised/MemberNickChangeSchema.ts
diff --git a/src/schemas/MessageAcknowledgeSchema.ts b/src/schemas/uncategorised/MessageAcknowledgeSchema.ts
similarity index 100%
rename from src/schemas/MessageAcknowledgeSchema.ts
rename to src/schemas/uncategorised/MessageAcknowledgeSchema.ts
diff --git a/src/schemas/MessageCreateSchema.ts b/src/schemas/uncategorised/MessageCreateSchema.ts
similarity index 99%
rename from src/schemas/MessageCreateSchema.ts
rename to 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 .
*/
-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
similarity index 100%
rename from src/schemas/MessageEditSchema.ts
rename to src/schemas/uncategorised/MessageEditSchema.ts
diff --git a/src/schemas/MfaCodesSchema.ts b/src/schemas/uncategorised/MfaCodesSchema.ts
similarity index 100%
rename from src/schemas/MfaCodesSchema.ts
rename to src/schemas/uncategorised/MfaCodesSchema.ts
diff --git a/src/schemas/ModifyGuildStickerSchema.ts b/src/schemas/uncategorised/ModifyGuildStickerSchema.ts
similarity index 100%
rename from src/schemas/ModifyGuildStickerSchema.ts
rename to src/schemas/uncategorised/ModifyGuildStickerSchema.ts
diff --git a/src/schemas/PasswordResetSchema.ts b/src/schemas/uncategorised/PasswordResetSchema.ts
similarity index 100%
rename from src/schemas/PasswordResetSchema.ts
rename to src/schemas/uncategorised/PasswordResetSchema.ts
diff --git a/src/schemas/PreloadMessagesRequestSchema.ts b/src/schemas/uncategorised/PreloadMessagesRequestSchema.ts
similarity index 100%
rename from src/schemas/PreloadMessagesRequestSchema.ts
rename to src/schemas/uncategorised/PreloadMessagesRequestSchema.ts
diff --git a/src/schemas/PruneSchema.ts b/src/schemas/uncategorised/PruneSchema.ts
similarity index 100%
rename from src/schemas/PruneSchema.ts
rename to src/schemas/uncategorised/PruneSchema.ts
diff --git a/src/schemas/PurgeSchema.ts b/src/schemas/uncategorised/PurgeSchema.ts
similarity index 100%
rename from src/schemas/PurgeSchema.ts
rename to src/schemas/uncategorised/PurgeSchema.ts
diff --git a/src/schemas/RefreshUrlsRequestSchema.ts b/src/schemas/uncategorised/RefreshUrlsRequestSchema.ts
similarity index 100%
rename from src/schemas/RefreshUrlsRequestSchema.ts
rename to src/schemas/uncategorised/RefreshUrlsRequestSchema.ts
diff --git a/src/schemas/RegisterSchema.ts b/src/schemas/uncategorised/RegisterSchema.ts
similarity index 100%
rename from src/schemas/RegisterSchema.ts
rename to src/schemas/uncategorised/RegisterSchema.ts
diff --git a/src/schemas/RelationshipPostSchema.ts b/src/schemas/uncategorised/RelationshipPostSchema.ts
similarity index 100%
rename from src/schemas/RelationshipPostSchema.ts
rename to src/schemas/uncategorised/RelationshipPostSchema.ts
diff --git a/src/schemas/RelationshipPutSchema.ts b/src/schemas/uncategorised/RelationshipPutSchema.ts
similarity index 90%
rename from src/schemas/RelationshipPutSchema.ts
rename to 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 .
*/
-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
similarity index 100%
rename from src/schemas/RequestGuildMembersSchema.ts
rename to src/schemas/uncategorised/RequestGuildMembersSchema.ts
diff --git a/src/schemas/RoleModifySchema.ts b/src/schemas/uncategorised/RoleModifySchema.ts
similarity index 100%
rename from src/schemas/RoleModifySchema.ts
rename to src/schemas/uncategorised/RoleModifySchema.ts
diff --git a/src/schemas/RolePositionUpdateSchema.ts b/src/schemas/uncategorised/RolePositionUpdateSchema.ts
similarity index 100%
rename from src/schemas/RolePositionUpdateSchema.ts
rename to src/schemas/uncategorised/RolePositionUpdateSchema.ts
diff --git a/src/schemas/SelectProtocolSchema.ts b/src/schemas/uncategorised/SelectProtocolSchema.ts
similarity index 100%
rename from src/schemas/SelectProtocolSchema.ts
rename to src/schemas/uncategorised/SelectProtocolSchema.ts
diff --git a/src/schemas/SettingsProtoUpdateSchema.ts b/src/schemas/uncategorised/SettingsProtoUpdateSchema.ts
similarity index 100%
rename from src/schemas/SettingsProtoUpdateSchema.ts
rename to src/schemas/uncategorised/SettingsProtoUpdateSchema.ts
diff --git a/src/schemas/TeamCreateSchema.ts b/src/schemas/uncategorised/TeamCreateSchema.ts
similarity index 100%
rename from src/schemas/TeamCreateSchema.ts
rename to src/schemas/uncategorised/TeamCreateSchema.ts
diff --git a/src/schemas/TemplateCreateSchema.ts b/src/schemas/uncategorised/TemplateCreateSchema.ts
similarity index 100%
rename from src/schemas/TemplateCreateSchema.ts
rename to src/schemas/uncategorised/TemplateCreateSchema.ts
diff --git a/src/schemas/TemplateModifySchema.ts b/src/schemas/uncategorised/TemplateModifySchema.ts
similarity index 100%
rename from src/schemas/TemplateModifySchema.ts
rename to src/schemas/uncategorised/TemplateModifySchema.ts
diff --git a/src/schemas/TotpDisableSchema.ts b/src/schemas/uncategorised/TotpDisableSchema.ts
similarity index 100%
rename from src/schemas/TotpDisableSchema.ts
rename to src/schemas/uncategorised/TotpDisableSchema.ts
diff --git a/src/schemas/TotpEnableSchema.ts b/src/schemas/uncategorised/TotpEnableSchema.ts
similarity index 100%
rename from src/schemas/TotpEnableSchema.ts
rename to src/schemas/uncategorised/TotpEnableSchema.ts
diff --git a/src/schemas/TotpSchema.ts b/src/schemas/uncategorised/TotpSchema.ts
similarity index 100%
rename from src/schemas/TotpSchema.ts
rename to src/schemas/uncategorised/TotpSchema.ts
diff --git a/src/schemas/UploadAttachmentRequestSchema.ts b/src/schemas/uncategorised/UploadAttachmentRequestSchema.ts
similarity index 100%
rename from src/schemas/UploadAttachmentRequestSchema.ts
rename to src/schemas/uncategorised/UploadAttachmentRequestSchema.ts
diff --git a/src/schemas/UserDeleteSchema.ts b/src/schemas/uncategorised/UserDeleteSchema.ts
similarity index 100%
rename from src/schemas/UserDeleteSchema.ts
rename to src/schemas/uncategorised/UserDeleteSchema.ts
diff --git a/src/schemas/UserGuildSettingsSchema.ts b/src/schemas/uncategorised/UserGuildSettingsSchema.ts
similarity index 100%
rename from src/schemas/UserGuildSettingsSchema.ts
rename to src/schemas/uncategorised/UserGuildSettingsSchema.ts
diff --git a/src/schemas/UserModifySchema.ts b/src/schemas/uncategorised/UserModifySchema.ts
similarity index 100%
rename from src/schemas/UserModifySchema.ts
rename to src/schemas/uncategorised/UserModifySchema.ts
diff --git a/src/schemas/UserNoteUpdateSchema.ts b/src/schemas/uncategorised/UserNoteUpdateSchema.ts
similarity index 100%
rename from src/schemas/UserNoteUpdateSchema.ts
rename to src/schemas/uncategorised/UserNoteUpdateSchema.ts
diff --git a/src/schemas/UserProfileModifySchema.ts b/src/schemas/uncategorised/UserProfileModifySchema.ts
similarity index 100%
rename from src/schemas/UserProfileModifySchema.ts
rename to 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 .
+*/
+
+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
similarity index 100%
rename from src/schemas/VanityUrlSchema.ts
rename to src/schemas/uncategorised/VanityUrlSchema.ts
diff --git a/src/schemas/VerifyEmailSchema.ts b/src/schemas/uncategorised/VerifyEmailSchema.ts
similarity index 100%
rename from src/schemas/VerifyEmailSchema.ts
rename to src/schemas/uncategorised/VerifyEmailSchema.ts
diff --git a/src/schemas/VoiceStateUpdateSchema.ts b/src/schemas/uncategorised/VoiceStateUpdateSchema.ts
similarity index 100%
rename from src/schemas/VoiceStateUpdateSchema.ts
rename to src/schemas/uncategorised/VoiceStateUpdateSchema.ts
diff --git a/src/schemas/WebAuthnSchema.ts b/src/schemas/uncategorised/WebAuthnSchema.ts
similarity index 100%
rename from src/schemas/WebAuthnSchema.ts
rename to src/schemas/uncategorised/WebAuthnSchema.ts
diff --git a/src/schemas/WebhookCreateSchema.ts b/src/schemas/uncategorised/WebhookCreateSchema.ts
similarity index 100%
rename from src/schemas/WebhookCreateSchema.ts
rename to src/schemas/uncategorised/WebhookCreateSchema.ts
diff --git a/src/schemas/WebhookExecuteSchema.ts b/src/schemas/uncategorised/WebhookExecuteSchema.ts
similarity index 97%
rename from src/schemas/WebhookExecuteSchema.ts
rename to 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 .
*/
-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
similarity index 100%
rename from src/schemas/WebhookUpdateSchema.ts
rename to src/schemas/uncategorised/WebhookUpdateSchema.ts
diff --git a/src/schemas/WidgetModifySchema.ts b/src/schemas/uncategorised/WidgetModifySchema.ts
similarity index 100%
rename from src/schemas/WidgetModifySchema.ts
rename to 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 .
+*/
+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
similarity index 100%
rename from src/schemas/VoiceIdentifySchema.ts
rename to src/schemas/webrtc/VoiceIdentifySchema.ts
diff --git a/src/schemas/VoiceVideoSchema.ts b/src/schemas/webrtc/VoiceVideoSchema.ts
similarity index 100%
rename from src/schemas/VoiceVideoSchema.ts
rename to 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 .
+*/
+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
- // & Pick
- & Pick
- & Pick
- & Pick
- & Pick
- & Pick
- & Pick
- & { channel?: Channel }
-// & Pick // 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 .
*/
-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,10 +19,12 @@
import { CLOSECODES } from "@spacebar/gateway";
import {
StreamSession,
- validateSchema,
- VoiceIdentifySchema,
VoiceState,
} from "@spacebar/util";
+import {
+ validateSchema,
+ VoiceIdentifySchema,
+} from "@spacebar/schemas";
import {
generateSsrc,
mediaServer,
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 .
*/
-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 .
*/
-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;