mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-05 13:28:08 +03:00
fix: change prudence's default export to named
this was causing issues with vite and is potentially a bug in prudence or in vite. it's very hard to tell and i've already spent 3 hours trying to fix this, so here.
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@
|
||||
"mei-logger": "^1.0.3",
|
||||
"monk": "7.3.4",
|
||||
"node-fetch": "2.6.7",
|
||||
"prudence": "0.9.8",
|
||||
"prudence": "0.10.0",
|
||||
"seq-logging": "1.1.1",
|
||||
"sync-fetch": "^0.3.1",
|
||||
"tachi-common": "workspace:../common",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { FormatPrError } from "./utils/prudence";
|
||||
import { config } from "dotenv";
|
||||
import JSON5 from "json5";
|
||||
// eslint-disable-next-line import/order
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
|
||||
// @ts-expect-error No types available...
|
||||
import fetchSync from "sync-fetch";
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
|
||||
|
||||
<script crossorigin="anonymous"
|
||||
src="https://polyfill.io/v3/polyfill.min.js?features=es2017%2Cdefault%2Ces2015%2Ces2016%2CIntl"></script>
|
||||
<link rel="stylesheet" href="">
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
</head>
|
||||
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
"start": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint src --fix",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite build && vite preview"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
@@ -54,7 +54,7 @@
|
||||
"natural-compare": "^1.4.0",
|
||||
"pretty-bytes": "5.6.0",
|
||||
"prop-types": "15.6.0",
|
||||
"prudence": "0.9.8",
|
||||
"prudence": "0.10.0",
|
||||
"react": "17.0.2",
|
||||
"react-async": "10.0.1",
|
||||
"react-bootstrap": "1.6.1",
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
GetGameConfig,
|
||||
GetGamePTConfig,
|
||||
} from "tachi-common";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { PR_BATCH_MANUAL } from "tachi-common/lib/schemas";
|
||||
|
||||
export default function BatchManualPage() {
|
||||
|
||||
@@ -5,7 +5,7 @@ import AddNewQuestModal from "components/targets/AddNewQuestModal";
|
||||
import Divider from "components/util/Divider";
|
||||
import Icon from "components/util/Icon";
|
||||
import { TachiConfig } from "lib/config";
|
||||
import p, { PrudenceSchema } from "prudence";
|
||||
import { PrudenceSchema, p } from "prudence";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { Alert, Button, Col, Form, Modal, Row } from "react-bootstrap";
|
||||
import { FormatPrError, GetGameConfig } from "tachi-common";
|
||||
|
||||
@@ -70,6 +70,9 @@ export default defineConfig(() => {
|
||||
server: {
|
||||
port: 3000,
|
||||
},
|
||||
preview: {
|
||||
port: 3000,
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
@@ -81,6 +84,7 @@ export default defineConfig(() => {
|
||||
assetsDir: "static",
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
outDir: process.env.BUILD_OUT_DIR || "build",
|
||||
sourcemap: true,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
"@types/express-serve-static-core": "4.17.29",
|
||||
"@types/mongodb": "3.6.18",
|
||||
"deepmerge": "^4.2.2",
|
||||
"prudence": "0.9.8"
|
||||
"prudence": "0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/tap": "^15.0.7",
|
||||
|
||||
@@ -7,7 +7,7 @@ import { allIDStrings, allImportTypes, allSupportedGames } from "../config/stati
|
||||
import { ALL_PERMISSIONS } from "../constants/permissions";
|
||||
import { UserAuthLevels } from "../types";
|
||||
import deepmerge from "deepmerge";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import type { GamePTConfig } from "../config/config";
|
||||
import type { Game, IDStrings, NotificationBody, Playtype, Playtypes } from "../types";
|
||||
import type {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"mei-logger": "^1.0.1",
|
||||
"monk": "^7.3.4",
|
||||
"node-fetch": "2.6.7",
|
||||
"prudence": "0.9.8",
|
||||
"prudence": "0.10.0",
|
||||
"tachi-common": "workspace:../../common",
|
||||
"xml2js": "^0.4.23"
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"dotenv": "16.0.0",
|
||||
"express": "4.17.2",
|
||||
"node-fetch": "2.6.7",
|
||||
"prudence": "0.9.8"
|
||||
"prudence": "0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "4.17.13",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { config } from "dotenv";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
|
||||
// init dotenv
|
||||
config();
|
||||
|
||||
Generated
+14
-14
@@ -56,7 +56,7 @@ importers:
|
||||
mei-logger: ^1.0.3
|
||||
monk: 7.3.4
|
||||
node-fetch: 2.6.7
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
seq-logging: 1.1.1
|
||||
sync-fetch: ^0.3.1
|
||||
tachi-common: workspace:../common
|
||||
@@ -81,7 +81,7 @@ importers:
|
||||
mei-logger: 1.0.3
|
||||
monk: 7.3.4
|
||||
node-fetch: 2.6.7
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
seq-logging: 1.1.1
|
||||
sync-fetch: 0.3.1
|
||||
tachi-common: link:../common
|
||||
@@ -134,7 +134,7 @@ importers:
|
||||
natural-compare: ^1.4.0
|
||||
pretty-bytes: 5.6.0
|
||||
prop-types: 15.6.0
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
react: 17.0.2
|
||||
react-async: 10.0.1
|
||||
react-bootstrap: 1.6.1
|
||||
@@ -181,7 +181,7 @@ importers:
|
||||
natural-compare: 1.4.0
|
||||
pretty-bytes: 5.6.0
|
||||
prop-types: 15.6.0
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
react: 17.0.2
|
||||
react-async: 10.0.1_react@17.0.2
|
||||
react-bootstrap: 1.6.1_sfoxds7t5ydpegc3knd667wn6m
|
||||
@@ -214,13 +214,13 @@ importers:
|
||||
'@types/mongodb': 3.6.18
|
||||
'@types/tap': ^15.0.7
|
||||
deepmerge: ^4.2.2
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
tap: 15.1.6
|
||||
dependencies:
|
||||
'@types/express-serve-static-core': 4.17.29
|
||||
'@types/mongodb': 3.6.18
|
||||
deepmerge: 4.2.2
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
devDependencies:
|
||||
'@types/tap': 15.0.7
|
||||
tap: 15.1.6
|
||||
@@ -245,7 +245,7 @@ importers:
|
||||
mei-logger: ^1.0.1
|
||||
monk: ^7.3.4
|
||||
node-fetch: 2.6.7
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
tachi-common: workspace:../../common
|
||||
tsconfig-paths: 3.12.0
|
||||
xml2js: ^0.4.23
|
||||
@@ -268,7 +268,7 @@ importers:
|
||||
mei-logger: 1.0.3
|
||||
monk: 7.3.4
|
||||
node-fetch: 2.6.7
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
tachi-common: link:../../common
|
||||
xml2js: 0.4.23
|
||||
devDependencies:
|
||||
@@ -283,14 +283,14 @@ importers:
|
||||
dotenv: 16.0.0
|
||||
express: 4.17.2
|
||||
node-fetch: 2.6.7
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
typescript: 4.6.3
|
||||
dependencies:
|
||||
'@octokit/app': 13.1.0
|
||||
dotenv: 16.0.0
|
||||
express: 4.17.2
|
||||
node-fetch: 2.6.7
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
devDependencies:
|
||||
'@types/express': 4.17.13
|
||||
'@types/node': 16.11.7
|
||||
@@ -351,7 +351,7 @@ importers:
|
||||
node-html-parser: ^5.3.3
|
||||
node-mocks-http: 1.11.0
|
||||
nodemailer: 6.7.2
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
rate-limit-redis: 2.1.0
|
||||
redis: 3.1.2
|
||||
rg-stats: ^0.5.0
|
||||
@@ -417,7 +417,7 @@ importers:
|
||||
node-fetch: 2.6.7
|
||||
node-html-parser: 5.3.3
|
||||
nodemailer: 6.7.2
|
||||
prudence: 0.9.8
|
||||
prudence: 0.10.0
|
||||
rate-limit-redis: 2.1.0
|
||||
redis: 3.1.2
|
||||
rg-stats: 0.5.0
|
||||
@@ -8115,8 +8115,8 @@ packages:
|
||||
ipaddr.js: 1.9.1
|
||||
dev: false
|
||||
|
||||
/prudence/0.9.8:
|
||||
resolution: {integrity: sha512-my6HEhcTW3aKKjAx8j6jgUj3x5Kc71NEv3DySRXun2Zspw6Fdo5zDnbpXv/j4tyk9f9XXrpu1grWVBX4WU+1Tg==}
|
||||
/prudence/0.10.0:
|
||||
resolution: {integrity: sha512-QPyNYQR4tx+9xp+GuceW55MWeZIC/nNT3qWUmU8eij0FmO90x3L08oY9bJiIW1weB7mvH63JBra1cY+GH70YKw==}
|
||||
dev: false
|
||||
|
||||
/psl/1.8.0:
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@
|
||||
"node-fetch": "2.6.7",
|
||||
"node-html-parser": "^5.3.3",
|
||||
"nodemailer": "6.7.2",
|
||||
"prudence": "0.9.8",
|
||||
"prudence": "0.10.0",
|
||||
"rate-limit-redis": "2.1.0",
|
||||
"redis": "3.1.2",
|
||||
"rg-stats": "^0.5.0",
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { TachiConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { allImportTypes } from "tachi-common/config/static-config";
|
||||
import { SCHEMAS } from "tachi-common/lib/schemas";
|
||||
import type { Databases } from "./db";
|
||||
|
||||
@@ -5,7 +5,7 @@ import db from "external/mongo/db";
|
||||
import { BacksyncCollectionToBothBranches } from "lib/database-seeds/repo";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import fetch from "node-fetch";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RecalcAllScores } from "utils/calculations/recalc-scores";
|
||||
import { WrapScriptPromise } from "utils/misc";
|
||||
import { FindChartWithPTDF } from "utils/queries/charts";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CalculateDataForGamePT, CreateCalculatedData } from "./calculated-data";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import t from "tap";
|
||||
import { prAssert } from "test-utils/asserts";
|
||||
import {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CGGameToTachiGame } from "./util";
|
||||
import db from "external/mongo/db";
|
||||
import ScoreImportFatalError from "lib/score-import/framework/score-importing/score-import-error";
|
||||
import fetch from "node-fetch";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "tachi-common";
|
||||
import type { ParserFunctionReturns } from "../types";
|
||||
import type {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ScoreImportFatalError from "lib/score-import/framework/score-importing/score-import-error";
|
||||
import { ServerConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import nodeFetch from "utils/fetch";
|
||||
import { URLSearchParams } from "url";
|
||||
import type { CGErrorResponse, CGScoresResponse, CGServices, CGSupportedGames } from "./types";
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
GenericGetGradeAndPercent,
|
||||
ParseDateFromString,
|
||||
} from "../../../../framework/common/score-utils";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import { FindIIDXChartOnInGameIDVersion } from "utils/queries/charts";
|
||||
import { FindSongOnID } from "utils/queries/songs";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GetKaiTypeClientCredentials, KaiTypeToBaseURL } from "./utils";
|
||||
import db from "external/mongo/db";
|
||||
import ScoreImportFatalError from "lib/score-import/framework/score-importing/score-import-error";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import nodeFetch from "utils/fetch";
|
||||
import { CreateURLWithParams } from "utils/url";
|
||||
import type { KtLogger } from "lib/logger/logger";
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
GenericGetGradeAndPercent,
|
||||
ParseDateFromString,
|
||||
} from "../../../../framework/common/score-utils";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import { FindSDVXChartOnInGameIDVersion } from "utils/queries/charts";
|
||||
import { FindSongOnID } from "utils/queries/songs";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CreateBatchManualClassHandler } from "./class-handler";
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import { TachiConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { GetGameConfig } from "tachi-common";
|
||||
import { PR_BATCH_MANUAL } from "tachi-common/lib/schemas";
|
||||
import { IsRecord, IsValidGame, IsValidPlaytype } from "utils/misc";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
import type { MerScore } from "./types";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import { XMLParser } from "fast-xml-parser";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
import type { S3Score } from "./types";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
import type { BarbatosContext, BarbatosScore, BarbatosSDVX6Score } from "./types";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
import type { BeatorajaChart, BeatorajaContext, BeatorajaScore } from "./types";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CreateFerStaticClassHandler } from "./class-handler";
|
||||
import { AssertStrAsPositiveInt } from "../../../framework/common/string-asserts";
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import { SoftwareIDToVersion } from "../fervidex/parser";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { IsRecord } from "utils/misc";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
REV_NORMAL,
|
||||
REV_OMNIMIX,
|
||||
} from "lib/constants/ea3id";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { ParseEA3SoftID } from "utils/ea3id";
|
||||
import { FormatPrError, optNull } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PR_KSHOOK_SV6C } from "../kshook-sv6c/parser";
|
||||
import ScoreImportFatalError from "lib/score-import/framework/score-importing/score-import-error";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
import type { KsHookSV6CStaticBody, KsHookSV6CStaticScore } from "./types";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import ScoreImportFatalError from "lib/score-import/framework/score-importing/score-import-error";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
import type { KsHookSV6CContext, KsHookSV6CScore } from "./types";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import ScoreImportFatalError from "lib/score-import/framework/score-importing/score-import-error";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
import type { LR2HookContext, LR2HookScore } from "./types";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import type { ParserFunctionReturns } from "../../common/types";
|
||||
import type { IRUSCContext } from "./types";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// barrel file for re-exporting env variables.
|
||||
import dotenv from "dotenv";
|
||||
import JSON5 from "json5";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { StaticConfig } from "tachi-common";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import fs from "fs";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import prValidate from "./prudence-validate";
|
||||
import Prudence from "prudence";
|
||||
import { p } from "prudence";
|
||||
import t from "tap";
|
||||
import { expressRequestMock } from "test-utils/mock-request";
|
||||
|
||||
t.test("#PrudenceMiddleware", (t) => {
|
||||
const mw = prValidate({ foo: Prudence.regex(/^baz$/u) }, { foo: "example error message" });
|
||||
const mw = prValidate({ foo: p.regex(/^baz$/u) }, { foo: "example error message" });
|
||||
|
||||
t.test("Should return 400 on invalid prudence validation", async (t) => {
|
||||
const { res } = await expressRequestMock(mw, {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import Prudence from "prudence";
|
||||
import { p } from "prudence";
|
||||
import type { RequestHandler } from "express-serve-static-core";
|
||||
import type {
|
||||
ErrorMessages,
|
||||
@@ -68,6 +68,6 @@ const prValidate = (
|
||||
errorMessage?: ErrorMessages,
|
||||
options?: Partial<PrudenceOptions>,
|
||||
level: TachiLogLevels = "info"
|
||||
): RequestHandler => Prudence.CurryMiddleware(API_ERROR_HANDLERS[level])(s, errorMessage, options);
|
||||
): RequestHandler => p.CurryMiddleware(API_ERROR_HANDLERS[level])(s, errorMessage, options);
|
||||
|
||||
export default prValidate;
|
||||
|
||||
@@ -7,7 +7,7 @@ import CreateLogCtx, { ChangeRootLogLevel, GetLogLevel } from "lib/logger/logger
|
||||
import { SendSiteAnnouncementNotification } from "lib/notifications/notification-wrappers";
|
||||
import { DeleteMultipleScores, DeleteScore } from "lib/score-mutation/delete-scores";
|
||||
import { ServerConfig, TachiConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { UserAuthLevels } from "tachi-common";
|
||||
import { RecalcAllScores, UpdateAllPBs } from "utils/calculations/recalc-scores";
|
||||
|
||||
@@ -2,7 +2,7 @@ import bcrypt from "bcryptjs";
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { Environment, ServerConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { UserAuthLevels } from "tachi-common";
|
||||
import nodeFetch from "utils/fetch";
|
||||
import { Random20Hex } from "utils/misc";
|
||||
|
||||
@@ -14,7 +14,7 @@ import { SendEmail } from "lib/email/client";
|
||||
import { EmailFormatResetPassword, EmailFormatVerifyEmail } from "lib/email/formats";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { Environment, ServerConfig, TachiConfig } from "lib/setup/config";
|
||||
import Prudence from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import {
|
||||
AggressiveRateLimitMiddleware,
|
||||
@@ -48,7 +48,7 @@ router.post(
|
||||
AggressiveRateLimitMiddleware,
|
||||
prValidate(
|
||||
{
|
||||
username: Prudence.regex(/^[a-zA-Z_-][a-zA-Z0-9_-]{2,20}$/u),
|
||||
username: p.regex(/^[a-zA-Z_-][a-zA-Z0-9_-]{2,20}$/u),
|
||||
"!password": ValidatePassword,
|
||||
captcha: "string",
|
||||
},
|
||||
@@ -168,9 +168,9 @@ router.post(
|
||||
AggressiveRateLimitMiddleware,
|
||||
prValidate(
|
||||
{
|
||||
username: Prudence.regex(/^[a-zA-Z_-][a-zA-Z0-9_-]{2,20}$/u),
|
||||
username: p.regex(/^[a-zA-Z_-][a-zA-Z0-9_-]{2,20}$/u),
|
||||
"!password": ValidatePassword,
|
||||
email: Prudence.regex(LAZY_EMAIL_REGEX),
|
||||
email: p.regex(LAZY_EMAIL_REGEX),
|
||||
inviteCode: "*string",
|
||||
captcha: "string",
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { ServerConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { ALL_PERMISSIONS, UserAuthLevels } from "tachi-common";
|
||||
import { DedupeArr, DeleteUndefinedProps, IsValidURL, Random20Hex } from "utils/misc";
|
||||
|
||||
@@ -3,7 +3,7 @@ import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { CreateGoalTitle, ValidateGoalChartsAndCriteria } from "lib/targets/goal-utils";
|
||||
import { GetQuestsThatContainGoal } from "lib/targets/goals";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { GetMostSubscribedGoals } from "utils/db";
|
||||
import { AssignToReqTachiData, GetGPT, GetTachiData } from "utils/req-tachi-data";
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ExpressWrappedScoreImportMain } from "lib/score-import/framework/expres
|
||||
import { ReprocessOrphan } from "lib/score-import/framework/orphans/orphans";
|
||||
import { MakeScoreImport } from "lib/score-import/framework/score-import";
|
||||
import { ServerConfig, TachiConfig } from "lib/setup/config";
|
||||
import Prudence from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import { CreateMulterSingleUploadMiddleware } from "server/middleware/multer-upload";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
@@ -45,7 +45,7 @@ router.post(
|
||||
ParseMultipartScoredata,
|
||||
prValidate(
|
||||
{
|
||||
importType: Prudence.isIn(fileImportTypes),
|
||||
importType: p.isIn(fileImportTypes),
|
||||
},
|
||||
{},
|
||||
{ allowExcessKeys: true }
|
||||
@@ -108,7 +108,7 @@ router.post(
|
||||
RequirePermissions("submit_score"),
|
||||
prValidate(
|
||||
{
|
||||
importType: Prudence.isIn(apiImportTypes),
|
||||
importType: p.isIn(apiImportTypes),
|
||||
},
|
||||
{},
|
||||
{ allowExcessKeys: true }
|
||||
|
||||
@@ -6,7 +6,7 @@ import { RevertImport } from "lib/imports/imports";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import ScoreImportQueue, { ScoreImportQueueEvents } from "lib/score-import/worker/queue";
|
||||
import { ServerConfig, TachiConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { GetRelevantSongsAndCharts } from "utils/db";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { Random20Hex } from "utils/misc";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { DeleteScore } from "lib/score-mutation/delete-scores";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { GetTachiData } from "utils/req-tachi-data";
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from "./middleware";
|
||||
import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { GetGamePTConfig } from "tachi-common";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { RequireSelfRequestFromUser } from "../middleware";
|
||||
import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { ALL_PERMISSIONS } from "tachi-common";
|
||||
import { Random20Hex } from "utils/misc";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { ServerConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { GetUser } from "utils/req-tachi-data";
|
||||
import { FormatUserDoc, GetUsersWithIDs, GetUserWithID } from "utils/user";
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import db from "external/mongo/db";
|
||||
import { CreateActivityRouteHandler } from "lib/activity/activity";
|
||||
import { SetRivalsFailReasons } from "lib/constants/err-codes";
|
||||
import { GetChallengerUsers, GetRivalIDs, GetRivalUsers, SetRivals } from "lib/rivals/rivals";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { FormatGame, GetGamePTConfig } from "tachi-common";
|
||||
|
||||
@@ -14,7 +14,7 @@ import db from "external/mongo/db";
|
||||
import { CreateActivityRouteHandler } from "lib/activity/activity";
|
||||
import { ONE_MONTH, ONE_WEEK, ONE_YEAR } from "lib/constants/time";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { PasswordCompare, ValidatePassword } from "server/router/api/v1/auth/auth";
|
||||
import { FormatGame, GetGamePTConfig } from "tachi-common";
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { RequireAuthedAsUser } from "../../../../middleware";
|
||||
import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import { GetGamePTConfig } from "tachi-common";
|
||||
import { PR_GAMESPECIFIC_SETTINGS } from "tachi-common/lib/schemas";
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import db from "external/mongo/db";
|
||||
import { EvaluateShowcaseStat } from "lib/showcase/evaluator";
|
||||
import { GetRelatedStatDocuments } from "lib/showcase/get-related";
|
||||
import { EvaluateUsersStatsShowcase } from "lib/showcase/get-stats";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import { RequireAuthedAsUser } from "server/router/api/v1/users/_userID/middleware";
|
||||
import { FormatGame, GetGamePTConfig } from "tachi-common";
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import {
|
||||
UnsubscribeFromGoal,
|
||||
} from "lib/targets/goals";
|
||||
import { GetParentQuests } from "lib/targets/quests";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { GetGoalForIDGuaranteed } from "utils/db";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import { TachiConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { DeleteUndefinedProps } from "utils/misc";
|
||||
import { GetTachiData } from "utils/req-tachi-data";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RequireSelfRequestFromUser } from "../../../middleware";
|
||||
import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { GetTachiData } from "utils/req-tachi-data";
|
||||
import type { RequestHandler } from "express-serve-static-core";
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
GetKaiTypeClientCredentials,
|
||||
KaiTypeToBaseURL,
|
||||
} from "lib/score-import/import-types/common/api-kai/utils";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { RequireKamaitachi } from "server/middleware/type-require";
|
||||
import fetch from "utils/fetch";
|
||||
|
||||
@@ -26,7 +26,7 @@ import { GetRecentActivity } from "lib/activity/activity";
|
||||
import { ONE_MONTH } from "lib/constants/time";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { GetRivalIDs } from "lib/rivals/rivals";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { DeleteUndefinedProps, IsNonEmptyString, StripUrl } from "utils/misc";
|
||||
import { optNullFluffStrField } from "utils/prudence";
|
||||
|
||||
@@ -6,7 +6,7 @@ import { SYMBOL_TACHI_API_AUTH } from "lib/constants/tachi";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { ExpressWrappedScoreImportMain } from "lib/score-import/framework/express-wrapper";
|
||||
import { ServerConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequireNotGuest } from "server/middleware/auth";
|
||||
import prValidate from "server/middleware/prudence-validate";
|
||||
import { UpdateClassIfGreater } from "utils/class";
|
||||
|
||||
@@ -5,7 +5,7 @@ import { SYMBOL_TACHI_API_AUTH } from "lib/constants/tachi";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { ExpressWrappedScoreImportMain } from "lib/score-import/framework/express-wrapper";
|
||||
import { SoftwareIDToVersion } from "lib/score-import/import-types/ir/fervidex/parser";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import { PrudenceErrorFormatter } from "server/middleware/prudence-validate";
|
||||
import { UpdateClassIfGreater } from "utils/class";
|
||||
|
||||
@@ -10,7 +10,7 @@ import CreateLogCtx from "lib/logger/logger";
|
||||
import { AssertStrAsPositiveNonZeroInt } from "lib/score-import/framework/common/string-asserts";
|
||||
import { ExpressWrappedScoreImportMain } from "lib/score-import/framework/express-wrapper";
|
||||
import { ServerConfig, TachiConfig } from "lib/setup/config";
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import { RejectIfBanned, RequirePermissions } from "server/middleware/auth";
|
||||
import { CreateMulterSingleUploadMiddleware } from "server/middleware/multer-upload";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Prudence from "prudence";
|
||||
import { p } from "prudence";
|
||||
import type { PrudenceSchema } from "prudence";
|
||||
|
||||
export function isApproximately(
|
||||
@@ -27,7 +27,7 @@ export function prAssert(
|
||||
schema: PrudenceSchema,
|
||||
message = "Unnamed Prudence Assertion"
|
||||
) {
|
||||
const err = Prudence(obj, schema);
|
||||
const err = p(obj, schema);
|
||||
|
||||
if (err) {
|
||||
return t.fail(message, err);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import p from "prudence";
|
||||
import { p } from "prudence";
|
||||
import type { PrudenceError, ValidSchemaValue } from "prudence";
|
||||
|
||||
export function FormatPrError(err: PrudenceError, foreword = "Error") {
|
||||
|
||||
Reference in New Issue
Block a user