diff --git a/api.planx.uk/.eslintrc b/api.planx.uk/.eslintrc index b1869d8a06..032ba47f0a 100644 --- a/api.planx.uk/.eslintrc +++ b/api.planx.uk/.eslintrc @@ -18,6 +18,7 @@ } ], "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/consistent-type-imports": "error", "no-nested-ternary": "error", "@vitest/expect-expect": [ "error", diff --git a/api.planx.uk/docs/index.ts b/api.planx.uk/docs/index.ts index 734fb58606..7261fac081 100644 --- a/api.planx.uk/docs/index.ts +++ b/api.planx.uk/docs/index.ts @@ -1,4 +1,4 @@ -import { Express } from "express"; +import type { Express } from "express"; import swaggerJSDoc from "swagger-jsdoc"; import swaggerUi from "swagger-ui-express"; diff --git a/api.planx.uk/helpers.ts b/api.planx.uk/helpers.ts index 75276f782a..22af164e16 100644 --- a/api.planx.uk/helpers.ts +++ b/api.planx.uk/helpers.ts @@ -1,7 +1,8 @@ import { gql } from "graphql-request"; import capitalize from "lodash/capitalize.js"; -import { Flow, Node } from "./types.js"; -import { ComponentType, FlowGraph } from "@opensystemslab/planx-core/types"; +import type { Flow, Node } from "./types.js"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; +import { ComponentType } from "@opensystemslab/planx-core/types"; import { $public, getClient } from "./client/index.js"; export interface FlowData { diff --git a/api.planx.uk/lib/hasura/metadata/index.test.ts b/api.planx.uk/lib/hasura/metadata/index.test.ts index c6b9d5c547..e30ade3edc 100644 --- a/api.planx.uk/lib/hasura/metadata/index.test.ts +++ b/api.planx.uk/lib/hasura/metadata/index.test.ts @@ -1,10 +1,11 @@ -import { createScheduledEvent, RequiredScheduledEventArgs } from "./index.js"; +import type { RequiredScheduledEventArgs } from "./index.js"; +import { createScheduledEvent } from "./index.js"; import axios from "axios"; import type { Mocked } from "vitest"; describe("Creation of scheduled event", () => { vi.mock("axios", async (importOriginal) => { - const actualAxios = await importOriginal(); + const actualAxios = await importOriginal(); return { default: { ...actualAxios, diff --git a/api.planx.uk/lib/hasura/metadata/index.ts b/api.planx.uk/lib/hasura/metadata/index.ts index 7dc74bdd94..a14f4469da 100644 --- a/api.planx.uk/lib/hasura/metadata/index.ts +++ b/api.planx.uk/lib/hasura/metadata/index.ts @@ -1,4 +1,5 @@ -import Axios, { AxiosResponse, isAxiosError } from "axios"; +import type { AxiosResponse } from "axios"; +import axios, { isAxiosError } from "axios"; /** * Body posted to Hasura Metadata API to create a scheduled event @@ -46,7 +47,7 @@ const postToMetadataAPI = async ( body: ScheduledEvent, ): Promise> => { try { - return await Axios.post( + return await axios.post( process.env.HASURA_METADATA_URL!, JSON.stringify(body), { diff --git a/api.planx.uk/lib/hasura/schema/index.test.ts b/api.planx.uk/lib/hasura/schema/index.test.ts index cd008ce579..c84c6c6029 100644 --- a/api.planx.uk/lib/hasura/schema/index.test.ts +++ b/api.planx.uk/lib/hasura/schema/index.test.ts @@ -4,7 +4,7 @@ import type { Mocked } from "vitest"; describe("runSQL", () => { vi.mock("axios", async (importOriginal) => { - const actualAxios = await importOriginal(); + const actualAxios = await importOriginal(); return { default: { ...actualAxios, diff --git a/api.planx.uk/lib/hasura/schema/index.ts b/api.planx.uk/lib/hasura/schema/index.ts index 15f2052aca..9a1ca3fec2 100644 --- a/api.planx.uk/lib/hasura/schema/index.ts +++ b/api.planx.uk/lib/hasura/schema/index.ts @@ -1,4 +1,5 @@ -import Axios, { AxiosResponse, isAxiosError } from "axios"; +import type { AxiosResponse } from "axios"; +import axios, { isAxiosError } from "axios"; export interface RunSQLArgs { source: "default"; @@ -18,7 +19,7 @@ const postToSchemaAPI = async ( query: SchemaAPIQuery, ): Promise> => { try { - return await Axios.post( + return await axios.post( process.env.HASURA_SCHEMA_URL!, JSON.stringify(query), { diff --git a/api.planx.uk/lib/notify/index.test.ts b/api.planx.uk/lib/notify/index.test.ts index 22a926b60d..7f54fec643 100644 --- a/api.planx.uk/lib/notify/index.test.ts +++ b/api.planx.uk/lib/notify/index.test.ts @@ -1,6 +1,6 @@ import { sendEmail } from "./index.js"; import { NotifyClient } from "notifications-node-client"; -import { NotifyConfig } from "../../types.js"; +import type { NotifyConfig } from "../../types.js"; vi.mock("notifications-node-client"); diff --git a/api.planx.uk/lib/notify/index.ts b/api.planx.uk/lib/notify/index.ts index 1bbf95443a..064fe444bf 100644 --- a/api.planx.uk/lib/notify/index.ts +++ b/api.planx.uk/lib/notify/index.ts @@ -1,6 +1,6 @@ import { NotifyClient } from "notifications-node-client"; import { softDeleteSession } from "../../modules/saveAndReturn/service/utils.js"; -import { NotifyConfig } from "../../types.js"; +import type { NotifyConfig } from "../../types.js"; import { $api, $public } from "../../client/index.js"; const notifyClient = new NotifyClient(process.env.GOVUK_NOTIFY_API_KEY); diff --git a/api.planx.uk/modules/admin/session/csv.ts b/api.planx.uk/modules/admin/session/csv.ts index dad369a0a2..43e1560577 100644 --- a/api.planx.uk/modules/admin/session/csv.ts +++ b/api.planx.uk/modules/admin/session/csv.ts @@ -1,5 +1,5 @@ import { stringify } from "csv-stringify"; -import { NextFunction, Request, Response } from "express"; +import type { NextFunction, Request, Response } from "express"; import { $api } from "../../../client/index.js"; /** diff --git a/api.planx.uk/modules/admin/session/digitalPlanningData.ts b/api.planx.uk/modules/admin/session/digitalPlanningData.ts index 4e42b12dd0..0a125ff8be 100644 --- a/api.planx.uk/modules/admin/session/digitalPlanningData.ts +++ b/api.planx.uk/modules/admin/session/digitalPlanningData.ts @@ -1,4 +1,4 @@ -import { NextFunction, Request, Response } from "express"; +import type { NextFunction, Request, Response } from "express"; import { $api } from "../../../client/index.js"; /** diff --git a/api.planx.uk/modules/admin/session/oneAppXML.ts b/api.planx.uk/modules/admin/session/oneAppXML.ts index a90f4d1cde..a06129fb3c 100644 --- a/api.planx.uk/modules/admin/session/oneAppXML.ts +++ b/api.planx.uk/modules/admin/session/oneAppXML.ts @@ -1,4 +1,4 @@ -import { Request, Response, NextFunction } from "express"; +import type { Request, Response, NextFunction } from "express"; import { $api } from "../../../client/index.js"; /** diff --git a/api.planx.uk/modules/admin/session/summary.ts b/api.planx.uk/modules/admin/session/summary.ts index 1f6634f8dc..8bf758c593 100644 --- a/api.planx.uk/modules/admin/session/summary.ts +++ b/api.planx.uk/modules/admin/session/summary.ts @@ -1,13 +1,18 @@ -import { +import type { GovUKPayment, PaymentRequest, Session, Team, } from "@opensystemslab/planx-core/types"; -import { NextFunction, Request, Response } from "express"; +import type { NextFunction, Request, Response } from "express"; import { gql } from "graphql-request"; -import { Breadcrumb, Flow, LowCalSession, Passport } from "../../../types.js"; +import type { + Breadcrumb, + Flow, + LowCalSession, + Passport, +} from "../../../types.js"; import { $api } from "../../../client/index.js"; /** diff --git a/api.planx.uk/modules/admin/session/zip.ts b/api.planx.uk/modules/admin/session/zip.ts index 53ac5791f3..661b218319 100644 --- a/api.planx.uk/modules/admin/session/zip.ts +++ b/api.planx.uk/modules/admin/session/zip.ts @@ -1,4 +1,4 @@ -import { NextFunction, Request, Response } from "express"; +import type { NextFunction, Request, Response } from "express"; import { buildSubmissionExportZip } from "../../send/utils/exportZip.js"; /** diff --git a/api.planx.uk/modules/analytics/controller.ts b/api.planx.uk/modules/analytics/controller.ts index c4dfbf2ac3..5c46bfbc8b 100644 --- a/api.planx.uk/modules/analytics/controller.ts +++ b/api.planx.uk/modules/analytics/controller.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import { trackAnalyticsLogExit } from "./service.js"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; export const logAnalyticsSchema = z.object({ query: z.object({ diff --git a/api.planx.uk/modules/auth/controller.ts b/api.planx.uk/modules/auth/controller.ts index 383c954a47..b1b5394193 100644 --- a/api.planx.uk/modules/auth/controller.ts +++ b/api.planx.uk/modules/auth/controller.ts @@ -1,5 +1,5 @@ -import { CookieOptions, RequestHandler, Response } from "express"; -import { Request } from "express-jwt"; +import type { CookieOptions, RequestHandler, Response } from "express"; +import type { Request } from "express-jwt"; export const failedLogin: RequestHandler = (_req, _res, next) => next({ diff --git a/api.planx.uk/modules/auth/middleware.ts b/api.planx.uk/modules/auth/middleware.ts index 85457f0bf6..ef0335ff68 100644 --- a/api.planx.uk/modules/auth/middleware.ts +++ b/api.planx.uk/modules/auth/middleware.ts @@ -1,14 +1,14 @@ import crypto from "crypto"; import assert from "assert"; import { ServerError } from "../../errors/index.js"; -import { Template } from "../../lib/notify/index.js"; +import type { Template } from "../../lib/notify/index.js"; import { expressjwt } from "express-jwt"; import { generators } from "openid-client"; -import { Authenticator } from "passport"; -import { RequestHandler } from "http-proxy-middleware"; -import { Role } from "@opensystemslab/planx-core/types"; +import type { Authenticator } from "passport"; +import type { RequestHandler } from "http-proxy-middleware"; +import type { Role } from "@opensystemslab/planx-core/types"; import { AsyncLocalStorage } from "async_hooks"; -import { Request } from "express"; +import type { Request } from "express"; export const userContext = new AsyncLocalStorage<{ user: Express.User }>(); diff --git a/api.planx.uk/modules/auth/passport.ts b/api.planx.uk/modules/auth/passport.ts index b354c94fc3..c7212765a9 100644 --- a/api.planx.uk/modules/auth/passport.ts +++ b/api.planx.uk/modules/auth/passport.ts @@ -1,5 +1,6 @@ import { Issuer } from "openid-client"; -import passport, { type Authenticator } from "passport"; +import type { Authenticator } from "passport"; +import passport from "passport"; import { googleStrategy } from "./strategy/google.js"; import { diff --git a/api.planx.uk/modules/auth/service.ts b/api.planx.uk/modules/auth/service.ts index 195b2df140..7e7ef1db6c 100644 --- a/api.planx.uk/modules/auth/service.ts +++ b/api.planx.uk/modules/auth/service.ts @@ -1,6 +1,6 @@ import jwt from "jsonwebtoken"; import { $api } from "../../client/index.js"; -import { User, Role } from "@opensystemslab/planx-core/types"; +import type { User, Role } from "@opensystemslab/planx-core/types"; export const buildJWT = async (email: string): Promise => { await checkUserCanAccessEnv(email, process.env.NODE_ENV); diff --git a/api.planx.uk/modules/file/controller.ts b/api.planx.uk/modules/file/controller.ts index 52a87eda76..480c8b5c67 100644 --- a/api.planx.uk/modules/file/controller.ts +++ b/api.planx.uk/modules/file/controller.ts @@ -3,7 +3,7 @@ import { uploadPrivateFile, uploadPublicFile } from "./service/uploadFile.js"; import { buildFilePath } from "./service/utils.js"; import { getFileFromS3 } from "./service/getFile.js"; import { z } from "zod"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; import { ServerError } from "../../errors/index.js"; assert(process.env.AWS_S3_BUCKET); diff --git a/api.planx.uk/modules/file/file.test.ts b/api.planx.uk/modules/file/file.test.ts index e824a32006..165248b2c0 100644 --- a/api.planx.uk/modules/file/file.test.ts +++ b/api.planx.uk/modules/file/file.test.ts @@ -1,5 +1,5 @@ import supertest from "supertest"; -import { Mocked } from "vitest"; +import type { Mocked } from "vitest"; import app from "../../server.js"; import { deleteFilesByURL } from "./service/deleteFile.js"; diff --git a/api.planx.uk/modules/file/service/deleteFile.ts b/api.planx.uk/modules/file/service/deleteFile.ts index 13b9622d4d..e8b8f7e0b4 100644 --- a/api.planx.uk/modules/file/service/deleteFile.ts +++ b/api.planx.uk/modules/file/service/deleteFile.ts @@ -1,4 +1,4 @@ -import { DeleteObjectsRequest } from "aws-sdk/clients/s3.js"; +import type { DeleteObjectsRequest } from "aws-sdk/clients/s3.js"; import { getS3KeyFromURL, s3Factory } from "./utils.js"; export const deleteFilesByURL = async ( diff --git a/api.planx.uk/modules/file/service/getFile.ts b/api.planx.uk/modules/file/service/getFile.ts index bf71940168..400c5151ca 100644 --- a/api.planx.uk/modules/file/service/getFile.ts +++ b/api.planx.uk/modules/file/service/getFile.ts @@ -1,4 +1,4 @@ -import S3 from "aws-sdk/clients/s3.js"; +import type S3 from "aws-sdk/clients/s3.js"; import { s3Factory } from "./utils.js"; export const getFileFromS3 = async (fileId: string) => { diff --git a/api.planx.uk/modules/file/service/uploadFile.ts b/api.planx.uk/modules/file/service/uploadFile.ts index 2c1979b55a..0ae471af8b 100644 --- a/api.planx.uk/modules/file/service/uploadFile.ts +++ b/api.planx.uk/modules/file/service/uploadFile.ts @@ -1,4 +1,4 @@ -import S3 from "aws-sdk/clients/s3.js"; +import type S3 from "aws-sdk/clients/s3.js"; import { customAlphabet } from "nanoid"; import mime from "mime"; import { s3Factory } from "./utils.js"; diff --git a/api.planx.uk/modules/flows/copyFlow/controller.ts b/api.planx.uk/modules/flows/copyFlow/controller.ts index 21ede22e00..5df5bd91ad 100644 --- a/api.planx.uk/modules/flows/copyFlow/controller.ts +++ b/api.planx.uk/modules/flows/copyFlow/controller.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; -import { Flow } from "../../../types.js"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { Flow } from "../../../types.js"; import { ServerError } from "../../../errors/index.js"; import { copyFlow } from "./service.js"; diff --git a/api.planx.uk/modules/flows/copyFlow/copyFlow.test.ts b/api.planx.uk/modules/flows/copyFlow/copyFlow.test.ts index 9036eb18d5..1afaf5d9eb 100644 --- a/api.planx.uk/modules/flows/copyFlow/copyFlow.test.ts +++ b/api.planx.uk/modules/flows/copyFlow/copyFlow.test.ts @@ -3,7 +3,7 @@ import supertest from "supertest"; import { queryMock } from "../../../tests/graphqlQueryMock.js"; import { authHeader } from "../../../tests/mockJWT.js"; import app from "../../../server.js"; -import { Flow } from "../../../types.js"; +import type { Flow } from "../../../types.js"; import { userContext } from "../../auth/middleware.js"; beforeEach(() => { diff --git a/api.planx.uk/modules/flows/copyFlowAsPortal/controller.ts b/api.planx.uk/modules/flows/copyFlowAsPortal/controller.ts index e6d8bfb780..833774a390 100644 --- a/api.planx.uk/modules/flows/copyFlowAsPortal/controller.ts +++ b/api.planx.uk/modules/flows/copyFlowAsPortal/controller.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { Flow } from "../../../types.js"; -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { Flow } from "../../../types.js"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; import { copyPortalAsFlow } from "./service.js"; import { ServerError } from "../../../errors/index.js"; diff --git a/api.planx.uk/modules/flows/copyFlowAsPortal/copyPortalAsFlow.test.ts b/api.planx.uk/modules/flows/copyFlowAsPortal/copyPortalAsFlow.test.ts index 468d29d93b..fb19e3e1a5 100644 --- a/api.planx.uk/modules/flows/copyFlowAsPortal/copyPortalAsFlow.test.ts +++ b/api.planx.uk/modules/flows/copyFlowAsPortal/copyPortalAsFlow.test.ts @@ -3,7 +3,7 @@ import supertest from "supertest"; import { queryMock } from "../../../tests/graphqlQueryMock.js"; import { authHeader } from "../../../tests/mockJWT.js"; import app from "../../../server.js"; -import { Flow } from "../../../types.js"; +import type { Flow } from "../../../types.js"; beforeEach(() => { queryMock.mockQuery({ diff --git a/api.planx.uk/modules/flows/copyFlowAsPortal/service.ts b/api.planx.uk/modules/flows/copyFlowAsPortal/service.ts index 20b4c73633..348e4a6141 100644 --- a/api.planx.uk/modules/flows/copyFlowAsPortal/service.ts +++ b/api.planx.uk/modules/flows/copyFlowAsPortal/service.ts @@ -1,5 +1,5 @@ import { getFlowData, getChildren, makeUniqueFlow } from "../../../helpers.js"; -import { Flow } from "../../../types.js"; +import type { Flow } from "../../../types.js"; /** * Copies an internal portal and transforms it to be an independent flow diff --git a/api.planx.uk/modules/flows/downloadSchema/controller.ts b/api.planx.uk/modules/flows/downloadSchema/controller.ts index 4f6664d7c8..7d00a50ee9 100644 --- a/api.planx.uk/modules/flows/downloadSchema/controller.ts +++ b/api.planx.uk/modules/flows/downloadSchema/controller.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; import { stringify } from "csv-stringify"; import { getFlowSchema } from "./service.js"; import { ServerError } from "../../../errors/index.js"; diff --git a/api.planx.uk/modules/flows/findReplace/controller.ts b/api.planx.uk/modules/flows/findReplace/controller.ts index ebdca7275c..b14139d4b0 100644 --- a/api.planx.uk/modules/flows/findReplace/controller.ts +++ b/api.planx.uk/modules/flows/findReplace/controller.ts @@ -1,9 +1,9 @@ -import { Flow } from "../../../types.js"; -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { Flow } from "../../../types.js"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; import { z } from "zod"; import { ServerError } from "../../../errors/index.js"; import { findAndReplaceInFlow } from "./service.js"; -import { FlowGraph } from "@opensystemslab/planx-core/types"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; interface FindAndReplaceResponse { message: string; diff --git a/api.planx.uk/modules/flows/findReplace/findReplace.test.ts b/api.planx.uk/modules/flows/findReplace/findReplace.test.ts index 7f7e799853..23254c35e8 100644 --- a/api.planx.uk/modules/flows/findReplace/findReplace.test.ts +++ b/api.planx.uk/modules/flows/findReplace/findReplace.test.ts @@ -3,7 +3,7 @@ import supertest from "supertest"; import { queryMock } from "../../../tests/graphqlQueryMock.js"; import { authHeader } from "../../../tests/mockJWT.js"; import app from "../../../server.js"; -import { Flow } from "../../../types.js"; +import type { Flow } from "../../../types.js"; const auth = authHeader({ role: "platformAdmin" }); diff --git a/api.planx.uk/modules/flows/findReplace/service.ts b/api.planx.uk/modules/flows/findReplace/service.ts index 69102abe98..4d18c5cb3e 100644 --- a/api.planx.uk/modules/flows/findReplace/service.ts +++ b/api.planx.uk/modules/flows/findReplace/service.ts @@ -1,8 +1,8 @@ import { gql } from "graphql-request"; import { getFlowData } from "../../../helpers.js"; import { $api } from "../../../client/index.js"; -import { FlowGraph } from "@opensystemslab/planx-core/types"; -import { Flow } from "../../../types.js"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; +import type { Flow } from "../../../types.js"; interface MatchResult { matches: Flow["data"]; diff --git a/api.planx.uk/modules/flows/flattenFlow/controller.ts b/api.planx.uk/modules/flows/flattenFlow/controller.ts index 0d22b727fa..8c2c436a7e 100644 --- a/api.planx.uk/modules/flows/flattenFlow/controller.ts +++ b/api.planx.uk/modules/flows/flattenFlow/controller.ts @@ -1,7 +1,7 @@ -import { FlowGraph } from "@opensystemslab/planx-core/types"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; import { z } from "zod"; import { ServerError } from "../../../errors/index.js"; -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; import { dataMerged } from "../../../helpers.js"; type FlattenFlowDataResponse = FlowGraph; diff --git a/api.planx.uk/modules/flows/moveFlow/controller.ts b/api.planx.uk/modules/flows/moveFlow/controller.ts index 49400faa1a..64128e221a 100644 --- a/api.planx.uk/modules/flows/moveFlow/controller.ts +++ b/api.planx.uk/modules/flows/moveFlow/controller.ts @@ -1,4 +1,4 @@ -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; import { z } from "zod"; import { ServerError } from "../../../errors/index.js"; import { moveFlow } from "./service.js"; diff --git a/api.planx.uk/modules/flows/moveFlow/service.ts b/api.planx.uk/modules/flows/moveFlow/service.ts index 69cc461c71..4a18bceb49 100644 --- a/api.planx.uk/modules/flows/moveFlow/service.ts +++ b/api.planx.uk/modules/flows/moveFlow/service.ts @@ -1,7 +1,7 @@ import { gql } from "graphql-request"; -import { Flow } from "../../../types.js"; +import type { Flow } from "../../../types.js"; import { getClient } from "../../../client/index.js"; -import { Team } from "@opensystemslab/planx-core/types"; +import type { Team } from "@opensystemslab/planx-core/types"; export const moveFlow = async (flowId: string, teamSlug: string) => { const $client = getClient(); diff --git a/api.planx.uk/modules/flows/publish/controller.ts b/api.planx.uk/modules/flows/publish/controller.ts index 42675d09e7..4e5895f7ab 100644 --- a/api.planx.uk/modules/flows/publish/controller.ts +++ b/api.planx.uk/modules/flows/publish/controller.ts @@ -1,5 +1,5 @@ -import { Node } from "@opensystemslab/planx-core/types"; -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { Node } from "@opensystemslab/planx-core/types"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; import { z } from "zod"; import { publishFlow } from "./service.js"; import { ServerError } from "../../../errors/index.js"; diff --git a/api.planx.uk/modules/flows/publish/service.ts b/api.planx.uk/modules/flows/publish/service.ts index 6ffa007ee7..d1e440f6f1 100644 --- a/api.planx.uk/modules/flows/publish/service.ts +++ b/api.planx.uk/modules/flows/publish/service.ts @@ -1,7 +1,7 @@ import * as jsondiffpatch from "jsondiffpatch"; import { dataMerged, getMostRecentPublishedFlow } from "../../../helpers.js"; import { gql } from "graphql-request"; -import { FlowGraph, Node } from "@opensystemslab/planx-core/types"; +import type { FlowGraph, Node } from "@opensystemslab/planx-core/types"; import { userContext } from "../../auth/middleware.js"; import { getClient } from "../../../client/index.js"; diff --git a/api.planx.uk/modules/flows/validate/controller.ts b/api.planx.uk/modules/flows/validate/controller.ts index 109792e4f5..57c90d3849 100644 --- a/api.planx.uk/modules/flows/validate/controller.ts +++ b/api.planx.uk/modules/flows/validate/controller.ts @@ -1,5 +1,5 @@ -import { Node } from "@opensystemslab/planx-core/types"; -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { Node } from "@opensystemslab/planx-core/types"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; import { z } from "zod"; import { validateAndDiffFlow } from "./service/index.js"; import { ServerError } from "../../../errors/index.js"; diff --git a/api.planx.uk/modules/flows/validate/helpers.ts b/api.planx.uk/modules/flows/validate/helpers.ts index 1f50262e81..577949bbb2 100644 --- a/api.planx.uk/modules/flows/validate/helpers.ts +++ b/api.planx.uk/modules/flows/validate/helpers.ts @@ -1,9 +1,9 @@ -import { +import type { ComponentType, FlowGraph, Node, } from "@opensystemslab/planx-core/types"; -import { Entry } from "type-fest"; +import type { Entry } from "type-fest"; export const isComponentType = ( entry: Entry, diff --git a/api.planx.uk/modules/flows/validate/service/fileTypes.ts b/api.planx.uk/modules/flows/validate/service/fileTypes.ts index 7050ca31ec..fb2254f169 100644 --- a/api.planx.uk/modules/flows/validate/service/fileTypes.ts +++ b/api.planx.uk/modules/flows/validate/service/fileTypes.ts @@ -1,13 +1,10 @@ import { getValidSchemaValues } from "@opensystemslab/planx-core"; -import { - ComponentType, - FlowGraph, - Node, -} from "@opensystemslab/planx-core/types"; +import type { FlowGraph, Node } from "@opensystemslab/planx-core/types"; +import { ComponentType } from "@opensystemslab/planx-core/types"; import countBy from "lodash/countBy.js"; import { isComponentType } from "../helpers.js"; -import { FlowValidationResponse } from "./index.js"; +import type { FlowValidationResponse } from "./index.js"; const validateFileTypes = (flowGraph: FlowGraph): FlowValidationResponse => { // Get all passport variables set by FileUpload and/or FileUploadAndLabel diff --git a/api.planx.uk/modules/flows/validate/service/index.ts b/api.planx.uk/modules/flows/validate/service/index.ts index ea40034406..85710b307c 100644 --- a/api.planx.uk/modules/flows/validate/service/index.ts +++ b/api.planx.uk/modules/flows/validate/service/index.ts @@ -1,4 +1,8 @@ -import { ComponentType, Edges, Node } from "@opensystemslab/planx-core/types"; +import type { + ComponentType, + Edges, + Node, +} from "@opensystemslab/planx-core/types"; import * as jsondiffpatch from "jsondiffpatch"; import { dataMerged, getMostRecentPublishedFlow } from "../../../../helpers.js"; diff --git a/api.planx.uk/modules/flows/validate/service/inviteToPay.ts b/api.planx.uk/modules/flows/validate/service/inviteToPay.ts index 6e85161978..2d053c71f9 100644 --- a/api.planx.uk/modules/flows/validate/service/inviteToPay.ts +++ b/api.planx.uk/modules/flows/validate/service/inviteToPay.ts @@ -1,11 +1,12 @@ -import { ComponentType, FlowGraph } from "@opensystemslab/planx-core/types"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; +import { ComponentType } from "@opensystemslab/planx-core/types"; import { hasComponentType, isComponentType, numberOfComponentType, } from "../helpers.js"; -import { FlowValidationResponse } from "./index.js"; +import type { FlowValidationResponse } from "./index.js"; const validateInviteToPay = (flowGraph: FlowGraph): FlowValidationResponse => { if (inviteToPayEnabled(flowGraph)) { diff --git a/api.planx.uk/modules/flows/validate/service/projectTypes.ts b/api.planx.uk/modules/flows/validate/service/projectTypes.ts index bd6ea4b9ef..240165fd0f 100644 --- a/api.planx.uk/modules/flows/validate/service/projectTypes.ts +++ b/api.planx.uk/modules/flows/validate/service/projectTypes.ts @@ -1,9 +1,10 @@ import { getValidSchemaValues } from "@opensystemslab/planx-core"; -import { ComponentType, FlowGraph } from "@opensystemslab/planx-core/types"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; +import { ComponentType } from "@opensystemslab/planx-core/types"; import countBy from "lodash/countBy.js"; import { isComponentType } from "../helpers.js"; -import { FlowValidationResponse } from "./index.js"; +import type { FlowValidationResponse } from "./index.js"; const validateProjectTypes = (flowGraph: FlowGraph): FlowValidationResponse => { // Get all passport values set by Answers of Checklists that set fn "proposal.projectType" diff --git a/api.planx.uk/modules/flows/validate/service/sections.ts b/api.planx.uk/modules/flows/validate/service/sections.ts index e28b67e6ca..30a9228d23 100644 --- a/api.planx.uk/modules/flows/validate/service/sections.ts +++ b/api.planx.uk/modules/flows/validate/service/sections.ts @@ -1,8 +1,9 @@ -import { ComponentType, FlowGraph } from "@opensystemslab/planx-core/types"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; +import { ComponentType } from "@opensystemslab/planx-core/types"; import intersection from "lodash/intersection.js"; import { isComponentType } from "../helpers.js"; -import { FlowValidationResponse } from "./index.js"; +import type { FlowValidationResponse } from "./index.js"; const validateSections = (flowGraph: FlowGraph): FlowValidationResponse => { if (getSectionNodeIds(flowGraph)?.length > 0) { diff --git a/api.planx.uk/modules/flows/validate/validate.test.ts b/api.planx.uk/modules/flows/validate/validate.test.ts index 818610ceb0..302b50fd14 100644 --- a/api.planx.uk/modules/flows/validate/validate.test.ts +++ b/api.planx.uk/modules/flows/validate/validate.test.ts @@ -5,7 +5,7 @@ import { authHeader, getJWT } from "../../../tests/mockJWT.js"; import app from "../../../server.js"; import { flowWithInviteToPay } from "../../../tests/mocks/inviteToPayData.js"; import { userContext } from "../../auth/middleware.js"; -import { FlowGraph } from "@opensystemslab/planx-core/types"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; import { mockFlowData } from "../../../tests/mocks/validateAndPublishMocks.js"; beforeAll(() => { diff --git a/api.planx.uk/modules/gis/service/article4Schema.ts b/api.planx.uk/modules/gis/service/article4Schema.ts index b18c5d5d16..a723be2f57 100644 --- a/api.planx.uk/modules/gis/service/article4Schema.ts +++ b/api.planx.uk/modules/gis/service/article4Schema.ts @@ -1,4 +1,4 @@ -import { NextFunction, Request, Response } from "express"; +import type { NextFunction, Request, Response } from "express"; import { localAuthorityMetadata } from "./digitalLand.js"; diff --git a/api.planx.uk/modules/gis/service/classifiedRoads.ts b/api.planx.uk/modules/gis/service/classifiedRoads.ts index b55cca2117..bfc00ffff7 100644 --- a/api.planx.uk/modules/gis/service/classifiedRoads.ts +++ b/api.planx.uk/modules/gis/service/classifiedRoads.ts @@ -1,5 +1,5 @@ -import { Constraint, GISResponse } from "@opensystemslab/planx-core/types"; -import { NextFunction, Request, Response } from "express"; +import type { Constraint, GISResponse } from "@opensystemslab/planx-core/types"; +import type { NextFunction, Request, Response } from "express"; import fetch from "isomorphic-fetch"; type OSFeatures = { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/barkingAndDagenham.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/barkingAndDagenham.ts index fc5c2cec3d..d82b0b1603 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/barkingAndDagenham.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/barkingAndDagenham.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/1UmxQ95SjU72j0KaVIIkrIfhdE_k_lcFNhUWBc53GEIA/edit#gid=0 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/barnet.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/barnet.ts index 25eb1c85bf..92726b8bc1 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/barnet.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/barnet.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/1ZjqYdC7upA8YS9rBoyRIQPT1sqCXJBaxQDrvUh1todU/edit#gid=0 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/birmingham.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/birmingham.ts index 73d1d9936d..dc0eb9e625 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/birmingham.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/birmingham.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/19t4DKDvyWix1Vf5huuQPVf9L8e6jcq1W/edit#gid=207440632 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/buckinghamshire.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/buckinghamshire.ts index 94ef1bb2c0..70193f3bbf 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/buckinghamshire.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/buckinghamshire.ts @@ -9,7 +9,7 @@ https://environment.data.gov.uk/arcgis/rest/services https://inspire.wycombe.gov.uk/ (legacy) */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/camden.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/camden.ts index 4726227fb4..9d91aafe66 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/camden.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/camden.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/1pFzq0cv_cwDx33d8QgRPVfIXtiseSxgmwQb6cORCVYs/edit#gid=0 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/canterbury.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/canterbury.ts index 93271a9e52..eaa7ea924b 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/canterbury.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/canterbury.ts @@ -9,7 +9,7 @@ https://mapping.canterbury.gov.uk/arcgis/rest/services/ https://environment.data.gov.uk/arcgis/rest/services */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/doncaster.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/doncaster.ts index c5d972e763..847d5f745f 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/doncaster.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/doncaster.ts @@ -8,7 +8,7 @@ https://maps.doncaster.gov.uk/portal/apps/webappviewer/index.html?id=2435bce5ee1 https://www.doncaster.gov.uk/services/planning/houses-in-multiple-occupation-article-4-direction */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/epsomAndEwell.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/epsomAndEwell.ts index 9b051745b6..de05e9538d 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/epsomAndEwell.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/epsomAndEwell.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/1BzYZ_YvJjOrY2afxPGWbPvV2g_FLBr0H/edit#gid=125611981 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/gateshead.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/gateshead.ts index 070f298838..2b02f4966f 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/gateshead.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/gateshead.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/13RdEvCfydfSx6R6p4S742xubOhfea-tvR3n95sYUpvs/edit#gid=0 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/gloucester.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/gloucester.ts index f1556bc339..165cab5810 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/gloucester.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/gloucester.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction&dataset=art https://docs.google.com/spreadsheets/d/1ALSH4hiupdUlrA7Rq7jhfHnWr0-PcB-IzhsztPLl7FY/edit?gid=0#gid=0 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/lambeth.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/lambeth.ts index 339c259da5..ffc7fa04f7 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/lambeth.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/lambeth.ts @@ -9,7 +9,7 @@ https://gis.lambeth.gov.uk/arcgis/rest/services https://environment.data.gov.uk/arcgis/rest/services */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/medway.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/medway.ts index 9a64535402..e0fa7ea31d 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/medway.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/medway.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://trello.com/c/cpNv0iyO/42-input-your-article-4-direction-information-into-this-spreadsheet */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/newcastle.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/newcastle.ts index c82f38c841..3578b704cc 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/newcastle.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/newcastle.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/1GhxQEuKeSnrchZ_quxg6Rg7fHEWPDUr7/edit#gid=915271261 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/southwark.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/southwark.ts index 4c275973e2..5c387eff76 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/southwark.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/southwark.ts @@ -8,7 +8,7 @@ https://geo.southwark.gov.uk/connect/analyst/mobile/#/main https://environment.data.gov.uk/arcgis/rest/services */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/stAlbans.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/stAlbans.ts index 717f142015..476bf64f0e 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/stAlbans.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/stAlbans.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/17qaNhd7M-F90KZ34kVjyetTxfxECf1QUU8UI-aUiknU/edit#gid=0 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/tewkesbury.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/tewkesbury.ts index 7140025940..26439e455a 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/tewkesbury.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/tewkesbury.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/19VMxVhzIt3z1CcvlhELuUxablfbw40Ri/edit#gid=1979469480 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/westBerkshire.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/westBerkshire.ts index 56abd862de..7ff21d982c 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/westBerkshire.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/westBerkshire.ts @@ -8,7 +8,7 @@ https://www.planning.data.gov.uk/entity/?dataset=article-4-direction-area&geomet https://docs.google.com/spreadsheets/d/1dRTb8xhcJgsQB8zIFregenm5aEzrZGU_/edit#gid=322896440 */ -import { LocalAuthorityMetadata } from "../../digitalLand.js"; +import type { LocalAuthorityMetadata } from "../../digitalLand.js"; const planningConstraints: LocalAuthorityMetadata["planningConstraints"] = { article4: { diff --git a/api.planx.uk/modules/misc/controller.ts b/api.planx.uk/modules/misc/controller.ts index b89bf440aa..098f37a3e8 100644 --- a/api.planx.uk/modules/misc/controller.ts +++ b/api.planx.uk/modules/misc/controller.ts @@ -1,7 +1,7 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { stringify } from "csv-stringify"; import { z } from "zod"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; export const healthCheck: RequestHandler = (_req, res) => res.json({ hello: "world" }); diff --git a/api.planx.uk/modules/ordnanceSurvey/controller.ts b/api.planx.uk/modules/ordnanceSurvey/controller.ts index 607e489196..78888b2815 100644 --- a/api.planx.uk/modules/ordnanceSurvey/controller.ts +++ b/api.planx.uk/modules/ordnanceSurvey/controller.ts @@ -1,6 +1,6 @@ import { useProxy } from "../../shared/middleware/proxy.js"; -import { NextFunction, Request, Response } from "express"; -import { IncomingMessage } from "http"; +import type { NextFunction, Request, Response } from "express"; +import type { IncomingMessage } from "http"; export const OS_DOMAIN = "https://api.os.uk"; diff --git a/api.planx.uk/modules/ordnanceSurvey/ordnanceSurvey.test.ts b/api.planx.uk/modules/ordnanceSurvey/ordnanceSurvey.test.ts index aead559dd3..80f1f427b2 100644 --- a/api.planx.uk/modules/ordnanceSurvey/ordnanceSurvey.test.ts +++ b/api.planx.uk/modules/ordnanceSurvey/ordnanceSurvey.test.ts @@ -1,4 +1,4 @@ -import { Request } from "express"; +import type { Request } from "express"; import nock from "nock"; import supertest from "supertest"; import app from "../../server.js"; diff --git a/api.planx.uk/modules/pay/controller.ts b/api.planx.uk/modules/pay/controller.ts index e8661aba8d..03c649045a 100644 --- a/api.planx.uk/modules/pay/controller.ts +++ b/api.planx.uk/modules/pay/controller.ts @@ -1,16 +1,19 @@ import assert from "assert"; -import { Request } from "express"; +import type { Request } from "express"; import { responseInterceptor } from "http-proxy-middleware"; import { handleGovPayErrors, logPaymentStatus } from "./helpers.js"; import { usePayProxy } from "./proxy.js"; import { $api } from "../../client/index.js"; import { ServerError } from "../../errors/index.js"; -import { GovUKPayment, PaymentRequest } from "@opensystemslab/planx-core/types"; +import type { + GovUKPayment, + PaymentRequest, +} from "@opensystemslab/planx-core/types"; import { addGovPayPaymentIdToPaymentRequest, postPaymentNotificationToSlack, } from "./service/utils.js"; -import { +import type { InviteToPayController, PaymentProxyController, PaymentRequestProxyController, diff --git a/api.planx.uk/modules/pay/middleware.ts b/api.planx.uk/modules/pay/middleware.ts index 266cb37356..632ace95c0 100644 --- a/api.planx.uk/modules/pay/middleware.ts +++ b/api.planx.uk/modules/pay/middleware.ts @@ -1,10 +1,10 @@ -import { NextFunction, Request, RequestHandler, Response } from "express"; +import type { NextFunction, Request, RequestHandler, Response } from "express"; import { gql } from "graphql-request"; import { $api } from "../../client/index.js"; import { ServerError } from "../../errors/index.js"; -import { GovPayMetadata } from "./types.js"; +import type { GovPayMetadata } from "./types.js"; import { formatGovPayMetadata } from "@opensystemslab/planx-core"; -import { +import type { GovPayMetadataValue, Passport, } from "@opensystemslab/planx-core/types"; diff --git a/api.planx.uk/modules/pay/proxy.ts b/api.planx.uk/modules/pay/proxy.ts index 446f59627d..350979d8cc 100644 --- a/api.planx.uk/modules/pay/proxy.ts +++ b/api.planx.uk/modules/pay/proxy.ts @@ -1,5 +1,6 @@ -import { Response, Request } from "express"; -import { fixRequestBody, Options } from "http-proxy-middleware"; +import type { Response, Request } from "express"; +import type { Options } from "http-proxy-middleware"; +import { fixRequestBody } from "http-proxy-middleware"; import { useProxy } from "../../shared/middleware/proxy.js"; export const usePayProxy = ( diff --git a/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.test.ts b/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.test.ts index aec212019f..744dc486c1 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.test.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.test.ts @@ -3,7 +3,7 @@ import app from "../../../../server.js"; import { createScheduledEvent } from "../../../../lib/hasura/metadata/index.js"; import { queryMock } from "../../../../tests/graphqlQueryMock.js"; import { flowWithInviteToPay } from "../../../../tests/mocks/inviteToPayData.js"; -import { MockedFunction } from "vitest"; +import type { MockedFunction } from "vitest"; vi.mock("../../../../lib/hasura/metadata"); const mockedCreateScheduledEvent = createScheduledEvent as MockedFunction< diff --git a/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts b/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts index 88380568d3..bdaa1c3cbf 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts @@ -1,13 +1,12 @@ -import { ComponentType, Team } from "@opensystemslab/planx-core/types"; -import { NextFunction, Request, Response } from "express"; +import type { Team } from "@opensystemslab/planx-core/types"; +import { ComponentType } from "@opensystemslab/planx-core/types"; +import type { NextFunction, Request, Response } from "express"; import { gql } from "graphql-request"; -import { - CombinedResponse, - createScheduledEvent, -} from "../../../../lib/hasura/metadata/index.js"; +import type { CombinedResponse } from "../../../../lib/hasura/metadata/index.js"; +import { createScheduledEvent } from "../../../../lib/hasura/metadata/index.js"; import { $api, $public } from "../../../../client/index.js"; import { getMostRecentPublishedFlow } from "../../../../helpers.js"; -import { Flow, Node } from "../../../../types.js"; +import type { Flow, Node } from "../../../../types.js"; enum Destination { BOPS = "bops", diff --git a/api.planx.uk/modules/pay/service/inviteToPay/paymentRequest.ts b/api.planx.uk/modules/pay/service/inviteToPay/paymentRequest.ts index f9e2b7179f..9c6b55fe19 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/paymentRequest.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/paymentRequest.ts @@ -1,7 +1,7 @@ import { gql } from "graphql-request"; -import { Request } from "express"; +import type { Request } from "express"; import { fetchPaymentViaProxyWithCallback } from "../../controller.js"; -import { GovUKPayment } from "@opensystemslab/planx-core/types"; +import type { GovUKPayment } from "@opensystemslab/planx-core/types"; import { $api } from "../../../../client/index.js"; import { postPaymentNotificationToSlack } from "../utils.js"; diff --git a/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.ts b/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.ts index 0cc4b48ae8..69fe0ffd40 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.ts @@ -1,12 +1,12 @@ import { formatRawProjectTypes } from "@opensystemslab/planx-core"; import type { PaymentRequest, Team } from "@opensystemslab/planx-core/types"; import { gql } from "graphql-request"; +import type { Template } from "../../../../lib/notify/index.js"; import { - Template, getClientForTemplate, sendEmail, } from "../../../../lib/notify/index.js"; -import { InviteToPayNotifyConfig } from "../../../../types.js"; +import type { InviteToPayNotifyConfig } from "../../../../types.js"; import { calculateExpiryDate, getServiceLink, diff --git a/api.planx.uk/modules/pay/service/utils.test.ts b/api.planx.uk/modules/pay/service/utils.test.ts index 90a325caa5..7e07a94b1d 100644 --- a/api.planx.uk/modules/pay/service/utils.test.ts +++ b/api.planx.uk/modules/pay/service/utils.test.ts @@ -1,4 +1,4 @@ -import { GovUKPayment } from "@opensystemslab/planx-core/types"; +import type { GovUKPayment } from "@opensystemslab/planx-core/types"; import { isTestPayment } from "./utils.js"; describe("isTestPayment() helper function", () => { diff --git a/api.planx.uk/modules/pay/service/utils.ts b/api.planx.uk/modules/pay/service/utils.ts index 1c7c2dc062..67f8dddcb9 100644 --- a/api.planx.uk/modules/pay/service/utils.ts +++ b/api.planx.uk/modules/pay/service/utils.ts @@ -1,9 +1,9 @@ -import { GovUKPayment } from "@opensystemslab/planx-core/types"; +import type { GovUKPayment } from "@opensystemslab/planx-core/types"; import { $api } from "../../../client/index.js"; import { gql } from "graphql-request"; import SlackNotify from "slack-notify"; -import { Request } from "express"; +import type { Request } from "express"; export const addGovPayPaymentIdToPaymentRequest = async ( paymentRequestId: string, diff --git a/api.planx.uk/modules/pay/types.ts b/api.planx.uk/modules/pay/types.ts index 268324db37..d8a2ca0a9d 100644 --- a/api.planx.uk/modules/pay/types.ts +++ b/api.planx.uk/modules/pay/types.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; -import { PaymentRequest } from "@opensystemslab/planx-core/types"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; +import type { PaymentRequest } from "@opensystemslab/planx-core/types"; export const paymentProxySchema = z.object({ query: z.object({ diff --git a/api.planx.uk/modules/saveAndReturn/controller.ts b/api.planx.uk/modules/saveAndReturn/controller.ts index d1c0d5a958..633485df5d 100644 --- a/api.planx.uk/modules/saveAndReturn/controller.ts +++ b/api.planx.uk/modules/saveAndReturn/controller.ts @@ -1,6 +1,6 @@ import { resumeApplication } from "./service/resumeApplication.js"; import { findSession, validateSession } from "./service/validateSession.js"; -import { ResumeApplication, ValidateSessionController } from "./types.js"; +import type { ResumeApplication, ValidateSessionController } from "./types.js"; export const validateSessionController: ValidateSessionController = async ( _req, diff --git a/api.planx.uk/modules/saveAndReturn/service/resumeApplication.test.ts b/api.planx.uk/modules/saveAndReturn/service/resumeApplication.test.ts index 7cb57e8e8d..8325578253 100644 --- a/api.planx.uk/modules/saveAndReturn/service/resumeApplication.test.ts +++ b/api.planx.uk/modules/saveAndReturn/service/resumeApplication.test.ts @@ -1,4 +1,4 @@ -import { LowCalSession } from "../../../types.js"; +import type { LowCalSession } from "../../../types.js"; import supertest from "supertest"; import app from "../../../server.js"; import { queryMock } from "../../../tests/graphqlQueryMock.js"; @@ -7,8 +7,8 @@ import { mockTeam, } from "../../../tests/mocks/saveAndReturnMocks.js"; import { buildContentFromSessions } from "./resumeApplication.js"; -import { PartialDeep } from "type-fest"; -import { Team } from "@opensystemslab/planx-core/types"; +import type { PartialDeep } from "type-fest"; +import type { Team } from "@opensystemslab/planx-core/types"; const ENDPOINT = "/resume-application"; const TEST_EMAIL = "simulate-delivered@notifications.service.gov.uk"; diff --git a/api.planx.uk/modules/saveAndReturn/service/resumeApplication.ts b/api.planx.uk/modules/saveAndReturn/service/resumeApplication.ts index ba9f8d8f52..e464f248d8 100644 --- a/api.planx.uk/modules/saveAndReturn/service/resumeApplication.ts +++ b/api.planx.uk/modules/saveAndReturn/service/resumeApplication.ts @@ -5,7 +5,7 @@ import { gql } from "graphql-request"; import { $api } from "../../../client/index.js"; import { sendEmail } from "../../../lib/notify/index.js"; -import { LowCalSession } from "../../../types.js"; +import type { LowCalSession } from "../../../types.js"; import { DAYS_UNTIL_EXPIRY, calculateExpiryDate, diff --git a/api.planx.uk/modules/saveAndReturn/service/utils.test.ts b/api.planx.uk/modules/saveAndReturn/service/utils.test.ts index de2af88a05..c415db0551 100644 --- a/api.planx.uk/modules/saveAndReturn/service/utils.test.ts +++ b/api.planx.uk/modules/saveAndReturn/service/utils.test.ts @@ -1,6 +1,6 @@ -import { Team } from "@opensystemslab/planx-core/types"; +import type { Team } from "@opensystemslab/planx-core/types"; import { queryMock } from "../../../tests/graphqlQueryMock.js"; -import { LowCalSession, LowCalSessionData } from "../../../types.js"; +import type { LowCalSession, LowCalSessionData } from "../../../types.js"; import { getResumeLink, getSessionDetails, diff --git a/api.planx.uk/modules/saveAndReturn/service/utils.ts b/api.planx.uk/modules/saveAndReturn/service/utils.ts index 72ba0b4ed7..c5d1c20a8a 100644 --- a/api.planx.uk/modules/saveAndReturn/service/utils.ts +++ b/api.planx.uk/modules/saveAndReturn/service/utils.ts @@ -1,15 +1,12 @@ import { formatRawProjectTypes } from "@opensystemslab/planx-core"; -import { SiteAddress, Team } from "@opensystemslab/planx-core/types"; +import type { SiteAddress, Team } from "@opensystemslab/planx-core/types"; import { addDays, format } from "date-fns"; import { gql } from "graphql-request"; import { $api } from "../../../client/index.js"; -import { - Template, - getClientForTemplate, - sendEmail, -} from "../../../lib/notify/index.js"; -import { LowCalSession } from "../../../types.js"; +import type { Template } from "../../../lib/notify/index.js"; +import { getClientForTemplate, sendEmail } from "../../../lib/notify/index.js"; +import type { LowCalSession } from "../../../types.js"; const DAYS_UNTIL_EXPIRY = 28; const REMINDER_DAYS_FROM_EXPIRY = [7, 1]; diff --git a/api.planx.uk/modules/saveAndReturn/service/validateSession.ts b/api.planx.uk/modules/saveAndReturn/service/validateSession.ts index f62cf1cf50..34445d26bc 100644 --- a/api.planx.uk/modules/saveAndReturn/service/validateSession.ts +++ b/api.planx.uk/modules/saveAndReturn/service/validateSession.ts @@ -15,7 +15,7 @@ import type { Node, } from "../../../types.js"; import { $api } from "../../../client/index.js"; -import { ValidationResponse } from "../types.js"; +import type { ValidationResponse } from "../types.js"; export type ReconciledSession = { alteredSectionIds: Array; diff --git a/api.planx.uk/modules/saveAndReturn/types.ts b/api.planx.uk/modules/saveAndReturn/types.ts index 7f144d5639..f6ed6dec13 100644 --- a/api.planx.uk/modules/saveAndReturn/types.ts +++ b/api.planx.uk/modules/saveAndReturn/types.ts @@ -1,7 +1,7 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; -import { LowCalSessionData } from "../../types.js"; -import { PaymentRequest } from "@opensystemslab/planx-core/types"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; +import type { LowCalSessionData } from "../../types.js"; +import type { PaymentRequest } from "@opensystemslab/planx-core/types"; interface ResumeApplicationResponse { message: string; diff --git a/api.planx.uk/modules/send/bops/bops.test.ts b/api.planx.uk/modules/send/bops/bops.test.ts index bf9694ef1f..3342e08b19 100644 --- a/api.planx.uk/modules/send/bops/bops.test.ts +++ b/api.planx.uk/modules/send/bops/bops.test.ts @@ -1,5 +1,6 @@ import nock from "nock"; import supertest from "supertest"; +import type planxCore from "@opensystemslab/planx-core"; import { queryMock } from "../../../tests/graphqlQueryMock.js"; import app from "../../../server.js"; import { expectedPlanningPermissionPayload } from "../../../tests/mocks/digitalPlanningDataMocks.js"; @@ -9,8 +10,7 @@ vi.mock("../../saveAndReturn/service/utils", () => ({ })); vi.mock("@opensystemslab/planx-core", async (importOriginal) => { - const actualCore = - await importOriginal(); + const actualCore = await importOriginal(); const actualCoreDomainClient = actualCore.CoreDomainClient; return { diff --git a/api.planx.uk/modules/send/bops/bops.ts b/api.planx.uk/modules/send/bops/bops.ts index 99809fd214..ccd8c388ac 100644 --- a/api.planx.uk/modules/send/bops/bops.ts +++ b/api.planx.uk/modules/send/bops/bops.ts @@ -1,6 +1,7 @@ -import axios, { AxiosResponse } from "axios"; +import type { AxiosResponse } from "axios"; +import axios from "axios"; import { markSessionAsSubmitted } from "../../saveAndReturn/service/utils.js"; -import { NextFunction, Request, Response } from "express"; +import type { NextFunction, Request, Response } from "express"; import { gql } from "graphql-request"; import { $api } from "../../../client/index.js"; import { ServerError } from "../../../errors/index.js"; diff --git a/api.planx.uk/modules/send/createSendEvents/controller.ts b/api.planx.uk/modules/send/createSendEvents/controller.ts index b2a756187d..d2cb83e9a9 100644 --- a/api.planx.uk/modules/send/createSendEvents/controller.ts +++ b/api.planx.uk/modules/send/createSendEvents/controller.ts @@ -1,8 +1,6 @@ -import { - CombinedResponse, - createScheduledEvent, -} from "../../../lib/hasura/metadata/index.js"; -import { CreateSendEventsController } from "./types.js"; +import type { CombinedResponse } from "../../../lib/hasura/metadata/index.js"; +import { createScheduledEvent } from "../../../lib/hasura/metadata/index.js"; +import type { CreateSendEventsController } from "./types.js"; // Create "One-off Scheduled Events" in Hasura from Send component for selected destinations const createSendEvents: CreateSendEventsController = async ( diff --git a/api.planx.uk/modules/send/createSendEvents/types.ts b/api.planx.uk/modules/send/createSendEvents/types.ts index ea383a88de..684b819566 100644 --- a/api.planx.uk/modules/send/createSendEvents/types.ts +++ b/api.planx.uk/modules/send/createSendEvents/types.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { CombinedResponse } from "../../../lib/hasura/metadata/index.js"; -import { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; +import type { CombinedResponse } from "../../../lib/hasura/metadata/index.js"; +import type { ValidatedRequestHandler } from "../../../shared/middleware/validate.js"; const eventSchema = z.object({ localAuthority: z.string(), diff --git a/api.planx.uk/modules/send/email/index.test.ts b/api.planx.uk/modules/send/email/index.test.ts index 74c21f805a..d5b9fcad84 100644 --- a/api.planx.uk/modules/send/email/index.test.ts +++ b/api.planx.uk/modules/send/email/index.test.ts @@ -1,4 +1,5 @@ import supertest from "supertest"; +import type planxCore from "@opensystemslab/planx-core"; import { queryMock } from "../../../tests/graphqlQueryMock.js"; import app from "../../../server.js"; @@ -11,8 +12,7 @@ const mockGenerateCSVData = vi.fn().mockResolvedValue([ ]); vi.mock("@opensystemslab/planx-core", async (importOriginal) => { - const actualCore = - await importOriginal(); + const actualCore = await importOriginal(); const actualCoreDomainClient = actualCore.CoreDomainClient; return { diff --git a/api.planx.uk/modules/send/email/index.ts b/api.planx.uk/modules/send/email/index.ts index cd19e6bffe..ce7a28dc95 100644 --- a/api.planx.uk/modules/send/email/index.ts +++ b/api.planx.uk/modules/send/email/index.ts @@ -1,6 +1,6 @@ import type { NextFunction, Request, Response } from "express"; import { sendEmail } from "../../../lib/notify/index.js"; -import { EmailSubmissionNotifyConfig } from "../../../types.js"; +import type { EmailSubmissionNotifyConfig } from "../../../types.js"; import { markSessionAsSubmitted } from "../../saveAndReturn/service/utils.js"; import { getSessionEmailDetailsById, diff --git a/api.planx.uk/modules/send/email/service.ts b/api.planx.uk/modules/send/email/service.ts index 878d165856..67425a1509 100644 --- a/api.planx.uk/modules/send/email/service.ts +++ b/api.planx.uk/modules/send/email/service.ts @@ -1,7 +1,10 @@ import { gql } from "graphql-request"; import { $api } from "../../../client/index.js"; -import { Session, TeamContactSettings } from "@opensystemslab/planx-core/types"; -import { EmailSubmissionNotifyConfig } from "../../../types.js"; +import type { + Session, + TeamContactSettings, +} from "@opensystemslab/planx-core/types"; +import type { EmailSubmissionNotifyConfig } from "../../../types.js"; interface GetTeamEmailSettings { teams: { diff --git a/api.planx.uk/modules/send/idox/nexus.ts b/api.planx.uk/modules/send/idox/nexus.ts index 9b67392970..758e1a41b1 100644 --- a/api.planx.uk/modules/send/idox/nexus.ts +++ b/api.planx.uk/modules/send/idox/nexus.ts @@ -1,5 +1,6 @@ -import axios, { AxiosRequestConfig, isAxiosError } from "axios"; -import { NextFunction, Request, Response } from "express"; +import type { AxiosRequestConfig } from "axios"; +import axios, { isAxiosError } from "axios"; +import type { NextFunction, Request, Response } from "express"; import FormData from "form-data"; import fs from "fs"; import { gql } from "graphql-request"; diff --git a/api.planx.uk/modules/send/s3/index.test.ts b/api.planx.uk/modules/send/s3/index.test.ts index c5f8d56fe3..01baa00632 100644 --- a/api.planx.uk/modules/send/s3/index.test.ts +++ b/api.planx.uk/modules/send/s3/index.test.ts @@ -1,4 +1,5 @@ import supertest from "supertest"; +import type planxCore from "@opensystemslab/planx-core"; import app from "../../../server.js"; import { expectedPlanningPermissionPayload } from "../../../tests/mocks/digitalPlanningDataMocks.js"; import { queryMock } from "../../../tests/graphqlQueryMock.js"; @@ -8,8 +9,7 @@ vi.mock("../../saveAndReturn/service/utils", () => ({ })); vi.mock("@opensystemslab/planx-core", async (importOriginal) => { - const actualCore = - await importOriginal(); + const actualCore = await importOriginal(); const actualCoreDomainClient = actualCore.CoreDomainClient; return { diff --git a/api.planx.uk/modules/send/s3/index.ts b/api.planx.uk/modules/send/s3/index.ts index 51909b2428..ffd57cd2ba 100644 --- a/api.planx.uk/modules/send/s3/index.ts +++ b/api.planx.uk/modules/send/s3/index.ts @@ -1,9 +1,10 @@ -import axios, { AxiosRequestConfig } from "axios"; +import type { AxiosRequestConfig } from "axios"; +import axios from "axios"; import type { NextFunction, Request, Response } from "express"; import { gql } from "graphql-request"; import { $api } from "../../../client/index.js"; -import { Passport } from "../../../types.js"; +import type { Passport } from "../../../types.js"; import { uploadPrivateFile } from "../../file/service/uploadFile.js"; import { markSessionAsSubmitted } from "../../saveAndReturn/service/utils.js"; import { isApplicationTypeSupported } from "../utils/helpers.js"; diff --git a/api.planx.uk/modules/send/uniform/uniform.ts b/api.planx.uk/modules/send/uniform/uniform.ts index 77b32ea8ad..795f69cd8c 100644 --- a/api.planx.uk/modules/send/uniform/uniform.ts +++ b/api.planx.uk/modules/send/uniform/uniform.ts @@ -1,5 +1,6 @@ -import axios, { AxiosRequestConfig, isAxiosError } from "axios"; -import { NextFunction, Request, Response } from "express"; +import type { AxiosRequestConfig } from "axios"; +import axios, { isAxiosError } from "axios"; +import type { NextFunction, Request, Response } from "express"; import FormData from "form-data"; import fs from "fs"; import { gql } from "graphql-request"; diff --git a/api.planx.uk/modules/send/utils/helpers.ts b/api.planx.uk/modules/send/utils/helpers.ts index d149c9bb50..1ed97083f5 100644 --- a/api.planx.uk/modules/send/utils/helpers.ts +++ b/api.planx.uk/modules/send/utils/helpers.ts @@ -1,4 +1,4 @@ -import { Passport } from "../../../types.js"; +import type { Passport } from "../../../types.js"; /** * Checks whether a session's passport data includes an application type supported by the ODP Schema diff --git a/api.planx.uk/modules/sendEmail/controller.ts b/api.planx.uk/modules/sendEmail/controller.ts index fcb0c5163f..c95cbc3856 100644 --- a/api.planx.uk/modules/sendEmail/controller.ts +++ b/api.planx.uk/modules/sendEmail/controller.ts @@ -4,8 +4,8 @@ import { } from "../pay/service/inviteToPay/index.js"; import { sendSingleApplicationEmail } from "../saveAndReturn/service/utils.js"; import { ServerError } from "../../errors/index.js"; -import { NextFunction } from "express"; -import { +import type { NextFunction } from "express"; +import type { ConfirmationEmail, PaymentEmail, SingleApplicationEmail, diff --git a/api.planx.uk/modules/sendEmail/types.ts b/api.planx.uk/modules/sendEmail/types.ts index b070a4208c..4128245efa 100644 --- a/api.planx.uk/modules/sendEmail/types.ts +++ b/api.planx.uk/modules/sendEmail/types.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; interface SendEmailResponse { message: string; diff --git a/api.planx.uk/modules/slack/controller.ts b/api.planx.uk/modules/slack/controller.ts index 8db6150a81..ddb18f3689 100644 --- a/api.planx.uk/modules/slack/controller.ts +++ b/api.planx.uk/modules/slack/controller.ts @@ -1,7 +1,7 @@ import SlackNotify from "slack-notify"; import { z } from "zod"; import { ServerError } from "../../errors/index.js"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; interface SendSlackNotificationResponse { message: string; diff --git a/api.planx.uk/modules/team/controller.ts b/api.planx.uk/modules/team/controller.ts index fee1a83faf..c99a0a2b51 100644 --- a/api.planx.uk/modules/team/controller.ts +++ b/api.planx.uk/modules/team/controller.ts @@ -1,6 +1,6 @@ import { z } from "zod"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; import { ServerError } from "../../errors/index.js"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; import * as Service from "./service.js"; interface TeamMemberResponse { diff --git a/api.planx.uk/modules/team/service.ts b/api.planx.uk/modules/team/service.ts index a9c1b0a22d..a3b0498787 100644 --- a/api.planx.uk/modules/team/service.ts +++ b/api.planx.uk/modules/team/service.ts @@ -1,5 +1,5 @@ import { getClient } from "../../client/index.js"; -import { TeamRole } from "@opensystemslab/planx-core/types"; +import type { TeamRole } from "@opensystemslab/planx-core/types"; interface UpsertMember { userEmail: string; diff --git a/api.planx.uk/modules/test/controller.ts b/api.planx.uk/modules/test/controller.ts index 4ddda88468..57ba2ff109 100644 --- a/api.planx.uk/modules/test/controller.ts +++ b/api.planx.uk/modules/test/controller.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const testSessionMethods: RequestHandler = (req, res) => { const hasRegenerate = typeof req.session?.regenerate === "function"; diff --git a/api.planx.uk/modules/user/controller.ts b/api.planx.uk/modules/user/controller.ts index 9c4231e605..1ffd37ceb7 100644 --- a/api.planx.uk/modules/user/controller.ts +++ b/api.planx.uk/modules/user/controller.ts @@ -1,9 +1,9 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../shared/middleware/validate.js"; import { getClient } from "../../client/index.js"; import { ServerError } from "../../errors/index.js"; -import { RequestHandler } from "express"; -import { User } from "@opensystemslab/planx-core/types"; +import type { RequestHandler } from "express"; +import type { User } from "@opensystemslab/planx-core/types"; import { userContext } from "../auth/middleware.js"; interface UserResponse { diff --git a/api.planx.uk/modules/webhooks/controller.ts b/api.planx.uk/modules/webhooks/controller.ts index 6fbd0ba6b5..4bf3ec5b64 100644 --- a/api.planx.uk/modules/webhooks/controller.ts +++ b/api.planx.uk/modules/webhooks/controller.ts @@ -1,20 +1,20 @@ import { ServerError } from ".././../errors/index.js"; -import { CreateSessionEventController } from "./service/lowcalSessionEvents/schema.js"; +import type { CreateSessionEventController } from "./service/lowcalSessionEvents/schema.js"; import { createSessionExpiryEvent, createSessionReminderEvent, } from "./service/lowcalSessionEvents/index.js"; -import { SendSlackNotification } from "./service/sendNotification/types.js"; +import type { SendSlackNotification } from "./service/sendNotification/types.js"; import { sendSlackNotification } from "./service/sendNotification/index.js"; -import { CreatePaymentEventController } from "./service/paymentRequestEvents/schema.js"; +import type { CreatePaymentEventController } from "./service/paymentRequestEvents/schema.js"; import { createPaymentExpiryEvents, createPaymentInvitationEvents, createPaymentReminderEvents, } from "./service/paymentRequestEvents/index.js"; -import { SanitiseApplicationData } from "./service/sanitiseApplicationData/types.js"; +import type { SanitiseApplicationData } from "./service/sanitiseApplicationData/types.js"; import { sanitiseApplicationData } from "./service/sanitiseApplicationData/index.js"; -import { IsCleanJSONBController } from "./service/validateInput/schema.js"; +import type { IsCleanJSONBController } from "./service/validateInput/schema.js"; import { analyzeSessions } from "./service/analyzeSessions/index.js"; export const sendSlackNotificationController: SendSlackNotification = async ( diff --git a/api.planx.uk/modules/webhooks/service/analyzeSessions/index.ts b/api.planx.uk/modules/webhooks/service/analyzeSessions/index.ts index 7da345cfa3..132bf29d18 100644 --- a/api.planx.uk/modules/webhooks/service/analyzeSessions/index.ts +++ b/api.planx.uk/modules/webhooks/service/analyzeSessions/index.ts @@ -1,6 +1,6 @@ import { postToSlack } from "../sanitiseApplicationData/index.js"; import { operationHandler } from "../sanitiseApplicationData/operations.js"; -import { OperationResult } from "../sanitiseApplicationData/types.js"; +import type { OperationResult } from "../sanitiseApplicationData/types.js"; import { getAnalyzeSessionOperations } from "./operations.js"; /** diff --git a/api.planx.uk/modules/webhooks/service/analyzeSessions/operations.test.ts b/api.planx.uk/modules/webhooks/service/analyzeSessions/operations.test.ts index d9e1d5e515..e7ac416c68 100644 --- a/api.planx.uk/modules/webhooks/service/analyzeSessions/operations.test.ts +++ b/api.planx.uk/modules/webhooks/service/analyzeSessions/operations.test.ts @@ -1,5 +1,5 @@ +import type planxCore from "@opensystemslab/planx-core"; import { queryMock } from "../../../../tests/graphqlQueryMock.js"; - import { getSubmittedUnAnalyzedSessionIds, updateLowcalSessionAllowListAnswers, @@ -9,8 +9,7 @@ vi.mock("../../../../lib/hasura/schema"); const mockFindSession = vi.fn(); vi.mock("@opensystemslab/planx-core", async (importOriginal) => { - const actualCore = - await importOriginal(); + const actualCore = await importOriginal(); const actualCoreDomainClient = actualCore.CoreDomainClient; const actualPassport = actualCore.Passport; diff --git a/api.planx.uk/modules/webhooks/service/analyzeSessions/operations.ts b/api.planx.uk/modules/webhooks/service/analyzeSessions/operations.ts index aa08115e03..ce71073e16 100644 --- a/api.planx.uk/modules/webhooks/service/analyzeSessions/operations.ts +++ b/api.planx.uk/modules/webhooks/service/analyzeSessions/operations.ts @@ -2,7 +2,7 @@ import { gql } from "graphql-request"; import { Passport } from "@opensystemslab/planx-core"; import { $api } from "../../../../client/index.js"; -import { Operation } from "../sanitiseApplicationData/types.js"; +import type { Operation } from "../sanitiseApplicationData/types.js"; /** * ALLOW_LIST should stay in sync with diff --git a/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/index.test.ts b/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/index.test.ts index 98678310ed..7be1aeaeaf 100644 --- a/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/index.test.ts +++ b/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/index.test.ts @@ -1,7 +1,7 @@ import supertest from "supertest"; import app from "../../../../server.js"; import { createScheduledEvent } from "../../../../lib/hasura/metadata/index.js"; -import { MockedFunction } from "vitest"; +import type { MockedFunction } from "vitest"; const { post } = supertest(app); diff --git a/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/index.ts b/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/index.ts index af05363ad3..1e801899af 100644 --- a/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/index.ts +++ b/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/index.ts @@ -5,7 +5,7 @@ import { DAYS_UNTIL_EXPIRY, REMINDER_DAYS_FROM_EXPIRY, } from "../../../saveAndReturn/service/utils.js"; -import { CreateSessionEvent } from "./schema.js"; +import type { CreateSessionEvent } from "./schema.js"; /** * Create "reminder" events for a lowcal_session record diff --git a/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/schema.ts b/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/schema.ts index a83dce4147..b4b7746248 100644 --- a/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/schema.ts +++ b/api.planx.uk/modules/webhooks/service/lowcalSessionEvents/schema.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; -import { ScheduledEventResponse } from "../../../../lib/hasura/metadata/index.js"; +import type { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; +import type { ScheduledEventResponse } from "../../../../lib/hasura/metadata/index.js"; export const createSessionEventSchema = z.object({ body: z.object({ diff --git a/api.planx.uk/modules/webhooks/service/paymentRequestEvents/index.test.ts b/api.planx.uk/modules/webhooks/service/paymentRequestEvents/index.test.ts index 9c584657f5..086d8cefa0 100644 --- a/api.planx.uk/modules/webhooks/service/paymentRequestEvents/index.test.ts +++ b/api.planx.uk/modules/webhooks/service/paymentRequestEvents/index.test.ts @@ -1,8 +1,8 @@ import supertest from "supertest"; import app from "../../../../server.js"; import { createScheduledEvent } from "../../../../lib/hasura/metadata/index.js"; -import { CreatePaymentEvent } from "./schema.js"; -import { MockedFunction } from "vitest"; +import type { CreatePaymentEvent } from "./schema.js"; +import type { MockedFunction } from "vitest"; const { post } = supertest(app); diff --git a/api.planx.uk/modules/webhooks/service/paymentRequestEvents/index.ts b/api.planx.uk/modules/webhooks/service/paymentRequestEvents/index.ts index b0f1c94c69..8130a99dfd 100644 --- a/api.planx.uk/modules/webhooks/service/paymentRequestEvents/index.ts +++ b/api.planx.uk/modules/webhooks/service/paymentRequestEvents/index.ts @@ -5,7 +5,7 @@ import { DAYS_UNTIL_EXPIRY, REMINDER_DAYS_FROM_EXPIRY, } from "../../../saveAndReturn/service/utils.js"; -import { CreatePaymentEvent } from "./schema.js"; +import type { CreatePaymentEvent } from "./schema.js"; /** * Create two "invitation" events for a payments_request record: one for the nominee and one for the agent diff --git a/api.planx.uk/modules/webhooks/service/paymentRequestEvents/schema.ts b/api.planx.uk/modules/webhooks/service/paymentRequestEvents/schema.ts index 029b94dc85..3facb498a4 100644 --- a/api.planx.uk/modules/webhooks/service/paymentRequestEvents/schema.ts +++ b/api.planx.uk/modules/webhooks/service/paymentRequestEvents/schema.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; -import { ScheduledEventResponse } from "../../../../lib/hasura/metadata/index.js"; +import type { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; +import type { ScheduledEventResponse } from "../../../../lib/hasura/metadata/index.js"; export const createPaymentEventSchema = z.object({ body: z.object({ diff --git a/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/index.ts b/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/index.ts index 1f54397767..bc15ff6232 100644 --- a/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/index.ts +++ b/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/index.ts @@ -1,7 +1,7 @@ import SlackNotify from "slack-notify"; import { getOperations, operationHandler } from "./operations.js"; -import { OperationResult } from "./types.js"; +import type { OperationResult } from "./types.js"; import { getFormattedEnvironment } from "../../../../helpers.js"; /** diff --git a/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/operations.test.ts b/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/operations.test.ts index a0dedc1ec8..13ad138a43 100644 --- a/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/operations.test.ts +++ b/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/operations.test.ts @@ -1,3 +1,4 @@ +import type planxCore from "@opensystemslab/planx-core"; import { runSQL } from "../../../../lib/hasura/schema/index.js"; import { queryMock } from "../../../../tests/graphqlQueryMock.js"; import { @@ -26,7 +27,7 @@ import { deleteHasuraScheduledEventsForSubmittedSessions, deleteFeedback, } from "./operations.js"; -import { MockedFunction } from "vitest"; +import type { MockedFunction } from "vitest"; vi.mock("../../../../lib/hasura/schema"); const mockRunSQL = runSQL as MockedFunction; @@ -34,8 +35,7 @@ const mockRunSQL = runSQL as MockedFunction; const mockFindSession = vi.fn(); vi.mock("@opensystemslab/planx-core", async (importOriginal) => { - const actualCore = - await importOriginal(); + const actualCore = await importOriginal(); const actualCoreDomainClient = actualCore.CoreDomainClient; const actualPassport = actualCore.Passport; diff --git a/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/operations.ts b/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/operations.ts index 5f6ce18237..8384c95c6e 100644 --- a/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/operations.ts +++ b/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/operations.ts @@ -1,7 +1,7 @@ import { gql } from "graphql-request"; import { subMonths } from "date-fns"; -import { Operation, OperationResult, QueryResult } from "./types.js"; +import type { Operation, OperationResult, QueryResult } from "./types.js"; import { runSQL } from "../../../../lib/hasura/schema/index.js"; import { deleteFilesByURL } from "../../../file/service/deleteFile.js"; import { $api } from "../../../../client/index.js"; diff --git a/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/types.ts b/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/types.ts index 45878199d2..f67d8ce215 100644 --- a/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/types.ts +++ b/api.planx.uk/modules/webhooks/service/sanitiseApplicationData/types.ts @@ -1,5 +1,5 @@ -import { z } from "zod"; -import { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; +import type { z } from "zod"; +import type { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; export interface OperationResult { operationName: string; diff --git a/api.planx.uk/modules/webhooks/service/sendNotification/index.test.ts b/api.planx.uk/modules/webhooks/service/sendNotification/index.test.ts index 272ba89bbe..e46a1d249a 100644 --- a/api.planx.uk/modules/webhooks/service/sendNotification/index.test.ts +++ b/api.planx.uk/modules/webhooks/service/sendNotification/index.test.ts @@ -1,7 +1,7 @@ import supertest from "supertest"; import app from "../../../../server.js"; import SlackNotify from "slack-notify"; -import { BOPSBody, EmailBody, S3Body, UniformBody } from "./types.js"; +import type { BOPSBody, EmailBody, S3Body, UniformBody } from "./types.js"; import { $api } from "../../../../client/index.js"; const mockSessionWithFee = { diff --git a/api.planx.uk/modules/webhooks/service/sendNotification/index.ts b/api.planx.uk/modules/webhooks/service/sendNotification/index.ts index c6a6160eed..9dd900aaf7 100644 --- a/api.planx.uk/modules/webhooks/service/sendNotification/index.ts +++ b/api.planx.uk/modules/webhooks/service/sendNotification/index.ts @@ -1,6 +1,6 @@ import { Passport } from "@opensystemslab/planx-core"; import SlackNotify from "slack-notify"; -import { +import type { BOPSEventData, EmailEventData, EventData, diff --git a/api.planx.uk/modules/webhooks/service/sendNotification/types.ts b/api.planx.uk/modules/webhooks/service/sendNotification/types.ts index cdf96fcdab..af58833525 100644 --- a/api.planx.uk/modules/webhooks/service/sendNotification/types.ts +++ b/api.planx.uk/modules/webhooks/service/sendNotification/types.ts @@ -1,6 +1,6 @@ -import { z } from "zod"; -import { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; -import { +import type { z } from "zod"; +import type { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; +import type { bopsSubmissionSchema, emailSubmissionSchema, s3SubmissionSchema, diff --git a/api.planx.uk/modules/webhooks/service/validateInput/schema.ts b/api.planx.uk/modules/webhooks/service/validateInput/schema.ts index 2a6ba837b6..05e1f4ff93 100644 --- a/api.planx.uk/modules/webhooks/service/validateInput/schema.ts +++ b/api.planx.uk/modules/webhooks/service/validateInput/schema.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; +import type { ValidatedRequestHandler } from "../../../../shared/middleware/validate.js"; import { isCleanHTML, isObjectValid } from "./utils.js"; // Definition: https://hasura.io/docs/latest/schema/postgres/input-validations/#response diff --git a/api.planx.uk/package.json b/api.planx.uk/package.json index 024e9d2578..fde1da959d 100644 --- a/api.planx.uk/package.json +++ b/api.planx.uk/package.json @@ -53,7 +53,6 @@ "string-to-stream": "^3.0.1", "swagger-jsdoc": "^6.2.8", "swagger-ui-express": "^5.0.0", - "ts-node": "^10.9.2", "type-fest": "^4.18.1", "zod": "^3.23.5" }, diff --git a/api.planx.uk/pnpm-lock.yaml b/api.planx.uk/pnpm-lock.yaml index 4209b25d22..098716f372 100644 --- a/api.planx.uk/pnpm-lock.yaml +++ b/api.planx.uk/pnpm-lock.yaml @@ -139,9 +139,6 @@ dependencies: swagger-ui-express: specifier: ^5.0.0 version: 5.0.0(express@4.21.0) - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@types/node@18.19.13)(typescript@5.5.2) type-fest: specifier: ^4.18.1 version: 4.18.1 @@ -667,13 +664,6 @@ packages: to-fast-properties: 2.0.0 dev: true - /@cspotcode/source-map-support@0.8.1: - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - dev: false - /@emotion/babel-plugin@11.12.0: resolution: {integrity: sha512-y2WQb+oP8Jqvvclh8Q55gLUyb7UFvgv7eJfsj7td5TToBrIUtPay2kMrZi4xjq9qw2vD0ZR5fSho0yqoFgX7Rw==} dependencies: @@ -1163,13 +1153,6 @@ packages: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - /@jridgewell/trace-mapping@0.3.9: - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.0 - dev: false - /@jsdevtools/ono@7.1.3: resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} dev: false @@ -1506,22 +1489,6 @@ packages: dev: true optional: true - /@tsconfig/node10@1.0.11: - resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} - dev: false - - /@tsconfig/node12@1.0.11: - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - dev: false - - /@tsconfig/node14@1.0.3: - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - dev: false - - /@tsconfig/node16@1.0.4: - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - dev: false - /@types/adm-zip@0.5.0: resolution: {integrity: sha512-FCJBJq9ODsQZUNURo5ILAQueuA8WJhRvuihS3ke2iI25mJlfV2LK8jG2Qj2z2AWg8U0FtWWqBHVRetceLskSaw==} dependencies: @@ -2075,13 +2042,6 @@ packages: dependencies: acorn: 8.12.1 - /acorn-walk@8.3.3: - resolution: {integrity: sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==} - engines: {node: '>=0.4.0'} - dependencies: - acorn: 8.12.1 - dev: false - /acorn@8.12.1: resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} engines: {node: '>=0.4.0'} @@ -2168,10 +2128,6 @@ packages: resolution: {integrity: sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==} dev: false - /arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - dev: false - /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} @@ -2634,10 +2590,6 @@ packages: yaml: 1.10.2 dev: false - /create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - dev: false - /cross-fetch@3.1.8: resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} dependencies: @@ -2813,11 +2765,6 @@ packages: engines: {node: '>=0.3.1'} dev: true - /diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - dev: false - /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -4326,10 +4273,6 @@ packages: semver: 7.6.3 dev: true - /make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - dev: false - /marked@14.1.2: resolution: {integrity: sha512-f3r0yqpz31VXiDB/wj9GaOB0a2PRLQl6vJmXiFrniNwjkKdvakqJRULhjFKJpxOchlCRiG5fcacoUZY5Xa6PEQ==} engines: {node: '>= 18'} @@ -5695,37 +5638,6 @@ packages: dependencies: punycode: 2.3.1 - /ts-node@10.9.2(@types/node@18.19.13)(typescript@5.5.2): - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 18.19.13 - acorn: 8.12.1 - acorn-walk: 8.3.3 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.5.2 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - dev: false - /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true @@ -5801,6 +5713,7 @@ packages: resolution: {integrity: sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==} engines: {node: '>=14.17'} hasBin: true + dev: true /uid2@0.0.4: resolution: {integrity: sha512-IevTus0SbGwQzYh3+fRsAMTVVPOoIVufzacXcHPmdlle1jUpq7BRL+mw3dgeLanvGZdwwbWhRV6XrcFNdBmjWA==} @@ -5885,10 +5798,6 @@ packages: hasBin: true dev: false - /v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - dev: false - /validator@13.12.0: resolution: {integrity: sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==} engines: {node: '>= 0.10'} @@ -6204,11 +6113,6 @@ packages: yargs-parser: 20.2.9 dev: false - /yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - dev: false - /yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} diff --git a/api.planx.uk/rateLimit.ts b/api.planx.uk/rateLimit.ts index c62a9fe281..202eaea528 100644 --- a/api.planx.uk/rateLimit.ts +++ b/api.planx.uk/rateLimit.ts @@ -1,4 +1,4 @@ -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import rateLimit from "express-rate-limit"; // Broad limiter to prevent egregious abuse diff --git a/api.planx.uk/server.ts b/api.planx.uk/server.ts index 1c4b249984..53336b40c7 100644 --- a/api.planx.uk/server.ts +++ b/api.planx.uk/server.ts @@ -1,12 +1,12 @@ -import { Role } from "@opensystemslab/planx-core/types"; +import type { Role } from "@opensystemslab/planx-core/types"; import assert from "assert"; import bodyParser from "body-parser"; import cookieParser from "cookie-parser"; import cookieSession from "cookie-session"; -import cors, { CorsOptions } from "cors"; -import express from "express"; +import type { CorsOptions } from "cors"; +import cors from "cors"; import type { ErrorRequestHandler, Request } from "express"; -import "express-async-errors"; +import express from "express"; import pinoLogger from "express-pino-logger"; import helmet from "helmet"; import { Server, type IncomingMessage } from "http"; diff --git a/api.planx.uk/session.ts b/api.planx.uk/session.ts index 518d35190f..90350f13e2 100644 --- a/api.planx.uk/session.ts +++ b/api.planx.uk/session.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "http-proxy-middleware"; +import type { RequestHandler } from "http-proxy-middleware"; // this middleware registers dummy methods on req.session to resolve passport/cookie-session incompatibility export const registerSessionStubs: RequestHandler = (req, _res, next): void => { diff --git a/api.planx.uk/shared/middleware/proxy.ts b/api.planx.uk/shared/middleware/proxy.ts index 7a3d1c7177..004764b1fb 100644 --- a/api.planx.uk/shared/middleware/proxy.ts +++ b/api.planx.uk/shared/middleware/proxy.ts @@ -1,4 +1,5 @@ -import { createProxyMiddleware, Options } from "http-proxy-middleware"; +import type { Options } from "http-proxy-middleware"; +import { createProxyMiddleware } from "http-proxy-middleware"; // debug, info, warn, error, silent const LOG_LEVEL = process.env.NODE_ENV === "test" ? "silent" : "debug"; diff --git a/api.planx.uk/shared/middleware/validate.ts b/api.planx.uk/shared/middleware/validate.ts index d3e850d214..5886664f5f 100644 --- a/api.planx.uk/shared/middleware/validate.ts +++ b/api.planx.uk/shared/middleware/validate.ts @@ -1,5 +1,5 @@ -import { Request, RequestHandler, Response, NextFunction } from "express"; -import { z } from "zod"; +import type { Request, RequestHandler, Response, NextFunction } from "express"; +import type { z } from "zod"; /** * Middleware to validate incoming requests to the API diff --git a/api.planx.uk/tests/mockJWT.ts b/api.planx.uk/tests/mockJWT.ts index 5e90671e6f..6ee27a35e4 100644 --- a/api.planx.uk/tests/mockJWT.ts +++ b/api.planx.uk/tests/mockJWT.ts @@ -1,4 +1,4 @@ -import { Role } from "@opensystemslab/planx-core/types"; +import type { Role } from "@opensystemslab/planx-core/types"; import { sign } from "jsonwebtoken"; function getJWT({ role }: { role: Role }) { diff --git a/api.planx.uk/tests/mocks/flattenPortals.ts b/api.planx.uk/tests/mocks/flattenPortals.ts index 990575dc4e..b0f6aa3546 100644 --- a/api.planx.uk/tests/mocks/flattenPortals.ts +++ b/api.planx.uk/tests/mocks/flattenPortals.ts @@ -1,4 +1,4 @@ -import { FlowGraph } from "@opensystemslab/planx-core/types"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; export const mockDraftParent: FlowGraph = { _root: { diff --git a/api.planx.uk/tests/mocks/inviteToPayData.ts b/api.planx.uk/tests/mocks/inviteToPayData.ts index d16dd52670..7b7958794d 100644 --- a/api.planx.uk/tests/mocks/inviteToPayData.ts +++ b/api.planx.uk/tests/mocks/inviteToPayData.ts @@ -3,7 +3,7 @@ import type { PaymentRequest, FlowGraph, } from "@opensystemslab/planx-core/types"; -import { Flow } from "../../types.js"; +import type { Flow } from "../../types.js"; export const validEmail = "the-payee@opensystemslab.io"; diff --git a/api.planx.uk/tests/mocks/saveAndReturnMocks.ts b/api.planx.uk/tests/mocks/saveAndReturnMocks.ts index 648ff7ea1f..5900d2b9aa 100644 --- a/api.planx.uk/tests/mocks/saveAndReturnMocks.ts +++ b/api.planx.uk/tests/mocks/saveAndReturnMocks.ts @@ -1,6 +1,6 @@ import { v4 as uuidV4 } from "uuid"; import type { LowCalSession, Flow } from "../../types.js"; -import { Team } from "@opensystemslab/planx-core/types"; +import type { Team } from "@opensystemslab/planx-core/types"; export const mockTeam = { id: 1, diff --git a/api.planx.uk/tests/mocks/validateAndPublishMocks.ts b/api.planx.uk/tests/mocks/validateAndPublishMocks.ts index d3db8718cf..3c9ec73c72 100644 --- a/api.planx.uk/tests/mocks/validateAndPublishMocks.ts +++ b/api.planx.uk/tests/mocks/validateAndPublishMocks.ts @@ -1,4 +1,4 @@ -import { FlowGraph } from "@opensystemslab/planx-core/types"; +import type { FlowGraph } from "@opensystemslab/planx-core/types"; export const mockFlowData: FlowGraph = { _root: { diff --git a/api.planx.uk/tsconfig.json b/api.planx.uk/tsconfig.json index 91fa3cb1b1..546e50d1fe 100644 --- a/api.planx.uk/tsconfig.json +++ b/api.planx.uk/tsconfig.json @@ -16,8 +16,7 @@ "target": "esnext", "types": ["vitest/globals"], // ensure the code is ready for per-file transpilation by tsx (used in dev mode) - "isolatedModules": true, - // TODO: implement "verbatimModuleSyntax" option (laborious) + "verbatimModuleSyntax": true, }, "exclude": ["node_modules", "dist"], } diff --git a/api.planx.uk/types.ts b/api.planx.uk/types.ts index 2c1bbf7378..bc3fd4f55e 100644 --- a/api.planx.uk/types.ts +++ b/api.planx.uk/types.ts @@ -1,4 +1,4 @@ -import { +import type { GovUKPayment, Team, PaymentRequest,