rename src/common to src/utils

This commit is contained in:
zkldi
2021-05-25 17:56:41 +01:00
parent 09f5af727a
commit 7f1829daae
112 changed files with 146 additions and 146 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import { Session, SessionData } from "express-session";
import { SYMBOL_KtchiData } from "../../src/constants/ktchi";
import { KtchiRequestData, KtchiSessionData } from "../../src/common/types";
import { KtchiRequestData, KtchiSessionData } from "../../src/utils/types";
export {};
+1 -1
View File
@@ -26,7 +26,7 @@ import {
UserMilestoneDocument,
} from "kamaitachi-common";
import monk from "monk";
import CreateLogCtx from "../../common/logger";
import CreateLogCtx from "../../utils/logger";
const logger = CreateLogCtx(__filename);
+1 -1
View File
@@ -1,6 +1,6 @@
import connectRedis from "connect-redis";
import expressSession from "express-session";
import CreateLogCtx from "../../common/logger";
import CreateLogCtx from "../../utils/logger";
import redis from "redis";
const logger = CreateLogCtx(__filename);
+1 -1
View File
@@ -11,7 +11,7 @@ function FormatVersion() {
return `v${[major, minor, patch].join(".")} (${name})`;
}
import CreateLogCtx from "./common/logger";
import CreateLogCtx from "./utils/logger";
import server from "./server/server";
import serverConfig from "./server/server-config";
import dotenv from "dotenv";
@@ -1,7 +1,7 @@
import Pr from "prudence";
import t from "tap";
import db, { CloseMongoConnection } from "../../../external/mongo/db";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import { prAssert } from "../../../test-utils/asserts";
import {
Testing511SPA,
@@ -12,7 +12,7 @@ import {
import { CreateCalculatedData, CalculateLampRating, CalculateRating } from "./calculated-data";
import deepmerge from "deepmerge";
import ResetDBState from "../../../test-utils/reset-db-state";
import { GetDefaultTierlist } from "../../../common/tierlist";
import { GetDefaultTierlist } from "../../../utils/tierlist";
const mockLogger = CreateLogCtx(__filename);
@@ -4,8 +4,8 @@ import {
GetAllTierlistDataOfType,
GetDefaultTierlist,
GetOneTierlistData,
} from "../../../common/tierlist";
import { KtLogger } from "../../../common/types";
} from "../../../utils/tierlist";
import { KtLogger } from "../../../utils/types";
import { DryScore } from "../common/types";
import { CreateGameSpecific } from "./game-specific";
import { CalculateCHUNITHMRating, CalculateGITADORARating } from "./game-specific-stats";
@@ -11,7 +11,7 @@ import {
CalculateVF5,
KaidenPercentile,
} from "./game-specific-stats";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import { isApproximately } from "../../../test-utils/asserts";
import { DryScore } from "../common/types";
@@ -1,6 +1,6 @@
import { AnyChartDocument, ESDCore, integer, Grades, Lamps } from "kamaitachi-common";
import db from "../../../external/mongo/db";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import { DryScore } from "../common/types";
/**
@@ -1,7 +1,7 @@
import Pr from "prudence";
import t from "tap";
import { CloseMongoConnection } from "../../../external/mongo/db";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import { prAssert } from "../../../test-utils/asserts";
import {
Testing511SPA,
@@ -1,6 +1,6 @@
import { AnyChartDocument, ChartDocument, Game, Playtypes, Grades, Lamps } from "kamaitachi-common";
import db from "../../../external/mongo/db";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import { DryScore } from "../common/types";
import {
CalculateBPI,
@@ -1,8 +1,8 @@
import { ImportTypes, PublicUserDocument } from "kamaitachi-common";
import crypto from "crypto";
import { FormatUserDoc } from "../../../common/user";
import { rootLogger } from "../../../common/logger";
import { KtLogger } from "../../../common/types";
import { FormatUserDoc } from "../../../utils/user";
import { rootLogger } from "../../../utils/logger";
import { KtLogger } from "../../../utils/types";
export function CreateImportLoggerAndID(userDoc: PublicUserDocument, importType: ImportTypes) {
const importID = crypto.randomBytes(20).toString("hex");
@@ -10,7 +10,7 @@ import {
Playtypes,
} from "kamaitachi-common";
import { judgementWindows, gamePercentMax } from "kamaitachi-common/js/config";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import { InternalFailure, InvalidScoreFailure } from "./converter-failures";
const logger = CreateLogCtx(__filename);
@@ -9,7 +9,7 @@ import {
ProcessGoal,
} from "./goals";
import { GoalDocument, UserGoalDocument } from "kamaitachi-common";
import { CreateFolderChartLookup } from "../../../common/folder";
import { CreateFolderChartLookup } from "../../../utils/folder";
import {
GetKTDataJSON,
Testing511SPA,
@@ -19,7 +19,7 @@ import {
TestingIIDXFolderSP10,
} from "../../../test-utils/test-data";
import deepmerge from "deepmerge";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import crypto from "crypto";
const logger = CreateLogCtx(__filename);
@@ -1,7 +1,7 @@
import { integer, Game, GoalDocument, UserGoalDocument } from "kamaitachi-common";
import { EvaluateGoalForUser } from "../../../common/goal";
import { EvaluateGoalForUser } from "../../../utils/goal";
import db from "../../../external/mongo/db";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
/**
* Update a user's progress on all of their set goals.
@@ -1,6 +1,6 @@
import t from "tap";
import db, { CloseMongoConnection } from "../../../external/mongo/db";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import ResetDBState from "../../../test-utils/reset-db-state";
import { TestingIIDXSPMilestone } from "../../../test-utils/test-data";
import { UpdateUsersMilestones } from "./milestones";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import {
integer,
Game,
@@ -8,7 +8,7 @@ import {
MilestoneImportInfo,
} from "kamaitachi-common";
import db from "../../../external/mongo/db";
import { ProcessMilestoneFromGII } from "../../../common/milestone";
import { ProcessMilestoneFromGII } from "../../../utils/milestone";
import { BulkWriteUpdateOneOperation } from "mongodb";
export async function UpdateUsersMilestones(
@@ -4,8 +4,8 @@ import ResetDBState from "../../../test-utils/reset-db-state";
import { GetKTDataJSON, Testing511SPA, TestingIIDXSPScore } from "../../../test-utils/test-data";
import { CreatePBDoc } from "./create-pb-doc";
import deepmerge from "deepmerge";
import CreateLogCtx from "../../../common/logger";
import { KtLogger } from "../../../common/types";
import CreateLogCtx from "../../../utils/logger";
import { KtLogger } from "../../../utils/types";
import { lamps } from "kamaitachi-common/js/config";
let IIDXScore = TestingIIDXSPScore;
@@ -1,7 +1,7 @@
import db from "../../../external/mongo/db";
import { integer, PBScoreDocument, ScoreDocument } from "kamaitachi-common";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import { IIDXMergeFn, SDVXMergeFn } from "./game-specific-merge";
import { BulkWriteUpdateOneOperation } from "mongodb";
export type PBScoreDocumentNoRank = Omit<PBScoreDocument, "rankingData">;
@@ -1,7 +1,7 @@
import { PBScoreDocument, ScoreDocument } from "kamaitachi-common";
import { FindChartWithChartID } from "../../../common/database-lookup/chart";
import { FindChartWithChartID } from "../../../utils/database-lookup/chart";
import db from "../../../external/mongo/db";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import { CalculateVF4, CalculateVF5 } from "../calculated-data/game-specific-stats";
import { InternalFailure } from "../common/converter-failures";
@@ -1,6 +1,6 @@
import t from "tap";
import db, { CloseMongoConnection } from "../../../external/mongo/db";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import ResetDBState from "../../../test-utils/reset-db-state";
import { Testing511SPA, TestingIIDXSPScore } from "../../../test-utils/test-data";
import { ProcessPBs } from "./process-pbs";
@@ -1,6 +1,6 @@
import { integer, PBScoreDocument } from "kamaitachi-common";
import db from "../../../external/mongo/db";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import { CreatePBDoc, UpdateChartRanking, PBScoreDocumentNoRank } from "./create-pb-doc";
export async function ProcessPBs(
@@ -8,11 +8,11 @@ import {
integer,
IDStrings,
} from "kamaitachi-common";
import { KtLogger } from "../../common/types";
import { KtLogger } from "../../utils/types";
import { ImportAllIterableData } from "./score-importing/score-importing";
import { CreateImportLoggerAndID } from "./common/import-logger";
import { CreateSessions } from "./sessions/sessions";
import { GetMilisecondsSince } from "../../common/util";
import { GetMilisecondsSince } from "../../utils/util";
import { ProcessPBs } from "./pb/process-pbs";
import { UpdateUsersGamePlaytypeStats } from "./user-game-stats/update-ugs";
import db from "../../external/mongo/db";
@@ -5,7 +5,7 @@ import {
ScoreDocument,
AnySongDocument,
} from "kamaitachi-common";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import { CreateCalculatedData } from "../calculated-data/calculated-data";
import { CalculateESDForGame } from "../common/score-utils";
import { DryScore } from "../common/types";
@@ -1,6 +1,6 @@
import { ScoreDocument } from "kamaitachi-common";
import db from "../../../external/mongo/db";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
const logger = CreateLogCtx(__filename);
const ScoreQueue: ScoreDocument[] = [];
@@ -17,8 +17,8 @@ import {
} from "../common/converter-failures";
import { CreateScoreID } from "./score-id";
import db from "../../../external/mongo/db";
import { AppendLogCtx } from "../../../common/logger";
import { KtLogger } from "../../../common/types";
import { AppendLogCtx } from "../../../utils/logger";
import { KtLogger } from "../../../utils/types";
import {
ConverterFunctionReturns,
ConverterFnReturn,
@@ -10,12 +10,12 @@ import {
Game,
} from "kamaitachi-common";
import db from "../../../external/mongo/db";
import { AppendLogCtx } from "../../../common/logger";
import { AppendLogCtx } from "../../../utils/logger";
import { GenerateRandomSessionName } from "./name-generation";
import crypto from "crypto";
import { CreateSessionCalcData } from "./performance-calc";
import { GetScoresFromSession } from "../../../common/session";
import { KtLogger } from "../../../common/types";
import { GetScoresFromSession } from "../../../utils/session";
import { KtLogger } from "../../../utils/types";
import { ScorePlaytypeMap } from "../common/types";
const TWO_HOURS = 1000 * 60 * 60 * 2;
@@ -1,7 +1,7 @@
import { UserGameStats } from "kamaitachi-common";
import t from "tap";
import { CloseMongoConnection } from "../../../external/mongo/db";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import ResetDBState from "../../../test-utils/reset-db-state";
import { CalculateClassDeltas, UpdateUGSClasses } from "./classes";
@@ -1,9 +1,9 @@
import { Game, Playtypes, integer, UserGameStats, ClassDelta } from "kamaitachi-common";
import { gameClassValues } from "kamaitachi-common/js/game-classes";
import deepmerge from "deepmerge";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import { CalculateGitadoraColour, CalculateJubeatColour } from "./builtin-class-handlers";
import { ReturnClassIfGreater } from "../../../common/class";
import { ReturnClassIfGreater } from "../../../utils/class";
export interface ClassHandler {
(
@@ -4,7 +4,7 @@ import ResetDBState from "../../../test-utils/reset-db-state";
import { TestingIIDXSPScorePB } from "../../../test-utils/test-data";
import { CalculateCustomRatings, CalculateRatings } from "./rating";
import deepmerge from "deepmerge";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import crypto from "crypto";
const logger = CreateLogCtx(__filename);
@@ -1,6 +1,6 @@
import { Game, Playtypes, integer, GameSpecificCalcLookup, IDStrings } from "kamaitachi-common";
import db from "../../../external/mongo/db";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
export async function CalculateRatings(
game: Game,
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import t from "tap";
import db, { CloseMongoConnection } from "../../../external/mongo/db";
import CreateLogCtx from "../../../common/logger";
import CreateLogCtx from "../../../utils/logger";
import ResetDBState from "../../../test-utils/reset-db-state";
import { UpdateUsersGamePlaytypeStats } from "./update-ugs";
import deepmerge from "deepmerge";
@@ -4,7 +4,7 @@
import { Game, Playtypes, integer, UserGameStats, ClassDelta } from "kamaitachi-common";
import db from "../../../external/mongo/db";
import { KtLogger } from "../../../common/types";
import { KtLogger } from "../../../utils/types";
import { CalculateClassDeltas, UpdateUGSClasses, ClassHandler } from "./classes";
import { CalculateRatings, CalculateCustomRatings } from "./rating";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { ParseKaiIIDX } from "../../common/api-kai/iidx/parser";
import { KaiAuthDocument } from "kamaitachi-common";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { KaiAuthDocument } from "kamaitachi-common";
import { ParseKaiSDVX } from "../../common/api-kai/sdvx/parser";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { ParseKaiIIDX } from "../../common/api-kai/iidx/parser";
import { KaiAuthDocument } from "kamaitachi-common";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { KaiAuthDocument } from "kamaitachi-common";
import { ParseKaiSDVX } from "../../common/api-kai/sdvx/parser";
@@ -1,4 +1,4 @@
import { FindIIDXChartOnInGameIDVersion } from "../../../../../common/database-lookup/chart";
import { FindIIDXChartOnInGameIDVersion } from "../../../../../utils/database-lookup/chart";
import { KaiContext, KaiIIDXScore } from "../types";
import p from "prudence";
import {
@@ -6,8 +6,8 @@ import {
InvalidScoreFailure,
KTDataNotFoundFailure,
} from "../../../../framework/common/converter-failures";
import { FormatPrError } from "../../../../../common/prudence";
import { FindSongOnID } from "../../../../../common/database-lookup/song";
import { FormatPrError } from "../../../../../utils/prudence";
import { FindSongOnID } from "../../../../../utils/database-lookup/song";
import {
GenericGetGradeAndPercent,
ParseDateFromString,
@@ -1,5 +1,5 @@
import { KtLogger } from "../../../../../common/types";
import nodeFetch from "../../../../../common/fetch";
import { KtLogger } from "../../../../../utils/types";
import nodeFetch from "../../../../../utils/fetch";
import { KaiAuthDocument } from "kamaitachi-common";
import { KaiContext } from "../types";
import { EAG_API_URL, FLO_API_URL } from "../../../../../secrets";
@@ -1,4 +1,4 @@
import { FindSDVXChartOnInGameIDVersion } from "../../../../../common/database-lookup/chart";
import { FindSDVXChartOnInGameIDVersion } from "../../../../../utils/database-lookup/chart";
import { KaiContext, KaiSDVXScore } from "../types";
import p from "prudence";
import {
@@ -6,8 +6,8 @@ import {
InvalidScoreFailure,
KTDataNotFoundFailure,
} from "../../../../framework/common/converter-failures";
import { FormatPrError } from "../../../../../common/prudence";
import { FindSongOnID } from "../../../../../common/database-lookup/song";
import { FormatPrError } from "../../../../../utils/prudence";
import { FindSongOnID } from "../../../../../utils/database-lookup/song";
import {
GenericGetGradeAndPercent,
ParseDateFromString,
@@ -1,5 +1,5 @@
import { KtLogger } from "../../../../../common/types";
import nodeFetch from "../../../../../common/fetch";
import { KtLogger } from "../../../../../utils/types";
import nodeFetch from "../../../../../utils/fetch";
import { KaiAuthDocument } from "kamaitachi-common";
import { KaiContext } from "../types";
import { EAG_API_URL, FLO_API_URL } from "../../../../../secrets";
@@ -1,6 +1,6 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import nodeFetch from "../../../../common/fetch";
import nodeFetch from "../../../../utils/fetch";
import { KaiAuthDocument } from "kamaitachi-common";
/**
@@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import t from "tap";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import { GetKTDataJSON, Testing511Song, Testing511SPA } from "../../../../test-utils/test-data";
import { ResolveChartFromSong, ResolveMatchTypeToKTData, ConverterBatchManual } from "./converter";
import deepmerge from "deepmerge";
import { EscapeStringRegexp } from "../../../../common/util";
import { EscapeStringRegexp } from "../../../../utils/util";
import db, { CloseMongoConnection } from "../../../../external/mongo/db";
import { Game } from "kamaitachi-common";
import ResetDBState from "../../../../test-utils/reset-db-state";
@@ -5,19 +5,19 @@ import {
InvalidScoreFailure,
KTDataNotFoundFailure,
} from "../../../framework/common/converter-failures";
import { FindSongOnID, FindSongOnTitleInsensitive } from "../../../../common/database-lookup/song";
import { FindSongOnID, FindSongOnTitleInsensitive } from "../../../../utils/database-lookup/song";
import {
FindBMSChartOnHash,
FindChartWithPTDF,
FindChartWithPTDFVersion,
FindDDRChartOnSongHash,
} from "../../../../common/database-lookup/chart";
} from "../../../../utils/database-lookup/chart";
import {
AssertStrAsDifficulty,
AssertStrAsPositiveInt,
} from "../../../framework/common/string-asserts";
import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils";
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { DryScore } from "../../../framework/common/types";
import { ConverterFunction, ConverterFnReturn } from "../types";
@@ -1,10 +1,10 @@
import t from "tap";
import { CloseMongoConnection } from "../../../../external/mongo/db";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { ParseBatchManualFromObject as ParserFn } from "./parser";
import { BatchManual } from "./types";
import { EscapeStringRegexp } from "../../../../common/util";
import { EscapeStringRegexp } from "../../../../utils/util";
import deepmerge from "deepmerge";
const mockErr = (...msg: string[]) =>
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { BatchManual, BatchManualContext, BatchManualScore } from "./types";
import p, { PrudenceSchema, ValidSchemaValue } from "prudence";
@@ -6,7 +6,7 @@ import { lamps, supportedGames, validHitData, validPlaytypes } from "kamaitachi-
import { Game, ImportTypes } from "kamaitachi-common";
import { ConverterBatchManual } from "./converter";
import deepmerge from "deepmerge";
import { FormatPrError } from "../../../../common/prudence";
import { FormatPrError } from "../../../../utils/prudence";
import { ParserFunctionReturnsSync } from "../types";
const optNull = (v: ValidSchemaValue) => p.optional(p.nullable(v));
@@ -1,6 +1,6 @@
import t from "tap";
import db, { CloseMongoConnection } from "../../../../external/mongo/db";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import ResetDBState from "../../../../test-utils/reset-db-state";
import ConverterFn, { EamScoreConverter, EamScoreConverterWrapper } from "./converter";
import p from "prudence";
@@ -1,6 +1,6 @@
import { Lamps, AnySongDocument, ChartDocument } from "kamaitachi-common";
import { FindChartWithPTDFVersion } from "../../../../common/database-lookup/chart";
import { FindSongOnTitleInsensitive } from "../../../../common/database-lookup/song";
import { FindChartWithPTDFVersion } from "../../../../utils/database-lookup/chart";
import { FindSongOnTitleInsensitive } from "../../../../utils/database-lookup/song";
import {
KTDataNotFoundFailure,
InternalFailure,
@@ -10,7 +10,7 @@ import ScoreImportFatalError from "../../../framework/score-importing/score-impo
import { GetGradeFromPercent } from "../../../framework/common/score-utils";
import { AssertStrAsPositiveInt } from "../../../framework/common/string-asserts";
import { EamusementScoreData, IIDXEamusementCSVContext, IIDXEamusementCSVData } from "./types";
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { DryScore } from "../../../framework/common/types";
import { ConverterFunction, ConverterFnReturn } from "../types";
@@ -1,5 +1,5 @@
import t from "tap";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import GenericParseEamIIDXCSV, { NaiveCSVParse, ResolveHeaders } from "./parser";
import { CloseMongoConnection } from "../../../../external/mongo/db";
@@ -1,5 +1,5 @@
import { Difficulties } from "kamaitachi-common";
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { ParserFunctionReturnsSync } from "../types";
import ConverterFn from "./converter";
@@ -1,4 +1,4 @@
import { EmptyObject, KtLogger } from "../../../common/types";
import { EmptyObject, KtLogger } from "../../../utils/types";
import { MerScore } from "../file/mer-iidx/types";
import { S3Score } from "../file/solid-state-squad/types";
import { BarbatosScore } from "../ir/barbatos/types";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { ParseBatchManualFromObject } from "../../common/batch-manual/parser";
import { BatchManualContext, BatchManualScore } from "../../common/batch-manual/types";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import GenericParseEamIIDXCSV from "../../common/eamusement-iidx-csv/parser";
import {
IIDXEamusementCSVContext,
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import t from "tap";
import db, { CloseMongoConnection } from "../../../../external/mongo/db";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import ResetDBState from "../../../../test-utils/reset-db-state";
import {
GetKTDataJSON,
@@ -1,6 +1,6 @@
import { FindIIDXChartOnInGameID } from "../../../../common/database-lookup/chart";
import { FindSongOnID } from "../../../../common/database-lookup/song";
import { EmptyObject } from "../../../../common/types";
import { FindIIDXChartOnInGameID } from "../../../../utils/database-lookup/chart";
import { FindSongOnID } from "../../../../utils/database-lookup/song";
import { EmptyObject } from "../../../../utils/types";
import {
InternalFailure,
KTDataNotFoundFailure,
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import t from "tap";
import { CloseMongoConnection } from "../../../../external/mongo/db";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import { MockMulterFile } from "../../../../test-utils/mock-multer";
import ResetDBState from "../../../../test-utils/reset-db-state";
import { GetKTDataBuffer, GetKTDataJSON } from "../../../../test-utils/test-data";
@@ -1,6 +1,6 @@
import p from "prudence";
import { FormatPrError } from "../../../../common/prudence";
import { EmptyObject, KtLogger } from "../../../../common/types";
import { FormatPrError } from "../../../../utils/prudence";
import { EmptyObject, KtLogger } from "../../../../utils/types";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { ParserFunctionReturnsSync } from "../../common/types";
import { ConvertFileMerIIDX } from "./converter";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import GenericParseEamIIDXCSV from "../../common/eamusement-iidx-csv/parser";
import {
IIDXEamusementCSVContext,
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import t from "tap";
import { CloseMongoConnection } from "../../../../external/mongo/db";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import ResetDBState from "../../../../test-utils/reset-db-state";
import {
GetKTDataJSON,
@@ -1,4 +1,4 @@
import { EmptyObject, KtLogger } from "../../../../common/types";
import { EmptyObject, KtLogger } from "../../../../utils/types";
import {
InvalidScoreFailure,
KTDataNotFoundFailure,
@@ -6,8 +6,8 @@ import {
} from "../../../framework/common/converter-failures";
import { S3Score } from "./types";
import { Playtypes, Difficulties, Grades, Lamps } from "kamaitachi-common";
import { FindSongOnTitleInsensitive } from "../../../../common/database-lookup/song";
import { FindChartWithPTDFVersion } from "../../../../common/database-lookup/chart";
import { FindSongOnTitleInsensitive } from "../../../../utils/database-lookup/song";
import { FindChartWithPTDFVersion } from "../../../../utils/database-lookup/chart";
import {
GenericGetGradeAndPercent,
ParseDateFromString,
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import t from "tap";
import { GetMilisecondsSince } from "../../../../common/util";
import { GetMilisecondsSince } from "../../../../utils/util";
import { CloseMongoConnection } from "../../../../external/mongo/db";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import { MockMulterFile } from "../../../../test-utils/mock-multer";
import ResetDBState from "../../../../test-utils/reset-db-state";
import { GetKTDataBuffer } from "../../../../test-utils/test-data";
@@ -1,8 +1,8 @@
import { parse as FastParseXML } from "fast-xml-parser";
import { EmptyObject, KtLogger } from "../../../../common/types";
import { EmptyObject, KtLogger } from "../../../../utils/types";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import p, { PrudenceSchema } from "prudence";
import { FormatPrError } from "../../../../common/prudence";
import { FormatPrError } from "../../../../utils/prudence";
import { S3Score } from "./types";
import { ConvertFileS3 } from "./converter";
import { ParserFunctionReturnsSync } from "../../common/types";
@@ -1,6 +1,6 @@
import { FindSDVXChartOnInGameID } from "../../../../common/database-lookup/chart";
import { FindSongOnID } from "../../../../common/database-lookup/song";
import { EmptyObject } from "../../../../common/types";
import { FindSDVXChartOnInGameID } from "../../../../utils/database-lookup/chart";
import { FindSongOnID } from "../../../../utils/database-lookup/song";
import { EmptyObject } from "../../../../utils/types";
import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils";
import {
InternalFailure,
@@ -1,7 +1,7 @@
import { EmptyObject, KtLogger } from "../../../../common/types";
import { EmptyObject, KtLogger } from "../../../../utils/types";
import p from "prudence";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { FormatPrError } from "../../../../common/prudence";
import { FormatPrError } from "../../../../utils/prudence";
import { BarbatosScore } from "./types";
import { ConverterIRBarbatos } from "./converter";
import { ParserFunctionReturnsSync } from "../../common/types";
@@ -1,4 +1,4 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { ParseBatchManualFromObject } from "../../common/batch-manual/parser";
import { BatchManualContext, BatchManualScore } from "../../common/batch-manual/types";
import { ParserFunctionReturnsSync } from "../../common/types";
@@ -1,11 +1,11 @@
import { FindSongOnID } from "../../../../common/database-lookup/song";
import { FindSongOnID } from "../../../../utils/database-lookup/song";
import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils";
import {
InternalFailure,
KTDataNotFoundFailure,
} from "../../../framework/common/converter-failures";
import { Lamps } from "kamaitachi-common";
import { FindChartOnInGameIDVersion } from "../../../../common/database-lookup/chart";
import { FindChartOnInGameIDVersion } from "../../../../utils/database-lookup/chart";
import { FervidexStaticContext, FervidexStaticScore } from "./types";
import { FERVIDEX_LAMP_LOOKUP, SplitFervidexChartRef } from "../fervidex/converter";
import { DryScore } from "../../../framework/common/types";
@@ -1,7 +1,7 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import p, { PrudenceSchema } from "prudence";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { FormatPrError } from "../../../../common/prudence";
import { FormatPrError } from "../../../../utils/prudence";
import { ConverterIRFervidexStatic } from "./converter";
import { FervidexStaticContext, FervidexStaticScore } from "./types";
import { FerHeaders, SoftwareIDToVersion } from "../fervidex/parser";
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import t from "tap";
import db, { CloseMongoConnection } from "../../../../external/mongo/db";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import ResetDBState from "../../../../test-utils/reset-db-state";
import { GetKTDataJSON, Testing511Song, Testing511SPA } from "../../../../test-utils/test-data";
import { InternalFailure } from "../../../framework/common/converter-failures";
@@ -1,4 +1,4 @@
import { FindSongOnID } from "../../../../common/database-lookup/song";
import { FindSongOnID } from "../../../../utils/database-lookup/song";
import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils";
import {
InternalFailure,
@@ -10,7 +10,7 @@ import { Lamps, Difficulties, Playtypes } from "kamaitachi-common";
import {
FindIIDXChartOnInGameIDVersion,
FindIIDXChartWith2DXtraHash,
} from "../../../../common/database-lookup/chart";
} from "../../../../utils/database-lookup/chart";
import { ConverterFunction } from "../../common/types";
import { DryScore } from "../../../framework/common/types";
@@ -1,10 +1,10 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import p, { PrudenceSchema, ValidSchemaValue } from "prudence";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { FormatPrError, optNull } from "../../../../common/prudence";
import { FormatPrError, optNull } from "../../../../utils/prudence";
import { FervidexContext, FervidexScore } from "./types";
import { ConverterIRFervidex } from "./converter";
import { ParseEA3SoftID } from "../../../../common/util";
import { ParseEA3SoftID } from "../../../../utils/util";
import {
EXT_HEROIC_VERSE,
MODEL_IIDX,
@@ -1,6 +1,6 @@
import { USCClientScore } from "../../../../server/router/ir/usc/common";
import { FindSongOnID } from "../../../../common/database-lookup/song";
import { KtLogger } from "../../../../common/types";
import { FindSongOnID } from "../../../../utils/database-lookup/song";
import { KtLogger } from "../../../../utils/types";
import { InternalFailure, InvalidScoreFailure } from "../../../framework/common/converter-failures";
import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils";
import { IRUSCContext } from "./types";
@@ -1,8 +1,8 @@
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { ChartDocument } from "kamaitachi-common";
import p, { PrudenceSchema } from "prudence";
import { InvalidScoreFailure } from "../../../framework/common/converter-failures";
import { FormatPrError } from "../../../../common/prudence";
import { FormatPrError } from "../../../../utils/prudence";
import { USCClientScore } from "../../../../server/router/ir/usc/common";
import { IRUSCContext } from "./types";
import { ConverterIRUSC } from "./converter";
@@ -1,5 +1,5 @@
import Prudence, { MiddlewareErrorHandler } from "prudence";
import CreateLogCtx from "../../common/logger";
import CreateLogCtx from "../../utils/logger";
const logger = CreateLogCtx(__filename);
@@ -1,5 +1,5 @@
import { NextFunction, Request, Response } from "express";
import CreateLogCtx from "../../common/logger";
import CreateLogCtx from "../../utils/logger";
const logger = CreateLogCtx(__filename);
+3 -3
View File
@@ -7,15 +7,15 @@ import {
ReinstateInvite,
ValidatePassword,
ValidateCaptcha,
} from "../../../../common/auth";
} from "../../../../utils/auth";
import {
FormatUserDoc,
GetUserCaseInsensitive,
PRIVATEINFO_GetUserCaseInsensitive,
} from "../../../../common/user";
} from "../../../../utils/user";
import db from "../../../../external/mongo/db";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import prValidate from "../../../middleware/prudence-validate";
import { RequireLoggedIn } from "../../../middleware/require-logged-in";
@@ -2,14 +2,14 @@ import { Router } from "express";
import { FileUploadImportTypes } from "kamaitachi-common";
import { fileImportTypes } from "kamaitachi-common/js/config";
import Prudence from "prudence";
import { GetUserWithIDGuaranteed } from "../../../../common/user";
import CreateLogCtx from "../../../../common/logger";
import { GetUserWithIDGuaranteed } from "../../../../utils/user";
import CreateLogCtx from "../../../../utils/logger";
import prValidate from "../../../middleware/prudence-validate";
import { RequireLoggedIn } from "../../../middleware/require-logged-in";
import ScoreImportFatalError from "../../../../score-import/framework/score-importing/score-import-error";
import { KtLogger } from "../../../../common/types";
import { KtLogger } from "../../../../utils/types";
import { ExpressWrappedScoreImportMain } from "../../../../score-import/framework/express-wrapper";
import { CreateMulterSingleUploadMiddleware } from "../../../../common/multer";
import { CreateMulterSingleUploadMiddleware } from "../../../../utils/multer";
const logger = CreateLogCtx(__filename);
@@ -1,5 +1,5 @@
import { Router } from "express";
import { GetUserWithIDGuaranteed } from "../../../../common/user";
import { GetUserWithIDGuaranteed } from "../../../../utils/user";
import { RequireLoggedIn } from "../../../middleware/require-logged-in";
import { ExpressWrappedScoreImportMain } from "../../../../score-import/framework/express-wrapper";
import { ParseBarbatosSingle } from "../../../../score-import/import-types/ir/barbatos/parser";
@@ -1,5 +1,5 @@
import { Router } from "express";
import { GetUserWithIDGuaranteed } from "../../../../common/user";
import { GetUserWithIDGuaranteed } from "../../../../utils/user";
import { RequireLoggedIn } from "../../../middleware/require-logged-in";
import { ExpressWrappedScoreImportMain } from "../../../../score-import/framework/express-wrapper";
import ParseDirectManual from "../../../../score-import/import-types/ir/direct-manual/parser";
@@ -1,6 +1,6 @@
import { Router } from "express";
import { GetUserWithID, GetUserWithIDGuaranteed } from "../../../../common/user";
import CreateLogCtx from "../../../../common/logger";
import { GetUserWithID, GetUserWithIDGuaranteed } from "../../../../utils/user";
import CreateLogCtx from "../../../../utils/logger";
import { RequireLoggedIn } from "../../../middleware/require-logged-in";
import { ExpressWrappedScoreImportMain } from "../../../../score-import/framework/express-wrapper";
import ParseDirectManual from "../../../../score-import/import-types/ir/direct-manual/parser";
@@ -1,14 +1,14 @@
import { Router, RequestHandler } from "express";
import { UpdateClassIfGreater } from "../../../../common/class";
import { GetUserWithIDGuaranteed } from "../../../../common/user";
import { ParseEA3SoftID } from "../../../../common/util";
import { UpdateClassIfGreater } from "../../../../utils/class";
import { GetUserWithIDGuaranteed } from "../../../../utils/user";
import { ParseEA3SoftID } from "../../../../utils/util";
import { EXT_HEROIC_VERSE, MODEL_INFINITAS_2, REV_2DXBMS } from "../../../../constants/ea3id";
import { RequireLoggedIn } from "../../../middleware/require-logged-in";
import { ExpressWrappedScoreImportMain } from "../../../../score-import/framework/express-wrapper";
import { ParseFervidexStatic } from "../../../../score-import/import-types/ir/fervidex-static/parser";
import { ParseFervidexSingle } from "../../../../score-import/import-types/ir/fervidex/parser";
import { Playtypes } from "kamaitachi-common";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import { FERVIDEX_COURSE_LOOKUP } from "../../../../score-import/import-types/ir/fervidex-static/class-handler";
const logger = CreateLogCtx(__filename);
+3 -3
View File
@@ -1,7 +1,7 @@
import { integer, PBScoreDocument, ScoreDocument, ChartDocument } from "kamaitachi-common";
import CreateLogCtx from "../../../../common/logger";
import { GetPBOnChart, GetServerRecordOnChart } from "../../../../common/scores";
import { MStoS } from "../../../../common/util";
import CreateLogCtx from "../../../../utils/logger";
import { GetPBOnChart, GetServerRecordOnChart } from "../../../../utils/scores";
import { MStoS } from "../../../../utils/util";
import { USCIR_ADJACENT_SCORE_N } from "../../../../constants/usc-ir";
import db from "../../../../external/mongo/db";
+5 -5
View File
@@ -1,5 +1,5 @@
import { Router, RequestHandler } from "express";
import { FindChartOnSHA256 } from "../../../../common/database-lookup/chart";
import { FindChartOnSHA256 } from "../../../../utils/database-lookup/chart";
import { SYMBOL_KtchiData } from "../../../../constants/ktchi";
import db from "../../../../external/mongo/db";
import {
@@ -9,14 +9,14 @@ import {
ImportDocument,
} from "kamaitachi-common";
import { AssertStrAsPositiveNonZeroInt } from "../../../../score-import/framework/common/string-asserts";
import CreateLogCtx from "../../../../common/logger";
import CreateLogCtx from "../../../../utils/logger";
import { CreatePOSTScoresResponseBody, KtchiScoreToServerScore } from "./common";
import { ExpressWrappedScoreImportMain } from "../../../../score-import/framework/express-wrapper";
import { GetUserWithID } from "../../../../common/user";
import { KtLogger } from "../../../../common/types";
import { GetUserWithID } from "../../../../utils/user";
import { KtLogger } from "../../../../utils/types";
import { ParseIRUSC } from "../../../../score-import/import-types/ir/usc/parser";
import { USCIR_MAX_LEADERBOARD_N } from "../../../../constants/usc-ir";
import { CreateMulterSingleUploadMiddleware } from "../../../../common/multer";
import { CreateMulterSingleUploadMiddleware } from "../../../../utils/multer";
const logger = CreateLogCtx(__filename);
+1 -1
View File
@@ -1,6 +1,6 @@
import express, { Express } from "express";
import "express-async-errors";
import CreateLogCtx from "../common/logger";
import CreateLogCtx from "../utils/logger";
import expressSession from "express-session";
import { SESSION_SECRET } from "../secrets";
import { integer } from "kamaitachi-common";
+1 -1
View File
@@ -1,5 +1,5 @@
import ResetDBState from "./reset-db-state";
import CreateLogCtx from "../common/logger";
import CreateLogCtx from "../utils/logger";
import supertest from "supertest";
const logger = CreateLogCtx(__filename);
+1 -1
View File
@@ -1,5 +1,5 @@
import supertest from "supertest";
import CreateLogCtx from "../common/logger";
import CreateLogCtx from "../utils/logger";
const logger = CreateLogCtx(__filename);
+1 -1
View File
@@ -1,5 +1,5 @@
import { Response } from "node-fetch";
import { NodeFetch } from "../common/fetch";
import { NodeFetch } from "../utils/fetch";
export function MockFetch(data: Partial<Response>) {
// We know! this is a mock function.
+1 -1
View File
@@ -4,7 +4,7 @@
import db from "../external/mongo/db";
import fs from "fs";
import path from "path";
import CreateLogCtx from "../common/logger";
import CreateLogCtx from "../utils/logger";
const logger = CreateLogCtx(__filename);

Some files were not shown because too many files have changed in this diff Show More