From 9bebbe6e0588b1a72de06ce1540da66d45bde52a Mon Sep 17 00:00:00 2001 From: William Oldham Date: Wed, 8 Jan 2025 16:30:37 +0000 Subject: [PATCH] style: run new eslint config on EVERYTHING ELSE --- src/config-manager.ts | 6 +- src/database.ts | 10 +- src/middleware/parse-user-agent.ts | 5 +- src/models/cec-data.ts | 2 +- src/models/cec-slot.ts | 2 +- src/models/file.ts | 4 +- src/models/task.ts | 4 +- src/request-exception.ts | 2 +- src/services/grpc/boss/delete-file.ts | 11 +- src/services/grpc/boss/delete-task.ts | 11 +- src/services/grpc/boss/implementation.ts | 2 +- src/services/grpc/boss/list-files.ts | 2 +- .../grpc/boss/list-known-boss-apps.ts | 118 +++++++++--------- src/services/grpc/boss/list-tasks.ts | 2 +- .../boss/middleware/api-key-middleware.ts | 7 +- .../middleware/authentication-middleware.ts | 11 +- src/services/grpc/boss/register-task.ts | 9 +- .../grpc/boss/update-file-metadata.ts | 11 +- src/services/grpc/boss/update-task.ts | 11 +- src/services/grpc/boss/upload-file.ts | 11 +- src/services/grpc/server.ts | 5 +- src/services/npfl.ts | 20 +-- src/services/nppl.ts | 4 +- src/types/common/config.ts | 4 +- src/types/common/policylist.ts | 2 +- src/types/common/user-agent-info.ts | 2 +- src/types/express-subdomain.d.ts | 2 +- src/types/mongoose/cec-data.ts | 6 +- src/types/mongoose/cec-slot.ts | 6 +- src/types/mongoose/file.ts | 6 +- src/types/mongoose/task.ts | 12 +- 31 files changed, 160 insertions(+), 150 deletions(-) diff --git a/src/config-manager.ts b/src/config-manager.ts index 6b6737c..125002e 100644 --- a/src/config-manager.ts +++ b/src/config-manager.ts @@ -1,10 +1,10 @@ import crypto from 'node:crypto'; import path from 'node:path'; import fs from 'fs-extra'; -import mongoose from 'mongoose'; import dotenv from 'dotenv'; import { LOG_INFO, LOG_WARN, LOG_ERROR } from '@/logger'; -import { DisabledFeatures, Config } from '@/types/common/config'; +import type mongoose from 'mongoose'; +import type { DisabledFeatures, Config } from '@/types/common/config'; dotenv.config(); @@ -78,7 +78,7 @@ export const config: Config = { secret: process.env.PN_BOSS_CONFIG_S3_ACCESS_SECRET?.trim() || '' }, disk_path: process.env.PN_BOSS_CONFIG_CDN_DISK_PATH?.trim() || '' - }, + } }; LOG_INFO('Config loaded, checking integrity'); diff --git a/src/database.ts b/src/database.ts index 5cad623..f5d11c6 100644 --- a/src/database.ts +++ b/src/database.ts @@ -4,10 +4,10 @@ import { CECSlot } from '@/models/cec-slot'; import { Task } from '@/models/task'; import { File } from '@/models/file'; import { config } from '@/config-manager'; -import { HydratedCECDataDocument } from '@/types/mongoose/cec-data'; -import { HydratedCECSlotDocument, ICECSlot } from '@/types/mongoose/cec-slot'; -import { HydratedTaskDocument, ITask } from '@/types/mongoose/task'; -import { HydratedFileDocument, IFile } from '@/types/mongoose/file'; +import type { HydratedCECDataDocument } from '@/types/mongoose/cec-data'; +import type { HydratedCECSlotDocument, ICECSlot } from '@/types/mongoose/cec-slot'; +import type { HydratedTaskDocument, ITask } from '@/types/mongoose/task'; +import type { HydratedFileDocument, IFile } from '@/types/mongoose/file'; const connection_string: string = config.mongoose.connection_string; const options: mongoose.ConnectOptions = config.mongoose.options; @@ -168,7 +168,7 @@ export async function getRandomCECData(pids: number[], gameID: number): Promise< // * We search through the CECSlot so that everyone has the same chance of getting their data picked up const filter: mongoose.FilterQuery = { creator_pid: { - $in: pids, + $in: pids }, game_id: gameID }; diff --git a/src/middleware/parse-user-agent.ts b/src/middleware/parse-user-agent.ts index ad03b0a..5fcdabf 100644 --- a/src/middleware/parse-user-agent.ts +++ b/src/middleware/parse-user-agent.ts @@ -1,6 +1,7 @@ -import express from 'express'; +import { CTRSystemModel } from '@/types/common/user-agent-info'; +import type { UserAgentInfo } from '@/types/common/user-agent-info'; +import type express from 'express'; // import RequestException from '@/request-exception'; -import { CTRSystemModel, UserAgentInfo } from '@/types/common/user-agent-info'; const FIRMWARE_PATCH_REGION_WIIU_REGEX = /(\d)([JEU])/; diff --git a/src/models/cec-data.ts b/src/models/cec-data.ts index ec9c138..a140527 100644 --- a/src/models/cec-data.ts +++ b/src/models/cec-data.ts @@ -1,5 +1,5 @@ import mongoose from 'mongoose'; -import { ICECData, ICECDataMethods, CECDataModel } from '@/types/mongoose/cec-data'; +import type { ICECData, ICECDataMethods, CECDataModel } from '@/types/mongoose/cec-data'; const CECDataSchema = new mongoose.Schema({ creator_pid: Number, diff --git a/src/models/cec-slot.ts b/src/models/cec-slot.ts index 057eb38..ad9bd62 100644 --- a/src/models/cec-slot.ts +++ b/src/models/cec-slot.ts @@ -1,5 +1,5 @@ import mongoose from 'mongoose'; -import { ICECSlot, ICECSlotMethods, CECSlotModel } from '@/types/mongoose/cec-slot'; +import type { ICECSlot, ICECSlotMethods, CECSlotModel } from '@/types/mongoose/cec-slot'; const CECSlotSchema = new mongoose.Schema({ creator_pid: Number, diff --git a/src/models/file.ts b/src/models/file.ts index 10716d4..746c4d1 100644 --- a/src/models/file.ts +++ b/src/models/file.ts @@ -1,6 +1,6 @@ import mongoose from 'mongoose'; -import { AutoIncrementID } from '@typegoose/auto-increment'; -import { IFile, IFileMethods, FileModel } from '@/types/mongoose/file'; +import { AutoIncrementID } from '@typegoose/auto-increment'; +import type { IFile, IFileMethods, FileModel } from '@/types/mongoose/file'; const FileSchema = new mongoose.Schema({ deleted: { diff --git a/src/models/task.ts b/src/models/task.ts index 44ca1a0..ac06bf8 100644 --- a/src/models/task.ts +++ b/src/models/task.ts @@ -1,5 +1,5 @@ import mongoose from 'mongoose'; -import { ITask, ITaskMethods, TaskModel } from '@/types/mongoose/task'; +import type { ITask, ITaskMethods, TaskModel } from '@/types/mongoose/task'; const TaskSchema = new mongoose.Schema({ deleted: { @@ -12,7 +12,7 @@ const TaskSchema = new mongoose.Schema({ creator_pid: Number, status: { type: String, - enum : ['open'] // TODO - What else is there? + enum: ['open'] // TODO - What else is there? }, title_id: String, description: Number, diff --git a/src/request-exception.ts b/src/request-exception.ts index b91ec7e..b35016c 100644 --- a/src/request-exception.ts +++ b/src/request-exception.ts @@ -6,4 +6,4 @@ export default class RequestException extends Error { this.status = status; } -} \ No newline at end of file +} diff --git a/src/services/grpc/boss/delete-file.ts b/src/services/grpc/boss/delete-file.ts index 294b1b1..48d6d2f 100644 --- a/src/services/grpc/boss/delete-file.ts +++ b/src/services/grpc/boss/delete-file.ts @@ -1,9 +1,10 @@ -import { CallContext, Status, ServerError } from 'nice-grpc'; -import { DeleteFileRequest } from '@pretendonetwork/grpc/boss/delete_file'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import { Status, ServerError } from 'nice-grpc'; import { getTaskFileByDataID } from '@/database'; -import { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; -import { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty'; +import type { CallContext } from 'nice-grpc'; +import type { DeleteFileRequest } from '@pretendonetwork/grpc/boss/delete_file'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty'; +import type { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; export async function deleteFile(request: DeleteFileRequest, context: CallContext & AuthenticationCallContextExt): Promise { // * This is asserted in authentication middleware, we know this is never null diff --git a/src/services/grpc/boss/delete-task.ts b/src/services/grpc/boss/delete-task.ts index 6b15d8d..4151eb7 100644 --- a/src/services/grpc/boss/delete-task.ts +++ b/src/services/grpc/boss/delete-task.ts @@ -1,9 +1,10 @@ -import { CallContext, Status, ServerError } from 'nice-grpc'; -import { DeleteTaskRequest } from '@pretendonetwork/grpc/boss/delete_task'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import { Status, ServerError } from 'nice-grpc'; import { getTask } from '@/database'; -import { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; -import { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty'; +import type { CallContext } from 'nice-grpc'; +import type { DeleteTaskRequest } from '@pretendonetwork/grpc/boss/delete_task'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; +import type { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty'; export async function deleteTask(request: DeleteTaskRequest, context: CallContext & AuthenticationCallContextExt): Promise { // * This is asserted in authentication middleware, we know this is never null diff --git a/src/services/grpc/boss/implementation.ts b/src/services/grpc/boss/implementation.ts index 2f6491b..c674db7 100644 --- a/src/services/grpc/boss/implementation.ts +++ b/src/services/grpc/boss/implementation.ts @@ -1,4 +1,3 @@ -import { BOSSServiceImplementation } from '@pretendonetwork/grpc/boss/boss_service'; import { listKnownBOSSApps } from '@/services/grpc/boss/list-known-boss-apps'; import { listTasks } from '@/services/grpc/boss/list-tasks'; import { registerTask } from '@/services/grpc/boss/register-task'; @@ -8,6 +7,7 @@ import { listFiles } from '@/services/grpc/boss/list-files'; import { uploadFile } from '@/services/grpc/boss/upload-file'; import { updateFileMetadata } from '@/services/grpc/boss/update-file-metadata'; import { deleteFile } from '@/services/grpc/boss/delete-file'; +import type { BOSSServiceImplementation } from '@pretendonetwork/grpc/boss/boss_service'; export const implementation: BOSSServiceImplementation = { listKnownBOSSApps, diff --git a/src/services/grpc/boss/list-files.ts b/src/services/grpc/boss/list-files.ts index 48fb609..112caa9 100644 --- a/src/services/grpc/boss/list-files.ts +++ b/src/services/grpc/boss/list-files.ts @@ -1,7 +1,7 @@ import { Status, ServerError } from 'nice-grpc'; -import { ListFilesRequest, ListFilesResponse } from '@pretendonetwork/grpc/boss/list_files'; import { isValidCountryCode, isValidLanguage } from '@/util'; import { getTaskFiles } from '@/database'; +import type { ListFilesRequest, ListFilesResponse } from '@pretendonetwork/grpc/boss/list_files'; const BOSS_APP_ID_FILTER_REGEX = /^[A-Za-z0-9]*$/; diff --git a/src/services/grpc/boss/list-known-boss-apps.ts b/src/services/grpc/boss/list-known-boss-apps.ts index 414cca3..039d0c9 100644 --- a/src/services/grpc/boss/list-known-boss-apps.ts +++ b/src/services/grpc/boss/list-known-boss-apps.ts @@ -1,4 +1,4 @@ -import { ListKnownBOSSAppsResponse } from '@pretendonetwork/grpc/boss/list_known_boss_apps'; +import type { ListKnownBOSSAppsResponse } from '@pretendonetwork/grpc/boss/list_known_boss_apps'; export async function listKnownBOSSApps(): Promise { return { @@ -8,400 +8,400 @@ export async function listKnownBOSSApps(): Promise { titleId: '0005003010016000', titleRegion: 'UNK', name: 'Unknown', - tasks: [ 'olvinfo' ] + tasks: ['olvinfo'] }, { bossAppId: 'VFoY6V7u7UUq1EG5', titleId: '0005003010016100', titleRegion: 'UNK', name: 'Unknown', - tasks: [ 'olvinfo' ] + tasks: ['olvinfo'] }, { bossAppId: '8MNOVprfNVAJjfCM', titleId: '0005003010016200', titleRegion: 'UNK', name: 'Unknown', - tasks: [ 'olvinfo' ] + tasks: ['olvinfo'] }, { bossAppId: 'v1cqzWykBKUg0rHQ', titleId: '000500301001900A', titleRegion: 'JPN', name: 'Miiverse Post All', - tasks: [ 'solv' ] + tasks: ['solv'] }, { bossAppId: 'bieC9ACJlisFg5xS', titleId: '000500301001910A', titleRegion: 'USA', name: 'Miiverse Post All', - tasks: [ 'solv' ] + tasks: ['solv'] }, { bossAppId: 'tOaQcoBLtPTgVN3Y', titleId: '000500301001920A', titleRegion: 'EUR', name: 'Miiverse Post All', - tasks: [ 'solv' ] + tasks: ['solv'] }, { bossAppId: 'HX8a16MMNn6i1z0Y', titleId: '000500301001400A', titleRegion: 'JPN', name: 'Nintendo eShop', - tasks: [ 'wood1', 'woodBGM' ] + tasks: ['wood1', 'woodBGM'] }, { bossAppId: '07E3nY6lAwlwrQRo', titleId: '000500301001410A', titleRegion: 'USA', name: 'Nintendo eShop', - tasks: [ 'wood1', 'woodBGM' ] + tasks: ['wood1', 'woodBGM'] }, { bossAppId: '8UsM86l8xgkjFk8z', titleId: '000500301001420A', titleRegion: 'EUR', name: 'Nintendo eShop', - tasks: [ 'wood1', 'woodBGM' ] + tasks: ['wood1', 'woodBGM'] }, { bossAppId: 'IXmFUqR2qenXfF61', titleId: '0005001010066000', titleRegion: 'ALL', name: 'ECO Process', - tasks: [ 'promo1', 'promo2', 'promo3', 'push' ] + tasks: ['promo1', 'promo2', 'promo3', 'push'] }, { bossAppId: 'BMQAm5iUVtPsJVsU', titleId: '000500101004D000', titleRegion: 'JPN', name: 'Notifications', - tasks: [ 'sysmsg1', 'sysmsg2' ] + tasks: ['sysmsg1', 'sysmsg2'] }, { bossAppId: 'LRmanFo4Tx3kEGDp', titleId: '000500101004D100', titleRegion: 'USA', name: 'Notifications', - tasks: [ 'sysmsg1', 'sysmsg2' ] + tasks: ['sysmsg1', 'sysmsg2'] }, { bossAppId: 'TZr27FE8wzKiEaTO', titleId: '000500101004D200', titleRegion: 'EUR', name: 'Notifications', - tasks: [ 'sysmsg1', 'sysmsg2' ] + tasks: ['sysmsg1', 'sysmsg2'] }, { bossAppId: 'JnIrm9c4E9JBmxBo', titleId: '0005000010185200', titleRegion: 'JPN', name: 'NewスーパーマリオブラザーズU 無料お試し版 (New SUPER MARIO BROS. U (Trial))', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: 'dadlI27Ww8H2d56x', titleId: '0005000010101C00', titleRegion: 'JPN', name: 'NewスーパーマリオブラザーズU (New SUPER MARIO BROS. U)', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: 'RaPn5saabzliYrpo', titleId: '0005000010101D00', titleRegion: 'USA', name: 'New SUPER MARIO BROS. U', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: '14VFIK3rY2SP0WRE', titleId: '0005000010101E00', titleRegion: 'EUR', name: 'New SUPER MARIO BROS. U', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: 'RbEQ44t2AocC4rvu', titleId: '000500001014B700', titleRegion: 'USA', name: 'New SUPER MARIO BROS. U + New SUPER LUIGI U', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: '287gv3WZdxo1QRhl', titleId: '000500001014B800', titleRegion: 'EUR', name: 'New SUPER MARIO BROS. U + New SUPER LUIGI U', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: 'bb6tOEckvgZ50ciH', titleId: '0005000010162B00', titleRegion: 'JPN', name: 'スプラトゥーン (Splatoon)', - tasks: [ 'optdat2', 'schdat2', 'schdata' ] + tasks: ['optdat2', 'schdat2', 'schdata'] }, { bossAppId: 'rjVlM7hUXPxmYQJh', titleId: '0005000010176900', titleRegion: 'USA', name: 'Splatoon', - tasks: [ 'optdat2', 'schdat2', 'schdata', 'optdata2', 'schdata2' ] + tasks: ['optdat2', 'schdat2', 'schdata', 'optdata2', 'schdata2'] }, { bossAppId: 'zvGSM4kOrXpkKnpT', titleId: '0005000010176A00', titleRegion: 'EUR', name: 'Splatoon', - tasks: [ 'optdat2', 'schdat2', 'schdata', 'optdata' ] + tasks: ['optdat2', 'schdat2', 'schdata', 'optdata'] }, { bossAppId: 'm8KJPtmPweiPuETE', titleId: '000500001012F100', titleRegion: 'JPN', name: 'Wii Sports Club', - tasks: [ 'sp1_ans' ] + tasks: ['sp1_ans'] }, { bossAppId: 'pO72Hi5uqf5yuNd8', titleId: '0005000010144D00', titleRegion: 'USA', name: 'Wii Sports Club', - tasks: [ 'sp1_ans' ] + tasks: ['sp1_ans'] }, { bossAppId: '4m8Xme1wKgzwslTJ', titleId: '0005000010144E00', titleRegion: 'EUR', name: 'Wii Sports Club', - tasks: [ 'sp1_ans' ] + tasks: ['sp1_ans'] }, { bossAppId: 'ESLqtAhxS8KQU4eu', titleId: '000500001018DB00', titleRegion: 'JPN', name: 'Super Mario Maker (スーパーマリオメーカー)', - tasks: [ 'CHARA' ] + tasks: ['CHARA'] }, { bossAppId: 'vGwChBW1ExOoHDsm', titleId: '000500001018DC00', titleRegion: 'USA', name: 'Super Mario Maker', - tasks: [ 'CHARA' ] + tasks: ['CHARA'] }, { bossAppId: 'IeUc4hQsKKe9rJHB', titleId: '000500001018DD00', titleRegion: 'EUA', name: 'Super Mario Maker', - tasks: [ 'CHARA' ] + tasks: ['CHARA'] }, { bossAppId: '4krJA4Gx3jF5nhQf', titleId: '000500001012BC00', titleRegion: 'JPN', name: 'ピクミン3 (PIKMIN 3)', - tasks: [ 'histgrm' ] + tasks: ['histgrm'] }, { bossAppId: '9jRZEoWYLc3OG9a8', titleId: '000500001012BD00', titleRegion: 'USA', name: 'PIKMIN 3', - tasks: [ 'histgrm' ] + tasks: ['histgrm'] }, { bossAppId: 'VWqUTspR5YtjDjxa', titleId: '000500001012BE00', titleRegion: 'EUR', name: 'PIKMIN 3', - tasks: [ 'histgrm' ] + tasks: ['histgrm'] }, { bossAppId: 'Ge1KtMu8tYlf4AUM', titleId: '0005000010192000', titleRegion: 'JPN', name: '太鼓の達人 特盛り! (Taiko no Tatsujin Tokumori!)', - tasks: [ 'notice1' ] + tasks: ['notice1'] }, { bossAppId: 'gycVtTzCouZmukZ6', titleId: '0005000010110E00', titleRegion: 'JPN', name: '大乱闘スマッシュブラザーズ for Wii U (Super Smash Bros. for Wii U)', - tasks: [ 'NEWS', 'amiibo' ] + tasks: ['NEWS', 'amiibo'] }, { bossAppId: 'o2Ug1pIp9Uhri6Nh', titleId: '0005000010144F00', titleRegion: 'USA', name: 'Super Smash Bros. for Wii U', - tasks: [ 'amiibo', 'NEWS', 'friend', 'CONQ' ] + tasks: ['amiibo', 'NEWS', 'friend', 'CONQ'] }, { bossAppId: 'n6rAJ1nnfC1Sgcpl', titleId: '0005000010145000', titleRegion: 'EUR', name: 'Super Smash Bros. for Wii U', - tasks: [ 'amiibo', 'NEWS', 'friend', 'CONQ' ] + tasks: ['amiibo', 'NEWS', 'friend', 'CONQ'] }, { bossAppId: 'CHUN6T1m7Xk4EBg4', titleId: '00050000101DFF00', titleRegion: 'JPN', name: 'プチコンBIG (Petitcom BIG)', - tasks: [ 'ptcbnws' ] + tasks: ['ptcbnws'] }, { bossAppId: 'zyXdCW9jGdi9rjaz', titleId: '0005000010142200', titleRegion: 'JPN', name: 'NewスーパールイージU (New SUPER LUIGI U)', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: 'jPHLlJr2fJyTzffp', titleId: '0005000010142300', titleRegion: 'USA', name: 'New SUPER LUIGI U', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: 'YsXB6IRGSI56tPxl', titleId: '0005000010142400', titleRegion: 'EUR', name: 'New SUPER LUIGI U', - tasks: [ 'news' ] + tasks: ['news'] }, { bossAppId: 'Lbqp9Sg1i0xUzFFa', titleId: '0005000010113800', titleRegion: 'EUR', name: 'Zen Pinball 2', - tasks: [ 'PTS' ] + tasks: ['PTS'] }, { bossAppId: 'DwU7n0FidGrLNiOo', titleId: '000500001014D900', titleRegion: 'JPN', name: 'ぷよぷよテトリス (PUYOPUYOTETRIS)', - tasks: [ 'boss1', 'boss2', 'boss3' ] + tasks: ['boss1', 'boss2', 'boss3'] }, { bossAppId: 'yIUkFmuGVkGP8pDb', titleId: '0005000010132200', titleRegion: 'JPN', name: '太鼓の達人 Wii Uば~じょん! (Taiko no Tatsujin Wii U version!)', - tasks: [ 'notice1' ] + tasks: ['notice1'] }, { bossAppId: 'v4WRObSzD7VU3dcJ', titleId: '00050000101D3000', titleRegion: 'JPN', name: '太鼓の達人 あつめて★ともだち大作戦! (Taiko no Tatsujin Atsumete★ TomodachiDaisakusen!)', - tasks: [ 'notice1' ] + tasks: ['notice1'] }, { bossAppId: '3zDjXIA57bSceyaw', titleId: '00050000101BEC00', titleRegion: 'USA', name: 'Star Fox Guard', - tasks: [ 'param' ] + tasks: ['param'] }, { bossAppId: 'NL38jhExI2CQqhWd', titleId: '00050000101CDB00', titleRegion: 'JPN', name: 'Splatoon Pre-Launch Review', - tasks: [ 'schdata' ] + tasks: ['schdata'] }, { bossAppId: 'sE6KwEpQYyg6tdU7', titleId: '00050000101CDC00', titleRegion: 'USA', name: 'Splatoon Pre-Launch Review', - tasks: [ 'schdata' ] + tasks: ['schdata'] }, { bossAppId: 'pTKZ9q5KrCP3gBag', titleId: '00050000101CDD00', titleRegion: 'EUR', name: 'Splatoon Pre-Launch Review', - tasks: [ 'schdata' ] + tasks: ['schdata'] }, { bossAppId: 'CJT88RO008LAnD51', titleId: '0005000010170600', titleRegion: 'JPN', name: '仮面ライダー バトライド・ウォーⅡ プレミアムTV&MOVIEサウンドED. (KAMEN RIDER BATTRIDE WAR Ⅱ PREMIUM TV&MOVIE SOUND ED.)', - tasks: [ 'PE_GAK', 'PE_ZNG' ] + tasks: ['PE_GAK', 'PE_ZNG'] }, { bossAppId: 'FyyMFzEByuQJc6sJ', titleId: '0005000010135200', titleRegion: 'USA', name: 'Star Wars Pinball', - tasks: [ 'PTS' ] + tasks: ['PTS'] }, { bossAppId: 'A4yyXWKZZUToFtrt', titleId: '0005000010132A00', titleRegion: 'EUR', name: 'Star Wars Pinball', - tasks: [ 'PTS' ] + tasks: ['PTS'] }, { bossAppId: 'HauaFQ1sPsnQ6rBj', titleId: '0005000010171F00', titleRegion: 'USA', name: 'Pushmo World', - tasks: [ 'annouce' ] + tasks: ['annouce'] }, { bossAppId: 'qDUeFmk0Az71nHyD', titleId: '0005000010110900', titleRegion: 'JPN', name: 'NINJA GAIDEN 3: Razor\'s Edge', - tasks: [ 'DLCINFO' ] + tasks: ['DLCINFO'] }, { bossAppId: 'yVsSPM2E0DEOxroT', titleId: '0005000010110A00', titleRegion: 'USA', name: 'NINJA GAIDEN 3: Razor\'s Edge', - tasks: [ 'DLCINFO' ] + tasks: ['DLCINFO'] }, { bossAppId: 'Xw6OvZkQofQ3O8Bi', titleId: '0005000010110B00', titleRegion: 'EUR', name: 'Ninja Gaiden 3: Razor\'s Edge', - tasks: [ 'DLCINFO' ] + tasks: ['DLCINFO'] }, { bossAppId: 'LUQX5swEjBUPQ8nR', titleId: '0005000010110200', titleRegion: 'USA', name: 'WARRIORS OROCHI 3 Hyper(NA)', - tasks: [ 'OR2H000' ] + tasks: ['OR2H000'] }, { bossAppId: 'y4pXrgLe0JGao3No', titleId: '0005000010112B00', titleRegion: 'EUR', name: 'WARRIORS OROCHI 3 Hyper(EU)', - tasks: [ 'OR2H000' ] + tasks: ['OR2H000'] }, { bossAppId: 'j01mRJ9sNe00MWPC', titleId: '0005000010170700', titleRegion: 'JPN', name: '仮面ライダー バトライド・ウォーⅡ (KAMEN RIDER BATTRIDE WAR Ⅱ)', - tasks: [ 'CHR_GAK', 'CHR_ZNG' ] + tasks: ['CHR_GAK', 'CHR_ZNG'] } ] }; -} \ No newline at end of file +} diff --git a/src/services/grpc/boss/list-tasks.ts b/src/services/grpc/boss/list-tasks.ts index 4066f94..983afc4 100644 --- a/src/services/grpc/boss/list-tasks.ts +++ b/src/services/grpc/boss/list-tasks.ts @@ -1,5 +1,5 @@ -import { ListTasksResponse } from '@pretendonetwork/grpc/boss/list_tasks'; import { getAllTasks } from '@/database'; +import type { ListTasksResponse } from '@pretendonetwork/grpc/boss/list_tasks'; export async function listTasks(): Promise { const tasks = await getAllTasks(false); diff --git a/src/services/grpc/boss/middleware/api-key-middleware.ts b/src/services/grpc/boss/middleware/api-key-middleware.ts index b2b5c29..211c2cc 100644 --- a/src/services/grpc/boss/middleware/api-key-middleware.ts +++ b/src/services/grpc/boss/middleware/api-key-middleware.ts @@ -1,9 +1,10 @@ -import { Status, ServerMiddlewareCall, CallContext, ServerError } from 'nice-grpc'; +import { Status, ServerError } from 'nice-grpc'; import { config } from '@/config-manager'; +import type { ServerMiddlewareCall, CallContext } from 'nice-grpc'; export async function* apiKeyMiddleware( call: ServerMiddlewareCall, - context: CallContext, + context: CallContext ): AsyncGenerator { const apiKey: string | undefined = context.metadata.get('X-API-Key'); @@ -12,4 +13,4 @@ export async function* apiKeyMiddleware( } return yield* call.next(call.request, context); -} \ No newline at end of file +} diff --git a/src/services/grpc/boss/middleware/authentication-middleware.ts b/src/services/grpc/boss/middleware/authentication-middleware.ts index dfbb404..ec00a33 100644 --- a/src/services/grpc/boss/middleware/authentication-middleware.ts +++ b/src/services/grpc/boss/middleware/authentication-middleware.ts @@ -1,13 +1,14 @@ -import { Status, ServerMiddlewareCall, CallContext, ServerError } from 'nice-grpc'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import { Status, ServerError } from 'nice-grpc'; import { getUserDataByToken } from '@/util'; +import type { ServerMiddlewareCall, CallContext } from 'nice-grpc'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; const TOKEN_REQUIRED_PATHS = [ '/boss.BOSS/RegisterTask', '/boss.BOSS/UpdateTask', '/boss.BOSS/DeleteTask', '/boss.BOSS/UploadFile', - '/boss.BOSS/DeleteFile', + '/boss.BOSS/DeleteFile' ]; export type AuthenticationCallContextExt = { @@ -16,7 +17,7 @@ export type AuthenticationCallContextExt = { export async function* authenticationMiddleware( call: ServerMiddlewareCall, - context: CallContext, + context: CallContext ): AsyncGenerator { const token: string | undefined = context.metadata.get('X-Token')?.trim(); @@ -50,4 +51,4 @@ export async function* authenticationMiddleware( throw new ServerError(Status.INVALID_ARGUMENT, message); } -} \ No newline at end of file +} diff --git a/src/services/grpc/boss/register-task.ts b/src/services/grpc/boss/register-task.ts index e29d47c..c7c4487 100644 --- a/src/services/grpc/boss/register-task.ts +++ b/src/services/grpc/boss/register-task.ts @@ -1,9 +1,10 @@ -import { CallContext, Status, ServerError } from 'nice-grpc'; -import { RegisterTaskRequest, RegisterTaskResponse } from '@pretendonetwork/grpc/boss/register_task'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import { ServerError, Status } from 'nice-grpc'; import { getTask } from '@/database'; import { Task } from '@/models/task'; -import { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; +import type { CallContext } from 'nice-grpc'; +import type { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { RegisterTaskRequest, RegisterTaskResponse } from '@pretendonetwork/grpc/boss/register_task'; const BOSS_APP_ID_FILTER_REGEX = /^[A-Za-z0-9]*$/; diff --git a/src/services/grpc/boss/update-file-metadata.ts b/src/services/grpc/boss/update-file-metadata.ts index 847d978..01fc7f8 100644 --- a/src/services/grpc/boss/update-file-metadata.ts +++ b/src/services/grpc/boss/update-file-metadata.ts @@ -1,10 +1,11 @@ -import { CallContext, Status, ServerError } from 'nice-grpc'; -import { UpdateFileMetadataRequest } from '@pretendonetwork/grpc/boss/update_file_metadata'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import { Status, ServerError } from 'nice-grpc'; import { getTaskFileByDataID } from '@/database'; -import { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; -import { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty'; import { isValidFileNotifyCondition, isValidFileType } from '@/util'; +import type { CallContext } from 'nice-grpc'; +import type { UpdateFileMetadataRequest } from '@pretendonetwork/grpc/boss/update_file_metadata'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; +import type { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty'; export async function updateFileMetadata(request: UpdateFileMetadataRequest, context: CallContext & AuthenticationCallContextExt): Promise { // * This is asserted in authentication middleware, we know this is never null diff --git a/src/services/grpc/boss/update-task.ts b/src/services/grpc/boss/update-task.ts index c5b8a18..113cccb 100644 --- a/src/services/grpc/boss/update-task.ts +++ b/src/services/grpc/boss/update-task.ts @@ -1,9 +1,10 @@ -import { CallContext, Status, ServerError } from 'nice-grpc'; -import { UpdateTaskRequest } from '@pretendonetwork/grpc/boss/update_task'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import { Status, ServerError } from 'nice-grpc'; import { getTask } from '@/database'; -import { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; -import { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty'; +import type { CallContext } from 'nice-grpc'; +import type { UpdateTaskRequest } from '@pretendonetwork/grpc/boss/update_task'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; +import type { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty'; export async function updateTask(request: UpdateTaskRequest, context: CallContext & AuthenticationCallContextExt): Promise { // * This is asserted in authentication middleware, we know this is never null diff --git a/src/services/grpc/boss/upload-file.ts b/src/services/grpc/boss/upload-file.ts index 88c22f9..6abae9c 100644 --- a/src/services/grpc/boss/upload-file.ts +++ b/src/services/grpc/boss/upload-file.ts @@ -1,12 +1,13 @@ -import { CallContext, Status, ServerError } from 'nice-grpc'; -import { UploadFileRequest, UploadFileResponse } from '@pretendonetwork/grpc/boss/upload_file'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import { Status, ServerError } from 'nice-grpc'; import { encryptWiiU } from '@pretendonetwork/boss-crypto'; import { isValidCountryCode, isValidFileNotifyCondition, isValidFileType, isValidLanguage, md5, uploadCDNFile } from '@/util'; import { getTask, getTaskFile } from '@/database'; import { File } from '@/models/file'; -import { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; import { config } from '@/config-manager'; +import type { CallContext } from 'nice-grpc'; +import type { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { UploadFileRequest, UploadFileResponse } from '@pretendonetwork/grpc/boss/upload_file'; const BOSS_APP_ID_FILTER_REGEX = /^[A-Za-z0-9]*$/; @@ -172,7 +173,7 @@ export async function uploadFile(request: UploadFileRequest, context: CallContex notifyOnNew: file.notify_on_new, notifyLed: file.notify_led, createdTimestamp: file.created, - updatedTimestamp: file.updated, + updatedTimestamp: file.updated } }; } diff --git a/src/services/grpc/server.ts b/src/services/grpc/server.ts index 98b78b2..f156275 100644 --- a/src/services/grpc/server.ts +++ b/src/services/grpc/server.ts @@ -1,9 +1,10 @@ -import { createServer, Server } from 'nice-grpc'; +import { createServer } from 'nice-grpc'; import { BOSSDefinition } from '@pretendonetwork/grpc/boss/boss_service'; import { apiKeyMiddleware } from '@/services/grpc/boss/middleware/api-key-middleware'; import { authenticationMiddleware } from '@/services/grpc/boss/middleware/authentication-middleware'; import { implementation } from '@/services/grpc/boss/implementation'; import { config } from '@/config-manager'; +import type { Server } from 'nice-grpc'; export async function startGRPCServer(): Promise { const server: Server = createServer(); @@ -11,4 +12,4 @@ export async function startGRPCServer(): Promise { server.with(apiKeyMiddleware).with(authenticationMiddleware).add(BOSSDefinition, implementation); await server.listen(`${config.grpc.boss.address}:${config.grpc.boss.port}`); -} \ No newline at end of file +} diff --git a/src/services/npfl.ts b/src/services/npfl.ts index 8aac8a6..e016ffc 100644 --- a/src/services/npfl.ts +++ b/src/services/npfl.ts @@ -15,14 +15,14 @@ npfl.get('/p01/filelist/:appID/:taskID', async (request: express.Request<{ appID: string; taskID: string; }, any, any, { - c?: string; - l?: string; - a1?: string; - a2?: string; - a3?: string; - ap?: string; - tm?: string; -}>, response) => { + c?: string; + l?: string; + a1?: string; + a2?: string; + a3?: string; + ap?: string; + tm?: string; + }>, response) => { for (const param in request.query) { // * Beats me why the real server does this. // * Just doing accurate emulation ¯\_(ツ)_/¯ @@ -87,7 +87,7 @@ npfl.get('/p01/filelist/:appID/:taskID', async (request: express.Request<{ file.attribute2, file.attribute3, file.size, - file.updated/1000n // * Expects time as seconds, not milliseconds + file.updated / 1000n // * Expects time as seconds, not milliseconds ]; const line = `${params.join('\t')}\r\n`; @@ -111,4 +111,4 @@ const router = express.Router(); router.use(subdomain('npfl.c.app', npfl)); -export default router; \ No newline at end of file +export default router; diff --git a/src/services/nppl.ts b/src/services/nppl.ts index b3390c5..7429843 100644 --- a/src/services/nppl.ts +++ b/src/services/nppl.ts @@ -2,7 +2,7 @@ import xmlbuilder from 'xmlbuilder'; import moment from 'moment'; import express from 'express'; import subdomain from 'express-subdomain'; -import { PolicyList } from '@/types/common/policylist'; +import type { PolicyList } from '@/types/common/policylist'; const nppl = express.Router(); @@ -186,4 +186,4 @@ const router = express.Router(); router.use(subdomain('nppl.c.app', nppl)); // * 3DS router.use(subdomain('nppl.app', nppl)); // * WiiU -export default router; \ No newline at end of file +export default router; diff --git a/src/types/common/config.ts b/src/types/common/config.ts index 5dd3d13..021d197 100644 --- a/src/types/common/config.ts +++ b/src/types/common/config.ts @@ -1,7 +1,7 @@ -import mongoose from 'mongoose'; +import type mongoose from 'mongoose'; export interface DisabledFeatures { - s3: boolean + s3: boolean; } export interface Config { diff --git a/src/types/common/policylist.ts b/src/types/common/policylist.ts index 4136fac..edab4de 100644 --- a/src/types/common/policylist.ts +++ b/src/types/common/policylist.ts @@ -14,4 +14,4 @@ export type PolicyList = { Persistent?: boolean; Revive?: boolean; }[]; -}; \ No newline at end of file +}; diff --git a/src/types/common/user-agent-info.ts b/src/types/common/user-agent-info.ts index 49602e1..f428531 100644 --- a/src/types/common/user-agent-info.ts +++ b/src/types/common/user-agent-info.ts @@ -4,7 +4,7 @@ export enum CTRSystemModel { KTR, // * New Nintendo 3DS FTR, // * Nintendo 2DS RED, // * New Nintendo 3DS XL - JAN // * New Nintendo 2DS XL + JAN // * New Nintendo 2DS XL } export type UserAgentInfo = { diff --git a/src/types/express-subdomain.d.ts b/src/types/express-subdomain.d.ts index 933d1f0..9c57184 100644 --- a/src/types/express-subdomain.d.ts +++ b/src/types/express-subdomain.d.ts @@ -13,4 +13,4 @@ declare module 'express-subdomain'{ subdomain: string, fn: Router | ((req: Request, res: Response) => void | any) ): (req: Request, res: Response, next: () => void) => void | typeof fn; -} \ No newline at end of file +} diff --git a/src/types/mongoose/cec-data.ts b/src/types/mongoose/cec-data.ts index db4cac7..1327530 100644 --- a/src/types/mongoose/cec-data.ts +++ b/src/types/mongoose/cec-data.ts @@ -1,4 +1,4 @@ -import { Model, HydratedDocument } from 'mongoose'; +import type { Model, HydratedDocument } from 'mongoose'; export interface ICECData { creator_pid: number; @@ -13,6 +13,6 @@ export interface ICECDataMethods {} interface ICECDataQueryHelpers {} -export type CECDataModel = Model +export type CECDataModel = Model; -export type HydratedCECDataDocument = HydratedDocument +export type HydratedCECDataDocument = HydratedDocument; diff --git a/src/types/mongoose/cec-slot.ts b/src/types/mongoose/cec-slot.ts index 0fd8530..cdbfb89 100644 --- a/src/types/mongoose/cec-slot.ts +++ b/src/types/mongoose/cec-slot.ts @@ -1,4 +1,4 @@ -import { Model, HydratedDocument } from 'mongoose'; +import type { Model, HydratedDocument } from 'mongoose'; export interface ICECSlot { creator_pid: number; @@ -10,6 +10,6 @@ export interface ICECSlotMethods {} interface ICECSlotQueryHelpers {} -export type CECSlotModel = Model +export type CECSlotModel = Model; -export type HydratedCECSlotDocument = HydratedDocument +export type HydratedCECSlotDocument = HydratedDocument; diff --git a/src/types/mongoose/file.ts b/src/types/mongoose/file.ts index bda397b..4988404 100644 --- a/src/types/mongoose/file.ts +++ b/src/types/mongoose/file.ts @@ -1,4 +1,4 @@ -import { Model, HydratedDocument } from 'mongoose'; +import type { Model, HydratedDocument } from 'mongoose'; export interface IFile { deleted: boolean; @@ -26,6 +26,6 @@ export interface IFileMethods {} interface IFileQueryHelpers {} -export type FileModel = Model +export type FileModel = Model; -export type HydratedFileDocument = HydratedDocument \ No newline at end of file +export type HydratedFileDocument = HydratedDocument; diff --git a/src/types/mongoose/task.ts b/src/types/mongoose/task.ts index 004093e..9204472 100644 --- a/src/types/mongoose/task.ts +++ b/src/types/mongoose/task.ts @@ -1,4 +1,4 @@ -import { Model, HydratedDocument } from 'mongoose'; +import type { Model, HydratedDocument } from 'mongoose'; export interface ITask { deleted: boolean; @@ -6,17 +6,17 @@ export interface ITask { in_game_id: string; boss_app_id: string; creator_pid: number; - status: 'open'; // TODO - Make this a union. What else is there? + status: 'open'; // TODO - Make this a union. What else is there? title_id: string; description: string; created: bigint; updated: bigint; } -export interface ITaskMethods {} +export interface ITaskMethods { } -interface ITaskQueryHelpers {} +interface ITaskQueryHelpers { } -export type TaskModel = Model +export type TaskModel = Model; -export type HydratedTaskDocument = HydratedDocument \ No newline at end of file +export type HydratedTaskDocument = HydratedDocument;