diff --git a/.gitignore b/.gitignore index 20b0c921..6bcf6bdb 100644 --- a/.gitignore +++ b/.gitignore @@ -125,3 +125,6 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* + +# turbo cache +.turbo \ No newline at end of file diff --git a/packages/kanao-schema/package.json b/packages/kanao-schema/package.json new file mode 100644 index 00000000..4fc8c877 --- /dev/null +++ b/packages/kanao-schema/package.json @@ -0,0 +1,28 @@ +{ + "name": "@nezuchan/kanao-schema", + "version": "1.0.0", + "description": "Cache schema for Kanao Gateway", + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.js" + }, + "scripts": { + "build": "rimraf dist && tsc", + "lint": "eslint src", + "lint:fix": "eslint src --fix" + }, + "keywords": [], + "author": "KagChi", + "license": "GPL-3.0", + "devDependencies": { + "drizzle-kit": "^0.20.14" + }, + "dependencies": { + "drizzle-orm": "^0.29.3", + "tslib": "^2.6.2" + } +} diff --git a/services/kanao-gateway/src/Schema/collections/channel.ts b/packages/kanao-schema/src/Schema/channel.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/channel.ts rename to packages/kanao-schema/src/Schema/channel.ts diff --git a/services/kanao-gateway/src/Schema/collections/guild.ts b/packages/kanao-schema/src/Schema/guild.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/guild.ts rename to packages/kanao-schema/src/Schema/guild.ts diff --git a/services/kanao-gateway/src/Schema/collections/member.ts b/packages/kanao-schema/src/Schema/member.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/member.ts rename to packages/kanao-schema/src/Schema/member.ts diff --git a/services/kanao-gateway/src/Schema/collections/message.ts b/packages/kanao-schema/src/Schema/message.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/message.ts rename to packages/kanao-schema/src/Schema/message.ts diff --git a/services/kanao-gateway/src/Schema/collections/roles.ts b/packages/kanao-schema/src/Schema/roles.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/roles.ts rename to packages/kanao-schema/src/Schema/roles.ts diff --git a/services/kanao-gateway/src/Schema/collections/session.ts b/packages/kanao-schema/src/Schema/session.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/session.ts rename to packages/kanao-schema/src/Schema/session.ts diff --git a/services/kanao-gateway/src/Schema/collections/status.ts b/packages/kanao-schema/src/Schema/status.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/status.ts rename to packages/kanao-schema/src/Schema/status.ts diff --git a/services/kanao-gateway/src/Schema/collections/user.ts b/packages/kanao-schema/src/Schema/user.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/user.ts rename to packages/kanao-schema/src/Schema/user.ts diff --git a/services/kanao-gateway/src/Schema/collections/voice.ts b/packages/kanao-schema/src/Schema/voice.ts similarity index 100% rename from services/kanao-gateway/src/Schema/collections/voice.ts rename to packages/kanao-schema/src/Schema/voice.ts diff --git a/packages/kanao-schema/src/index.ts b/packages/kanao-schema/src/index.ts new file mode 100644 index 00000000..c0b8287f --- /dev/null +++ b/packages/kanao-schema/src/index.ts @@ -0,0 +1,9 @@ +export * from "./Schema/member.js"; +export * from "./Schema/user.js"; +export * from "./Schema/roles.js"; +export * from "./Schema/guild.js"; +export * from "./Schema/channel.js"; +export * from "./Schema/voice.js"; +export * from "./Schema/message.js"; +export * from "./Schema/session.js"; +export * from "./Schema/status.js"; diff --git a/packages/kanao-schema/tsconfig.json b/packages/kanao-schema/tsconfig.json new file mode 100644 index 00000000..d62780ed --- /dev/null +++ b/packages/kanao-schema/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": "src", + "declaration": true, + "sourceMap": true + }, + "include": ["src"] +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index de82f1a4..49e03b9a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,6 +24,19 @@ importers: specifier: ^5.3.3 version: 5.3.3 + packages/kanao-schema: + dependencies: + drizzle-orm: + specifier: ^0.29.3 + version: 0.29.3(postgres@3.4.3) + tslib: + specifier: ^2.6.2 + version: 2.6.2 + devDependencies: + drizzle-kit: + specifier: ^0.20.14 + version: 0.20.14 + services/kanao-gateway: dependencies: '@discordjs/collection': @@ -38,6 +51,9 @@ importers: '@nezuchan/constants': specifier: ^0.8.0 version: 0.8.0 + '@nezuchan/kanao-schema': + specifier: workspace:^ + version: link:../../packages/kanao-schema '@nezuchan/utilities': specifier: ^0.6.2 version: 0.6.2(amqplib@0.10.3) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index c66016f4..bad6a404 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,2 +1,3 @@ packages: - - 'services/*' \ No newline at end of file + - 'services/*' + - 'packages/*' \ No newline at end of file diff --git a/services/kanao-gateway/package.json b/services/kanao-gateway/package.json index fb2a7ce6..eef83baa 100644 --- a/services/kanao-gateway/package.json +++ b/services/kanao-gateway/package.json @@ -18,6 +18,7 @@ "@discordjs/rest": "^2.2.0", "@discordjs/ws": "^1.0.2", "@nezuchan/constants": "^0.8.0", + "@nezuchan/kanao-schema": "workspace:^", "@nezuchan/utilities": "^0.6.2", "@sapphire/pieces": "^4.2.2", "@sapphire/result": "^2.6.6", diff --git a/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelCreateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelCreateListener.ts index d2f00104..b7cfd377 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelCreateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelCreateListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { channels, channelsOverwrite } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayChannelCreateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { channels, channelsOverwrite } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateChannels } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelDeleteListener.ts b/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelDeleteListener.ts index b7b2e89b..055a42c7 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelDeleteListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelDeleteListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { channels } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayChannelDeleteDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { channels } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateChannels } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelUpdateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelUpdateListener.ts index 1e62d358..693d60c9 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelUpdateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Channels/ChannelUpdateListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { channels, channelsOverwrite } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayChannelUpdateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { channels, channelsOverwrite } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateChannels } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberAddListener.ts b/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberAddListener.ts index 5d3f4233..a17cd99b 100644 --- a/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberAddListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberAddListener.ts @@ -1,9 +1,9 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { memberRoles, members, users } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildMemberAddDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; -import { memberRoles, members, users } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateUsers } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberRemoveListener.ts b/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberRemoveListener.ts index 2567ad00..6bf1bdac 100644 --- a/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberRemoveListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberRemoveListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { members } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildMemberRemoveDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { members } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberUpdateListener.ts b/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberUpdateListener.ts index a7a24d17..034bdf58 100644 --- a/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberUpdateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMemberUpdateListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { memberRoles, members, users } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildMemberUpdateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { memberRoles, members, users } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateMembers, stateUsers } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMembersChunkListener.ts b/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMembersChunkListener.ts index 272c42d0..31864e30 100644 --- a/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMembersChunkListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/GuildMembers/GuildMembersChunkListener.ts @@ -1,9 +1,9 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { members, users } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildMembersChunkDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; -import { members, users } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateMembers, stateUsers } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleCreateListener.ts b/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleCreateListener.ts index 95efa797..8a3e84a3 100644 --- a/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleCreateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleCreateListener.ts @@ -1,9 +1,9 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { roles } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildRoleCreateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; -import { roles } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateRoles } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleDeleteListener.ts b/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleDeleteListener.ts index 6fc5068a..72aa04ac 100644 --- a/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleDeleteListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleDeleteListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { roles } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildRoleDeleteDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { roles } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleUpdateListener.ts b/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleUpdateListener.ts index 24d28758..20b962c7 100644 --- a/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleUpdateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/GuildRoles/GuildRoleUpdateListener.ts @@ -1,9 +1,9 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { roles } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildRoleUpdateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; -import { roles } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateRoles } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildCreateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildCreateListener.ts index cee2a3c3..5932d36f 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildCreateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildCreateListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { channels, channelsOverwrite, guilds, guildsRoles, memberRoles, members, roles, users, voiceStates } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildCreateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { channels, channelsOverwrite, guilds, guildsRoles, memberRoles, members, roles, users, voiceStates } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateChannels, stateMembers, stateRoles, stateUsers, stateVoices } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildDeleteListener.ts b/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildDeleteListener.ts index 86cb8398..cdd278ab 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildDeleteListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildDeleteListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { guilds } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildDeleteDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { guilds } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildUpdateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildUpdateListener.ts index 237872c2..40a0762f 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildUpdateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildUpdateListener.ts @@ -1,9 +1,9 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { guilds } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayGuildUpdateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; -import { guilds } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageCreateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageCreateListener.ts index 975d3f81..3dc51ff3 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageCreateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageCreateListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { memberRoles, members, messages, users } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayMessageCreateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { memberRoles, members, messages, users } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateMembers, stateMessages, stateUsers } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageDeleteBulkListener.ts b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageDeleteBulkListener.ts index f6629be6..3ad26d2f 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageDeleteBulkListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageDeleteBulkListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { messages } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayMessageDeleteBulkDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { inArray } from "drizzle-orm"; -import { messages } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageDeleteListener.ts b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageDeleteListener.ts index 056a2169..4d654def 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageDeleteListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageDeleteListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { messages } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayMessageDeleteDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { messages } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageUpdateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageUpdateListener.ts index 806d45d0..4d54f304 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageUpdateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageUpdateListener.ts @@ -1,9 +1,9 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { members, messages, users } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayMessageUpdateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; -import { members, messages, users } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateMembers, stateMessages, stateUsers } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Users/UserUpdateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Users/UserUpdateListener.ts index a8b341f6..fef811da 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Users/UserUpdateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Users/UserUpdateListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { users } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayUserUpdateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { users } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/Caches/Voices/VoiceStateUpdateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Voices/VoiceStateUpdateListener.ts index cc0a1984..a8826355 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Voices/VoiceStateUpdateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Voices/VoiceStateUpdateListener.ts @@ -1,10 +1,10 @@ import { Buffer } from "node:buffer"; import { RabbitMQ } from "@nezuchan/constants"; +import { memberRoles, members, users, voiceStates } from "@nezuchan/kanao-schema"; import { RoutingKey } from "@nezuchan/utilities"; import type { GatewayVoiceStateUpdateDispatch } from "discord-api-types/v10"; import { GatewayDispatchEvents } from "discord-api-types/v10"; import { eq } from "drizzle-orm"; -import { memberRoles, members, users, voiceStates } from "../../../Schema/index.js"; import type { ListenerContext } from "../../../Stores/Listener.js"; import { Listener } from "../../../Stores/Listener.js"; import { clientId, stateMembers, stateUsers, stateVoices } from "../../../config.js"; diff --git a/services/kanao-gateway/src/Listeners/HeartBeatCompleteListener.ts b/services/kanao-gateway/src/Listeners/HeartBeatCompleteListener.ts index a8d9da1b..61ab74d7 100644 --- a/services/kanao-gateway/src/Listeners/HeartBeatCompleteListener.ts +++ b/services/kanao-gateway/src/Listeners/HeartBeatCompleteListener.ts @@ -1,6 +1,6 @@ import type { WebSocketShard } from "@discordjs/ws"; import { WebSocketShardEvents } from "@discordjs/ws"; -import { status } from "../Schema/collections/status.js"; +import { status } from "@nezuchan/kanao-schema"; import type { ListenerContext } from "../Stores/Listener.js"; import { Listener } from "../Stores/Listener.js"; diff --git a/services/kanao-gateway/src/Listeners/ReadyListener.ts b/services/kanao-gateway/src/Listeners/ReadyListener.ts index cee42f92..2f36d987 100644 --- a/services/kanao-gateway/src/Listeners/ReadyListener.ts +++ b/services/kanao-gateway/src/Listeners/ReadyListener.ts @@ -1,6 +1,6 @@ import { WebSocketShardEvents } from "@discordjs/ws"; +import { guilds } from "@nezuchan/kanao-schema"; import type { GatewayReadyDispatch } from "discord-api-types/v10"; -import { guilds } from "../Schema/index.js"; import type { ListenerContext } from "../Stores/Listener.js"; import { Listener } from "../Stores/Listener.js"; diff --git a/services/kanao-gateway/src/Schema/index.ts b/services/kanao-gateway/src/Schema/index.ts deleted file mode 100644 index 67adc64f..00000000 --- a/services/kanao-gateway/src/Schema/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from "./collections/member.js"; -export * from "./collections/user.js"; -export * from "./collections/roles.js"; -export * from "./collections/guild.js"; -export * from "./collections/channel.js"; -export * from "./collections/voice.js"; -export * from "./collections/message.js"; -export * from "./collections/session.js"; -export * from "./collections/status.js"; diff --git a/services/kanao-gateway/src/Structures/NezuGateway.ts b/services/kanao-gateway/src/Structures/NezuGateway.ts index 88fd5e52..412916f3 100644 --- a/services/kanao-gateway/src/Structures/NezuGateway.ts +++ b/services/kanao-gateway/src/Structures/NezuGateway.ts @@ -6,13 +6,13 @@ import { REST } from "@discordjs/rest"; import { CompressionMethod, WebSocketManager, WebSocketShardEvents, WebSocketShardStatus } from "@discordjs/ws"; import type { SessionInfo, ShardRange } from "@discordjs/ws"; import { RabbitMQ } from "@nezuchan/constants"; +import * as schema from "@nezuchan/kanao-schema"; import { Util, createAmqpChannel, RoutingKey } from "@nezuchan/utilities"; import type { Channel } from "amqplib"; import { eq } from "drizzle-orm"; import { drizzle } from "drizzle-orm/postgres-js"; import postgres from "postgres"; import APM from "prometheus-middleware"; -import * as schema from "../Schema/index.js"; import { createLogger } from "../Utilities/Logger.js"; import { ProcessShardingStrategy } from "../Utilities/WebSockets/ProcessShardingStrategy.js"; import { amqp, clientId, databaseUrl, discordToken, enablePrometheus, gatewayCompression, gatewayGuildPerShard, gatewayHandShakeTimeout, gatewayHelloTimeout, gatewayIntents, gatewayLargeThreshold, gatewayPresenceName, gatewayPresenceStatus, gatewayPresenceType, gatewayReadyTimeout, gatewayResume, gatewayShardCount, gatewayShardsPerWorkers, getShardCount, lokiHost, prometheusPath, prometheusPort, proxy, replicaId, storeLogs } from "../config.js"; diff --git a/services/kanao-gateway/src/Utilities/WebSockets/ProcessBootstrapper.ts b/services/kanao-gateway/src/Utilities/WebSockets/ProcessBootstrapper.ts index 36e1aedc..4a0ca1df 100644 --- a/services/kanao-gateway/src/Utilities/WebSockets/ProcessBootstrapper.ts +++ b/services/kanao-gateway/src/Utilities/WebSockets/ProcessBootstrapper.ts @@ -14,13 +14,13 @@ import { Collection } from "@discordjs/collection"; import type { BootstrapOptions, WorkerReceivePayload, WorkerSendPayload, WorkerData, WebSocketShardDestroyOptions } from "@discordjs/ws"; import { WebSocketShardEvents, WebSocketShard, WorkerReceivePayloadOp, WorkerSendPayloadOp } from "@discordjs/ws"; import { RabbitMQ, ShardOp } from "@nezuchan/constants"; +import * as schema from "@nezuchan/kanao-schema"; import { RoutingKey, RoutingKeyToId, createAmqpChannel } from "@nezuchan/utilities"; import { StoreRegistry } from "@sapphire/pieces"; import type { Channel, ConsumeMessage } from "amqplib"; import type { GatewaySendPayload } from "discord-api-types/v10"; import { drizzle } from "drizzle-orm/postgres-js"; import postgres from "postgres"; -import * as schema from "../../Schema/index.js"; import type { Listener } from "../../Stores/Listener.js"; import { ListenerStore } from "../../Stores/ListenerStore.js"; import { discordToken, storeLogs, lokiHost, amqp, databaseUrl, clientId } from "../../config.js"; diff --git a/services/kanao-gateway/tsconfig.json b/services/kanao-gateway/tsconfig.json index 2a0598dc..159cac80 100644 --- a/services/kanao-gateway/tsconfig.json +++ b/services/kanao-gateway/tsconfig.json @@ -2,7 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "dist", - "rootDir": "src" + "rootDir": "src", + "noEmit": true }, "include": ["src"] } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 421c3a67..1b97259e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "target": "ES2021", - "module": "Node16", - "moduleResolution": "Node16", + "module": "ESNext", + "moduleResolution": "Node", "lib": ["ES2021"], "strict": true, "esModuleInterop": false, @@ -14,7 +14,6 @@ "importHelpers": true, "resolveJsonModule": true, "strictNullChecks": true, - "noEmit": true, "typeRoots": ["node_modules/@types"] } } \ No newline at end of file diff --git a/turbo.json b/turbo.json index abbd00c6..62811809 100644 --- a/turbo.json +++ b/turbo.json @@ -2,10 +2,10 @@ "$schema": "https://turborepo.org/schema.json", "pipeline": { "build": { - "dependsOn": ["^build"], "outputs": ["dist/**"] }, "lint": { + "dependsOn": ["^build"], "outputs": [] }, "lint:fix": {