diff --git a/components/webui/server/package.json b/components/webui/server/package.json index 0d71297067..b2bd7bafa6 100644 --- a/components/webui/server/package.json +++ b/components/webui/server/package.json @@ -6,13 +6,13 @@ "scripts": { "build": "tsc", "build:watch": "npm run build -- -w", - "dev:start": "fastify start --ignore-watch=.ts$ -w -l info -P dist/server/src/fastify-v2/app.js", + "dev:start": "fastify start --ignore-watch=.ts$ -w -l info -P dist/server/src/app.js", "dev": "npm run build && concurrently -k -p \"[{name}]\" -n \"TypeScript,App\" -c \"yellow.bold,cyan.bold\" \"npm:build:watch\" \"npm:dev:start\"", - "start": "npm run build && fastify start -l info dist/server/src/fastify-v2/app.js", + "start": "npm run build && fastify start -l info dist/server/src/app.js", "standalone": "npm run build && node --env-file=.env dist/server/src/main.js", "lint:check": "eslint . --max-warnings 0", "lint:fix": "npm run lint:check -- --fix", - "test": "NODE_ENV=test tap --include='**/*test.ts'" + "test": "tap --include='**/*test.ts'" }, "author": "YScope Inc. ", "license": "Apache-2.0", diff --git a/components/webui/server/src/app.ts b/components/webui/server/src/app.ts index 8cd2bd066f..87a9dc5554 100644 --- a/components/webui/server/src/app.ts +++ b/components/webui/server/src/app.ts @@ -1,25 +1,106 @@ +// Reference: https://github.com/fastify/demo/blob/main/src/app.ts + +import path from "node:path"; + +import {fastifyAutoload} from "@fastify/autoload"; import { FastifyInstance, - FastifyPluginAsync, + FastifyPluginOptions, } from "fastify"; +import {StatusCodes} from "http-status-codes"; -import staticRoutes from "./routes/static.js"; +const RATE_LIMIT_MAX_REQUESTS = 3; +const RATE_LIMIT_TIME_WINDOW_MS = 500; /** - * Creates the Fastify app with the given options. - * - * TODO: Once old webui code is refactored to new modlular fastify style, this plugin should be - * removed. + * Registers all plugins and routes. * * @param fastify - * @return + * @param opts */ -const FastifyV1App: FastifyPluginAsync = async ( - fastify: FastifyInstance -) => { - // Register the routes - await fastify.register(staticRoutes); -}; - -export default FastifyV1App; +// eslint-disable-next-line max-lines-per-function +export default async function serviceApp ( + fastify: FastifyInstance, + opts: FastifyPluginOptions +) { + // Option only serves testing purpose. It's used in testing to expose all decorators to the + // test app. Some decorators may not be exposed in production. + delete opts.skipOverride; + + // Loads all external plugins. Registered first as application plugins might depend on them. + await fastify.register(fastifyAutoload, { + dir: path.join(import.meta.dirname, "plugins/external"), + options: {...opts}, + }); + + // Loads all application plugins. + fastify.register(fastifyAutoload, { + dir: path.join(import.meta.dirname, "plugins/app"), + options: {...opts}, + }); + + // Loads all routes. + fastify.register(fastifyAutoload, { + autoHooks: true, + cascadeHooks: true, + dir: path.join(import.meta.dirname, "routes"), + options: {...opts}, + }); + + fastify.setErrorHandler((err, request, reply) => { + fastify.log.error( + { + err: err, + request: { + method: request.method, + url: request.url, + query: request.query, + params: request.params, + }, + }, + "Unhandled error occurred" + ); + + if ("undefined" !== typeof err.statusCode && + Number(StatusCodes.INTERNAL_SERVER_ERROR) > err.statusCode + ) { + reply.code(err.statusCode); + + return err.message; + } + + reply.internalServerError(); + + return { + message: "Internal Server Error", + }; + }); + + // An attacker could search for valid URLs if 404 error handling is not rate limited. + fastify.setNotFoundHandler( + { + preHandler: fastify.rateLimit({ + max: RATE_LIMIT_MAX_REQUESTS, + timeWindow: RATE_LIMIT_TIME_WINDOW_MS, + }), + }, + (request, reply) => { + request.log.warn( + { + request: { + method: request.method, + url: request.url, + query: request.query, + params: request.params, + }, + }, + "Resource not found" + ); + + reply.notFound(); + + return {message: "Not Found"}; + } + ); +} diff --git a/components/webui/server/src/fastify-v2/app.ts b/components/webui/server/src/fastify-v2/app.ts deleted file mode 100644 index 340a4d9e1f..0000000000 --- a/components/webui/server/src/fastify-v2/app.ts +++ /dev/null @@ -1,113 +0,0 @@ -// Reference: https://github.com/fastify/demo/blob/main/src/app.ts - -import path from "node:path"; - -import {fastifyAutoload} from "@fastify/autoload"; -import { - FastifyInstance, - FastifyPluginOptions, -} from "fastify"; -import {StatusCodes} from "http-status-codes"; - -import FastifyV1App from "../app.js"; - - -const RATE_LIMIT_MAX_REQUESTS = 3; -const RATE_LIMIT_TIME_WINDOW_MS = 500; - -/** - * Registers all plugins and routes. - * - * @param fastify - * @param opts - */ -// eslint-disable-next-line max-lines-per-function -export default async function serviceApp ( - fastify: FastifyInstance, - opts: FastifyPluginOptions -) { - // Option only serves testing purpose. It's used in testing to expose all decorators to the - // test app. Some decorators may not be exposed in production. - delete opts.skipOverride; - - // Loads all external plugins. Registered first as application plugins might depend on them. - await fastify.register(fastifyAutoload, { - dir: path.join(import.meta.dirname, "plugins/external"), - options: {...opts}, - }); - - // eslint-disable-next-line no-warning-comments - // TODO: Refactor old webui code to use more modular fastify style. Temporarily, the old webui - // code is loaded as a separate plugin. - await fastify.register(FastifyV1App); - - // Loads all application plugins. - fastify.register(fastifyAutoload, { - dir: path.join(import.meta.dirname, "plugins/app"), - options: {...opts}, - }); - - // Loads all routes. - fastify.register(fastifyAutoload, { - autoHooks: true, - cascadeHooks: true, - dir: path.join(import.meta.dirname, "routes"), - options: {...opts}, - }); - - fastify.setErrorHandler((err, request, reply) => { - fastify.log.error( - { - err: err, - request: { - method: request.method, - url: request.url, - query: request.query, - params: request.params, - }, - }, - "Unhandled error occurred" - ); - - if ("undefined" !== typeof err.statusCode && - Number(StatusCodes.INTERNAL_SERVER_ERROR) > err.statusCode - ) { - reply.code(err.statusCode); - - return err.message; - } - - reply.internalServerError(); - - return { - message: "Internal Server Error", - }; - }); - - // An attacker could search for valid URLs if 404 error handling is not rate limited. - fastify.setNotFoundHandler( - { - preHandler: fastify.rateLimit({ - max: RATE_LIMIT_MAX_REQUESTS, - timeWindow: RATE_LIMIT_TIME_WINDOW_MS, - }), - }, - (request, reply) => { - request.log.warn( - { - request: { - method: request.method, - url: request.url, - query: request.query, - params: request.params, - }, - }, - "Resource not found" - ); - - reply.notFound(); - - return {message: "Not Found"}; - } - ); -} diff --git a/components/webui/server/src/main.ts b/components/webui/server/src/main.ts index 6faacbebb8..558942d96a 100644 --- a/components/webui/server/src/main.ts +++ b/components/webui/server/src/main.ts @@ -4,7 +4,7 @@ import closeWithGrace from "close-with-grace"; import fastify from "fastify"; import fp from "fastify-plugin"; -import serviceApp from "./fastify-v2/app.js"; +import serviceApp from "./app.js"; const DEFAULT_FASTIFY_CLOSE_GRACE_DELAY = 500; diff --git a/components/webui/server/src/fastify-v2/plugins/app/QueryJobDbManager/index.ts b/components/webui/server/src/plugins/app/QueryJobDbManager/index.ts similarity index 97% rename from components/webui/server/src/fastify-v2/plugins/app/QueryJobDbManager/index.ts rename to components/webui/server/src/plugins/app/QueryJobDbManager/index.ts index 5a965abf74..6e84ad5e45 100644 --- a/components/webui/server/src/fastify-v2/plugins/app/QueryJobDbManager/index.ts +++ b/components/webui/server/src/plugins/app/QueryJobDbManager/index.ts @@ -6,14 +6,14 @@ import {FastifyInstance} from "fastify"; import fp from "fastify-plugin"; import {ResultSetHeader} from "mysql2"; -import settings from "../../../../../settings.json" with {type: "json"}; +import settings from "../../../../settings.json" with {type: "json"}; import { QUERY_JOB_STATUS, QUERY_JOB_STATUS_WAITING_STATES, QUERY_JOB_TYPE, QUERY_JOBS_TABLE_COLUMN_NAMES, QueryJob, -} from "../../../../typings/query.js"; +} from "../../../typings/query.js"; import {JOB_COMPLETION_STATUS_POLL_INTERVAL_MILLIS} from "./typings.js"; diff --git a/components/webui/server/src/fastify-v2/plugins/app/QueryJobDbManager/typings.ts b/components/webui/server/src/plugins/app/QueryJobDbManager/typings.ts similarity index 100% rename from components/webui/server/src/fastify-v2/plugins/app/QueryJobDbManager/typings.ts rename to components/webui/server/src/plugins/app/QueryJobDbManager/typings.ts diff --git a/components/webui/server/src/fastify-v2/plugins/app/S3Manager/index.ts b/components/webui/server/src/plugins/app/S3Manager/index.ts similarity index 94% rename from components/webui/server/src/fastify-v2/plugins/app/S3Manager/index.ts rename to components/webui/server/src/plugins/app/S3Manager/index.ts index 3f60efadc6..7c1b02a667 100644 --- a/components/webui/server/src/fastify-v2/plugins/app/S3Manager/index.ts +++ b/components/webui/server/src/plugins/app/S3Manager/index.ts @@ -5,8 +5,8 @@ import { import {getSignedUrl} from "@aws-sdk/s3-request-presigner"; import fp from "fastify-plugin"; -import settings from "../../../../../settings.json" with {type: "json"}; -import {Nullable} from "../../../../typings/common.js"; +import settings from "../../../../settings.json" with {type: "json"}; +import {Nullable} from "../../../typings/common.js"; import {PRE_SIGNED_URL_EXPIRY_TIME_SECONDS} from "./typings.js"; diff --git a/components/webui/server/src/fastify-v2/plugins/app/S3Manager/typings.ts b/components/webui/server/src/plugins/app/S3Manager/typings.ts similarity index 100% rename from components/webui/server/src/fastify-v2/plugins/app/S3Manager/typings.ts rename to components/webui/server/src/plugins/app/S3Manager/typings.ts diff --git a/components/webui/server/src/fastify-v2/plugins/app/StreamFileManager.ts b/components/webui/server/src/plugins/app/StreamFileManager.ts similarity index 94% rename from components/webui/server/src/fastify-v2/plugins/app/StreamFileManager.ts rename to components/webui/server/src/plugins/app/StreamFileManager.ts index b70a913e35..203f5bc873 100644 --- a/components/webui/server/src/fastify-v2/plugins/app/StreamFileManager.ts +++ b/components/webui/server/src/plugins/app/StreamFileManager.ts @@ -4,13 +4,13 @@ import { } from "fastify"; import fp from "fastify-plugin"; -import settings from "../../../../settings.json" with {type: "json"}; -import {Nullable} from "../../../typings/common.js"; -import {QUERY_JOB_TYPE} from "../../../typings/query.js"; +import settings from "../../../settings.json" with {type: "json"}; +import {Nullable} from "../../typings/common.js"; +import {QUERY_JOB_TYPE} from "../../typings/query.js"; import { StreamFileMetadata, StreamFilesCollection, -} from "../../../typings/stream-files.js"; +} from "../../typings/stream-files.js"; /** diff --git a/components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/MongoWatcherCollection.ts b/components/webui/server/src/plugins/app/socket/MongoSocketIoServer/MongoWatcherCollection.ts similarity index 99% rename from components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/MongoWatcherCollection.ts rename to components/webui/server/src/plugins/app/socket/MongoSocketIoServer/MongoWatcherCollection.ts index d3f825323d..7cbf6cab68 100644 --- a/components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/MongoWatcherCollection.ts +++ b/components/webui/server/src/plugins/app/socket/MongoSocketIoServer/MongoWatcherCollection.ts @@ -4,7 +4,7 @@ import type { Db, } from "mongodb"; -import {QueryId} from "../../../../../../../common/index.js"; +import {QueryId} from "../../../../../../common/index.js"; import { CLIENT_UPDATE_TIMEOUT_MILLIS, MongoCustomSocket, diff --git a/components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/index.ts b/components/webui/server/src/plugins/app/socket/MongoSocketIoServer/index.ts similarity index 99% rename from components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/index.ts rename to components/webui/server/src/plugins/app/socket/MongoSocketIoServer/index.ts index cd79a52580..8d246c5e13 100644 --- a/components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/index.ts +++ b/components/webui/server/src/plugins/app/socket/MongoSocketIoServer/index.ts @@ -21,7 +21,7 @@ import type { Response, ServerToClientEvents, SocketData, -} from "../../../../../../../common/index.js"; +} from "../../../../../../common/index.js"; import MongoWatcherCollection from "./MongoWatcherCollection.js"; import { ConnectionId, diff --git a/components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/typings.ts b/components/webui/server/src/plugins/app/socket/MongoSocketIoServer/typings.ts similarity index 96% rename from components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/typings.ts rename to components/webui/server/src/plugins/app/socket/MongoSocketIoServer/typings.ts index 13d8635529..d2a3e93162 100644 --- a/components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/typings.ts +++ b/components/webui/server/src/plugins/app/socket/MongoSocketIoServer/typings.ts @@ -11,7 +11,7 @@ import { InterServerEvents, ServerToClientEvents, SocketData, -} from "../../../../../../../common/index.js"; +} from "../../../../../../common/index.js"; /** diff --git a/components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/utils.ts b/components/webui/server/src/plugins/app/socket/MongoSocketIoServer/utils.ts similarity index 100% rename from components/webui/server/src/fastify-v2/plugins/app/socket/MongoSocketIoServer/utils.ts rename to components/webui/server/src/plugins/app/socket/MongoSocketIoServer/utils.ts diff --git a/components/webui/server/src/fastify-v2/plugins/external/env.ts b/components/webui/server/src/plugins/external/env.ts similarity index 100% rename from components/webui/server/src/fastify-v2/plugins/external/env.ts rename to components/webui/server/src/plugins/external/env.ts diff --git a/components/webui/server/src/fastify-v2/plugins/external/mongo.ts b/components/webui/server/src/plugins/external/mongo.ts similarity index 78% rename from components/webui/server/src/fastify-v2/plugins/external/mongo.ts rename to components/webui/server/src/plugins/external/mongo.ts index 22d62355c0..15e16909d3 100644 --- a/components/webui/server/src/fastify-v2/plugins/external/mongo.ts +++ b/components/webui/server/src/plugins/external/mongo.ts @@ -1,6 +1,6 @@ import fastifyMongoDb from "@fastify/mongodb"; -import settings from "../../../../settings.json" with {type: "json"}; +import settings from "../../../settings.json" with {type: "json"}; export const autoConfig = () => { diff --git a/components/webui/server/src/fastify-v2/plugins/external/mysql.ts b/components/webui/server/src/plugins/external/mysql.ts similarity index 90% rename from components/webui/server/src/fastify-v2/plugins/external/mysql.ts rename to components/webui/server/src/plugins/external/mysql.ts index 2484282c43..6720774613 100644 --- a/components/webui/server/src/fastify-v2/plugins/external/mysql.ts +++ b/components/webui/server/src/plugins/external/mysql.ts @@ -4,7 +4,7 @@ import { } from "@fastify/mysql"; import {FastifyInstance} from "fastify"; -import settings from "../../../../settings.json" with {type: "json"}; +import settings from "../../../settings.json" with {type: "json"}; // The typing of `@fastify/mysql` needs to be manually specified. diff --git a/components/webui/server/src/fastify-v2/plugins/external/rateLimit.ts b/components/webui/server/src/plugins/external/rateLimit.ts similarity index 100% rename from components/webui/server/src/fastify-v2/plugins/external/rateLimit.ts rename to components/webui/server/src/plugins/external/rateLimit.ts diff --git a/components/webui/server/src/fastify-v2/plugins/external/sensible.ts b/components/webui/server/src/plugins/external/sensible.ts similarity index 100% rename from components/webui/server/src/fastify-v2/plugins/external/sensible.ts rename to components/webui/server/src/plugins/external/sensible.ts diff --git a/components/webui/server/src/fastify-v2/routes/api/archive-metadata/index.ts b/components/webui/server/src/routes/api/archive-metadata/index.ts similarity index 100% rename from components/webui/server/src/fastify-v2/routes/api/archive-metadata/index.ts rename to components/webui/server/src/routes/api/archive-metadata/index.ts diff --git a/components/webui/server/src/fastify-v2/routes/api/example/index.ts b/components/webui/server/src/routes/api/example/index.ts similarity index 100% rename from components/webui/server/src/fastify-v2/routes/api/example/index.ts rename to components/webui/server/src/routes/api/example/index.ts diff --git a/components/webui/server/src/fastify-v2/routes/api/search/index.ts b/components/webui/server/src/routes/api/search/index.ts similarity index 97% rename from components/webui/server/src/fastify-v2/routes/api/search/index.ts rename to components/webui/server/src/routes/api/search/index.ts index ec90070419..a48f3737cd 100644 --- a/components/webui/server/src/fastify-v2/routes/api/search/index.ts +++ b/components/webui/server/src/routes/api/search/index.ts @@ -7,14 +7,14 @@ import {StatusCodes} from "http-status-codes"; import { SEARCH_SIGNAL, type SearchResultsMetadataDocument, -} from "../../../../../../common/index.js"; -import settings from "../../../../../settings.json" with {type: "json"}; -import {QUERY_JOB_TYPE} from "../../../../typings/query.js"; +} from "../../../../../common/index.js"; +import settings from "../../../../settings.json" with {type: "json"}; import {ErrorSchema} from "../../../schemas/error.js"; import { QueryJobCreationSchema, QueryJobSchema, } from "../../../schemas/search.js"; +import {QUERY_JOB_TYPE} from "../../../typings/query.js"; import {SEARCH_MAX_NUM_RESULTS} from "./typings.js"; import { createMongoIndexes, diff --git a/components/webui/server/src/fastify-v2/routes/api/search/typings.ts b/components/webui/server/src/routes/api/search/typings.ts similarity index 96% rename from components/webui/server/src/fastify-v2/routes/api/search/typings.ts rename to components/webui/server/src/routes/api/search/typings.ts index 00878722d8..353a8a9270 100644 --- a/components/webui/server/src/fastify-v2/routes/api/search/typings.ts +++ b/components/webui/server/src/routes/api/search/typings.ts @@ -10,7 +10,7 @@ import type { import { SEARCH_SIGNAL, type SearchResultsMetadataDocument, -} from "../../../../../../common/index.js"; +} from "../../../../../common/index.js"; /** diff --git a/components/webui/server/src/fastify-v2/routes/api/search/utils.ts b/components/webui/server/src/routes/api/search/utils.ts similarity index 98% rename from components/webui/server/src/fastify-v2/routes/api/search/utils.ts rename to components/webui/server/src/routes/api/search/utils.ts index 60e4ff339c..88b19b4035 100644 --- a/components/webui/server/src/fastify-v2/routes/api/search/utils.ts +++ b/components/webui/server/src/routes/api/search/utils.ts @@ -1,6 +1,6 @@ import type {Db} from "mongodb"; -import {SEARCH_SIGNAL} from "../../../../../../common/index.js"; +import {SEARCH_SIGNAL} from "../../../../../common/index.js"; import { CreateMongoIndexesProps, SEARCH_MAX_NUM_RESULTS, diff --git a/components/webui/server/src/fastify-v2/routes/api/stream-files/index.ts b/components/webui/server/src/routes/api/stream-files/index.ts similarity index 92% rename from components/webui/server/src/fastify-v2/routes/api/stream-files/index.ts rename to components/webui/server/src/routes/api/stream-files/index.ts index 83a8d817a5..599b5609f1 100644 --- a/components/webui/server/src/fastify-v2/routes/api/stream-files/index.ts +++ b/components/webui/server/src/routes/api/stream-files/index.ts @@ -1,11 +1,11 @@ import {FastifyPluginAsyncTypebox} from "@fastify/type-provider-typebox"; import {StatusCodes} from "http-status-codes"; -import settings from "../../../../../settings.json" with {type: "json"}; -import {EXTRACT_JOB_TYPES} from "../../../../typings/query.js"; -import {StreamFileMetadataSchema} from "../../../../typings/stream-files.js"; +import settings from "../../../../settings.json" with {type: "json"}; import {ErrorSchema} from "../../../schemas/error.js"; import {StreamFileExtractionSchema} from "../../../schemas/stream-files.js"; +import {EXTRACT_JOB_TYPES} from "../../../typings/query.js"; +import {StreamFileMetadataSchema} from "../../../typings/stream-files.js"; /** diff --git a/components/webui/server/src/routes/static.ts b/components/webui/server/src/routes/static.ts index 03a7ea303c..451da313c4 100644 --- a/components/webui/server/src/routes/static.ts +++ b/components/webui/server/src/routes/static.ts @@ -1,5 +1,4 @@ import path from "node:path"; -import process from "node:process"; import {fileURLToPath} from "node:url"; import {fastifyStatic} from "@fastify/static"; @@ -38,26 +37,22 @@ const routes: FastifyPluginAsync = async (fastify) => { decorateReply: false, }); - if ("production" === process.env.NODE_ENV) { - // In the development environment, we expect the client to use a separate webserver that - // supports live reloading. - let clientDir = settings.ClientDir; - if (false === path.isAbsolute(clientDir)) { - clientDir = path.resolve(rootDirname, settings.ClientDir); - } - - await fastify.register(fastifyStatic, { - prefix: "/", - root: clientDir, - decorateReply: true, - wildcard: false, - }); - - // Serve index.html for all unmatched routes in the React Single Page Application (SPA). - fastify.get("/*", (_, reply) => { - reply.sendFile("index.html"); - }); + let clientDir = settings.ClientDir; + if (false === path.isAbsolute(clientDir)) { + clientDir = path.resolve(rootDirname, settings.ClientDir); } + + await fastify.register(fastifyStatic, { + prefix: "/", + root: clientDir, + decorateReply: true, + wildcard: false, + }); + + // Serve index.html for all unmatched routes in the React Single Page Application (SPA). + fastify.get("/*", (_, reply) => { + reply.sendFile("index.html"); + }); }; export default routes; diff --git a/components/webui/server/src/fastify-v2/schemas/archive-metadata.ts b/components/webui/server/src/schemas/archive-metadata.ts similarity index 100% rename from components/webui/server/src/fastify-v2/schemas/archive-metadata.ts rename to components/webui/server/src/schemas/archive-metadata.ts diff --git a/components/webui/server/src/fastify-v2/schemas/common.ts b/components/webui/server/src/schemas/common.ts similarity index 100% rename from components/webui/server/src/fastify-v2/schemas/common.ts rename to components/webui/server/src/schemas/common.ts diff --git a/components/webui/server/src/fastify-v2/schemas/error.ts b/components/webui/server/src/schemas/error.ts similarity index 100% rename from components/webui/server/src/fastify-v2/schemas/error.ts rename to components/webui/server/src/schemas/error.ts diff --git a/components/webui/server/src/fastify-v2/schemas/search.ts b/components/webui/server/src/schemas/search.ts similarity index 100% rename from components/webui/server/src/fastify-v2/schemas/search.ts rename to components/webui/server/src/schemas/search.ts diff --git a/components/webui/server/src/fastify-v2/schemas/stream-files.ts b/components/webui/server/src/schemas/stream-files.ts similarity index 91% rename from components/webui/server/src/fastify-v2/schemas/stream-files.ts rename to components/webui/server/src/schemas/stream-files.ts index a64a0a5aa1..bf0c3d3edb 100644 --- a/components/webui/server/src/fastify-v2/schemas/stream-files.ts +++ b/components/webui/server/src/schemas/stream-files.ts @@ -1,6 +1,6 @@ import {Type} from "@sinclair/typebox"; -import {QUERY_JOB_TYPE} from "../../typings/query.js"; +import {QUERY_JOB_TYPE} from "../typings/query.js"; import {StringSchema} from "./common.js"; diff --git a/components/webui/server/src/test/example.test.ts b/components/webui/server/src/test/example.test.ts index bdbaa9e814..59bb68b827 100644 --- a/components/webui/server/src/test/example.test.ts +++ b/components/webui/server/src/test/example.test.ts @@ -2,7 +2,7 @@ import fastify from "fastify"; import {StatusCodes} from "http-status-codes"; import tap, {Test} from "tap"; -import routes from "../fastify-v2/routes/api/example/index.js"; +import routes from "../routes/api/example/index.js"; tap.test("Tests the example routes", async (t: Test) => { diff --git a/components/webui/server/src/test/tap.ts b/components/webui/server/src/test/tap.ts index c58be41513..445f447e86 100644 --- a/components/webui/server/src/test/tap.ts +++ b/components/webui/server/src/test/tap.ts @@ -7,9 +7,6 @@ import {build as buildApplication} from "fastify-cli/helper.js"; import type {Test} from "tap"; -// eslint-disable-next-line no-warning-comments -// TODO: Setup testing for new webui fastify app in `fastify-v2/app.ts`. Testing will need -// to be split into unit tests and integration tests (require clp package running). const appPath = path.join(import.meta.dirname, "../app.ts"); /**