chore: update mongoose (#2539)
The transform hook signature was changed in the typings, so I just updated them to be explicit about what we expect. Reviewed-on: #2539 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
a2a441ecb0
commit
aada031a80
@ -21,7 +21,7 @@
|
||||
"@typescript-eslint/no-unsafe-argument": "error",
|
||||
"@typescript-eslint/no-unsafe-call": "error",
|
||||
"@typescript-eslint/no-unsafe-assignment": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"no-loss-of-precision": "error",
|
||||
"@typescript-eslint/no-unnecessary-condition": "error",
|
||||
"@typescript-eslint/no-base-to-string": "off",
|
||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -18,7 +18,7 @@
|
||||
"crc-32": "^1.2.2",
|
||||
"express": "^5",
|
||||
"json-with-bigint": "^3.4.4",
|
||||
"mongoose": ">=8.11.0 <8.16.2",
|
||||
"mongoose": "^8.11.0",
|
||||
"morgan": "^1.10.0",
|
||||
"ncp": "^2.0.0",
|
||||
"typescript": "^5.5",
|
||||
@ -3889,9 +3889,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mongoose": {
|
||||
"version": "8.16.1",
|
||||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.16.1.tgz",
|
||||
"integrity": "sha512-Q+0TC+KLdY4SYE+u9gk9pdW1tWu/pl0jusyEkMGTgBoAbvwQdfy4f9IM8dmvCwb/blSfp7IfLkob7v76x6ZGpQ==",
|
||||
"version": "8.16.4",
|
||||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.16.4.tgz",
|
||||
"integrity": "sha512-jslgdQ8pY2vcNSKPv3Dbi5ogo/NT8zcvf6kPDyD8Sdsjsa1at3AFAF0F5PT+jySPGSPbvlNaQ49nT9h+Kx2UDA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bson": "^6.10.4",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"crc-32": "^1.2.2",
|
||||
"express": "^5",
|
||||
"json-with-bigint": "^3.4.4",
|
||||
"mongoose": ">=8.11.0 <8.16.2",
|
||||
"mongoose": "^8.11.0",
|
||||
"morgan": "^1.10.0",
|
||||
"ncp": "^2.0.0",
|
||||
"typescript": "^5.5",
|
||||
|
@ -88,7 +88,6 @@ export const crewShipFusionController: RequestHandler = async (req, res) => {
|
||||
}
|
||||
}
|
||||
superiorItem.UpgradeFingerprint = JSON.stringify(fingerprint);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
inventoryChanges[category] = [superiorItem.toJSON() as any];
|
||||
|
||||
await inventory.save();
|
||||
|
@ -141,7 +141,7 @@ export const getProfileViewingDataGetController: RequestHandler = async (req, re
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
combinedStats[arrayName].push(entry as any);
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ messageSchema.virtual("messageId").get(function (this: IMessageDatabase) {
|
||||
|
||||
messageSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
const messageDatabase = returnedObject as IMessageDatabase;
|
||||
const messageClient = returnedObject as IMessageClient;
|
||||
|
||||
|
@ -121,7 +121,7 @@ import {
|
||||
export const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
|
||||
|
||||
typeCountSchema.set("toJSON", {
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
if (obj.ItemCount > 2147483647) {
|
||||
obj.ItemCount = 2147483647;
|
||||
} else if (obj.ItemCount < -2147483648) {
|
||||
@ -189,7 +189,7 @@ operatorConfigSchema.virtual("ItemId").get(function () {
|
||||
|
||||
operatorConfigSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
}
|
||||
@ -226,7 +226,7 @@ const ItemConfigSchema = new Schema<IItemConfig>(
|
||||
);
|
||||
|
||||
ItemConfigSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject.__v;
|
||||
}
|
||||
});
|
||||
@ -261,7 +261,7 @@ RawUpgrades.virtual("LastAdded").get(function () {
|
||||
|
||||
RawUpgrades.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
}
|
||||
@ -282,7 +282,7 @@ upgradeSchema.virtual("ItemId").get(function () {
|
||||
|
||||
upgradeSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
}
|
||||
@ -325,7 +325,7 @@ const crewMemberSchema = new Schema<ICrewMemberDatabase>(
|
||||
|
||||
crewMemberSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as ICrewMemberDatabase;
|
||||
const client = obj as ICrewMemberClient;
|
||||
|
||||
@ -353,7 +353,7 @@ const FlavourItemSchema = new Schema(
|
||||
);
|
||||
|
||||
FlavourItemSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
}
|
||||
@ -367,7 +367,7 @@ FlavourItemSchema.set("toJSON", {
|
||||
);
|
||||
|
||||
MailboxSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
const mailboxDatabase = returnedObject as HydratedDocument<IMailboxDatabase, { __v?: number }>;
|
||||
delete mailboxDatabase.__v;
|
||||
(returnedObject as IMailboxClient).LastInboxId = toOid(mailboxDatabase.LastInboxId);
|
||||
@ -386,7 +386,7 @@ const DuviriInfoSchema = new Schema<IDuviriInfo>(
|
||||
);
|
||||
|
||||
DuviriInfoSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject.__v;
|
||||
}
|
||||
});
|
||||
@ -416,7 +416,7 @@ const droneSchema = new Schema<IDroneDatabase>(
|
||||
);
|
||||
droneSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, obj) {
|
||||
transform(_document, obj: Record<string, any>) {
|
||||
const client = obj as IDroneClient;
|
||||
const db = obj as IDroneDatabase;
|
||||
|
||||
@ -457,7 +457,7 @@ const personalGoalProgressSchema = new Schema<IPersonalGoalProgressDatabase>(
|
||||
|
||||
personalGoalProgressSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as IPersonalGoalProgressDatabase;
|
||||
const client = obj as IPersonalGoalProgressClient;
|
||||
|
||||
@ -502,7 +502,7 @@ StepSequencersSchema.virtual("ItemId").get(function () {
|
||||
|
||||
StepSequencersSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
}
|
||||
@ -516,7 +516,7 @@ const kubrowPetEggSchema = new Schema<IKubrowPetEggDatabase>(
|
||||
);
|
||||
kubrowPetEggSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, obj) {
|
||||
transform(_document, obj: Record<string, any>) {
|
||||
const client = obj as IKubrowPetEggClient;
|
||||
const db = obj as IKubrowPetEggDatabase;
|
||||
|
||||
@ -586,7 +586,7 @@ personalTechProjectSchema.virtual("ItemId").get(function () {
|
||||
|
||||
personalTechProjectSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, ret, _options) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
delete ret._id;
|
||||
delete ret.__v;
|
||||
|
||||
@ -687,7 +687,7 @@ const questKeysSchema = new Schema<IQuestKeyDatabase>(
|
||||
);
|
||||
|
||||
questKeysSchema.set("toJSON", {
|
||||
transform(_doc, ret, _options) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
const questKeysDatabase = ret as IQuestKeyDatabase;
|
||||
|
||||
if (questKeysDatabase.CompletionDate) {
|
||||
@ -709,7 +709,7 @@ const invasionProgressSchema = new Schema<IInvasionProgressDatabase>(
|
||||
);
|
||||
|
||||
invasionProgressSchema.set("toJSON", {
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as IInvasionProgressDatabase;
|
||||
const client = obj as IInvasionProgressClient;
|
||||
|
||||
@ -748,7 +748,7 @@ weaponSkinsSchema.virtual("ItemId").get(function () {
|
||||
|
||||
weaponSkinsSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, ret, _options) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
delete ret._id;
|
||||
delete ret.__v;
|
||||
}
|
||||
@ -772,7 +772,7 @@ const periodicMissionCompletionsSchema = new Schema<IPeriodicMissionCompletionDa
|
||||
);
|
||||
|
||||
periodicMissionCompletionsSchema.set("toJSON", {
|
||||
transform(_doc, ret, _options) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
const periodicMissionCompletionDatabase = ret as IPeriodicMissionCompletionDatabase;
|
||||
|
||||
(periodicMissionCompletionDatabase as unknown as IPeriodicMissionCompletionResponse).date = toMongoDate(
|
||||
@ -849,7 +849,7 @@ const endlessXpProgressSchema = new Schema<IEndlessXpProgressDatabase>(
|
||||
);
|
||||
|
||||
endlessXpProgressSchema.set("toJSON", {
|
||||
transform(_doc, ret) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
const db = ret as IEndlessXpProgressDatabase;
|
||||
const client = ret as IEndlessXpProgressClient;
|
||||
|
||||
@ -898,7 +898,7 @@ const crewShipMemberSchema = new Schema<ICrewShipMemberDatabase>(
|
||||
);
|
||||
crewShipMemberSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as ICrewShipMemberDatabase;
|
||||
const client = obj as ICrewShipMemberClient;
|
||||
if (db.ItemId) {
|
||||
@ -951,7 +951,7 @@ const dialogueSchema = new Schema<IDialogueDatabase>(
|
||||
);
|
||||
dialogueSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, ret) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
const db = ret as IDialogueDatabase;
|
||||
const client = ret as IDialogueClient;
|
||||
|
||||
@ -997,7 +997,7 @@ const kubrowPetPrintSchema = new Schema<IKubrowPetPrintDatabase>({
|
||||
});
|
||||
kubrowPetPrintSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as IKubrowPetPrintDatabase;
|
||||
const client = obj as IKubrowPetPrintClient;
|
||||
|
||||
@ -1025,7 +1025,7 @@ const detailsSchema = new Schema<IKubrowPetDetailsDatabase>(
|
||||
);
|
||||
|
||||
detailsSchema.set("toJSON", {
|
||||
transform(_doc, returnedObject) {
|
||||
transform(_doc, returnedObject: Record<string, any>) {
|
||||
delete returnedObject.__v;
|
||||
|
||||
const db = returnedObject as IKubrowPetDetailsDatabase;
|
||||
@ -1081,7 +1081,7 @@ EquipmentSchema.virtual("ItemId").get(function () {
|
||||
|
||||
EquipmentSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
|
||||
@ -1132,7 +1132,7 @@ pendingRecipeSchema.virtual("ItemId").get(function () {
|
||||
|
||||
pendingRecipeSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
delete returnedObject.LongGuns;
|
||||
@ -1170,7 +1170,7 @@ const infestedFoundrySchema = new Schema<IInfestedFoundryDatabase>(
|
||||
);
|
||||
|
||||
infestedFoundrySchema.set("toJSON", {
|
||||
transform(_doc, ret, _options) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
if (ret.AbilityOverrideUnlockCooldown) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
ret.AbilityOverrideUnlockCooldown = toMongoDate(ret.AbilityOverrideUnlockCooldown);
|
||||
@ -1243,7 +1243,7 @@ const vendorPurchaseHistoryEntrySchema = new Schema<IVendorPurchaseHistoryEntryD
|
||||
);
|
||||
|
||||
vendorPurchaseHistoryEntrySchema.set("toJSON", {
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as IVendorPurchaseHistoryEntryDatabase;
|
||||
const client = obj as IVendorPurchaseHistoryEntryClient;
|
||||
client.Expiry = toMongoDate(db.Expiry);
|
||||
@ -1286,7 +1286,7 @@ const pendingCouponSchema = new Schema<IPendingCouponDatabase>(
|
||||
);
|
||||
|
||||
pendingCouponSchema.set("toJSON", {
|
||||
transform(_doc, ret, _options) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
(ret as IPendingCouponClient).Expiry = toMongoDate((ret as IPendingCouponDatabase).Expiry);
|
||||
}
|
||||
});
|
||||
@ -1353,7 +1353,7 @@ const nemesisSchema = new Schema<INemesisDatabase>(
|
||||
|
||||
nemesisSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as INemesisDatabase;
|
||||
const client = obj as INemesisClient;
|
||||
|
||||
@ -1383,7 +1383,7 @@ const lastSortieRewardSchema = new Schema<ILastSortieRewardDatabase>(
|
||||
|
||||
lastSortieRewardSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as ILastSortieRewardDatabase;
|
||||
const client = obj as ILastSortieRewardClient;
|
||||
|
||||
@ -1790,7 +1790,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
||||
);
|
||||
|
||||
inventorySchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
delete returnedObject.accountOwnerId;
|
||||
|
@ -49,7 +49,7 @@ loadoutConfigSchema.virtual("ItemId").get(function () {
|
||||
|
||||
loadoutConfigSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, ret, _options) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
delete ret._id;
|
||||
delete ret.__v;
|
||||
}
|
||||
@ -71,7 +71,7 @@ export const loadoutSchema = new Schema<ILoadoutDatabase, loadoutModelType>({
|
||||
});
|
||||
|
||||
loadoutSchema.set("toJSON", {
|
||||
transform(_doc, ret, _options) {
|
||||
transform(_doc, ret: Record<string, any>) {
|
||||
delete ret._id;
|
||||
delete ret.__v;
|
||||
delete ret.loadoutOwnerId;
|
||||
|
@ -32,7 +32,7 @@ const databaseAccountSchema = new Schema<IDatabaseAccountJson>(
|
||||
);
|
||||
|
||||
databaseAccountSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
},
|
||||
|
@ -55,7 +55,7 @@ placedDecosSchema.virtual("id").get(function (this: IPlacedDecosDatabase) {
|
||||
|
||||
placedDecosSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
}
|
||||
});
|
||||
@ -78,7 +78,7 @@ const favouriteLoadoutSchema = new Schema<IFavouriteLoadoutDatabase>(
|
||||
);
|
||||
favouriteLoadoutSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
returnedObject.LoadoutId = toOid(returnedObject.LoadoutId);
|
||||
}
|
||||
@ -95,7 +95,7 @@ const plantSchema = new Schema<IPlantDatabase>(
|
||||
|
||||
plantSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const client = obj as IPlantClient;
|
||||
const db = obj as IPlantDatabase;
|
||||
|
||||
@ -158,7 +158,7 @@ const orbiterSchema = new Schema<IOrbiterDatabase>(
|
||||
);
|
||||
orbiterSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_doc, obj) {
|
||||
transform(_doc, obj: Record<string, any>) {
|
||||
const db = obj as IOrbiterDatabase;
|
||||
const client = obj as IOrbiterClient;
|
||||
|
||||
|
@ -22,7 +22,7 @@ shipSchema.virtual("ItemId").get(function () {
|
||||
|
||||
shipSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
const shipResponse = returnedObject as IShipInventory;
|
||||
const shipDatabase = returnedObject as IShipDatabase;
|
||||
delete returnedObject._id;
|
||||
|
@ -101,7 +101,7 @@ const statsSchema = new Schema<IStatsDatabase>({
|
||||
});
|
||||
|
||||
statsSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
transform(_document, returnedObject: Record<string, any>) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
delete returnedObject.accountOwnerId;
|
||||
|
@ -114,7 +114,7 @@ export const loadConfig = (): void => {
|
||||
|
||||
// Set all values to undefined now so if the new config.json omits some fields that were previously present, it's correct in-memory.
|
||||
for (const key of Object.keys(config)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
(config as any)[key] = undefined;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Types } from "mongoose";
|
||||
import { IOid, IMongoDate, IOidWithLegacySupport, ITypeCount } from "@/src/types/commonTypes";
|
||||
import {
|
||||
|
Loading…
x
Reference in New Issue
Block a user