Skip to content

Commit

Permalink
chore(deps): bump dependencies to latest versions
Browse files Browse the repository at this point in the history
Update various dependencies to their latest versions, including:
- NestJS packages (11.0.10)
- AWS SDK
- Mongoose
- OpenAI
- Langchain
- bcryptjs
- isbot

Includes minor type and model improvements in core application

Signed-off-by: Innei <tukon479@gmail.com>
  • Loading branch information
Innei committed Feb 19, 2025
1 parent c861821 commit 91e566f
Show file tree
Hide file tree
Showing 6 changed files with 566 additions and 552 deletions.
32 changes: 16 additions & 16 deletions apps/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"dependencies": {
"@algolia/client-search": "^4.22.1",
"@antfu/install-pkg": "1.0.0",
"@aws-sdk/client-s3": "3.741.0",
"@aws-sdk/client-s3": "3.750.0",
"@babel/core": "7.26.9",
"@babel/plugin-transform-modules-commonjs": "7.26.3",
"@babel/plugin-transform-typescript": "7.26.8",
Expand All @@ -68,25 +68,25 @@
"@langchain/openai": "0.4.4",
"@mx-space/compiled": "workspace:*",
"@nestjs/cache-manager": "3.0.0",
"@nestjs/common": "11.0.9",
"@nestjs/core": "11.0.9",
"@nestjs/common": "11.0.10",
"@nestjs/core": "11.0.10",
"@nestjs/event-emitter": "3.0.0",
"@nestjs/mapped-types": "^2.1.0",
"@nestjs/platform-fastify": "11.0.9",
"@nestjs/platform-socket.io": "11.0.9",
"@nestjs/platform-fastify": "11.0.10",
"@nestjs/platform-socket.io": "11.0.10",
"@nestjs/schedule": "5.0.1",
"@nestjs/throttler": "6.4.0",
"@nestjs/websockets": "11.0.9",
"@nestjs/websockets": "11.0.10",
"@simplewebauthn/server": "10.0.1",
"@socket.io/redis-adapter": "8.3.0",
"@socket.io/redis-emitter": "5.1.0",
"@typegoose/auto-increment": "4.9.1",
"@typegoose/typegoose": "12.8.0",
"@typegoose/auto-increment": "4.10.0",
"@typegoose/typegoose": "12.11.0",
"@types/jsonwebtoken": "9.0.8",
"algoliasearch": "4.24.0",
"axios": "^1.7.9",
"axios-retry": "4.5.0",
"bcryptjs": "^2.4.3",
"bcryptjs": "^3.0.2",
"blurhash": "2.0.5",
"cache-manager": "6.4.0",
"class-transformer": "0.5.1",
Expand All @@ -98,28 +98,28 @@
"ejs": "3.1.10",
"form-data": "4.0.2",
"inquirer": "^10.2.2",
"isbot": "5.1.22",
"isbot": "5.1.23",
"js-yaml": "^4.1.0",
"json5": "2.2.3",
"jsonwebtoken": "9.0.2",
"jszip": "3.10.1",
"keyv": "5.2.3",
"langchain": "0.3.18",
"langchain": "0.3.19",
"linkedom": "0.18.9",
"lodash": "^4.17.21",
"lru-cache": "11.0.2",
"marked": "15.0.7",
"mime-types": "^2.1.35",
"mkdirp": "^3.0.1",
"mongoose": "8.7.0",
"mongoose": "8.10.1",
"mongoose-aggregate-paginate-v2": "1.1.4",
"mongoose-autopopulate": "1.1.0",
"mongoose-lean-getters": "2.1.1",
"mongoose-lean-virtuals": "1.1.0",
"mongoose-paginate-v2": "1.9.0",
"node-machine-id": "1.1.12",
"nodemailer": "6.10.0",
"openai": "4.82.0",
"openai": "4.85.2",
"pluralize": "^8.0.0",
"qs": "6.14.0",
"reflect-metadata": "0.2.2",
Expand All @@ -138,9 +138,9 @@
},
"devDependencies": {
"@langchain/core": "0.3.40",
"@nestjs/cli": "11.0.2",
"@nestjs/schematics": "11.0.0",
"@nestjs/testing": "11.0.9",
"@nestjs/cli": "11.0.4",
"@nestjs/schematics": "11.0.1",
"@nestjs/testing": "11.0.10",
"@swc/core": "1.10.18",
"@types/babel__core": "7.20.5",
"@types/bcryptjs": "^2.4.6",
Expand Down
18 changes: 10 additions & 8 deletions apps/core/src/modules/activity/activity.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { omit, pick, uniqBy } from 'lodash'
import { ObjectId } from 'mongodb'
import { Types } from 'mongoose'
import type { OnModuleDestroy, OnModuleInit } from '@nestjs/common'
import type { Collection } from 'mongodb'
import type { Document } from 'mongoose'
import type { Socket } from 'socket.io'
import type { NoteModel } from '../note/note.model'
import type { PageModel } from '../page/page.model'
Expand Down Expand Up @@ -211,12 +213,9 @@ export class ActivityService implements OnModuleInit, OnModuleDestroy {
readerMap.set(reader._id.toHexString(), reader)
}

const type2Collection: Record<
ActivityLikeSupportType,
Collection<Document>
> = {
note: this.databaseService.db.collection(NOTE_COLLECTION_NAME),
post: this.databaseService.db.collection(POST_COLLECTION_NAME),
const type2Collection = {
note: this.databaseService.db.collection<NoteModel>(NOTE_COLLECTION_NAME),
post: this.databaseService.db.collection<PostModel>(POST_COLLECTION_NAME),
}

const refModelData = new Map<string, any>()
Expand All @@ -226,7 +225,7 @@ export class ActivityService implements OnModuleInit, OnModuleDestroy {
.find(
{
_id: {
$in: ids.map((id) => new Types.ObjectId(id)),
$in: ids.map((id) => new ObjectId(id)),
},
},
{
Expand Down Expand Up @@ -291,7 +290,10 @@ export class ActivityService implements OnModuleInit, OnModuleDestroy {
if (!roomName) continue
const refId = extractArticleIdFromRoomName(roomName)
articleIds.push(refId)
data.data[i] = data.data[i].toObject()

// Explicitly type the document conversion
const document = data.data[i] as Document & ActivityModel
data.data[i] = document.toObject()
;(data.data[i] as any).refId = refId
}

Expand Down
3 changes: 1 addition & 2 deletions apps/core/src/modules/post/post.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ import { CategoryModel as Category } from '../category/category.model'

@plugin(aggregatePaginate)
@plugin(mongooseAutoPopulate)
@index({ slug: 1 })
@index({ modified: -1 })
@index({ text: 'text' })
@modelOptions({
options: { customName: POST_COLLECTION_NAME, allowMixed: Severity.ALLOW },
})
export class PostModel extends WriteBaseModel {
@prop({ trim: true, unique: true, required: true })
@prop({ trim: true, unique: true, index: true, required: true })
@IsString()
@IsNotEmpty()
slug!: string
Expand Down
3 changes: 1 addition & 2 deletions apps/core/src/modules/topic/topic.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { BaseModel } from '~/shared/model/base.model'
customName: TOPIC_COLLECTION_NAME,
},
})
@index({ name: 1 })
export class TopicModel extends BaseModel {
@prop({ default: '' })
@MaxLength(400, { message: '描述信息最多 400 个字符' })
Expand All @@ -30,7 +29,7 @@ export class TopicModel extends BaseModel {
@MaxLength(100, { message: '简介最多 100 个字符' })
introduce: string

@prop({ unique: true })
@prop({ unique: true, index: true })
@IsString()
@IsNotEmpty({
message: '话题名称不能为空',
Expand Down
6 changes: 1 addition & 5 deletions apps/core/src/processors/database/database.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ export class DatabaseService {
// @ts-ignore
public getModelByRefType(
type: CollectionRefTypes,
):
| ReturnModelType<typeof PostModel>
| ReturnModelType<typeof NoteModel>
| ReturnModelType<typeof PageModel>
| ReturnModelType<typeof RecentlyModel>
): ReturnModelType<typeof WriteBaseModel>
// @ts-ignore
public getModelByRefType(
type: ArticleTypeEnum,
Expand Down
Loading

0 comments on commit 91e566f

Please sign in to comment.