mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-04 05:38:55 +08:00
refactor(contracts / schemas): move schemas into their own package (@miodec) (#6754)
This commit is contained in:
parent
92790f3682
commit
69cbbe4ab2
183 changed files with 440 additions and 535 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import { randomBytes } from "crypto";
|
||||
import { hash } from "bcrypt";
|
||||
import { ObjectId } from "mongodb";
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
CONFIGURATION_FORM_SCHEMA,
|
||||
} from "../../../src/constants/base-configuration";
|
||||
import * as Configuration from "../../../src/init/configuration";
|
||||
import type { Configuration as ConfigurationType } from "@monkeytype/contracts/schemas/configuration";
|
||||
import type { Configuration as ConfigurationType } from "@monkeytype/schemas/configuration";
|
||||
import { ObjectId } from "mongodb";
|
||||
import * as Misc from "../../../src/utils/misc";
|
||||
import * as AdminUuids from "../../../src/dal/admin-uids";
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
mockAuthenticateWithApeKey,
|
||||
mockBearerAuthentication,
|
||||
} from "../../__testData__/auth";
|
||||
import { XpLeaderboardEntry } from "@monkeytype/contracts/schemas/leaderboards";
|
||||
import { XpLeaderboardEntry } from "@monkeytype/schemas/leaderboards";
|
||||
|
||||
const mockApp = request(app);
|
||||
const configuration = Configuration.getCachedConfiguration();
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as ReportDal from "../../../src/dal/report";
|
|||
import * as Captcha from "../../../src/utils/captcha";
|
||||
import { ObjectId } from "mongodb";
|
||||
import _ from "lodash";
|
||||
import { ApproveQuote } from "@monkeytype/contracts/schemas/quotes";
|
||||
import { ApproveQuote } from "@monkeytype/schemas/quotes";
|
||||
import { mockBearerAuthentication } from "../../__testData__/auth";
|
||||
|
||||
const mockApp = request(app);
|
||||
|
|
|
@ -19,7 +19,7 @@ import { FirebaseError } from "firebase-admin";
|
|||
import * as ApeKeysDal from "../../../src/dal/ape-keys";
|
||||
import * as LogDal from "../../../src/dal/logs";
|
||||
import { ObjectId } from "mongodb";
|
||||
import { PersonalBest } from "@monkeytype/contracts/schemas/shared";
|
||||
import { PersonalBest } from "@monkeytype/schemas/shared";
|
||||
import { pb } from "../../dal/leaderboards.spec";
|
||||
import {
|
||||
mockAuthenticateWithApeKey,
|
||||
|
@ -27,9 +27,9 @@ import {
|
|||
} from "../../__testData__/auth";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import _ from "lodash";
|
||||
import { MonkeyMail, UserStreak } from "@monkeytype/contracts/schemas/users";
|
||||
import { MonkeyMail, UserStreak } from "@monkeytype/schemas/users";
|
||||
import MonkeyError, { isFirebaseError } from "../../../src/utils/error";
|
||||
import { LeaderboardEntry } from "@monkeytype/contracts/schemas/leaderboards";
|
||||
import { LeaderboardEntry } from "@monkeytype/schemas/leaderboards";
|
||||
import * as WeeklyXpLeaderboard from "../../../src/services/weekly-xp-leaderboard";
|
||||
|
||||
const mockApp = request(app);
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as LeaderboardsDal from "../../src/dal/leaderboards";
|
|||
import * as PublicDal from "../../src/dal/public";
|
||||
import * as Configuration from "../../src/init/configuration";
|
||||
import type { DBLeaderboardEntry } from "../../src/dal/leaderboards";
|
||||
import type { PersonalBest } from "@monkeytype/contracts/schemas/shared";
|
||||
import type { PersonalBest } from "@monkeytype/schemas/shared";
|
||||
const configuration = Configuration.getCachedConfiguration();
|
||||
|
||||
import * as DB from "../../src/init/db";
|
||||
|
|
|
@ -2,12 +2,9 @@ import _ from "lodash";
|
|||
import * as UserDAL from "../../src/dal/user";
|
||||
import * as UserTestData from "../__testData__/users";
|
||||
import { ObjectId } from "mongodb";
|
||||
import { MonkeyMail, ResultFilters } from "@monkeytype/contracts/schemas/users";
|
||||
import {
|
||||
PersonalBest,
|
||||
PersonalBests,
|
||||
} from "@monkeytype/contracts/schemas/shared";
|
||||
import { CustomThemeColors } from "@monkeytype/contracts/schemas/configs";
|
||||
import { MonkeyMail, ResultFilters } from "@monkeytype/schemas/users";
|
||||
import { PersonalBest, PersonalBests } from "@monkeytype/schemas/shared";
|
||||
import { CustomThemeColors } from "@monkeytype/schemas/configs";
|
||||
|
||||
const mockPersonalBest = {
|
||||
acc: 1,
|
||||
|
|
|
@ -12,7 +12,7 @@ import crypto from "crypto";
|
|||
import {
|
||||
EndpointMetadata,
|
||||
RequestAuthenticationOptions,
|
||||
} from "@monkeytype/contracts/schemas/api";
|
||||
} from "@monkeytype/schemas/api";
|
||||
import * as Prometheus from "../../src/utils/prometheus";
|
||||
import { TsRestRequestWithContext } from "../../src/api/types";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { RequireConfiguration } from "@monkeytype/contracts/require-configuration/index";
|
||||
import { verifyRequiredConfiguration } from "../../src/middlewares/configuration";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import { Response } from "express";
|
||||
import MonkeyError from "../../src/utils/error";
|
||||
import { TsRestRequest } from "../../src/api/types";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Response } from "express";
|
||||
import { verifyPermissions } from "../../src/middlewares/permission";
|
||||
import { EndpointMetadata } from "@monkeytype/contracts/schemas/api";
|
||||
import { EndpointMetadata } from "@monkeytype/schemas/api";
|
||||
import * as Misc from "../../src/utils/misc";
|
||||
import * as AdminUids from "../../src/dal/admin-uids";
|
||||
import * as UserDal from "../../src/dal/user";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Mode } from "@monkeytype/contracts/schemas/shared";
|
||||
import { Mode } from "@monkeytype/schemas/shared";
|
||||
import { getDailyLeaderboard } from "../../src/utils/daily-leaderboards";
|
||||
|
||||
const dailyLeaderboardsConfig = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import _ from "lodash";
|
||||
import * as pb from "../../src/utils/pb";
|
||||
import { Mode, PersonalBests } from "@monkeytype/contracts/schemas/shared";
|
||||
import { Result } from "@monkeytype/contracts/schemas/results";
|
||||
import { FunboxName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { Mode, PersonalBests } from "@monkeytype/schemas/shared";
|
||||
import { Result } from "@monkeytype/schemas/results";
|
||||
import { FunboxName } from "@monkeytype/schemas/configs";
|
||||
|
||||
describe("Pb Utils", () => {
|
||||
it("funboxCatGetPb", () => {
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
"devDependencies": {
|
||||
"@monkeytype/eslint-config": "workspace:*",
|
||||
"@monkeytype/oxlint-config": "workspace:*",
|
||||
"@monkeytype/schemas": "workspace:*",
|
||||
"@monkeytype/typescript-config": "workspace:*",
|
||||
"@redocly/cli": "1.28.5",
|
||||
"@types/bcrypt": "5.0.2",
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import { generateOpenApi } from "@ts-rest/open-api";
|
||||
import { contract } from "@monkeytype/contracts/index";
|
||||
import { writeFileSync, mkdirSync } from "fs";
|
||||
import {
|
||||
EndpointMetadata,
|
||||
PermissionId,
|
||||
} from "@monkeytype/contracts/schemas/api";
|
||||
import { EndpointMetadata, PermissionId } from "@monkeytype/contracts/util/api";
|
||||
import type { OpenAPIObject, OperationObject } from "openapi3-ts";
|
||||
import {
|
||||
RateLimitIds,
|
||||
|
@ -277,7 +274,7 @@ function addRequiredConfiguration(
|
|||
if (metadata === undefined || metadata.requireConfiguration === undefined)
|
||||
return;
|
||||
|
||||
//@ts-expect-error
|
||||
//@ts-expect-error somehow path doesnt exist
|
||||
operation.description += `**Required configuration:** This operation can only be called if the [configuration](#tag/configuration/operation/configuration.get) for \`${metadata.requireConfiguration.path}\` is \`true\`.\n\n`;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
const hasAnticheatImplemented = process.env["BYPASS_ANTICHEAT"] === "true";
|
||||
|
||||
import {
|
||||
CompletedEvent,
|
||||
KeyStats,
|
||||
} from "@monkeytype/contracts/schemas/results";
|
||||
import { CompletedEvent, KeyStats } from "@monkeytype/schemas/results";
|
||||
import Logger from "../utils/logger";
|
||||
|
||||
export function implemented(): boolean {
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
ToggleBanResponse,
|
||||
} from "@monkeytype/contracts/admin";
|
||||
import MonkeyError, { getErrorMessage } from "../../utils/error";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import { addImportantLog } from "../../dal/logs";
|
||||
import { MonkeyRequest } from "../types";
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
EditApeKeyRequest,
|
||||
GetApeKeyResponse,
|
||||
} from "@monkeytype/contracts/ape-keys";
|
||||
import { ApeKey } from "@monkeytype/contracts/schemas/ape-keys";
|
||||
import { ApeKey } from "@monkeytype/schemas/ape-keys";
|
||||
import { MonkeyRequest } from "../types";
|
||||
|
||||
function cleanApeKey(apeKey: ApeKeysDAL.DBApeKey): ApeKey {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { PartialConfig } from "@monkeytype/contracts/schemas/configs";
|
||||
import { PartialConfig } from "@monkeytype/schemas/configs";
|
||||
import * as ConfigDAL from "../../dal/config";
|
||||
import { MonkeyResponse } from "../../utils/monkey-response";
|
||||
import { GetConfigResponse } from "@monkeytype/contracts/configs";
|
||||
|
|
|
@ -9,11 +9,7 @@ import { ObjectId } from "mongodb";
|
|||
import * as LeaderboardDal from "../../dal/leaderboards";
|
||||
import MonkeyError from "../../utils/error";
|
||||
|
||||
import {
|
||||
Mode,
|
||||
PersonalBest,
|
||||
PersonalBests,
|
||||
} from "@monkeytype/contracts/schemas/shared";
|
||||
import { Mode, PersonalBest, PersonalBests } from "@monkeytype/schemas/shared";
|
||||
import {
|
||||
GenerateDataRequest,
|
||||
GenerateDataResponse,
|
||||
|
@ -22,7 +18,7 @@ import { roundTo2 } from "@monkeytype/util/numbers";
|
|||
import { MonkeyRequest } from "../types";
|
||||
import { DBResult } from "../../utils/result";
|
||||
import { LbPersonalBests } from "../../utils/pb";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
|
||||
const CREATE_RESULT_DEFAULT_OPTIONS = {
|
||||
firstTestTimestamp: DateUtils.startOfDay(new UTCDate(Date.now())).valueOf(),
|
||||
|
|
|
@ -19,7 +19,7 @@ import {
|
|||
GetWeeklyXpLeaderboardRankResponse,
|
||||
GetWeeklyXpLeaderboardResponse,
|
||||
} from "@monkeytype/contracts/leaderboards";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import {
|
||||
getCurrentDayTimestamp,
|
||||
getCurrentWeekTimestamp,
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
import * as PresetDAL from "../../dal/preset";
|
||||
import { MonkeyResponse } from "../../utils/monkey-response";
|
||||
import { replaceObjectId } from "../../utils/misc";
|
||||
import { EditPresetRequest } from "@monkeytype/contracts/schemas/presets";
|
||||
import { EditPresetRequest } from "@monkeytype/schemas/presets";
|
||||
import { MonkeyRequest } from "../types";
|
||||
|
||||
export async function getPresets(
|
||||
|
|
|
@ -23,7 +23,7 @@ import {
|
|||
} from "@monkeytype/contracts/quotes";
|
||||
import { replaceObjectId, replaceObjectIds } from "../../utils/misc";
|
||||
import { MonkeyRequest } from "../types";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
|
||||
async function verifyCaptcha(captcha: string): Promise<void> {
|
||||
if (!(await verify(captcha))) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import {
|
|||
DBResult,
|
||||
replaceLegacyValues,
|
||||
} from "../../utils/result";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import { addImportantLog, addLog } from "../../dal/logs";
|
||||
import {
|
||||
AddResultRequest,
|
||||
|
@ -50,8 +50,8 @@ import {
|
|||
Result,
|
||||
PostResultResponse,
|
||||
XpBreakdown,
|
||||
} from "@monkeytype/contracts/schemas/results";
|
||||
import { Mode } from "@monkeytype/contracts/schemas/shared";
|
||||
} from "@monkeytype/schemas/results";
|
||||
import { Mode } from "@monkeytype/schemas/shared";
|
||||
import {
|
||||
isSafeNumber,
|
||||
mapRange,
|
||||
|
|
|
@ -39,7 +39,7 @@ import {
|
|||
CountByYearAndDay,
|
||||
TestActivity,
|
||||
UserProfileDetails,
|
||||
} from "@monkeytype/contracts/schemas/users";
|
||||
} from "@monkeytype/schemas/users";
|
||||
import { addImportantLog, addLog, deleteUserLogs } from "../../dal/logs";
|
||||
import { sendForgotPasswordEmail as authSendForgotPasswordEmail } from "../../utils/auth";
|
||||
import {
|
||||
|
|
|
@ -31,7 +31,7 @@ import { getLiveConfiguration } from "../../init/configuration";
|
|||
import Logger from "../../utils/logger";
|
||||
import { createExpressEndpoints, initServer } from "@ts-rest/express";
|
||||
import { ZodIssue } from "zod";
|
||||
import { MonkeyValidationError } from "@monkeytype/contracts/schemas/api";
|
||||
import { MonkeyValidationError } from "@monkeytype/contracts/util/api";
|
||||
import { authenticateTsRestRequest } from "../../middlewares/auth";
|
||||
import { rateLimitRequest } from "../../middlewares/rate-limit";
|
||||
import { verifyPermissions } from "../../middlewares/permission";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
|
||||
/**
|
||||
* This is the base schema for the configuration of the API backend.
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
Collection,
|
||||
} from "mongodb";
|
||||
import MonkeyError from "../utils/error";
|
||||
import { ApeKey } from "@monkeytype/contracts/schemas/ape-keys";
|
||||
import { ApeKey } from "@monkeytype/schemas/ape-keys";
|
||||
|
||||
export type DBApeKey = ApeKey & {
|
||||
_id: ObjectId;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Collection } from "mongodb";
|
||||
import * as db from "../init/db";
|
||||
import { createHash } from "crypto";
|
||||
import { User } from "@monkeytype/contracts/schemas/users";
|
||||
import { User } from "@monkeytype/schemas/users";
|
||||
import { WithObjectId } from "../utils/misc";
|
||||
|
||||
type BlocklistEntryProperties = Pick<User, "name" | "email" | "discordId">;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Collection, ObjectId, UpdateResult } from "mongodb";
|
||||
import * as db from "../init/db";
|
||||
import _ from "lodash";
|
||||
import { Config, PartialConfig } from "@monkeytype/contracts/schemas/configs";
|
||||
import { Config, PartialConfig } from "@monkeytype/schemas/configs";
|
||||
|
||||
const configLegacyProperties = [
|
||||
"swapEscAndTab",
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
|
||||
import { addLog } from "./logs";
|
||||
import { Collection, ObjectId } from "mongodb";
|
||||
import { LeaderboardEntry } from "@monkeytype/contracts/schemas/leaderboards";
|
||||
import { LeaderboardEntry } from "@monkeytype/schemas/leaderboards";
|
||||
import { omit } from "lodash";
|
||||
import { DBUser, getUsersCollection } from "./user";
|
||||
import MonkeyError from "../utils/error";
|
||||
|
|
|
@ -6,12 +6,12 @@ import { readFile } from "node:fs/promises";
|
|||
import * as db from "../init/db";
|
||||
import MonkeyError from "../utils/error";
|
||||
import { compareTwoStrings } from "string-similarity";
|
||||
import { ApproveQuote, Quote } from "@monkeytype/contracts/schemas/quotes";
|
||||
import { ApproveQuote, Quote } from "@monkeytype/schemas/quotes";
|
||||
import { WithObjectId } from "../utils/misc";
|
||||
import { parseWithSchema as parseJsonWithSchema } from "@monkeytype/util/json";
|
||||
import { z } from "zod";
|
||||
import { tryCatchSync } from "@monkeytype/util/trycatch";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
|
||||
const JsonQuoteSchema = z.object({
|
||||
text: z.string(),
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import MonkeyError from "../utils/error";
|
||||
import * as db from "../init/db";
|
||||
import { ObjectId, type Filter, Collection, type WithId } from "mongodb";
|
||||
import {
|
||||
EditPresetRequest,
|
||||
Preset,
|
||||
} from "@monkeytype/contracts/schemas/presets";
|
||||
import { EditPresetRequest, Preset } from "@monkeytype/schemas/presets";
|
||||
import { omit } from "lodash";
|
||||
import { WithObjectId } from "../utils/misc";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { PSA } from "@monkeytype/contracts/schemas/psas";
|
||||
import { PSA } from "@monkeytype/schemas/psas";
|
||||
import * as db from "../init/db";
|
||||
import { WithObjectId } from "../utils/misc";
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import { roundTo2 } from "@monkeytype/util/numbers";
|
||||
import * as db from "../init/db";
|
||||
import MonkeyError from "../utils/error";
|
||||
import {
|
||||
TypingStats,
|
||||
SpeedHistogram,
|
||||
} from "@monkeytype/contracts/schemas/public";
|
||||
import { TypingStats, SpeedHistogram } from "@monkeytype/schemas/public";
|
||||
|
||||
export type PublicTypingStatsDB = TypingStats & { _id: "stats" };
|
||||
export type PublicSpeedStatsDB = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { QuoteRating } from "@monkeytype/contracts/schemas/quotes";
|
||||
import { QuoteRating } from "@monkeytype/schemas/quotes";
|
||||
import * as db from "../init/db";
|
||||
import { Collection } from "mongodb";
|
||||
import { WithObjectId } from "../utils/misc";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
|
||||
type DBQuoteRating = WithObjectId<QuoteRating>;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as db from "../init/db";
|
|||
|
||||
import { getUser, getTags } from "./user";
|
||||
import { DBResult } from "../utils/result";
|
||||
import { FunboxName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { FunboxName } from "@monkeytype/schemas/configs";
|
||||
import { tryCatch } from "@monkeytype/util/trycatch";
|
||||
|
||||
export const getResultCollection = (): Collection<DBResult> =>
|
||||
|
|
|
@ -26,15 +26,11 @@ import {
|
|||
UserTag,
|
||||
User,
|
||||
CountByYearAndDay,
|
||||
} from "@monkeytype/contracts/schemas/users";
|
||||
import {
|
||||
Mode,
|
||||
Mode2,
|
||||
PersonalBest,
|
||||
} from "@monkeytype/contracts/schemas/shared";
|
||||
} from "@monkeytype/schemas/users";
|
||||
import { Mode, Mode2, PersonalBest } from "@monkeytype/schemas/shared";
|
||||
import { addImportantLog } from "./logs";
|
||||
import { Result as ResultType } from "@monkeytype/contracts/schemas/results";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Result as ResultType } from "@monkeytype/schemas/results";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import { isToday, isYesterday } from "@monkeytype/util/date-and-time";
|
||||
import GeorgeQueue from "../queues/george-queue";
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ObjectId } from "mongodb";
|
|||
import Logger from "../utils/logger";
|
||||
import { identity } from "../utils/misc";
|
||||
import { BASE_CONFIGURATION } from "../constants/base-configuration";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import { addLog } from "../dal/logs";
|
||||
import {
|
||||
PartialConfiguration,
|
||||
|
|
|
@ -17,8 +17,8 @@ import { AppRoute, AppRouter } from "@ts-rest/core";
|
|||
import {
|
||||
EndpointMetadata,
|
||||
RequestAuthenticationOptions,
|
||||
} from "@monkeytype/contracts/schemas/api";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
} from "@monkeytype/contracts/util/api";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import { getMetadata } from "./utility";
|
||||
import { TsRestRequestWithContext } from "../api/types";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import type { Response, NextFunction } from "express";
|
||||
import { TsRestRequestHandler } from "@ts-rest/express";
|
||||
import { EndpointMetadata } from "@monkeytype/contracts/schemas/api";
|
||||
import { EndpointMetadata } from "@monkeytype/contracts/util/api";
|
||||
import MonkeyError from "../utils/error";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import {
|
||||
ConfigurationPath,
|
||||
RequireConfiguration,
|
||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
|||
Request as ExpressRequest,
|
||||
} from "express";
|
||||
import { DecodedToken } from "./auth";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import { ExpressRequestWithContext } from "../api/types";
|
||||
|
||||
export type Context = {
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
EndpointMetadata,
|
||||
RequestAuthenticationOptions,
|
||||
PermissionId,
|
||||
} from "@monkeytype/contracts/schemas/api";
|
||||
} from "@monkeytype/contracts/util/api";
|
||||
import { isDevEnvironment } from "../utils/misc";
|
||||
import { getMetadata } from "./utility";
|
||||
import { TsRestRequestWithContext } from "../api/types";
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { Request, Response, NextFunction, RequestHandler } from "express";
|
|||
import { recordClientVersion as prometheusRecordClientVersion } from "../utils/prometheus";
|
||||
import { isDevEnvironment } from "../utils/misc";
|
||||
import MonkeyError from "../utils/error";
|
||||
import { EndpointMetadata } from "@monkeytype/contracts/schemas/api";
|
||||
import { EndpointMetadata } from "@monkeytype/contracts/util/api";
|
||||
import { TsRestRequestWithContext } from "../api/types";
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { LeaderboardEntry } from "@monkeytype/contracts/schemas/leaderboards";
|
||||
import { LeaderboardEntry } from "@monkeytype/schemas/leaderboards";
|
||||
import { MonkeyQueue } from "./monkey-queue";
|
||||
|
||||
const QUEUE_NAME = "george-tasks";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import LRUCache from "lru-cache";
|
||||
import Logger from "../utils/logger";
|
||||
import { MonkeyQueue } from "./monkey-queue";
|
||||
import { ValidModeRule } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { ValidModeRule } from "@monkeytype/schemas/configuration";
|
||||
import {
|
||||
getCurrentDayTimestamp,
|
||||
getCurrentWeekTimestamp,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import * as RedisClient from "../init/redis";
|
||||
import LaterQueue from "../queues/later-queue";
|
||||
import {
|
||||
|
@ -6,7 +6,7 @@ import {
|
|||
RedisXpLeaderboardEntrySchema,
|
||||
RedisXpLeaderboardScore,
|
||||
XpLeaderboardEntry,
|
||||
} from "@monkeytype/contracts/schemas/leaderboards";
|
||||
} from "@monkeytype/schemas/leaderboards";
|
||||
import { getCurrentWeekTimestamp } from "@monkeytype/util/date-and-time";
|
||||
import MonkeyError from "../utils/error";
|
||||
import { omit } from "lodash";
|
||||
|
|
|
@ -6,14 +6,14 @@ import { parseWithSchema as parseJsonWithSchema } from "@monkeytype/util/json";
|
|||
import {
|
||||
Configuration,
|
||||
ValidModeRule,
|
||||
} from "@monkeytype/contracts/schemas/configuration";
|
||||
} from "@monkeytype/schemas/configuration";
|
||||
import {
|
||||
LeaderboardEntry,
|
||||
RedisDailyLeaderboardEntry,
|
||||
RedisDailyLeaderboardEntrySchema,
|
||||
} from "@monkeytype/contracts/schemas/leaderboards";
|
||||
} from "@monkeytype/schemas/leaderboards";
|
||||
import MonkeyError from "./error";
|
||||
import { Mode, Mode2 } from "@monkeytype/contracts/schemas/shared";
|
||||
import { Mode, Mode2 } from "@monkeytype/schemas/shared";
|
||||
import { getCurrentDayTimestamp } from "@monkeytype/util/date-and-time";
|
||||
|
||||
const dailyLeaderboardNamespace = "monkeytype:dailyleaderboard";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import { isDevEnvironment } from "./misc";
|
||||
import { MonkeyServerErrorType } from "@monkeytype/contracts/schemas/api";
|
||||
import { MonkeyServerErrorType } from "@monkeytype/contracts/util/api";
|
||||
import { FirebaseError } from "firebase-admin";
|
||||
|
||||
type FirebaseErrorParent = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { MonkeyMail } from "@monkeytype/contracts/schemas/users";
|
||||
import { MonkeyMail } from "@monkeytype/schemas/users";
|
||||
import { v4 } from "uuid";
|
||||
|
||||
type MonkeyMailOptions = Partial<Omit<MonkeyMail, "id" | "read">>;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { MonkeyResponseType } from "@monkeytype/contracts/schemas/api";
|
||||
import { MonkeyResponseType } from "@monkeytype/contracts/util/api";
|
||||
|
||||
export type MonkeyDataAware<T> = {
|
||||
data: T | null;
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
import _ from "lodash";
|
||||
import {
|
||||
Mode,
|
||||
PersonalBest,
|
||||
PersonalBests,
|
||||
} from "@monkeytype/contracts/schemas/shared";
|
||||
import { Result as ResultType } from "@monkeytype/contracts/schemas/results";
|
||||
import { Mode, PersonalBest, PersonalBests } from "@monkeytype/schemas/shared";
|
||||
import { Result as ResultType } from "@monkeytype/schemas/results";
|
||||
import { getFunbox } from "@monkeytype/funbox";
|
||||
|
||||
export type LbPersonalBests = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import "dotenv/config";
|
||||
import { Counter, Histogram, Gauge } from "prom-client";
|
||||
import { CompletedEvent } from "@monkeytype/contracts/schemas/results";
|
||||
import { CompletedEvent } from "@monkeytype/schemas/results";
|
||||
import { Request } from "express";
|
||||
|
||||
const auth = new Counter({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { CompletedEvent, Result } from "@monkeytype/contracts/schemas/results";
|
||||
import { Mode } from "@monkeytype/contracts/schemas/shared";
|
||||
import { CompletedEvent, Result } from "@monkeytype/schemas/results";
|
||||
import { Mode } from "@monkeytype/schemas/shared";
|
||||
import { ObjectId } from "mongodb";
|
||||
import { WithObjectId } from "./misc";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import _ from "lodash";
|
||||
import { CompletedEvent } from "@monkeytype/contracts/schemas/results";
|
||||
import { CompletedEvent } from "@monkeytype/schemas/results";
|
||||
|
||||
export function isTestTooShort(result: CompletedEvent): boolean {
|
||||
const { mode, mode2, customText, testDuration, bailedOut } = result;
|
||||
|
|
|
@ -15,7 +15,7 @@ import LaterQueue, {
|
|||
} from "../queues/later-queue";
|
||||
import { recordTimeToCompleteJob } from "../utils/prometheus";
|
||||
import { WeeklyXpLeaderboard } from "../services/weekly-xp-leaderboard";
|
||||
import { MonkeyMail } from "@monkeytype/contracts/schemas/users";
|
||||
import { MonkeyMail } from "@monkeytype/schemas/users";
|
||||
import { isSafeNumber, mapRange } from "@monkeytype/util/numbers";
|
||||
|
||||
async function handleDailyLeaderboardResults(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { readdirSync } from "fs";
|
||||
import { LanguageGroups, LanguageList } from "../../src/ts/constants/languages";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
|
||||
describe("languages", () => {
|
||||
describe("LanguageList", () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { readdirSync } from "fs";
|
||||
import { LayoutsList } from "../../src/ts/constants/layouts";
|
||||
import { LayoutName } from "@monkeytype/contracts/schemas/layouts";
|
||||
import { LayoutName } from "@monkeytype/schemas/layouts";
|
||||
|
||||
describe("layouts", () => {
|
||||
it("should not have duplicates", () => {
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
FunboxName,
|
||||
ConfigKey,
|
||||
Config as ConfigType,
|
||||
} from "@monkeytype/contracts/schemas/configs";
|
||||
} from "@monkeytype/schemas/configs";
|
||||
import { randomBytes } from "crypto";
|
||||
import { vi } from "vitest";
|
||||
import * as FunboxValidation from "../../src/ts/test/funbox/funbox-validation";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { canSetConfigWithCurrentFunboxes } from "../../../src/ts/test/funbox/funbox-validation";
|
||||
|
||||
import * as Notifications from "../../../src/ts/elements/notifications";
|
||||
import { FunboxName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { FunboxName } from "@monkeytype/schemas/configs";
|
||||
describe("funbox-validation", () => {
|
||||
describe("canSetConfigWithCurrentFunboxes", () => {
|
||||
const addNotificationMock = vi.spyOn(Notifications, "add");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { getDefaultConfig } from "../../src/ts/constants/default-config";
|
||||
import { migrateConfig } from "../../src/ts/utils/config";
|
||||
import { PartialConfig } from "@monkeytype/contracts/schemas/configs";
|
||||
import { PartialConfig } from "@monkeytype/schemas/configs";
|
||||
|
||||
const defaultConfig = getDefaultConfig();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { getDefaultConfig } from "../../src/ts/constants/default-config";
|
||||
import { Formatting } from "../../src/ts/utils/format";
|
||||
import { Config } from "@monkeytype/contracts/schemas/configs";
|
||||
import { Config } from "@monkeytype/schemas/configs";
|
||||
|
||||
describe("format.ts", () => {
|
||||
describe("typingsSpeed", () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// eslint-disable no-useless-escape
|
||||
import { Difficulty, Mode, Mode2 } from "@monkeytype/contracts/schemas/shared";
|
||||
import { Difficulty, Mode, Mode2 } from "@monkeytype/schemas/shared";
|
||||
import { compressToURI } from "lz-ts";
|
||||
import * as UpdateConfig from "../../src/ts/config";
|
||||
import * as Notifications from "../../src/ts/elements/notifications";
|
||||
|
@ -8,7 +8,7 @@ import * as TestLogic from "../../src/ts/test/test-logic";
|
|||
import * as TestState from "../../src/ts/test/test-state";
|
||||
import * as Misc from "../../src/ts/utils/misc";
|
||||
import { loadTestSettingsFromUrl } from "../../src/ts/utils/url-handler";
|
||||
import { FunboxName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { FunboxName } from "@monkeytype/schemas/configs";
|
||||
|
||||
//mock modules to avoid dependencies
|
||||
vi.mock("../../src/ts/test/test-logic", () => ({
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
"@fortawesome/fontawesome-free": "5.15.4",
|
||||
"@monkeytype/eslint-config": "workspace:*",
|
||||
"@monkeytype/oxlint-config": "workspace:*",
|
||||
"@monkeytype/schemas": "workspace:*",
|
||||
"@monkeytype/typescript-config": "workspace:*",
|
||||
"@types/canvas-confetti": "1.4.3",
|
||||
"@types/chartjs-plugin-trendline": "1.0.1",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { Configuration } from "@monkeytype/schemas/configuration";
|
||||
import Ape from ".";
|
||||
import { promiseWithResolvers } from "../utils/misc";
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ import {
|
|||
CustomLayoutFluidSchema,
|
||||
CustomPolyglot,
|
||||
CustomPolyglotSchema,
|
||||
} from "@monkeytype/contracts/schemas/configs";
|
||||
} from "@monkeytype/schemas/configs";
|
||||
import { Command, CommandsSubgroup, withValidation } from "./types";
|
||||
import * as TestLogic from "../test/test-logic";
|
||||
import * as ActivePage from "../states/active-page";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ThemeName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { ThemeName } from "@monkeytype/schemas/configs";
|
||||
import Config, * as UpdateConfig from "../../config";
|
||||
import { randomTheme } from "../../controllers/theme-controller";
|
||||
import { Command } from "../types";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { FontSizeSchema } from "@monkeytype/contracts/schemas/configs";
|
||||
import { FontSizeSchema } from "@monkeytype/schemas/configs";
|
||||
import Config, * as UpdateConfig from "../../config";
|
||||
import { Command, withValidation } from "../types";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { KeymapLayout } from "@monkeytype/contracts/schemas/configs";
|
||||
import { KeymapLayout } from "@monkeytype/schemas/configs";
|
||||
import * as UpdateConfig from "../../config";
|
||||
import { LayoutsList } from "../../constants/layouts";
|
||||
import * as TestLogic from "../../test/test-logic";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Config } from "@monkeytype/contracts/schemas/configs";
|
||||
import { Config } from "@monkeytype/schemas/configs";
|
||||
import AnimatedModal from "../utils/animated-modal";
|
||||
import { z } from "zod";
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ import {
|
|||
reloadAfter,
|
||||
typedKeys,
|
||||
} from "./utils/misc";
|
||||
import * as ConfigSchemas from "@monkeytype/contracts/schemas/configs";
|
||||
import { Config, FunboxName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { Mode } from "@monkeytype/contracts/schemas/shared";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import * as ConfigSchemas from "@monkeytype/schemas/configs";
|
||||
import { Config, FunboxName } from "@monkeytype/schemas/configs";
|
||||
import { Mode } from "@monkeytype/schemas/shared";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
import { LocalStorageWithSchema } from "./utils/local-storage-with-schema";
|
||||
import { migrateConfig } from "./utils/config";
|
||||
import { roundTo1 } from "@monkeytype/util/numbers";
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
Config,
|
||||
CustomThemeColors,
|
||||
} from "@monkeytype/contracts/schemas/configs";
|
||||
import { Config, CustomThemeColors } from "@monkeytype/schemas/configs";
|
||||
import { deepClone } from "../utils/misc";
|
||||
|
||||
const obj = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ResultFilters } from "@monkeytype/contracts/schemas/users";
|
||||
import { ResultFilters } from "@monkeytype/schemas/users";
|
||||
import { deepClone } from "../utils/misc";
|
||||
import { LanguageList } from "./languages";
|
||||
import { getFunboxNames } from "@monkeytype/funbox";
|
||||
|
|
|
@ -3,18 +3,18 @@ import {
|
|||
User,
|
||||
UserProfileDetails,
|
||||
UserTag,
|
||||
} from "@monkeytype/contracts/schemas/users";
|
||||
} from "@monkeytype/schemas/users";
|
||||
import { deepClone } from "../utils/misc";
|
||||
import { getDefaultConfig } from "./default-config";
|
||||
import { Mode } from "@monkeytype/contracts/schemas/shared";
|
||||
import { Result } from "@monkeytype/contracts/schemas/results";
|
||||
import { Config, FunboxName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { Mode } from "@monkeytype/schemas/shared";
|
||||
import { Result } from "@monkeytype/schemas/results";
|
||||
import { Config, FunboxName } from "@monkeytype/schemas/configs";
|
||||
import {
|
||||
ModifiableTestActivityCalendar,
|
||||
TestActivityCalendar,
|
||||
} from "../elements/test-activity-calendar";
|
||||
import { Preset } from "@monkeytype/contracts/schemas/presets";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import { Preset } from "@monkeytype/schemas/presets";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
|
||||
export type SnapshotUserTag = UserTag & {
|
||||
active?: boolean;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
Language,
|
||||
LanguageSchema,
|
||||
} from "@monkeytype/contracts/schemas/languages";
|
||||
import { Language, LanguageSchema } from "@monkeytype/schemas/languages";
|
||||
|
||||
export const LanguageList: Language[] = LanguageSchema._def.values;
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import { LayoutName, LayoutNameSchema } from "@monkeytype/contracts/schemas/layouts";
|
||||
import { LayoutName, LayoutNameSchema } from "@monkeytype/schemas/layouts";
|
||||
|
||||
export const LayoutsList:LayoutName[] = LayoutNameSchema._def.values;
|
|
@ -1,4 +1,4 @@
|
|||
import { ThemeName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { ThemeName } from "@monkeytype/schemas/configs";
|
||||
import { hexToHSL } from "../utils/colors";
|
||||
|
||||
export type Theme = {
|
||||
|
|
|
@ -9,18 +9,15 @@ import * as TestUI from "../test/test-ui";
|
|||
import * as ConfigEvent from "../observables/config-event";
|
||||
import * as TestState from "../test/test-state";
|
||||
import * as Loader from "../elements/loader";
|
||||
import {
|
||||
CustomTextLimitMode,
|
||||
CustomTextMode,
|
||||
} from "@monkeytype/contracts/schemas/util";
|
||||
import { CustomTextLimitMode, CustomTextMode } from "@monkeytype/schemas/util";
|
||||
import {
|
||||
Config as ConfigType,
|
||||
Difficulty,
|
||||
ThemeName,
|
||||
FunboxName,
|
||||
} from "@monkeytype/contracts/schemas/configs";
|
||||
import { Mode } from "@monkeytype/contracts/schemas/shared";
|
||||
import { CompletedEvent } from "@monkeytype/contracts/schemas/results";
|
||||
} from "@monkeytype/schemas/configs";
|
||||
import { Mode } from "@monkeytype/schemas/shared";
|
||||
import { CompletedEvent } from "@monkeytype/schemas/results";
|
||||
import { areUnsortedArraysEqual } from "../utils/arrays";
|
||||
import { tryCatch } from "@monkeytype/util/trycatch";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Preset } from "@monkeytype/contracts/schemas/presets";
|
||||
import { Preset } from "@monkeytype/schemas/presets";
|
||||
import * as UpdateConfig from "../config";
|
||||
import * as DB from "../db";
|
||||
import * as Notifications from "../elements/notifications";
|
||||
|
|
|
@ -5,7 +5,7 @@ import { subscribe } from "../observables/config-event";
|
|||
import * as DB from "../db";
|
||||
import Ape from "../ape";
|
||||
import { tryCatch } from "@monkeytype/util/trycatch";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
|
||||
export type Quote = {
|
||||
text: string;
|
||||
|
|
|
@ -8,7 +8,7 @@ import { capsState } from "../test/caps-warning";
|
|||
import * as Notifications from "../elements/notifications";
|
||||
|
||||
import type { Howl } from "howler";
|
||||
import { PlaySoundOnClick } from "@monkeytype/contracts/schemas/configs";
|
||||
import { PlaySoundOnClick } from "@monkeytype/schemas/configs";
|
||||
|
||||
async function gethowler(): Promise<typeof import("howler")> {
|
||||
return await import("howler");
|
||||
|
|
|
@ -2,7 +2,7 @@ import { z } from "zod";
|
|||
import * as DB from "../db";
|
||||
import * as ModesNotice from "../elements/modes-notice";
|
||||
import { LocalStorageWithSchema } from "../utils/local-storage-with-schema";
|
||||
import { IdSchema } from "@monkeytype/contracts/schemas/util";
|
||||
import { IdSchema } from "@monkeytype/schemas/util";
|
||||
|
||||
const activeTagsLS = new LocalStorageWithSchema({
|
||||
key: "activeTags",
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as DB from "../db";
|
|||
import * as Notifications from "../elements/notifications";
|
||||
import * as Loader from "../elements/loader";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import { ThemeName } from "@monkeytype/contracts/schemas/configs";
|
||||
import { ThemeName } from "@monkeytype/schemas/configs";
|
||||
import { ThemesList } from "../constants/themes";
|
||||
|
||||
export let randomTheme: ThemeName | string | null = null;
|
||||
|
|
|
@ -12,14 +12,14 @@ import {
|
|||
} from "./elements/test-activity-calendar";
|
||||
import * as Loader from "./elements/loader";
|
||||
|
||||
import { Badge, CustomTheme } from "@monkeytype/contracts/schemas/users";
|
||||
import { Config, Difficulty } from "@monkeytype/contracts/schemas/configs";
|
||||
import { Badge, CustomTheme } from "@monkeytype/schemas/users";
|
||||
import { Config, Difficulty } from "@monkeytype/schemas/configs";
|
||||
import {
|
||||
Mode,
|
||||
Mode2,
|
||||
PersonalBest,
|
||||
PersonalBests,
|
||||
} from "@monkeytype/contracts/schemas/shared";
|
||||
} from "@monkeytype/schemas/shared";
|
||||
import {
|
||||
getDefaultSnapshot,
|
||||
Snapshot,
|
||||
|
@ -30,7 +30,7 @@ import {
|
|||
import { getDefaultConfig } from "./constants/default-config";
|
||||
import { FunboxMetadata } from "../../../packages/funbox/src/types";
|
||||
import { getFirstDayOfTheWeek } from "./utils/date-and-time";
|
||||
import { Language } from "@monkeytype/contracts/schemas/languages";
|
||||
import { Language } from "@monkeytype/schemas/languages";
|
||||
|
||||
let dbSnapshot: Snapshot | undefined;
|
||||
const firstDayOfTheWeek = getFirstDayOfTheWeek();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as Loader from "../../elements/loader";
|
||||
import * as Notifications from "../../elements/notifications";
|
||||
import Ape from "../../ape";
|
||||
import { ApeKey, ApeKeys } from "@monkeytype/contracts/schemas/ape-keys";
|
||||
import { ApeKey, ApeKeys } from "@monkeytype/schemas/ape-keys";
|
||||
import { format } from "date-fns/format";
|
||||
import { SimpleModal, TextArea } from "../../utils/simple-modal";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Config from "../../config";
|
||||
import { format as dateFormat } from "date-fns/format";
|
||||
import Format from "../../utils/format";
|
||||
import { Mode2, PersonalBests } from "@monkeytype/contracts/schemas/shared";
|
||||
import { StringNumber } from "@monkeytype/contracts/schemas/util";
|
||||
import { Mode2, PersonalBests } from "@monkeytype/schemas/shared";
|
||||
import { StringNumber } from "@monkeytype/schemas/util";
|
||||
|
||||
function clearTables(isProfile: boolean): void {
|
||||
const source = isProfile ? "Profile" : "Account";
|
||||
|
|
|
@ -6,13 +6,13 @@ import * as Notifications from "../notifications";
|
|||
import Ape from "../../ape/index";
|
||||
import * as Loader from "../loader";
|
||||
import SlimSelect from "slim-select";
|
||||
import { QuoteLength } from "@monkeytype/contracts/schemas/configs";
|
||||
import { QuoteLength } from "@monkeytype/schemas/configs";
|
||||
import {
|
||||
ResultFilters,
|
||||
ResultFiltersSchema,
|
||||
ResultFiltersGroup,
|
||||
ResultFiltersGroupItem,
|
||||
} from "@monkeytype/contracts/schemas/users";
|
||||
} from "@monkeytype/schemas/users";
|
||||
import { LocalStorageWithSchema } from "../../utils/local-storage-with-schema";
|
||||
import defaultResultFilters from "../../constants/default-result-filters";
|
||||
import { getAllFunboxes } from "@monkeytype/funbox";
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as ConnectionState from "../states/connection";
|
|||
import { escapeHTML } from "../utils/misc";
|
||||
import AnimatedModal from "../utils/animated-modal";
|
||||
import { updateXp as accountPageUpdateProfile } from "./profile";
|
||||
import { MonkeyMail } from "@monkeytype/contracts/schemas/users";
|
||||
import { MonkeyMail } from "@monkeytype/schemas/users";
|
||||
import * as XPBar from "../elements/xp-bar";
|
||||
|
||||
let accountAlerts: MonkeyMail[] = [];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CustomBackgroundFilter } from "@monkeytype/contracts/schemas/configs";
|
||||
import { CustomBackgroundFilter } from "@monkeytype/schemas/configs";
|
||||
import * as UpdateConfig from "../config";
|
||||
import * as ConfigEvent from "../observables/config-event";
|
||||
import { debounce } from "throttle-debounce";
|
||||
|
|
|
@ -11,7 +11,7 @@ import * as ActivePage from "../states/active-page";
|
|||
import { formatDistanceToNowStrict } from "date-fns/formatDistanceToNowStrict";
|
||||
import { getHtmlByUserFlags } from "../controllers/user-flag-controller";
|
||||
import Format from "../utils/format";
|
||||
import { UserProfile, RankAndCount } from "@monkeytype/contracts/schemas/users";
|
||||
import { UserProfile, RankAndCount } from "@monkeytype/schemas/users";
|
||||
import { abbreviateNumber, convertRemToPixels } from "../utils/numbers";
|
||||
import { secondsToString } from "../utils/date-and-time";
|
||||
import { Auth } from "../firebase";
|
||||
|
|
|
@ -4,10 +4,10 @@ import { secondsToString } from "../utils/date-and-time";
|
|||
import * as Notifications from "./notifications";
|
||||
import { format } from "date-fns/format";
|
||||
import * as Alerts from "./alerts";
|
||||
import { PSA } from "@monkeytype/contracts/schemas/psas";
|
||||
import { PSA } from "@monkeytype/schemas/psas";
|
||||
import { z } from "zod";
|
||||
import { LocalStorageWithSchema } from "../utils/local-storage-with-schema";
|
||||
import { IdSchema } from "@monkeytype/contracts/schemas/util";
|
||||
import { IdSchema } from "@monkeytype/schemas/util";
|
||||
import { tryCatch } from "@monkeytype/util/trycatch";
|
||||
import { isSafeNumber } from "@monkeytype/util/numbers";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ConfigValue } from "@monkeytype/contracts/schemas/configs";
|
||||
import { ConfigValue } from "@monkeytype/schemas/configs";
|
||||
import Config from "../../config";
|
||||
import * as Notifications from "../notifications";
|
||||
import SlimSelect from "slim-select";
|
||||
|
|
|
@ -10,10 +10,7 @@ import * as DB from "../../db";
|
|||
import * as ConfigEvent from "../../observables/config-event";
|
||||
import { isAuthenticated } from "../../firebase";
|
||||
import * as ActivePage from "../../states/active-page";
|
||||
import {
|
||||
CustomThemeColors,
|
||||
ThemeName,
|
||||
} from "@monkeytype/contracts/schemas/configs";
|
||||
import { CustomThemeColors, ThemeName } from "@monkeytype/schemas/configs";
|
||||
import { captureException } from "../../sentry";
|
||||
import { ThemesListSorted } from "../../constants/themes";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as Misc from "../utils/misc";
|
|||
import * as Levels from "../utils/levels";
|
||||
import { getAll } from "./theme-colors";
|
||||
import * as SlowTimer from "../states/slow-timer";
|
||||
import { XpBreakdown } from "@monkeytype/contracts/schemas/results";
|
||||
import { XpBreakdown } from "@monkeytype/schemas/results";
|
||||
import { isSafeNumber, mapRange } from "@monkeytype/util/numbers";
|
||||
|
||||
let breakdownVisible = false;
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as Notifications from "../elements/notifications";
|
|||
import * as SavedTextsPopup from "./saved-texts";
|
||||
import * as SaveCustomTextPopup from "./save-custom-text";
|
||||
import AnimatedModal, { ShowOptions } from "../utils/animated-modal";
|
||||
import { CustomTextMode } from "@monkeytype/contracts/schemas/util";
|
||||
import { CustomTextMode } from "@monkeytype/schemas/util";
|
||||
|
||||
const popup = "#customTextModal .modal";
|
||||
|
||||
|
|
|
@ -6,10 +6,7 @@ import * as Settings from "../pages/settings";
|
|||
import * as Notifications from "../elements/notifications";
|
||||
import * as ConnectionState from "../states/connection";
|
||||
import AnimatedModal from "../utils/animated-modal";
|
||||
import {
|
||||
PresetType,
|
||||
PresetTypeSchema,
|
||||
} from "@monkeytype/contracts/schemas/presets";
|
||||
import { PresetType, PresetTypeSchema } from "@monkeytype/schemas/presets";
|
||||
import { getPreset } from "../controllers/preset-controller";
|
||||
import {
|
||||
ConfigGroupName,
|
||||
|
@ -17,7 +14,7 @@ import {
|
|||
ConfigGroupsLiteral,
|
||||
ConfigKey,
|
||||
Config as ConfigType,
|
||||
} from "@monkeytype/contracts/schemas/configs";
|
||||
} from "@monkeytype/schemas/configs";
|
||||
import { getDefaultConfig } from "../constants/default-config";
|
||||
import { SnapshotPreset } from "../constants/default-snapshot";
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
TwitterProfileSchema,
|
||||
UserProfileDetails,
|
||||
WebsiteSchema,
|
||||
} from "@monkeytype/contracts/schemas/users";
|
||||
} from "@monkeytype/schemas/users";
|
||||
import { InputIndicator } from "../elements/input-indicator";
|
||||
|
||||
export function show(): void {
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as DB from "../db";
|
|||
import * as Settings from "../pages/settings";
|
||||
import AnimatedModal, { ShowOptions } from "../utils/animated-modal";
|
||||
import { SimpleModal, TextInput } from "../utils/simple-modal";
|
||||
import { TagNameSchema } from "@monkeytype/contracts/schemas/users";
|
||||
import { TagNameSchema } from "@monkeytype/schemas/users";
|
||||
|
||||
const cleanTagName = (tagName: string): string => tagName.replaceAll(" ", "_");
|
||||
const tagNameValidation = async (tagName: string): Promise<true | string> => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import AnimatedModal from "../utils/animated-modal";
|
|||
|
||||
import * as TestLogic from "../test/test-logic";
|
||||
import * as Notifications from "../elements/notifications";
|
||||
import { CompletedEvent } from "@monkeytype/contracts/schemas/results";
|
||||
import { CompletedEvent } from "@monkeytype/schemas/results";
|
||||
import { Auth } from "../firebase";
|
||||
import { syncNotSignedInLastResult } from "../utils/results";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ChartData } from "@monkeytype/contracts/schemas/results";
|
||||
import { ChartData } from "@monkeytype/schemas/results";
|
||||
import AnimatedModal from "../utils/animated-modal";
|
||||
import * as ChartController from "../controllers/chart-controller";
|
||||
import Config from "../config";
|
||||
|
|
|
@ -6,11 +6,8 @@ import * as CustomTestDurationPopup from "./custom-test-duration";
|
|||
import * as QuoteSearchModal from "./quote-search";
|
||||
import * as CustomTextPopup from "./custom-text";
|
||||
import AnimatedModal from "../utils/animated-modal";
|
||||
import {
|
||||
QuoteLength,
|
||||
QuoteLengthConfig,
|
||||
} from "@monkeytype/contracts/schemas/configs";
|
||||
import { Mode } from "@monkeytype/contracts/schemas/shared";
|
||||
import { QuoteLength, QuoteLengthConfig } from "@monkeytype/schemas/configs";
|
||||
import { Mode } from "@monkeytype/schemas/shared";
|
||||
|
||||
function update(): void {
|
||||
const el = $("#mobileTestConfigModal");
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue