diff --git a/.yarnrc.yml b/.yarnrc.yml index 3d497e149..754811f11 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -15,6 +15,9 @@ packageExtensions: qs: "*" regenerator-runtime: "*" traverse: "*" + terser-webpack-plugin@*: + dependencies: + "@types/terser": "*" vue-router@*: dependencies: "@vue/runtime-dom": "*" diff --git a/package.json b/package.json index 4c88b7a1b..4b90df66e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build-client": "webpack --config out/server/infra/build-client/webpack.prod.js", "build-client:dev": "webpack --config out/server/infra/build-client/webpack.dev.js", "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue --max-warnings=0", - "build-server": "ttsc", + "build-server": "tsc", "clean": "rm -rf out/ && rm -rf static/dist/", "pretty-check": "prettier --check .", "start": "yarn node out/server/bin/witness/witness.js", @@ -62,6 +62,7 @@ "@babel/types": "^7.17.10", "@sentry/browser": "^6.19.7", "@sentry/tracing": "^6.19.7", + "@types/axios": "^0.14.0", "@types/bluebird": "^3.5.36", "@types/body-parser": "^1.19.2", "@types/cookie-parser": "^1.4.3", @@ -70,6 +71,7 @@ "@types/csurf": "^1.11.2", "@types/events": "^3", "@types/express": "^4.17.13", + "@types/express-rate-limit": "^6.0.0", "@types/heapdump": "^0.3.1", "@types/imagemin": "^8", "@types/jest": "^27.4.1", @@ -84,6 +86,7 @@ "@types/sqlite3": "^3.1.8", "@types/svgo": "^2.6.3", "@types/swagger-ui": "^3.52.0", + "@types/terser": "^3.12.0", "@types/tmp": "^0.2.3", "@types/underscore": "^1.11.4", "@types/verror": "^1.10.5", @@ -93,7 +96,6 @@ "@typescript-eslint/parser": "^5.21.0", "@vue/compiler-sfc": "^3.2.33", "@vue/runtime-dom": "^3.2.33", - "@zoltu/typescript-transformer-append-js-extension": "^1.0.1", "buffer": "^6.0.3", "clean-webpack-plugin": "^4.0.0", "cleanup-mini-css-extract-plugin": "^1.1.1", @@ -126,7 +128,6 @@ "terser-webpack-plugin": "^5.3.1", "ts-jest": "^27.1.4", "ts-loader": "^9.2.9", - "ttypescript": "^1.5.13", "typescript": "4.7.0-beta", "url": "^0.11.0", "vue": "^3.2.33", diff --git a/src/bin/updatedb.ts b/src/bin/updatedb.ts index 7168ea7e2..4c754abfa 100644 --- a/src/bin/updatedb.ts +++ b/src/bin/updatedb.ts @@ -33,7 +33,7 @@ */ import { fileURLToPath } from "url"; -import { getPostgresKnex } from "../db/getPostgresKnex"; +import { getPostgresKnex } from "../db/getPostgresKnex.js"; // Directory is relative to project root const MIGRATE_CONFIG = { @@ -45,7 +45,7 @@ const knex = getPostgresKnex(); export function updateDb(revert: boolean): Promise { if (revert) { console.log("Reverting schema changes..."); - return knex.migrate.rollback(MIGRATE_CONFIG).then((reverts) => { + return knex!.migrate.rollback(MIGRATE_CONFIG).then((reverts) => { const batch = reverts[0]; const scripts = reverts[1]; if (scripts.length > 0) { @@ -60,7 +60,7 @@ export function updateDb(revert: boolean): Promise { } else { // Proceed with an update to latest schema console.log("Updating..."); - return knex.migrate.latest(MIGRATE_CONFIG).then((updates) => { + return knex!.migrate.latest(MIGRATE_CONFIG).then((updates) => { const batch = updates[0]; const scripts = updates[1]; if (scripts.length > 0) { diff --git a/src/bin/witness/ProcessControl.ts b/src/bin/witness/ProcessControl.ts index 290252230..a80d70a2f 100644 --- a/src/bin/witness/ProcessControl.ts +++ b/src/bin/witness/ProcessControl.ts @@ -2,7 +2,7 @@ import * as child_process from "child_process"; import { ChildProcess } from "child_process"; -import * as logger from "./logger"; +import * as logger from "./logger.js"; /** * Manages the lifecycle of the child and parent processes. diff --git a/src/bin/witness/RotatingFileLogWriter.ts b/src/bin/witness/RotatingFileLogWriter.ts index 69be2b662..213a608d5 100644 --- a/src/bin/witness/RotatingFileLogWriter.ts +++ b/src/bin/witness/RotatingFileLogWriter.ts @@ -3,17 +3,17 @@ import * as path from "path"; import moment from "moment"; import { Writable } from "stream"; import { WriteStream } from "fs"; -import { BasicCallback } from "../../util/stream/core"; +import { BasicCallback } from "../../util/stream/core.js"; import { Moment } from "moment"; -import { asyncEach } from "./asyncEach"; -import { pruneOldLogs } from "./pruneOldLogs"; -import * as logger from "./logger"; +import { asyncEach } from "./asyncEach.js"; +import { pruneOldLogs } from "./pruneOldLogs.js"; +import * as logger from "./logger.js"; import { formatLogFilename, getLogFormatSpecifier, formatOutputLine, parseInputLine, -} from "./protocol"; +} from "./protocol.js"; /** * Writes log output to a text file. diff --git a/src/bin/witness/asyncEach.ts b/src/bin/witness/asyncEach.ts index f0c3d2276..4aee97b05 100644 --- a/src/bin/witness/asyncEach.ts +++ b/src/bin/witness/asyncEach.ts @@ -1,4 +1,4 @@ -import { BasicCallback } from "../../util/stream/core"; +import { BasicCallback } from "../../util/stream/core.js"; /** * Array iteration for callback-based async execution. diff --git a/src/bin/witness/pruneOldLogs.ts b/src/bin/witness/pruneOldLogs.ts index 7459d09b3..353d25e59 100644 --- a/src/bin/witness/pruneOldLogs.ts +++ b/src/bin/witness/pruneOldLogs.ts @@ -1,10 +1,10 @@ import * as fs from "fs"; import * as path from "path"; import moment from "moment"; -import { asyncEach } from "./asyncEach"; -import { BasicCallback } from "../../util/stream/core"; -import { parseLogFilename } from "./protocol"; -import * as logger from "./logger"; +import { asyncEach } from "./asyncEach.js"; +import { BasicCallback } from "../../util/stream/core.js"; +import { parseLogFilename } from "./protocol.js"; +import * as logger from "./logger.js"; /** * Deletes any log files older than MAX_LOG_LIFETIME. diff --git a/src/bin/witness/witness.ts b/src/bin/witness/witness.ts index 79805feb2..c7e2ace63 100644 --- a/src/bin/witness/witness.ts +++ b/src/bin/witness/witness.ts @@ -1,8 +1,8 @@ import moment from "moment"; -import { ProcessControl } from "./ProcessControl"; -import { RotatingFileLogWriter } from "./RotatingFileLogWriter"; -import { getRootPath } from "./getRootPath"; -import * as logger from "./logger"; +import { ProcessControl } from "./ProcessControl.js"; +import { RotatingFileLogWriter } from "./RotatingFileLogWriter.js"; +import { getRootPath } from "./getRootPath.js"; +import * as logger from "./logger.js"; import path from "path"; import { fileURLToPath } from "url"; diff --git a/src/client/character/skills.ts b/src/client/character/skills.ts index c3c79760f..b61c71f95 100644 --- a/src/client/character/skills.ts +++ b/src/client/character/skills.ts @@ -40,7 +40,7 @@ for (let i = 0; i < GROUP_DISPLAY_ORDER.length; i++) { }; } -import * as api from "../../route/api/character/skills"; +import * as api from "../../route/api/character/skills.js"; export interface Skill extends api.Skill { queuedLevel?: number; diff --git a/src/client/home.ts b/src/client/home.ts index e6ca3ac4b..fc0ddeda1 100644 --- a/src/client/home.ts +++ b/src/client/home.ts @@ -29,9 +29,9 @@ import BattleDetail from "./srp/battles/BattleDetail.vue"; import ShipsBorrowedByMe from "./ships/ShipsBorrowedByMe.vue"; import AllBorrowedShips from "./ships/AllBorrowedShips.vue"; -import { configureCsrfInterceptor } from "./shared/ajaxer"; +import { configureCsrfInterceptor } from "./shared/ajaxer.js"; -import { SimpleMap } from "../util/simpleTypes"; +import { SimpleMap } from "../util/simpleTypes.js"; // Anything added here should also be in server.js:FRONTEND_ROUTES // TODO(aiiane): make server.js just read it directly from here diff --git a/src/client/login.ts b/src/client/login.ts index 3a545b852..3c44e9ec7 100644 --- a/src/client/login.ts +++ b/src/client/login.ts @@ -2,11 +2,11 @@ import "./sentry"; import "./css/login.css"; -import bg0 from "./res/background/0.jpg"; -import bg1 from "./res/background/1.jpg"; -import bg2 from "./res/background/2.jpg"; -import bg3 from "./res/background/3.jpg"; -import bg4 from "./res/background/4.jpg"; +import bg0 from "./res/background/0.jpg.js"; +import bg1 from "./res/background/1.jpg.js"; +import bg2 from "./res/background/2.jpg.js"; +import bg3 from "./res/background/3.jpg.js"; +import bg4 from "./res/background/4.jpg.js"; const backgrounds = [bg0, bg1, bg2, bg3, bg4]; const root = document.getElementById("root"); diff --git a/src/client/roster/rosterColumns.ts b/src/client/roster/rosterColumns.ts index 80c93070f..aa7a0904b 100644 --- a/src/client/roster/rosterColumns.ts +++ b/src/client/roster/rosterColumns.ts @@ -1,4 +1,4 @@ -import { Character, Account } from "./types"; +import { Character, Account } from "./types.js"; interface RenderColumn { label: string; diff --git a/src/client/roster/types.ts b/src/client/roster/types.ts index e332557af..54432ba97 100644 --- a/src/client/roster/types.ts +++ b/src/client/roster/types.ts @@ -1,4 +1,4 @@ -import * as serverTypes from "../../route/api/roster"; +import * as serverTypes from "../../route/api/roster.js"; export interface Character extends serverTypes.CharacterJson { totalSp?: number; diff --git a/src/client/shared/ajaxer.ts b/src/client/shared/ajaxer.ts index f497f5767..672b3c0cb 100644 --- a/src/client/shared/ajaxer.ts +++ b/src/client/shared/ajaxer.ts @@ -1,13 +1,19 @@ import axios, { AxiosResponse } from "axios"; -import { Output as syncStatus_Output } from "../../route/api/admin/roster/syncStatus_GET"; -import { Output as dashboard_Output } from "../../route/api/dashboard"; -import { Output as character_Output } from "../../route/api/character"; -import { Triage, Battles, Losses, Transaction, Payments } from "../srp/types"; -import { Task, Job, Log, Citadel } from "../admin/types"; -import { Account } from "../roster/types"; -import { CharacterDescription } from "../../route/api/account/characters_GET"; -import { Payload as skills_Payload } from "../../route/api/character/skills"; -import { Ship } from "../ships/ships"; +import { Output as syncStatus_Output } from "../../route/api/admin/roster/syncStatus_GET.js"; +import { Output as dashboard_Output } from "../../route/api/dashboard.js"; +import { Output as character_Output } from "../../route/api/character.js"; +import { + Triage, + Battles, + Losses, + Transaction, + Payments, +} from "../srp/types.js"; +import { Task, Job, Log, Citadel } from "../admin/types.js"; +import { Account } from "../roster/types.js"; +import { CharacterDescription } from "../../route/api/account/characters_GET.js"; +import { Payload as skills_Payload } from "../../route/api/character/skills.js"; +import { Ship } from "../ships/ships.js"; export function configureCsrfInterceptor(token: string) { axios.interceptors.request.use( diff --git a/src/client/shared/nameCache.ts b/src/client/shared/nameCache.ts index 5b14c873e..b5d0dddca 100644 --- a/src/client/shared/nameCache.ts +++ b/src/client/shared/nameCache.ts @@ -12,7 +12,7 @@ const nameCache = new Map(); * map, it should call addNames(). This allows any child components to * access the map without it being passed to them explicitly. */ -import { SimpleNumMap } from "../../util/simpleTypes"; +import { SimpleNumMap } from "../../util/simpleTypes.js"; export const NameCacheMixin = { methods: { addNames(names: SimpleNumMap) { diff --git a/src/client/srp/types.ts b/src/client/srp/types.ts index 4b1c2972a..c331c7551 100644 --- a/src/client/srp/types.ts +++ b/src/client/srp/types.ts @@ -1,4 +1,4 @@ -import { SimpleNumMap } from "../../util/simpleTypes"; +import { SimpleNumMap } from "../../util/simpleTypes.js"; export interface Loss { payout: number; diff --git a/src/data-source/accessToken/TokenRefresher.ts b/src/data-source/accessToken/TokenRefresher.ts index 35c7fb9c0..6773bc80a 100644 --- a/src/data-source/accessToken/TokenRefresher.ts +++ b/src/data-source/accessToken/TokenRefresher.ts @@ -1,12 +1,12 @@ import * as querystring from "querystring"; -import axios from "axios"; +import axios, { AxiosError } from "axios"; -import { AccessToken } from "../../db/tables"; -import { AccessTokenErrorType } from "../../error/AccessTokenError"; +import { AccessToken } from "../../db/tables.js"; +import { AccessTokenErrorType } from "../../error/AccessTokenError.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; -import { fetchAuthInfo } from "./jwt"; +import { fetchAuthInfo } from "./jwt.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); @@ -67,7 +67,7 @@ export class TokenRefresher { accessToken_needsUpdate: false, }; } catch (e) { - if (!axios.isAxiosError(e)) { + if (!(e instanceof AxiosError) || e.isAxiosError !== true) { throw e; } diff --git a/src/data-source/accessToken/accessToken.ts b/src/data-source/accessToken/accessToken.ts index 8014bb1f4..764d1386e 100644 --- a/src/data-source/accessToken/accessToken.ts +++ b/src/data-source/accessToken/accessToken.ts @@ -1,15 +1,15 @@ -import { dao } from "../../db/dao"; -import { Tnex } from "../../db/tnex/index"; -import { AccessToken } from "../../db/tables"; +import { dao } from "../../db/dao.js"; +import { Tnex } from "../../db/tnex/index.js"; +import { AccessToken } from "../../db/tables.js"; import { AccessTokenError, AccessTokenErrorType, -} from "../../error/AccessTokenError"; +} from "../../error/AccessTokenError.js"; import { RefreshResult, TokenRefresher, AccessTokenUpdate, -} from "./TokenRefresher"; +} from "./TokenRefresher.js"; const TOKEN_EXPIRATION_FUDGE_MS = 1000; // 1 second const tokenRefresher = new TokenRefresher(); diff --git a/src/data-source/accessToken/decs.d.ts b/src/data-source/accessToken/decs.d.ts new file mode 100644 index 000000000..93674042d --- /dev/null +++ b/src/data-source/accessToken/decs.d.ts @@ -0,0 +1 @@ +declare module "jose"; diff --git a/src/data-source/accessToken/jwt.ts b/src/data-source/accessToken/jwt.ts index f8bee1b77..f30a4d800 100644 --- a/src/data-source/accessToken/jwt.ts +++ b/src/data-source/accessToken/jwt.ts @@ -1,18 +1,18 @@ -import { createRemoteJWKSet, jwtVerify, JWTPayload } from "jose"; +import { default as jose } from "jose"; export async function fetchAuthInfo( accessToken: string -): Promise { - const result = await jwtVerify( +): Promise { + const result = await jose.jwtVerify( accessToken, - createRemoteJWKSet(new URL("https://login.eveonline.com/oauth/jwks"), { + jose.createRemoteJWKSet(new URL("https://login.eveonline.com/oauth/jwks"), { cacheMaxAge: Infinity, }), { issuer: "login.eveonline.com", } ); - return result.payload; + return result.payload; } interface AuthInfoResponse { diff --git a/src/data-source/esi/endpoints.ts b/src/data-source/esi/endpoints.ts index 94444a0a8..31aa253ac 100644 --- a/src/data-source/esi/endpoints.ts +++ b/src/data-source/esi/endpoints.ts @@ -1,7 +1,7 @@ -import { EsiAsset } from "./EsiAsset"; -import { FetchMethod, Private, Public } from "./EsiEndpoint"; -import { EsiKillmail } from "./EsiKillmail"; -import { EsiNotification } from "./EsiNotification"; +import { EsiAsset } from "./EsiAsset.js"; +import { FetchMethod, Private, Public } from "./EsiEndpoint.js"; +import { EsiKillmail } from "./EsiKillmail.js"; +import { EsiNotification } from "./EsiNotification.js"; /** * Supported endpoints in the ESI API diff --git a/src/data-source/esi/error.ts b/src/data-source/esi/error.ts index e4ac9780e..c86e275dc 100644 --- a/src/data-source/esi/error.ts +++ b/src/data-source/esi/error.ts @@ -1,4 +1,4 @@ -import { EsiError, EsiErrorKind } from "./EsiError"; +import { EsiError, EsiErrorKind } from "./EsiError.js"; import VError from "verror"; import { inspect } from "util"; diff --git a/src/data-source/esi/fetch/EsiEndpointParams.ts b/src/data-source/esi/fetch/EsiEndpointParams.ts index ef2e89766..8e1a9fcd8 100644 --- a/src/data-source/esi/fetch/EsiEndpointParams.ts +++ b/src/data-source/esi/fetch/EsiEndpointParams.ts @@ -1,4 +1,4 @@ -import { EsiEndpoint, Private } from "../EsiEndpoint"; +import { EsiEndpoint, Private } from "../EsiEndpoint.js"; /** * Given an ESI endpoint, assembles a unified "params" type object for use in diff --git a/src/data-source/esi/fetch/buildEsiFetchConfig.ts b/src/data-source/esi/fetch/buildEsiFetchConfig.ts index f31448698..2fbca2c30 100644 --- a/src/data-source/esi/fetch/buildEsiFetchConfig.ts +++ b/src/data-source/esi/fetch/buildEsiFetchConfig.ts @@ -1,8 +1,8 @@ -import { EsiEndpoint } from "../EsiEndpoint"; +import { EsiEndpoint } from "../EsiEndpoint.js"; import { AxiosRequestConfig } from "axios"; -import { MixedObject } from "../../../util/simpleTypes"; +import { MixedObject } from "../../../util/simpleTypes.js"; import { inspect } from "util"; -import { EsiEndpointParams } from "./EsiEndpointParams"; +import { EsiEndpointParams } from "./EsiEndpointParams.js"; export function buildEsiFetchConfig( baseUrl: string, diff --git a/src/data-source/esi/fetch/checkEsiResponseForWarnings.ts b/src/data-source/esi/fetch/checkEsiResponseForWarnings.ts index 1ae35aec0..07315a33a 100644 --- a/src/data-source/esi/fetch/checkEsiResponseForWarnings.ts +++ b/src/data-source/esi/fetch/checkEsiResponseForWarnings.ts @@ -1,8 +1,8 @@ import moment from "moment"; -import { EsiEndpoint } from "../EsiEndpoint"; +import { EsiEndpoint } from "../EsiEndpoint.js"; import { AxiosResponse } from "axios"; -import { SimpleMap } from "../../../util/simpleTypes"; -import { buildLogger } from "../../../infra/logging/buildLogger"; +import { SimpleMap } from "../../../util/simpleTypes.js"; +import { buildLogger } from "../../../infra/logging/buildLogger.js"; const logger = buildLogger("esi"); diff --git a/src/data-source/esi/fetch/fetchEsi.ts b/src/data-source/esi/fetch/fetchEsi.ts index a54e5b259..caf804550 100644 --- a/src/data-source/esi/fetch/fetchEsi.ts +++ b/src/data-source/esi/fetch/fetchEsi.ts @@ -1,9 +1,9 @@ -import axios, { AxiosResponse } from "axios"; -import { EsiEndpoint } from "../EsiEndpoint"; -import { EsiError, EsiErrorKind } from "../EsiError"; -import { buildEsiFetchConfig } from "./buildEsiFetchConfig"; -import { checkEsiResponseForWarnings } from "./checkEsiResponseForWarnings"; -import { EsiEndpointParams } from "./EsiEndpointParams"; +import axios, { AxiosResponse, AxiosError } from "axios"; +import { EsiEndpoint } from "../EsiEndpoint.js"; +import { EsiError, EsiErrorKind } from "../EsiError.js"; +import { buildEsiFetchConfig } from "./buildEsiFetchConfig.js"; +import { checkEsiResponseForWarnings } from "./checkEsiResponseForWarnings.js"; +import { EsiEndpointParams } from "./EsiEndpointParams.js"; /** * Loads a particular ESI endpoint. @@ -53,7 +53,7 @@ async function fetchEsiImpl( } catch (err) { let errKind = EsiErrorKind.GENERIC_ERROR; - if (!axios.isAxiosError(err)) { + if (!(err instanceof AxiosError) || err.isAxiosError !== false) { throw err; } diff --git a/src/data-source/esi/names.ts b/src/data-source/esi/names.ts index b51caffda..951c0ba85 100644 --- a/src/data-source/esi/names.ts +++ b/src/data-source/esi/names.ts @@ -1,10 +1,10 @@ -import { SimpleNumMap, nil } from "../../util/simpleTypes"; -import { isAnyEsiError, printError } from "./error"; -import { UNKNOWN_CORPORATION_ID } from "../../db/constants"; +import { SimpleNumMap, nil } from "../../util/simpleTypes.js"; +import { isAnyEsiError, printError } from "./error.js"; +import { UNKNOWN_CORPORATION_ID } from "../../db/constants.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; -import { ESI_UNIVERSE_NAMES } from "./endpoints"; -import { fetchEsi } from "./fetch/fetchEsi"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; +import { ESI_UNIVERSE_NAMES } from "./endpoints.js"; +import { fetchEsi } from "./fetch/fetchEsi.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/data-source/evemarketer/fetchJitaSellPrices.ts b/src/data-source/evemarketer/fetchJitaSellPrices.ts index ba4c1a6e2..85d559d6b 100644 --- a/src/data-source/evemarketer/fetchJitaSellPrices.ts +++ b/src/data-source/evemarketer/fetchJitaSellPrices.ts @@ -1,13 +1,13 @@ -import axios from "axios"; +import { AxiosError } from "axios"; import moment from "moment"; import { inspect } from "util"; -import { ExpirationCache } from "../../util/ExpirationCache"; -import { fetchMarketStats } from "./fetchMarketStats"; -import { SYSTEM_JITA } from "../../eve/constants/mapSolarSystems"; -import { MarketStat } from "./MarketStat"; +import { ExpirationCache } from "../../util/ExpirationCache.js"; +import { fetchMarketStats } from "./fetchMarketStats.js"; +import { SYSTEM_JITA } from "../../eve/constants/mapSolarSystems.js"; +import { MarketStat } from "./MarketStat.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); @@ -32,7 +32,7 @@ export async function fetchJitaSellPrices(ids: number[]) { useSystem: SYSTEM_JITA, }); } catch (err) { - if (!axios.isAxiosError(err)) { + if (!(err instanceof AxiosError) || err.isAxiosError !== true) { throw err; } logger.warn(`Error while trying to retrieve market stats:`); diff --git a/src/data-source/evemarketer/fetchMarketStats.ts b/src/data-source/evemarketer/fetchMarketStats.ts index c3bdc40f1..cb85c97b6 100644 --- a/src/data-source/evemarketer/fetchMarketStats.ts +++ b/src/data-source/evemarketer/fetchMarketStats.ts @@ -1,5 +1,5 @@ import axios from "axios"; -import { MarketStat } from "./MarketStat"; +import { MarketStat } from "./MarketStat.js"; const BASE_URL = `https://api.evemarketer.com/ec`; diff --git a/src/data-source/zkillboard/ZKillmail.ts b/src/data-source/zkillboard/ZKillmail.ts index f4e16103c..4f02125e9 100644 --- a/src/data-source/zkillboard/ZKillmail.ts +++ b/src/data-source/zkillboard/ZKillmail.ts @@ -1,4 +1,4 @@ -import { EsiKillmail } from "../esi/EsiKillmail"; +import { EsiKillmail } from "../esi/EsiKillmail.js"; /** * Meta-object created by joining the output of ZKill and ESI. This used to be diff --git a/src/data-source/zkillboard/ZKillmailStream.ts b/src/data-source/zkillboard/ZKillmailStream.ts index 661d8456a..3a359bf49 100644 --- a/src/data-source/zkillboard/ZKillmailStream.ts +++ b/src/data-source/zkillboard/ZKillmailStream.ts @@ -1,6 +1,6 @@ -import { Readable } from "../../util/stream/Readable"; -import { ZKillDescriptor } from "./ZKillmail"; -import { fetchZKillResultPage } from "./fetchZKillResultPage"; +import { Readable } from "../../util/stream/Readable.js"; +import { ZKillDescriptor } from "./ZKillmail.js"; +import { fetchZKillResultPage } from "./fetchZKillResultPage.js"; /** * Readable stream representing a query for a ZKillboard API. diff --git a/src/data-source/zkillboard/fetchZKillResultPage.ts b/src/data-source/zkillboard/fetchZKillResultPage.ts index 34aed6eb5..6cef5179f 100644 --- a/src/data-source/zkillboard/fetchZKillResultPage.ts +++ b/src/data-source/zkillboard/fetchZKillResultPage.ts @@ -1,7 +1,7 @@ import * as util from "util"; import axios from "axios"; -import { ZKillDescriptor } from "./ZKillmail"; -import { RateLimiter } from "../../util/RateLimiter"; +import { ZKillDescriptor } from "./ZKillmail.js"; +import { RateLimiter } from "../../util/RateLimiter.js"; /** * Fetches a specific page of a specific ZKill URL. diff --git a/src/db/dao.ts b/src/db/dao.ts index ad30afa9f..bdd404a7d 100644 --- a/src/db/dao.ts +++ b/src/db/dao.ts @@ -1,24 +1,24 @@ -import AccessTokenDao from "./dao/AccessTokenDao"; -import AccountDao from "./dao/AccountDao"; -import BattleDao from "./dao/BattleDao"; -import CharacterDao from "./dao/CharacterDao"; -import CharacterLocationDao from "./dao/CharacterLocationDao"; -import CharacterNotificationDao from "./dao/CharacterNotificationDao"; -import CharacterShipDao from "./dao/CharacterShipDao"; -import CitadelDao from "./dao/CitadelDao"; -import CombatStatsDao from "./dao/CombatStatsDao"; -import ConfigDao from "./dao/ConfigDao"; -import CronDao from "./dao/CronDao"; -import GroupsDao from "./dao/GroupsDao"; -import KillmailDao from "./dao/KillmailDao"; -import LogDao from "./dao/LogDao"; -import OwnershipDao from "./dao/OwnershipDao"; -import RosterDao from "./dao/RosterDao"; -import SdeDao from "./dao/SdeDao"; -import SkillQueueDao from "./dao/SkillQueueDao"; -import SkillsheetDao from "./dao/SkillsheetDao"; -import SrpDao from "./dao/SrpDao"; -import StatisticsDao from "./dao/StatisticsDao"; +import AccessTokenDao from "./dao/AccessTokenDao.js"; +import AccountDao from "./dao/AccountDao.js"; +import BattleDao from "./dao/BattleDao.js"; +import CharacterDao from "./dao/CharacterDao.js"; +import CharacterLocationDao from "./dao/CharacterLocationDao.js"; +import CharacterNotificationDao from "./dao/CharacterNotificationDao.js"; +import CharacterShipDao from "./dao/CharacterShipDao.js"; +import CitadelDao from "./dao/CitadelDao.js"; +import CombatStatsDao from "./dao/CombatStatsDao.js"; +import ConfigDao from "./dao/ConfigDao.js"; +import CronDao from "./dao/CronDao.js"; +import GroupsDao from "./dao/GroupsDao.js"; +import KillmailDao from "./dao/KillmailDao.js"; +import LogDao from "./dao/LogDao.js"; +import OwnershipDao from "./dao/OwnershipDao.js"; +import RosterDao from "./dao/RosterDao.js"; +import SdeDao from "./dao/SdeDao.js"; +import SkillQueueDao from "./dao/SkillQueueDao.js"; +import SkillsheetDao from "./dao/SkillsheetDao.js"; +import SrpDao from "./dao/SrpDao.js"; +import StatisticsDao from "./dao/StatisticsDao.js"; export class Dao { // This strucure is necessary in order to avoid circular dependencies. diff --git a/src/db/dao/AccessTokenDao.ts b/src/db/dao/AccessTokenDao.ts index eb06ae999..332a06dae 100644 --- a/src/db/dao/AccessTokenDao.ts +++ b/src/db/dao/AccessTokenDao.ts @@ -1,6 +1,6 @@ -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import { accessToken, AccessToken } from "../tables"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import { accessToken, AccessToken } from "../tables.js"; export default class AccessTokenDao { constructor(private _parent: Dao) {} diff --git a/src/db/dao/AccountDao.ts b/src/db/dao/AccountDao.ts index ffcfc832e..e42a781ef 100644 --- a/src/db/dao/AccountDao.ts +++ b/src/db/dao/AccountDao.ts @@ -1,5 +1,5 @@ -import { Dao } from "../dao"; -import { Tnex, val, DEFAULT_NUM } from "../../db/tnex/index"; +import { Dao } from "../dao.js"; +import { Tnex, val, DEFAULT_NUM } from "../../db/tnex/index.js"; import { account, accountGroup, @@ -8,11 +8,11 @@ import { groupExplicit, pendingOwnership, ownership, -} from "../tables"; -import { updateGroupsForAccount } from "../../domain/account/accountGroups"; -import { ADMIN_GROUP } from "../../domain/account/specialGroups"; +} from "../tables.js"; +import { updateGroupsForAccount } from "../../domain/account/accountGroups.js"; +import { ADMIN_GROUP } from "../../domain/account/specialGroups.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/db/dao/BattleDao.ts b/src/db/dao/BattleDao.ts index b1e7aa995..0da1e4bcf 100644 --- a/src/db/dao/BattleDao.ts +++ b/src/db/dao/BattleDao.ts @@ -1,14 +1,14 @@ -import { Dao } from "../dao"; -import { Tnex, val, ResultOrder } from "../../db/tnex/index"; +import { Dao } from "../dao.js"; +import { Tnex, val, ResultOrder } from "../../db/tnex/index.js"; import { killmail, killmailBattle, battle, Battle, srpVerdict, -} from "../tables"; -import { SrpVerdictStatus } from "./enums"; -import { makeKillmailIterator } from "../shared/makeKillmailIterator"; +} from "../tables.js"; +import { SrpVerdictStatus } from "./enums.js"; +import { makeKillmailIterator } from "../shared/makeKillmailIterator.js"; export default class BattleDao { constructor(private _dao: Dao) {} diff --git a/src/db/dao/CharacterDao.ts b/src/db/dao/CharacterDao.ts index 45d01a15e..380081d9b 100644 --- a/src/db/dao/CharacterDao.ts +++ b/src/db/dao/CharacterDao.ts @@ -1,7 +1,7 @@ import _ from "underscore"; -import { Dao } from "../dao"; -import { Tnex, val, UpdateStrategy } from "../../db/tnex/index"; +import { Dao } from "../dao.js"; +import { Tnex, val, UpdateStrategy } from "../../db/tnex/index.js"; import { accessToken, account, @@ -11,7 +11,7 @@ import { memberCorporation, ownership, skillsheet, -} from "../tables"; +} from "../tables.js"; export default class CharacterDao { constructor(private _parent: Dao) {} diff --git a/src/db/dao/CharacterLocationDao.ts b/src/db/dao/CharacterLocationDao.ts index 61ca0ac11..d9c2b0ac1 100644 --- a/src/db/dao/CharacterLocationDao.ts +++ b/src/db/dao/CharacterLocationDao.ts @@ -1,12 +1,12 @@ -import { Dao } from "../dao"; -import { Tnex, val } from "../../db/tnex/index"; +import { Dao } from "../dao.js"; +import { Tnex, val } from "../../db/tnex/index.js"; import { characterLocation, CharacterLocation, memberCorporation, character, accessToken, -} from "../tables"; +} from "../tables.js"; export default class LocationDao { constructor(private _parent: Dao) {} diff --git a/src/db/dao/CharacterNotificationDao.ts b/src/db/dao/CharacterNotificationDao.ts index dbf741881..f049fee08 100644 --- a/src/db/dao/CharacterNotificationDao.ts +++ b/src/db/dao/CharacterNotificationDao.ts @@ -1,11 +1,14 @@ import moment from "moment"; import _ from "underscore"; -import { Dao } from "../dao"; -import { EsiNotification } from "../../data-source/esi/EsiNotification"; -import { fetchEveNames } from "../../data-source/esi/names"; -import { characterNotification, characterNotificationUpdate } from "../tables"; -import { Tnex, val } from "../tnex/index"; +import { Dao } from "../dao.js"; +import { EsiNotification } from "../../data-source/esi/EsiNotification.js"; +import { fetchEveNames } from "../../data-source/esi/names.js"; +import { + characterNotification, + characterNotificationUpdate, +} from "../tables.js"; +import { Tnex, val } from "../tnex/index.js"; export default class CharacterNotificationDao { constructor(private _parent: Dao) {} diff --git a/src/db/dao/CharacterShipDao.ts b/src/db/dao/CharacterShipDao.ts index f9d6fe064..8bf1da6e0 100644 --- a/src/db/dao/CharacterShipDao.ts +++ b/src/db/dao/CharacterShipDao.ts @@ -1,4 +1,4 @@ -import { Dao } from "../dao"; +import { Dao } from "../dao.js"; import { account, character, @@ -6,8 +6,8 @@ import { characterShipUpdate, ownership, sdeType, -} from "../tables"; -import { Tnex, val } from "../tnex/index"; +} from "../tables.js"; +import { Tnex, val } from "../tnex/index.js"; export default class CharacterShipDao { constructor(private _parent: Dao) {} diff --git a/src/db/dao/CitadelDao.ts b/src/db/dao/CitadelDao.ts index 7d1af055f..2e083e50d 100644 --- a/src/db/dao/CitadelDao.ts +++ b/src/db/dao/CitadelDao.ts @@ -1,6 +1,6 @@ -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import { citadel, Citadel } from "../tables"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import { citadel, Citadel } from "../tables.js"; export default class CitadelDao { constructor(private _parent: Dao) {} diff --git a/src/db/dao/CombatStatsDao.ts b/src/db/dao/CombatStatsDao.ts index 5b626afa0..70ee12c6d 100644 --- a/src/db/dao/CombatStatsDao.ts +++ b/src/db/dao/CombatStatsDao.ts @@ -1,7 +1,7 @@ -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import * as t from "../tables"; -import { MEMBER_GROUP } from "../../domain/account/specialGroups"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import * as t from "../tables.js"; +import { MEMBER_GROUP } from "../../domain/account/specialGroups.js"; export default class CombatStatsDao { constructor(private _dao: Dao) {} diff --git a/src/db/dao/ConfigDao.ts b/src/db/dao/ConfigDao.ts index f92835d4e..7d908d5b9 100644 --- a/src/db/dao/ConfigDao.ts +++ b/src/db/dao/ConfigDao.ts @@ -1,17 +1,17 @@ import Bluebird from "bluebird"; -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; import { config, groupTitle, GroupTitle, memberCorporation, MemberCorporation, -} from "../tables"; -import { serialize } from "../../util/asyncUtil"; -import { UserVisibleError } from "../../error/UserVisibleError"; -import { Nullable } from "../../util/simpleTypes"; +} from "../tables.js"; +import { serialize } from "../../util/asyncUtil.js"; +import { UserVisibleError } from "../../error/UserVisibleError.js"; +import { Nullable } from "../../util/simpleTypes.js"; export interface ConfigEntries { siggyUsername: string; diff --git a/src/db/dao/CronDao.ts b/src/db/dao/CronDao.ts index eedfae082..f16a0b3bb 100644 --- a/src/db/dao/CronDao.ts +++ b/src/db/dao/CronDao.ts @@ -1,11 +1,11 @@ import Bluebird from "bluebird"; import moment from "moment"; -import { Tnex, val, DEFAULT_NUM } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import { cronLog } from "../tables"; +import { Tnex, val, DEFAULT_NUM } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import { cronLog } from "../tables.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/db/dao/GroupsDao.ts b/src/db/dao/GroupsDao.ts index 5fe73f9dc..ed44c385d 100644 --- a/src/db/dao/GroupsDao.ts +++ b/src/db/dao/GroupsDao.ts @@ -1,15 +1,15 @@ import _ from "underscore"; -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; import { accountGroup, groupExplicit, groupPriv, groupTitle, privilege, -} from "../tables"; -import { MEMBER_GROUP } from "../../domain/account/specialGroups"; +} from "../tables.js"; +import { MEMBER_GROUP } from "../../domain/account/specialGroups.js"; export default class GroupsDao { constructor(private _parent: Dao) {} diff --git a/src/db/dao/KillmailDao.ts b/src/db/dao/KillmailDao.ts index 338a4ccaa..57caca2f1 100644 --- a/src/db/dao/KillmailDao.ts +++ b/src/db/dao/KillmailDao.ts @@ -1,5 +1,5 @@ -import { Dao } from "../dao"; -import { Tnex, val, UpdateStrategy } from "../../db/tnex/index"; +import { Dao } from "../dao.js"; +import { Tnex, val, UpdateStrategy } from "../../db/tnex/index.js"; import { killmail, Killmail, @@ -7,9 +7,9 @@ import { account, memberCorporation, ownership, -} from "../tables"; -import { makeKillmailIterator } from "../shared/makeKillmailIterator"; -import { StreamIterator } from "../../util/stream/BatchedObjectReadable"; +} from "../tables.js"; +import { makeKillmailIterator } from "../shared/makeKillmailIterator.js"; +import { StreamIterator } from "../../util/stream/BatchedObjectReadable.js"; export default class KillmailDao { constructor(private _dao: Dao) {} diff --git a/src/db/dao/LogDao.ts b/src/db/dao/LogDao.ts index d4cc389d9..cc493bc4f 100644 --- a/src/db/dao/LogDao.ts +++ b/src/db/dao/LogDao.ts @@ -1,6 +1,6 @@ -import { Tnex, DEFAULT_NUM } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import { account, accountLog, character } from "../tables"; +import { Tnex, DEFAULT_NUM } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import { account, accountLog, character } from "../tables.js"; export type LoggableEvent = | "CREATE_ACCOUNT" diff --git a/src/db/dao/OwnershipDao.ts b/src/db/dao/OwnershipDao.ts index 9896a4e63..f6caf953e 100644 --- a/src/db/dao/OwnershipDao.ts +++ b/src/db/dao/OwnershipDao.ts @@ -1,7 +1,7 @@ -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import { account, character, ownership, pendingOwnership } from "../tables"; -import { updateGroupsForAccount } from "../../domain/account/accountGroups"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import { account, character, ownership, pendingOwnership } from "../tables.js"; +import { updateGroupsForAccount } from "../../domain/account/accountGroups.js"; export default class OwnershipDao { constructor(private _dao: Dao) {} diff --git a/src/db/dao/RosterDao.ts b/src/db/dao/RosterDao.ts index 013aa2db8..3e9fd389f 100644 --- a/src/db/dao/RosterDao.ts +++ b/src/db/dao/RosterDao.ts @@ -1,9 +1,9 @@ import _ from "underscore"; -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import * as t from "../tables"; -import { MEMBER_GROUP } from "../../domain/account/specialGroups"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import * as t from "../tables.js"; +import { MEMBER_GROUP } from "../../domain/account/specialGroups.js"; export interface BasicRosterCharacter { character_id: number; diff --git a/src/db/dao/SdeDao.ts b/src/db/dao/SdeDao.ts index ad8986589..5e90081e0 100644 --- a/src/db/dao/SdeDao.ts +++ b/src/db/dao/SdeDao.ts @@ -1,6 +1,6 @@ -import { Dao } from "../dao"; -import { Tnex } from "../tnex/Tnex"; -import { SdeType, sdeType } from "../tables"; +import { Dao } from "../dao.js"; +import { Tnex } from "../tnex/Tnex.js"; +import { SdeType, sdeType } from "../tables.js"; export default class SdeDao { constructor(private _dao: Dao) {} diff --git a/src/db/dao/SkillQueueDao.ts b/src/db/dao/SkillQueueDao.ts index bcffcb7f3..b53d0c54d 100644 --- a/src/db/dao/SkillQueueDao.ts +++ b/src/db/dao/SkillQueueDao.ts @@ -1,7 +1,7 @@ -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import { characterSkillQueue, sdeType } from "../tables"; -import { defaultSkillName } from "../../domain/skills/defaultSkillName"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import { characterSkillQueue, sdeType } from "../tables.js"; +import { defaultSkillName } from "../../domain/skills/defaultSkillName.js"; class SkillQueueDao { constructor(private _parent: Dao) {} diff --git a/src/db/dao/SkillsheetDao.ts b/src/db/dao/SkillsheetDao.ts index 8f28f5f8d..3a0b928ab 100644 --- a/src/db/dao/SkillsheetDao.ts +++ b/src/db/dao/SkillsheetDao.ts @@ -1,6 +1,6 @@ -import { Tnex, val } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import { skillsheet, Skillsheet, sdeType } from "../tables"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import { skillsheet, Skillsheet, sdeType } from "../tables.js"; export interface SkillsheetEntry { skillsheet_skill: number; diff --git a/src/db/dao/SrpDao.ts b/src/db/dao/SrpDao.ts index e8d555d96..1bd719ffd 100644 --- a/src/db/dao/SrpDao.ts +++ b/src/db/dao/SrpDao.ts @@ -1,5 +1,5 @@ -import { Dao } from "../dao"; -import { Tnex, DEFAULT_NUM, UpdatePolicy } from "../../db/tnex/index"; +import { Dao } from "../dao.js"; +import { Tnex, DEFAULT_NUM, UpdatePolicy } from "../../db/tnex/index.js"; import { killmail, Killmail, @@ -13,11 +13,11 @@ import { Account, killmailBattle, KillmailBattle, -} from "../tables"; -import { SrpVerdictStatus, SrpVerdictReason } from "./enums"; -import { val, Comparison } from "../tnex/core"; -import { Nullable } from "../../util/simpleTypes"; -import { ZKillmail } from "../../data-source/zkillboard/ZKillmail"; +} from "../tables.js"; +import { SrpVerdictStatus, SrpVerdictReason } from "./enums.js"; +import { val, Comparison } from "../tnex/core.js"; +import { Nullable } from "../../util/simpleTypes.js"; +import { ZKillmail } from "../../data-source/zkillboard/ZKillmail.js"; export interface SrpLossFilter { status?: SrpVerdictStatus; diff --git a/src/db/dao/StatisticsDao.ts b/src/db/dao/StatisticsDao.ts index 80fed5d8a..9ef9dd066 100644 --- a/src/db/dao/StatisticsDao.ts +++ b/src/db/dao/StatisticsDao.ts @@ -1,6 +1,6 @@ -import { Tnex } from "../../db/tnex/index"; -import { Dao } from "../dao"; -import { MEMBER_GROUP } from "../../domain/account/specialGroups"; +import { Tnex } from "../../db/tnex/index.js"; +import { Dao } from "../dao.js"; +import { MEMBER_GROUP } from "../../domain/account/specialGroups.js"; export interface SkillRequirement { skill: number; diff --git a/src/db/getPostgresKnex.ts b/src/db/getPostgresKnex.ts index 67f8563a2..5c50e00c2 100644 --- a/src/db/getPostgresKnex.ts +++ b/src/db/getPostgresKnex.ts @@ -1,6 +1,6 @@ import pg from "pg"; -import knex, { Knex } from "knex"; +import { knex, Knex } from "knex"; // By default, pg returns columns of type "bigint" (20) as strings, not numbers, // since they could possibly overflow Javascript's number type (which is a diff --git a/src/db/shared/makeKillmailIterator.ts b/src/db/shared/makeKillmailIterator.ts index d984fb427..6fda51838 100644 --- a/src/db/shared/makeKillmailIterator.ts +++ b/src/db/shared/makeKillmailIterator.ts @@ -1,7 +1,7 @@ -import { Tnex, val } from "../tnex/index"; -import { Killmail, killmail } from "../tables"; -import { Select } from "../tnex/Select"; -import { StreamIterator } from "../../util/stream/BatchedObjectReadable"; +import { Tnex, val } from "../tnex/index.js"; +import { Killmail, killmail } from "../tables.js"; +import { Select } from "../tnex/Select.js"; +import { StreamIterator } from "../../util/stream/BatchedObjectReadable.js"; // TODO: Make this properly generic once // https://github.com/Microsoft/TypeScript/issues/24560 is fixed diff --git a/src/db/tables.ts b/src/db/tables.ts index 268a9c552..9918b30b8 100644 --- a/src/db/tables.ts +++ b/src/db/tables.ts @@ -10,15 +10,15 @@ import { strEnum, float4, decimal, -} from "../db/tnex/index"; +} from "../db/tnex/index.js"; import { PrivilegeName, HullCategory, SrpVerdictStatus, SrpVerdictReason, -} from "./dao/enums"; -import { ZKillmail } from "../data-source/zkillboard/ZKillmail"; -import { BattleData } from "../domain/battle/BattleData"; +} from "./dao/enums.js"; +import { ZKillmail } from "../data-source/zkillboard/ZKillmail.js"; +import { BattleData } from "../domain/battle/BattleData.js"; export const tables = new TnexBuilder(); diff --git a/src/db/tnex/FilterableQuery.ts b/src/db/tnex/FilterableQuery.ts index 70f6f3e65..918ca5753 100644 --- a/src/db/tnex/FilterableQuery.ts +++ b/src/db/tnex/FilterableQuery.ts @@ -5,8 +5,8 @@ import { ValueWrapper, StringKeyOf, DeepPartial, -} from "./core"; -import { Scoper } from "./Scoper"; +} from "./core.js"; +import { Scoper } from "./Scoper.js"; /** * Base class for things that can specify WHERE clauses. diff --git a/src/db/tnex/Query.ts b/src/db/tnex/Query.ts index 58fcfda9c..cf1c20689 100644 --- a/src/db/tnex/Query.ts +++ b/src/db/tnex/Query.ts @@ -1,6 +1,6 @@ import { Knex } from "knex"; -import { Scoper } from "./Scoper"; -import { FilterableQuery } from "./FilterableQuery"; +import { Scoper } from "./Scoper.js"; +import { FilterableQuery } from "./FilterableQuery.js"; // TODO: Change this to an interface and just have all the subclasses implement // that interface diff --git a/src/db/tnex/RenamedJoin.ts b/src/db/tnex/RenamedJoin.ts index 0b8d741f2..3c1af07c3 100644 --- a/src/db/tnex/RenamedJoin.ts +++ b/src/db/tnex/RenamedJoin.ts @@ -1,5 +1,5 @@ -import { Link } from "./core"; -import { Scoper } from "./Scoper"; +import { Link } from "./core.js"; +import { Scoper } from "./Scoper.js"; export class RenamedJoin { public readonly table: T; diff --git a/src/db/tnex/Scoper.ts b/src/db/tnex/Scoper.ts index 7cb38e52e..2cba5a14b 100644 --- a/src/db/tnex/Scoper.ts +++ b/src/db/tnex/Scoper.ts @@ -1,5 +1,5 @@ import util from "util"; -import { splitColumn } from "./core"; +import { splitColumn } from "./core.js"; export class Scoper { private _separator: string; diff --git a/src/db/tnex/Select.ts b/src/db/tnex/Select.ts index e0086ae3a..45d422b96 100644 --- a/src/db/tnex/Select.ts +++ b/src/db/tnex/Select.ts @@ -1,10 +1,10 @@ import { Knex } from "knex"; -import { Comparison, Link, Nullable, StringKeyOf } from "./core"; -import { Scoper } from "./Scoper"; -import { Query } from "./Query"; -import { RenamedJoin } from "./RenamedJoin"; -import { checkNotNil } from "../../util/assert"; +import { Comparison, Link, Nullable, StringKeyOf } from "./core.js"; +import { Scoper } from "./Scoper.js"; +import { Query } from "./Query.js"; +import { RenamedJoin } from "./RenamedJoin.js"; +import { checkNotNil } from "../../util/assert.js"; interface ColumnSelect { column: string; diff --git a/src/db/tnex/Tnex.ts b/src/db/tnex/Tnex.ts index 2ec2d87a0..34cffeb7a 100644 --- a/src/db/tnex/Tnex.ts +++ b/src/db/tnex/Tnex.ts @@ -2,17 +2,17 @@ import { inspect } from "util"; import { Knex } from "knex"; -import { SimpleObj, val, StringKeyOf } from "./core"; -import { Scoper } from "./Scoper"; -import { Select } from "./Select"; -import { Query } from "./Query"; -import { RenamedJoin } from "./RenamedJoin"; -import { Update } from "./Update"; +import { SimpleObj, val, StringKeyOf } from "./core.js"; +import { Scoper } from "./Scoper.js"; +import { Select } from "./Select.js"; +import { Query } from "./Query.js"; +import { RenamedJoin } from "./RenamedJoin.js"; +import { Update } from "./Update.js"; import { getColumnDescriptors, ColumnDescriptor, DataType, -} from "./ColumnDescriptor"; +} from "./ColumnDescriptor.js"; const USE_DEFAULT = {}; diff --git a/src/db/tnex/TnexBuilder.ts b/src/db/tnex/TnexBuilder.ts index bcd61686e..658901b4e 100644 --- a/src/db/tnex/TnexBuilder.ts +++ b/src/db/tnex/TnexBuilder.ts @@ -1,10 +1,10 @@ import { Knex } from "knex"; import util from "util"; -import { splitColumn } from "./core"; -import { Tnex } from "./Tnex"; -import { Scoper } from "./Scoper"; -import { ColumnDescriptorImpl } from "./ColumnDescriptor"; +import { splitColumn } from "./core.js"; +import { Tnex } from "./Tnex.js"; +import { Scoper } from "./Scoper.js"; +import { ColumnDescriptorImpl } from "./ColumnDescriptor.js"; export class TnexBuilder { private _separator: string; diff --git a/src/db/tnex/Update.ts b/src/db/tnex/Update.ts index 7fac053d1..cc1b5e9ca 100644 --- a/src/db/tnex/Update.ts +++ b/src/db/tnex/Update.ts @@ -1,7 +1,7 @@ import { Knex } from "knex"; -import { Query } from "./Query"; -import { Scoper } from "./Scoper"; +import { Query } from "./Query.js"; +import { Scoper } from "./Scoper.js"; /** * Represents an update query in Tnex. diff --git a/src/db/tnex/definers.ts b/src/db/tnex/definers.ts index 51cdb6f7f..abfa47041 100644 --- a/src/db/tnex/definers.ts +++ b/src/db/tnex/definers.ts @@ -1,4 +1,4 @@ -import { ColumnDescriptorImpl, DataType } from "./ColumnDescriptor"; +import { ColumnDescriptorImpl, DataType } from "./ColumnDescriptor.js"; export function nullable(value: K): K | null { if (!(value instanceof ColumnDescriptorImpl)) { diff --git a/src/db/tnex/examples.ts b/src/db/tnex/examples.ts index 748699fed..a2e3e219d 100644 --- a/src/db/tnex/examples.ts +++ b/src/db/tnex/examples.ts @@ -1,8 +1,8 @@ /*eslint-disable @typescript-eslint/no-unused-vars*/ /*eslint-disable no-unused-vars*/ -import { val, integer, varchar } from "."; -import { Tnex } from "./Tnex"; +import { val, integer, varchar } from "./index.js"; +import { Tnex } from "./Tnex.js"; // Step 1: Define our table schemas // Each table should be represented by a singleton class. You'll need to create diff --git a/src/db/tnex/index.ts b/src/db/tnex/index.ts index 2526d63b1..235dfe141 100644 --- a/src/db/tnex/index.ts +++ b/src/db/tnex/index.ts @@ -1,7 +1,7 @@ -export { TnexBuilder } from "./TnexBuilder"; +export { TnexBuilder } from "./TnexBuilder.js"; -export { val, ResultOrder } from "./core"; -export { Tnex, UpdatePolicy, UpdateStrategy } from "./Tnex"; +export { val, ResultOrder } from "./core.js"; +export { Tnex, UpdatePolicy, UpdateStrategy } from "./Tnex.js"; export { nullable, boolean, @@ -14,9 +14,9 @@ export { decimal, jsonb, strEnum, -} from "./definers"; +} from "./definers.js"; -export { DEFAULT_NUM, DEFAULT_STR, DEFAULT_BOOL } from "./Tnex"; +export { DEFAULT_NUM, DEFAULT_STR, DEFAULT_BOOL } from "./Tnex.js"; export function toNum(bool: boolean) { return bool ? 1 : 0; diff --git a/src/domain/account/accountGroups.ts b/src/domain/account/accountGroups.ts index ccc966021..8417daa3a 100644 --- a/src/domain/account/accountGroups.ts +++ b/src/domain/account/accountGroups.ts @@ -1,13 +1,13 @@ import _ from "underscore"; import Bluebird from "bluebird"; -import { dao } from "../../db/dao"; -import { Tnex } from "../../db/tnex/index"; -import { ADMIN_GROUP, MEMBER_GROUP } from "./specialGroups"; -import { serialize } from "../../util/asyncUtil"; -import { account } from "../../db/tables"; +import { dao } from "../../db/dao.js"; +import { Tnex } from "../../db/tnex/index.js"; +import { ADMIN_GROUP, MEMBER_GROUP } from "./specialGroups.js"; +import { serialize } from "../../util/asyncUtil.js"; +import { account } from "../../db/tables.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/domain/battle/BattleCreator.ts b/src/domain/battle/BattleCreator.ts index 5d1aedb18..8f3f334fd 100644 --- a/src/domain/battle/BattleCreator.ts +++ b/src/domain/battle/BattleCreator.ts @@ -1,7 +1,7 @@ -import { ZKillmail } from "../../data-source/zkillboard/ZKillmail"; -import { Battle, Killmail } from "../../db/tables"; -import { Participant } from "./BattleData"; -import { Transform, TransformCallback } from "../../util/stream/Transform"; +import { ZKillmail } from "../../data-source/zkillboard/ZKillmail.js"; +import { Battle, Killmail } from "../../db/tables.js"; +import { Participant } from "./BattleData.js"; +import { Transform, TransformCallback } from "../../util/stream/Transform.js"; /** * Transform stream that accepts a stream of killmails and outputs a stream of diff --git a/src/domain/battle/BattleWriter.ts b/src/domain/battle/BattleWriter.ts index 29144289a..acef00793 100644 --- a/src/domain/battle/BattleWriter.ts +++ b/src/domain/battle/BattleWriter.ts @@ -1,9 +1,9 @@ -import { BattleResult } from "./BattleCreator"; -import { Tnex, DEFAULT_NUM } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { BattleData } from "./BattleData"; -import { Writable } from "../../util/stream/Writable"; -import { BasicCallback } from "../../util/stream/core"; +import { BattleResult } from "./BattleCreator.js"; +import { Tnex, DEFAULT_NUM } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { BattleData } from "./BattleData.js"; +import { Writable } from "../../util/stream/Writable.js"; +import { BasicCallback } from "../../util/stream/core.js"; /** * Writes the output of BattleCreator to the database. diff --git a/src/domain/battle/battlesToJson.ts b/src/domain/battle/battlesToJson.ts index 88f71830a..cade6be4e 100644 --- a/src/domain/battle/battlesToJson.ts +++ b/src/domain/battle/battlesToJson.ts @@ -1,19 +1,19 @@ import moment from "moment"; -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { SimpleNumMap, nil, AsyncReturnType } from "../../util/simpleTypes"; -import { SrpLossJson } from "../srp/SrpLossJson"; -import { Participant } from "./BattleData"; -import { arrayToMap, addAll } from "../../util/collections"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { SimpleNumMap, nil, AsyncReturnType } from "../../util/simpleTypes.js"; +import { SrpLossJson } from "../srp/SrpLossJson.js"; +import { Participant } from "./BattleData.js"; +import { arrayToMap, addAll } from "../../util/collections.js"; import { pluck } from "underscore"; -import { srpLossToJson } from "../srp/srpLossToJson"; -import { triageLosses } from "../srp/triage/triageLosses"; -import { triagedLossesToSuggestionJson } from "../srp/triage/triagedLossesToSuggestionJson"; -import { fetchEveNames } from "../../data-source/esi/names"; -import { Battle, MemberCorporation } from "../../db/tables"; -import { sortBy, cmpNumberProp } from "../../util/sortBy"; -import { isCapsule } from "../../eve/util/isCapsule"; +import { srpLossToJson } from "../srp/srpLossToJson.js"; +import { triageLosses } from "../srp/triage/triageLosses.js"; +import { triagedLossesToSuggestionJson } from "../srp/triage/triagedLossesToSuggestionJson.js"; +import { fetchEveNames } from "../../data-source/esi/names.js"; +import { Battle, MemberCorporation } from "../../db/tables.js"; +import { sortBy, cmpNumberProp } from "../../util/sortBy.js"; +import { isCapsule } from "../../eve/util/isCapsule.js"; /** * Given a list of results from dao.battle.listBattles(), converts them into diff --git a/src/domain/battle/createPendingBattles.ts b/src/domain/battle/createPendingBattles.ts index 9d21646d4..51add2a4d 100644 --- a/src/domain/battle/createPendingBattles.ts +++ b/src/domain/battle/createPendingBattles.ts @@ -1,13 +1,13 @@ import moment from "moment"; -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { BatchedObjectReadable } from "../../util/stream/BatchedObjectReadable"; -import { BattleCreator } from "./BattleCreator"; -import { BattleWriter } from "./BattleWriter"; -import { battle } from "../../db/tables"; -import { Logger } from "../../infra/logging/Logger"; -import { pipelinePr } from "../../util/stream/pipeline"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { BatchedObjectReadable } from "../../util/stream/BatchedObjectReadable.js"; +import { BattleCreator } from "./BattleCreator.js"; +import { BattleWriter } from "./BattleWriter.js"; +import { battle } from "../../db/tables.js"; +import { Logger } from "../../infra/logging/Logger.js"; +import { pipelinePr } from "../../util/stream/pipeline.js"; /** * Iterates through any killmails that aren't associated with battle reports diff --git a/src/domain/skills/skillQueue.ts b/src/domain/skills/skillQueue.ts index 07580d216..f69d77db0 100644 --- a/src/domain/skills/skillQueue.ts +++ b/src/domain/skills/skillQueue.ts @@ -1,11 +1,11 @@ import moment from "moment"; -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { SkillQueueRow } from "../../db/dao/SkillQueueDao"; -import { getAccessToken } from "../../data-source/accessToken/accessToken"; -import { ESI_CHARACTERS_$characterId_SKILLQUEUE } from "../../data-source/esi/endpoints"; -import { fetchEsi } from "../../data-source/esi/fetch/fetchEsi"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { SkillQueueRow } from "../../db/dao/SkillQueueDao.js"; +import { getAccessToken } from "../../data-source/accessToken/accessToken.js"; +import { ESI_CHARACTERS_$characterId_SKILLQUEUE } from "../../data-source/esi/endpoints.js"; +import { fetchEsi } from "../../data-source/esi/fetch/fetchEsi.js"; /** * Fetches fresh skill queue data from ESI and stores it in the DB. Returns a diff --git a/src/domain/skills/skillQueueSummarizer.ts b/src/domain/skills/skillQueueSummarizer.ts index 9f0450759..eb4190dfd 100644 --- a/src/domain/skills/skillQueueSummarizer.ts +++ b/src/domain/skills/skillQueueSummarizer.ts @@ -1,19 +1,19 @@ -import * as time from "../../util/time"; -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { NamedSkillQueueRow } from "../../db/dao/SkillQueueDao"; +import * as time from "../../util/time.js"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { NamedSkillQueueRow } from "../../db/dao/SkillQueueDao.js"; import { updateSkillQueue, getTrainingProgress, isQueueEntryCompleted, -} from "./skillQueue"; -import { isAnyEsiError } from "../../data-source/esi/error"; +} from "./skillQueue.js"; +import { isAnyEsiError } from "../../data-source/esi/error.js"; import { AccessTokenError, AccessTokenErrorType, -} from "../../error/AccessTokenError"; +} from "../../error/AccessTokenError.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); @@ -24,7 +24,7 @@ import { QueueStatus, WarningType, SkillQueueSummary, -} from "./skillQueueSummary"; +} from "./skillQueueSummary.js"; /** * Loads a character's skill queue and then generates summary text for it diff --git a/src/domain/skills/skills.ts b/src/domain/skills/skills.ts index 533f88838..738ccee8a 100644 --- a/src/domain/skills/skills.ts +++ b/src/domain/skills/skills.ts @@ -1,14 +1,14 @@ -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; -import { getAccessToken } from "../../data-source/accessToken/accessToken"; -import { updateSkillQueue, isQueueEntryCompleted } from "./skillQueue"; -import { NamedSkillQueueRow } from "../../db/dao/SkillQueueDao"; -import { SimpleNumMap } from "../../util/simpleTypes"; -import { skillLevelToSp } from "../../eve/skillLevelToSp"; -import * as sde from "../../eve/sde"; -import { ESI_CHARACTERS_$characterId_SKILLS } from "../../data-source/esi/endpoints"; -import { fetchEsi } from "../../data-source/esi/fetch/fetchEsi"; +import { getAccessToken } from "../../data-source/accessToken/accessToken.js"; +import { updateSkillQueue, isQueueEntryCompleted } from "./skillQueue.js"; +import { NamedSkillQueueRow } from "../../db/dao/SkillQueueDao.js"; +import { SimpleNumMap } from "../../util/simpleTypes.js"; +import { skillLevelToSp } from "../../eve/skillLevelToSp.js"; +import * as sde from "../../eve/sde.js"; +import { ESI_CHARACTERS_$characterId_SKILLS } from "../../data-source/esi/endpoints.js"; +import { fetchEsi } from "../../data-source/esi/fetch/fetchEsi.js"; /** Throws AccessTokenError and ESI failure errors. */ export function updateSkills(db: Tnex, characterId: number) { diff --git a/src/domain/srp/SrpLossJson.ts b/src/domain/srp/SrpLossJson.ts index f4c40a177..a2670c5bb 100644 --- a/src/domain/srp/SrpLossJson.ts +++ b/src/domain/srp/SrpLossJson.ts @@ -1,4 +1,4 @@ -import { SrpVerdictStatus, SrpVerdictReason } from "../../db/dao/enums"; +import { SrpVerdictStatus, SrpVerdictReason } from "../../db/dao/enums.js"; /** * JSON format for corp ship losses. Combines killmail information with SRP diff --git a/src/domain/srp/srpLossToJson.ts b/src/domain/srp/srpLossToJson.ts index 17a848570..91fa72af0 100644 --- a/src/domain/srp/srpLossToJson.ts +++ b/src/domain/srp/srpLossToJson.ts @@ -1,10 +1,14 @@ import moment from "moment"; import _ from "underscore"; -import { SrpLossRow } from "../../db/dao/SrpDao"; -import { nil } from "../../util/simpleTypes"; -import { ZKillmail } from "../../data-source/zkillboard/ZKillmail"; -import { SrpLossJson, UnifiedSrpLossStatus, AttackerJson } from "./SrpLossJson"; +import { SrpLossRow } from "../../db/dao/SrpDao.js"; +import { nil } from "../../util/simpleTypes.js"; +import { ZKillmail } from "../../data-source/zkillboard/ZKillmail.js"; +import { + SrpLossJson, + UnifiedSrpLossStatus, + AttackerJson, +} from "./SrpLossJson.js"; /** * Shared logic for dumping the representation of an SRPable loss to JSON. diff --git a/src/domain/srp/triage/TriageRule.ts b/src/domain/srp/triage/TriageRule.ts index 9d3e56f01..e1c74d995 100644 --- a/src/domain/srp/triage/TriageRule.ts +++ b/src/domain/srp/triage/TriageRule.ts @@ -1,5 +1,5 @@ -import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail"; -import { SrpVerdictStatus, SrpVerdictReason } from "../../../db/dao/enums"; +import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail.js"; +import { SrpVerdictStatus, SrpVerdictReason } from "../../../db/dao/enums.js"; /** * Defines a rule for triaging losses. A rule has two fundamental parts: the diff --git a/src/domain/srp/triage/autoTriageLosses.ts b/src/domain/srp/triage/autoTriageLosses.ts index fa8bc8ccf..a37d1b969 100644 --- a/src/domain/srp/triage/autoTriageLosses.ts +++ b/src/domain/srp/triage/autoTriageLosses.ts @@ -1,8 +1,8 @@ -import { Tnex } from "../../../db/tnex/index"; -import { LossRow, triageLosses, TriagedLoss } from "./triageLosses"; -import { fetchHullMarketValues, resolvePayout } from "./payout"; -import { SrpVerdictReason, SrpVerdictStatus } from "../../../db/dao/enums"; -import { dao } from "../../../db/dao"; +import { Tnex } from "../../../db/tnex/index.js"; +import { LossRow, triageLosses, TriagedLoss } from "./triageLosses.js"; +import { fetchHullMarketValues, resolvePayout } from "./payout.js"; +import { SrpVerdictReason, SrpVerdictStatus } from "../../../db/dao/enums.js"; +import { dao } from "../../../db/dao.js"; /** * Given a list of losses, applies triage rules to each one and commits and diff --git a/src/domain/srp/triage/payout.ts b/src/domain/srp/triage/payout.ts index 7d2fb6be6..d08f13b9a 100644 --- a/src/domain/srp/triage/payout.ts +++ b/src/domain/srp/triage/payout.ts @@ -1,8 +1,8 @@ -import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail"; -import { ApprovedVerdict, MarketPayout } from "./TriageRule"; -import { fetchJitaSellPrices } from "../../../data-source/evemarketer/fetchJitaSellPrices"; -import { SrpVerdictStatus } from "../../../db/dao/enums"; -import { TriagedLoss } from "./triageLosses"; +import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail.js"; +import { ApprovedVerdict, MarketPayout } from "./TriageRule.js"; +import { fetchJitaSellPrices } from "../../../data-source/evemarketer/fetchJitaSellPrices.js"; +import { SrpVerdictStatus } from "../../../db/dao/enums.js"; +import { TriagedLoss } from "./triageLosses.js"; /** * Given a list of triaged losses, looks up any relevant market prices. Used diff --git a/src/domain/srp/triage/rules.ts b/src/domain/srp/triage/rules.ts index 1f6b993ef..989bbf320 100644 --- a/src/domain/srp/triage/rules.ts +++ b/src/domain/srp/triage/rules.ts @@ -1,7 +1,7 @@ import _ from "underscore"; -import { TemplateRule, FuncRule } from "./TriageRule"; -import { SrpVerdictStatus, SrpVerdictReason } from "../../../db/dao/enums"; +import { TemplateRule, FuncRule } from "./TriageRule.js"; +import { SrpVerdictStatus, SrpVerdictReason } from "../../../db/dao/enums.js"; import { GROUP_T1_INDUSTRIAL, GROUP_T1_FRIGATE, @@ -40,7 +40,7 @@ import { GROUP_LIGHT_FIGHTER, GROUP_HEAVY_FIGHTER, GROUP_SHUTTLE, -} from "../../../eve/constants/groups"; +} from "../../../eve/constants/groups.js"; import { TYPE_DEFENDER_MISSILE, TYPE_GNOSIS, @@ -70,7 +70,7 @@ import { TYPE_LOW_GRADE_SLAVES, TYPE_MID_GRADE_SLAVES, TYPE_HIGH_GRADE_SLAVES, -} from "../../../eve/constants/types"; +} from "../../../eve/constants/types.js"; import { MKT_GROUP_PIRATE_CRUISERS, MKT_GROUP_NAVY_FRIGATES, @@ -83,13 +83,13 @@ import { MKT_GROUP_TRIGLAVIAN_FRIGATES, MKT_GROUP_TRIGLAVIAN_CRUISERS, MKT_GROUP_TRIGLAVIAN_BATTLESHIPS, -} from "../../../eve/constants/marketGroups"; +} from "../../../eve/constants/marketGroups.js"; import { SYSTEM_AD001, SYSTEM_AD200, -} from "../../../eve/constants/mapSolarSystems"; +} from "../../../eve/constants/mapSolarSystems.js"; -import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail"; +import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail.js"; /** * SOUND-specific implementation of SRP rules. See the TRIAGE_RULES export diff --git a/src/domain/srp/triage/triageLosses.ts b/src/domain/srp/triage/triageLosses.ts index c750f27a7..5a176316b 100644 --- a/src/domain/srp/triage/triageLosses.ts +++ b/src/domain/srp/triage/triageLosses.ts @@ -1,11 +1,11 @@ -import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail"; -import { Tnex } from "../../../db/tnex/index"; -import { TRIAGE_RULES } from "./rules"; -import { dao } from "../../../db/dao"; -import { TriageVerdict, TriageRule, isFuncRule } from "./TriageRule"; -import { SdeType } from "../../../db/tables"; +import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail.js"; +import { Tnex } from "../../../db/tnex/index.js"; +import { TRIAGE_RULES } from "./rules.js"; +import { dao } from "../../../db/dao.js"; +import { TriageVerdict, TriageRule, isFuncRule } from "./TriageRule.js"; +import { SdeType } from "../../../db/tables.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/domain/srp/triage/triagedLossesToSuggestionJson.ts b/src/domain/srp/triage/triagedLossesToSuggestionJson.ts index 19b312264..972da4a1f 100644 --- a/src/domain/srp/triage/triagedLossesToSuggestionJson.ts +++ b/src/domain/srp/triage/triagedLossesToSuggestionJson.ts @@ -1,7 +1,7 @@ -import { fetchHullMarketValues, resolvePayout } from "./payout"; -import { SrpTriageJson, VerdictOptionJson } from "../SrpLossJson"; -import { SrpVerdictStatus } from "../../../db/dao/enums"; -import { TriagedLoss } from "./triageLosses"; +import { fetchHullMarketValues, resolvePayout } from "./payout.js"; +import { SrpTriageJson, VerdictOptionJson } from "../SrpLossJson.js"; +import { SrpVerdictStatus } from "../../../db/dao/enums.js"; +import { TriagedLoss } from "./triageLosses.js"; /** * Converts the output for triageLosses() to the triage format in SrpLossJson. diff --git a/src/error/AccessTokenError.ts b/src/error/AccessTokenError.ts index aa0ad0868..422dbf716 100644 --- a/src/error/AccessTokenError.ts +++ b/src/error/AccessTokenError.ts @@ -1,4 +1,4 @@ -import { ExtendableError } from "./ExtendableError"; +import { ExtendableError } from "./ExtendableError.js"; export const enum AccessTokenErrorType { TOKEN_MISSING, diff --git a/src/error/BadRequestError.ts b/src/error/BadRequestError.ts index f0239bb23..6ab0934f4 100644 --- a/src/error/BadRequestError.ts +++ b/src/error/BadRequestError.ts @@ -1,3 +1,3 @@ -import { ExtendableError } from "./ExtendableError"; +import { ExtendableError } from "./ExtendableError.js"; export class BadRequestError extends ExtendableError {} diff --git a/src/error/MissingPrivilegeError.ts b/src/error/MissingPrivilegeError.ts index 9ea54c216..fdc5a325b 100644 --- a/src/error/MissingPrivilegeError.ts +++ b/src/error/MissingPrivilegeError.ts @@ -1,4 +1,4 @@ -import { UnauthorizedClientError } from "./UnauthorizedClientError"; +import { UnauthorizedClientError } from "./UnauthorizedClientError.js"; export class MissingPrivilegeError extends UnauthorizedClientError { constructor( diff --git a/src/error/NoSuchAccountError.ts b/src/error/NoSuchAccountError.ts index 69765f4a5..f58906a83 100644 --- a/src/error/NoSuchAccountError.ts +++ b/src/error/NoSuchAccountError.ts @@ -1,4 +1,4 @@ -import { ExtendableError } from "./ExtendableError"; +import { ExtendableError } from "./ExtendableError.js"; export class NoSuchAccountError extends ExtendableError { constructor(accountId: number) { diff --git a/src/error/NotFoundError.ts b/src/error/NotFoundError.ts index 47b60db93..488655035 100644 --- a/src/error/NotFoundError.ts +++ b/src/error/NotFoundError.ts @@ -1,4 +1,4 @@ -import { ExtendableError } from "./ExtendableError"; +import { ExtendableError } from "./ExtendableError.js"; export class NotFoundError extends ExtendableError { constructor() { diff --git a/src/error/NotLoggedInError.ts b/src/error/NotLoggedInError.ts index c93767179..9e76b084a 100644 --- a/src/error/NotLoggedInError.ts +++ b/src/error/NotLoggedInError.ts @@ -1,4 +1,4 @@ -import { UnauthorizedClientError } from "./UnauthorizedClientError"; +import { UnauthorizedClientError } from "./UnauthorizedClientError.js"; export class NotLoggedInError extends UnauthorizedClientError { constructor() { diff --git a/src/error/UnauthorizedClientError.ts b/src/error/UnauthorizedClientError.ts index effd90a5d..3ae2202e9 100644 --- a/src/error/UnauthorizedClientError.ts +++ b/src/error/UnauthorizedClientError.ts @@ -1,3 +1,3 @@ -import { ExtendableError } from "./ExtendableError"; +import { ExtendableError } from "./ExtendableError.js"; export class UnauthorizedClientError extends ExtendableError {} diff --git a/src/error/UserVisibleError.ts b/src/error/UserVisibleError.ts index cca1c3d19..4fe518c62 100644 --- a/src/error/UserVisibleError.ts +++ b/src/error/UserVisibleError.ts @@ -1,3 +1,3 @@ -import { ExtendableError } from "./ExtendableError"; +import { ExtendableError } from "./ExtendableError.js"; export class UserVisibleError extends ExtendableError {} diff --git a/src/eve/assets.ts b/src/eve/assets.ts index a7a28b43b..ffe4e45c5 100644 --- a/src/eve/assets.ts +++ b/src/eve/assets.ts @@ -1,14 +1,14 @@ import { ESI_CHARACTERS_$characterId_ASSETS, ESI_CHARACTERS_$characterId_ASSETS_NAMES, -} from "../data-source/esi/endpoints"; -import { EsiAsset } from "../data-source/esi/EsiAsset"; -import { fetchEsi, fetchEsiEx } from "../data-source/esi/fetch/fetchEsi"; -import { dao } from "../db/dao"; -import { SdeType } from "../db/tables"; -import { Tnex } from "../db/tnex/index"; -import { arrayToMap } from "../util/collections"; -import { TYPE_CATEGORY_SHIP } from "./constants/categories"; +} from "../data-source/esi/endpoints.js"; +import { EsiAsset } from "../data-source/esi/EsiAsset.js"; +import { fetchEsi, fetchEsiEx } from "../data-source/esi/fetch/fetchEsi.js"; +import { dao } from "../db/dao.js"; +import { SdeType } from "../db/tables.js"; +import { Tnex } from "../db/tnex/index.js"; +import { arrayToMap } from "../util/collections.js"; +import { TYPE_CATEGORY_SHIP } from "./constants/categories.js"; const MAX_ASSET_PAGES_TO_FETCH = 50; diff --git a/src/eve/sde.ts b/src/eve/sde.ts index d5acaa3ed..2f298a79f 100644 --- a/src/eve/sde.ts +++ b/src/eve/sde.ts @@ -1,13 +1,13 @@ -import { Tnex } from "../db/tnex/index"; +import { Tnex } from "../db/tnex/index.js"; import { loadSdeSkillDefinitions, SdeSkill, -} from "./sde/loadSdeSkillDefinitions"; -import { defaultSkillName } from "../domain/skills/defaultSkillName"; +} from "./sde/loadSdeSkillDefinitions.js"; +import { defaultSkillName } from "../domain/skills/defaultSkillName.js"; let skillDefinitions = new Map(); -export { SdeSkill } from "./sde/loadSdeSkillDefinitions"; +export { SdeSkill } from "./sde/loadSdeSkillDefinitions.js"; export async function loadStaticData(db: Tnex, strictMode: boolean) { const _skillDefinitions = await loadSdeSkillDefinitions(db, strictMode); diff --git a/src/eve/sde/loadSdeSkillDefinitions.ts b/src/eve/sde/loadSdeSkillDefinitions.ts index 076963b67..eea959311 100644 --- a/src/eve/sde/loadSdeSkillDefinitions.ts +++ b/src/eve/sde/loadSdeSkillDefinitions.ts @@ -1,9 +1,9 @@ -import { Tnex, val } from "../../db/tnex/index"; -import { sdeType, sdeTypeAttribute, sdeAttribute } from "../../db/tables"; +import { Tnex, val } from "../../db/tnex/index.js"; +import { sdeType, sdeTypeAttribute, sdeAttribute } from "../../db/tables.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; -import { TYPE_CATEGORY_SKILL } from "../constants/categories"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; +import { TYPE_CATEGORY_SKILL } from "../constants/categories.js"; import { DGM_ATTR_REQUIRED_SKILL_1, DGM_ATTR_REQUIRED_SKILL_2, @@ -12,7 +12,7 @@ import { DGM_ATTR_REQUIRED_SKILL_2_LEVEL, DGM_ATTR_REQUIRED_SKILL_3_LEVEL, DGM_ATTR_SKILL_TIME_CONSTANT, -} from "../constants/dogma"; +} from "../constants/dogma.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/eve/util/isCapsule.ts b/src/eve/util/isCapsule.ts index 279bd38f6..5aff4fffd 100644 --- a/src/eve/util/isCapsule.ts +++ b/src/eve/util/isCapsule.ts @@ -1,5 +1,5 @@ -import { TYPE_CAPSULE, TYPE_CAPSULE_GENOLUTION } from "../constants/types"; -import { nil } from "../../util/simpleTypes"; +import { TYPE_CAPSULE, TYPE_CAPSULE_GENOLUTION } from "../constants/types.js"; +import { nil } from "../../util/simpleTypes.js"; export function isCapsule(typeId: number | nil) { return typeId == TYPE_CAPSULE || typeId == TYPE_CAPSULE_GENOLUTION; diff --git a/src/infra/build-client/webpack.dev.ts b/src/infra/build-client/webpack.dev.ts index 355c7ff1d..e0a46b592 100644 --- a/src/infra/build-client/webpack.dev.ts +++ b/src/infra/build-client/webpack.dev.ts @@ -1,6 +1,6 @@ import { merge } from "webpack-merge"; -import { commonConfig } from "./webpack"; -import { getProjectPaths } from "./paths"; +import { commonConfig } from "./webpack.js"; +import { getProjectPaths } from "./paths.js"; import webpack from "webpack"; const paths = getProjectPaths(); diff --git a/src/infra/build-client/webpack.prod.ts b/src/infra/build-client/webpack.prod.ts index 7ec183032..6f65841e9 100644 --- a/src/infra/build-client/webpack.prod.ts +++ b/src/infra/build-client/webpack.prod.ts @@ -1,7 +1,7 @@ import webpack from "webpack"; import { merge } from "webpack-merge"; -import { getProjectPaths } from "./paths"; -import { commonConfig } from "./webpack"; +import { getProjectPaths } from "./paths.js"; +import { commonConfig } from "./webpack.js"; const paths = getProjectPaths(); diff --git a/src/infra/build-client/webpack.ts b/src/infra/build-client/webpack.ts index ba6d1e4f0..4a7475a68 100644 --- a/src/infra/build-client/webpack.ts +++ b/src/infra/build-client/webpack.ts @@ -1,6 +1,6 @@ import path from "path"; -import { ProjectPaths } from "./paths"; +import { ProjectPaths } from "./paths.js"; import webpack from "webpack"; import TerserPlugin from "terser-webpack-plugin"; diff --git a/src/infra/express/decs.d.ts b/src/infra/express/decs.d.ts index d0c977be0..9e88c2f82 100644 --- a/src/infra/express/decs.d.ts +++ b/src/infra/express/decs.d.ts @@ -1 +1,2 @@ declare module "webpack-hot-middleware"; +declare module "express-rate-limit"; diff --git a/src/infra/express/express.ts b/src/infra/express/express.ts index d2787b2ff..fc787abbb 100644 --- a/src/infra/express/express.ts +++ b/src/infra/express/express.ts @@ -16,18 +16,18 @@ import rateLimit from "express-rate-limit"; import crypto from "crypto"; import csrf from "csurf"; -import { Tnex } from "../../db/tnex/index"; -import { isDevelopment } from "../../util/config"; -import { LOGIN_PARAMS } from "../../domain/sso/loginParams"; - -import { default as route_api } from "../../route/api/api"; -import { default as route_home } from "../../route/home"; -import { default as route_authenticate } from "../../route/authenticate"; -import { default as route_swagger } from "../../route/esi/swagger"; -import { default as route_esi_proxy } from "../../route/esi/proxy"; -import { getSession, endSession } from "./session"; -import { checkNotNil } from "../../util/assert"; -import { getProjectPaths } from "../build-client/paths"; +import { Tnex } from "../../db/tnex/index.js"; +import { isDevelopment } from "../../util/config.js"; +import { LOGIN_PARAMS } from "../../domain/sso/loginParams.js"; + +import { default as route_api } from "../../route/api/api.js"; +import { default as route_home } from "../../route/home.js"; +import { default as route_authenticate } from "../../route/authenticate.js"; +import { default as route_swagger } from "../../route/esi/swagger.js"; +import { default as route_esi_proxy } from "../../route/esi/proxy.js"; +import { getSession, endSession } from "./session.js"; +import { checkNotNil } from "../../util/assert.js"; +import { getProjectPaths } from "../build-client/paths.js"; const FRONTEND_ROUTES = [ "/", @@ -124,8 +124,8 @@ async function setupClientServing(app: express.Application) { if (isDevelopment()) { const clientConfig = isDevelopment() - ? (await import("../build-client/webpack.dev")).default - : (await import("../build-client/webpack.prod")).default; + ? (await import("../build-client/webpack.dev.js")).default + : (await import("../build-client/webpack.prod.js")).default; const webpack = (await import("webpack")).default; const webpackDevMiddleware = (await import("webpack-dev-middleware")) .default; diff --git a/src/infra/express/getAccountPrivs.ts b/src/infra/express/getAccountPrivs.ts index 3bc2b8eb4..ae6ca6205 100644 --- a/src/infra/express/getAccountPrivs.ts +++ b/src/infra/express/getAccountPrivs.ts @@ -7,12 +7,12 @@ * @param accountId * @returns {Promise} */ -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { getPrivileges } from "./privileges"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { getPrivileges } from "./privileges.js"; -import { NoSuchAccountError } from "../../error/NoSuchAccountError"; -import { NotLoggedInError } from "../../error/NotLoggedInError"; +import { NoSuchAccountError } from "../../error/NoSuchAccountError.js"; +import { NotLoggedInError } from "../../error/NotLoggedInError.js"; export interface AccountSummary { id: number; diff --git a/src/infra/express/privileges.ts b/src/infra/express/privileges.ts index db27fe186..86bc35429 100644 --- a/src/infra/express/privileges.ts +++ b/src/infra/express/privileges.ts @@ -1,11 +1,14 @@ -import { dao } from "../../db/dao"; -import { Tnex } from "../../db/tnex/index"; -import { PrivilegeName } from "../../db/dao/enums"; -import { ADMIN_GROUP, MEMBER_GROUP } from "../../domain/account/specialGroups"; - -import { MissingPrivilegeError } from "../../error/MissingPrivilegeError"; +import { dao } from "../../db/dao.js"; +import { Tnex } from "../../db/tnex/index.js"; +import { PrivilegeName } from "../../db/dao/enums.js"; +import { + ADMIN_GROUP, + MEMBER_GROUP, +} from "../../domain/account/specialGroups.js"; + +import { MissingPrivilegeError } from "../../error/MissingPrivilegeError.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/infra/express/protectedEndpoint.ts b/src/infra/express/protectedEndpoint.ts index e555bd8b1..53c726b94 100644 --- a/src/infra/express/protectedEndpoint.ts +++ b/src/infra/express/protectedEndpoint.ts @@ -8,20 +8,20 @@ */ import express from "express"; -import { BadRequestError } from "../../error/BadRequestError"; -import { NotFoundError } from "../../error/NotFoundError"; -import { NoSuchAccountError } from "../../error/NoSuchAccountError"; -import { NotLoggedInError } from "../../error/NotLoggedInError"; -import { UnauthorizedClientError } from "../../error/UnauthorizedClientError"; -import { UserVisibleError } from "../../error/UserVisibleError"; +import { BadRequestError } from "../../error/BadRequestError.js"; +import { NotFoundError } from "../../error/NotFoundError.js"; +import { NoSuchAccountError } from "../../error/NoSuchAccountError.js"; +import { NotLoggedInError } from "../../error/NotLoggedInError.js"; +import { UnauthorizedClientError } from "../../error/UnauthorizedClientError.js"; +import { UserVisibleError } from "../../error/UserVisibleError.js"; -import { Tnex } from "../../db/tnex/index"; -import { AccountPrivileges } from "./privileges"; -import { getAccountPrivs, AccountSummary } from "./getAccountPrivs"; -import { SchemaVerificationError } from "../../util/express/schemaVerifier"; +import { Tnex } from "../../db/tnex/index.js"; +import { AccountPrivileges } from "./privileges.js"; +import { getAccountPrivs, AccountSummary } from "./getAccountPrivs.js"; +import { SchemaVerificationError } from "../../util/express/schemaVerifier.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; -import { getSession, endSession } from "./session"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; +import { getSession, endSession } from "./session.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/infra/logging/WitnessLogger.ts b/src/infra/logging/WitnessLogger.ts index af8e83d78..54bc7085d 100644 --- a/src/infra/logging/WitnessLogger.ts +++ b/src/infra/logging/WitnessLogger.ts @@ -1,7 +1,7 @@ -import { Logger, LogLevel } from "./Logger"; -import * as protocol from "../../bin/witness/protocol"; -import { printError } from "../../data-source/esi/error"; -import { nil } from "../../util/simpleTypes"; +import { Logger, LogLevel } from "./Logger.js"; +import * as protocol from "../../bin/witness/protocol.js"; +import { printError } from "../../data-source/esi/error.js"; +import { nil } from "../../util/simpleTypes.js"; export class WitnessLogger implements Logger { private _tag: string | nil; diff --git a/src/infra/logging/buildLogger.ts b/src/infra/logging/buildLogger.ts index 410634443..db217d22b 100644 --- a/src/infra/logging/buildLogger.ts +++ b/src/infra/logging/buildLogger.ts @@ -1,5 +1,5 @@ -import { Logger } from "./Logger"; -import { WitnessLogger } from "./WitnessLogger"; +import { Logger } from "./Logger.js"; +import { WitnessLogger } from "./WitnessLogger.js"; /** * Creates an object that can be used to log messages to persistent logs. diff --git a/src/infra/taskrunner/Job.ts b/src/infra/taskrunner/Job.ts index 9af9a8440..a13072291 100644 --- a/src/infra/taskrunner/Job.ts +++ b/src/infra/taskrunner/Job.ts @@ -1,6 +1,6 @@ import { EventEmitter } from "events"; -import { Logger } from "../logging/Logger"; -import { Task } from "./Task"; +import { Logger } from "../logging/Logger.js"; +import { Task } from "./Task.js"; export type JobResult = "pending" | "success" | "partial" | "failure"; export type JobStatus = "queued" | "running" | "finished"; diff --git a/src/infra/taskrunner/JobImpl.ts b/src/infra/taskrunner/JobImpl.ts index 6c1da2533..3f480da15 100644 --- a/src/infra/taskrunner/JobImpl.ts +++ b/src/infra/taskrunner/JobImpl.ts @@ -2,11 +2,11 @@ import { EventEmitter } from "events"; -import { Job, JobStatus, JobResult, JobLogger } from "./Job"; +import { Job, JobStatus, JobResult, JobLogger } from "./Job.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../logging/buildLogger"; -import { LogLevel } from "../logging/Logger"; -import { Task } from "./Task"; +import { buildLoggerFromFilename } from "../logging/buildLogger.js"; +import { LogLevel } from "../logging/Logger.js"; +import { Task } from "./Task.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/infra/taskrunner/Scheduler.ts b/src/infra/taskrunner/Scheduler.ts index 1e30ce91a..1869c3c7e 100644 --- a/src/infra/taskrunner/Scheduler.ts +++ b/src/infra/taskrunner/Scheduler.ts @@ -2,15 +2,15 @@ import _ from "underscore"; import { inspect } from "util"; -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { checkNotNil } from "../../util/assert"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { checkNotNil } from "../../util/assert.js"; -import { Job, JobResult } from "./Job"; -import { JobImpl } from "./JobImpl"; +import { Job, JobResult } from "./Job.js"; +import { JobImpl } from "./JobImpl.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../logging/buildLogger"; -import { Task } from "./Task"; +import { buildLoggerFromFilename } from "../logging/buildLogger.js"; +import { Task } from "./Task.js"; import { trace, context } from "@opentelemetry/api"; diff --git a/src/infra/taskrunner/Task.ts b/src/infra/taskrunner/Task.ts index 0f7113dc2..a9d36ca15 100644 --- a/src/infra/taskrunner/Task.ts +++ b/src/infra/taskrunner/Task.ts @@ -1,5 +1,5 @@ -import { Tnex } from "../../db/tnex/index"; -import { JobLogger } from "./Job"; +import { Tnex } from "../../db/tnex/index.js"; +import { JobLogger } from "./Job.js"; /** * A piece of background work that the server can perform. diff --git a/src/infra/taskrunner/cron.ts b/src/infra/taskrunner/cron.ts index e04dca1bf..9e55deca6 100644 --- a/src/infra/taskrunner/cron.ts +++ b/src/infra/taskrunner/cron.ts @@ -4,14 +4,14 @@ */ import schedule from "node-schedule"; -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { serialize } from "../../util/asyncUtil"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { serialize } from "../../util/asyncUtil.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../logging/buildLogger"; -import { Task } from "./Task"; -import * as taskRunner from "./taskRunner"; -import { SCHEDULED_TASKS } from "../../task-registry/scheduledTasks"; +import { buildLoggerFromFilename } from "../logging/buildLogger.js"; +import { Task } from "./Task.js"; +import * as taskRunner from "./taskRunner.js"; +import { SCHEDULED_TASKS } from "../../task-registry/scheduledTasks.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/infra/taskrunner/taskRunner.ts b/src/infra/taskrunner/taskRunner.ts index 42d612573..e688f59c5 100644 --- a/src/infra/taskrunner/taskRunner.ts +++ b/src/infra/taskrunner/taskRunner.ts @@ -1,6 +1,6 @@ -import { Scheduler, TaskOptions } from "./Scheduler"; -import { Task } from "./Task"; -import { Tnex } from "../../db/tnex/index"; +import { Scheduler, TaskOptions } from "./Scheduler.js"; +import { Task } from "./Task.js"; +import { Tnex } from "../../db/tnex/index.js"; /** * Global wrapper around a Scheduler instance. diff --git a/src/route/api/account/activeTimezone_PUT.ts b/src/route/api/account/activeTimezone_PUT.ts index 69c35e28b..07e1fc9b9 100644 --- a/src/route/api/account/activeTimezone_PUT.ts +++ b/src/route/api/account/activeTimezone_PUT.ts @@ -1,10 +1,10 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { TIMEZONE_LABELS } from "../../../domain/roster/timezoneLabels"; -import { verify, string } from "../../../util/express/schemaVerifier"; -import { idParam } from "../../../util/express/paramVerifier"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { TIMEZONE_LABELS } from "../../../domain/roster/timezoneLabels.js"; +import { verify, string } from "../../../util/express/schemaVerifier.js"; +import { idParam } from "../../../util/express/paramVerifier.js"; -import { BadRequestError } from "../../../error/BadRequestError"; +import { BadRequestError } from "../../../error/BadRequestError.js"; export class Input { activeTimezone = string(); diff --git a/src/route/api/account/characters_GET.ts b/src/route/api/account/characters_GET.ts index 78d6c3c23..abf2731b4 100644 --- a/src/route/api/account/characters_GET.ts +++ b/src/route/api/account/characters_GET.ts @@ -1,10 +1,10 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { Tnex } from "../../../db/tnex/index"; -import { AccountSummary } from "../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../infra/express/privileges"; -import { idParam } from "../../../util/express/paramVerifier"; -import { UnauthorizedClientError } from "../../../error/UnauthorizedClientError"; -import { dao } from "../../../db/dao"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { Tnex } from "../../../db/tnex/index.js"; +import { AccountSummary } from "../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../infra/express/privileges.js"; +import { idParam } from "../../../util/express/paramVerifier.js"; +import { UnauthorizedClientError } from "../../../error/UnauthorizedClientError.js"; +import { dao } from "../../../db/dao.js"; export type Output = CharacterDescription[]; diff --git a/src/route/api/account/homeCitadel_PUT.ts b/src/route/api/account/homeCitadel_PUT.ts index 021bd2617..510803ad5 100644 --- a/src/route/api/account/homeCitadel_PUT.ts +++ b/src/route/api/account/homeCitadel_PUT.ts @@ -1,9 +1,9 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { verify, string } from "../../../util/express/schemaVerifier"; -import { idParam } from "../../../util/express/paramVerifier"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { verify, string } from "../../../util/express/schemaVerifier.js"; +import { idParam } from "../../../util/express/paramVerifier.js"; -import { BadRequestError } from "../../../error/BadRequestError"; +import { BadRequestError } from "../../../error/BadRequestError.js"; export class Input { citadelName = string(); diff --git a/src/route/api/account/mainCharacter_PUT.ts b/src/route/api/account/mainCharacter_PUT.ts index 324875cda..219561994 100644 --- a/src/route/api/account/mainCharacter_PUT.ts +++ b/src/route/api/account/mainCharacter_PUT.ts @@ -1,12 +1,12 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { idParam } from "../../../util/express/paramVerifier"; -import { verify, number } from "../../../util/express/schemaVerifier"; -import { canDesignateMain } from "../../../domain/account/canDesignateMain"; -import { CORP_DOOMHEIM } from "../../../shared/eveConstants"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { idParam } from "../../../util/express/paramVerifier.js"; +import { verify, number } from "../../../util/express/schemaVerifier.js"; +import { canDesignateMain } from "../../../domain/account/canDesignateMain.js"; +import { CORP_DOOMHEIM } from "../../../shared/eveConstants.js"; -import { BadRequestError } from "../../../error/BadRequestError"; -import { UnauthorizedClientError } from "../../../error/UnauthorizedClientError"; +import { BadRequestError } from "../../../error/BadRequestError.js"; +import { UnauthorizedClientError } from "../../../error/UnauthorizedClientError.js"; export class Input { characterId = number(); diff --git a/src/route/api/account/transfer_DELETE.ts b/src/route/api/account/transfer_DELETE.ts index b0bbc234b..646c2d25b 100644 --- a/src/route/api/account/transfer_DELETE.ts +++ b/src/route/api/account/transfer_DELETE.ts @@ -1,8 +1,8 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { idParam } from "../../../util/express/paramVerifier"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { idParam } from "../../../util/express/paramVerifier.js"; -import { UnauthorizedClientError } from "../../../error/UnauthorizedClientError"; +import { UnauthorizedClientError } from "../../../error/UnauthorizedClientError.js"; export default jsonEndpoint((req, res, db, account, _privs): Promise<{}> => { const targetAccountId = idParam(req, "id"); diff --git a/src/route/api/account/transfer_POST.ts b/src/route/api/account/transfer_POST.ts index eace02ecc..5a5aee2bb 100644 --- a/src/route/api/account/transfer_POST.ts +++ b/src/route/api/account/transfer_POST.ts @@ -1,10 +1,10 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { idParam } from "../../../util/express/paramVerifier"; -import { verify, number } from "../../../util/express/schemaVerifier"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { idParam } from "../../../util/express/paramVerifier.js"; +import { verify, number } from "../../../util/express/schemaVerifier.js"; -import { BadRequestError } from "../../../error/BadRequestError"; -import { UnauthorizedClientError } from "../../../error/UnauthorizedClientError"; +import { BadRequestError } from "../../../error/BadRequestError.js"; +import { UnauthorizedClientError } from "../../../error/UnauthorizedClientError.js"; export class Input { characterId = number(); diff --git a/src/route/api/admin/accountLog.ts b/src/route/api/admin/accountLog.ts index 79ea2985c..086ea55da 100644 --- a/src/route/api/admin/accountLog.ts +++ b/src/route/api/admin/accountLog.ts @@ -1,5 +1,5 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; export interface Output { rows: AccountLog[]; diff --git a/src/route/api/admin/citadel_DELETE.ts b/src/route/api/admin/citadel_DELETE.ts index 81486df64..53043251c 100644 --- a/src/route/api/admin/citadel_DELETE.ts +++ b/src/route/api/admin/citadel_DELETE.ts @@ -1,6 +1,6 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { BadRequestError } from "../../../error/BadRequestError"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { BadRequestError } from "../../../error/BadRequestError.js"; export default jsonEndpoint((req, res, db, account, privs): Promise<{}> => { const citadelId = parseInt(req.params.id); diff --git a/src/route/api/admin/citadel_POST.ts b/src/route/api/admin/citadel_POST.ts index e837ef9fe..ff68a2483 100644 --- a/src/route/api/admin/citadel_POST.ts +++ b/src/route/api/admin/citadel_POST.ts @@ -1,7 +1,11 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { DEFAULT_NUM } from "../../../db/tnex/index"; -import { dao } from "../../../db/dao"; -import { verify, string, boolean } from "../../../util/express/schemaVerifier"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { DEFAULT_NUM } from "../../../db/tnex/index.js"; +import { dao } from "../../../db/dao.js"; +import { + verify, + string, + boolean, +} from "../../../util/express/schemaVerifier.js"; export class Input { name = string(); diff --git a/src/route/api/admin/citadel_PUT.ts b/src/route/api/admin/citadel_PUT.ts index a2a713a3d..59d4bb098 100644 --- a/src/route/api/admin/citadel_PUT.ts +++ b/src/route/api/admin/citadel_PUT.ts @@ -1,8 +1,8 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { verify, string } from "../../../util/express/schemaVerifier"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { verify, string } from "../../../util/express/schemaVerifier.js"; -import { BadRequestError } from "../../../error/BadRequestError"; +import { BadRequestError } from "../../../error/BadRequestError.js"; export class PartialCitadelJson { name = string(); diff --git a/src/route/api/admin/roster/syncStatus_GET.ts b/src/route/api/admin/roster/syncStatus_GET.ts index 4b8e36a08..6219e4fff 100644 --- a/src/route/api/admin/roster/syncStatus_GET.ts +++ b/src/route/api/admin/roster/syncStatus_GET.ts @@ -1,13 +1,13 @@ import _ from "underscore"; -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { Tnex } from "../../../../db/tnex/index"; -import { dao } from "../../../../db/dao"; -import { AccountSummary } from "../../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { SimpleNumMap } from "../../../../util/simpleTypes"; -import { fetchEveNames } from "../../../../data-source/esi/names"; -import { hasRosterScopes } from "../../../../domain/roster/hasRosterScopes"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { Tnex } from "../../../../db/tnex/index.js"; +import { dao } from "../../../../db/dao.js"; +import { AccountSummary } from "../../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { SimpleNumMap } from "../../../../util/simpleTypes.js"; +import { fetchEveNames } from "../../../../data-source/esi/names.js"; +import { hasRosterScopes } from "../../../../domain/roster/hasRosterScopes.js"; export interface Output { corporations: CorpSection[]; diff --git a/src/route/api/admin/setup_GET.ts b/src/route/api/admin/setup_GET.ts index 8a02810e4..cc2607eaf 100644 --- a/src/route/api/admin/setup_GET.ts +++ b/src/route/api/admin/setup_GET.ts @@ -1,12 +1,12 @@ import Bluebird from "bluebird"; -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { Tnex } from "../../../db/tnex/index"; -import { MemberCorporation, GroupTitle } from "../../../db/tables"; -import { SimpleMap } from "../../../util/simpleTypes"; -import { censor } from "./_censor"; -import { Input as Output } from "./setup_PUT"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { Tnex } from "../../../db/tnex/index.js"; +import { MemberCorporation, GroupTitle } from "../../../db/tables.js"; +import { SimpleMap } from "../../../util/simpleTypes.js"; +import { censor } from "./_censor.js"; +import { Input as Output } from "./setup_PUT.js"; type CorporationConfig = Output["corporations"][0]; diff --git a/src/route/api/admin/setup_PUT.ts b/src/route/api/admin/setup_PUT.ts index 096a23298..815773e0f 100644 --- a/src/route/api/admin/setup_PUT.ts +++ b/src/route/api/admin/setup_PUT.ts @@ -1,10 +1,10 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { MemberCorporation, GroupTitle } from "../../../db/tables"; -import { Tnex, DEFAULT_NUM } from "../../../db/tnex/index"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { MemberCorporation, GroupTitle } from "../../../db/tables.js"; +import { Tnex, DEFAULT_NUM } from "../../../db/tnex/index.js"; -import { UserVisibleError } from "../../../error/UserVisibleError"; -import { isCensored } from "./_censor"; +import { UserVisibleError } from "../../../error/UserVisibleError.js"; +import { isCensored } from "./_censor.js"; import { verify, @@ -15,11 +15,11 @@ import { array, object, simpleMap, -} from "../../../util/express/schemaVerifier"; -import { AccountSummary } from "../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../infra/express/privileges"; -import { fetchEsi } from "../../../data-source/esi/fetch/fetchEsi"; -import { ESI_CORPORATIONS_$corporationId } from "../../../data-source/esi/endpoints"; +} from "../../../util/express/schemaVerifier.js"; +import { AccountSummary } from "../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../infra/express/privileges.js"; +import { fetchEsi } from "../../../data-source/esi/fetch/fetchEsi.js"; +import { ESI_CORPORATIONS_$corporationId } from "../../../data-source/esi/endpoints.js"; export class Input { corporations = array({ diff --git a/src/route/api/admin/srp/jurisdiction_GET.ts b/src/route/api/admin/srp/jurisdiction_GET.ts index b3b173d0e..053e09809 100644 --- a/src/route/api/admin/srp/jurisdiction_GET.ts +++ b/src/route/api/admin/srp/jurisdiction_GET.ts @@ -1,8 +1,8 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { Tnex } from "../../../../db/tnex/index"; -import { AccountSummary } from "../../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { dao } from "../../../../db/dao"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { Tnex } from "../../../../db/tnex/index.js"; +import { AccountSummary } from "../../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { dao } from "../../../../db/dao.js"; export interface Output { srpJurisdiction: { start: number } | null; diff --git a/src/route/api/admin/srp/jurisdiction_PUT.ts b/src/route/api/admin/srp/jurisdiction_PUT.ts index 745b5edac..794c477af 100644 --- a/src/route/api/admin/srp/jurisdiction_PUT.ts +++ b/src/route/api/admin/srp/jurisdiction_PUT.ts @@ -1,14 +1,14 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; import { verify, number, nullable, -} from "../../../../util/express/schemaVerifier"; +} from "../../../../util/express/schemaVerifier.js"; -import { Tnex } from "../../../../db/tnex/index"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { AccountSummary } from "../../../../infra/express/getAccountPrivs"; -import { dao } from "../../../../db/dao"; +import { Tnex } from "../../../../db/tnex/index.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { AccountSummary } from "../../../../infra/express/getAccountPrivs.js"; +import { dao } from "../../../../db/dao.js"; export class Input { start = nullable(number()); diff --git a/src/route/api/admin/tasks/job.ts b/src/route/api/admin/tasks/job.ts index accd5bd67..571691ed2 100644 --- a/src/route/api/admin/tasks/job.ts +++ b/src/route/api/admin/tasks/job.ts @@ -1,5 +1,5 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import * as taskRunner from "../../../../infra/taskrunner/taskRunner"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import * as taskRunner from "../../../../infra/taskrunner/taskRunner.js"; export type Output = JobJson[]; diff --git a/src/route/api/admin/tasks/job_PUT.ts b/src/route/api/admin/tasks/job_PUT.ts index 5f8f41d0d..ce7c7170c 100644 --- a/src/route/api/admin/tasks/job_PUT.ts +++ b/src/route/api/admin/tasks/job_PUT.ts @@ -1,10 +1,10 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { verify, string } from "../../../../util/express/schemaVerifier"; -import { JobJson } from "./job"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { verify, string } from "../../../../util/express/schemaVerifier.js"; +import { JobJson } from "./job.js"; -import { BadRequestError } from "../../../../error/BadRequestError"; -import { findRunnableTaskWithName } from "../../../../task-registry/runnableTasks"; -import * as taskRunner from "../../../../infra/taskrunner/taskRunner"; +import { BadRequestError } from "../../../../error/BadRequestError.js"; +import { findRunnableTaskWithName } from "../../../../task-registry/runnableTasks.js"; +import * as taskRunner from "../../../../infra/taskrunner/taskRunner.js"; export class Input { task = string(); diff --git a/src/route/api/admin/tasks/logs.ts b/src/route/api/admin/tasks/logs.ts index 4353e609a..c3ed1948e 100644 --- a/src/route/api/admin/tasks/logs.ts +++ b/src/route/api/admin/tasks/logs.ts @@ -1,6 +1,6 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { dao } from "../../../../db/dao"; -import { Tnex } from "../../../../db/tnex/index"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../../db/dao.js"; +import { Tnex } from "../../../../db/tnex/index.js"; export type Output = LogEntry[]; diff --git a/src/route/api/admin/tasks/task.ts b/src/route/api/admin/tasks/task.ts index e6f3696c1..01e7c750e 100644 --- a/src/route/api/admin/tasks/task.ts +++ b/src/route/api/admin/tasks/task.ts @@ -1,5 +1,5 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { getRunnableTasks } from "../../../../task-registry/runnableTasks"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { getRunnableTasks } from "../../../../task-registry/runnableTasks.js"; export type Output = { name: string; diff --git a/src/route/api/api.ts b/src/route/api/api.ts index bcb5cebe2..48557ba36 100644 --- a/src/route/api/api.ts +++ b/src/route/api/api.ts @@ -1,56 +1,56 @@ import express from "express"; -import account_activeTimezone_PUT from "./account/activeTimezone_PUT"; -import account_characters_GET from "./account/characters_GET"; -import account_homeCitadel_PUT from "./account/homeCitadel_PUT"; -import account_mainCharacter_PUT from "./account/mainCharacter_PUT"; -import account_transfer_DELETE from "./account/transfer_DELETE"; -import account_transfer_POST from "./account/transfer_POST"; - -import admin_accountLog from "./admin/accountLog"; -import admin_citadel_DELETE from "./admin/citadel_DELETE"; -import admin_citadel_POST from "./admin/citadel_POST"; -import admin_citadel_PUT from "./admin/citadel_PUT"; -import admin_roster_syncStatus_GET from "./admin/roster/syncStatus_GET"; -import admin_setup_GET from "./admin/setup_GET"; -import admin_setup_PUT from "./admin/setup_PUT"; -import admin_srp_jurisdiction_GET from "./admin/srp/jurisdiction_GET"; -import admin_srp_jurisdiction_PUT from "./admin/srp/jurisdiction_PUT"; -import admin_tasks_job_PUT from "./admin/tasks/job_PUT"; -import admin_tasks_job from "./admin/tasks/job"; -import admin_tasks_logs from "./admin/tasks/logs"; -import admin_tasks_task from "./admin/tasks/task"; - -import character from "./character"; -import character_character_PUT from "./character/character_PUT"; -import character_character_DELETE from "./character/character_DELETE"; -import character_skills from "./character/skills"; - -import control_openwindow_information_POST from "./control/openwindow/information_POST"; - -import dashboard from "./dashboard"; -import dashboard_queueSummary from "./dashboard/queueSummary"; - -import killmail_GET from "./killmail/killmail_GET"; - -import ships_borrowedByMe from "./ships/borrowedByMe"; -import ships_borrowed from "./ships/borrowed"; - -import srp_approvedLiability_GET from "./srp/approvedLiability_GET"; -import srp_battle_dir_GET from "./srp/battle/battle_dir_GET"; -import srp_battle_GET from "./srp/battle/battle_GET"; -import srp_loss_dir_GET from "./srp/loss/loss_dir_GET"; -import srp_loss_PUT from "./srp/loss/loss_PUT"; -import srp_loss_triage_GET from "./srp/loss/triage_GET"; -import srp_payment_dir_GET from "./srp/payment/payment_dir_GET"; -import srp_payment_GET from "./srp/payment/payment_GET"; -import srp_payment_PUT from "./srp/payment/payment_PUT"; - -import statistics_skills from "./statistics/skills"; - -import roster from "./roster"; -import citadels from "./citadels"; -import corporation from "./corporation"; +import account_activeTimezone_PUT from "./account/activeTimezone_PUT.js"; +import account_characters_GET from "./account/characters_GET.js"; +import account_homeCitadel_PUT from "./account/homeCitadel_PUT.js"; +import account_mainCharacter_PUT from "./account/mainCharacter_PUT.js"; +import account_transfer_DELETE from "./account/transfer_DELETE.js"; +import account_transfer_POST from "./account/transfer_POST.js"; + +import admin_accountLog from "./admin/accountLog.js"; +import admin_citadel_DELETE from "./admin/citadel_DELETE.js"; +import admin_citadel_POST from "./admin/citadel_POST.js"; +import admin_citadel_PUT from "./admin/citadel_PUT.js"; +import admin_roster_syncStatus_GET from "./admin/roster/syncStatus_GET.js"; +import admin_setup_GET from "./admin/setup_GET.js"; +import admin_setup_PUT from "./admin/setup_PUT.js"; +import admin_srp_jurisdiction_GET from "./admin/srp/jurisdiction_GET.js"; +import admin_srp_jurisdiction_PUT from "./admin/srp/jurisdiction_PUT.js"; +import admin_tasks_job_PUT from "./admin/tasks/job_PUT.js"; +import admin_tasks_job from "./admin/tasks/job.js"; +import admin_tasks_logs from "./admin/tasks/logs.js"; +import admin_tasks_task from "./admin/tasks/task.js"; + +import character from "./character.js"; +import character_character_PUT from "./character/character_PUT.js"; +import character_character_DELETE from "./character/character_DELETE.js"; +import character_skills from "./character/skills.js"; + +import control_openwindow_information_POST from "./control/openwindow/information_POST.js"; + +import dashboard from "./dashboard.js"; +import dashboard_queueSummary from "./dashboard/queueSummary.js"; + +import killmail_GET from "./killmail/killmail_GET.js"; + +import ships_borrowedByMe from "./ships/borrowedByMe.js"; +import ships_borrowed from "./ships/borrowed.js"; + +import srp_approvedLiability_GET from "./srp/approvedLiability_GET.js"; +import srp_battle_dir_GET from "./srp/battle/battle_dir_GET.js"; +import srp_battle_GET from "./srp/battle/battle_GET.js"; +import srp_loss_dir_GET from "./srp/loss/loss_dir_GET.js"; +import srp_loss_PUT from "./srp/loss/loss_PUT.js"; +import srp_loss_triage_GET from "./srp/loss/triage_GET.js"; +import srp_payment_dir_GET from "./srp/payment/payment_dir_GET.js"; +import srp_payment_GET from "./srp/payment/payment_GET.js"; +import srp_payment_PUT from "./srp/payment/payment_PUT.js"; + +import statistics_skills from "./statistics/skills.js"; + +import roster from "./roster.js"; +import citadels from "./citadels.js"; +import corporation from "./corporation.js"; const router = express.Router(); diff --git a/src/route/api/character.ts b/src/route/api/character.ts index f89912190..ae9dd44c5 100644 --- a/src/route/api/character.ts +++ b/src/route/api/character.ts @@ -1,15 +1,15 @@ import _ from "underscore"; -import { Tnex } from "../../db/tnex/index"; -import { dao } from "../../db/dao"; -import { jsonEndpoint } from "../../infra/express/protectedEndpoint"; -import { AccountPrivileges } from "../../infra/express/privileges"; -import { idParam } from "../../util/express/paramVerifier"; -import { NotFoundError } from "../../error/NotFoundError"; +import { Tnex } from "../../db/tnex/index.js"; +import { dao } from "../../db/dao.js"; +import { jsonEndpoint } from "../../infra/express/protectedEndpoint.js"; +import { AccountPrivileges } from "../../infra/express/privileges.js"; +import { idParam } from "../../util/express/paramVerifier.js"; +import { NotFoundError } from "../../error/NotFoundError.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; -import { TIMEZONE_LABELS } from "../../domain/roster/timezoneLabels"; -import { SimpleMap } from "../../util/simpleTypes"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; +import { TIMEZONE_LABELS } from "../../domain/roster/timezoneLabels.js"; +import { SimpleMap } from "../../util/simpleTypes.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/route/api/character/character_DELETE.ts b/src/route/api/character/character_DELETE.ts index 0397f0cce..d04cc0915 100644 --- a/src/route/api/character/character_DELETE.ts +++ b/src/route/api/character/character_DELETE.ts @@ -1,11 +1,11 @@ import _ from "underscore"; -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { BadRequestError } from "../../../error/BadRequestError"; -import { CORP_DOOMHEIM } from "../../../shared/eveConstants"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { BadRequestError } from "../../../error/BadRequestError.js"; +import { CORP_DOOMHEIM } from "../../../shared/eveConstants.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/route/api/character/character_PUT.ts b/src/route/api/character/character_PUT.ts index 00912fff2..f443a8e73 100644 --- a/src/route/api/character/character_PUT.ts +++ b/src/route/api/character/character_PUT.ts @@ -1,11 +1,11 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { Tnex } from "../../../db/tnex/index"; -import { AccountPrivileges } from "../../../infra/express/privileges"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { Tnex } from "../../../db/tnex/index.js"; +import { AccountPrivileges } from "../../../infra/express/privileges.js"; -import { BadRequestError } from "../../../error/BadRequestError"; +import { BadRequestError } from "../../../error/BadRequestError.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/route/api/character/skills.ts b/src/route/api/character/skills.ts index e3a9596c6..433877262 100644 --- a/src/route/api/character/skills.ts +++ b/src/route/api/character/skills.ts @@ -1,21 +1,21 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import { Tnex } from "../../../db/tnex/index"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import { Tnex } from "../../../db/tnex/index.js"; -import { isAnyEsiError } from "../../../data-source/esi/error"; -import { updateSkills } from "../../../domain/skills/skills"; +import { isAnyEsiError } from "../../../data-source/esi/error.js"; +import { updateSkills } from "../../../domain/skills/skills.js"; import { getTrainingProgress, isQueueEntryCompleted, -} from "../../../domain/skills/skillQueue"; -import { SkillsheetEntry } from "../../../db/dao/SkillsheetDao"; -import { NamedSkillQueueRow } from "../../../db/dao/SkillQueueDao"; +} from "../../../domain/skills/skillQueue.js"; +import { SkillsheetEntry } from "../../../db/dao/SkillsheetDao.js"; +import { NamedSkillQueueRow } from "../../../db/dao/SkillQueueDao.js"; import { AccessTokenError, AccessTokenErrorType, -} from "../../../error/AccessTokenError"; -import * as time from "../../../util/time"; -import { defaultSkillName } from "../../../domain/skills/defaultSkillName"; +} from "../../../error/AccessTokenError.js"; +import * as time from "../../../util/time.js"; +import { defaultSkillName } from "../../../domain/skills/defaultSkillName.js"; export interface Skill { id: number; diff --git a/src/route/api/citadels.ts b/src/route/api/citadels.ts index d25768f24..ef9086421 100644 --- a/src/route/api/citadels.ts +++ b/src/route/api/citadels.ts @@ -1,5 +1,5 @@ -import { dao } from "../../db/dao"; -import { jsonEndpoint } from "../../infra/express/protectedEndpoint"; +import { dao } from "../../db/dao.js"; +import { jsonEndpoint } from "../../infra/express/protectedEndpoint.js"; interface Output { citadels: CitadelJson[]; diff --git a/src/route/api/control/openwindow/information_POST.ts b/src/route/api/control/openwindow/information_POST.ts index 1673c1938..a593d8fdc 100644 --- a/src/route/api/control/openwindow/information_POST.ts +++ b/src/route/api/control/openwindow/information_POST.ts @@ -1,14 +1,14 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { number, verify } from "../../../../util/express/schemaVerifier"; -import { AccountSummary } from "../../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { Tnex } from "../../../../db/tnex/index"; -import { dao } from "../../../../db/dao"; -import { BadRequestError } from "../../../../error/BadRequestError"; -import { UnauthorizedClientError } from "../../../../error/UnauthorizedClientError"; -import { getAccessToken } from "../../../../data-source/accessToken/accessToken"; -import { fetchEsi } from "../../../../data-source/esi/fetch/fetchEsi"; -import { ESI_UI_OPENWINDOW_INFORMATION } from "../../../../data-source/esi/endpoints"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { number, verify } from "../../../../util/express/schemaVerifier.js"; +import { AccountSummary } from "../../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { Tnex } from "../../../../db/tnex/index.js"; +import { dao } from "../../../../db/dao.js"; +import { BadRequestError } from "../../../../error/BadRequestError.js"; +import { UnauthorizedClientError } from "../../../../error/UnauthorizedClientError.js"; +import { getAccessToken } from "../../../../data-source/accessToken/accessToken.js"; +import { fetchEsi } from "../../../../data-source/esi/fetch/fetchEsi.js"; +import { ESI_UI_OPENWINDOW_INFORMATION } from "../../../../data-source/esi/endpoints.js"; export class Input { character = number(); diff --git a/src/route/api/corporation.ts b/src/route/api/corporation.ts index 70057306f..ab86b0694 100644 --- a/src/route/api/corporation.ts +++ b/src/route/api/corporation.ts @@ -1,7 +1,7 @@ -import { jsonEndpoint } from "../../infra/express/protectedEndpoint"; -import { ESI_CORPORATIONS_$corporationId } from "../../data-source/esi/endpoints"; -import { fetchEsi } from "../../data-source/esi/fetch/fetchEsi"; -import { idParam } from "../../util/express/paramVerifier"; +import { jsonEndpoint } from "../../infra/express/protectedEndpoint.js"; +import { ESI_CORPORATIONS_$corporationId } from "../../data-source/esi/endpoints.js"; +import { fetchEsi } from "../../data-source/esi/fetch/fetchEsi.js"; +import { idParam } from "../../util/express/paramVerifier.js"; export default jsonEndpoint(async (req, _res) => { const corporationId = idParam(req, "id"); diff --git a/src/route/api/dashboard.ts b/src/route/api/dashboard.ts index 6a80365aa..721f953be 100644 --- a/src/route/api/dashboard.ts +++ b/src/route/api/dashboard.ts @@ -1,11 +1,11 @@ -import { dao } from "../../db/dao"; -import { NotFoundError } from "../../error/NotFoundError"; -import { jsonEndpoint } from "../../infra/express/protectedEndpoint"; -import { loadSummarizedQueue } from "../../domain/skills/skillQueueSummarizer"; -import { SkillQueueSummary } from "../../domain/skills/skillQueueSummary"; -import { parallelize } from "../../util/asyncUtil"; -import * as ccpSso from "../../domain/sso/loginParams"; -import { canDesignateMain } from "../../domain/account/canDesignateMain"; +import { dao } from "../../db/dao.js"; +import { NotFoundError } from "../../error/NotFoundError.js"; +import { jsonEndpoint } from "../../infra/express/protectedEndpoint.js"; +import { loadSummarizedQueue } from "../../domain/skills/skillQueueSummarizer.js"; +import { SkillQueueSummary } from "../../domain/skills/skillQueueSummary.js"; +import { parallelize } from "../../util/asyncUtil.js"; +import * as ccpSso from "../../domain/sso/loginParams.js"; +import { canDesignateMain } from "../../domain/account/canDesignateMain.js"; export interface Output { accountId: number; diff --git a/src/route/api/dashboard/queueSummary.ts b/src/route/api/dashboard/queueSummary.ts index 44cf2210b..34b6c1885 100644 --- a/src/route/api/dashboard/queueSummary.ts +++ b/src/route/api/dashboard/queueSummary.ts @@ -1,10 +1,10 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; -import { parallelize } from "../../../util/asyncUtil"; -import { loadSummarizedQueue } from "../../../domain/skills/skillQueueSummarizer"; +import { parallelize } from "../../../util/asyncUtil.js"; +import { loadSummarizedQueue } from "../../../domain/skills/skillQueueSummarizer.js"; -import { SkillQueueSummary } from "../../../domain/skills/skillQueueSummary"; +import { SkillQueueSummary } from "../../../domain/skills/skillQueueSummary.js"; export type Payload = { id: number; diff --git a/src/route/api/killmail/killmail_GET.ts b/src/route/api/killmail/killmail_GET.ts index 75deff8e7..fc3e8ab8b 100644 --- a/src/route/api/killmail/killmail_GET.ts +++ b/src/route/api/killmail/killmail_GET.ts @@ -1,12 +1,12 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { Tnex } from "../../../db/tnex/index"; -import { AccountPrivileges } from "../../../infra/express/privileges"; -import { idParam } from "../../../util/express/paramVerifier"; -import { dao } from "../../../db/dao"; -import { NotFoundError } from "../../../error/NotFoundError"; -import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail"; -import { SimpleNumMap, nil } from "../../../util/simpleTypes"; -import { fetchEveNames } from "../../../data-source/esi/names"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { Tnex } from "../../../db/tnex/index.js"; +import { AccountPrivileges } from "../../../infra/express/privileges.js"; +import { idParam } from "../../../util/express/paramVerifier.js"; +import { dao } from "../../../db/dao.js"; +import { NotFoundError } from "../../../error/NotFoundError.js"; +import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail.js"; +import { SimpleNumMap, nil } from "../../../util/simpleTypes.js"; +import { fetchEveNames } from "../../../data-source/esi/names.js"; export interface Output { killmail: ZKillmail; diff --git a/src/route/api/roster.ts b/src/route/api/roster.ts index 7d4bc6eff..14a7a6f58 100644 --- a/src/route/api/roster.ts +++ b/src/route/api/roster.ts @@ -1,19 +1,19 @@ import moment from "moment"; -import { dao } from "../../db/dao"; -import { Tnex } from "../../db/tnex/index"; +import { dao } from "../../db/dao.js"; +import { Tnex } from "../../db/tnex/index.js"; import { BasicRosterCharacter, OwnedRosterCharacter, -} from "../../db/dao/RosterDao"; -import { AccountPrivileges } from "../../infra/express/privileges"; -import { jsonEndpoint } from "../../infra/express/protectedEndpoint"; -import { isAnyEsiError } from "../../data-source/esi/error"; -import * as alert from "../../shared/rosterAlertLevels"; -import { fetchEveNames } from "../../data-source/esi/names"; -import { SimpleMap } from "../../util/simpleTypes"; +} from "../../db/dao/RosterDao.js"; +import { AccountPrivileges } from "../../infra/express/privileges.js"; +import { jsonEndpoint } from "../../infra/express/protectedEndpoint.js"; +import { isAnyEsiError } from "../../data-source/esi/error.js"; +import * as alert from "../../shared/rosterAlertLevels.js"; +import { fetchEveNames } from "../../data-source/esi/names.js"; +import { SimpleMap } from "../../util/simpleTypes.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../../infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "../../infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/route/api/ships/borrowed.ts b/src/route/api/ships/borrowed.ts index 0f138c007..6e83ba988 100644 --- a/src/route/api/ships/borrowed.ts +++ b/src/route/api/ships/borrowed.ts @@ -1,6 +1,6 @@ -import { dao } from "../../../db/dao"; -import { BorrowedShipOutputRow } from "../../../db/dao/CharacterShipDao"; -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; +import { dao } from "../../../db/dao.js"; +import { BorrowedShipOutputRow } from "../../../db/dao/CharacterShipDao.js"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; export default jsonEndpoint( (req, res, db, account, privs): Promise => { diff --git a/src/route/api/ships/borrowedByMe.ts b/src/route/api/ships/borrowedByMe.ts index 07ac3952e..8393abf70 100644 --- a/src/route/api/ships/borrowedByMe.ts +++ b/src/route/api/ships/borrowedByMe.ts @@ -1,6 +1,6 @@ -import { dao } from "../../../db/dao"; -import { BorrowedShipOutputRow } from "../../../db/dao/CharacterShipDao"; -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; +import { dao } from "../../../db/dao.js"; +import { BorrowedShipOutputRow } from "../../../db/dao/CharacterShipDao.js"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; export default jsonEndpoint( (req, res, db, account, privs): Promise => { diff --git a/src/route/api/srp/approvedLiability_GET.ts b/src/route/api/srp/approvedLiability_GET.ts index 33f2472e8..7f947d917 100644 --- a/src/route/api/srp/approvedLiability_GET.ts +++ b/src/route/api/srp/approvedLiability_GET.ts @@ -1,8 +1,8 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { Tnex } from "../../../db/tnex/index"; -import { AccountSummary } from "../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../infra/express/privileges"; -import { dao } from "../../../db/dao"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { Tnex } from "../../../db/tnex/index.js"; +import { AccountSummary } from "../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../infra/express/privileges.js"; +import { dao } from "../../../db/dao.js"; export interface Output { approvedLiability: number; diff --git a/src/route/api/srp/battle/battle_GET.ts b/src/route/api/srp/battle/battle_GET.ts index 607fc7728..bc710d8e2 100644 --- a/src/route/api/srp/battle/battle_GET.ts +++ b/src/route/api/srp/battle/battle_GET.ts @@ -1,10 +1,10 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { dao } from "../../../../db/dao"; -import { boolQuery, idParam } from "../../../../util/express/paramVerifier"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../../db/dao.js"; +import { boolQuery, idParam } from "../../../../util/express/paramVerifier.js"; import { BattleOutput, battlesToJson, -} from "../../../../domain/battle/battlesToJson"; +} from "../../../../domain/battle/battlesToJson.js"; export default jsonEndpoint( async (req, res, db, _account, _privs): Promise => { diff --git a/src/route/api/srp/battle/battle_dir_GET.ts b/src/route/api/srp/battle/battle_dir_GET.ts index 7dcebbbb4..f6c0213fb 100644 --- a/src/route/api/srp/battle/battle_dir_GET.ts +++ b/src/route/api/srp/battle/battle_dir_GET.ts @@ -1,7 +1,7 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { ResultOrder } from "../../../../db/tnex/index"; -import { BattleColumn, BoundCmp } from "../../../../db/dao/BattleDao"; -import { dao } from "../../../../db/dao"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { ResultOrder } from "../../../../db/tnex/index.js"; +import { BattleColumn, BoundCmp } from "../../../../db/dao/BattleDao.js"; +import { dao } from "../../../../db/dao.js"; import { optional, array, @@ -10,12 +10,15 @@ import { boolean, object, verify, -} from "../../../../util/express/schemaVerifier"; -import { jsonQuery, boolQuery } from "../../../../util/express/paramVerifier"; +} from "../../../../util/express/schemaVerifier.js"; +import { + jsonQuery, + boolQuery, +} from "../../../../util/express/paramVerifier.js"; import { BattleOutput, battlesToJson, -} from "../../../../domain/battle/battlesToJson"; +} from "../../../../domain/battle/battlesToJson.js"; const FILTER_SCHEMA = { id: optional(number()), diff --git a/src/route/api/srp/loss/loss_PUT.ts b/src/route/api/srp/loss/loss_PUT.ts index 376214473..87a429bb5 100644 --- a/src/route/api/srp/loss/loss_PUT.ts +++ b/src/route/api/srp/loss/loss_PUT.ts @@ -1,19 +1,22 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; import { number, verify, nullable, stringEnum, -} from "../../../../util/express/schemaVerifier"; -import { AccountSummary } from "../../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { Tnex } from "../../../../db/tnex/index"; -import { dao } from "../../../../db/dao"; -import { BadRequestError } from "../../../../error/BadRequestError"; -import { SrpVerdictStatus, SrpVerdictReason } from "../../../../db/dao/enums"; -import { NotFoundError } from "../../../../error/NotFoundError"; -import { idParam } from "../../../../util/express/paramVerifier"; -import { UserVisibleError } from "../../../../error/UserVisibleError"; +} from "../../../../util/express/schemaVerifier.js"; +import { AccountSummary } from "../../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { Tnex } from "../../../../db/tnex/index.js"; +import { dao } from "../../../../db/dao.js"; +import { BadRequestError } from "../../../../error/BadRequestError.js"; +import { + SrpVerdictStatus, + SrpVerdictReason, +} from "../../../../db/dao/enums.js"; +import { NotFoundError } from "../../../../error/NotFoundError.js"; +import { idParam } from "../../../../util/express/paramVerifier.js"; +import { UserVisibleError } from "../../../../error/UserVisibleError.js"; export class Input { verdict = stringEnum(SrpVerdictStatus); diff --git a/src/route/api/srp/loss/loss_dir_GET.ts b/src/route/api/srp/loss/loss_dir_GET.ts index 11b4d85a7..38f4c98a3 100644 --- a/src/route/api/srp/loss/loss_dir_GET.ts +++ b/src/route/api/srp/loss/loss_dir_GET.ts @@ -1,21 +1,21 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { Tnex } from "../../../../db/tnex/Tnex"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { dao } from "../../../../db/dao"; -import { SrpVerdictStatus } from "../../../../db/dao/enums"; -import { SimpleNumMap, nil } from "../../../../util/simpleTypes"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { Tnex } from "../../../../db/tnex/Tnex.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { dao } from "../../../../db/dao.js"; +import { SrpVerdictStatus } from "../../../../db/dao/enums.js"; +import { SimpleNumMap, nil } from "../../../../util/simpleTypes.js"; import { boolQuery, intQuery, enumQuery, -} from "../../../../util/express/paramVerifier"; -import { fetchEveNames } from "../../../../data-source/esi/names"; -import { srpLossToJson } from "../../../../domain/srp/srpLossToJson"; -import { SrpLossFilter } from "../../../../db/dao/SrpDao"; -import { ResultOrder } from "../../../../db/tnex/index"; -import { SrpLossJson } from "../../../../domain/srp/SrpLossJson"; -import { triageLosses } from "../../../../domain/srp/triage/triageLosses"; -import { triagedLossesToSuggestionJson } from "../../../../domain/srp/triage/triagedLossesToSuggestionJson"; +} from "../../../../util/express/paramVerifier.js"; +import { fetchEveNames } from "../../../../data-source/esi/names.js"; +import { srpLossToJson } from "../../../../domain/srp/srpLossToJson.js"; +import { SrpLossFilter } from "../../../../db/dao/SrpDao.js"; +import { ResultOrder } from "../../../../db/tnex/index.js"; +import { SrpLossJson } from "../../../../domain/srp/SrpLossJson.js"; +import { triageLosses } from "../../../../domain/srp/triage/triageLosses.js"; +import { triagedLossesToSuggestionJson } from "../../../../domain/srp/triage/triagedLossesToSuggestionJson.js"; export interface Output { srps: SrpLossJson[]; diff --git a/src/route/api/srp/loss/triage_GET.ts b/src/route/api/srp/loss/triage_GET.ts index a5ba7b162..b3ab78e9b 100644 --- a/src/route/api/srp/loss/triage_GET.ts +++ b/src/route/api/srp/loss/triage_GET.ts @@ -1,13 +1,13 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { AccountSummary } from "../../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { Tnex } from "../../../../db/tnex/index"; -import { dao } from "../../../../db/dao"; -import { NotFoundError } from "../../../../error/NotFoundError"; -import { idParam } from "../../../../util/express/paramVerifier"; -import { SrpTriageJson } from "../../../../domain/srp/SrpLossJson"; -import { triagedLossesToSuggestionJson } from "../../../../domain/srp/triage/triagedLossesToSuggestionJson"; -import { triageLosses } from "../../../../domain/srp/triage/triageLosses"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { AccountSummary } from "../../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { Tnex } from "../../../../db/tnex/index.js"; +import { dao } from "../../../../db/dao.js"; +import { NotFoundError } from "../../../../error/NotFoundError.js"; +import { idParam } from "../../../../util/express/paramVerifier.js"; +import { SrpTriageJson } from "../../../../domain/srp/SrpLossJson.js"; +import { triagedLossesToSuggestionJson } from "../../../../domain/srp/triage/triagedLossesToSuggestionJson.js"; +import { triageLosses } from "../../../../domain/srp/triage/triageLosses.js"; export interface Output { triage: SrpTriageJson | null; diff --git a/src/route/api/srp/payment/payment_GET.ts b/src/route/api/srp/payment/payment_GET.ts index db7b614d4..335312a6a 100644 --- a/src/route/api/srp/payment/payment_GET.ts +++ b/src/route/api/srp/payment/payment_GET.ts @@ -1,15 +1,15 @@ import moment from "moment"; -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { Tnex } from "../../../../db/tnex/index"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { idParam } from "../../../../util/express/paramVerifier"; -import { dao } from "../../../../db/dao"; -import { NotFoundError } from "../../../../error/NotFoundError"; -import { SimpleNumMap } from "../../../../util/simpleTypes"; -import { srpLossToJson } from "../../../../domain/srp/srpLossToJson"; -import { fetchEveNames } from "../../../../data-source/esi/names"; -import { SrpLossJson } from "../../../../domain/srp/SrpLossJson"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { Tnex } from "../../../../db/tnex/index.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { idParam } from "../../../../util/express/paramVerifier.js"; +import { dao } from "../../../../db/dao.js"; +import { NotFoundError } from "../../../../error/NotFoundError.js"; +import { SimpleNumMap } from "../../../../util/simpleTypes.js"; +import { srpLossToJson } from "../../../../domain/srp/srpLossToJson.js"; +import { fetchEveNames } from "../../../../data-source/esi/names.js"; +import { SrpLossJson } from "../../../../domain/srp/SrpLossJson.js"; export interface Output { payment: { diff --git a/src/route/api/srp/payment/payment_PUT.ts b/src/route/api/srp/payment/payment_PUT.ts index 7aa3ac116..11da0b5bd 100644 --- a/src/route/api/srp/payment/payment_PUT.ts +++ b/src/route/api/srp/payment/payment_PUT.ts @@ -1,17 +1,17 @@ -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; import { number, verify, boolean, optional, -} from "../../../../util/express/schemaVerifier"; -import { AccountSummary } from "../../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { Tnex } from "../../../../db/tnex/index"; -import { dao } from "../../../../db/dao"; -import { BadRequestError } from "../../../../error/BadRequestError"; -import { NotFoundError } from "../../../../error/NotFoundError"; -import { idParam } from "../../../../util/express/paramVerifier"; +} from "../../../../util/express/schemaVerifier.js"; +import { AccountSummary } from "../../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { Tnex } from "../../../../db/tnex/index.js"; +import { dao } from "../../../../db/dao.js"; +import { BadRequestError } from "../../../../error/BadRequestError.js"; +import { NotFoundError } from "../../../../error/NotFoundError.js"; +import { idParam } from "../../../../util/express/paramVerifier.js"; export class Input { paid = boolean(); diff --git a/src/route/api/srp/payment/payment_dir_GET.ts b/src/route/api/srp/payment/payment_dir_GET.ts index f12dfe0db..c6cea5dd6 100644 --- a/src/route/api/srp/payment/payment_dir_GET.ts +++ b/src/route/api/srp/payment/payment_dir_GET.ts @@ -1,18 +1,18 @@ import moment from "moment"; -import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint"; -import { AccountSummary } from "../../../../infra/express/getAccountPrivs"; -import { AccountPrivileges } from "../../../../infra/express/privileges"; -import { Tnex, ResultOrder } from "../../../../db/tnex/index"; -import { dao } from "../../../../db/dao"; +import { jsonEndpoint } from "../../../../infra/express/protectedEndpoint.js"; +import { AccountSummary } from "../../../../infra/express/getAccountPrivs.js"; +import { AccountPrivileges } from "../../../../infra/express/privileges.js"; +import { Tnex, ResultOrder } from "../../../../db/tnex/index.js"; +import { dao } from "../../../../db/dao.js"; import { boolQuery, intQuery, enumQuery, -} from "../../../../util/express/paramVerifier"; -import { nil, SimpleNumMap } from "../../../../util/simpleTypes"; -import { fetchEveNames } from "../../../../data-source/esi/names"; -import { SrpReimbursementFilter } from "../../../../db/dao/SrpDao"; +} from "../../../../util/express/paramVerifier.js"; +import { nil, SimpleNumMap } from "../../../../util/simpleTypes.js"; +import { fetchEveNames } from "../../../../data-source/esi/names.js"; +import { SrpReimbursementFilter } from "../../../../db/dao/SrpDao.js"; export interface Output { payments: PaymentJson[]; diff --git a/src/route/api/statistics/skills.ts b/src/route/api/statistics/skills.ts index b520d05a2..08a944843 100644 --- a/src/route/api/statistics/skills.ts +++ b/src/route/api/statistics/skills.ts @@ -1,10 +1,10 @@ -import { jsonEndpoint } from "../../../infra/express/protectedEndpoint"; -import { dao } from "../../../db/dao"; -import * as sde from "../../../eve/sde"; -import { BadRequestError } from "../../../error/BadRequestError"; +import { jsonEndpoint } from "../../../infra/express/protectedEndpoint.js"; +import { dao } from "../../../db/dao.js"; +import * as sde from "../../../eve/sde.js"; +import { BadRequestError } from "../../../error/BadRequestError.js"; -import { SkillRequirement } from "../../../db/dao/StatisticsDao"; -import { stringQuery } from "../../../util/express/paramVerifier"; +import { SkillRequirement } from "../../../db/dao/StatisticsDao.js"; +import { stringQuery } from "../../../util/express/paramVerifier.js"; export interface Output { query: string[]; diff --git a/src/route/authenticate.ts b/src/route/authenticate.ts index d26619029..e0d9eae49 100644 --- a/src/route/authenticate.ts +++ b/src/route/authenticate.ts @@ -3,23 +3,23 @@ import querystring from "querystring"; import axios from "axios"; import express from "express"; -import { dao } from "../db/dao"; -import { Tnex, UpdatePolicy } from "../db/tnex/index"; -import { isAnyEsiError } from "../data-source/esi/error"; +import { dao } from "../db/dao.js"; +import { Tnex, UpdatePolicy } from "../db/tnex/index.js"; +import { isAnyEsiError } from "../data-source/esi/error.js"; -import { UserVisibleError } from "../error/UserVisibleError"; -import { stringQuery } from "../util/express/paramVerifier"; -import { BadRequestError } from "../error/BadRequestError"; +import { UserVisibleError } from "../error/UserVisibleError.js"; +import { stringQuery } from "../util/express/paramVerifier.js"; +import { BadRequestError } from "../error/BadRequestError.js"; import { ESI_CHARACTERS_$characterId_ROLES, ESI_CHARACTERS_$characterId, -} from "../data-source/esi/endpoints"; -import { UNKNOWN_CORPORATION_ID } from "../db/constants"; +} from "../data-source/esi/endpoints.js"; +import { UNKNOWN_CORPORATION_ID } from "../db/constants.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../infra/logging/buildLogger"; -import { getSession } from "../infra/express/session"; -import { fetchEsi } from "../data-source/esi/fetch/fetchEsi"; -import { fetchAuthInfo } from "../data-source/accessToken/jwt"; +import { buildLoggerFromFilename } from "../infra/logging/buildLogger.js"; +import { getSession } from "../infra/express/session.js"; +import { fetchEsi } from "../data-source/esi/fetch/fetchEsi.js"; +import { fetchAuthInfo } from "../data-source/accessToken/jwt.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/route/esi/proxy.ts b/src/route/esi/proxy.ts index 693690cc6..ff5554944 100644 --- a/src/route/esi/proxy.ts +++ b/src/route/esi/proxy.ts @@ -1,11 +1,11 @@ import axios, { AxiosRequestConfig, Method } from "axios"; -import { MixedObject } from "../../util/simpleTypes"; +import { MixedObject } from "../../util/simpleTypes.js"; -import { getAccessToken } from "../../data-source/accessToken/accessToken"; -import { jsonEndpoint } from "../../infra/express/protectedEndpoint"; +import { getAccessToken } from "../../data-source/accessToken/accessToken.js"; +import { jsonEndpoint } from "../../infra/express/protectedEndpoint.js"; -import { CHARACTER_HEADER } from "../../data-source/esi/fetch/fetchSwagger"; -import { BASE_URL } from "../../data-source/esi/fetch/fetchEsi"; +import { CHARACTER_HEADER } from "../../data-source/esi/fetch/fetchSwagger.js"; +import { BASE_URL } from "../../data-source/esi/fetch/fetchEsi.js"; export default jsonEndpoint( (req, res, db, account, privs): Promise => { diff --git a/src/route/esi/swagger.ts b/src/route/esi/swagger.ts index fa77e6614..8d2139dd2 100644 --- a/src/route/esi/swagger.ts +++ b/src/route/esi/swagger.ts @@ -1,6 +1,6 @@ -import { jsonEndpoint } from "../../infra/express/protectedEndpoint"; -import { getModifiedSwagger } from "../../data-source/esi/fetch/fetchSwagger"; -import { BASE_URL } from "../../data-source/esi/fetch/fetchEsi"; +import { jsonEndpoint } from "../../infra/express/protectedEndpoint.js"; +import { getModifiedSwagger } from "../../data-source/esi/fetch/fetchSwagger.js"; +import { BASE_URL } from "../../data-source/esi/fetch/fetchEsi.js"; export default jsonEndpoint((req, res, db, account, privs): Promise => { privs.requireRead("api", false); diff --git a/src/route/home.ts b/src/route/home.ts index ea1f69451..1fa18750f 100644 --- a/src/route/home.ts +++ b/src/route/home.ts @@ -1,6 +1,6 @@ import querystring from "querystring"; -import { htmlEndpoint } from "../infra/express/protectedEndpoint"; -import { getSession } from "../infra/express/session"; +import { htmlEndpoint } from "../infra/express/protectedEndpoint.js"; +import { getSession } from "../infra/express/session.js"; export default htmlEndpoint(async (req, res, db, account, privs) => { const identity = { diff --git a/src/server.ts b/src/server.ts index cc3645e4a..d1db8a412 100644 --- a/src/server.ts +++ b/src/server.ts @@ -13,8 +13,8 @@ import "heapdump"; import Graceful from "node-graceful"; Graceful.captureExceptions = true; -import { tables } from "./db/tables"; -import { getPostgresKnex } from "./db/getPostgresKnex"; +import { tables } from "./db/tables.js"; +import { getPostgresKnex } from "./db/getPostgresKnex.js"; // import { DiagConsoleLogger, DiagLogLevel, diag } from "@opentelemetry/api"; // diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG); @@ -37,7 +37,7 @@ const REQUIRED_VARS = [ ]; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "./infra/logging/buildLogger"; +import { buildLoggerFromFilename } from "./infra/logging/buildLogger.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); for (const envVar of REQUIRED_VARS) { @@ -76,10 +76,10 @@ registerInstrumentations({ ], }); -import * as express from "./infra/express/express"; -import * as cron from "./infra/taskrunner/cron"; -import * as taskRunner from "./infra/taskrunner/taskRunner"; -import * as sde from "./eve/sde"; +import * as express from "./infra/express/express.js"; +import * as cron from "./infra/taskrunner/cron.js"; +import * as taskRunner from "./infra/taskrunner/taskRunner.js"; +import * as sde from "./eve/sde.js"; // Crash the process in the face of an unhandled promise rejection process.on("unhandledRejection", (err) => { @@ -98,7 +98,7 @@ main().catch((e) => { }); async function main() { - const db = tables.build(getPostgresKnex()); + const db = tables.build(getPostgresKnex()!); await sde.loadStaticData(db, false); diff --git a/src/task-registry/runnableTasks.ts b/src/task-registry/runnableTasks.ts index bc21e3326..f4830c9d2 100644 --- a/src/task-registry/runnableTasks.ts +++ b/src/task-registry/runnableTasks.ts @@ -1,19 +1,19 @@ import _ from "underscore"; -import { Task } from "../infra/taskrunner/Task"; +import { Task } from "../infra/taskrunner/Task.js"; -import { syncCharacterLocations } from "../task/syncCharacterLocations"; -import { syncCombatStats } from "../task/syncCombatStats"; -import { syncKillmails } from "../task/syncKillmails"; -import { syncRoster } from "../task/syncRoster"; -import { syncBorrowedShips } from "../task/syncBorrowedShips"; -import { syncNotifications } from "../task/syncNotifications"; -import { syncSkills } from "../task/syncSkills"; -import { syncCorps } from "../task/syncCorps"; -import { truncateCronLog } from "../task/truncateCronLog"; -import { truncateCharacterLocations } from "../task/truncateCharacterLocations"; -import { updateSde } from "../task/updateSde"; -import { triagePendingLosses } from "../task/triagePendingLosses"; +import { syncCharacterLocations } from "../task/syncCharacterLocations.js"; +import { syncCombatStats } from "../task/syncCombatStats.js"; +import { syncKillmails } from "../task/syncKillmails.js"; +import { syncRoster } from "../task/syncRoster.js"; +import { syncBorrowedShips } from "../task/syncBorrowedShips.js"; +import { syncNotifications } from "../task/syncNotifications.js"; +import { syncSkills } from "../task/syncSkills.js"; +import { syncCorps } from "../task/syncCorps.js"; +import { truncateCronLog } from "../task/truncateCronLog.js"; +import { truncateCharacterLocations } from "../task/truncateCharacterLocations.js"; +import { updateSde } from "../task/updateSde.js"; +import { triagePendingLosses } from "../task/triagePendingLosses.js"; /** * List of tasks that can be manually invoked from the admin UI. diff --git a/src/task-registry/scheduledTasks.ts b/src/task-registry/scheduledTasks.ts index 93c3374ea..94c561fdb 100644 --- a/src/task-registry/scheduledTasks.ts +++ b/src/task-registry/scheduledTasks.ts @@ -1,17 +1,17 @@ import moment from "moment"; -import { syncCharacterLocations } from "../task/syncCharacterLocations"; -import { syncCombatStats } from "../task/syncCombatStats"; -import { syncKillmails } from "../task/syncKillmails"; -import { syncRoster } from "../task/syncRoster"; -import { syncSkills } from "../task/syncSkills"; -import { syncCorps } from "../task/syncCorps"; -import { truncateCronLog } from "../task/truncateCronLog"; -import { truncateCharacterLocations } from "../task/truncateCharacterLocations"; -import { triagePendingLosses } from "../task/triagePendingLosses"; -import { TaskSchedule } from "../infra/taskrunner/cron"; -import { syncBorrowedShips } from "../task/syncBorrowedShips"; -import { syncNotifications } from "../task/syncNotifications"; +import { syncCharacterLocations } from "../task/syncCharacterLocations.js"; +import { syncCombatStats } from "../task/syncCombatStats.js"; +import { syncKillmails } from "../task/syncKillmails.js"; +import { syncRoster } from "../task/syncRoster.js"; +import { syncSkills } from "../task/syncSkills.js"; +import { syncCorps } from "../task/syncCorps.js"; +import { truncateCronLog } from "../task/truncateCronLog.js"; +import { truncateCharacterLocations } from "../task/truncateCharacterLocations.js"; +import { triagePendingLosses } from "../task/triagePendingLosses.js"; +import { TaskSchedule } from "../infra/taskrunner/cron.js"; +import { syncBorrowedShips } from "../task/syncBorrowedShips.js"; +import { syncNotifications } from "../task/syncNotifications.js"; /** * Schedules for periodically running certain tasks. diff --git a/src/task/syncBorrowedShips.ts b/src/task/syncBorrowedShips.ts index 455c56f3b..0035bb906 100644 --- a/src/task/syncBorrowedShips.ts +++ b/src/task/syncBorrowedShips.ts @@ -1,21 +1,21 @@ import moment from "moment"; -import { getAccessToken } from "../data-source/accessToken/accessToken"; -import { ESI_UNIVERSE_STRUCTURES_$structureId } from "../data-source/esi/endpoints"; -import { isAnyEsiError } from "../data-source/esi/error"; -import { EsiErrorKind } from "../data-source/esi/EsiError"; -import { fetchEsi } from "../data-source/esi/fetch/fetchEsi"; -import { fetchEveNames } from "../data-source/esi/names"; -import { dao } from "../db/dao"; -import { CharacterShipRow } from "../db/dao/CharacterShipDao"; -import { Tnex } from "../db/tnex/index"; -import { AccessTokenError } from "../error/AccessTokenError"; -import { Asset, fetchAssets, formatLocationFlag } from "../eve/assets"; -import { TYPE_CATEGORY_SHIP } from "../eve/constants/categories"; +import { getAccessToken } from "../data-source/accessToken/accessToken.js"; +import { ESI_UNIVERSE_STRUCTURES_$structureId } from "../data-source/esi/endpoints.js"; +import { isAnyEsiError } from "../data-source/esi/error.js"; +import { EsiErrorKind } from "../data-source/esi/EsiError.js"; +import { fetchEsi } from "../data-source/esi/fetch/fetchEsi.js"; +import { fetchEveNames } from "../data-source/esi/names.js"; +import { dao } from "../db/dao.js"; +import { CharacterShipRow } from "../db/dao/CharacterShipDao.js"; +import { Tnex } from "../db/tnex/index.js"; +import { AccessTokenError } from "../error/AccessTokenError.js"; +import { Asset, fetchAssets, formatLocationFlag } from "../eve/assets.js"; +import { TYPE_CATEGORY_SHIP } from "../eve/constants/categories.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../infra/logging/buildLogger"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { Task } from "../infra/taskrunner/Task"; -import { arrayToMap } from "../util/collections"; +import { buildLoggerFromFilename } from "../infra/logging/buildLogger.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { Task } from "../infra/taskrunner/Task.js"; +import { arrayToMap } from "../util/collections.js"; // If a character was updated less than 10 minutes ago, we consider it // unnecessary to update that character this time. diff --git a/src/task/syncCharacterLocations.ts b/src/task/syncCharacterLocations.ts index 72489087c..94f9c9cc8 100644 --- a/src/task/syncCharacterLocations.ts +++ b/src/task/syncCharacterLocations.ts @@ -1,17 +1,17 @@ import moment from "moment"; -import { getAccessTokensFromRows } from "../data-source/accessToken/accessToken"; -import { dao } from "../db/dao"; -import { Tnex } from "../db/tnex/index"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { CharacterLocation } from "../db/tables"; -import { Task } from "../infra/taskrunner/Task"; +import { getAccessTokensFromRows } from "../data-source/accessToken/accessToken.js"; +import { dao } from "../db/dao.js"; +import { Tnex } from "../db/tnex/index.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { CharacterLocation } from "../db/tables.js"; +import { Task } from "../infra/taskrunner/Task.js"; import { ESI_CHARACTERS_$characterId_LOCATION, ESI_CHARACTERS_$characterId_SHIP, -} from "../data-source/esi/endpoints"; -import { isAnyEsiError } from "../data-source/esi/error"; -import { fetchEsi } from "../data-source/esi/fetch/fetchEsi"; +} from "../data-source/esi/endpoints.js"; +import { isAnyEsiError } from "../data-source/esi/error.js"; +import { fetchEsi } from "../data-source/esi/fetch/fetchEsi.js"; export const syncCharacterLocations: Task = { name: "syncCharacterLocations", diff --git a/src/task/syncCombatStats.ts b/src/task/syncCombatStats.ts index be16724c1..9d0afe184 100644 --- a/src/task/syncCombatStats.ts +++ b/src/task/syncCombatStats.ts @@ -2,13 +2,13 @@ import Bluebird from "bluebird"; import moment from "moment"; import axios from "axios"; -import { dao } from "../db/dao"; -import { Tnex } from "../db/tnex/index"; -import { serialize } from "../util/asyncUtil"; -import { JobLogger } from "../infra/taskrunner/Job"; +import { dao } from "../db/dao.js"; +import { Tnex } from "../db/tnex/index.js"; +import { serialize } from "../util/asyncUtil.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../infra/logging/buildLogger"; -import { Task } from "../infra/taskrunner/Task"; +import { buildLoggerFromFilename } from "../infra/logging/buildLogger.js"; +import { Task } from "../infra/taskrunner/Task.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/task/syncCorps.ts b/src/task/syncCorps.ts index e70606b40..2a4979ac9 100644 --- a/src/task/syncCorps.ts +++ b/src/task/syncCorps.ts @@ -1,21 +1,21 @@ import moment from "moment"; -import { dao } from "../db/dao"; -import { Tnex } from "../db/tnex/index"; -import { JobLogger } from "../infra/taskrunner/Job"; +import { dao } from "../db/dao.js"; +import { Tnex } from "../db/tnex/index.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; import { isAnyEsiError, isMissingCharError, isRetryableError, -} from "../data-source/esi/error"; -import { UNKNOWN_CORPORATION_ID } from "../db/constants"; -import { CORP_DOOMHEIM } from "../shared/eveConstants"; -import { parallelize } from "../util/asyncUtil"; +} from "../data-source/esi/error.js"; +import { UNKNOWN_CORPORATION_ID } from "../db/constants.js"; +import { CORP_DOOMHEIM } from "../shared/eveConstants.js"; +import { parallelize } from "../util/asyncUtil.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../infra/logging/buildLogger"; -import { Task } from "../infra/taskrunner/Task"; -import { ESI_CHARACTERS_$characterId } from "../data-source/esi/endpoints"; -import { fetchEsi } from "../data-source/esi/fetch/fetchEsi"; +import { buildLoggerFromFilename } from "../infra/logging/buildLogger.js"; +import { Task } from "../infra/taskrunner/Task.js"; +import { ESI_CHARACTERS_$characterId } from "../data-source/esi/endpoints.js"; +import { fetchEsi } from "../data-source/esi/fetch/fetchEsi.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/task/syncKillmails.ts b/src/task/syncKillmails.ts index 6b2b6af14..b1190572e 100644 --- a/src/task/syncKillmails.ts +++ b/src/task/syncKillmails.ts @@ -1,13 +1,13 @@ import moment from "moment"; -import { Tnex } from "../db/tnex/index"; -import { dao } from "../db/dao"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { MemberCorporation } from "../db/tables"; -import { createPendingBattles } from "../domain/battle/createPendingBattles"; -import { Task } from "../infra/taskrunner/Task"; -import { processNewKillmails } from "./syncKillmails/process/processNewKillmails"; -import { fetchKillmails } from "./syncKillmails/fetch/fetchKillmails"; +import { Tnex } from "../db/tnex/index.js"; +import { dao } from "../db/dao.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { MemberCorporation } from "../db/tables.js"; +import { createPendingBattles } from "../domain/battle/createPendingBattles.js"; +import { Task } from "../infra/taskrunner/Task.js"; +import { processNewKillmails } from "./syncKillmails/process/processNewKillmails.js"; +import { fetchKillmails } from "./syncKillmails/fetch/fetchKillmails.js"; /** * Downloads and stores any recent killmails for all member and affiliated diff --git a/src/task/syncKillmails/fetch/EsiKillmailFetcher.ts b/src/task/syncKillmails/fetch/EsiKillmailFetcher.ts index 161280e61..0757919eb 100644 --- a/src/task/syncKillmails/fetch/EsiKillmailFetcher.ts +++ b/src/task/syncKillmails/fetch/EsiKillmailFetcher.ts @@ -1,14 +1,14 @@ import VError from "verror"; -import { OrderedParallelTransform } from "../../../util/stream/OrderedParallelTransform"; +import { OrderedParallelTransform } from "../../../util/stream/OrderedParallelTransform.js"; import { ZKillmail, ZKillDescriptor, -} from "../../../data-source/zkillboard/ZKillmail"; -import { ESI_KILLMAILS_$killmailId_$killmailHash } from "../../../data-source/esi/endpoints"; -import { EsiKillmail } from "../../../data-source/esi/EsiKillmail"; +} from "../../../data-source/zkillboard/ZKillmail.js"; +import { ESI_KILLMAILS_$killmailId_$killmailHash } from "../../../data-source/esi/endpoints.js"; +import { EsiKillmail } from "../../../data-source/esi/EsiKillmail.js"; import { AxiosError } from "axios"; -import { Logger } from "../../../infra/logging/Logger"; -import { fetchEsi } from "../../../data-source/esi/fetch/fetchEsi"; +import { Logger } from "../../../infra/logging/Logger.js"; +import { fetchEsi } from "../../../data-source/esi/fetch/fetchEsi.js"; /** * Given a stream of ZKillDesciptors, fetches the associated EsiKillmail and diff --git a/src/task/syncKillmails/fetch/KillmailOrderer.ts b/src/task/syncKillmails/fetch/KillmailOrderer.ts index 60aa9a34a..7e62276fc 100644 --- a/src/task/syncKillmails/fetch/KillmailOrderer.ts +++ b/src/task/syncKillmails/fetch/KillmailOrderer.ts @@ -1,10 +1,13 @@ -import { Transform, TransformCallback } from "../../../util/stream/Transform"; -import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail"; -import { Killmail } from "../../../db/tables"; -import { ArrayQueue } from "../../../util/collection/ArrayQueue"; -import { killmailToRow } from "./killmailToRow"; -import { BasicCallback } from "../../../util/stream/core"; -import { JobLogger } from "../../../infra/taskrunner/Job"; +import { + Transform, + TransformCallback, +} from "../../../util/stream/Transform.js"; +import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail.js"; +import { Killmail } from "../../../db/tables.js"; +import { ArrayQueue } from "../../../util/collection/ArrayQueue.js"; +import { killmailToRow } from "./killmailToRow.js"; +import { BasicCallback } from "../../../util/stream/core.js"; +import { JobLogger } from "../../../infra/taskrunner/Job.js"; /** * Given a stream of killmails whose timestamps are *mostly* in descending diff --git a/src/task/syncKillmails/fetch/KillmailWriter.ts b/src/task/syncKillmails/fetch/KillmailWriter.ts index 6db72491b..2b57cf3ae 100644 --- a/src/task/syncKillmails/fetch/KillmailWriter.ts +++ b/src/task/syncKillmails/fetch/KillmailWriter.ts @@ -1,7 +1,7 @@ -import { BatchedObjectWritable } from "../../../util/stream/BatchedObjectWritable"; -import { Killmail } from "../../../db/tables"; -import { Tnex, UpdatePolicy } from "../../../db/tnex/index"; -import { dao } from "../../../db/dao"; +import { BatchedObjectWritable } from "../../../util/stream/BatchedObjectWritable.js"; +import { Killmail } from "../../../db/tables.js"; +import { Tnex, UpdatePolicy } from "../../../db/tnex/index.js"; +import { dao } from "../../../db/dao.js"; /** * Simple batched DB writer for Killmails. Uses UPSERT rather than INSERT. diff --git a/src/task/syncKillmails/fetch/fetchKillmails.ts b/src/task/syncKillmails/fetch/fetchKillmails.ts index 2da21ed3b..528dab283 100644 --- a/src/task/syncKillmails/fetch/fetchKillmails.ts +++ b/src/task/syncKillmails/fetch/fetchKillmails.ts @@ -1,12 +1,12 @@ import moment from "moment"; -import { Tnex } from "../../../db/tnex/index"; -import { JobLogger } from "../../../infra/taskrunner/Job"; -import { ZKillmailStream } from "../../../data-source/zkillboard/ZKillmailStream"; -import { pipelinePr } from "../../../util/stream/pipeline"; -import { formatZKillTimeArgument } from "../../../data-source/zkillboard/formatZKillTimeArgument"; -import { EsiKillmailFetcher } from "./EsiKillmailFetcher"; -import { KillmailOrderer } from "./KillmailOrderer"; -import { KillmailWriter } from "./KillmailWriter"; +import { Tnex } from "../../../db/tnex/index.js"; +import { JobLogger } from "../../../infra/taskrunner/Job.js"; +import { ZKillmailStream } from "../../../data-source/zkillboard/ZKillmailStream.js"; +import { pipelinePr } from "../../../util/stream/pipeline.js"; +import { formatZKillTimeArgument } from "../../../data-source/zkillboard/formatZKillTimeArgument.js"; +import { EsiKillmailFetcher } from "./EsiKillmailFetcher.js"; +import { KillmailOrderer } from "./KillmailOrderer.js"; +import { KillmailWriter } from "./KillmailWriter.js"; /** * Fetches all killmails for a corporation whose timestamps are within the diff --git a/src/task/syncKillmails/fetch/killmailToRow.ts b/src/task/syncKillmails/fetch/killmailToRow.ts index 43ccabb35..07740b599 100644 --- a/src/task/syncKillmails/fetch/killmailToRow.ts +++ b/src/task/syncKillmails/fetch/killmailToRow.ts @@ -1,8 +1,8 @@ import moment from "moment"; -import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail"; -import { Killmail } from "../../../db/tables"; -import { HullCategory } from "../../../db/dao/enums"; -import { isCapsule } from "../../../eve/util/isCapsule"; +import { ZKillmail } from "../../../data-source/zkillboard/ZKillmail.js"; +import { Killmail } from "../../../db/tables.js"; +import { HullCategory } from "../../../db/dao/enums.js"; +import { isCapsule } from "../../../eve/util/isCapsule.js"; /** * Converts a ZKillmail to a row in the killmail table. diff --git a/src/task/syncKillmails/process/KillmailAssociator.ts b/src/task/syncKillmails/process/KillmailAssociator.ts index ecf50bdf0..fd9727708 100644 --- a/src/task/syncKillmails/process/KillmailAssociator.ts +++ b/src/task/syncKillmails/process/KillmailAssociator.ts @@ -1,9 +1,12 @@ -import { Transform, TransformCallback } from "../../../util/stream/Transform"; -import { UnprocessedKillmailRow } from "../../../db/dao/KillmailDao"; -import { ArrayQueue } from "../../../util/collection/ArrayQueue"; -import { HullCategory } from "../../../db/dao/enums"; -import { BasicCallback } from "../../../util/stream/core"; -import { ProcessedKillmail } from "./ProcessedKillmail"; +import { + Transform, + TransformCallback, +} from "../../../util/stream/Transform.js"; +import { UnprocessedKillmailRow } from "../../../db/dao/KillmailDao.js"; +import { ArrayQueue } from "../../../util/collection/ArrayQueue.js"; +import { HullCategory } from "../../../db/dao/enums.js"; +import { BasicCallback } from "../../../util/stream/core.js"; +import { ProcessedKillmail } from "./ProcessedKillmail.js"; /** * Associates capsule losses with the ship they came from (if any). diff --git a/src/task/syncKillmails/process/KillmailProcessor.ts b/src/task/syncKillmails/process/KillmailProcessor.ts index f9b562525..0fb462c5e 100644 --- a/src/task/syncKillmails/process/KillmailProcessor.ts +++ b/src/task/syncKillmails/process/KillmailProcessor.ts @@ -1,10 +1,10 @@ -import { BatchedObjectWritable } from "../../../util/stream/BatchedObjectWritable"; -import { ProcessedKillmail } from "./ProcessedKillmail"; -import { Tnex } from "../../../db/tnex/index"; -import { dao } from "../../../db/dao"; -import { LossRow } from "../../../domain/srp/triage/triageLosses"; -import { autoTriageLosses } from "../../../domain/srp/triage/autoTriageLosses"; -import { Killmail } from "../../../db/tables"; +import { BatchedObjectWritable } from "../../../util/stream/BatchedObjectWritable.js"; +import { ProcessedKillmail } from "./ProcessedKillmail.js"; +import { Tnex } from "../../../db/tnex/index.js"; +import { dao } from "../../../db/dao.js"; +import { LossRow } from "../../../domain/srp/triage/triageLosses.js"; +import { autoTriageLosses } from "../../../domain/srp/triage/autoTriageLosses.js"; +import { Killmail } from "../../../db/tables.js"; /** * Marks rows as processed, updates relatedLoss (if necessary), creates SRP diff --git a/src/task/syncKillmails/process/ProcessedKillmail.ts b/src/task/syncKillmails/process/ProcessedKillmail.ts index 619de5efe..c21d01d0c 100644 --- a/src/task/syncKillmails/process/ProcessedKillmail.ts +++ b/src/task/syncKillmails/process/ProcessedKillmail.ts @@ -1,5 +1,5 @@ -import { UnprocessedKillmailRow } from "../../../db/dao/KillmailDao"; -import { Killmail } from "../../../db/tables"; +import { UnprocessedKillmailRow } from "../../../db/dao/KillmailDao.js"; +import { Killmail } from "../../../db/tables.js"; /** Represents a killmail that's moving through the processing pipeline. */ export interface ProcessedKillmail { diff --git a/src/task/syncKillmails/process/processNewKillmails.ts b/src/task/syncKillmails/process/processNewKillmails.ts index 040383b9e..e04dd0484 100644 --- a/src/task/syncKillmails/process/processNewKillmails.ts +++ b/src/task/syncKillmails/process/processNewKillmails.ts @@ -1,11 +1,11 @@ import moment from "moment"; -import { Tnex } from "../../../db/tnex/index"; -import { BatchedObjectReadable } from "../../../util/stream/BatchedObjectReadable"; -import { dao } from "../../../db/dao"; -import { pipelinePr } from "../../../util/stream/pipeline"; -import { KillmailAssociator } from "./KillmailAssociator"; -import { KillmailProcessor } from "./KillmailProcessor"; -import { JobLogger } from "../../../infra/taskrunner/Job"; +import { Tnex } from "../../../db/tnex/index.js"; +import { BatchedObjectReadable } from "../../../util/stream/BatchedObjectReadable.js"; +import { dao } from "../../../db/dao.js"; +import { pipelinePr } from "../../../util/stream/pipeline.js"; +import { KillmailAssociator } from "./KillmailAssociator.js"; +import { KillmailProcessor } from "./KillmailProcessor.js"; +import { JobLogger } from "../../../infra/taskrunner/Job.js"; /** * Processes any killmails whose "processed" column is false diff --git a/src/task/syncNotifications.ts b/src/task/syncNotifications.ts index 566f1bc2c..39b779698 100644 --- a/src/task/syncNotifications.ts +++ b/src/task/syncNotifications.ts @@ -1,17 +1,17 @@ import _ from "underscore"; import moment from "moment"; -import { getAccessToken } from "../data-source/accessToken/accessToken"; -import { isAnyEsiError } from "../data-source/esi/error"; -import { EsiNotification } from "../data-source/esi/EsiNotification"; -import { fetchEsi } from "../data-source/esi/fetch/fetchEsi"; -import { ESI_CHARACTERS_$characterId_NOTIFICATIONS } from "../data-source/esi/endpoints"; -import { dao } from "../db/dao"; -import { Tnex } from "../db/tnex/index"; -import { AccessTokenError } from "../error/AccessTokenError"; +import { getAccessToken } from "../data-source/accessToken/accessToken.js"; +import { isAnyEsiError } from "../data-source/esi/error.js"; +import { EsiNotification } from "../data-source/esi/EsiNotification.js"; +import { fetchEsi } from "../data-source/esi/fetch/fetchEsi.js"; +import { ESI_CHARACTERS_$characterId_NOTIFICATIONS } from "../data-source/esi/endpoints.js"; +import { dao } from "../db/dao.js"; +import { Tnex } from "../db/tnex/index.js"; +import { AccessTokenError } from "../error/AccessTokenError.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../infra/logging/buildLogger"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { Task } from "../infra/taskrunner/Task"; +import { buildLoggerFromFilename } from "../infra/logging/buildLogger.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { Task } from "../infra/taskrunner/Task.js"; import { trace, context } from "@opentelemetry/api"; diff --git a/src/task/syncRoster.ts b/src/task/syncRoster.ts index b41f23fb8..0ef81b94b 100644 --- a/src/task/syncRoster.ts +++ b/src/task/syncRoster.ts @@ -1,28 +1,28 @@ import moment from "moment"; -import { Tnex, val, UpdatePolicy } from "../db/tnex/index"; -import { character, Character, MemberCorporation } from "../db/tables"; -import { getAccessToken } from "../data-source/accessToken/accessToken"; -import { dao } from "../db/dao"; -import { arrayToMap, refine } from "../util/collections"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { fetchEveNames } from "../data-source/esi/names"; -import { UNKNOWN_CORPORATION_ID } from "../db/constants"; +import { Tnex, val, UpdatePolicy } from "../db/tnex/index.js"; +import { character, Character, MemberCorporation } from "../db/tables.js"; +import { getAccessToken } from "../data-source/accessToken/accessToken.js"; +import { dao } from "../db/dao.js"; +import { arrayToMap, refine } from "../util/collections.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { fetchEveNames } from "../data-source/esi/names.js"; +import { UNKNOWN_CORPORATION_ID } from "../db/constants.js"; import { ESI_CORPORATIONS_$corporationId_MEMBERS, ESI_CORPORATIONS_$corporationId_TITLES, ESI_CORPORATIONS_$corporationId_MEMBERS_TITLES, ESI_CORPORATIONS_$corporationId_ROLES, ESI_CORPORATIONS_$corporationId_MEMBERTRACKING, -} from "../data-source/esi/endpoints"; -import { isAnyEsiError, printError } from "../data-source/esi/error"; -import { hasRosterScopes } from "../domain/roster/hasRosterScopes"; -import { AccessTokenError } from "../error/AccessTokenError"; -import { AsyncReturnType } from "../util/simpleTypes"; -import { updateGroupsOnAllAccounts } from "../domain/account/accountGroups"; -import { LogLevel } from "../infra/logging/Logger"; -import { Task } from "../infra/taskrunner/Task"; -import { fetchEsi } from "../data-source/esi/fetch/fetchEsi"; +} from "../data-source/esi/endpoints.js"; +import { isAnyEsiError, printError } from "../data-source/esi/error.js"; +import { hasRosterScopes } from "../domain/roster/hasRosterScopes.js"; +import { AccessTokenError } from "../error/AccessTokenError.js"; +import { AsyncReturnType } from "../util/simpleTypes.js"; +import { updateGroupsOnAllAccounts } from "../domain/account/accountGroups.js"; +import { LogLevel } from "../infra/logging/Logger.js"; +import { Task } from "../infra/taskrunner/Task.js"; +import { fetchEsi } from "../data-source/esi/fetch/fetchEsi.js"; /** * Updates the member list of each member corporation. diff --git a/src/task/syncSkills.ts b/src/task/syncSkills.ts index abbf965a3..1b744bb9d 100644 --- a/src/task/syncSkills.ts +++ b/src/task/syncSkills.ts @@ -1,15 +1,15 @@ import Bluebird from "bluebird"; import moment from "moment"; -import { dao } from "../db/dao"; -import { Tnex } from "../db/tnex/index"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { updateSkills } from "../domain/skills/skills"; -import { AccessTokenError } from "../error/AccessTokenError"; -import { isAnyEsiError } from "../data-source/esi/error"; +import { dao } from "../db/dao.js"; +import { Tnex } from "../db/tnex/index.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { updateSkills } from "../domain/skills/skills.js"; +import { AccessTokenError } from "../error/AccessTokenError.js"; +import { isAnyEsiError } from "../data-source/esi/error.js"; import { fileURLToPath } from "url"; -import { buildLoggerFromFilename } from "../infra/logging/buildLogger"; -import { Task } from "../infra/taskrunner/Task"; +import { buildLoggerFromFilename } from "../infra/logging/buildLogger.js"; +import { Task } from "../infra/taskrunner/Task.js"; const logger = buildLoggerFromFilename(fileURLToPath(import.meta.url)); diff --git a/src/task/triagePendingLosses.ts b/src/task/triagePendingLosses.ts index 8b78d68d6..0fb37d2da 100644 --- a/src/task/triagePendingLosses.ts +++ b/src/task/triagePendingLosses.ts @@ -1,11 +1,11 @@ import moment from "moment"; -import { Tnex } from "../db/tnex/index"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { dao } from "../db/dao"; -import { SrpVerdictStatus } from "../db/dao/enums"; -import { autoTriageLosses } from "../domain/srp/triage/autoTriageLosses"; -import { Task } from "../infra/taskrunner/Task"; +import { Tnex } from "../db/tnex/index.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { dao } from "../db/dao.js"; +import { SrpVerdictStatus } from "../db/dao/enums.js"; +import { autoTriageLosses } from "../domain/srp/triage/autoTriageLosses.js"; +import { Task } from "../infra/taskrunner/Task.js"; /** * Manually runs the SRP autotriage rules on all losses that are still marked diff --git a/src/task/truncateCharacterLocations.ts b/src/task/truncateCharacterLocations.ts index c471a5e2a..886b564b9 100644 --- a/src/task/truncateCharacterLocations.ts +++ b/src/task/truncateCharacterLocations.ts @@ -1,9 +1,9 @@ import moment from "moment"; -import { Tnex } from "../db/tnex/index"; -import { dao } from "../db/dao"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { Task } from "../infra/taskrunner/Task"; +import { Tnex } from "../db/tnex/index.js"; +import { dao } from "../db/dao.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { Task } from "../infra/taskrunner/Task.js"; export const truncateCharacterLocations: Task = { name: "truncateCharacterLocations", diff --git a/src/task/truncateCronLog.ts b/src/task/truncateCronLog.ts index b15e8e9ab..86b941843 100644 --- a/src/task/truncateCronLog.ts +++ b/src/task/truncateCronLog.ts @@ -1,9 +1,9 @@ import moment from "moment"; -import { Tnex } from "../db/tnex/index"; -import { dao } from "../db/dao"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { Task } from "../infra/taskrunner/Task"; +import { Tnex } from "../db/tnex/index.js"; +import { dao } from "../db/dao.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { Task } from "../infra/taskrunner/Task.js"; export const truncateCronLog: Task = { name: "truncateCronLog", diff --git a/src/task/updateSde.ts b/src/task/updateSde.ts index f2273b965..1b2901c3b 100644 --- a/src/task/updateSde.ts +++ b/src/task/updateSde.ts @@ -2,11 +2,11 @@ import * as fs from "fs"; import * as tmp from "tmp"; import moment from "moment"; -import { Tnex } from "../db/tnex/index"; -import { JobLogger } from "../infra/taskrunner/Job"; -import { acquireSde } from "./updateSde/acquireSde"; -import { ingestSde } from "./updateSde/ingestSde"; -import { Task } from "../infra/taskrunner/Task"; +import { Tnex } from "../db/tnex/index.js"; +import { JobLogger } from "../infra/taskrunner/Job.js"; +import { acquireSde } from "./updateSde/acquireSde.js"; +import { ingestSde } from "./updateSde/ingestSde.js"; +import { Task } from "../infra/taskrunner/Task.js"; /** * Downloads the EVE static data export (SDE) and imports the parts that we diff --git a/src/task/updateSde/acquireSde.ts b/src/task/updateSde/acquireSde.ts index 2a86c7f04..b25406a40 100644 --- a/src/task/updateSde/acquireSde.ts +++ b/src/task/updateSde/acquireSde.ts @@ -2,7 +2,7 @@ import * as fs from "fs"; import axios from "axios"; import progress from "progress-stream"; -import { JobLogger } from "../../infra/taskrunner/Job"; +import { JobLogger } from "../../infra/taskrunner/Job.js"; import bz2 from "unbzip2-stream"; diff --git a/src/task/updateSde/fixupImport.ts b/src/task/updateSde/fixupImport.ts index c7983c58b..77fec183f 100644 --- a/src/task/updateSde/fixupImport.ts +++ b/src/task/updateSde/fixupImport.ts @@ -1,4 +1,4 @@ -import { Tnex } from "../../db/tnex/index"; +import { Tnex } from "../../db/tnex/index.js"; /** * Repair or remove and inconsistencies in the imported SDE data, such as diff --git a/src/task/updateSde/ingestSde.ts b/src/task/updateSde/ingestSde.ts index aec9123cc..3a60ff0c3 100644 --- a/src/task/updateSde/ingestSde.ts +++ b/src/task/updateSde/ingestSde.ts @@ -1,23 +1,23 @@ import sqlite3 from "sqlite3"; -import { Tnex, val, DEFAULT_NUM } from "../../db/tnex/index"; +import { Tnex, val, DEFAULT_NUM } from "../../db/tnex/index.js"; import { sdeImport, sdeType, sdeAttribute, sdeTypeAttribute, -} from "../../db/tables"; +} from "../../db/tables.js"; -import { JobLogger } from "../../infra/taskrunner/Job"; -import { checkNotNil } from "../../util/assert"; -import { normalizeSearchStr } from "../../eve/sde/normalizeSearchStr"; -import { computeMd5 } from "./computeMd5"; -import { fixupImport } from "./fixupImport"; -import { verifyImport } from "./verifyImport"; +import { JobLogger } from "../../infra/taskrunner/Job.js"; +import { checkNotNil } from "../../util/assert.js"; +import { normalizeSearchStr } from "../../eve/sde/normalizeSearchStr.js"; +import { computeMd5 } from "./computeMd5.js"; +import { fixupImport } from "./fixupImport.js"; +import { verifyImport } from "./verifyImport.js"; import { TYPE_CAPSULE, TYPE_CAPSULE_GENOLUTION, -} from "../../eve/constants/types"; +} from "../../eve/constants/types.js"; const IMPORTER_VERSION = 0; const IMPORT_LABEL = "Importing new SDE data..."; diff --git a/src/task/updateSde/verifyImport.ts b/src/task/updateSde/verifyImport.ts index a4ff93222..2d1427954 100644 --- a/src/task/updateSde/verifyImport.ts +++ b/src/task/updateSde/verifyImport.ts @@ -1,5 +1,5 @@ -import { Tnex } from "../../db/tnex/index"; -import * as sde from "../../eve/sde"; +import { Tnex } from "../../db/tnex/index.js"; +import * as sde from "../../eve/sde.js"; export async function verifyImport(db: Tnex) { await sde.loadStaticData(db, true /* strict mode */); diff --git a/src/types/expressTypes.ts b/src/types/expressTypes.ts index 984607b91..3261619e5 100644 --- a/src/types/expressTypes.ts +++ b/src/types/expressTypes.ts @@ -1,6 +1,6 @@ /* eslint @typescript-eslint/no-namespace: "off" */ -import { Tnex } from "../db/tnex/index"; +import { Tnex } from "../db/tnex/index.js"; declare global { namespace Express { diff --git a/src/util/RateLimiter.ts b/src/util/RateLimiter.ts index 25bd999c0..4a5027f12 100644 --- a/src/util/RateLimiter.ts +++ b/src/util/RateLimiter.ts @@ -1,4 +1,4 @@ -import { ArrayQueue } from "./collection/ArrayQueue"; +import { ArrayQueue } from "./collection/ArrayQueue.js"; /** * Provides a way to rate-limit access to a resource. diff --git a/src/util/express/paramVerifier.ts b/src/util/express/paramVerifier.ts index 92d60e16c..cf48c1616 100644 --- a/src/util/express/paramVerifier.ts +++ b/src/util/express/paramVerifier.ts @@ -1,7 +1,7 @@ import express from "express"; -import { BadRequestError } from "../../error/BadRequestError"; -import { MixedObject } from "../simpleTypes"; +import { BadRequestError } from "../../error/BadRequestError.js"; +import { MixedObject } from "../simpleTypes.js"; const POSITIVE_INTEGER_PATTERN = /^\d+$/; diff --git a/src/util/express/schemaVerifier.ts b/src/util/express/schemaVerifier.ts index 42c2ce88c..0a08f6533 100644 --- a/src/util/express/schemaVerifier.ts +++ b/src/util/express/schemaVerifier.ts @@ -1,4 +1,4 @@ -import { ExtendableError } from "../../error/ExtendableError"; +import { ExtendableError } from "../../error/ExtendableError.js"; /** * Example: diff --git a/src/util/sortBy.ts b/src/util/sortBy.ts index 656016489..97783683a 100644 --- a/src/util/sortBy.ts +++ b/src/util/sortBy.ts @@ -1,4 +1,4 @@ -import { KeysOfType, nil } from "./simpleTypes"; +import { KeysOfType, nil } from "./simpleTypes.js"; /** * Sorts an array of objects by one or more properites of those objects. diff --git a/src/util/stream/BatchedObjectReadable.ts b/src/util/stream/BatchedObjectReadable.ts index 0ff83a826..919949f55 100644 --- a/src/util/stream/BatchedObjectReadable.ts +++ b/src/util/stream/BatchedObjectReadable.ts @@ -1,4 +1,4 @@ -import { Readable } from "./Readable"; +import { Readable } from "./Readable.js"; /** * Given an asynchronous 'iterator' that returns an array of objects, diff --git a/src/util/stream/BatchedObjectWritable.ts b/src/util/stream/BatchedObjectWritable.ts index 0f5647d4f..1af381187 100644 --- a/src/util/stream/BatchedObjectWritable.ts +++ b/src/util/stream/BatchedObjectWritable.ts @@ -1,5 +1,5 @@ -import { Writable } from "./Writable"; -import { BasicCallback } from "./core"; +import { Writable } from "./Writable.js"; +import { BasicCallback } from "./core.js"; /** * Abstract writable stream that batches writes in order to improve performance. diff --git a/src/util/stream/Duplex.d.ts b/src/util/stream/Duplex.d.ts index 2b48e182a..80c242f86 100644 --- a/src/util/stream/Duplex.d.ts +++ b/src/util/stream/Duplex.d.ts @@ -1,8 +1,8 @@ /* global NodeJS */ -import { WritableOptions } from "./Writable"; -import { ReadStream, ReadableOptions } from "./Readable"; -import { BasicCallback } from "./core"; +import { WritableOptions } from "./Writable.js"; +import { ReadStream, ReadableOptions } from "./Readable.js"; +import { BasicCallback } from "./core.js"; export interface Duplex extends ReadWriteStream {} export class Duplex { diff --git a/src/util/stream/OrderedParallelTransform.ts b/src/util/stream/OrderedParallelTransform.ts index ca41fd59e..806546441 100644 --- a/src/util/stream/OrderedParallelTransform.ts +++ b/src/util/stream/OrderedParallelTransform.ts @@ -1,6 +1,6 @@ -import { Transform, TransformCallback } from "./Transform"; -import { BasicCallback } from "./core"; -import { ArrayQueue } from "../collection/ArrayQueue"; +import { Transform, TransformCallback } from "./Transform.js"; +import { BasicCallback } from "./core.js"; +import { ArrayQueue } from "../collection/ArrayQueue.js"; /** * Transform stream that can process multiple entities at once. diff --git a/src/util/stream/Readable.d.ts b/src/util/stream/Readable.d.ts index 6769018dd..4774374e7 100644 --- a/src/util/stream/Readable.d.ts +++ b/src/util/stream/Readable.d.ts @@ -1,8 +1,8 @@ /* global NodeJS */ import { EventEmitter } from "events"; -import { BasicCallback } from "./core"; -import { WriteStream } from "./Writable"; +import { BasicCallback } from "./core.js"; +import { WriteStream } from "./Writable.js"; export interface Readable extends ReadStream {} export class Readable { diff --git a/src/util/stream/Transform.d.ts b/src/util/stream/Transform.d.ts index 9724e65bc..ba160868e 100644 --- a/src/util/stream/Transform.d.ts +++ b/src/util/stream/Transform.d.ts @@ -1,4 +1,4 @@ -import { Duplex, DuplexOptions } from "./Duplex"; +import { Duplex, DuplexOptions } from "./Duplex.js"; export class Transform extends Duplex { constructor(opts?: DuplexOptions, In>); diff --git a/src/util/stream/Writable.d.ts b/src/util/stream/Writable.d.ts index c76f81ce6..4ab472716 100644 --- a/src/util/stream/Writable.d.ts +++ b/src/util/stream/Writable.d.ts @@ -1,6 +1,6 @@ import { EventEmitter } from "events"; -import { ReadStream } from "./Readable"; -import { BasicCallback } from "./core"; +import { ReadStream } from "./Readable.js"; +import { BasicCallback } from "./core.js"; export interface Writable extends WriteStream {} export class Writable { diff --git a/src/util/stream/pipeline.d.ts b/src/util/stream/pipeline.d.ts index 52176daaf..5b679607d 100644 --- a/src/util/stream/pipeline.d.ts +++ b/src/util/stream/pipeline.d.ts @@ -1,8 +1,8 @@ /* global NodeJS */ -import { WriteStream } from "./Writable"; -import { ReadStream } from "./Readable"; -import { ReadWriteStream } from "./Duplex"; +import { WriteStream } from "./Writable.js"; +import { ReadStream } from "./Readable.js"; +import { ReadWriteStream } from "./Duplex.js"; export function pipeline>( stream1: ReadStream, diff --git a/test/util/collection/ArrayQueue.test.ts b/test/util/collection/ArrayQueue.test.ts index 9afdaf3e1..6bbeba9dd 100644 --- a/test/util/collection/ArrayQueue.test.ts +++ b/test/util/collection/ArrayQueue.test.ts @@ -1,4 +1,4 @@ -import { ArrayQueue } from "../../../src/util/collection/ArrayQueue"; +import { ArrayQueue } from "../../../src/util/collection/ArrayQueue.js"; test("Basic contents", () => { const queue = new ArrayQueue(); diff --git a/test/util/sortBy.test.ts b/test/util/sortBy.test.ts index f4ef5b622..413f05ac7 100644 --- a/test/util/sortBy.test.ts +++ b/test/util/sortBy.test.ts @@ -3,7 +3,7 @@ import { cmpNumberProp, cmpStringProp, cmpNullProp, -} from "../../src/util/sortBy"; +} from "../../src/util/sortBy.js"; test("Null sort - simple", () => { expect( diff --git a/test/util/time.test.ts b/test/util/time.test.ts index bd37e5153..160d889ed 100644 --- a/test/util/time.test.ts +++ b/test/util/time.test.ts @@ -1,4 +1,4 @@ -import * as time from "../../src/util/time"; +import * as time from "../../src/util/time.js"; test("shortDurationString: output specificity = days", () => { expect( diff --git a/tsconfig.json b/tsconfig.json index 168aee987..cacc9eab1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,9 +6,9 @@ "target": "es2020", // Export Node-style modules since this is running on Node - "module": "es2020", + "module": "nodenext", // We're running on Node, so use this strategy. - "moduleResolution": "node", + "moduleResolution": "nodenext", // Various strictness guarantees when compiling "strict": true, @@ -26,13 +26,7 @@ "dom" ] /* Specify library files to be included in the compilation: */, "allowJs": true /* Allow javascript files to be compiled. */, - "sourceMap": true /* Generates corresponding '.map' file. */, - "plugins": [ - { - "transform": "@zoltu/typescript-transformer-append-js-extension/output/index.js", - "after": true - } - ] + "sourceMap": true /* Generates corresponding '.map' file. */ }, "include": ["src/**/*"], "exclude": ["node_modules", "static", "out/**/*", "src/client"] diff --git a/yarn.lock b/yarn.lock index 39d341f9f..ea6aefa1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1224,6 +1224,15 @@ __metadata: languageName: node linkType: hard +"@types/axios@npm:^0.14.0": + version: 0.14.0 + resolution: "@types/axios@npm:0.14.0" + dependencies: + axios: "npm:*" + checksum: 111f1677b03939e101ca633d610af4f7a45111c52337aac6c90776ef55c5c6e1ea2d0c8702b8c5cbc432a905006c47777e20faf669fb3d5d7834c56eb05f9e51 + languageName: node + linkType: hard + "@types/babel__core@npm:^7.0.0, @types/babel__core@npm:^7.1.14": version: 7.1.16 resolution: "@types/babel__core@npm:7.1.16" @@ -1362,6 +1371,15 @@ __metadata: languageName: node linkType: hard +"@types/express-rate-limit@npm:^6.0.0": + version: 6.0.0 + resolution: "@types/express-rate-limit@npm:6.0.0" + dependencies: + express-rate-limit: "npm:*" + checksum: 9f746ffe54a9b1a117e40e4df6a1ad92a29b4c70f47c06343642521d39dc45836ab7d370cff9a4f2f5de7196b7d8b9614bbec416e31fee32653058bd38607649 + languageName: node + linkType: hard + "@types/express-serve-static-core@npm:*, @types/express-serve-static-core@npm:^4.17.18": version: 4.17.24 resolution: "@types/express-serve-static-core@npm:4.17.24" @@ -1738,6 +1756,24 @@ __metadata: languageName: node linkType: hard +"@types/terser@npm:*": + version: 3.8.1 + resolution: "@types/terser@npm:3.8.1" + dependencies: + source-map: "npm:*" + checksum: 1f59eee5caab7629f8520eaed14126172456c2df7c3eebb99199da9d746a71f225ebabc57b1207b53d497fc2eb70117b45e0f5ab7f3d949c9d298e4a3cedb657 + languageName: node + linkType: hard + +"@types/terser@npm:^3.12.0": + version: 3.12.0 + resolution: "@types/terser@npm:3.12.0" + dependencies: + terser: "npm:*" + checksum: 844f4333356231c10fcc543e4f166c7baec76e3f705163c0f3d6109b7d70405bb5315ee44c2ade521bd82e61daecf4f921f8aaaff0f1960b335f6b09f856486d + languageName: node + linkType: hard + "@types/tmp@npm:^0.2.3": version: 0.2.3 resolution: "@types/tmp@npm:0.2.3" @@ -2236,13 +2272,6 @@ __metadata: languageName: node linkType: hard -"@zoltu/typescript-transformer-append-js-extension@npm:^1.0.1": - version: 1.0.1 - resolution: "@zoltu/typescript-transformer-append-js-extension@npm:1.0.1" - checksum: 049ec347f8989e97830b2c206bfca48ce1b44b007fc2aa11609b15f9af4b8fafb7ed5833c9ea268810c8aaddf5475b6428bbc1b0cdac91f3cabdef9d34598007 - languageName: node - linkType: hard - "abab@npm:^2.0.3, abab@npm:^2.0.5": version: 2.0.5 resolution: "abab@npm:2.0.5" @@ -2659,7 +2688,7 @@ __metadata: languageName: node linkType: hard -"axios@npm:^0.27.2": +"axios@npm:*, axios@npm:^0.27.2": version: 0.27.2 resolution: "axios@npm:0.27.2" dependencies: @@ -4771,6 +4800,7 @@ __metadata: "@sentry/browser": "npm:^6.19.7" "@sentry/node": "npm:^6.19.7" "@sentry/tracing": "npm:^6.19.7" + "@types/axios": "npm:^0.14.0" "@types/bluebird": "npm:^3.5.36" "@types/body-parser": "npm:^1.19.2" "@types/cookie-parser": "npm:^1.4.3" @@ -4779,6 +4809,7 @@ __metadata: "@types/csurf": "npm:^1.11.2" "@types/events": "npm:^3" "@types/express": "npm:^4.17.13" + "@types/express-rate-limit": "npm:^6.0.0" "@types/heapdump": "npm:^0.3.1" "@types/imagemin": "npm:^8" "@types/jest": "npm:^27.4.1" @@ -4793,6 +4824,7 @@ __metadata: "@types/sqlite3": "npm:^3.1.8" "@types/svgo": "npm:^2.6.3" "@types/swagger-ui": "npm:^3.52.0" + "@types/terser": "npm:^3.12.0" "@types/tmp": "npm:^0.2.3" "@types/underscore": "npm:^1.11.4" "@types/verror": "npm:^1.10.5" @@ -4802,7 +4834,6 @@ __metadata: "@typescript-eslint/parser": "npm:^5.21.0" "@vue/compiler-sfc": "npm:^3.2.33" "@vue/runtime-dom": "npm:^3.2.33" - "@zoltu/typescript-transformer-append-js-extension": "npm:^1.0.1" axios: "npm:^0.27.2" bluebird: "npm:^3.7.2" body-parser: "npm:^1.20.0" @@ -4858,7 +4889,6 @@ __metadata: tmp: "npm:^0.2.1" ts-jest: "npm:^27.1.4" ts-loader: "npm:^9.2.9" - ttypescript: "npm:^1.5.13" typescript: "npm:4.7.0-beta" unbzip2-stream: "npm:^1.4.3" underscore: "npm:^1.13.3" @@ -4993,7 +5023,7 @@ __metadata: languageName: node linkType: hard -"express-rate-limit@npm:^6.4.0": +"express-rate-limit@npm:*, express-rate-limit@npm:^6.4.0": version: 6.4.0 resolution: "express-rate-limit@npm:6.4.0" peerDependencies: @@ -7729,6 +7759,13 @@ __metadata: languageName: node linkType: hard +"lodash.sortby@npm:^4.7.0": + version: 4.7.0 + resolution: "lodash.sortby@npm:4.7.0" + checksum: 533eff6eecb504d3fdfe33e994bf89dd1ed377172b6b82b2690b60e0edd80befa5ad1a4089c2714c564c6f239406d40caac328e3daa16a33fa359263ec501a4e + languageName: node + linkType: hard + "lodash.uniq@npm:^4.5.0": version: 4.5.0 resolution: "lodash.uniq@npm:4.5.0" @@ -10393,7 +10430,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:>=1.9.0, resolve@npm:^1.10.0, resolve@npm:^1.12.0, resolve@npm:^1.15.1, resolve@npm:^1.20.0, resolve@npm:^1.9.0": +"resolve@npm:^1.10.0, resolve@npm:^1.12.0, resolve@npm:^1.15.1, resolve@npm:^1.20.0, resolve@npm:^1.9.0": version: 1.20.0 resolution: "resolve@npm:1.20.0" dependencies: @@ -10403,7 +10440,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@npm%3A>=1.9.0#optional!builtin, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.12.0#optional!builtin, resolve@patch:resolve@npm%3A^1.15.1#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.9.0#optional!builtin": +"resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.12.0#optional!builtin, resolve@patch:resolve@npm%3A^1.15.1#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.9.0#optional!builtin": version: 1.20.0 resolution: "resolve@patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b" dependencies: @@ -10875,7 +10912,7 @@ __metadata: languageName: node linkType: hard -"source-map-support@npm:^0.5.20, source-map-support@npm:^0.5.21, source-map-support@npm:^0.5.6, source-map-support@npm:~0.5.19": +"source-map-support@npm:^0.5.20, source-map-support@npm:^0.5.21, source-map-support@npm:^0.5.6, source-map-support@npm:~0.5.19, source-map-support@npm:~0.5.20": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" dependencies: @@ -10885,6 +10922,13 @@ __metadata: languageName: node linkType: hard +"source-map@npm:*, source-map@npm:^0.7.3, source-map@npm:~0.7.2": + version: 0.7.3 + resolution: "source-map@npm:0.7.3" + checksum: 5a00dce8ee0de43b5218608798422304d30f86ee551d8896b638606ceea90712323af12c52b6728e72214be8548c5c4bf230dca85bbbd03756b038b91c992d3e + languageName: node + linkType: hard + "source-map@npm:^0.5.0": version: 0.5.7 resolution: "source-map@npm:0.5.7" @@ -10899,10 +10943,12 @@ __metadata: languageName: node linkType: hard -"source-map@npm:^0.7.3, source-map@npm:~0.7.2": - version: 0.7.3 - resolution: "source-map@npm:0.7.3" - checksum: 5a00dce8ee0de43b5218608798422304d30f86ee551d8896b638606ceea90712323af12c52b6728e72214be8548c5c4bf230dca85bbbd03756b038b91c992d3e +"source-map@npm:~0.8.0-beta.0": + version: 0.8.0-beta.0 + resolution: "source-map@npm:0.8.0-beta.0" + dependencies: + whatwg-url: "npm:^7.0.0" + checksum: 4bc71864ed618ad3a75194fee233aff938dd1716010e34ca8c33e3216a5977ebf56ae6cd1102f72be1a9a7388d25c55865f7710ba30ea5255e8713f38eae89b3 languageName: node linkType: hard @@ -11454,6 +11500,20 @@ __metadata: languageName: node linkType: hard +"terser@npm:*": + version: 5.13.1 + resolution: "terser@npm:5.13.1" + dependencies: + acorn: "npm:^8.5.0" + commander: "npm:^2.20.0" + source-map: "npm:~0.8.0-beta.0" + source-map-support: "npm:~0.5.20" + bin: + terser: bin/terser + checksum: 81aee1ff4329585a4b45de152044aac3ac0040316242471bbfbb8c271858efc14a178322d30a0d6988175ba617f26d8a952019c2cdee67a9ac67e235ba881510 + languageName: node + linkType: hard + "terser@npm:^5.7.2": version: 5.7.2 resolution: "terser@npm:5.7.2" @@ -11628,6 +11688,15 @@ __metadata: languageName: node linkType: hard +"tr46@npm:^1.0.1": + version: 1.0.1 + resolution: "tr46@npm:1.0.1" + dependencies: + punycode: "npm:^2.1.0" + checksum: 077551401b0752fb141ba39d6c287b3783d32ac5a054a0e991b084c888e47789857f2957199840c1f1529deb9c6b9cbd53ab836f3bfcad41411f430e8685ddd8 + languageName: node + linkType: hard + "tr46@npm:^2.0.2": version: 2.0.2 resolution: "tr46@npm:2.0.2" @@ -11747,21 +11816,6 @@ __metadata: languageName: node linkType: hard -"ttypescript@npm:^1.5.13": - version: 1.5.13 - resolution: "ttypescript@npm:1.5.13" - dependencies: - resolve: "npm:>=1.9.0" - peerDependencies: - ts-node: ">=8.0.2" - typescript: ">=3.2.2" - bin: - ttsc: bin/tsc - ttsserver: bin/tsserver - checksum: fee8c3ef7fe2006e016ffc6cdac90dea9c85f71b0fd4e25c4a74d18a234b98cd71c82508daa4dc3612d527b0d1f9c49780226a290463908c1d3a8c08bc85c785 - languageName: node - linkType: hard - "tunnel-agent@npm:^0.6.0": version: 0.6.0 resolution: "tunnel-agent@npm:0.6.0" @@ -12232,6 +12286,13 @@ __metadata: languageName: node linkType: hard +"webidl-conversions@npm:^4.0.2": + version: 4.0.2 + resolution: "webidl-conversions@npm:4.0.2" + checksum: 68c1adc8200c122eeb9cd3ccb6407e929dab3108210a249ce485ac71acbe8d943cf97fe03687fe350295be467de1c0538d4ee0e0818267a941f1fbcdb0d8f765 + languageName: node + linkType: hard + "webidl-conversions@npm:^5.0.0": version: 5.0.0 resolution: "webidl-conversions@npm:5.0.0" @@ -12386,6 +12447,17 @@ __metadata: languageName: node linkType: hard +"whatwg-url@npm:^7.0.0": + version: 7.1.0 + resolution: "whatwg-url@npm:7.1.0" + dependencies: + lodash.sortby: "npm:^4.7.0" + tr46: "npm:^1.0.1" + webidl-conversions: "npm:^4.0.2" + checksum: 81485960495654692080d29ba6c311765eed40d8ea2227dc1a22609302d9091992255aabf6c17529a23efe3afae0527dd24f350895e25fbd2906225b1f389cbd + languageName: node + linkType: hard + "whatwg-url@npm:^8.0.0, whatwg-url@npm:^8.5.0": version: 8.5.0 resolution: "whatwg-url@npm:8.5.0"