chore(api): bump dependencies

This commit is contained in:
isra el
2025-12-14 14:28:29 +03:00
parent 99a9ee3cc1
commit ba0437ff01
16 changed files with 3790 additions and 2974 deletions

View File

@@ -21,60 +21,60 @@
},
"dependencies": {
"@nest-modules/mailer": "^1.3.22",
"@nestjs/bull": "^11.0.2",
"@nestjs/common": "^10.4.5",
"@nestjs/config": "^4.0.1",
"@nestjs/core": "^10.4.5",
"@nestjs/bull": "^11.0.4",
"@nestjs/common": "^11.1.9",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^11.1.9",
"@nestjs/event-emitter": "^3.0.1",
"@nestjs/jwt": "^10.2.0",
"@nestjs/jwt": "^11.0.2",
"@nestjs/mapped-types": "^2.1.0",
"@nestjs/mongoose": "^10.0.10",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.4.5",
"@nestjs/schedule": "^4.1.1",
"@nestjs/swagger": "^7.4.2",
"@nestjs/throttler": "^6.2.1",
"@polar-sh/sdk": "^0.34.9",
"axios": "^1.8.2",
"bcryptjs": "^2.4.3",
"@nestjs/mongoose": "^11.0.4",
"@nestjs/passport": "^11.0.5",
"@nestjs/platform-express": "^11.1.9",
"@nestjs/schedule": "^6.1.0",
"@nestjs/swagger": "^11.2.3",
"@nestjs/throttler": "^6.5.0",
"@polar-sh/sdk": "^0.41.5",
"axios": "^1.13.2",
"bcryptjs": "^3.0.3",
"bull": "^4.16.5",
"class-validator": "^0.14.1",
"dotenv": "^16.4.5",
"express": "^4.21.2",
"firebase-admin": "^12.6.0",
"class-validator": "^0.14.3",
"dotenv": "^17.2.3",
"express": "^5.2.1",
"firebase-admin": "^13.6.0",
"handlebars": "^4.7.8",
"ioredis": "^5.6.0",
"mongoose": "^8.12.1",
"nodemailer": "^6.10.0",
"ioredis": "^5.8.2",
"mongoose": "^9.0.1",
"nodemailer": "^7.0.11",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"reflect-metadata": "^0.2.2",
"rimraf": "^6.0.1",
"rxjs": "^7.8.1",
"rimraf": "^6.1.2",
"rxjs": "^7.8.2",
"swagger-ui-express": "^5.0.1",
"uuid": "^10.0.0"
"uuid": "^9.0.1"
},
"devDependencies": {
"@nestjs/cli": "^10.4.5",
"@nestjs/schematics": "^10.2.2",
"@nestjs/testing": "^10.4.5",
"@types/express": "^5.0.0",
"@types/jest": "29.5.13",
"@types/node": "^22.7.7",
"@types/nodemailer": "^6.4.16",
"@nestjs/cli": "^11.0.14",
"@nestjs/schematics": "^11.0.9",
"@nestjs/testing": "^11.1.9",
"@types/express": "^5.0.6",
"@types/jest": "30.0.0",
"@types/node": "^25.0.1",
"@types/nodemailer": "^7.0.4",
"@types/passport-jwt": "^4.0.1",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^8.10.0",
"@typescript-eslint/parser": "^8.10.0",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"@types/supertest": "^6.0.3",
"@typescript-eslint/eslint-plugin": "^8.49.0",
"@typescript-eslint/parser": "^8.49.0",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"jest": "^30.2.0",
"prettier": "^3.7.4",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"supertest": "^7.1.4",
"ts-jest": "^29.4.6",
"ts-loader": "^9.5.4",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.6.3"

6641
api/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -42,7 +42,9 @@ import { OptionalAuthGuard } from './guards/optional-auth.guard'
PassportModule,
JwtModule.register({
secret: process.env.JWT_SECRET,
signOptions: { expiresIn: process.env.JWT_EXPIRATION || '60d' },
signOptions: {
expiresIn: process.env.JWT_EXPIRATION || '60d' as any
},
}),
MailModule,
CommonModule,

View File

@@ -10,10 +10,10 @@ export class AccessLog {
_id?: Types.ObjectId
@Prop({ type: Types.ObjectId, ref: ApiKey.name })
apiKey: ApiKey
apiKey: ApiKey | Types.ObjectId
@Prop({ type: Types.ObjectId, ref: User.name })
user: User
user: User | Types.ObjectId
@Prop({ type: String })
url: string

View File

@@ -18,7 +18,7 @@ export class ApiKey {
hashedApiKey: string
@Prop({ type: Types.ObjectId, ref: User.name })
user: User
user: User | Types.ObjectId
@Prop({ type: Number, default: 0 })
usageCount: number

View File

@@ -9,7 +9,7 @@ export class EmailVerification {
_id?: Types.ObjectId
@Prop({ type: Types.ObjectId, ref: User.name })
user: User
user: User | Types.ObjectId
@Prop({ type: String })
verificationCode: string // hashed

View File

@@ -9,7 +9,7 @@ export class PasswordReset {
_id?: Types.ObjectId
@Prop({ type: Types.ObjectId, ref: User.name })
user: User
user: User | Types.ObjectId
@Prop({ type: String })
otp: string

View File

@@ -9,6 +9,7 @@ import {
import { User, UserDocument } from '../users/schemas/user.schema'
import { MailService } from '../mail/mail.service'
import { BillingService } from './billing.service'
import { Plan } from './schemas/plan.schema'
interface EmailConfig {
template: string
@@ -123,7 +124,7 @@ export class AbandonedCheckoutService {
const subscription = await this.billingService.getCurrentSubscription(
session.user,
)
if (subscription.plan.name !== 'free') {
if ((subscription?.plan as Plan)?.name !== 'free') {
this.logger.debug(
`Skipping email for session ${session._id}: user is not on free plan`,
)

View File

@@ -268,7 +268,7 @@ export class BillingService {
})
const currentSubscription = await this.getCurrentSubscription(user)
if (currentSubscription?.plan?.name === payload.planName) {
if ((currentSubscription?.plan as Plan)?.name === payload.planName) {
throw new BadRequestException({
message: `You are already on ${payload.planName} plan, please contact billing@textbee.dev to get a custom plan`,
code: 'ALREADY_ON_PLAN',

View File

@@ -18,7 +18,7 @@ export class BillingNotification {
_id?: Types.ObjectId
@Prop({ type: Types.ObjectId, ref: User.name, required: true, index: true })
user: User
user: User | Types.ObjectId
@Prop({ type: String, enum: Object.values(BillingNotificationType), required: true, index: true })
type: BillingNotificationType

View File

@@ -18,10 +18,10 @@ export type SubscriptionDocument = Subscription & Document
@Schema({ timestamps: true })
export class Subscription {
@Prop({ type: Types.ObjectId, ref: User.name, required: true })
user: User
user: User | Types.ObjectId
@Prop({ type: Types.ObjectId, ref: Plan.name, required: true })
plan: Plan
plan: Plan | Types.ObjectId
// @Prop()
// polarSubscriptionId?: string

View File

@@ -9,7 +9,7 @@ export class Device {
_id?: Types.ObjectId
@Prop({ type: Types.ObjectId, ref: User.name })
user: User
user: User | Types.ObjectId
@Prop({ type: Boolean, default: false })
enabled: boolean

View File

@@ -10,10 +10,10 @@ export class SMS {
_id?: Types.ObjectId
@Prop({ type: Types.ObjectId, ref: Device.name, required: true })
device: Device
device: Device | Types.ObjectId
@Prop({ type: Types.ObjectId, ref: SMSBatch.name })
smsBatch: SMSBatch
smsBatch: SMSBatch | Types.ObjectId
@Prop({ type: String })
message: string

View File

@@ -7,7 +7,7 @@ export type SupportMessageDocument = SupportMessage & Document
@Schema({ timestamps: true })
export class SupportMessage {
@Prop({ type: Types.ObjectId, ref: User.name })
user: User
user: User | Types.ObjectId
@Prop()
name: string

View File

@@ -43,6 +43,9 @@ export class User {
@Prop({ type: String })
accountDeletionReason: string
@Prop({ type: Object })
meta: Object
}
export const UserSchema = SchemaFactory.createForClass(User)

View File

@@ -6,6 +6,7 @@ import { Cron, CronExpression } from '@nestjs/schedule'
import { MailService } from '../mail/mail.service'
import { BillingService } from '../billing/billing.service'
import { Device, DeviceDocument } from '../gateway/schemas/device.schema'
import { Plan } from 'src/billing/schemas/plan.schema'
@Injectable()
export class UsersService {
@@ -136,7 +137,7 @@ export class UsersService {
user._id.toString(),
)
if (subscription?.plan?.name === 'free') {
if ((subscription?.plan as Plan)?.name === 'free') {
const devices = await this.deviceModel.find({ user: user._id })
if (devices.length === 0 || devices.map(device=>device.sentSMSCount + device.receivedSMSCount).reduce((a,b)=>a+b,0) == 0) {