forked from OpenWF/SpaceNinjaServer
chore: enforce consistent imports (#2408)
Reviewed-on: OpenWF/SpaceNinjaServer#2408 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
a75e6d6b95
commit
c7c7fd4ea0
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -19,6 +19,7 @@ jobs:
|
||||
- run: npm run lint:ci
|
||||
- run: npm run prettier
|
||||
- run: npm run update-translations
|
||||
- run: npm run fix-imports
|
||||
- name: Fail if there are uncommitted changes
|
||||
run: |
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
|
@ -19,7 +19,9 @@
|
||||
"lint:ci": "eslint --ext .ts --rule \"prettier/prettier: off\" .",
|
||||
"lint:fix": "eslint --fix --ext .ts .",
|
||||
"prettier": "prettier --write .",
|
||||
"update-translations": "cd scripts && node update-translations.js"
|
||||
"update-translations": "cd scripts && node update-translations.js",
|
||||
"fix-imports": "cd scripts && node fix-imports.js",
|
||||
"fix": "npm run update-translations && npm run fix-imports && npm run prettier"
|
||||
},
|
||||
"license": "GNU",
|
||||
"dependencies": {
|
||||
|
46
scripts/fix-imports.js
Normal file
46
scripts/fix-imports.js
Normal file
@ -0,0 +1,46 @@
|
||||
/* eslint-disable */
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const root = path.join(process.cwd(), "..");
|
||||
|
||||
function listFiles(dir) {
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
let results = [];
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
results = results.concat(listFiles(fullPath));
|
||||
} else {
|
||||
results.push(fullPath);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
const files = listFiles(path.join(root, "src"));
|
||||
|
||||
for (const file of files) {
|
||||
let content;
|
||||
try {
|
||||
content = fs.readFileSync(file, "utf8");
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
const dir = path.dirname(file);
|
||||
const fixedContent = content.replaceAll(/} from "([^"]+)";/g, (sub, importPath) => {
|
||||
if (!importPath.startsWith("@/")) {
|
||||
const fullImportPath = path.resolve(dir, importPath);
|
||||
if (fs.existsSync(fullImportPath + ".ts")) {
|
||||
const relative = path.relative(root, fullImportPath).replace(/\\/g, "/");
|
||||
const fixedPath = "@/" + relative;
|
||||
console.log(`${importPath} -> ${fixedPath}`);
|
||||
return sub.split(importPath).join(fixedPath);
|
||||
}
|
||||
}
|
||||
return sub;
|
||||
});
|
||||
if (content != fixedContent) {
|
||||
fs.writeFileSync(file, fixedContent, "utf8");
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ import { getAccountForRequest } from "@/src/services/loginService";
|
||||
import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes";
|
||||
import { addMissionInventoryUpdates, addMissionRewards } from "@/src/services/missionInventoryUpdateService";
|
||||
import { getInventory } from "@/src/services/inventoryService";
|
||||
import { getInventoryResponse } from "./inventoryController";
|
||||
import { getInventoryResponse } from "@/src/controllers/api/inventoryController";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { IMissionInventoryUpdateResponse } from "@/src/types/missionTypes";
|
||||
import { sendWsBroadcastTo } from "@/src/services/wsService";
|
||||
|
@ -2,7 +2,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||
import { getInventory } from "@/src/services/inventoryService";
|
||||
import { RequestHandler } from "express";
|
||||
import { ISettings } from "../../types/inventoryTypes/inventoryTypes";
|
||||
import { ISettings } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
|
||||
interface ISaveSettingsRequest {
|
||||
Settings: ISettings;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { IAccountCreation } from "@/src/types/customTypes";
|
||||
import { IDatabaseAccountRequiredFields } from "@/src/types/loginTypes";
|
||||
import crypto from "crypto";
|
||||
import { isString, parseEmail, parseString } from "../general";
|
||||
import { isString, parseEmail, parseString } from "@/src/helpers/general";
|
||||
|
||||
const getWhirlpoolHash = (rawPassword: string): string => {
|
||||
const whirlpool = crypto.createHash("whirlpool");
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { TEquipmentKey } from "../types/inventoryTypes/inventoryTypes";
|
||||
import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
|
||||
export const modularWeaponTypes: Record<string, TEquipmentKey> = {
|
||||
"/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimary": "LongGuns",
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { ExportRegions, ExportWarframes } from "warframe-public-export-plus";
|
||||
import { IInfNode, TNemesisFaction } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { generateRewardSeed, getRewardAtPercentage, SRng } from "@/src/services/rngService";
|
||||
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||
import { IOid } from "../types/commonTypes";
|
||||
import { isArchwingMission } from "../services/worldStateService";
|
||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { IOid } from "@/src/types/commonTypes";
|
||||
import { isArchwingMission } from "@/src/services/worldStateService";
|
||||
|
||||
type TInnateDamageTag =
|
||||
| "InnateElectricityDamage"
|
||||
|
@ -5,8 +5,8 @@ import { getRandomWeightedReward, IRngResult } from "@/src/services/rngService";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { addMiscItems, combineInventoryChanges } from "@/src/services/inventoryService";
|
||||
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
||||
import { IInventoryChanges } from "../types/purchaseTypes";
|
||||
import { config } from "../services/configService";
|
||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
import { config } from "@/src/services/configService";
|
||||
|
||||
export const crackRelic = async (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IUpgrade } from "warframe-public-export-plus";
|
||||
import { getRandomElement, getRandomInt, getRandomReward } from "../services/rngService";
|
||||
import { getRandomElement, getRandomInt, getRandomReward } from "@/src/services/rngService";
|
||||
|
||||
export type RivenFingerprint = IVeiledRivenFingerprint | IUnveiledRivenFingerprint;
|
||||
|
||||
|
@ -19,10 +19,10 @@ logger.info("Starting up...");
|
||||
// Proceed with normal startup: bring up config watcher service, validate config, connect to MongoDB, and finally start listening for HTTP.
|
||||
import mongoose from "mongoose";
|
||||
import { JSONStringify } from "json-with-bigint";
|
||||
import { startWebServer } from "./services/webService";
|
||||
import { startWebServer } from "@/src/services/webService";
|
||||
|
||||
import { syncConfigWithDatabase, validateConfig } from "@/src/services/configWatcherService";
|
||||
import { updateWorldStateCollections } from "./services/worldStateService";
|
||||
import { updateWorldStateCollections } from "@/src/services/worldStateService";
|
||||
|
||||
// Patch JSON.stringify to work flawlessly with Bigints.
|
||||
JSON.stringify = JSONStringify;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { logger } from "../utils/logger";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
|
||||
export const errorHandler = (err: Error, req: Request, res: Response, _next: NextFunction): void => {
|
||||
if (err.message == "Invalid accountId-nonce pair") {
|
||||
|
@ -17,8 +17,8 @@ import {
|
||||
GuildPermission
|
||||
} from "@/src/types/guildTypes";
|
||||
import { Document, Model, model, Schema, Types } from "mongoose";
|
||||
import { fusionTreasuresSchema, typeCountSchema } from "./inventoryModels/inventoryModel";
|
||||
import { pictureFrameInfoSchema } from "./personalRoomsModel";
|
||||
import { fusionTreasuresSchema, typeCountSchema } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { pictureFrameInfoSchema } from "@/src/models/personalRoomsModel";
|
||||
|
||||
const dojoDecoSchema = new Schema<IDojoDecoDatabase>({
|
||||
Type: String,
|
||||
|
@ -89,8 +89,8 @@ import {
|
||||
IPersonalGoalProgressClient,
|
||||
IKubrowPetPrintClient,
|
||||
IKubrowPetPrintDatabase
|
||||
} from "../../types/inventoryTypes/inventoryTypes";
|
||||
import { IOid, ITypeCount } from "../../types/commonTypes";
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IOid, ITypeCount } from "@/src/types/commonTypes";
|
||||
import {
|
||||
IAbilityOverride,
|
||||
ICrewShipCustomization,
|
||||
@ -101,9 +101,9 @@ import {
|
||||
IPolarity
|
||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||
import { EquipmentSelectionSchema, oidSchema } from "./loadoutModel";
|
||||
import { EquipmentSelectionSchema, oidSchema } from "@/src/models/inventoryModels/loadoutModel";
|
||||
import { ICountedStoreItem } from "warframe-public-export-plus";
|
||||
import { colorSchema, shipCustomizationSchema } from "../commonModel";
|
||||
import { colorSchema, shipCustomizationSchema } from "@/src/models/commonModel";
|
||||
import {
|
||||
IArchonCrystalUpgrade,
|
||||
ICrewShipMemberClient,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Document, model, Schema, Types } from "mongoose";
|
||||
import { ILeaderboardEntryDatabase } from "../types/leaderboardTypes";
|
||||
import { ILeaderboardEntryDatabase } from "@/src/types/leaderboardTypes";
|
||||
|
||||
const leaderboardEntrySchema = new Schema<ILeaderboardEntryDatabase>(
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ import {
|
||||
PersonalRoomsModelType
|
||||
} from "@/src/types/personalRoomsTypes";
|
||||
import { Schema, Types, model } from "mongoose";
|
||||
import { colorSchema, shipCustomizationSchema } from "./commonModel";
|
||||
import { colorSchema, shipCustomizationSchema } from "@/src/models/commonModel";
|
||||
|
||||
export const pictureFrameInfoSchema = new Schema<IPictureFrameInfo>(
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Document, Schema, Types, model } from "mongoose";
|
||||
import { IShipDatabase } from "../types/shipTypes";
|
||||
import { IShipDatabase } from "@/src/types/shipTypes";
|
||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||
import { colorSchema } from "@/src/models/commonModel";
|
||||
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
|
@ -1,10 +1,10 @@
|
||||
import chokidar from "chokidar";
|
||||
import fsPromises from "fs/promises";
|
||||
import { logger } from "../utils/logger";
|
||||
import { config, configPath, loadConfig } from "./configService";
|
||||
import { getWebPorts, startWebServer, stopWebServer } from "./webService";
|
||||
import { sendWsBroadcast } from "./wsService";
|
||||
import { Inbox } from "../models/inboxModel";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { config, configPath, loadConfig } from "@/src/services/configService";
|
||||
import { getWebPorts, startWebServer, stopWebServer } from "@/src/services/webService";
|
||||
import { sendWsBroadcast } from "@/src/services/wsService";
|
||||
import { Inbox } from "@/src/models/inboxModel";
|
||||
import varzia from "@/static/fixed_responses/worldState/varzia.json";
|
||||
|
||||
let amnesia = false;
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { IFriendInfo } from "../types/friendTypes";
|
||||
import { getInventory } from "./inventoryService";
|
||||
import { config } from "./configService";
|
||||
import { Account } from "../models/loginModel";
|
||||
import { IFriendInfo } from "@/src/types/friendTypes";
|
||||
import { getInventory } from "@/src/services/inventoryService";
|
||||
import { config } from "@/src/services/configService";
|
||||
import { Account } from "@/src/models/loginModel";
|
||||
import { Types } from "mongoose";
|
||||
import { Friendship } from "../models/friendModel";
|
||||
import { fromOid, toMongoDate } from "../helpers/inventoryHelpers";
|
||||
import { Friendship } from "@/src/models/friendModel";
|
||||
import { fromOid, toMongoDate } from "@/src/helpers/inventoryHelpers";
|
||||
|
||||
export const addAccountDataToFriendInfo = async (info: IFriendInfo): Promise<void> => {
|
||||
const account = (await Account.findById(fromOid(info._id), "DisplayName LastLogin"))!;
|
||||
|
@ -22,17 +22,17 @@ import {
|
||||
import { toMongoDate, toOid, toOid2 } from "@/src/helpers/inventoryHelpers";
|
||||
import { Types } from "mongoose";
|
||||
import { ExportDojoRecipes, ExportResources, IDojoBuild, IDojoResearch } from "warframe-public-export-plus";
|
||||
import { logger } from "../utils/logger";
|
||||
import { config } from "./configService";
|
||||
import { getRandomInt } from "./rngService";
|
||||
import { Inbox } from "../models/inboxModel";
|
||||
import { IFusionTreasure } from "../types/inventoryTypes/inventoryTypes";
|
||||
import { IInventoryChanges } from "../types/purchaseTypes";
|
||||
import { parallelForeach } from "../utils/async-utils";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { config } from "@/src/services/configService";
|
||||
import { getRandomInt } from "@/src/services/rngService";
|
||||
import { Inbox } from "@/src/models/inboxModel";
|
||||
import { IFusionTreasure } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
import { parallelForeach } from "@/src/utils/async-utils";
|
||||
import allDecoRecipes from "@/static/fixed_responses/allDecoRecipes.json";
|
||||
import { createMessage } from "./inboxService";
|
||||
import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "./friendService";
|
||||
import { ITypeCount } from "../types/commonTypes";
|
||||
import { createMessage } from "@/src/services/inboxService";
|
||||
import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "@/src/services/friendService";
|
||||
import { ITypeCount } from "@/src/types/commonTypes";
|
||||
|
||||
export const getGuildForRequest = async (req: Request): Promise<TGuildDatabaseDocument> => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
|
@ -3,8 +3,8 @@ import {
|
||||
IItemConfig,
|
||||
IOperatorConfigClient,
|
||||
IOperatorConfigDatabase
|
||||
} from "../types/inventoryTypes/commonInventoryTypes";
|
||||
import { IMongoDate } from "../types/commonTypes";
|
||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { IMongoDate } from "@/src/types/commonTypes";
|
||||
import {
|
||||
equipmentKeys,
|
||||
IDialogueClient,
|
||||
@ -25,15 +25,15 @@ import {
|
||||
IUpgradeDatabase,
|
||||
IWeaponSkinClient,
|
||||
IWeaponSkinDatabase
|
||||
} from "../types/inventoryTypes/inventoryTypes";
|
||||
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import {
|
||||
ILoadoutConfigClient,
|
||||
ILoadoutConfigDatabase,
|
||||
ILoadoutDatabase,
|
||||
ILoadOutPresets
|
||||
} from "../types/saveLoadoutTypes";
|
||||
import { slotNames } from "../types/purchaseTypes";
|
||||
} from "@/src/types/saveLoadoutTypes";
|
||||
import { slotNames } from "@/src/types/purchaseTypes";
|
||||
import {
|
||||
ICrewShipMemberClient,
|
||||
ICrewShipMemberDatabase,
|
||||
@ -43,7 +43,7 @@ import {
|
||||
IEquipmentDatabase,
|
||||
IKubrowPetDetailsClient,
|
||||
IKubrowPetDetailsDatabase
|
||||
} from "../types/equipmentTypes";
|
||||
} from "@/src/types/equipmentTypes";
|
||||
|
||||
const convertDate = (value: IMongoDate): Date => {
|
||||
return new Date(parseInt(value.$date.$numberLong));
|
||||
|
@ -2,8 +2,8 @@ import { IMessageDatabase, Inbox } from "@/src/models/inboxModel";
|
||||
import { getAccountForRequest } from "@/src/services/loginService";
|
||||
import { HydratedDocument, Types } from "mongoose";
|
||||
import { Request } from "express";
|
||||
import { unixTimesInMs } from "../constants/timeConstants";
|
||||
import { config } from "./configService";
|
||||
import { unixTimesInMs } from "@/src/constants/timeConstants";
|
||||
import { config } from "@/src/services/configService";
|
||||
|
||||
export const getAllMessagesSorted = async (accountId: string): Promise<HydratedDocument<IMessageDatabase>[]> => {
|
||||
const inbox = await Inbox.find({ ownerId: accountId }).sort({ date: -1 });
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { ExportRecipes } from "warframe-public-export-plus";
|
||||
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||
import { IInfestedFoundryClient, IInfestedFoundryDatabase } from "../types/inventoryTypes/inventoryTypes";
|
||||
import { addRecipes } from "./inventoryService";
|
||||
import { config } from "./configService";
|
||||
import { ITypeCount } from "../types/commonTypes";
|
||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { IInfestedFoundryClient, IInfestedFoundryDatabase } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { addRecipes } from "@/src/services/inventoryService";
|
||||
import { config } from "@/src/services/configService";
|
||||
import { ITypeCount } from "@/src/types/commonTypes";
|
||||
|
||||
export const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundryDatabase, delta: number): ITypeCount[] => {
|
||||
const recipeChanges: ITypeCount[] = [];
|
||||
|
@ -27,11 +27,11 @@ import {
|
||||
IDialogueDatabase,
|
||||
IKubrowPetPrintClient
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate";
|
||||
import { IKeyChainRequest, IMissionInventoryUpdateRequest } from "../types/requestTypes";
|
||||
import { IGenericUpdate, IUpdateNodeIntrosResponse } from "@/src/types/genericUpdate";
|
||||
import { IKeyChainRequest, IMissionInventoryUpdateRequest } from "@/src/types/requestTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { convertInboxMessage, fromStoreItem, getKeyChainItems } from "@/src/services/itemDataService";
|
||||
import { IFlavourItem, IItemConfig } from "../types/inventoryTypes/commonInventoryTypes";
|
||||
import { IFlavourItem, IItemConfig } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import {
|
||||
ExportArcanes,
|
||||
ExportBoosters,
|
||||
@ -59,7 +59,7 @@ import {
|
||||
ISentinel,
|
||||
TStandingLimitBin
|
||||
} from "warframe-public-export-plus";
|
||||
import { createShip } from "./shipService";
|
||||
import { createShip } from "@/src/services/shipService";
|
||||
import {
|
||||
catbrowDetails,
|
||||
fromMongoDate,
|
||||
@ -68,19 +68,25 @@ import {
|
||||
kubrowFurPatternsWeights,
|
||||
kubrowWeights,
|
||||
toOid
|
||||
} from "../helpers/inventoryHelpers";
|
||||
} from "@/src/helpers/inventoryHelpers";
|
||||
import { addQuestKey, completeQuest } from "@/src/services/questService";
|
||||
import { handleBundleAcqusition } from "./purchaseService";
|
||||
import { handleBundleAcqusition } from "@/src/services/purchaseService";
|
||||
import libraryDailyTasks from "@/static/fixed_responses/libraryDailyTasks.json";
|
||||
import { generateRewardSeed, getRandomElement, getRandomInt, getRandomWeightedReward, SRng } from "./rngService";
|
||||
import { createMessage, IMessageCreationTemplate } from "./inboxService";
|
||||
import {
|
||||
generateRewardSeed,
|
||||
getRandomElement,
|
||||
getRandomInt,
|
||||
getRandomWeightedReward,
|
||||
SRng
|
||||
} from "@/src/services/rngService";
|
||||
import { createMessage, IMessageCreationTemplate } from "@/src/services/inboxService";
|
||||
import { getMaxStanding, getMinStanding } from "@/src/helpers/syndicateStandingHelper";
|
||||
import { getNightwaveSyndicateTag, getWorldState } from "./worldStateService";
|
||||
import { getNightwaveSyndicateTag, getWorldState } from "@/src/services/worldStateService";
|
||||
import { ICalendarSeason } from "@/src/types/worldStateTypes";
|
||||
import { generateNemesisProfile, INemesisProfile } from "../helpers/nemesisHelpers";
|
||||
import { TAccountDocument } from "./loginService";
|
||||
import { unixTimesInMs } from "../constants/timeConstants";
|
||||
import { addString } from "../helpers/stringHelpers";
|
||||
import { generateNemesisProfile, INemesisProfile } from "@/src/helpers/nemesisHelpers";
|
||||
import { TAccountDocument } from "@/src/services/loginService";
|
||||
import { unixTimesInMs } from "@/src/constants/timeConstants";
|
||||
import { addString } from "@/src/helpers/stringHelpers";
|
||||
import {
|
||||
EquipmentFeatures,
|
||||
IEquipmentClient,
|
||||
@ -88,8 +94,8 @@ import {
|
||||
IKubrowPetDetailsDatabase,
|
||||
ITraits,
|
||||
Status
|
||||
} from "../types/equipmentTypes";
|
||||
import { ITypeCount } from "../types/commonTypes";
|
||||
} from "@/src/types/equipmentTypes";
|
||||
import { ITypeCount } from "@/src/types/commonTypes";
|
||||
|
||||
export const createInventory = async (
|
||||
accountOwnerId: Types.ObjectId,
|
||||
|
@ -33,7 +33,7 @@ import {
|
||||
IRecipe,
|
||||
TReward
|
||||
} from "warframe-public-export-plus";
|
||||
import { IMessage } from "../models/inboxModel";
|
||||
import { IMessage } from "@/src/models/inboxModel";
|
||||
|
||||
export type WeaponTypeInternal =
|
||||
| "LongGuns"
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Guild } from "../models/guildModel";
|
||||
import { Leaderboard, TLeaderboardEntryDocument } from "../models/leaderboardModel";
|
||||
import { ILeaderboardEntryClient } from "../types/leaderboardTypes";
|
||||
import { Guild } from "@/src/models/guildModel";
|
||||
import { Leaderboard, TLeaderboardEntryDocument } from "@/src/models/leaderboardModel";
|
||||
import { ILeaderboardEntryClient } from "@/src/types/leaderboardTypes";
|
||||
|
||||
export const submitLeaderboardScore = async (
|
||||
schedule: "weekly" | "daily",
|
||||
|
@ -1,10 +1,10 @@
|
||||
import randomRewards from "@/static/fixed_responses/loginRewards/randomRewards.json";
|
||||
import { IInventoryChanges } from "../types/purchaseTypes";
|
||||
import { TAccountDocument } from "./loginService";
|
||||
import { mixSeeds, SRng } from "./rngService";
|
||||
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||
import { addBooster, updateCurrency } from "./inventoryService";
|
||||
import { handleStoreItemAcquisition } from "./purchaseService";
|
||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
import { TAccountDocument } from "@/src/services/loginService";
|
||||
import { mixSeeds, SRng } from "@/src/services/rngService";
|
||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { addBooster, updateCurrency } from "@/src/services/inventoryService";
|
||||
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
||||
import {
|
||||
ExportBoosterPacks,
|
||||
ExportBoosters,
|
||||
@ -12,7 +12,7 @@ import {
|
||||
ExportWarframes,
|
||||
ExportWeapons
|
||||
} from "warframe-public-export-plus";
|
||||
import { toStoreItem } from "./itemDataService";
|
||||
import { toStoreItem } from "@/src/services/itemDataService";
|
||||
|
||||
export interface ILoginRewardsReponse {
|
||||
DailyTributeInfo: {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Account } from "@/src/models/loginModel";
|
||||
import { createInventory } from "@/src/services/inventoryService";
|
||||
import { IDatabaseAccountJson, IDatabaseAccountRequiredFields } from "@/src/types/loginTypes";
|
||||
import { createShip } from "./shipService";
|
||||
import { createShip } from "@/src/services/shipService";
|
||||
import { Document, Types } from "mongoose";
|
||||
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
||||
import { PersonalRooms } from "@/src/models/personalRoomsModel";
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
IRegion,
|
||||
IReward
|
||||
} from "warframe-public-export-plus";
|
||||
import { IMissionInventoryUpdateRequest, IRewardInfo } from "../types/requestTypes";
|
||||
import { IMissionInventoryUpdateRequest, IRewardInfo } from "@/src/types/requestTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { IRngResult, SRng, generateRewardSeed, getRandomElement, getRandomReward } from "@/src/services/rngService";
|
||||
import { equipmentKeys, IMission, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
@ -47,10 +47,10 @@ import { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
import { fromStoreItem, getLevelKeyRewards, isStoreItem, toStoreItem } from "@/src/services/itemDataService";
|
||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { getEntriesUnsafe } from "@/src/utils/ts-utils";
|
||||
import { handleStoreItemAcquisition } from "./purchaseService";
|
||||
import { IMissionCredits, IMissionReward } from "../types/missionTypes";
|
||||
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
||||
import { IMissionCredits, IMissionReward } from "@/src/types/missionTypes";
|
||||
import { crackRelic } from "@/src/helpers/relicHelper";
|
||||
import { createMessage } from "./inboxService";
|
||||
import { createMessage } from "@/src/services/inboxService";
|
||||
import kuriaMessage50 from "@/static/fixed_responses/kuriaMessages/fiftyPercent.json";
|
||||
import kuriaMessage75 from "@/static/fixed_responses/kuriaMessages/seventyFivePercent.json";
|
||||
import kuriaMessage100 from "@/static/fixed_responses/kuriaMessages/oneHundredPercent.json";
|
||||
@ -63,8 +63,8 @@ import {
|
||||
getNemesisManifest,
|
||||
getNemesisPasscode
|
||||
} from "@/src/helpers/nemesisHelpers";
|
||||
import { Loadout } from "../models/inventoryModels/loadoutModel";
|
||||
import { ILoadoutConfigDatabase } from "../types/saveLoadoutTypes";
|
||||
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
||||
import { ILoadoutConfigDatabase } from "@/src/types/saveLoadoutTypes";
|
||||
import {
|
||||
getLiteSortie,
|
||||
getSortie,
|
||||
@ -73,14 +73,14 @@ import {
|
||||
idToDay,
|
||||
idToWeek,
|
||||
pushClassicBounties
|
||||
} from "./worldStateService";
|
||||
import { config } from "./configService";
|
||||
} from "@/src/services/worldStateService";
|
||||
import { config } from "@/src/services/configService";
|
||||
import libraryDailyTasks from "@/static/fixed_responses/libraryDailyTasks.json";
|
||||
import { ISyndicateMissionInfo } from "../types/worldStateTypes";
|
||||
import { fromOid } from "../helpers/inventoryHelpers";
|
||||
import { TAccountDocument } from "./loginService";
|
||||
import { ITypeCount } from "../types/commonTypes";
|
||||
import { IEquipmentClient } from "../types/equipmentTypes";
|
||||
import { ISyndicateMissionInfo } from "@/src/types/worldStateTypes";
|
||||
import { fromOid } from "@/src/helpers/inventoryHelpers";
|
||||
import { TAccountDocument } from "@/src/services/loginService";
|
||||
import { ITypeCount } from "@/src/types/commonTypes";
|
||||
import { IEquipmentClient } from "@/src/types/equipmentTypes";
|
||||
|
||||
const getRotations = (rewardInfo: IRewardInfo, tierOverride?: number): number[] => {
|
||||
// For Spy missions, e.g. 3 vaults cracked = A, B, C
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PersonalRooms } from "@/src/models/personalRoomsModel";
|
||||
import { addItem, getInventory } from "@/src/services/inventoryService";
|
||||
import { IGardeningDatabase, TPersonalRoomsDatabaseDocument } from "../types/personalRoomsTypes";
|
||||
import { getRandomElement } from "./rngService";
|
||||
import { IGardeningDatabase, TPersonalRoomsDatabaseDocument } from "@/src/types/personalRoomsTypes";
|
||||
import { getRandomElement } from "@/src/services/rngService";
|
||||
|
||||
export const getPersonalRooms = async (
|
||||
accountId: string,
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
IPurchaseParams
|
||||
} from "@/src/types/purchaseTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { getWorldState } from "./worldStateService";
|
||||
import { getWorldState } from "@/src/services/worldStateService";
|
||||
import {
|
||||
ExportBoosterPacks,
|
||||
ExportBoosters,
|
||||
@ -32,11 +32,11 @@ import {
|
||||
ExportVendors,
|
||||
TRarity
|
||||
} from "warframe-public-export-plus";
|
||||
import { config } from "./configService";
|
||||
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||
import { fromStoreItem, toStoreItem } from "./itemDataService";
|
||||
import { DailyDeal } from "../models/worldStateModel";
|
||||
import { fromMongoDate, toMongoDate } from "../helpers/inventoryHelpers";
|
||||
import { config } from "@/src/services/configService";
|
||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { fromStoreItem, toStoreItem } from "@/src/services/itemDataService";
|
||||
import { DailyDeal } from "@/src/models/worldStateModel";
|
||||
import { fromMongoDate, toMongoDate } from "@/src/helpers/inventoryHelpers";
|
||||
|
||||
export const getStoreItemCategory = (storeItem: string): string => {
|
||||
const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/");
|
||||
|
@ -8,10 +8,10 @@ import { IQuestKeyClient, IQuestKeyDatabase, IQuestStage } from "@/src/types/inv
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { Types } from "mongoose";
|
||||
import { ExportKeys } from "warframe-public-export-plus";
|
||||
import { addFixedLevelRewards } from "./missionInventoryUpdateService";
|
||||
import { IInventoryChanges } from "../types/purchaseTypes";
|
||||
import { addFixedLevelRewards } from "@/src/services/missionInventoryUpdateService";
|
||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
import questCompletionItems from "@/static/fixed_responses/questCompletionRewards.json";
|
||||
import { ITypeCount } from "../types/commonTypes";
|
||||
import { ITypeCount } from "@/src/types/commonTypes";
|
||||
|
||||
export interface IUpdateQuestRequest {
|
||||
QuestKeys: Omit<IQuestKeyDatabase, "CompletionDate">[];
|
||||
|
@ -13,8 +13,8 @@ import { Types } from "mongoose";
|
||||
import { isEmptyObject } from "@/src/helpers/general";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { equipmentKeys, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IItemConfig } from "../types/inventoryTypes/commonInventoryTypes";
|
||||
import { importCrewMemberId } from "./importService";
|
||||
import { IItemConfig } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { importCrewMemberId } from "@/src/services/importService";
|
||||
|
||||
//TODO: setup default items on account creation or like originally in giveStartingItems.php
|
||||
|
||||
|
@ -6,7 +6,7 @@ import { mixSeeds, SRng } from "@/src/services/rngService";
|
||||
import { IItemManifest, IVendorInfo, IVendorManifest } from "@/src/types/vendorTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { ExportVendors, IRange, IVendor, IVendorOffer } from "warframe-public-export-plus";
|
||||
import { config } from "./configService";
|
||||
import { config } from "@/src/services/configService";
|
||||
|
||||
interface IGeneratableVendorInfo extends Omit<IVendorInfo, "ItemManifest" | "Expiry"> {
|
||||
cycleOffset?: number;
|
||||
|
@ -8,14 +8,14 @@ import {
|
||||
RoomsType,
|
||||
TBootLocation,
|
||||
TPersonalRoomsDatabaseDocument
|
||||
} from "../types/personalRoomsTypes";
|
||||
} from "@/src/types/personalRoomsTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { Types } from "mongoose";
|
||||
import { addFusionTreasures, addShipDecorations, getInventory } from "./inventoryService";
|
||||
import { config } from "./configService";
|
||||
import { Guild } from "../models/guildModel";
|
||||
import { hasGuildPermission } from "./guildService";
|
||||
import { GuildPermission } from "../types/guildTypes";
|
||||
import { addFusionTreasures, addShipDecorations, getInventory } from "@/src/services/inventoryService";
|
||||
import { config } from "@/src/services/configService";
|
||||
import { Guild } from "@/src/models/guildModel";
|
||||
import { hasGuildPermission } from "@/src/services/guildService";
|
||||
import { GuildPermission } from "@/src/types/guildTypes";
|
||||
import { ExportResources } from "warframe-public-export-plus";
|
||||
|
||||
export const setShipCustomizations = async (
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
} from "@/src/types/statTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { addEmailItem, getInventory } from "@/src/services/inventoryService";
|
||||
import { submitLeaderboardScore } from "./leaderboardService";
|
||||
import { submitLeaderboardScore } from "@/src/services/leaderboardService";
|
||||
|
||||
export const createStats = async (accountId: string): Promise<TStatsDatabaseDocument> => {
|
||||
const stats = new Stats({ accountOwnerId: accountId });
|
||||
|
@ -1,12 +1,12 @@
|
||||
import http from "http";
|
||||
import https from "https";
|
||||
import fs from "node:fs";
|
||||
import { config } from "./configService";
|
||||
import { logger } from "../utils/logger";
|
||||
import { app } from "../app";
|
||||
import { config } from "@/src/services/configService";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { app } from "@/src/app";
|
||||
import { AddressInfo } from "node:net";
|
||||
import { Agent, WebSocket as UnidiciWebSocket } from "undici";
|
||||
import { startWsServer, startWssServer, stopWsServers } from "./wsService";
|
||||
import { startWsServer, startWssServer, stopWsServers } from "@/src/services/wsService";
|
||||
|
||||
let httpServer: http.Server | undefined;
|
||||
let httpsServer: https.Server | undefined;
|
||||
|
@ -28,10 +28,10 @@ import {
|
||||
IVoidTraderOffer,
|
||||
IWorldState,
|
||||
TCircuitGameMode
|
||||
} from "../types/worldStateTypes";
|
||||
import { toMongoDate, toOid, version_compare } from "../helpers/inventoryHelpers";
|
||||
import { logger } from "../utils/logger";
|
||||
import { DailyDeal, Fissure } from "../models/worldStateModel";
|
||||
} from "@/src/types/worldStateTypes";
|
||||
import { toMongoDate, toOid, version_compare } from "@/src/helpers/inventoryHelpers";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { DailyDeal, Fissure } from "@/src/models/worldStateModel";
|
||||
|
||||
const sortieBosses = [
|
||||
"SORTIE_BOSS_HYENA",
|
||||
|
@ -1,9 +1,9 @@
|
||||
import http from "http";
|
||||
import https from "https";
|
||||
import ws from "ws";
|
||||
import { Account } from "../models/loginModel";
|
||||
import { createAccount, createNonce, getUsernameFromEmail, isCorrectPassword } from "./loginService";
|
||||
import { IDatabaseAccountJson } from "../types/loginTypes";
|
||||
import { Account } from "@/src/models/loginModel";
|
||||
import { createAccount, createNonce, getUsernameFromEmail, isCorrectPassword } from "@/src/services/loginService";
|
||||
import { IDatabaseAccountJson } from "@/src/types/loginTypes";
|
||||
import { HydratedDocument } from "mongoose";
|
||||
|
||||
let wsServer: ws.Server | undefined;
|
||||
|
@ -1,6 +1,11 @@
|
||||
import { Types } from "mongoose";
|
||||
import { IMongoDate, IOid, IOidWithLegacySupport } from "./commonTypes";
|
||||
import { ICrewShipCustomization, IFlavourItem, IItemConfig, IPolarity } from "./inventoryTypes/commonInventoryTypes";
|
||||
import { IMongoDate, IOid, IOidWithLegacySupport } from "@/src/types/commonTypes";
|
||||
import {
|
||||
ICrewShipCustomization,
|
||||
IFlavourItem,
|
||||
IItemConfig,
|
||||
IPolarity
|
||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
|
||||
export interface IEquipmentSelection {
|
||||
ItemId: IOid;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Types } from "mongoose";
|
||||
import { IMongoDate, IOidWithLegacySupport } from "./commonTypes";
|
||||
import { IMongoDate, IOidWithLegacySupport } from "@/src/types/commonTypes";
|
||||
|
||||
export interface IFriendInfo {
|
||||
_id: IOidWithLegacySupport;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IInventoryChanges } from "./purchaseTypes";
|
||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
|
||||
export interface IGenericUpdate {
|
||||
NodeIntrosCompleted: string | string[];
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Types } from "mongoose";
|
||||
import { IOid, IMongoDate, IOidWithLegacySupport, ITypeCount } from "@/src/types/commonTypes";
|
||||
import { IFusionTreasure, IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IPictureFrameInfo } from "./personalRoomsTypes";
|
||||
import { IFriendInfo } from "./friendTypes";
|
||||
import { IPictureFrameInfo } from "@/src/types/personalRoomsTypes";
|
||||
import { IFriendInfo } from "@/src/types/friendTypes";
|
||||
|
||||
export interface IGuildClient {
|
||||
_id: IOidWithLegacySupport;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Types } from "mongoose";
|
||||
import { IOid, IMongoDate, IOidWithLegacySupport, ITypeCount } from "../commonTypes";
|
||||
import { IOid, IMongoDate, IOidWithLegacySupport, ITypeCount } from "@/src/types/commonTypes";
|
||||
import {
|
||||
IColor,
|
||||
IItemConfig,
|
||||
@ -11,10 +11,10 @@ import {
|
||||
IShipCustomization
|
||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { IFingerprintStat, RivenFingerprint } from "@/src/helpers/rivenHelper";
|
||||
import { IOrbiterClient } from "../personalRoomsTypes";
|
||||
import { IOrbiterClient } from "@/src/types/personalRoomsTypes";
|
||||
import { ICountedStoreItem } from "warframe-public-export-plus";
|
||||
import { IEquipmentClient, IEquipmentDatabase, ITraits } from "../equipmentTypes";
|
||||
import { ILoadOutPresets } from "../saveLoadoutTypes";
|
||||
import { IEquipmentClient, IEquipmentDatabase, ITraits } from "@/src/types/equipmentTypes";
|
||||
import { ILoadOutPresets } from "@/src/types/saveLoadoutTypes";
|
||||
|
||||
export type InventoryDatabaseEquipment = {
|
||||
[_ in TEquipmentKey]: IEquipmentDatabase[];
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IAffiliationMods, IInventoryChanges } from "./purchaseTypes";
|
||||
import { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
|
||||
export const inventoryFields = ["RawUpgrades", "MiscItems", "Consumables", "Recipes"] as const;
|
||||
export type IInventoryFieldType = (typeof inventoryFields)[number];
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { IColor, IShipAttachments, IShipCustomization } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { Document, Model, Types } from "mongoose";
|
||||
import { ILoadoutClient } from "./saveLoadoutTypes";
|
||||
import { IMongoDate, IOid } from "./commonTypes";
|
||||
import { ILoadoutClient } from "@/src/types/saveLoadoutTypes";
|
||||
import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
||||
|
||||
export interface IGetShipResponse {
|
||||
ShipOwnerId: string;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITypeCount } from "./commonTypes";
|
||||
import { IEquipmentClient } from "./equipmentTypes";
|
||||
import { ITypeCount } from "@/src/types/commonTypes";
|
||||
import { IEquipmentClient } from "@/src/types/equipmentTypes";
|
||||
import {
|
||||
IDroneClient,
|
||||
IInfestedFoundryClient,
|
||||
@ -9,7 +9,7 @@ import {
|
||||
TEquipmentKey,
|
||||
ICrewMemberClient,
|
||||
IKubrowPetPrintClient
|
||||
} from "./inventoryTypes/inventoryTypes";
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
|
||||
export enum PurchaseSource {
|
||||
Market = 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IOid, ITypeCount } from "./commonTypes";
|
||||
import { IOid, ITypeCount } from "@/src/types/commonTypes";
|
||||
import { ArtifactPolarity, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import {
|
||||
IBooster,
|
||||
@ -22,10 +22,10 @@ import {
|
||||
IWeaponSkinClient,
|
||||
IKubrowPetEggClient,
|
||||
INemesisClient
|
||||
} from "./inventoryTypes/inventoryTypes";
|
||||
import { IGroup } from "./loginTypes";
|
||||
import { ILoadOutPresets } from "./saveLoadoutTypes";
|
||||
import { IEquipmentClient } from "./equipmentTypes";
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IGroup } from "@/src/types/loginTypes";
|
||||
import { ILoadOutPresets } from "@/src/types/saveLoadoutTypes";
|
||||
import { IEquipmentClient } from "@/src/types/equipmentTypes";
|
||||
|
||||
export interface IAffiliationChange {
|
||||
Tag: string;
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
IOperatorConfigClient
|
||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { Types } from "mongoose";
|
||||
import { ICrewShipMembersClient, ICrewShipWeapon, IEquipmentSelection } from "./equipmentTypes";
|
||||
import { ICrewShipMembersClient, ICrewShipWeapon, IEquipmentSelection } from "@/src/types/equipmentTypes";
|
||||
|
||||
export interface ISaveLoadoutRequest {
|
||||
LoadOuts: ILoadoutClient;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IMongoDate, IOid } from "./commonTypes";
|
||||
import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
||||
|
||||
export interface IItemPrice {
|
||||
ItemType: string;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IMissionReward } from "warframe-public-export-plus";
|
||||
import { IMongoDate, IOid } from "./commonTypes";
|
||||
import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
||||
|
||||
export interface IWorldState {
|
||||
Version: number; // for goals
|
||||
|
Loading…
x
Reference in New Issue
Block a user