Skip to content

Let's use AI to Earn!

feat: 开源服务端

Nevin539c27e7d00c
diff --git a/server/.editorconfig b/server/.editorconfig
new file mode 100644
index 00000000..5b8220e3
--- /dev/null
+++ b/server/.editorconfig
@@ -0,0 +1,14 @@
+# editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
+
diff --git a/server/.env.example b/server/.env.example
new file mode 100644
index 00000000..0b73157e
--- /dev/null
+++ b/server/.env.example
@@ -0,0 +1,40 @@
+NODE_ENV=production
+SERVER_PORT=3000
+MONGO_URI=mongodb://root:YOUR_MONGO_PASSWORD@your_mongo_host:port/?directConnection=true
+MONGO_DB=att
+REDIS_HOST=your_redis_host
+REDIS_PORT=your_redis_port
+REDIS_PASSWORD=your_redis_password
+REDIS_DB=0
+WX_MCH_ID=your_wx_mch_id
+WX_KEY=your_wx_key
+WX_NOTIFY_URL=https://your_domain/api/pay/back/wx
+WX_APP_ID=your_wx_app_id
+WX_APP_SECRET=your_wx_app_secret
+WX_GZH_ID=your_wx_gzh_id
+WX_GZH_SECRET=your_wx_gzh_secret
+WX_GZH_TOKEN=your_wx_gzh_token
+WX_GZH_AES_KEY=your_wx_gzh_aes_key
+OSS_KEY_ID=your_oss_key_id
+OSS_KEY_SECRET=your_oss_key_secret
+OSS_REGION=your_oss_region
+OSS_BUCKET=your_oss_bucket
+OSS_URL=https://your_oss_bucket.oss-region.aliyuncs.com
+OSS_SECRET=true
+SMS_ACCESS_KEY_ID=your_sms_access_key_id
+SMS_ACCESS_KEY_SECRET=your_sms_access_key_secret
+SMS_ENDPOINT=dysmsapi.aliyuncs.com
+SMS_REGION_ID=
+SMS_SIGN_NAME=your_sms_sign_name
+SMS_TEMPLATE_CODE=your_sms_template_code
+QWEN_KEY=your_qwen_key
+REALNAME_ACCESS_KEY_ID=your_realname_access_key_id
+REALNAME_ACCESS_KEY_SECRET=your_realname_access_key_secret
+TENCENT_TMS_SECRET_ID=your_tencent_tms_secret_id
+TENCENT_TMS_SECRET_KEY=your_tencent_tms_secret_key
+GOOGLE_WEB_CLIENT_ID=your_google_web_client_id
+GOOGLE_WEB_CLIENT_SECRET=your_google_web_client_secret
+GOOGLE_RENDER_URL=https://your_render_url
+TWITTER_WEB_CLIENT_ID=your_twitter_web_client_id
+TWITTER_WEB_CLIENT_SECRET=your_twitter_web_client_secret
+TWITTER_WEB_RENDER_URL=https://your_render_url
\ No newline at end of file
diff --git a/server/.env.pro b/server/.env.pro
new file mode 100644
index 00000000..0b73157e
--- /dev/null
+++ b/server/.env.pro
@@ -0,0 +1,40 @@
+NODE_ENV=production
+SERVER_PORT=3000
+MONGO_URI=mongodb://root:YOUR_MONGO_PASSWORD@your_mongo_host:port/?directConnection=true
+MONGO_DB=att
+REDIS_HOST=your_redis_host
+REDIS_PORT=your_redis_port
+REDIS_PASSWORD=your_redis_password
+REDIS_DB=0
+WX_MCH_ID=your_wx_mch_id
+WX_KEY=your_wx_key
+WX_NOTIFY_URL=https://your_domain/api/pay/back/wx
+WX_APP_ID=your_wx_app_id
+WX_APP_SECRET=your_wx_app_secret
+WX_GZH_ID=your_wx_gzh_id
+WX_GZH_SECRET=your_wx_gzh_secret
+WX_GZH_TOKEN=your_wx_gzh_token
+WX_GZH_AES_KEY=your_wx_gzh_aes_key
+OSS_KEY_ID=your_oss_key_id
+OSS_KEY_SECRET=your_oss_key_secret
+OSS_REGION=your_oss_region
+OSS_BUCKET=your_oss_bucket
+OSS_URL=https://your_oss_bucket.oss-region.aliyuncs.com
+OSS_SECRET=true
+SMS_ACCESS_KEY_ID=your_sms_access_key_id
+SMS_ACCESS_KEY_SECRET=your_sms_access_key_secret
+SMS_ENDPOINT=dysmsapi.aliyuncs.com
+SMS_REGION_ID=
+SMS_SIGN_NAME=your_sms_sign_name
+SMS_TEMPLATE_CODE=your_sms_template_code
+QWEN_KEY=your_qwen_key
+REALNAME_ACCESS_KEY_ID=your_realname_access_key_id
+REALNAME_ACCESS_KEY_SECRET=your_realname_access_key_secret
+TENCENT_TMS_SECRET_ID=your_tencent_tms_secret_id
+TENCENT_TMS_SECRET_KEY=your_tencent_tms_secret_key
+GOOGLE_WEB_CLIENT_ID=your_google_web_client_id
+GOOGLE_WEB_CLIENT_SECRET=your_google_web_client_secret
+GOOGLE_RENDER_URL=https://your_render_url
+TWITTER_WEB_CLIENT_ID=your_twitter_web_client_id
+TWITTER_WEB_CLIENT_SECRET=your_twitter_web_client_secret
+TWITTER_WEB_RENDER_URL=https://your_render_url
\ No newline at end of file
diff --git a/server/.eslintrc.js b/server/.eslintrc.js
new file mode 100644
index 00000000..def3009a
--- /dev/null
+++ b/server/.eslintrc.js
@@ -0,0 +1,27 @@
+module.exports = {
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ project: 'tsconfig.json',
+ tsconfigRootDir: __dirname,
+ sourceType: 'module',
+ },
+ plugins: ['@typescript-eslint/eslint-plugin'],
+ extends: [
+ 'plugin:@typescript-eslint/recommended',
+ 'plugin:prettier/recommended',
+ ],
+ root: true,
+ env: {
+ node: true,
+ jest: true,
+ },
+ ignorePatterns: ['.eslintrc.js'],
+ rules: {
+ '@typescript-eslint/ban-ts-comment': 'off',
+ '@typescript-eslint/interface-name-prefix': 'off',
+ '@typescript-eslint/explicit-function-return-type': 'off',
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
+ '@typescript-eslint/no-explicit-any': 'off',
+ "prettier/prettier": ["error", { "endOfLine": "auto" }]
+ },
+};
diff --git a/server/.gitignore b/server/.gitignore
new file mode 100644
index 00000000..7d3e66aa
--- /dev/null
+++ b/server/.gitignore
@@ -0,0 +1,55 @@
+# compiled output
+/dist
+/node_modules
+/build
+
+# Logs
+logs
+*.log
+npm-debug.log*
+pnpm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# OS
+.DS_Store
+
+# Tests
+/coverage
+/.nyc_output
+
+# IDEs and editors
+/.idea
+.project
+.classpath
+.c9/
+*.launch
+.settings/
+*.sublime-workspace
+
+# IDE - VSCode
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+
+# dotenv environment variable files
+.env
+.env.development
+.env.test
+.env.production
+
+# temp directory
+.temp
+.tmp
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
diff --git a/server/.prettierrc b/server/.prettierrc
new file mode 100644
index 00000000..3cd0ff0d
--- /dev/null
+++ b/server/.prettierrc
@@ -0,0 +1,4 @@
+{
+ "singleQuote": true,
+ "trailingComma": "all"
+}
\ No newline at end of file
diff --git a/server/Dockerfile b/server/Dockerfile
new file mode 100644
index 00000000..824118b8
--- /dev/null
+++ b/server/Dockerfile
@@ -0,0 +1,24 @@
+# 第一阶段:构建
+FROM nestjs:v10 AS builder
+
+WORKDIR /app
+COPY package*.json ./
+RUN yarn install
+COPY . .
+RUN yarn run build
+
+# 第二阶段:创建最终运行镜像
+FROM nestjs:v10
+
+# 构建参数
+ENV WORK_HOME /home/server
+COPY --from=builder /app/dist /home/server/dist
+COPY --from=builder /app/node_modules /home/server/node_modules
+
+WORKDIR $WORK_HOME
+
+# 声明对外暴露的端口
+EXPOSE 3000
+# 配置容器启动时运行的命令
+ENTRYPOINT ["node","/home/server/dist/src/main.js"]
+
diff --git a/server/README.md b/server/README.md
new file mode 100644
index 00000000..17cb5444
--- /dev/null
+++ b/server/README.md
@@ -0,0 +1,19 @@
+# 凯团团服务端
+
+## 简介
+凯团团服务端是基于 NestJS 构建的后端项目,用于支持聚合类业务平台。
+
+## 环境配置
+项目使用环境变量进行配置管理。请根据实际需要配置环境变量:
+
+1. 复制示例配置文件:
+ ```bash
+ cp .env.example .env
+ ```
+
+2. 修改 `.env` 文件中的配置项,替换为您实际的配置值。
+
+## 部署
+```bash
+pm2 start pm2.json
+```
\ No newline at end of file
diff --git a/server/config/bilibili.config.ts b/server/config/bilibili.config.ts
new file mode 100644
index 00000000..5e7c94ea
--- /dev/null
+++ b/server/config/bilibili.config.ts
@@ -0,0 +1,15 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 11:05:02
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-02-25 15:03:36
+ * @Description: B站配置
+ */
+export default () => ({
+ BILIBILI_CONFIG: {
+ CLIENT_NAME: process.env.BILIBILI_CLIENT_NAME || '',
+ CLIENT_ID: process.env.BILIBILI_CLIENT_ID || '',
+ CLIENT_SECRET: process.env.BILIBILI_CLIENT_SECRET || '',
+ AUTH_BACK_URL: process.env.BILIBILI_AUTH_BACK_URL || '',
+ },
+});
diff --git a/server/config/bullMq.config.ts b/server/config/bullMq.config.ts
new file mode 100644
index 00000000..eba98c19
--- /dev/null
+++ b/server/config/bullMq.config.ts
@@ -0,0 +1,15 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 11:05:02
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-01-13 17:26:58
+ * @Description: 队列配置
+ */
+export default () => ({
+ BULLMQ_REDIS_CONFIG: {
+ HOST: process.env.REDIS_HOST || '127.0.0.1',
+ PORT: Number(process.env.REDIS_PORT) || 6379,
+ PASSWORD: process.env.REDIS_PASSWORD || '',
+ DB: process.env.REDIS_DB,
+ },
+});
diff --git a/server/config/google.config.ts b/server/config/google.config.ts
new file mode 100644
index 00000000..03d6b8cd
--- /dev/null
+++ b/server/config/google.config.ts
@@ -0,0 +1,12 @@
+export default () => ({
+ GOOGLE_CONFIG: {
+ WEB_CLIENT_SECRET: process.env.GOOGLE_WEB_CLIENT_SECRET || '',
+ WEB_CLIENT_ID: process.env.GOOGLE_WEB_CLIENT_ID || '',
+ WEB_RENDER_URL: process.env.GOOGLE_RENDER_URL || '',
+ },
+ TWITTER_CONFIG: {
+ WEB_CLIENT_SECRET: process.env.TWITTER_WEB_CLIENT_SECRET || '',
+ WEB_CLIENT_ID: process.env.TWITTER_WEB_CLIENT_ID || '',
+ WEB_RENDER_URL: process.env.TWITTER_WEB_RENDER_URL || '',
+ },
+});
diff --git a/server/config/mail.config.ts b/server/config/mail.config.ts
new file mode 100644
index 00000000..9e1ace35
--- /dev/null
+++ b/server/config/mail.config.ts
@@ -0,0 +1,28 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 11:05:02
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-07-05 15:52:13
+ * @Description: 邮件服务配置文件
+ */
+import { MailerOptions } from '@nestjs-modules/mailer';
+
+export const mailConfig: MailerOptions = {
+ transport: {
+ host: process.env.MAIL_HOST || 'smtp.feishu.cn',
+ port: 465,
+ secure: true,
+ auth: {
+ user: process.env.MAIL_AUTH_USER || '[email protected]',
+ pass: process.env.MAIL_AUTH_PASS || 'xxxx',
+ },
+ debug: true,
+ },
+ defaults: {
+ from: `aitoearn <[email protected]>`,
+ },
+};
+
+export default () => ({
+ MAIL_CONFIG: mailConfig,
+});
diff --git a/server/config/mongo.config.ts b/server/config/mongo.config.ts
new file mode 100644
index 00000000..5a7f14ed
--- /dev/null
+++ b/server/config/mongo.config.ts
@@ -0,0 +1,15 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-30 14:58:16
+ * @LastEditTime: 2025-02-25 16:52:34
+ * @LastEditors: nevin
+ * @Description: mongo数据库配置
+ */
+import { MongooseModuleFactoryOptions } from '@nestjs/mongoose';
+
+export default (): { MONGO_CONFIG: MongooseModuleFactoryOptions } => ({
+ MONGO_CONFIG: {
+ uri: process.env.MONGO_URI || 'wwww',
+ dbName: process.env.MONGO_DB || '',
+ },
+});
diff --git a/server/config/oss.config.ts b/server/config/oss.config.ts
new file mode 100644
index 00000000..b9909750
--- /dev/null
+++ b/server/config/oss.config.ts
@@ -0,0 +1,19 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 11:05:02
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-06-17 14:24:27
+ * @Description: OSS模块配置文件
+ */
+export default () => ({
+ OSS_CONFIG: {
+ INIT_OPTION: {
+ region: 'oss-cn-beijing',
+ accessKeyId: process.env.OSS_KEY_ID || 'xxxx',
+ accessKeySecret: process.env.OSS_KEY_SECRET || 'xxxx',
+ bucket: process.env.OSS_BUCKET || '',
+ secret: process.env.OSS_SECRET === 'true',
+ },
+ HOST_URL: process.env.OSS_URL || '',
+ },
+});
diff --git a/server/config/realAuth.config.ts b/server/config/realAuth.config.ts
new file mode 100644
index 00000000..95544d2b
--- /dev/null
+++ b/server/config/realAuth.config.ts
@@ -0,0 +1,6 @@
+export default () => ({
+ REAL_NAME_CONFIG: {
+ accessKeyId: process.env.REALNAME_ACCESS_KEY_ID || 'xxxx',
+ accessKeySecret: process.env.REALNAME_ACCESS_KEY_SECRET || 'xxxx',
+ },
+});
diff --git a/server/config/redis.config.ts b/server/config/redis.config.ts
new file mode 100644
index 00000000..533a21b6
--- /dev/null
+++ b/server/config/redis.config.ts
@@ -0,0 +1,18 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 11:05:02
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-08-31 19:27:09
+ * @Description: redis缓存配置文件
+ */
+import { RedisOptions } from 'ioredis';
+export default (): { REDIS_CONFIG: RedisOptions } => ({
+ REDIS_CONFIG: {
+ name: 'default',
+ host: process.env.REDIS_HOST || '127.0.0.1',
+ port: Number(process.env.REDIS_PORT) || 6379,
+ password: process.env.REDIS_PASSWORD || '',
+ db: Number.parseInt(process.env.REDIS_DB) || 0,
+ connectTimeout: 10000,
+ },
+});
diff --git a/server/config/server.config.ts b/server/config/server.config.ts
new file mode 100644
index 00000000..4b7d295f
--- /dev/null
+++ b/server/config/server.config.ts
@@ -0,0 +1,16 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 11:05:02
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-06-17 14:24:40
+ * @Description: 服务配置文件
+ */
+export default () => ({
+ SERVER_CONFIG: {
+ NODE_ENV: process.env.NODE_ENV,
+ PORT: process.env.SERVER_PORT
+ ? Number.parseInt(process.env.SERVER_PORT)
+ : 7000,
+ ENABLE_SWAGGER: process.env.NODE_ENV !== 'production' ? true : false,
+ },
+});
diff --git a/server/config/sms.config.ts b/server/config/sms.config.ts
new file mode 100644
index 00000000..1be972e2
--- /dev/null
+++ b/server/config/sms.config.ts
@@ -0,0 +1,14 @@
+export default () => ({
+ SMS_CONFIG: {
+ config: {
+ accessKeyId: process.env.SMS_ACCESS_KEY_ID || 'xxxx',
+ accessKeySecret: process.env.SMS_ACCESS_KEY_SECRET || 'xxxx',
+ endpoint: process.env.SMS_ENDPOINT || 'dysmsapi.aliyuncs.com',
+ },
+ defaults: {
+ regionId: process.env.SMS_REGION_ID || undefined,
+ signName: process.env.SMS_SIGN_NAME || '',
+ templateCode: process.env.SMS_TEMPLATE_CODE || '',
+ },
+ },
+});
diff --git a/server/config/tiktok.config.ts b/server/config/tiktok.config.ts
new file mode 100644
index 00000000..7338ebcc
--- /dev/null
+++ b/server/config/tiktok.config.ts
@@ -0,0 +1,36 @@
+import { registerAs } from '@nestjs/config';
+
+export default registerAs('tiktok', () => ({
+ // TikTok开发者平台的客户端密钥
+ clientId: process.env.TIKTOK_CLIENT_ID || '',
+ clientSecret: process.env.TIKTOK_CLIENT_SECRET || '',
+ redirectUri: process.env.TIKTOK_REDIRECT_URI || 'https://platapi.aitoearn.cn',
+
+ // TikTok API基础URL
+ apiBaseUrl: 'https://open.tiktokapis.com',
+
+ // TikTok OAuth 2.0终端点
+ authUrl: 'https://www.tiktok.com/v2/auth/authorize',
+ tokenUrl: 'https://open.tiktokapis.com/v2/oauth/token/',
+ revokeUrl: 'https://open.tiktokapis.com/v2/oauth/revoke/',
+ refreshTokenUrl: 'https://open.tiktokapis.com/v2/oauth/token/',
+
+ // TikTok API终端点
+ // videosListUrl: 'https://open.tiktokapis.com/v2/video/list/',
+ videoUploadUrl: 'https://open-upload.tiktokapis.com/v2',
+ // videoPublishUrl: 'https://open.tiktokapis.com/v2/video/publish/',
+
+ // API版本
+ apiVersion: 'v2',
+
+ // 需要的权限范围
+ scopes: [
+ 'user.info.basic',
+ 'user.info.open_id',
+ 'user.info.profile',
+ 'user.info.stats',
+ 'video.list',
+ 'video.upload',
+ 'video.publish',
+ ].join(','),
+}));
diff --git a/server/config/tms.config.ts b/server/config/tms.config.ts
new file mode 100644
index 00000000..8f1f348d
--- /dev/null
+++ b/server/config/tms.config.ts
@@ -0,0 +1,6 @@
+export default () => ({
+ TMS_CONFIG: {
+ secretId: process.env.TENCENT_TMS_SECRET_ID || '',
+ secretKey: process.env.TENCENT_TMS_SECRET_KEY || '',
+ },
+});
diff --git a/server/config/wx.config.ts b/server/config/wx.config.ts
new file mode 100644
index 00000000..f4891835
--- /dev/null
+++ b/server/config/wx.config.ts
@@ -0,0 +1,31 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 11:05:02
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-02-25 15:03:36
+ * @Description: 微信配置
+ */
+import * as fs from 'fs';
+import { join } from 'path';
+
+export default () => ({
+ WX_CONFIG: {
+ APP_ID: process.env.WX_APP_ID || '',
+ APP_SECRET: process.env.WX_APP_SECRET || '',
+ MCH_ID: process.env.WX_MCH_ID || '',
+ PUBLIC_KEY: fs.readFileSync(
+ join(__dirname, '..', 'src/files/wxcert/apiclient_cert.pem'),
+ ),
+ PRIVATE_KEY: fs.readFileSync(
+ join(__dirname, '..', 'src/files/wxcert/apiclient_key.pem'),
+ ),
+ KEY: process.env.WX_KEY || '',
+ NOTIFY_URL: process.env.WX_NOTIFY_URL || '',
+ },
+ WX_GZH: {
+ WX_GZH_ID: process.env.WX_GZH_ID || '',
+ WX_GZH_SECRET: process.env.WX_GZH_SECRET || '',
+ WX_GZH_TOKEN: process.env.WX_GZH_TOKEN || '',
+ WX_GZH_AES_KEY: process.env.WX_GZH_AES_KEY || '',
+ },
+});
diff --git a/server/nest-cli.json b/server/nest-cli.json
new file mode 100644
index 00000000..a4af1b12
--- /dev/null
+++ b/server/nest-cli.json
@@ -0,0 +1,23 @@
+{
+ "$schema": "https://json.schemastore.org/nest-cli",
+ "collection": "@nestjs/schematics",
+ "sourceRoot": "src",
+ "compilerOptions": {
+ "deleteOutDir": true,
+ "assets": [
+ {
+ "include": "files/**",
+ "outDir": "dist/src",
+ "watchAssets": true
+ },
+ {
+ "include": "modules/tools/kwaiSign/kuaiShoSignCore.js",
+ "outDir": "dist/src",
+ "watchAssets": true
+ },
+ "views/",
+ "public/"
+ ],
+ "watchAssets": true
+ }
+}
diff --git a/server/package.json b/server/package.json
new file mode 100644
index 00000000..70f26a66
--- /dev/null
+++ b/server/package.json
@@ -0,0 +1,127 @@
+{
+ "name": "aituantuan-server",
+ "version": "0.0.1",
+ "description": "",
+ "author": "",
+ "private": true,
+ "license": "UNLICENSED",
+ "scripts": {
+ "build": "nest build",
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
+ "start": "nest start",
+ "dev": "nest start --watch",
+ "debug": "nest start --debug --watch",
+ "prod": "node dist/main",
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
+ "test": "jest",
+ "test:watch": "jest --watch",
+ "test:cov": "jest --coverage",
+ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
+ "test:e2e": "jest --config ./test/jest-e2e.json"
+ },
+ "dependencies": {
+ "@alicloud/cloudauth20190307": "3.5.0",
+ "@alicloud/credentials": "^2.4.3",
+ "@alicloud/dypnsapi20170525": "1.2.3",
+ "@alicloud/dysmsapi20170525": "^3.1.1",
+ "@alicloud/openapi-client": "^0.4.12",
+ "@alicloud/tea-util": "^1.4.10",
+ "@nestjs-modules/mailer": "^2.0.2",
+ "@nestjs/axios": "^3.1.3",
+ "@nestjs/bullmq": "^11.0.2",
+ "@nestjs/common": "^10.0.0",
+ "@nestjs/config": "^3.3.0",
+ "@nestjs/core": "^10.0.0",
+ "@nestjs/event-emitter": "^2.1.1",
+ "@nestjs/jwt": "^10.2.0",
+ "@nestjs/mongoose": "^10.1.0",
+ "@nestjs/platform-express": "^10.0.0",
+ "@nestjs/schedule": "^4.1.2",
+ "@nestjs/swagger": "^8.1.1",
+ "ali-oss": "^6.22.0",
+ "axios": "^1.7.9",
+ "body-parser": "^2.2.0",
+ "bullmq": "^5.52.2",
+ "cheerio": "^1.0.0",
+ "class-transformer": "^0.5.1",
+ "class-validator": "^0.14.1",
+ "express": "^5.1.0",
+ "express-session": "^1.18.1",
+ "fast-xml-parser": "^5.0.7",
+ "form-data": "^4.0.3",
+ "fs": "0.0.1-security",
+ "google-auth-library": "^9.15.1",
+ "googleapis": "^148.0.0",
+ "hbs": "^4.2.0",
+ "he": "^1.2.0",
+ "ioredis": "^5.4.2",
+ "lodash": "^4.17.21",
+ "moment": "^2.30.1",
+ "mongodb": "^6.12.0",
+ "mongoose": "^8.9.4",
+ "multer": "^2.0.0",
+ "natural": "^8.0.1",
+ "nest-wechatpay-node-v3": "^1.0.2",
+ "nodemailer": "^7.0.3",
+ "openai": "^4.86.2",
+ "path": "^0.12.7",
+ "qs": "^6.14.0",
+ "reflect-metadata": "^0.2.0",
+ "rxjs": "^7.8.1",
+ "swagger-ui-express": "^5.0.1",
+ "tencentcloud-sdk-nodejs-tms": "^4.0.1052",
+ "uuid": "^11.0.5",
+ "wechatpay-node-v3": "^2.2.1",
+ "xml-js": "^1.6.11",
+ "xml2js": "^0.6.2",
+ "yaml": "^2.7.0"
+ },
+ "devDependencies": {
+ "@hapi/joi": "^17.1.1",
+ "@nestjs/cli": "^10.0.0",
+ "@nestjs/schematics": "^10.0.0",
+ "@nestjs/testing": "^10.0.0",
+ "@testcontainers/mongodb": "^10.16.0",
+ "@testcontainers/redis": "^10.16.0",
+ "@types/express": "^4.17.17",
+ "@types/jest": "^29.5.2",
+ "@types/multer": "^1.4.12",
+ "@types/node": "^20.3.1",
+ "@types/nodemailer": "^6.4.17",
+ "@types/qs": "^6.14.0",
+ "@types/supertest": "^6.0.0",
+ "@types/xml-js": "^1.0.0",
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
+ "@typescript-eslint/parser": "^8.0.0",
+ "eslint": "^8.42.0",
+ "eslint-config-prettier": "^9.1.0",
+ "eslint-plugin-prettier": "^5.2.1",
+ "jest": "^29.5.0",
+ "prettier": "^3.0.0",
+ "source-map-support": "^0.5.21",
+ "supertest": "^7.0.0",
+ "testcontainers": "^10.16.0",
+ "ts-jest": "^29.1.0",
+ "ts-loader": "^9.4.3",
+ "ts-node": "^10.9.1",
+ "tsconfig-paths": "^4.2.0",
+ "typescript": "^5.1.3"
+ },
+ "jest": {
+ "moduleFileExtensions": [
+ "js",
+ "json",
+ "ts"
+ ],
+ "rootDir": "src",
+ "testRegex": ".*\\.spec\\.ts$",
+ "transform": {
+ "^.+\\.(t|j)s$": "ts-jest"
+ },
+ "collectCoverageFrom": [
+ "**/*.(t|j)s"
+ ],
+ "coverageDirectory": "../coverage",
+ "testEnvironment": "node"
+ }
+}
diff --git a/server/pm2.json b/server/pm2.json
new file mode 100644
index 00000000..33cdca54
--- /dev/null
+++ b/server/pm2.json
@@ -0,0 +1,117 @@
+{
+ "apps": [
+ {
+ "name": "aitoearn-server",
+ "cwd": "dist",
+ "script": "src/main.js",
+ "instances": "2",
+ "exec_mode": "cluster",
+ "env": {
+ "NODE_ENV": "development",
+ "SERVER_PORT": "3000",
+ "MONGO_URI": "mongodb://root:[email protected]:31051/katuantuan?authSource=admin&directConnection=true",
+ "MONGO_DB": "katuantuan",
+ "REDIS_HOST": "101.200.211.50",
+ "REDIS_PORT": "6379",
+ "REDIS_PASSWORD": "REPLACE_WITH_RANDOM_STRING",
+ "REDIS_DB": "1",
+ "WX_MCH_ID": "REPLACE_WITH_RANDOM_STRING",
+ "WX_KEY": "REPLACE_WITH_RANDOM_STRING",
+ "WX_NOTIFY_URL": "https://qqdsdabnbtqd.sealosbja.site/api/pay/back/wx",
+ "WX_APP_ID": "REPLACE_WITH_RANDOM_STRING",
+ "WX_APP_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "WX_GZH_ID": "REPLACE_WITH_RANDOM_STRING",
+ "WX_GZH_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "WX_GZH_TOKEN": "REPLACE_WITH_RANDOM_STRING",
+ "WX_GZH_AES_KEY": "REPLACE_WITH_RANDOM_STRING",
+ "OSS_KEY_ID": "REPLACE_WITH_RANDOM_STRING",
+ "OSS_KEY_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "OSS_REGION": "oss-cn-beijing",
+ "OSS_BUCKET": "ai-to-earn",
+ "OSS_URL": "https://ai-to-earn.oss-cn-beijing.aliyuncs.com",
+ "OSS_SECRET": "true",
+ "SMS_ACCESS_KEY_ID": "REPLACE_WITH_RANDOM_STRING",
+ "SMS_ACCESS_KEY_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "SMS_ENDPOINT": "dysmsapi.aliyuncs.com",
+ "SMS_REGION_ID": "",
+ "SMS_SIGN_NAME": "艺咖",
+ "SMS_TEMPLATE_CODE": "REPLACE_WITH_RANDOM_STRING",
+ "REALNAME_ACCESS_KEY_ID": "REPLACE_WITH_RANDOM_STRING",
+ "REALNAME_ACCESS_KEY_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "QWEN_KEY": "REPLACE_WITH_RANDOM_STRING",
+ "TENCENT_TMS_SECRET_ID": "REPLACE_WITH_RANDOM_STRING",
+ "TENCENT_TMS_SECRET_KEY": "REPLACE_WITH_RANDOM_STRING",
+ "MAIL_HOST": "smtp.feishu.cn",
+ "MAIL_AUTH_USER": "REPLACE_WITH_RANDOM_STRING",
+ "MAIL_AUTH_PASS": "REPLACE_WITH_RANDOM_STRING",
+ "BILIBILI_CLIENT_NAME": "aitoearn",
+ "BILIBILI_CLIENT_ID": "REPLACE_WITH_RANDOM_STRING",
+ "BILIBILI_CLIENT_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "BILIBILI_AUTH_BACK_URL": "https://apitest.aitoearn.cn",
+ "GOOGLE_WEB_CLIENT_ID": "REPLACE_WITH_RANDOM_STRING",
+ "GOOGLE_WEB_CLIENT_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "GOOGLE_RENDER_URL": "https://platapi.aitoearn.cn",
+ "TWITTER_WEB_CLIENT_ID": "REPLACE_WITH_RANDOM_STRING",
+ "TWITTER_WEB_CLIENT_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "TWITTER_WEB_RENDER_URL": "https://platapi.aitoearn.cn",
+ "TIKTOK_CLIENT_ID": "REPLACE_WITH_RANDOM_STRING",
+ "TIKTOK_CLIENT_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "TIKTOK_REDIRECT_URI": "https://platapi.aitoearn.cn"
+ },
+ "env_production": {
+ "NODE_ENV": "production",
+ "SERVER_PORT": "3000",
+ "MONGO_URI": "mongodb://root:[email protected]:33948/?directConnection=true",
+ "MONGO_DB": "att",
+ "REDIS_HOST": "dbconn.sealosbja.site",
+ "REDIS_PORT": "46963",
+ "REDIS_PASSWORD": "REPLACE_WITH_RANDOM_STRING",
+ "REDIS_DB": "0",
+ "WX_MCH_ID": "REPLACE_WITH_RANDOM_STRING",
+ "WX_KEY": "REPLACE_WITH_RANDOM_STRING",
+ "WX_NOTIFY_URL": "https://qqdsdabnbtqd.sealosbja.site/api/pay/back/wx",
+ "WX_APP_ID": "REPLACE_WITH_RANDOM_STRING",
+ "WX_APP_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "WX_GZH_ID": "REPLACE_WITH_RANDOM_STRING",
+ "WX_GZH_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "WX_GZH_TOKEN": "REPLACE_WITH_RANDOM_STRING",
+ "WX_GZH_AES_KEY": "REPLACE_WITH_RANDOM_STRING",
+ "OSS_KEY_ID": "REPLACE_WITH_RANDOM_STRING",
+ "OSS_KEY_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "OSS_REGION": "oss-cn-beijing",
+ "OSS_BUCKET": "ai-to-earn",
+ "OSS_URL": "https://ai-to-earn.oss-cn-beijing.aliyuncs.com",
+ "OSS_SECRET": "true",
+ "SMS_ACCESS_KEY_ID": "REPLACE_WITH_RANDOM_STRING",
+ "SMS_ACCESS_KEY_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "SMS_ENDPOINT": "dysmsapi.aliyuncs.com",
+ "SMS_REGION_ID": "",
+ "SMS_SIGN_NAME": "艺咖",
+ "SMS_TEMPLATE_CODE": "REPLACE_WITH_RANDOM_STRING",
+ "REALNAME_ACCESS_KEY_ID": "REPLACE_WITH_RANDOM_STRING",
+ "REALNAME_ACCESS_KEY_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "QWEN_KEY": "REPLACE_WITH_RANDOM_STRING",
+ "TENCENT_TMS_SECRET_ID": "REPLACE_WITH_RANDOM_STRING",
+ "TENCENT_TMS_SECRET_KEY": "REPLACE_WITH_RANDOM_STRING",
+ "MAIL_HOST": "smtp.feishu.cn",
+ "MAIL_AUTH_USER": "REPLACE_WITH_RANDOM_STRING",
+ "MAIL_AUTH_PASS": "REPLACE_WITH_RANDOM_STRING",
+ "BILIBILI_CLIENT_NAME": "aitoearn",
+ "BILIBILI_CLIENT_ID": "REPLACE_WITH_RANDOM_STRING",
+ "BILIBILI_CLIENT_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "BILIBILI_AUTH_BACK_URL": "https://api.aitoearn.cn",
+ "GOOGLE_WEB_CLIENT_ID": "REPLACE_WITH_RANDOM_STRING",
+ "GOOGLE_WEB_CLIENT_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "GOOGLE_RENDER_URL": "https://platapi.aitoearn.cn",
+ "TWITTER_WEB_CLIENT_ID": "REPLACE_WITH_RANDOM_STRING",
+ "TWITTER_WEB_CLIENT_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "TWITTER_WEB_RENDER_URL": "https://platapi.aitoearn.cn",
+ "TIKTOK_CLIENT_ID": "REPLACE_WITH_RANDOM_STRING",
+ "TIKTOK_CLIENT_SECRET": "REPLACE_WITH_RANDOM_STRING",
+ "TIKTOK_REDIRECT_URI": "https://platapi.aitoearn.cn"
+ },
+ "log_date_format": "YYYY-MM-DD_HH:mm Z",
+ "merge_logs": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml
new file mode 100644
index 00000000..c579c255
--- /dev/null
+++ b/server/pnpm-lock.yaml
@@ -0,0 +1,11139 @@
+lockfileVersion: '9.0'
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
+
+importers:
+
+ .:
+ dependencies:
+ '@alicloud/cloudauth20190307':
+ specifier: 3.5.0
+ version: 3.5.0
+ '@alicloud/credentials':
+ specifier: ^2.4.3
+ version: 2.4.3
+ '@alicloud/dypnsapi20170525':
+ specifier: 1.2.3
+ version: 1.2.3
+ '@alicloud/dysmsapi20170525':
+ specifier: ^3.1.1
+ version: 3.1.1
+ '@alicloud/openapi-client':
+ specifier: ^0.4.12
+ version: 0.4.12
+ '@alicloud/tea-util':
+ specifier: ^1.4.10
+ version: 1.4.10
+ '@nestjs-modules/mailer':
+ specifier: ^2.0.2
+ '@nestjs/axios':
+ specifier: ^3.1.3
+ '@nestjs/bullmq':
+ specifier: ^11.0.2
+ '@nestjs/common':
+ specifier: ^10.0.0
+ '@nestjs/config':
+ specifier: ^3.3.0
+ '@nestjs/core':
+ specifier: ^10.0.0
+ '@nestjs/event-emitter':
+ specifier: ^2.1.1
+ '@nestjs/jwt':
+ specifier: ^10.2.0
+ '@nestjs/mongoose':
+ specifier: ^10.1.0
+ '@nestjs/platform-express':
+ specifier: ^10.0.0
+ '@nestjs/schedule':
+ specifier: ^4.1.2
+ '@nestjs/swagger':
+ specifier: ^8.1.1
+ ali-oss:
+ specifier: ^6.22.0
+ version: 6.22.0
+ axios:
+ specifier: ^1.7.9
+ version: 1.7.9
+ body-parser:
+ specifier: ^2.2.0
+ version: 2.2.0
+ bullmq:
+ specifier: ^5.52.2
+ version: 5.52.2
+ cheerio:
+ specifier: ^1.0.0
+ version: 1.0.0
+ class-transformer:
+ specifier: ^0.5.1
+ version: 0.5.1
+ class-validator:
+ specifier: ^0.14.1
+ version: 0.14.1
+ express:
+ specifier: ^5.1.0
+ version: 5.1.0
+ express-session:
+ specifier: ^1.18.1
+ version: 1.18.1
+ fast-xml-parser:
+ specifier: ^5.0.7
+ version: 5.2.1
+ form-data:
+ specifier: ^4.0.3
+ version: 4.0.3
+ fs:
+ specifier: 0.0.1-security
+ version: 0.0.1-security
+ google-auth-library:
+ specifier: ^9.15.1
+ version: 9.15.1
+ googleapis:
+ specifier: ^148.0.0
+ version: 148.0.0
+ hbs:
+ specifier: ^4.2.0
+ version: 4.2.0
+ he:
+ specifier: ^1.2.0
+ version: 1.2.0
+ ioredis:
+ specifier: ^5.4.2
+ version: 5.4.2
+ lodash:
+ specifier: ^4.17.21
+ version: 4.17.21
+ moment:
+ specifier: ^2.30.1
+ version: 2.30.1
+ mongodb:
+ specifier: ^6.12.0
+ version: 6.12.0
+ mongoose:
+ specifier: ^8.9.4
+ version: 8.9.4
+ multer:
+ specifier: ^2.0.0
+ version: 2.0.0
+ natural:
+ specifier: ^8.0.1
+ version: 8.0.1
+ nest-wechatpay-node-v3:
+ specifier: ^1.0.2
+ version: 1.0.2
+ nodemailer:
+ specifier: ^7.0.3
+ version: 7.0.3
+ openai:
+ specifier: ^4.86.2
+ version: 4.96.0
+ path:
+ specifier: ^0.12.7
+ version: 0.12.7
+ qs:
+ specifier: ^6.14.0
+ version: 6.14.0
+ reflect-metadata:
+ specifier: ^0.2.0
+ version: 0.2.2
+ rxjs:
+ specifier: ^7.8.1
+ version: 7.8.1
+ swagger-ui-express:
+ specifier: ^5.0.1
+ version: 5.0.1([email protected])
+ tencentcloud-sdk-nodejs-tms:
+ specifier: ^4.0.1052
+ version: 4.0.1052
+ uuid:
+ specifier: ^11.0.5
+ version: 11.0.5
+ wechatpay-node-v3:
+ specifier: ^2.2.1
+ version: 2.2.1
+ xml-js:
+ specifier: ^1.6.11
+ version: 1.6.11
+ xml2js:
+ specifier: ^0.6.2
+ version: 0.6.2
+ yaml:
+ specifier: ^2.7.0
+ version: 2.7.0
+ devDependencies:
+ '@hapi/joi':
+ specifier: ^17.1.1
+ version: 17.1.1
+ '@nestjs/cli':
+ specifier: ^10.0.0
+ version: 10.4.9
+ '@nestjs/schematics':
+ specifier: ^10.0.0
+ '@nestjs/testing':
+ specifier: ^10.0.0
+ '@testcontainers/mongodb':
+ specifier: ^10.16.0
+ version: 10.16.0
+ '@testcontainers/redis':
+ specifier: ^10.16.0
+ version: 10.16.0
+ '@types/express':
+ specifier: ^4.17.17
+ version: 4.17.21
+ '@types/jest':
+ specifier: ^29.5.2
+ version: 29.5.14
+ '@types/multer':
+ specifier: ^1.4.12
+ version: 1.4.12
+ '@types/node':
+ specifier: ^20.3.1
+ version: 20.17.12
+ '@types/nodemailer':
+ specifier: ^6.4.17
+ version: 6.4.17
+ '@types/qs':
+ specifier: ^6.14.0
+ version: 6.14.0
+ '@types/supertest':
+ specifier: ^6.0.0
+ version: 6.0.2
+ '@types/xml-js':
+ specifier: ^1.0.0
+ version: 1.0.0
+ '@typescript-eslint/eslint-plugin':
+ specifier: ^8.0.0
+ '@typescript-eslint/parser':
+ specifier: ^8.0.0
+ eslint:
+ specifier: ^8.42.0
+ version: 8.57.1
+ eslint-config-prettier:
+ specifier: ^9.1.0
+ version: 9.1.0([email protected])
+ eslint-plugin-prettier:
+ specifier: ^5.2.1
+ jest:
+ specifier: ^29.5.0
+ prettier:
+ specifier: ^3.0.0
+ version: 3.4.2
+ source-map-support:
+ specifier: ^0.5.21
+ version: 0.5.21
+ supertest:
+ specifier: ^7.0.0
+ version: 7.0.0
+ testcontainers:
+ specifier: ^10.16.0
+ version: 10.16.0
+ ts-jest:
+ specifier: ^29.1.0
+ ts-loader:
+ specifier: ^9.4.3
+ ts-node:
+ specifier: ^10.9.1
+ version: 10.9.2(@types/[email protected])([email protected])
+ tsconfig-paths:
+ specifier: ^4.2.0
+ version: 4.2.0
+ typescript:
+ specifier: ^5.1.3
+ version: 5.7.3
+
+packages:
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-cUeNWfinrx7rvjGCoSurBtSlsnRbC45wi+5p3DyC+uf0JvA8dB7LbhwYXOt+bk1LIzG3OzL+zx9dNtO1wwGyyA==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-sCZjWWvOCJW/jkBBas6PJsofF0m3xxU0Yhq45rxs18IiHUsHqGeo1DqG4zkHToAuE689hA/GjFivtO6NOmJWHw==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-r2thNtthchTz/c8/HryGSey1vY0UZx2FkAvb+vd+j7xhD/v/KUwnp8RJNQKNG3E4kfs4wSx2bgDSkcPAiXHQLQ==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-y4oM4O2uXiroUjfWBLEXRHMm1279rWpkWWNalF7DFQyO5awJ/e0d631prU4i10ytKzo8XJd12eCHmm3IOW85+g==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-Sl5vCRVAYMqwmvXpJLM9hYoCHOMsQlGxaWSGhGWulpKk/NaUBArtoO1B0yHruJf1C5uHhEJIaylYcM48icFHgw==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-mlsNctkeqmR0RtgE1Rngyeadi5snLOAHBCWEtYf68d7tyKskosXDTNeZ6VCD/UfrUu4N51ItO8zlpfXiOgeg3A==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-2ep+G3YDvuI+dRYVlmER1LVUQDhf9kEItmVB/bbEu1pgKzelcocCwAc79XZQjTcQGFgjDycf3vH87WLDGLFMlw==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-I1TtwtAnzLamgqnAaOkN0IGjwkiti//0a7/auyVThdqiC/3kyafSAn6znysWOmzub4mrzac2WiqblZKFcN5NWg==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-NyWwrU8cAIesWk3uHL1Q7pTDTqLkCI/0PmJXC4/4A0MFNAZ9Ouq0iFBsRqvfyUujSSM+WhYLuTfakQXiVLkTMA==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-24UQXNlfNyiFG2KBjXvxPixU8pDIbaQznztiqb7e/UO3v8ghiy8WjDVY29JH8T//E/KS4BKzPdHRHATm6sDX+A==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-UvrQo9p1b7A/JH209jPFLdtuYGywMrn4vWl48LwGxgZOH21i/LQXJKGhIUkeN9/CbdWsW709lkJ9kWvzmQZ5gQ==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-+pH7/KEXup84cHzIL6UJAaPqETvln4yXlD9JzlrqioyCSaWxbug5FUobsiI6fuUOpw5WwoB3fWAtGbFnJ1K3Yg==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-KF4I+JvfYuLKc3fWeWYIZ7lOVJ9jRW0sQXdXidZn1DKZ978ncfGf7i0LBfONGk4OxvNb/HD3/0yYhkgZgPbKtA==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-KM7fu5asjxZPmrz9sJGHJeSU+cNQNOxW+SFmgmAIrITui5hXL2LB+KNRuzWmlwPjnuA2X3/keq9h6++S9jcV5g==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-ZODX85jwCf63Fmzj+pYZq85z8+SZzNg/FL+oW1/L/sRM8oj70+1+pdG0RHynAxBXkjNYt4eLIPrBvIEeVfx+LQ==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-WuKfFqwY3/+wuNawzfJAirNA00XDI7fm9fUhWK7siGZEh0R2XJR0Y54MLW7WWItX06fAghUvnDhKWZH3AgN+yg==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-7ALrOsj8MUUZkrPJNvWMARh0XykxaBsHEHthmlen3rk7EoTVbljyjdKn0VqFKe4AsqBl4F5I9wda2mxQxWAEHg==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-GUEYtX3lDv+WaZoDFCb0h9aZ8+IlajnSAxSHjiITbNtjCpZbA/vfd7Z/ST9YaPoT34nGqDNKiQTjqpLhaKtYBw==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-EC2JvxdcOgMlBAEG0+joOh2IB1um8CPz9EdYuRfTfd1uP8Yc9D8QRUWVGjP6scnj6fWSOaHFlit9H6PrJSyFow==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-x2o725mfNTML1rCoabrQ/9QIL7lnNGf1QsLV/7AH7IWp3tGLKKOQc7RyXIuU3E699lvF8dNsK3fZL6knjaKenA==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-4K5sQTd7rCLfk+DbwIKEbISWKKGlso9bBz1qzZkDBG6OGvLjwh36/2BK2O9omvXMUVzpj7jrJSkFU/oWZY4zEQ==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-xbFcZtcCJhR7UAdWnvccd9VJe4HD+Q+ovpdgbAzqHzWppjhiIKEXs9GEWS3kqclyoNzpz7lRG67GJA2KDzRtjA==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-5cfcNVhN7YCvwaI1iAheppMFhIVbeFuJZMgS65mxDA0F9ud6kMCkxiYnlYPvms/lvVEuVkEHbR5939WH8ysz0w==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-7gyxvZMDA/DVPcsr61VgCGAVNpsqiSKUE2R+0oONqOZFEP2bqkCbift14qOY+SL9C5+dvmLIXQluCtL00KVSLw==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-YUG6cPs9zq4WQVar0PX+s3ZnrmWf5nm62CzlBX4mlkkaCRyCf/VOGuYIPf+j1w8FvPYNv0zudeDU9tyZ20xWwA==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-WOv1qkNW7r2S6I0f2Qz8+7D5uU7bgE5vHxDWExcXmomMgr2i8JM6GhJeFPNVOzSWPgQi6Ujc+EATZ6ies9+UMA==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-+uKR4BsJssR254Isaqc/6Dc2iDC6AylBtrkf05yxqBd95cP1OfvzzRgdJ9MfipLWJkUtzVaVdnnbZwzGuLJVxQ==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-CWXWaquauJf0sW30mgJRVu9aaXyBth5uMBCUc+5vKTK1zlgf3hIqRUjJZbjlwHwQ5y9anwcu18r48nOZb7l2QQ==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-VEsXWP2dlJLvsY2THj+sH++zwxQRz3Y5BQ8EkfnFems36RkngQKYOLsoto5nR6ej1Gf6I+0IOgBXrkRdpNCQ1g==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-S0wz76rGtoPKskQtRTGqeuqBHFj8BqUn0Vh+glXKun2/9UpaaaWmuJwcmtImk6bJZfLYEShDF/kxDmDJoNYiTw==}
+
+ '@alicloud/[email protected]':
+ resolution: {integrity: sha512-+/9GliugjrLglsXVrd1D80EqqKgGpyA0eQ6+1ZdUOYCaRguaSwz44trX3PaxPu/HhIPJg9PsGQQ3cSLXWZjbAA==}
+
+ '@ampproject/[email protected]':
+ resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}
+ engines: {node: '>=6.0.0'}
+
+ '@angular-devkit/[email protected]':
+ resolution: {integrity: sha512-vTNDYNsLIWpYk2I969LMQFH29GTsLzxNk/0cLw5q56ARF0v5sIWfHYwGTS88jdDqIpuuettcSczbxeA7EuAmqQ==}
+ engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'}
+ peerDependencies:
+ chokidar: ^3.5.2
+ peerDependenciesMeta:
+ chokidar:
+ optional: true
+
+ '@angular-devkit/[email protected]':
+ resolution: {integrity: sha512-kcOMqp+PHAKkqRad7Zd7PbpqJ0LqLaNZdY1+k66lLWmkEBozgq8v4ASn/puPWf9Bo0HpCiK+EzLf0VHE8Z/y6Q==}
+ engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'}
+ hasBin: true
+
+ '@angular-devkit/[email protected]':
+ resolution: {integrity: sha512-I5wviiIqiFwar9Pdk30Lujk8FczEEc18i22A5c6Z9lbmhPQdTroDnEQdsfXjy404wPe8H62s0I15o4pmMGfTYQ==}
+ engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-XvcZi1KWf88RVbF9wn8MN6tYFloU5qX8KjuF3E1PVBmJ9eypXfs4GRiJwLuTZL0iSnJUKn1BFPa5BPZZJyFzPg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-2caSP6fN9I7HOe6nqhtft7V4g7/V/gfDsC3Ag4W7kEzzvRGKqiv0pu0HogPiZ3KaVSoNDhUws6IJjDjpfmYIXw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-SRJ4jYmXRqV1/Xc+TIVG84WjHBXKlxO9sHQnA2Pf12QQEAp1LOh6kDzNHXcUnbH1QI0FDoPPVOt+vyUDucxpaw==}
+ engines: {node: '>=6.0.0'}
+ hasBin: true
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-1x3D2xEk2fRo3PAhwQwu5UubzgiVWSXTBfWpVd2Mx2AzRqJuDJCsgaDVZ7HB5iGzDW1Hl1sWN2mFyKjmR9uAog==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-rkOSPOw+AXbgtwUga3U4u8RpoK9FEFWBNAlTpcnkLFjL5CT+oyHNuUUC/xx6XefEJ16r38r8Bc/lfp6rYuHeJQ==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-L6mZmwFDK6Cjh1nRCLXpa6no13ZIioJDz7mdkzHv399pThrTa/k0nUlNaenOeh2kWu/iaOQYElEpKPUswUa9Vg==}
+ engines: {node: '>=6.9.0'}
+
+ '@balena/[email protected]':
+ resolution: {integrity: sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==}
+
+ resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
+
+ '@colors/[email protected]':
+ resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
+ engines: {node: '>=0.1.90'}
+
+ '@cspotcode/[email protected]':
+ resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
+ engines: {node: '>=12'}
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-LNUR8TY4ldfYi0mi/d4UNuHJ+3o8yLQH9r2Nt6i4qeg1i7xswfL3n/LDLRXvGjBYqeEYNlhlBQzbPwMX1qrU6A==}
+ engines: {node: '>= 10'}
+ cpu: [arm]
+ os: [android]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-tH5us0NYGoTNBHOUHVV7j9KfJ4DtFOeTLA3cM0XNoMtArNu2pmaaBMFJPqECzavfXkLc7x5Z22UPZYjoyHfvCA==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [android]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-QE5W1YRIfRayFrtrcK/wqEaxNaqLULPI0gZB4ArbFRd3d56IycvgBasDTHPre5qL2cXCO3VyPx+80XyHOaVkag==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-mAvv2sN8awNFsbvBzlFkZPbCNZ6GCWY5/YcIz7V5dPYw+bHHRbjnlkNTEZq5BsDxErVrMIGvz05PGgzuNvZvdQ==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [darwin]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-AWC44xL0X7BgKvrWEqfSqkT2tJA5kwSGrAGT+m0gt11wnTYySvQ6YpX0fTY9i3ppYGu4bEdXFjyK2uY1DTQMHA==}
+ engines: {node: '>= 10'}
+ cpu: [arm]
+ os: [linux]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-drj0ciiJgdP3xKXvNAt4W+FH4KKMs8vB5iKLJ3HcH07sNZj58Sx++2GxFRS1el3p+GFp9OoYA6dgouJsGEqt0Q==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [linux]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-FzknI+st8eA8YQSdEJU9ykcM0LZjjigBuynVF5/p7hiMm9OMP8aNhWbhZ8LKJpKbZrQsxSGS4g9Vnr6n6FiSdQ==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [linux]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-yubbEye+daDY/4vXnyASAxH88s256pPati1DfVoZpU1V0+KP0BZ1dByZOU1ktExurbPH3gZOWisAnBE9xon0Uw==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [linux]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-6CRAZzoy1dMLPC/tns2rTt1ZwPo0nL/jYBEIAsYTCWhfAnNnpoLKVh5Nm+fSU3OOwTTqU87UkGrFJhObD/wobQ==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [linux]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-nzotGiaiuiQW78EzsiwsHZXbxEt6DiMUFcDJ6dhiliomXxnlaPyBfZb6/FMBgRJOf6sknDt/5695OttNmbMYzg==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [win32]
+
+ '@css-inline/[email protected]':
+ resolution: {integrity: sha512-u4eku+hnPqqHIGq/ZUQcaP0TrCbYeLIYBaK7qClNRGZbnh8RC4gVxLEIo8Pceo1nOK9E5G4Lxzlw5KnXcvflfA==}
+ engines: {node: '>= 10'}
+
+ '@darabonba/[email protected]':
+ resolution: {integrity: sha512-sTMBt+nC4aUSDfHy+Hl/nWbrHXuNMsgr8qN5xb0/QrvBR2U6ckko/In1N88Pj8bqbsrV1TtpKRGZDHDhZ3UVpA==}
+
+ '@eslint-community/[email protected]':
+ resolution: {integrity: sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ peerDependencies:
+ eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
+
+ '@eslint-community/[email protected]':
+ resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}
+ engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
+
+ '@eslint/[email protected]':
+ resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+
+ '@eslint/[email protected]':
+ resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+
+ '@fastify/[email protected]':
+ resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-esd1jyNvRb2HVaQGq2Gg8Z0kbQPXzV9Tq5Z14KNIov6KfFD6PTaRIO8UpcsYiTNzOqJpmyzWgVTrUwFV3UF4TQ==}
+ engines: {node: '>= 8'}
+
+ resolution: {integrity: sha512-nwc2iesjyc9hkuzcrMCBXQRn653XuAUKorfWM8PZyJawiy1QzLj4vahwzaI25+pfpwOLvMzbJ0uKpWLDNmo16w==}
+ engines: {node: '>= 8'}
+
+ resolution: {integrity: sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==}
+ deprecated: Moved to 'npm install @sideway/address'
+
+ resolution: {integrity: sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A==}
+ deprecated: Moved to 'npm install @sideway/formula'
+
+ resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==}
+
+ resolution: {integrity: sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg==}
+ deprecated: Switch to 'npm install joi'
+
+ resolution: {integrity: sha512-EKQmr16tM8s16vTT3cA5L0kZZcTMU5DUOZTuvpnY738m+jyP3JIUj+Mm1xc1rsLkGBQ/gVnfKYPwOmPg1tUR4Q==}
+
+ resolution: {integrity: sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==}
+
+ '@humanwhocodes/[email protected]':
+ resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==}
+ engines: {node: '>=10.10.0'}
+ deprecated: Use @eslint/config-array instead
+
+ '@humanwhocodes/[email protected]':
+ resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
+ engines: {node: '>=12.22'}
+
+ '@humanwhocodes/[email protected]':
+ resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==}
+ deprecated: Use @eslint/object-schema instead
+
+ '@ioredis/[email protected]':
+ resolution: {integrity: sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==}
+
+ '@isaacs/[email protected]':
+ resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
+ engines: {node: '>=12'}
+
+ '@istanbuljs/[email protected]':
+ resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==}
+ engines: {node: '>=8'}
+
+ '@istanbuljs/[email protected]':
+ resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ peerDependencies:
+ node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
+ peerDependenciesMeta:
+ node-notifier:
+ optional: true
+
+ resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ peerDependencies:
+ node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
+ peerDependenciesMeta:
+ node-notifier:
+ optional: true
+
+ resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==}
+ engines: {node: '>=6.0.0'}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
+ engines: {node: '>=6.0.0'}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==}
+ engines: {node: '>=6.0.0'}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==}
+
+ '@ljharb/[email protected]':
+ resolution: {integrity: sha512-/gKJun8NNiWGZJkGzI/Ragc53cOdcLNdzjLaIa+GEjguQs0ulsurx8WN0jijdK9yPqDvziX995sMRLyLt1uZMQ==}
+ engines: {node: '>= 0.4'}
+
+ '@lukeed/[email protected]':
+ resolution: {integrity: sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==}
+ engines: {node: '>=8'}
+
+ '@microsoft/[email protected]':
+ resolution: {integrity: sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw==}
+
+ '@mongodb-js/[email protected]':
+ resolution: {integrity: sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==}
+
+ '@msgpackr-extract/[email protected]':
+ resolution: {integrity: sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw==}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@msgpackr-extract/[email protected]':
+ resolution: {integrity: sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw==}
+ cpu: [x64]
+ os: [darwin]
+
+ '@msgpackr-extract/[email protected]':
+ resolution: {integrity: sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg==}
+ cpu: [arm64]
+ os: [linux]
+
+ '@msgpackr-extract/[email protected]':
+ resolution: {integrity: sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw==}
+ cpu: [arm]
+ os: [linux]
+
+ '@msgpackr-extract/[email protected]':
+ resolution: {integrity: sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg==}
+ cpu: [x64]
+ os: [linux]
+
+ '@msgpackr-extract/[email protected]':
+ resolution: {integrity: sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ==}
+ cpu: [x64]
+ os: [win32]
+
+ '@nestjs-modules/[email protected]':
+ resolution: {integrity: sha512-+z4mADQasg0H1ZaGu4zZTuKv2pu+XdErqx99PLFPzCDNTN/q9U59WPgkxVaHnsvKHNopLj5Xap7G4ZpptduoYw==}
+ peerDependencies:
+ '@nestjs/common': '>=7.0.9'
+ '@nestjs/core': '>=7.0.9'
+ nodemailer: '>=6.4.6'
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-RZ/63c1tMxGLqyG3iOCVt7A72oy4x1eM6QEhd4KzCYpaVWW0igq0WSREeRoEZhIxRcZfDfIIkvsOMiM7yfVGZQ==}
+ peerDependencies:
+ '@nestjs/common': ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0
+ axios: ^1.3.1
+ rxjs: ^6.0.0 || ^7.0.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-dFlttJvBqIFD6M8JVFbkrR4Feb39OTAJPJpFVILU50NOJCM4qziRw3dSNG84Q3v+7/M6xUGMFdZRRGvBBKxoSA==}
+ peerDependencies:
+ '@nestjs/common': ^10.0.0 || ^11.0.0
+ '@nestjs/core': ^10.0.0 || ^11.0.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-Lq6lGpKkETsm0RDcUktlzsthFoE3A5QTMp2FwPi1eztKqKD6/90KS1TcnC9CJFzjpUaYnQzIMrlNs55e+/wsHA==}
+ peerDependencies:
+ '@nestjs/common': ^10.0.0 || ^11.0.0
+ '@nestjs/core': ^10.0.0 || ^11.0.0
+ bullmq: ^3.0.0 || ^4.0.0 || ^5.0.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-s8qYd97bggqeK7Op3iD49X2MpFtW4LVNLAwXFkfbRxKME6IYT7X0muNTJ2+QfI8hpbNx9isWkrLWIp+g5FOhiA==}
+ engines: {node: '>= 16.14'}
+ hasBin: true
+ peerDependencies:
+ '@swc/cli': ^0.1.62 || ^0.3.0 || ^0.4.0 || ^0.5.0
+ '@swc/core': ^1.3.62
+ peerDependenciesMeta:
+ '@swc/cli':
+ optional: true
+ '@swc/core':
+ optional: true
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-vaLg1ZgwhG29BuLDxPA9OAcIlgqzp9/N8iG0wGapyUNTf4IY4O6zAHgN6QalwLhFxq7nOI021vdRojR1oF3bqg==}
+ peerDependencies:
+ class-transformer: '*'
+ class-validator: '*'
+ reflect-metadata: ^0.1.12 || ^0.2.0
+ rxjs: ^7.1.0
+ peerDependenciesMeta:
+ class-transformer:
+ optional: true
+ class-validator:
+ optional: true
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-pdGTp8m9d0ZCrjTpjkUbZx6gyf2IKf+7zlkrPNMsJzYZ4bFRRTpXrnj+556/5uiI6AfL5mMrJc2u7dB6bvM+VA==}
+ peerDependencies:
+ '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0
+ rxjs: ^7.1.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-UBejmdiYwaH6fTsz2QFBlC1cJHM+3UDeLZN+CiP9I1fRv2KlBZsmozGLbV5eS1JAVWJB4T5N5yQ0gjN8ZvcS2w==}
+ peerDependencies:
+ '@nestjs/common': ^10.0.0
+ '@nestjs/microservices': ^10.0.0
+ '@nestjs/platform-express': ^10.0.0
+ '@nestjs/websockets': ^10.0.0
+ reflect-metadata: ^0.1.12 || ^0.2.0
+ rxjs: ^7.1.0
+ peerDependenciesMeta:
+ '@nestjs/microservices':
+ optional: true
+ '@nestjs/platform-express':
+ optional: true
+ '@nestjs/websockets':
+ optional: true
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-6L6fBOZTyfFlL7Ih/JDdqlCzZeCW0RjCX28wnzGyg/ncv5F/EOeT1dfopQr1loBRQ3LTgu8OWM7n4zLN4xigsg==}
+ peerDependencies:
+ '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0
+ '@nestjs/core': ^8.0.0 || ^9.0.0 || ^10.0.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-x8cG90SURkEiLOehNaN2aRlotxT0KZESUliOPKKnjWiyJOcWurkF3w345WOX0P4MgFzUjGoZ1Sy0aZnxeihT0g==}
+ peerDependencies:
+ '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-84ze+CPfp1OWdpRi1/lOu59hOhTz38eVzJvRKrg9ykRFwDz+XleKfMsG0gUqNZYFa6v53XYzeD+xItt8uDW7NQ==}
+ peerDependencies:
+ '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0
+ class-transformer: ^0.4.0 || ^0.5.0
+ class-validator: ^0.13.0 || ^0.14.0
+ reflect-metadata: ^0.1.12 || ^0.2.0
+ peerDependenciesMeta:
+ class-transformer:
+ optional: true
+ class-validator:
+ optional: true
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-1ExAnZUfh2QffEaGjqYGgVPy/sYBQCVLCLqVgkcClKx/BCd0QNgND8MB70lwyobp3nm/+nbGQqBpu9F3/hgOCw==}
+ peerDependencies:
+ '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0
+ '@nestjs/core': ^8.0.0 || ^9.0.0 || ^10.0.0
+ mongoose: ^6.0.2 || ^7.0.0 || ^8.0.0
+ rxjs: ^7.0.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-63ZZPkXHjoDyO7ahGOVcybZCRa7/Scp6mObQKjcX/fTEq1YJeU75ELvMsuQgc8U2opMGOBD7GVuc4DV0oeDHoA==}
+ peerDependencies:
+ '@nestjs/common': ^10.0.0
+ '@nestjs/core': ^10.0.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-hCTQ1lNjIA5EHxeu8VvQu2Ed2DBLS1GSC6uKPYlBiQe6LL9a7zfE9iVSK+zuK8E2odsApteEBmfAQchc8Hx0Gg==}
+ peerDependencies:
+ '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0
+ '@nestjs/core': ^8.0.0 || ^9.0.0 || ^10.0.0
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-4e8gxaCk7DhBxVUly2PjYL4xC2ifDFexCqq1/u4TtivLGXotVk0wHdYuPYe1tHTHuR1lsOkRbfOCpkdTnigLVg==}
+ peerDependencies:
+ typescript: '>=4.8.2'
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-5Mda7H1DKnhKtlsb0C7PYshcvILv8UFyUotHzxmWh0G65Z21R3LZH/J8wmpnlzL4bmXIfr42YwbEwRxgzpJ5sQ==}
+ peerDependencies:
+ '@fastify/static': ^6.0.0 || ^7.0.0
+ '@nestjs/common': ^9.0.0 || ^10.0.0
+ '@nestjs/core': ^9.0.0 || ^10.0.0
+ class-transformer: '*'
+ class-validator: '*'
+ reflect-metadata: ^0.1.12 || ^0.2.0
+ peerDependenciesMeta:
+ '@fastify/static':
+ optional: true
+ class-transformer:
+ optional: true
+ class-validator:
+ optional: true
+
+ '@nestjs/[email protected]':
+ resolution: {integrity: sha512-eGlWESkACMKti+iZk1hs6FUY/UqObmMaa8HAN9JLnaYkoLf1Jeh+EuHlGnfqo/Rq77oznNLIyaA3PFjrFDlNUg==}
+ peerDependencies:
+ '@nestjs/common': ^10.0.0
+ '@nestjs/core': ^10.0.0
+ '@nestjs/microservices': ^10.0.0
+ '@nestjs/platform-express': ^10.0.0
+ peerDependenciesMeta:
+ '@nestjs/microservices':
+ optional: true
+ '@nestjs/platform-express':
+ optional: true
+
+ '@nodelib/[email protected]':
+ resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
+ engines: {node: '>= 8'}
+
+ '@nodelib/[email protected]':
+ resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==}
+ engines: {node: '>= 8'}
+
+ '@nodelib/[email protected]':
+ resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
+ engines: {node: '>= 8'}
+
+ '@nuxtjs/[email protected]':
+ resolution: {integrity: sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==}
+ engines: {node: '>=8.0.0', npm: '>=5.0.0'}
+ hasBin: true
+
+ '@one-ini/[email protected]':
+ resolution: {integrity: sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==}
+
+ '@pkgjs/[email protected]':
+ resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==}
+ engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg==}
+ peerDependencies:
+ '@redis/client': ^1.0.0
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-/KCsg3xSlR+nCK8/8ZYSknYxvXHwubJrU82F3Lm1Fp6789VQ0/3RJKfsmRXjqfaTA++23CvC3hqmqe/2GEt6Kw==}
+ engines: {node: '>=14'}
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-FEMTcTHZozZciLRl6GiiIB4zGm5z5F3F6a6FZCyrfxdKOhFlGkiAqlexWMBzCi4DcRoyiOsuLfW+cjlGWyExOw==}
+ peerDependencies:
+ '@redis/client': ^1.0.0
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-6UyXfjVaTBTJtKNG4/9Z8PSpKE6XgSyEb8iwaqDcy+uKrd/DGYHTWkUdnQDyzm727V7p21WUMhsqz5oy65kPcQ==}
+ peerDependencies:
+ '@redis/client': ^1.0.0
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-tYoDBbtqOVigEDMAcTGsRlMycIIjwMCgD8eR2t0NANeQmgK/lvxNAvYyb6bZDD4frHRhIHkJu2TBRvB0ERkOmw==}
+ peerDependencies:
+ '@redis/client': ^1.0.0
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-c1Q99M5ljsIuc4YdaCwfUEXsofakb9c8+Zse2qxTadu8TalLXuAESzLvFAvNVbkmSlvlzIQOLpBCmWI9wTOt+g==}
+ peerDependencies:
+ '@redis/client': ^1.0.0
+
+ '@scarf/[email protected]':
+ resolution: {integrity: sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ==}
+
+ '@selderee/[email protected]':
+ resolution: {integrity: sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==}
+
+ '@sinclair/[email protected]':
+ resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
+
+ '@sinonjs/[email protected]':
+ resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==}
+
+ '@sinonjs/[email protected]':
+ resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==}
+
+ '@testcontainers/[email protected]':
+ resolution: {integrity: sha512-ZYD2uv/iRrBD4mFxiLjtaRJ0d2AmpTMv6p94WoVkTsXZ4mX7Q81SPdS58NDh8ucgshVc1adJ9kEsh7tgDbIGrQ==}
+
+ '@testcontainers/[email protected]':
+ resolution: {integrity: sha512-+NJO1tfMXvUQiMfa9Y8qqwaFP6yV0BBg2cNA+iNz+Zt6kzTyxMapBiKCL8pWsCqWolz2mqZwuDtfcHBxdoCzAw==}
+
+ '@tsconfig/[email protected]':
+ resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==}
+
+ '@tsconfig/[email protected]':
+ resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==}
+
+ '@tsconfig/[email protected]':
+ resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==}
+
+ '@tsconfig/[email protected]':
+ resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-yKpAGEuKRSS8wwx0joknWxsmLha78wNMe9R2S3UNsVOkZded8UqOrV8KoeDXoXsjndxwyF3eIhyClGbO1SEhEg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-mH9SuIb8NuTDsMus5epcbTzSbEo52fKLBMo0zapzYIAIyfDqoIFn7L3trekHLKC8qmxGV++pPUP4YqQ9n5v2Zg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-nv+GSx77ZtXiJzwKdsASqi+YQ5Z7vwHsTP0JY2SiQgjGckkBRKZnk8nIM+7oUZ1VCtuTz0+By4qVR7fqzp/Dfg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-VRLSGzik+Unrup6BsouBeHsf4d1hOEgYWTm/7Nmw1sXoN1+tRly/Gy/po3yeahnP4jfnQWWAhQAqcNfH7ngOkA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-TifLZlFudklWlMBfhubvgqTXRzLDI5pCbGa4P8a3wPyUQSW+1xQ5eDsreP9DWHX3tjq1ke96uYG/nwundroWcA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-qu8dUksU8yXX18qMTFINkM4uoz7WQYC5F14lcWeSNmWbulaGG0KG19yeZwpx75b9RJXr8WI/FRHH0LyQTU9JbA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-vyi1vzWgMzFMwZY7GSZYX0GU0dmtC8vLHwpgk+NWmwbwRSrlieVyJ9sn5elodwUfklJM7yGl0zQeet1brKTWaQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-pQ2hoqvXiJt2FP9WQVLPRO+AmiIm/ZYkavPlIQnx282u4ZrVdztx0pkh3jjpQt0Kz+YI0YhSG264y08UJKoUQg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-evXpcgtZm8FY4jqBSN8+DmOTcVkkvTmAayeo4Wf3m1xAruyVGzGuDh/Fb/WWX2yLItUiho42ozyJjB0dw//Tkw==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-vo/wmBgMIiEA23A/knMfn/cf37VnuF52nZh5ZoW0GWt4e4sxNquibrMRJ7UQsA06+MBx9r/H1jsI9grYjQCQlw==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-I9CCaIp6DTldEg7vyUTZi8+9Vo0hi1/T8gv3C89yk1rSAAzoKQ8H8ki/jBYJSFoH/BisgLP8tkZMlQ91CIquww==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-Sy8tpEmCce4Tq0oSOYdfqaBpA3hDM8SoxoFh5vzFsu2oL+znzGz8oVWW7xb4K920yYMUY+PIG31qZnFMfPWNCg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-lbLLlXxdCZOSJMCInKH2+9V/77ET2J6NPQHpFI0kda61Dd1KglJs+fPQBchizmzYSOJBgdTajhPqBO1xxLywvg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-9JTQgVBWSgq6mAen6PVnrAmty1lqgCMvpfN+1Ck5WRUsyMYPa6qd50/vMJ0y1zkGpOEgLzm8m8Dx/Y5vRouLaA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-pTVjI73witn+9ILmoJdajHGW2jkSaOzhiFYF1Rd3EQ94kymLqB9PjD9ISg7WaALC7+dCHT0FGe9T2LktLq/3GQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-137ypx2lk/wTQbW6An6safu9hXmajAifU/s7szAHLN/FeIm5w7yR0Wkl9fdJMRSHwOn4HLAI0DaB2TOORuhPDg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-tRJYQN/uAD8Br9K+pqqzJNd/htIxQaFy6ppfNEWbwsAoWRK3oAxzROCGA39GHT+E3BHLyuBnSB7XKsnJ0s4w2g==}
+ deprecated: This is a stub types definition for xml-js (https://github.com/nashwaan/xml-js). xml-js provides its own type definitions, so you don't need @types/xml-js installed!
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-4YnrRemBShWRO2QjvUin8ESA41rH+9nQGLUGZV/1IDhi3SL9OhdpNC/MrulTWuptXKwhx/aDxE7toV0f/ypIXQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==}
+
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-tJzcVyvvb9h/PB96g30MpxACd9IrunT7GF9wfA9/0TJ1LxGOJx1TdPzSbBBnNED7K9Ka8ybJsnEpiXPktolTLg==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ peerDependencies:
+ '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0
+ eslint: ^8.57.0 || ^9.0.0
+ typescript: '>=4.8.4 <5.8.0'
+
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-67gbfv8rAwawjYx3fYArwldTQKoYfezNUT4D5ioWetr/xCrxXxvleo3uuiFuKfejipvq+og7mjz3b0G2bVyUCw==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ peerDependencies:
+ eslint: ^8.57.0 || ^9.0.0
+ typescript: '>=4.8.4 <5.8.0'
+
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-60L9KIuN/xgmsINzonOcMDSB8p82h95hoBfSBtXuO4jlR1R9L1xSkmVZKgCPVfavDlXihh4ARNjXhh1gGnLC7Q==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-Rp7k9lhDKBMRJB/nM9Ksp1zs4796wVNyihG9/TU9R6KCJDNkQbc2EOKjrBtLYh3396ZdpXLtr/MkaSEmNMtykw==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ peerDependencies:
+ eslint: ^8.57.0 || ^9.0.0
+ typescript: '>=4.8.4 <5.8.0'
+
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-JBVHMLj7B1K1v1051ZaMMgLW4Q/jre5qGK0Ew6UgXz1Rqh+/xPzV1aW581OM00X6iOfyr1be+QyW8LOUf19BbA==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-jk/TZwSMJlxlNnqhy0Eod1PNEvCkpY6MXOXE/WLlblZ6ibb32i2We4uByoKPv1d0OD2xebDv4hbs3fm11SMw8Q==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ peerDependencies:
+ typescript: '>=4.8.4 <5.8.0'
+
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-IxG5gLO0Ne+KaUc8iW1A+XuKLd63o4wlbI1Zp692n1xojCl/THvgIKXJXBZixTh5dd5+yTJ/VXH7GJaaw21qXA==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ peerDependencies:
+ eslint: ^8.57.0 || ^9.0.0
+ typescript: '>=4.8.4 <5.8.0'
+
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-fzmjU8CHK853V/avYZAvuVut3ZTfwN5YtMaoi+X9Y9MA9keaWNHC3zEQ9zvyX/7Hj+5JkNyK1l7TOR2hevHB6Q==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
+ '@ungap/[email protected]':
+ resolution: {integrity: sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==}
+
+ '@webassemblyjs/[email protected]':
+ resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==}
+
+ resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==}
+
+ resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==}
+
+ resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==}
+ engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
+ engines: {node: '>=6.5'}
+
+ resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
+ peerDependencies:
+ acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
+
+ resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==}
+ engines: {node: '>=0.4.0'}
+
+ resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==}
+ engines: {node: '>=0.4.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==}
+ engines: {node: '>=0.4.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==}
+ engines: {node: '>= 10.0.0'}
+
+ resolution: {integrity: sha512-0g9A1S3ZomFIGDTzZ0t6xmv4AuokBvBmpes8htiyHpH7N4xDmvSQL6UxL/Zcs2ypRb3VwgCscaD8Q3zEawKYhw==}
+
+ resolution: {integrity: sha512-7+Wlx3BImrK0HiG6y3lU4xX7SpBPSSu8T9iguPMlaueRFxjbYwAQrp9lqZUuFikqKbd/en8lVREILvP2J80uJA==}
+
+ resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
+ engines: {node: '>= 6.0.0'}
+
+ resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==}
+ engines: {node: '>= 14'}
+
+ resolution: {integrity: sha512-yqXL+k5rr8+ZRpOAntkaaRgWgE5o8ESAj5DyRmVTCSoZxXmqemb9Dd7T4i5UzwuERdLAJUy6XzR9zFVuf0kzkw==}
+ engines: {node: '>= 4.0.0'}
+
+ resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==}
+ engines: {node: '>= 8.0.0'}
+
+ resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
+ peerDependencies:
+ ajv: ^8.0.0
+ peerDependenciesMeta:
+ ajv:
+ optional: true
+
+ resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==}
+ peerDependencies:
+ ajv: ^6.9.1
+
+ resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==}
+ peerDependencies:
+ ajv: ^8.8.2
+
+ resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
+
+ resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==}
+
+ resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==}
+
+ resolution: {integrity: sha512-XppPf2S42nO2WhvKzlwzlfcApcXHzjlod30pKmcWjRgLOtqoe5DMuqdiYoM6AgyXksc6A6pV4v1L/WW217e57w==}
+ engines: {node: '>=0.8.0'}
+
+ resolution: {integrity: sha512-X8CHo+wsjCBvDaEvuibFOi3SZxiCBZSRUURrXH0upoVwu3SuW3e+PTVK7xw+uN6EyTcAESqrngrQimhp8iBzsQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
+
+ resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
+ engines: {node: '>= 8'}
+
+ resolution: {integrity: sha512-KLy/ugo33KZA7nugtQ7O0E1c8kQ52N3IvD/XgIh4w/Nr28ypfkwDfA67F1ev4N1m5D+BOk1+b2dEJDfpj/VvZg==}
+ engines: {node: '>=0.2.6'}
+
+ resolution: {integrity: sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==}
+
+ resolution: {integrity: sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==}
+ engines: {node: '>= 14'}
+
+ resolution: {integrity: sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==}
+ engines: {node: '>= 14'}
+
+ resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
+
+ resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
+
+ resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
+
+ resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==}
+
+ resolution: {integrity: sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==}
+
+ resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==}
+
+ resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==}
+
+ resolution: {integrity: sha512-5oJg84os6NMQNl27T9LnZkvvqzvAnHu03ShCnoj6bsJwS7L8AO4lf+C/XjK/nvzEqQB744moC6V128RucQd1jA==}
+
+ resolution: {integrity: sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ==}
+
+ resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==}
+
+ resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
+
+ resolution: {integrity: sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==}
+
+ resolution: {integrity: sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg==}
+
+ resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ peerDependencies:
+ '@babel/core': ^7.8.0
+
+ resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==}
+ peerDependencies:
+ '@babel/core': ^7.0.0
+
+ resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ peerDependencies:
+ '@babel/core': ^7.0.0
+
+ resolution: {integrity: sha512-GAwkz0AihzY5bkwIY5QDR+LvsRQgB/B+1foMPvi0FZPMl5fjD7ICiznUiBdLYMH1QYe6vqu4gWYytZOccLouFw==}
+ engines: {node: '>= 10.0.0'}
+
+ resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
+
+ resolution: {integrity: sha512-+gFfDkR8pj4/TrWCGUGWmJIkBwuxPS5F+a5yWjOHQt2hHvNZd5YLzadjmDUtFmMM4y429bnKLa8bYBMHcYdnQA==}
+
+ resolution: {integrity: sha512-ilQs4fm/l9eMfWY2dY0WCIUplSUp7U0CT1vrqMg1MUdeZl4fypu5UP0XcDBK5WBQPJAKP1b7XEodISmekH/CEg==}
+ engines: {bare: '>=1.7.0'}
+
+ resolution: {integrity: sha512-9Ous7UlnKbe3fMi7Y+qh0DwAup6A1JkYgPnjvMDNOlmnxNRQvQ/7Nst+OnUQKzk0iAT0m9BisbDVp9gCv8+ETA==}
+ engines: {bare: '>=1.6.0'}
+
+ resolution: {integrity: sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==}
+
+ resolution: {integrity: sha512-G6i3A74FjNq4nVrrSTUz5h3vgXzBJnjmWAVlBWaZETkgu+LgKd7AiyOml3EDJY1AHlIbBHKDXE+TUT53Ff8OaA==}
+ peerDependencies:
+ bare-buffer: '*'
+ bare-events: '*'
+ peerDependenciesMeta:
+ bare-buffer:
+ optional: true
+ bare-events:
+ optional: true
+
+ resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
+
+ resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==}
+
+ resolution: {integrity: sha512-eJzYkFYy9L4JzXsbymsFn3p54D+llV27oTQ+ziJG7WFRheJcNZilgVXMG0LoZtlQSKBsJdWtLFqOD0u+U0jZKA==}
+
+ resolution: {integrity: sha512-EM7aMFTXbptt/wZdMlBv2t8IViwQL+h6SLHosp8Yf0dqJMTnY6iL32opnAB6kAdL0SZPuvcAzFr31o0c/R3/RA==}
+
+ resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
+
+ resolution: {integrity: sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==}
+ engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}
+
+ resolution: {integrity: sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
+
+ resolution: {integrity: sha512-9IdMmj2KjigRq6oWhmwv1W36pDuA4STQZ8q6YO9um+x07xgYNCD3Oou+WP/3L1HNz7iqythGet3/p4wvc8AAwQ==}
+
+ resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==}
+
+ resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==}
+
+ resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==}
+ engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
+ hasBin: true
+
+ resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==}
+
+ resolution: {integrity: sha512-P92xmHDQjSKPLHqFxefqMxASNq/aWJMEZugpCjf+AF/pgcUpMMQCg7t7+ewko0/u8AapvF3luf/FoehddEK+sA==}
+ engines: {node: '>=16.20.1'}
+
+ resolution: {integrity: sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==}
+ engines: {node: '>=8.0.0'}
+
+ resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==}
+
+ resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
+
+ resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
+
+ resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
+
+ resolution: {integrity: sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==}
+ engines: {node: '>=10.0.0'}
+
+ resolution: {integrity: sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==}
+
+ resolution: {integrity: sha512-fK/dKIv8ymyys4K+zeNEPA+yuYWzRPmBWUmwIMz8DvYekadl8VG19yUx94Na0n0cLAi+spdn3a/+ufkYK7CBUg==}
+
+ resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}
+ engines: {node: '>=10.16.0'}
+
+ resolution: {integrity: sha512-s6webAy+R4SR8XVuJWt2V2rGvhnrhxN+9S15GNuTK3wKPOXFF6RNc+8ug2XhH+2s4f+uudG4kUVYmYOQWL2g0Q==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-+MbKztAYHXPr1jNTSKQF52VpcFjwY5RkR7fxksV8Doo4KAYc5Fl4UJRgthBbTmEx8C54DqahhbLJkDwjI3PI/w==}
+
+ resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-A95VKan0kdtrsnMubMKxEKUKImOPSuCpYgxSQBo036P5YYgVIcOYJEgt/txJWqObiRQeISNCfef9nvlQ0vbV7A==}
+
+ resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==}
+ engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
+
+ resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-+UqJQjFEFaTAs3bNsF2j2kEN1baG/zghZbdqoYEDxGZtJo9LBzl1A+m0D4n3qKx8N2FNv8/Xp6yV9mQmBuptaw==}
+
+ resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==}
+
+ resolution: {integrity: sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==}
+
+ resolution: {integrity: sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==}
+ engines: {node: '>=18.17'}
+
+ resolution: {integrity: sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
+ engines: {node: '>= 8.10.0'}
+
+ resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}
+
+ resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==}
+ engines: {node: '>=6.0'}
+
+ resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==}
+
+ resolution: {integrity: sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==}
+
+ resolution: {integrity: sha512-2VEG9JICxIqTpoK1eMzZqaV+u/EiwEJkMGzTrZf6sU/fwsnOITVgYJ8yojSy6CaXtO9V0Cc6ZQZ8h8m4UBuLwQ==}
+
+ resolution: {integrity: sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==}
+ engines: {node: '>= 4.0'}
+
+ resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==}
+ engines: {node: 10.* || >= 12.*}
+
+ resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==}
+ engines: {node: '>= 10'}
+
+ resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==}
+ engines: {node: '>= 12'}
+
+ resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==}
+ engines: {node: '>=0.8'}
+
+ resolution: {integrity: sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==}
+ engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
+
+ resolution: {integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==}
+
+ resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
+ engines: {node: '>=7.0.0'}
+
+ resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
+
+ resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
+
+ resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-bKw/r35jR3HGt5PEPm1ljsQQGyCrR8sFGNiN5L+ykDHdpO8Smxkrkla9Yi6NkQyUrb8V54PGhfMs6NrIwtxtdw==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==}
+
+ resolution: {integrity: sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==}
+ engines: {node: '>= 14'}
+
+ resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
+
+ resolution: {integrity: sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==}
+ engines: {'0': node >= 0.8}
+
+ resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==}
+
+ resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==}
+
+ resolution: {integrity: sha512-vCrqcSIq4//Gx74TXXCGnHpulY1dskqLTFGDmhrGxzeXL8lF8kvXv6mpNWlJj1uD4DW23D4ljAqbY4RRaaUZIw==}
+
+ resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
+
+ resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==}
+
+ resolution: {integrity: sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==}
+
+ resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==}
+ engines: {node: '>=6.6.0'}
+
+ resolution: {integrity: sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==}
+
+ resolution: {integrity: sha512-3DdaFaU/Zf1AnpLiFDeNCD4TOWe3Zl2RZaTzUvWiIk5ERzcCodOE20Vqq4fzCbNoHURFHT4/us/Lfq+S2zyY4w==}
+
+ resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
+
+ resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}
+ engines: {node: '>= 0.10'}
+
+ resolution: {integrity: sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==}
+ engines: {node: '>= 0.4.0'}
+
+ resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==}
+ engines: {node: '>=14'}
+ peerDependencies:
+ typescript: '>=4.9.5'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ resolution: {integrity: sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==}
+ engines: {node: '>=10.0.0'}
+
+ resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==}
+ engines: {node: '>=0.8'}
+ hasBin: true
+
+ resolution: {integrity: sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==}
+ engines: {node: '>= 14'}
+
+ resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ hasBin: true
+
+ resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==}
+
+ resolution: {integrity: sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==}
+ engines: {node: '>=12.0.0'}
+
+ resolution: {integrity: sha512-w2n5l49GMmmkBFEsH9FIDhjZ1n1QgTMOCMGuQtOXs5veNiosZmso6bQGuqOJSYAXXrG84WQFVneNk+Yt0Ua9iw==}
+
+ resolution: {integrity: sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==}
+ engines: {node: '>=4.8'}
+
+ resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
+ engines: {node: '>= 8'}
+
+ resolution: {integrity: sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==}
+
+ resolution: {integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-GODcnWq3YGoTnygPfi02ygEiRxqUxpJwuRHjdhJYuxpcZmDq4rjBiXYmbCCzStxo176ixfLT6i4NPwQooRySnw==}
+
+ resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
+ peerDependencies:
+ supports-color: '*'
+ peerDependenciesMeta:
+ supports-color:
+ optional: true
+
+ resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==}
+ engines: {node: '>=6.0'}
+ peerDependencies:
+ supports-color: '*'
+ peerDependenciesMeta:
+ supports-color:
+ optional: true
+
+ resolution: {integrity: sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==}
+ peerDependencies:
+ babel-plugin-macros: ^3.1.0
+ peerDependenciesMeta:
+ babel-plugin-macros:
+ optional: true
+
+ resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
+ engines: {node: '>=4.0.0'}
+
+ resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
+
+ resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-bDF7bg6OSNcSwFWPu4zYKpVkJZQYVrAANMYB8bc9Szem1D0yKdm4sa/rOCs2aC9+2GMqQ7KnwtZRvDhmLF0dXw==}
+ engines: {node: '>= 0.10.0'}
+
+ resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==}
+
+ resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
+ engines: {node: '>=0.4.0'}
+
+ resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==}
+ engines: {node: '>=0.10'}
+
+ resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==}
+ engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}
+
+ resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==}
+
+ resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==}
+
+ resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
+ engines: {node: '>=0.3.1'}
+
+ resolution: {integrity: sha512-glXVh42vz40yZb9Cq2oMOt70FIoWiv+vxNvdKdU8CwjLad25qHM3trLxhl9bVjdr6WaslIXhWpn0NO8T/67Qjg==}
+ engines: {node: '>= 8.0.0'}
+
+ resolution: {integrity: sha512-TdmtlAcdqy1NU+j7zlkDdMnCL878zriLaBmoD9quOoq1ySSSGv03l0hXK5CvIFZlIfFI/hizqdQuW+Num7xuhw==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-plizRs/Vf15H+GCVxq2EUvyPK7ei9b/cVesHvjnX4xaXjM9spHe2Ytq0BitndFgvTJ3E3NljPNUEl7BAN43iZw==}
+ engines: {node: '>= 6.0.0'}
+
+ resolution: {integrity: sha512-f0ReSURdM3pcKPNS30mxOHSbaFLcknGmQjwSfmbcdOw1XWKXVhukM3NJHhr7NpY9BIyyWQb0EBo3KQvvuU5egQ==}
+ engines: {node: '>= 8.0'}
+
+ resolution: {integrity: sha512-/0YNa3ZDNeLr/tSckmD69+Gq+qVNhvKfAHNeZJBnp7EOP6RGKV8ORrJHkUn20So5wU+xxT7+1n5u8PjHbfjbSA==}
+ engines: {node: '>= 8.0'}
+
+ resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}
+ engines: {node: '>=6.0.0'}
+
+ resolution: {integrity: sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ==}
+
+ resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==}
+
+ resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==}
+
+ resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==}
+
+ resolution: {integrity: sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA==}
+ engines: {node: '>= 4'}
+
+ resolution: {integrity: sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==}
+ engines: {node: '>= 4'}
+
+ resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}
+ engines: {node: '>= 4'}
+
+ resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==}
+
+ resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}
+
+ resolution: {integrity: sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
+
+ resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==}
+
+ resolution: {integrity: sha512-L9Qe08KWTlqYMVvMcTIvMAdl1cDUubzRNYL+WfA4bLDMHe4nemKkpmYzkznE1FwLKu0EEmy6obgQKzMJrg4x9Q==}
+ engines: {node: '>=14'}
+ hasBin: true
+
+ resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
+
+ resolution: {integrity: sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==}
+ engines: {node: '>=0.10.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-LTrKpW0AqIuHwmlVNV+cjFYTnXtM9K37OGhpe0ZI10ScPSxqVSryZHIY3WnCS5NSYbBODRTZyhRMS2h5FAEqAw==}
+
+ resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
+
+ resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==}
+
+ resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-EuJWwlHPZ1LbADuKTClvHtwbaFn4rOD+dRAbWysqEOXRc2Uui0hJInNJrsdH0c+OhJA4nrCBdSkW4DD5YxAo6A==}
+ engines: {node: '>=8.10.0'}
+
+ resolution: {integrity: sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==}
+
+ resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
+
+ resolution: {integrity: sha512-OclLMSug+k2A0JKuf494im25ANRBVW8qsjmwbgX7lQ8P82H21PQ1PWkoYwb9y5yMBS69BPlwtzdIFClo3+7kOQ==}
+ engines: {node: '>= 0.11.14'}
+
+ resolution: {integrity: sha512-0/r0MySGYG8YqlayBZ6MuCfECmHFdJ5qyPh8s8wa5Hnm6SaFLSK1VYCbj+NKp090Nm1caZhD+QTnmxO7esYGyQ==}
+ engines: {node: '>=10.13.0'}
+
+ resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==}
+
+ resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
+ engines: {node: '>=0.12'}
+
+ resolution: {integrity: sha512-aKstq2TDOndCn4diEyp9Uq/Flu2i1GlLkc6XIDQSDMuaFE3OPW5OphLCyQ5SpSJZTb4reN+kTcYru5yIfXoRPw==}
+ engines: {node: '>=0.12'}
+
+ resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==}
+
+ resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==}
+
+ resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-w3PwNZJwRxlp47QGzhuEBldEqVHHhh8/tIPcl6ecf2Bou99cdAt0knihBV0Ecc7CGxYduXVBDheH1K2oADRlvw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==}
+
+ resolution: {integrity: sha512-4/hFwoYaC6TkpDn9A3pTC52zQPArFeXuIfhUtCGYdauTzXVP9H3BDr3oO/QzQehMpLDC7srvYgfwvImPFGfvBA==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==}
+ engines: {node: '>=0.8.0'}
+
+ resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==}
+ hasBin: true
+ peerDependencies:
+ eslint: '>=7.0.0'
+
+ resolution: {integrity: sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==}
+ engines: {node: ^14.18.0 || >=16.0.0}
+ peerDependencies:
+ '@types/eslint': '>=8.0.0'
+ eslint: '>=8.0.0'
+ eslint-config-prettier: '*'
+ prettier: '>=3.0.0'
+ peerDependenciesMeta:
+ '@types/eslint':
+ optional: true
+ eslint-config-prettier:
+ optional: true
+
+ resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==}
+ engines: {node: '>=8.0.0'}
+
+ resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+
+ resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+
+ resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
+ resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
+ hasBin: true
+
+ resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+
+ resolution: {integrity: sha512-S9VbPDU0adFErpDai3qDkjq8+G05ONtKzcyNrPKg/ZKa+tf879nX2KexNU95b31UoTJjRLInNBHHHjFPoCd7lQ==}
+ engines: {node: '>=0.4.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==}
+ engines: {node: '>=4'}
+ hasBin: true
+
+ resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==}
+ engines: {node: '>=0.10'}
+
+ resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
+ engines: {node: '>=4.0'}
+
+ resolution: {integrity: sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==}
+ engines: {node: '>=4.0'}
+
+ resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==}
+ engines: {node: '>=4.0'}
+
+ resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==}
+
+ resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}
+
+ resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
+ engines: {node: '>=0.8.x'}
+
+ resolution: {integrity: sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-a5mtTqEaZvBCL9A9aqkrtfz+3SMDhOVUnjafjo+s7A9Txkq+SVX2DLvSp1Zrv4uCXa3lMSK3viWnh9Gg07PBUA==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==}
+ engines: {node: '>= 0.10.0'}
+
+ resolution: {integrity: sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-0dHDIXC7y7LDmCh/lp1oYkmv73K25AMugQI07r8eFopkW6f7Ufn1q+ETMsJjnV9Am14SlElkqy3O92r6xEaxPw==}
+
+ resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
+
+ resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
+
+ resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==}
+
+ resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==}
+
+ resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==}
+ engines: {node: '>=8.6.0'}
+
+ resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
+
+ resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
+
+ resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==}
+
+ resolution: {integrity: sha512-5JnBCWpFlMo0a3ciDy/JckMzzv1U9coZrIhedq+HXxxUfDTAiS0LA8OKVao4G9BxmCVck/jtA5r3KAtRWEyD8Q==}
+
+ resolution: {integrity: sha512-Kqq/ewnRACQ20e0BlQ5KqHRYWRBp7yv+jttK4Yj2yY+2ldgCoxJkrP1NHUhjypsJ+eQXlGJ/jebM3wa60s1rbQ==}
+ hasBin: true
+
+ resolution: {integrity: sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==}
+
+ resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==}
+
+ resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
+ engines: {node: ^10.12.0 || >=12.0.0}
+
+ resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==}
+
+ resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-5SM1+H2CcuJ3gGEwTiVo/+nd/hYpNj9Ch3iMDOQ58ndY+VGQ2QdvaUTkd3otjZvYnd/8LF/HkJ5cx7PBq0orCQ==}
+ hasBin: true
+
+ resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==}
+ engines: {node: ^10.12.0 || >=12.0.0}
+
+ resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==}
+
+ resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==}
+ engines: {node: '>=4.0'}
+ peerDependencies:
+ debug: '*'
+ peerDependenciesMeta:
+ debug:
+ optional: true
+
+ resolution: {integrity: sha512-J+ler7Ta54FwwNcx6wQRDhTIbNeyDcARMkOcguEqnEdtm0jKvN3Li3PDAb2Du3ubJYEWfYL83XMROXdsXAXycw==}
+
+ resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-Uochze2R8peoN1XqlSi/rGUkDQpRogtLFocP9+PGu68zk1BDAKXfdeCdyVZpgTk8V8WFVQXdEz426VKjXLO1Gg==}
+ engines: {node: '>=12.13.0', yarn: '>=1.0.0'}
+ peerDependencies:
+ typescript: '>3.6.0'
+ webpack: ^5.11.0
+
+ resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==}
+
+ resolution: {integrity: sha512-q5YBMeWy6E2Un0nMGWMgI65MAKtaylxfNJGJxpGh45YDciZB4epbWpaAfImil6CPAPTYB4sh0URQNDRIZG5F2w==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==}
+ engines: {node: '>= 12.20'}
+
+ resolution: {integrity: sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==}
+
+ resolution: {integrity: sha512-Jqc1btCy3QzRbJaICGwKcBfGWuLADRerLzDqi2NwSt/UkXLsHJw2TVResiaoBufHVHy9aSgClOHCeJsSsFLTbg==}
+
+ resolution: {integrity: sha512-q7ORzFqotpwn3Y/GBK2lK7PjtZZwJHz9QE9Phv8zb5IrL9ftGLyi2zjGURON3voK8TaZ+mqJKERYN4lrHYTkUQ==}
+
+ resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
+
+ resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-b1FMfwetIKymC0eioW7mTywihSQE4oLzQn1dB6rZB5fx/3NpNEdAWeCSMB+60/AeT0TCXsxzAlcYVEFCTAksWg==}
+
+ resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
+
+ resolution: {integrity: sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==}
+
+ resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
+ os: [darwin]
+
+ resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
+
+ resolution: {integrity: sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==}
+ engines: {node: '>= 4'}
+
+ resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
+ engines: {node: '>=6.9.0'}
+
+ resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
+ engines: {node: 6.* || 8.* || >= 10.*}
+
+ resolution: {integrity: sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==}
+ engines: {node: '>=8.0.0'}
+
+ resolution: {integrity: sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-mFXCZPJIlcYcth+N8267+mghfYN9h3EhsDa6JSnbA3Wrhh/XFpuowviFcsDeYZtKspQyWyJqfs4O6P8CHeTwzw==}
+
+ resolution: {integrity: sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
+ engines: {node: '>=10.13.0'}
+
+ resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==}
+
+ resolution: {integrity: sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==}
+ engines: {node: '>=16 || 14 >=14.17'}
+ hasBin: true
+
+ resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
+ hasBin: true
+
+ resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
+ deprecated: Glob versions prior to v9 are no longer supported
+
+ resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-/fhDZEJZvOV3X5jmD+fKxMqma5q2Q9nZNSF3kn1F18tpxmA86BcTxAGBQdM0N89Z3bEaIs+HVznSmFJEAmMTjA==}
+ engines: {node: '>=14.0.0'}
+
+ resolution: {integrity: sha512-8PDG5VItm6E1TdZWDqtRrUJSlBcNwz0/MwCa6AL81y/RxPGXJRUwKqGZfCoVX1ZBbfr3I4NkDxBmeTyOAZSWqw==}
+ engines: {node: '>=14.0.0'}
+
+ resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
+
+ resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
+
+ resolution: {integrity: sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==}
+ engines: {node: '>=14.0.0'}
+
+ resolution: {integrity: sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==}
+ engines: {node: '>=0.4.7'}
+ hasBin: true
+
+ resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==}
+ engines: {node: '>=0.4.7'}
+ hasBin: true
+
+ resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}
+
+ resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-dQwHnrfWlTk5PvG9+a45GYpg0VpX47ryKF8dULVd6DtwOE6TEcYQXQ5QM6nyOx/h7v3bvEQbdn19EDAcfUAgZg==}
+ engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}
+
+ resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
+ hasBin: true
+
+ resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-qlspKUK7IlSQv2o+5I7yhUd7TxlOG2Vr5LTa3ve2XSNVKAL/n/u/7KLvKmFNimomDIKvZFXWHv0T12mv7rT8Aw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
+
+ resolution: {integrity: sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==}
+ engines: {node: '>=6'}
+ hasBin: true
+
+ resolution: {integrity: sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-vKZZra6CSe9qsJzh0BjBGXo8dvzNsq/oGvsjfRdOrrryfeD9UOBEEQdeoqCRmKZchF5h2zOBMQ6YuQ0uRUmdbQ==}
+
+ resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==}
+
+ resolution: {integrity: sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==}
+
+ resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==}
+ engines: {node: '>=8.0.0'}
+
+ resolution: {integrity: sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==}
+ engines: {node: '>=12'}
+ hasBin: true
+
+ resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}
+ engines: {node: '>= 14'}
+
+ resolution: {integrity: sha512-k1qv94u1b6e+XKCxVbLgYlOypVP9MPGpnN5G/vxFf6tDO4V3xpz3d6FUOY/s8NtPgaq5RBVVgSB+7IHpVxMYzw==}
+
+ resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
+ engines: {node: '>=10.17.0'}
+
+ resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}
+
+ resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
+
+ resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
+ engines: {node: '>= 4'}
+
+ resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==}
+ engines: {node: '>=8'}
+ hasBin: true
+
+ resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
+ engines: {node: '>=0.8.19'}
+
+ resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
+ deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
+
+ resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==}
+
+ resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
+
+ resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
+
+ resolution: {integrity: sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==}
+ engines: {node: '>=12.0.0'}
+
+ resolution: {integrity: sha512-vI2w4zl/mDluHt9YEQ/543VTCwPKWiHzKtm9dM2V0NdFcqEexDAjUHzO1oA60HRNaVifGXXM1tRRNluLVHa0Kg==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-XDBEu44oSTqlvCSiOZ/0FoUkpWu/vwjJLGSKDabNISPQNZ5wub1FodGHBljRsrR0IXRPq7SslshZYMuA55CgTQ==}
+ engines: {node: '>= 4.5.0'}
+
+ resolution: {integrity: sha512-0SZXGNGZ+WzISQ67QDyZ2x0+wVxjjUndtD8oSeik/4ajifeiRufed8fCb8QW8VMyi4MXcS+UO1k/0NGhvq1PAg==}
+ engines: {node: '>=12.22.0'}
+
+ resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
+ engines: {node: '>= 0.10'}
+
+ resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==}
+
+ resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-0n+pzCC6ICtVr/WXnN2f03TK/3BfXY7me4cjCAqT8TYXEl0+JBRoqBo94JJHXcyDSLUeWbNX8Fvy5g5RJdAstQ==}
+
+ resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==}
+ engines: {node: '>=8'}
+ hasBin: true
+
+ resolution: {integrity: sha512-zMIXX63sxzG3XrkHkrAPvm/OVZVSCPNkwMHU8oTX7/U3AL78I0QXCEICXUM13BIa8TYGZ68PiTKfQz3yaTNr4A==}
+
+ resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
+ engines: {node: '>=0.12.0'}
+
+ resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==}
+
+ resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}
+
+ resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-EddYllaovi5ysMLMEN7yzHEKh8A850cZ7pykrY1aNRQGn/CDjRDE9qEWbIdt7xGEVJmjBXzU/fNnC4ABTm8tEQ==}
+
+ resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==}
+
+ resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
+
+ resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==}
+
+ resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
+
+ resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==}
+ engines: {node: '>=10'}
+ hasBin: true
+
+ resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ hasBin: true
+ peerDependencies:
+ node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
+ peerDependenciesMeta:
+ node-notifier:
+ optional: true
+
+ resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ peerDependencies:
+ '@types/node': '*'
+ ts-node: '>=9.0.0'
+ peerDependenciesMeta:
+ '@types/node':
+ optional: true
+ ts-node:
+ optional: true
+
+ resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==}
+ engines: {node: '>=6'}
+ peerDependencies:
+ jest-resolve: '*'
+ peerDependenciesMeta:
+ jest-resolve:
+ optional: true
+
+ resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
+ engines: {node: '>= 10.13.0'}
+
+ resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ hasBin: true
+ peerDependencies:
+ node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
+ peerDependenciesMeta:
+ node-notifier:
+ optional: true
+
+ resolution: {integrity: sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==}
+
+ resolution: {integrity: sha512-9/KXeZUKKJwqCXUdBxFJ3vPh467OCckSBmYDwSK/EtV090K+iMJ7zx2S3HLVDIWFQdqMIsZWbnaGiba18aWhaA==}
+ engines: {node: '>=14'}
+ hasBin: true
+
+ resolution: {integrity: sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-rtS5ATOo2Q5k1G+DADISilDA6lv79zIiwFd6CcjuIxGKLFm5C+RLImRscVap9k55i+MOZwgliw+NejvkLuGD5g==}
+
+ resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
+
+ resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==}
+ hasBin: true
+
+ resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==}
+ engines: {node: '>=6'}
+ hasBin: true
+
+ resolution: {integrity: sha512-pG8elXWCTAIwH1W8FwjDbj2FBJSi2WE5PdV0dm+c+7LAmH6XL6fwDsdQGgAgOZljcF3Kj9Uzop2TfGfPDSOUqA==}
+
+ resolution: {integrity: sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==}
+
+ resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==}
+
+ resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
+
+ resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
+
+ resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
+
+ resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
+
+ resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
+ engines: {node: '>=6'}
+ hasBin: true
+
+ resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==}
+
+ resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==}
+
+ resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
+
+ resolution: {integrity: sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==}
+ engines: {node: '>=12', npm: '>=6'}
+
+ resolution: {integrity: sha512-OYWlK0j+roh+eyaMROlNbS5cd5R25Y+IUpdl7cNdB8HNrkgwQzIS7L9MegxOiWNBj9dQhA/yAxiMwCC5mwNoBw==}
+
+ resolution: {integrity: sha512-C9YK3Rf8q6VAPDCCU9fnqo3mAfOH6vUGnMcP4AQAYIEpWtfGLpwOTmZ+igtdK5y+VvI2n3CyYSzy4Qh34eq24A==}
+
+ resolution: {integrity: sha512-ZhJT1soxJCkOiO55/mz8yeBKTAJhRzX9WBO+16ZTqNTONnnVlUPyVBIzQ7lDRjaBdTbid+bAnyIon/GM3yp4cA==}
+ engines: {node: '>=10.0.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==}
+
+ resolution: {integrity: sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==}
+
+ resolution: {integrity: sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==}
+
+ resolution: {integrity: sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==}
+
+ resolution: {integrity: sha512-C3iHfuGUXK2u8/ipq9LfjFfXFxAZMQJJq7vLS45r3D9Y2xQ/m4S8zaR4zMLFWh9AsNPXmcFfUDhTEO8UIC/V6Q==}
+ engines: {node: '>=12.0.0'}
+
+ resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
+
+ resolution: {integrity: sha512-fhBqFlXd0GkKTB+8ayLfpzPUw+LHxZlPAukPNBD1Om7JMeInT+/PxCAf1yLagvD+VKoyWhXtJR68xQkX/a0wOQ==}
+
+ resolution: {integrity: sha512-tBMwe6AALTBQJb0woQDD40734NKzb0Kzi3k7wQj9ar3AbP9oqhoVrdXPh7rk2r00/glIgd0YbToIUJsnxWMiIg==}
+
+ resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==}
+ engines: {node: '>= 0.6.3'}
+
+ resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==}
+
+ resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-GgOXd0Eo6phYgh0DJtjQ2tO8dc0IVINtZJeARPeiIJqge+HdsWSuaDTe8ztQ7j/cONByDZ3zeB325AHiv5O0dg==}
+
+ resolution: {integrity: sha512-j9mBC7eiqi6fgBPAGvKCXJKJSIASanYF4EeA4iBzSG0HxQxmXnR3KbyWqTn4CwsKSebqCv2f5XZfAO6sKzgvwA==}
+
+ resolution: {integrity: sha512-Jr6v8thd5qRlOlc6CslSTzGzzQW03uiscab7KHQZX1Dfo4R6n6FDhZ0Hri6/X7edLIDv9gl4VMZXhxTjLnl0VQ==}
+
+ resolution: {integrity: sha512-0Wd+GPz1O134cP62YU2GTOPNA7Qgl09XwCqM5zpBv87ERCXdfDtyKXvV7c9U22yWJh44QZqBocFnXN11K96qow==}
+
+ resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
+
+ resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
+
+ resolution: {integrity: sha512-NZXmCwv3RG5nire3fmIn9HsOyJX3vo+ptp0yaXUHAMzSNBhx74Hm+dAGJvscUA6lNqbLuYfXgNavRQ9UbUJhQQ==}
+ engines: {node: '>=14'}
+ hasBin: true
+
+ resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==}
+ engines: {node: '>=6.11.5'}
+
+ resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==}
+
+ resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==}
+
+ resolution: {integrity: sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==}
+
+ resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==}
+
+ resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==}
+
+ resolution: {integrity: sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==}
+
+ resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==}
+
+ resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==}
+
+ resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==}
+
+ resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
+
+ resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==}
+
+ resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
+
+ resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==}
+
+ resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
+
+ resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
+
+ resolution: {integrity: sha512-rh+Zjr6DNfUYR3bPwJEnuwDdqMbxZW7LOQfUN4B54+Cl+0o5zaU9RJ6bcidfDtC1cWCZXQ+nvX8bf6bAji37QQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-0RM14cZF0gO1y2Q/82hhWranispZOUSYHwvQ21h12x90NwD6+D5q59S5nOLqCtCdYitHN58LJXWEHa4RWm7BYA==}
+
+ resolution: {integrity: sha512-PFV0BBh4Tv7Omui5FtXXVtN4ExAxIi8Yvmb9JgBz+J6Hnnrv/YYXLlKKudLhXwd3/qWEATOslRsnzVCWDeCnmQ==}
+
+ resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
+
+ resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==}
+
+ resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==}
+ engines: {node: '>= 4.0.0'}
+
+ resolution: {integrity: sha512-qUEg2g8vxPe+zPn09KidjIStHPtoBO8Cttm8bgJFWWabbsjQ9Av9Ky+6UcvKx6ue0LLb/LEhtcyQpRyKfzeXcg==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==}
+
+ resolution: {integrity: sha512-IAeFvcOnV9V0Yk+bFhYR07O3yNina9ANIN5MoXBKYJ/RLYPurd2d0yw14MDhpr9/momp0WofT1bPUh3hkzdi/g==}
+
+ resolution: {integrity: sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==}
+
+ resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
+
+ resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
+ engines: {node: '>= 8'}
+
+ resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==}
+ engines: {node: '>=8.6'}
+
+ resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==}
+ engines: {node: '>=4'}
+ hasBin: true
+
+ resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==}
+ engines: {node: '>=4.0.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
+
+ resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==}
+ engines: {node: '>=16 || 14 >=14.17'}
+
+ resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
+ engines: {node: '>=16 || 14 >=14.17'}
+
+ resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
+
+ resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==}
+ engines: {node: '>=16 || 14 >=14.17'}
+
+ resolution: {integrity: sha512-LPNVSj1LyUVYT9G1gWwSw3GSuDzDsQCu0tPB2uDsq4VesYNnU6v3iLCQidMiR6azmIt13OEozG700ygAUuA6Ng==}
+
+ resolution: {integrity: sha512-7pfUOVPtmb0wC+oUOn4xBsAw4eT5DyD6xqaxj/kssu6RrFXOXgJaVnDPAI9AzIvXJ/5as9QrqRGYAddehwWpHQ==}
+
+ resolution: {integrity: sha512-79qwn9AgdGjJR1vLnrcm2rq2AsAZkKC5JPwffTMG+Nja6zGYpTDZFZ56ekHWr/r1b5WxkukcPj2PdevUug8c+Q==}
+
+ resolution: {integrity: sha512-3ju6I4l7uUhPRrJfN3yK9AMsfHvrYbRkcJ1GRphFHzUj37B2J6qJOQUpzA547Y4aeh69TSb7HFVf1t12ejQxVw==}
+
+ resolution: {integrity: sha512-+V2TDw3tXUVEptFvLSerz125C2ogYl8klIBRY1m5BHd4JvGVf3yhx8N3PngByCzA6PGcv/eydGQN+wy34SHf0Q==}
+ hasBin: true
+
+ resolution: {integrity: sha512-hYdEFdJGHPbZJSEysykrevEbB07yhJGSwfDZEYDSbhQQFjV2tXrEgYcFD5EneMaowjb55e3divSJxU4c5q4Qgw==}
+
+ resolution: {integrity: sha512-Dmwk+2cgSD9L9GmTbEUNd8QxkTZtW9P7FN/ROZW/fGZD6Hq6/4TB0zEspg2Ow9eYjZXO2ofOJ3PaQEEShKV0kQ==}
+
+ resolution: {integrity: sha512-vh27LQ9FG/01y0b9ntfqm+GT5AjJnDSDY9hilss2ixIUh0FemvfGRfsGVeV5UBVPBKK7Ffhvfqc7Rciob9Spzw==}
+
+ resolution: {integrity: sha512-HSu/rKnGZVKFq3ciT46vi1EOy+9mkB0HewO4+P6dP/Y0UerWkN6S3UK11Cxsj0cAp0vFwkPDCdOeEzRdpFEkzA==}
+
+ resolution: {integrity: sha512-2ISo0r5ZKwkrvJgDou9xVPxxtXMaETe2AsAA02L89LnbB2KC0N5myNsHV0sEysTw9+CfCmgjAb0GAI5QGpxKkQ==}
+
+ resolution: {integrity: sha512-Eo56FA5C2v6ucmWQL/JBJ2z641pLOom4k0wP6CMZI2utfyiJ+e2Uuinj1KTrgDcEvW4EtU9HrfAqLK9UosLZlg==}
+
+ resolution: {integrity: sha512-CzV2aDPpiNIIgGPHNcBhgyedKY4SX3BJoTwOobSwZVIlEA6TAWB4Z9WwFUmQqZOgo1AkkiTHPZQvGcEhFFXH6g==}
+
+ resolution: {integrity: sha512-MDNDPMBOgXUZYdxhosyrA2kudiGO8aogT0/cODyi2Ed9o/1S7W+je11JUYskQbncqhWKGxNyaP4VWa+6+vUC/g==}
+
+ resolution: {integrity: sha512-J2PxCefUVeFwsAExhrKo4lwxDevc5aKj888HBl/wN4EuWOoOg06iOGCxz4Omd8dqyFsrqvbBuPqRzQ+VycGmaA==}
+
+ resolution: {integrity: sha512-9J+JuH+mKrQU65CaJ4KZegACUgNIlYmWQYx3VOBR/tyz+8kDYX7xBhKJCjQ1I4wj2Tvga3bykd89Oc2kFZ5WOw==}
+
+ resolution: {integrity: sha512-IM59xRtsxID4DubQ0iLmoCGXguEe+9BFG4z6y2xQDrscIa4QY3KlfqgKGT69ojW+AVbXXJPEVqrAi4/eCsLItQ==}
+
+ resolution: {integrity: sha512-o3mRuuP/MB5fZycjD3KH/uXsnaPl7Oo8GtdbJTKtH1+O/3pz8GzGMkscTKa97l03DAG2EhGrzzLcU2A6eshwFw==}
+
+ resolution: {integrity: sha512-9cLAPuc69yiuzNrMZIN58j+HMK1UWPaq2i3/Fg2ZpimfcGFKRcPGCbEVh0v+Pb6/J0+kf8yIO0leH20opu3AyQ==}
+
+ resolution: {integrity: sha512-g1OhSdofIytE9qaOGdTPmRIp7JsCtgO0zbsn1Fk6wQh2gEL55Z40j/VoghslWAWTgT2OHFdBKnMvWtN6U5+d2Q==}
+
+ resolution: {integrity: sha512-sr/+35RdxZroNQVegjpfRHJ5hda9XCgaS4mK2FGO+Mb1IUevKfeEPII3F/cHDpNwFeYH3kAgyqQ22ClhGLWNBA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-VsKH/Jdlf8Yu3y7GpzQV5n7JMdpqvZvTSpF6UQXL0PWOm7k6+LX+sCZimOfpHJ+wCaaybpxokjWZ71mxOoCWoA==}
+
+ resolution: {integrity: sha512-Tz0UX8/JVYICLjT+U8J1f/TFxIYVYjzZHeh4/Oyta0pLpRLeZlxEd71f3u3kdnulCKMP4i37pFRDmyLXAlEuLw==}
+
+ resolution: {integrity: sha512-1zZS8P4O0KweWUqNS655+oNnVMPQ1Rq1GaZq5S9JfwT1Vh/m516lSmiTW9oko6gGHytt5s6Yj6oOeu5Zm8FoLw==}
+
+ resolution: {integrity: sha512-IGyHheOYyRchBLiAEgw3UM11kFNmBSMupu2BDdejC6ZiDhEAdG+tyERlsCwDPYtXanvFpGWULIu3XlsUPc+RZw==}
+
+ resolution: {integrity: sha512-JfVPRXH++Hd933gmQfG8JXXCBCR6fIzC3DwiYycvanL/aW1cEQ2EnebUfQkt5QzlYjOkJEH+JpccAsq3ln6FZQ==}
+
+ resolution: {integrity: sha512-7sD5FXrESOxpT9Z4Oh36bS6u/geuUrMP1aCg2sjyAwbPcF1aWa2k9OcatQfpRf6pJEhUZ18y6/WBBXmMVmSzXg==}
+
+ resolution: {integrity: sha512-3B7Qj+17EgDdAtZ3NAdMyOwLTX1jfmJuY7gjyhS2HtcZAmppW+cxqHUBwCKfvSRgTQiccmEvtNxaQK+tfyrZqA==}
+
+ resolution: {integrity: sha512-FLx7DcRKTdKdcOCbMyBaeudeHaHpwPveRrBm6WyQe3LXx6FfdmOh59i71/16LFQMgBOD3N4/UJkzxLzlTJzMqQ==}
+
+ resolution: {integrity: sha512-+C0hxCmw9kg0XzT6vhE5mFkK6y225nC8UEQcN94K0fBCjPKkM+HqZMwGX205fzdGRi+Bxa55b/VhrIVwdv+8vw==}
+
+ resolution: {integrity: sha512-Xb72KdqRwjv/qM2rJpV22syyP2N3cRQ9VVDrN6u2FSzLq02buFNxmSPJ7CKhat3PrUNdVHU75KZwOf/tz4UEhA==}
+
+ resolution: {integrity: sha512-ditsCijeHJrmBmObtJmQ18ddLxv5oPyMTdPU8Di8APOnD2zPk7Z4UAuJSl7HXB45oFiivr3MJf4koFzMUSZ6Gg==}
+
+ resolution: {integrity: sha512-bW2WpJxm6HS+S3Yu6tq1DUPFoTxU9sPviUSmnL7Ua+oVO3WA5ILFWqvujUlz+oeuM+HCwEyMiP5xvKNPENVjYA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
+
+ resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
+ hasBin: true
+
+ resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
+ engines: {node: '>=10'}
+ hasBin: true
+
+ resolution: {integrity: sha512-ZXm9b36esbe7OmdABqIWJuBBiLLwAjrN7CE+7sYdCCx82Nabt1wHDj8TVseS59QIlfFPbOoiBPm6ca9BioG4hw==}
+
+ resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
+
+ resolution: {integrity: sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==}
+
+ resolution: {integrity: sha512-RM7AHlvYfS7jv7+BXund/kR64DryVI+cHbVAy9P61fnb1RcWZqOW1/Wj2YhqMCx+MuYhqTRGv7AwHBzmsCKBfA==}
+ engines: {node: '>=16.20.1'}
+ peerDependencies:
+ '@aws-sdk/credential-providers': ^3.188.0
+ '@mongodb-js/zstd': ^1.1.0 || ^2.0.0
+ gcp-metadata: ^5.2.0
+ kerberos: ^2.0.1
+ mongodb-client-encryption: '>=6.0.0 <7'
+ snappy: ^7.2.2
+ socks: ^2.7.1
+ peerDependenciesMeta:
+ '@aws-sdk/credential-providers':
+ optional: true
+ '@mongodb-js/zstd':
+ optional: true
+ gcp-metadata:
+ optional: true
+ kerberos:
+ optional: true
+ mongodb-client-encryption:
+ optional: true
+ snappy:
+ optional: true
+ socks:
+ optional: true
+
+ resolution: {integrity: sha512-DndoI01aV/q40P9DiYDXsYjhj8vZjmmuFwcC3Tro5wFznoE1z6Fe2JgMnbLR6ghglym5ziYizSfAJykp+UPZWg==}
+ engines: {node: '>=16.20.1'}
+
+ resolution: {integrity: sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==}
+ engines: {node: '>=4.0.0'}
+
+ resolution: {integrity: sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==}
+ engines: {node: '>=14.0.0'}
+
+ resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
+
+ resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
+
+ resolution: {integrity: sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-mNdO4s/W54QCghwGNSqO5ULVJ6QUimP/1hRlWVx5f7frTLaClg+4sBRjUTgP1OrBRgVtkH1tI9vi4Dqg/JX3Kg==}
+
+ resolution: {integrity: sha512-WeSGziVj6+Z2/MwQo3GvqzgR+9Uc+qt8SwHKh3gvNPiISKfsMfG4SvCOFYlxxgkXt7yIV2i1yczehm0EOKIxIg==}
+ engines: {node: '>= 6.0.0'}
+ deprecated: Multer 1.x is impacted by a number of vulnerabilities, which have been patched in 2.x. You should upgrade to the latest 2.x version.
+
+ resolution: {integrity: sha512-bS8rPZurbAuHGAnApbM9d4h1wSoYqrOqkE+6a64KLMK9yWU7gJXBDDVklKQ3TPi9DRb85cRs6yXaC0+cjxRtRg==}
+ engines: {node: '>= 10.16.0'}
+
+ resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==}
+
+ resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==}
+ engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
+
+ resolution: {integrity: sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==}
+
+ resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
+
+ resolution: {integrity: sha512-VVw8O5KrfvwqAFeNZEgBbdgA+AQaBlHcXEootWU7TWDaFWFI0VLfzyKMsRjnfdS3cVCpWmI04xLJonCvEv11VQ==}
+ engines: {node: '>=0.4.10'}
+
+ resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
+
+ resolution: {integrity: sha512-FKZq30BT1w0xMRe0CbJtxWOhsvoHjXcxd2B4HjGQzkgyiuBUDWsxy6ZipDerDR9elVF11j9RGUhpz7c+Sd7gTw==}
+
+ resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==}
+
+ resolution: {integrity: sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==}
+
+ resolution: {integrity: sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==}
+
+ resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
+ engines: {node: '>=10.5.0'}
+ deprecated: Use your platform's native DOMException instead
+
+ resolution: {integrity: sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==}
+
+ resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
+ engines: {node: 4.x || >=6.0.0}
+ peerDependencies:
+ encoding: ^0.1.0
+ peerDependenciesMeta:
+ encoding:
+ optional: true
+
+ resolution: {integrity: sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw==}
+ hasBin: true
+
+ resolution: {integrity: sha512-iwpZdvW6Umz12ICmu9IYPRxg0tOLGmU3Tq2tKetejCj3oZd7b2nUXwP3a7QA5M9glWy8wlPS1G3RwM/CdsUbdQ==}
+ engines: {node: '>=8.0.0'}
+
+ resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==}
+
+ resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==}
+
+ resolution: {integrity: sha512-Z+iLaBGVaSjbIzQ4pX6XV41HrooLsQ10ZWPUehGmuantvzWoDVBnmsdUcOIDM1t+yPor5pDhVlDESgOMEGxhHA==}
+ engines: {node: '>=6.0.0'}
+
+ resolution: {integrity: sha512-Ajq6Sz1x7cIK3pN6KesGTah+1gnwMnx5gKl3piQlQQE/PwyJ4Mbc8is2psWYxK3RJTVeqsDaCv8ZzXLCDHMTZw==}
+ engines: {node: '>=6.0.0'}
+
+ resolution: {integrity: sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==}
+ engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
+ hasBin: true
+
+ resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
+
+ resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
+
+ resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-dKoW56i02Prv2XQolJ9Rl9Svqubqkzg3QpwEOBuSVZLk05Shelu7s+ErRTwFc1Bs3JZ2qBqBfVpXQiJhwOGG8A==}
+ hasBin: true
+ peerDependencies:
+ ws: ^8.18.0
+ zod: ^3.23.8
+ peerDependenciesMeta:
+ ws:
+ optional: true
+ zod:
+ optional: true
+
+ resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==}
+ hasBin: true
+
+ resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-f5estLO2KN8vgtTRaILIgEGBoBrMnZ3JQ7W9TMZCnOIGwHe8TRGSpcagnWDo+Dfhd/z08k9Xe75hvciJJ8Qaew==}
+ engines: {node: '>=0.10.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-ixCMMwnVxyHFQLQnINhmIpWqXIfS2YOXchwQrk+OFzmo6nDjQ0E4KXAyyUh0T0MZgV4bUhkRrAbVqlE4yLVq4A==}
+ engines: {node: '>=0.10.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-KXatOjCRXXkSePPb1Nbi0p0m+gQAwdlbhi4wQKJPI1HsMQS9g+Sqp2o+QHziPr7eYJyOZet836KoHEVM1mwOrQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-wpgERjNkLrBiFmkMEjuZJEWKKDrNfHCKA1OhyN1wg1FrLkULbviEy6py1AyJUgZ72YWFbZ38FIpnqvVqAlDUwA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
+
+ resolution: {integrity: sha512-eQE845L6ot89sk2N8liD8HAuH4ca6Vvr7VWAWwt7+kvvG5aBcPmmphQ68JsEG2qa9n1TykS2DLeMt363AAH8/w==}
+
+ resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==}
+
+ resolution: {integrity: sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==}
+
+ resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
+
+ resolution: {integrity: sha512-e6qHKe3a9HWr0oMRVDTRhKce+bRO8VGQR3NyVwcjwrbhMmFCX9KszEV35+rn4AdilFAq9VPxP/Fe1wC9Qjd2lw==}
+
+ resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
+
+ resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
+ engines: {node: '>=16 || 14 >=14.18'}
+
+ resolution: {integrity: sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==}
+
+ resolution: {integrity: sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==}
+
+ resolution: {integrity: sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==}
+ engines: {node: '>=16'}
+
+ resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==}
+
+ resolution: {integrity: sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==}
+
+ resolution: {integrity: sha512-XIxfHpEuSJbITd1H3EeQwpcZbTLHc+VVr8ANI9t5sit565tsI4/xK3KWTUFE2e6QiangUkh3B0jihzmGnNrRsQ==}
+
+ resolution: {integrity: sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg==}
+
+ resolution: {integrity: sha512-P2DEBKuvh5RClafLngkAuGe9OUlFV7ebu8w1kmaaOgPcpJd1RIFh7otETfI6hAR8YupOLFTY7nuvvIn7PLciUQ==}
+
+ resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
+ engines: {node: '>=4.0.0'}
+
+ resolution: {integrity: sha512-DzZ26On4sQ0KmqnO34muPcmKbhrjmyiO4lCCR0VwEd7MjmiKf5NTg/6+apUEu0NF7ESa37CGzFxH513CoUmWnA==}
+ peerDependencies:
+ pg: '>=8.0'
+
+ resolution: {integrity: sha512-IpdytjudNuLv8nhlHs/UrVBhU0e78J0oIS/0AVdTbWxSOkFUVdsHC/NrorO6nXsQNDTT1kzDSOMJubBQviX18Q==}
+
+ resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-7SKfdvP8CTNXjMUzfcVTaI+TDzBEeaUnVwiVGZQD1Hh33Kpev7liQba9uLd4CfN8r9mCVsD0JIpq03+Unpz+kg==}
+ engines: {node: '>= 8.0.0'}
+ peerDependencies:
+ pg-native: '>=3.0.1'
+ peerDependenciesMeta:
+ pg-native:
+ optional: true
+
+ resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==}
+
+ resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
+
+ resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
+ engines: {node: '>=8.6'}
+
+ resolution: {integrity: sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==}
+
+ resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-yuGIEjDAYnnOex9ddMnKZEMFE0CcGo6zbfzDklkmT1m5z734ss6JMzN9rNB3+RR7iS+F10D4/BVIaXOyh8PQKw==}
+ engines: {node: '>= 10.12'}
+
+ resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==}
+ engines: {node: '>=6.0.0'}
+
+ resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==}
+ engines: {node: '>=14'}
+ hasBin: true
+
+ resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==}
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+
+ resolution: {integrity: sha512-ZtV1YrwscEjlrUzYrTSs6Nwo49JM3pXLM4fFOBSC3wSni+bxaWlw9/Qgk75PZO8M7cX2EybmL2iwvaV3vkAttw==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
+
+ resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
+ engines: {node: '>= 0.6.0'}
+
+ resolution: {integrity: sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==}
+
+ resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==}
+
+ resolution: {integrity: sha512-z597WicA7nDZxK12kZqHr2TcvwNU1GCfA5UwfDY/HDp3hXPoPlb5rlEx9bwGTiJnc0OqbBTkU975jDToth8Gxw==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==}
+
+ resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
+ engines: {node: '>= 0.10'}
+
+ resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
+
+ resolution: {integrity: sha512-azINV9dUtzPMFQktvTXciNAfAuVh/L/JCl0vtPCwvOA21uZrC08K/UnmrL+SXGEVc1FwzjW62+xw5S/uaLj6cA==}
+
+ resolution: {integrity: sha512-cYQg0JW0w32Ux+XTeZnBEeuWrAY7/HNE6TWnhiHGnnRYlCgyAUPoyh9KzCMa9WhcJlJ1AtQqpEYHc+vbCzA+Aw==}
+
+ resolution: {integrity: sha512-lv7sU9e5Jk8IeUheHata6/UThZ7RK2jnaaNztxfPYUY+VxZyk/ePVaNZ/vwmH8WqGvDz3LrNYt/+gA55NDg6Pg==}
+
+ resolution: {integrity: sha512-yeNFtq5Yxmfz0f9z2rMXGw/8/4i1cCFecw/Q7+D0V2DdtII5UvqE12VaZ2AY7ri6o5RNXiweGH79OCq+2RQU4A==}
+
+ resolution: {integrity: sha512-0I6C62+keXlZPZkOJeVam9aBLVP2EnbeDw3An+k0/QlqdwH6rv8284nko14Na7c0TtqtogfWXcRoFE4O4Ff20w==}
+
+ resolution: {integrity: sha512-gjD1yzp0yxbQqnzBAdlhbgoJL5qIFJw78juN1NpTLt/mfPJ5VgC4BvkoD3G23qKzJtIIXBbcCt6FioLSFLOHdw==}
+
+ resolution: {integrity: sha512-OCjTEnhLWZBvS4zni/WUMjH2YSUosnsmjGBB1An7CsKQarYSWQ0GCVyd4eQPMFJqZ8w9xgs01QdiZXKVjk92EQ==}
+
+ resolution: {integrity: sha512-ukiYM/9cH6Cml+AOl5kETtM9NR3WulyVP2y4HOU45DyMim1IeP/OOiyEWRr6qk5I5klpsBnbuHpwKmTx6WURnw==}
+
+ resolution: {integrity: sha512-L50zbvrQ35TkpHwv0G6aLSuueDRwc/97XdY8kL3tOT0FmhgG7UypU3VztfV/LATAvmUfYi4wNxSajhSAeNN+Kg==}
+
+ resolution: {integrity: sha512-zo8DsDpH7eTkPHCXFeAk1xZXJbyoTfdPlNR0bK7rpOMuhBYb0f5qUVCO1xlsitYd3w5FQTK7zpNVKb3rZoUrrQ==}
+
+ resolution: {integrity: sha512-yYELe9Q5q9IQhuvqsZNwA5hfPkMJ8u92bQLIMcsMxf/VADjNtEYptU+inlufAFYcWdHlwNfZOEnOOQrZrcyJCQ==}
+
+ resolution: {integrity: sha512-uBi6kmc9f3SZ3PXxqcHiUZLmIXgfgWooKWXcwSGwQd2Zi5Rb0bT14+8CJjJgI8AB+nndLaNgHGrcc6bPIB665g==}
+
+ resolution: {integrity: sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==}
+
+ resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==}
+
+ resolution: {integrity: sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==}
+ engines: {node: '>=0.6'}
+
+ resolution: {integrity: sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==}
+ engines: {node: '>=0.6'}
+
+ resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
+
+ resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==}
+
+ resolution: {integrity: sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
+
+ resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
+ hasBin: true
+
+ resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==}
+
+ resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==}
+
+ resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+
+ resolution: {integrity: sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==}
+
+ resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
+ engines: {node: '>=8.10.0'}
+
+ resolution: {integrity: sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-S1bJDnqLftzHXHP8JsT5II/CtHWQrASX5K96REjWjlmWKrviSOLWmM7QnRLstAWsu1VBBV1ffV6DzCvxNP0UJQ==}
+
+ resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==}
+
+ resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==}
+ engines: {node: '>= 0.10'}
+
+ resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==}
+ engines: {node: '>=0.10'}
+
+ resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==}
+
+ resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==}
+ engines: {node: '>= 0.4'}
+ hasBin: true
+
+ resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==}
+ engines: {node: '>= 4'}
+
+ resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
+ engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
+ deprecated: Rimraf versions prior to v4 are no longer supported
+ hasBin: true
+
+ resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-Ep0RsvAjnRcBX1p5vogbaBdAGu/8j/ewpvGqnQYunnLd9SM0vWcPJewPKNnWFggf0hF0pwIgwV5XK7qQ7UZ8Qg==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==}
+ engines: {node: '>=0.12.0'}
+
+ resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==}
+ engines: {node: '>=0.12.0'}
+
+ resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
+
+ resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==}
+
+ resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
+
+ resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
+
+ resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
+
+ resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==}
+
+ resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==}
+ engines: {node: '>= 10.13.0'}
+
+ resolution: {integrity: sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==}
+ engines: {node: '>= 10.13.0'}
+
+ resolution: {integrity: sha512-eeG26wRwhtwYuKGCDM3LixCaxY27Pa/5lK4rLKhQa7HBjJ3U3Y+f81MMZQRsDw/8SC2Dao/83yJTXJ8aULuN8Q==}
+
+ resolution: {integrity: sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==}
+
+ resolution: {integrity: sha512-5TF+l7p4+OsnP8BCCvSyZiSPc4x4//p5uPwK8TCnVPJYRmU2aYKMpOXvw8zM5a5JvuuCGN1jmsMwuU2W02ukfA==}
+
+ resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==}
+ hasBin: true
+
+ resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==}
+ engines: {node: '>=10'}
+ hasBin: true
+
+ resolution: {integrity: sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==}
+
+ resolution: {integrity: sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
+
+ resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==}
+
+ resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
+
+ resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==}
+
+ resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-4qdtOGcBjral6YIBCWJ0ljFSKNLz9KkhbWtuGvUyRowl1kxfuE1x/Z/aJcaiilpb3do9bl5K7/1h9XC5wWpY/A==}
+
+ resolution: {integrity: sha512-KyFkIfr8QBlFG3uc3NaljaXdYcsbRy1KrSfc4tsQV8jW68jAktGeOcifu530Vx/5LC+PULHT0Rv8LiI8Gw+c1g==}
+
+ resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==}
+
+ resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
+
+ resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==}
+ engines: {node: '>= 8'}
+
+ resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==}
+
+ resolution: {integrity: sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==}
+
+ resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
+ engines: {node: '>= 10.x'}
+
+ resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
+
+ resolution: {integrity: sha512-x0LV1eVDwjf1gmG7TTnfqIzf+3VPRz7vrNIjX6oYLbeCrf/PeVY6hkT68Mg+q02qXxQhrLjB0jfgvhevoCRmLQ==}
+
+ resolution: {integrity: sha512-r1X4KsBGedJqo7h8F5c4Ybpcr5RjyP+aWIG007uBPRjmdQWfEiVLzSK71Zji1B9sKxwaCvD8y8cwSkYrlLiRRg==}
+ engines: {node: '>=10.16.0'}
+
+ resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==}
+
+ resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-I6GPS/E0zyieHehMRPQcqkiBMJKGgLta+1hREixhoLPqEA0AlVFiC43dl8uPpmkkeRdDMzYRWFWk5/l9x7nmNg==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-QllfrBhqF1DPcz46WxKTs6Mz1Bpc+8Qm6vbqOpVav5odAXwbyzwnEczoWqtxrsmlO+cJqtPrp/8gWKWjaKLLlA==}
+
+ resolution: {integrity: sha512-gHFfL3px0Kctd6Po0M8TzEvt3De/xu6cnRrjlfYNhwbhLPLwigI2t1nc6jrzNuaYg5C4YF78PPFuQPzRiqn9ew==}
+ engines: {node: '>=4.0.0'}
+
+ resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==}
+ engines: {node: '>=10.0.0'}
+
+ resolution: {integrity: sha512-PhP9wUnFLa+91CPy3N6tiQsK+gnYyUNuk15S3YG/zjYE7RuPeCjJngqnzpC31ow0lzBHQ+QGO4cNJnd0djYUsw==}
+
+ resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}
+
+ resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
+
+ resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-YAT3K/sgpCUxhxNMrrdhtod3jckkpYwH6JAuwmUdXZsmzH1wUyzTMrrK2wYCEEqlKwrWDd35NeuUkbBy/1iK+Q==}
+
+ resolution: {integrity: sha512-HqSe6DSIh3hEn6cJvCkaM1BLi466f1LHi4yubR0tpewlMpk4RUFFy35bKz8SsPBwYfIIJy5eclp+3tCYAuX0bw==}
+ engines: {node: '>=6.4.0 <13 || >=14'}
+ deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net
+
+ resolution: {integrity: sha512-xuW7dzkUpcJq7QnhOsnNUgtYp3xRwpt2F7abdRYIpCsAt0hhUqia0EdxyXZQQpNmGtsCzYHryaKSV3q3GJnq7w==}
+ engines: {node: '>=14.18.0'}
+
+ resolution: {integrity: sha512-qlsr7fIC0lSddmA3tzojvzubYxvlGtzumcdHgPwbFWMISQwL22MhM2Y3LNt+6w9Yyx7559VW5ab70dgphm8qQA==}
+ engines: {node: '>=14.18.0'}
+
+ resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-J+y4mCw/zXh1FOj5wGJvnAajq6XgHOyywsa9yITmwxIlJbMqITq3gYRZHaeqLVH/eV/HOPphE6NjF+nbSNC5Zw==}
+
+ resolution: {integrity: sha512-SrNU3RiBGTLLmFU8GIJdOdanJTl4TOmT27tt3bWWHppqYmAZ6IDuEuBvMU6nZq0zLEe6b/1rACXCgLZqO6ZfrA==}
+ engines: {node: '>= v0.10.32'}
+ peerDependencies:
+ express: '>=4.0.0 || >=5.0.0-beta'
+
+ resolution: {integrity: sha512-SzRP5LQ6Ts2G5NyAa/jg16s8e3R7rfdFjizy1zeoecYWw+nGL+YA1xZvW/+iJmidBGSdLkuvdwTYEyJEb+EiUw==}
+ engines: {node: '>=0.2.6'}
+
+ resolution: {integrity: sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==}
+ engines: {node: '>=0.10'}
+
+ resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==}
+ engines: {node: ^14.18.0 || >=16.0.0}
+
+ resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==}
+
+ resolution: {integrity: sha512-ZoROL70jptorGAlgAYiLoBLItEKw/fUxg9BSYK/dF/GAGYFJOJJJMvjPAKDJraCXFwadD456FCuvLWgfhMsPwg==}
+
+ resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==}
+
+ resolution: {integrity: sha512-ipUKFgaAHwAFRI5MiWGvKAle0dilXJ/EzVoJNvOg2FTHSjtPbD1kbaOWuNKG2l1v3C1NtMMSbRRaWFi3HQWz3w==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-BUZMff+ww4sfIRRSpYUtATZXdDhcssCPFsU4NYACqXTWhJ4CneSeVi0LzogYxovZT5VKNlqWdWrfzdluWb4P9Q==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ==}
+ engines: {node: '>= 10.13.0'}
+ peerDependencies:
+ '@swc/core': '*'
+ esbuild: '*'
+ uglify-js: '*'
+ webpack: ^5.1.0
+ peerDependenciesMeta:
+ '@swc/core':
+ optional: true
+ esbuild:
+ optional: true
+ uglify-js:
+ optional: true
+
+ resolution: {integrity: sha512-B8wRRkmre4ERucLM/uXx4MOV5cbnOlVAqUst+1+iLKPI0dOgFO28f84ptoQt9HEI537PMzfYa/d+GEPKTRXmYA==}
+ engines: {node: '>=10'}
+ hasBin: true
+
+ resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-oxPLuOtrRWS11A+Yn0+zXB7GkmNarflWqmy6CQJk8KJ75LZs2/zlUXDpizTbPpCGtk4kE2EQYwFZjrE967F8Wg==}
+
+ resolution: {integrity: sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==}
+
+ resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
+
+ resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
+ engines: {node: '>=0.8'}
+
+ resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
+
+ resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
+
+ resolution: {integrity: sha512-AldGGlDP0PNgwppe2quAvuBl18UcjuNtOnDuUkqhd6ipPqrYYBt3aTxK1QTsBVknk97lS2JcafWMghjGWFtunw==}
+ hasBin: true
+
+ resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
+ engines: {node: '>=0.6.0'}
+
+ resolution: {integrity: sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==}
+ engines: {node: '>=14.14'}
+
+ resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==}
+
+ resolution: {integrity: sha512-okFlQcoGTi4LQBG/PgSYblw9VOyptsz2KJZqc6qtgGdes8VktzUQkj4BI2blit072iS8VODNcMA+tvnS9dnuMA==}
+
+ resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
+ engines: {node: '>=8.0'}
+
+ resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
+ engines: {node: '>=0.6'}
+
+ resolution: {integrity: sha512-VSsyNPPW74RpHwR8Fc21uubwHY7wMDeJLys2IX5zJNih+OnAnaifKHo+1LHT7DAdloQ7apeaaWg8l7qnf/TnEg==}
+
+ resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
+
+ resolution: {integrity: sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}
+ hasBin: true
+
+ resolution: {integrity: sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==}
+ engines: {node: '>=18.12'}
+ peerDependencies:
+ typescript: '>=4.8.4'
+
+ resolution: {integrity: sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==}
+ engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0}
+ hasBin: true
+ peerDependencies:
+ '@babel/core': '>=7.0.0-beta.0 <8'
+ '@jest/transform': ^29.0.0
+ '@jest/types': ^29.0.0
+ babel-jest: ^29.0.0
+ esbuild: '*'
+ jest: ^29.0.0
+ typescript: '>=4.3 <6'
+ peerDependenciesMeta:
+ '@babel/core':
+ optional: true
+ '@jest/transform':
+ optional: true
+ '@jest/types':
+ optional: true
+ babel-jest:
+ optional: true
+ esbuild:
+ optional: true
+
+ resolution: {integrity: sha512-Qo4piXvOTWcMGIgRiuFa6nHNm+54HbYaZCKqc9eeZCLRy3XqafQgwX2F7mofrbJG3g7EEb+lkiR+z2Lic2s3Zw==}
+ engines: {node: '>=12.0.0'}
+ peerDependencies:
+ typescript: '*'
+ webpack: ^5.0.0
+
+ resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==}
+ hasBin: true
+ peerDependencies:
+ '@swc/core': '>=1.2.50'
+ '@swc/wasm': '>=1.2.50'
+ '@types/node': '*'
+ typescript: '>=2.7'
+ peerDependenciesMeta:
+ '@swc/core':
+ optional: true
+ '@swc/wasm':
+ optional: true
+
+ resolution: {integrity: sha512-zbem3rfRS8BgeNK50Zz5SIQgXzLafiHjOwUAvk/38/o1jHn/V5QAgVUcz884or7WYcPaH3N2CIfUc2u0ul7UcA==}
+ engines: {node: '>=10.13.0'}
+
+ resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==}
+
+ resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
+
+ resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==}
+
+ resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==}
+
+ resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
+
+ resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==}
+ engines: {node: '>=14.17'}
+ hasBin: true
+
+ resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==}
+ engines: {node: '>=14.17'}
+ hasBin: true
+
+ resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==}
+
+ resolution: {integrity: sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==}
+ engines: {node: '>=0.8.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==}
+
+ resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
+
+ resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
+
+ resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
+
+ resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==}
+ engines: {node: '>=14.0'}
+
+ resolution: {integrity: sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==}
+ engines: {node: '>=18.17'}
+
+ resolution: {integrity: sha512-O0+af1Gs50lyH1nUu3ZyYS1cRh01Q/kUKatTOkSs7jukXE6/NebucDVxyiDsA9AQ4JC1V1jUH9EO8JX2nMDgGQ==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==}
+ engines: {node: '>= 0.8.0'}
+
+ resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==}
+ engines: {node: '>= 10.0.0'}
+
+ resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==}
+ hasBin: true
+ peerDependencies:
+ browserslist: '>= 4.21.0'
+
+ resolution: {integrity: sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==}
+
+ resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
+
+ resolution: {integrity: sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==}
+
+ resolution: {integrity: sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==}
+
+ resolution: {integrity: sha512-zRCJqdfYllRDA9bXUtx+vccyRqtJPKsw85f44zH7zPD28PIvjMqIgw9VwoTLV7xTBWZsbebUFVHU5ghQcWku2A==}
+ engines: {node: '>= 0.10.0'}
+ peerDependencies:
+ proxy-agent: ^5.0.0
+ peerDependenciesMeta:
+ proxy-agent:
+ optional: true
+
+ resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
+
+ resolution: {integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==}
+
+ resolution: {integrity: sha512-PYxZDA+6QtvRvm//++aGdmKG/cI07jNwbROz0Ql+VzFV1+Z0Dy55NI4zZ7RHc9KKpBePNFwoErqIuqQv/cjiTA==}
+ engines: {node: '>= 0.12.0'}
+
+ resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==}
+ engines: {node: '>= 0.4.0'}
+
+ resolution: {integrity: sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==}
+ hasBin: true
+
+ resolution: {integrity: sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==}
+ deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
+ hasBin: true
+
+ resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
+
+ resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==}
+ engines: {node: '>=10.12.0'}
+
+ resolution: {integrity: sha512-jOWVmzVceKlVVdwjNSenT4PbGghU0SBIizAev8ofZVgivk/TVHXSbNL8LP6M3spZvkR9/QolkyJavGSX5Cs0UA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==}
+ engines: {node: '>= 0.10'}
+
+ resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-4eRTBZljBfIISK1Vnt69Gvr2w/wc3U6Vtrw7qiN5iqYJPH7LElcYh/iU4XWhdCy2dZqv1ToMyYlybDylfG/5Vg==}
+
+ resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==}
+
+ resolution: {integrity: sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==}
+ engines: {node: '>=10.13.0'}
+
+ resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==}
+
+ resolution: {integrity: sha512-kfqDxt5dTB1JhqsCUQVFDj0rmY+4HLwGQIsLPbyrsN9y9WV/1oFDSx3BQ4GfCv9X+jVeQ7rouTqwK53rA/7t8A==}
+ engines: {node: '>=10.0.0'}
+
+ resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==}
+ engines: {node: '>= 14'}
+
+ resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
+
+ resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==}
+ engines: {node: '>=10.13.0'}
+
+ resolution: {integrity: sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==}
+ engines: {node: '>=10.13.0'}
+ hasBin: true
+ peerDependencies:
+ webpack-cli: '*'
+ peerDependenciesMeta:
+ webpack-cli:
+ optional: true
+
+ resolution: {integrity: sha512-z+n8Mrzn0UNoLJPBRrY8ZG6yo9xxNihlGvwvAbV8Nlnm4tTap2UjwIikGkhryC8gOmwrlvJfSUd+x1cK3ks1hA==}
+
+ resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==}
+ engines: {node: '>=16'}
+
+ resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
+
+ resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==}
+ hasBin: true
+
+ resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
+ engines: {node: '>= 8'}
+ hasBin: true
+
+ resolution: {integrity: sha512-iCRnKVvGxOQdsKhcQId2PXV1vV3J/sDPXKA4Oe9+Eti2nb2ESEsYHRYls/UjoUW3bIc5ZDO8dTH50A/5iVN+bw==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-RNGKj82nUPg3g5ygxkQl0R937xLyho1J24ItRCBTr/m1YnZkzJy1hUiHUJrc/VlsDQzsCnInEGSg3bci0Lmd4w==}
+ engines: {node: '>= 10.0.0'}
+
+ resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-zVyFsvE+mq9MCmwXUWHIcpfbrHHClZWZiVOzKSxNJruIcFn2RbY55zkhiAMMxM8zCVSmtNiViq8FsAZSFpMYag==}
+ engines: {node: '>=0.6.0'}
+
+ resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==}
+
+ resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
+
+ resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==}
+ engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
+
+ resolution: {integrity: sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==}
+ hasBin: true
+
+ resolution: {integrity: sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==}
+ engines: {node: '>=4.0.0'}
+
+ resolution: {integrity: sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==}
+ engines: {node: '>=4.0.0'}
+
+ resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==}
+ engines: {node: '>=4.0'}
+
+ resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
+ engines: {node: '>=0.4'}
+
+ resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
+
+ resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
+
+ resolution: {integrity: sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==}
+ engines: {node: '>= 14'}
+ hasBin: true
+
+ resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==}
+ engines: {node: '>= 14'}
+
+snapshots:
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/openapi-core': 1.0.2
+ '@alicloud/openplatform20191219': 2.0.0
+ '@alicloud/oss-client': 1.1.4
+ '@alicloud/oss-util': 0.0.1
+ '@alicloud/tea-fileform': 1.2.0
+ '@darabonba/typescript': 1.0.2
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/sts-sdk': 1.0.2
+ httpx: 2.3.3
+ ini: 1.3.8
+ json-bigint: 0.2.3
+ kitx: 1.3.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ httpx: 2.3.3
+ ini: 1.3.8
+ kitx: 2.2.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ moment: 2.30.1
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ moment: 2.30.1
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/darabonba-encode-util': 0.0.1
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/endpoint-util': 0.0.1
+ '@alicloud/openapi-client': 0.4.12
+ '@alicloud/openapi-util': 0.3.2
+ '@alicloud/tea-typescript': 1.8.0
+ '@alicloud/tea-util': 1.4.10
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/endpoint-util': 0.0.1
+ '@alicloud/openapi-client': 0.4.12
+ '@alicloud/openapi-util': 0.3.2
+ '@alicloud/tea-typescript': 1.8.0
+ '@alicloud/tea-util': 1.4.10
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ kitx: 2.2.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/credentials': 2.4.3
+ '@alicloud/darabonba-array': 0.1.0
+ '@alicloud/darabonba-encode-util': 0.0.2
+ '@alicloud/darabonba-map': 0.0.1
+ '@alicloud/darabonba-signature-util': 0.0.4
+ '@alicloud/darabonba-string': 1.0.3
+ '@alicloud/endpoint-util': 0.0.1
+ '@alicloud/gateway-spi': 0.0.8
+ '@alicloud/openapi-util': 0.3.2
+ '@alicloud/tea-typescript': 1.8.0
+ '@alicloud/tea-util': 1.4.10
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/credentials': 2.4.3
+ '@alicloud/tea-typescript': 1.8.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ httpx: 2.3.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/credentials': 2.4.3
+ '@alicloud/gateway-spi': 0.0.8
+ '@alicloud/openapi-util': 0.3.2
+ '@alicloud/tea-typescript': 1.8.0
+ '@alicloud/tea-util': 1.4.10
+ '@alicloud/tea-xml': 0.0.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/gateway-pop': 0.0.6
+ '@alicloud/gateway-spi': 0.0.8
+ '@darabonba/typescript': 1.0.2
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ '@alicloud/tea-util': 1.4.10
+ kitx: 2.2.0
+ sm3: 1.0.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ '@alicloud/tea-util': 1.4.10
+ kitx: 2.2.0
+ sm3: 1.0.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/endpoint-util': 0.0.1
+ '@alicloud/openapi-client': 0.4.12
+ '@alicloud/openapi-util': 0.2.9
+ '@alicloud/tea-typescript': 1.8.0
+ '@alicloud/tea-util': 1.4.10
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/credentials': 1.1.0
+ '@alicloud/tea-typescript': 1.8.0
+ '@types/mime': 2.0.3
+ '@types/xml2js': 0.4.14
+ int64-buffer: 0.99.1007
+ kitx: 2.2.0
+ mime: 2.6.0
+ xml2js: 0.4.23
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/credentials': 2.4.3
+ '@alicloud/oss-baseclient': 1.2.0
+ '@alicloud/oss-util': 0.0.3
+ '@alicloud/rpc-util': 0.0.1
+ '@alicloud/tea-fileform': 1.2.0
+ '@alicloud/tea-typescript': 1.8.0
+ '@alicloud/tea-util': 1.4.9
+ '@alicloud/tea-xml': 0.0.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ '@types/mime': 2.0.3
+ '@types/xml2js': 0.4.14
+ int64-buffer: 0.99.1007
+ kitx: 2.2.0
+ mime: 2.6.0
+ xml2js: 0.4.23
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ '@types/mime': 2.0.3
+ '@types/xml2js': 0.4.14
+ int64-buffer: 0.99.1007
+ kitx: 2.2.0
+ mime: 2.6.0
+ xml2js: 0.4.23
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ '@types/xml2js': 0.4.14
+ kitx: 2.2.0
+ xml2js: 0.4.23
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/http-core-sdk': 1.0.0
+ uuid: 3.4.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@types/node': 12.20.55
+ httpx: 2.3.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ '@darabonba/typescript': 1.0.2
+ kitx: 2.2.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ kitx: 2.2.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@alicloud/[email protected]':
+ dependencies:
+ '@alicloud/tea-typescript': 1.8.0
+ '@types/xml2js': 0.4.14
+ xml2js: 0.6.2
+ transitivePeerDependencies:
+ - supports-color
+
+ '@ampproject/[email protected]':
+ dependencies:
+ '@jridgewell/gen-mapping': 0.3.8
+ '@jridgewell/trace-mapping': 0.3.25
+
+ dependencies:
+ ajv: 8.12.0
+ ajv-formats: 2.1.1([email protected])
+ jsonc-parser: 3.2.1
+ picomatch: 4.0.1
+ rxjs: 7.8.1
+ source-map: 0.7.4
+ optionalDependencies:
+ chokidar: 3.6.0
+
+ dependencies:
+ '@angular-devkit/core': 17.3.11([email protected])
+ '@angular-devkit/schematics': 17.3.11([email protected])
+ ansi-colors: 4.1.3
+ inquirer: 9.2.15
+ symbol-observable: 4.0.0
+ yargs-parser: 21.1.1
+ transitivePeerDependencies:
+ - chokidar
+
+ dependencies:
+ '@angular-devkit/core': 17.3.11([email protected])
+ jsonc-parser: 3.2.1
+ magic-string: 0.30.8
+ ora: 5.4.1
+ rxjs: 7.8.1
+ transitivePeerDependencies:
+ - chokidar
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/helper-validator-identifier': 7.25.9
+ js-tokens: 4.0.0
+ picocolors: 1.1.1
+
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]':
+ dependencies:
+ '@ampproject/remapping': 2.3.0
+ '@babel/code-frame': 7.26.2
+ '@babel/generator': 7.26.5
+ '@babel/helper-compilation-targets': 7.26.5
+ '@babel/helper-module-transforms': 7.26.0(@babel/[email protected])
+ '@babel/helpers': 7.26.0
+ '@babel/parser': 7.26.5
+ '@babel/template': 7.25.9
+ '@babel/traverse': 7.26.5
+ '@babel/types': 7.26.5
+ convert-source-map: 2.0.0
+ debug: 4.4.0
+ gensync: 1.0.0-beta.2
+ json5: 2.2.3
+ semver: 6.3.1
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/parser': 7.26.5
+ '@babel/types': 7.26.5
+ '@jridgewell/gen-mapping': 0.3.8
+ '@jridgewell/trace-mapping': 0.3.25
+ jsesc: 3.1.0
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/compat-data': 7.26.5
+ '@babel/helper-validator-option': 7.25.9
+ browserslist: 4.24.4
+ lru-cache: 5.1.1
+ semver: 6.3.1
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/traverse': 7.26.5
+ '@babel/types': 7.26.5
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-module-imports': 7.25.9
+ '@babel/helper-validator-identifier': 7.25.9
+ '@babel/traverse': 7.26.5
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/template': 7.25.9
+ '@babel/types': 7.26.5
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/types': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/helper-plugin-utils': 7.26.5
+
+ '@babel/[email protected]':
+ optional: true
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/code-frame': 7.26.2
+ '@babel/parser': 7.26.5
+ '@babel/types': 7.26.5
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/code-frame': 7.26.2
+ '@babel/generator': 7.26.5
+ '@babel/parser': 7.26.5
+ '@babel/template': 7.25.9
+ '@babel/types': 7.26.5
+ debug: 4.4.0
+ globals: 11.12.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/helper-string-parser': 7.25.9
+ '@babel/helper-validator-identifier': 7.25.9
+
+ '@balena/[email protected]': {}
+
+ '@bcoe/[email protected]': {}
+
+ '@colors/[email protected]':
+ optional: true
+
+ '@cspotcode/[email protected]':
+ dependencies:
+ '@jridgewell/trace-mapping': 0.3.9
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optional: true
+
+ '@css-inline/[email protected]':
+ optionalDependencies:
+ '@css-inline/css-inline-android-arm-eabi': 0.14.1
+ '@css-inline/css-inline-android-arm64': 0.14.1
+ '@css-inline/css-inline-darwin-arm64': 0.14.1
+ '@css-inline/css-inline-darwin-x64': 0.14.1
+ '@css-inline/css-inline-linux-arm-gnueabihf': 0.14.1
+ '@css-inline/css-inline-linux-arm64-gnu': 0.14.1
+ '@css-inline/css-inline-linux-arm64-musl': 0.14.1
+ '@css-inline/css-inline-linux-x64-gnu': 0.14.1
+ '@css-inline/css-inline-linux-x64-musl': 0.14.1
+ '@css-inline/css-inline-win32-x64-msvc': 0.14.1
+
+ '@darabonba/[email protected]':
+ dependencies:
+ httpx: 2.3.3
+ lodash: 4.17.21
+ moment: 2.30.1
+ moment-timezone: 0.5.46
+ xml2js: 0.6.2
+ transitivePeerDependencies:
+ - supports-color
+
+ '@eslint-community/[email protected]([email protected])':
+ dependencies:
+ eslint: 8.57.1
+ eslint-visitor-keys: 3.4.3
+
+ '@eslint-community/[email protected]': {}
+
+ '@eslint/[email protected]':
+ dependencies:
+ ajv: 6.12.6
+ debug: 4.4.0
+ espree: 9.6.1
+ globals: 13.24.0
+ ignore: 5.3.2
+ import-fresh: 3.3.0
+ js-yaml: 4.1.0
+ minimatch: 3.1.2
+ strip-json-comments: 3.1.1
+ transitivePeerDependencies:
+ - supports-color
+
+ '@eslint/[email protected]': {}
+
+ '@fastify/[email protected]': {}
+
+ '@fidm/[email protected]': {}
+
+ dependencies:
+ '@fidm/asn1': 1.0.4
+ tweetnacl: 1.0.3
+
+ dependencies:
+ '@hapi/hoek': 9.3.0
+
+ '@hapi/[email protected]': {}
+
+ '@hapi/[email protected]': {}
+
+ dependencies:
+ '@hapi/address': 4.1.0
+ '@hapi/formula': 2.0.0
+ '@hapi/hoek': 9.3.0
+ '@hapi/pinpoint': 2.0.1
+ '@hapi/topo': 5.1.0
+
+ '@hapi/[email protected]': {}
+
+ dependencies:
+ '@hapi/hoek': 9.3.0
+
+ '@humanwhocodes/[email protected]':
+ dependencies:
+ '@humanwhocodes/object-schema': 2.0.3
+ debug: 4.4.0
+ minimatch: 3.1.2
+ transitivePeerDependencies:
+ - supports-color
+
+ '@humanwhocodes/[email protected]': {}
+
+ '@humanwhocodes/[email protected]': {}
+
+ '@ioredis/[email protected]': {}
+
+ '@isaacs/[email protected]':
+ dependencies:
+ string-width: 5.1.2
+ string-width-cjs: [email protected]
+ strip-ansi: 7.1.0
+ strip-ansi-cjs: [email protected]
+ wrap-ansi: 8.1.0
+ wrap-ansi-cjs: [email protected]
+
+ '@istanbuljs/[email protected]':
+ dependencies:
+ camelcase: 5.3.1
+ find-up: 4.1.0
+ get-package-type: 0.1.0
+ js-yaml: 3.14.1
+ resolve-from: 5.0.0
+
+ '@istanbuljs/[email protected]': {}
+
+ dependencies:
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ chalk: 4.1.2
+ jest-message-util: 29.7.0
+ jest-util: 29.7.0
+ slash: 3.0.0
+
+ dependencies:
+ '@jest/console': 29.7.0
+ '@jest/reporters': 29.7.0
+ '@jest/test-result': 29.7.0
+ '@jest/transform': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ ansi-escapes: 4.3.2
+ chalk: 4.1.2
+ ci-info: 3.9.0
+ exit: 0.1.2
+ graceful-fs: 4.2.11
+ jest-changed-files: 29.7.0
+ jest-haste-map: 29.7.0
+ jest-message-util: 29.7.0
+ jest-regex-util: 29.6.3
+ jest-resolve: 29.7.0
+ jest-resolve-dependencies: 29.7.0
+ jest-runner: 29.7.0
+ jest-runtime: 29.7.0
+ jest-snapshot: 29.7.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ jest-watcher: 29.7.0
+ micromatch: 4.0.8
+ pretty-format: 29.7.0
+ slash: 3.0.0
+ strip-ansi: 6.0.1
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+
+ dependencies:
+ '@jest/fake-timers': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ jest-mock: 29.7.0
+
+ dependencies:
+ jest-get-type: 29.6.3
+
+ dependencies:
+ expect: 29.7.0
+ jest-snapshot: 29.7.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@jest/types': 29.6.3
+ '@sinonjs/fake-timers': 10.3.0
+ '@types/node': 20.17.12
+ jest-message-util: 29.7.0
+ jest-mock: 29.7.0
+ jest-util: 29.7.0
+
+ dependencies:
+ '@jest/environment': 29.7.0
+ '@jest/expect': 29.7.0
+ '@jest/types': 29.6.3
+ jest-mock: 29.7.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@bcoe/v8-coverage': 0.2.3
+ '@jest/console': 29.7.0
+ '@jest/test-result': 29.7.0
+ '@jest/transform': 29.7.0
+ '@jest/types': 29.6.3
+ '@jridgewell/trace-mapping': 0.3.25
+ '@types/node': 20.17.12
+ chalk: 4.1.2
+ collect-v8-coverage: 1.0.2
+ exit: 0.1.2
+ glob: 7.2.3
+ graceful-fs: 4.2.11
+ istanbul-lib-coverage: 3.2.2
+ istanbul-lib-instrument: 6.0.3
+ istanbul-lib-report: 3.0.1
+ istanbul-lib-source-maps: 4.0.1
+ istanbul-reports: 3.1.7
+ jest-message-util: 29.7.0
+ jest-util: 29.7.0
+ jest-worker: 29.7.0
+ slash: 3.0.0
+ string-length: 4.0.2
+ strip-ansi: 6.0.1
+ v8-to-istanbul: 9.3.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@sinclair/typebox': 0.27.8
+
+ dependencies:
+ '@jridgewell/trace-mapping': 0.3.25
+ callsites: 3.1.0
+ graceful-fs: 4.2.11
+
+ dependencies:
+ '@jest/console': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/istanbul-lib-coverage': 2.0.6
+ collect-v8-coverage: 1.0.2
+
+ dependencies:
+ '@jest/test-result': 29.7.0
+ graceful-fs: 4.2.11
+ jest-haste-map: 29.7.0
+ slash: 3.0.0
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@jest/types': 29.6.3
+ '@jridgewell/trace-mapping': 0.3.25
+ babel-plugin-istanbul: 6.1.1
+ chalk: 4.1.2
+ convert-source-map: 2.0.0
+ fast-json-stable-stringify: 2.1.0
+ graceful-fs: 4.2.11
+ jest-haste-map: 29.7.0
+ jest-regex-util: 29.6.3
+ jest-util: 29.7.0
+ micromatch: 4.0.8
+ pirates: 4.0.6
+ slash: 3.0.0
+ write-file-atomic: 4.0.2
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@jest/schemas': 29.6.3
+ '@types/istanbul-lib-coverage': 2.0.6
+ '@types/istanbul-reports': 3.0.4
+ '@types/node': 20.17.12
+ '@types/yargs': 17.0.33
+ chalk: 4.1.2
+
+ '@jridgewell/[email protected]':
+ dependencies:
+ '@jridgewell/set-array': 1.2.1
+ '@jridgewell/sourcemap-codec': 1.5.0
+ '@jridgewell/trace-mapping': 0.3.25
+
+ '@jridgewell/[email protected]': {}
+
+ '@jridgewell/[email protected]': {}
+
+ '@jridgewell/[email protected]':
+ dependencies:
+ '@jridgewell/gen-mapping': 0.3.8
+ '@jridgewell/trace-mapping': 0.3.25
+
+ '@jridgewell/[email protected]': {}
+
+ '@jridgewell/[email protected]':
+ dependencies:
+ '@jridgewell/resolve-uri': 3.1.2
+ '@jridgewell/sourcemap-codec': 1.5.0
+
+ '@jridgewell/[email protected]':
+ dependencies:
+ '@jridgewell/resolve-uri': 3.1.2
+ '@jridgewell/sourcemap-codec': 1.5.0
+
+ '@ljharb/[email protected]':
+ dependencies:
+ call-bind: 1.0.8
+
+ '@lukeed/[email protected]': {}
+
+ '@microsoft/[email protected]': {}
+
+ '@mongodb-js/[email protected]':
+ dependencies:
+ sparse-bitfield: 3.0.3
+
+ '@msgpackr-extract/[email protected]':
+ optional: true
+
+ '@msgpackr-extract/[email protected]':
+ optional: true
+
+ '@msgpackr-extract/[email protected]':
+ optional: true
+
+ '@msgpackr-extract/[email protected]':
+ optional: true
+
+ '@msgpackr-extract/[email protected]':
+ optional: true
+
+ '@msgpackr-extract/[email protected]':
+ optional: true
+
+ dependencies:
+ '@css-inline/css-inline': 0.14.1
+ glob: 10.3.12
+ nodemailer: 7.0.3
+ optionalDependencies:
+ '@types/ejs': 3.1.5
+ '@types/mjml': 4.7.4
+ '@types/pug': 2.0.10
+ ejs: 3.1.10
+ handlebars: 4.7.8
+ liquidjs: 10.21.1
+ mjml: 4.15.3
+ preview-email: 3.1.0
+ pug: 3.0.3
+ transitivePeerDependencies:
+ - encoding
+
+ dependencies:
+ axios: 1.7.9
+ rxjs: 7.8.1
+
+ dependencies:
+ tslib: 2.8.1
+
+ dependencies:
+ bullmq: 5.52.2
+ tslib: 2.8.1
+
+ '@nestjs/[email protected]':
+ dependencies:
+ '@angular-devkit/core': 17.3.11([email protected])
+ '@angular-devkit/schematics': 17.3.11([email protected])
+ '@angular-devkit/schematics-cli': 17.3.11([email protected])
+ '@nestjs/schematics': 10.2.3([email protected])([email protected])
+ chalk: 4.1.2
+ chokidar: 3.6.0
+ cli-table3: 0.6.5
+ commander: 4.1.1
+ fork-ts-checker-webpack-plugin: 9.0.2([email protected])([email protected])
+ glob: 10.4.5
+ inquirer: 8.2.6
+ node-emoji: 1.11.0
+ ora: 5.4.1
+ tree-kill: 1.2.2
+ tsconfig-paths: 4.2.0
+ tsconfig-paths-webpack-plugin: 4.2.0
+ typescript: 5.7.2
+ webpack: 5.97.1
+ webpack-node-externals: 3.0.0
+ transitivePeerDependencies:
+ - esbuild
+ - uglify-js
+ - webpack-cli
+
+ dependencies:
+ iterare: 1.2.1
+ reflect-metadata: 0.2.2
+ rxjs: 7.8.1
+ tslib: 2.8.1
+ uid: 2.0.2
+ optionalDependencies:
+ class-transformer: 0.5.1
+ class-validator: 0.14.1
+
+ dependencies:
+ dotenv: 16.4.5
+ dotenv-expand: 10.0.0
+ lodash: 4.17.21
+ rxjs: 7.8.1
+
+ dependencies:
+ '@nuxtjs/opencollective': 0.3.2
+ fast-safe-stringify: 2.1.1
+ iterare: 1.2.1
+ path-to-regexp: 3.3.0
+ reflect-metadata: 0.2.2
+ rxjs: 7.8.1
+ tslib: 2.8.1
+ uid: 2.0.2
+ optionalDependencies:
+ transitivePeerDependencies:
+ - encoding
+
+ dependencies:
+ eventemitter2: 6.4.9
+
+ dependencies:
+ '@types/jsonwebtoken': 9.0.5
+ jsonwebtoken: 9.0.2
+
+ dependencies:
+ reflect-metadata: 0.2.2
+ optionalDependencies:
+ class-transformer: 0.5.1
+ class-validator: 0.14.1
+
+ dependencies:
+ mongoose: 8.9.4
+ rxjs: 7.8.1
+
+ dependencies:
+ body-parser: 1.20.3
+ cors: 2.8.5
+ express: 4.21.2
+ multer: 1.4.4-lts.1
+ tslib: 2.8.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ cron: 3.2.1
+ uuid: 11.0.3
+
+ dependencies:
+ '@angular-devkit/core': 17.3.11([email protected])
+ '@angular-devkit/schematics': 17.3.11([email protected])
+ comment-json: 4.2.5
+ jsonc-parser: 3.3.1
+ pluralize: 8.0.0
+ typescript: 5.7.2
+ transitivePeerDependencies:
+ - chokidar
+
+ dependencies:
+ '@angular-devkit/core': 17.3.11([email protected])
+ '@angular-devkit/schematics': 17.3.11([email protected])
+ comment-json: 4.2.5
+ jsonc-parser: 3.3.1
+ pluralize: 8.0.0
+ typescript: 5.7.3
+ transitivePeerDependencies:
+ - chokidar
+
+ dependencies:
+ '@microsoft/tsdoc': 0.15.1
+ js-yaml: 4.1.0
+ lodash: 4.17.21
+ path-to-regexp: 3.3.0
+ reflect-metadata: 0.2.2
+ swagger-ui-dist: 5.18.2
+ optionalDependencies:
+ class-transformer: 0.5.1
+ class-validator: 0.14.1
+
+ dependencies:
+ tslib: 2.8.1
+ optionalDependencies:
+
+ '@nodelib/[email protected]':
+ dependencies:
+ '@nodelib/fs.stat': 2.0.5
+ run-parallel: 1.2.0
+
+ '@nodelib/[email protected]': {}
+
+ '@nodelib/[email protected]':
+ dependencies:
+ '@nodelib/fs.scandir': 2.1.5
+ fastq: 1.18.0
+
+ '@nuxtjs/[email protected]':
+ dependencies:
+ chalk: 4.1.2
+ consola: 2.15.3
+ node-fetch: 2.7.0
+ transitivePeerDependencies:
+ - encoding
+
+ '@one-ini/[email protected]':
+ optional: true
+
+ '@pkgjs/[email protected]':
+ optional: true
+
+ '@pkgr/[email protected]': {}
+
+ dependencies:
+ '@redis/client': 1.6.1
+
+ '@redis/[email protected]':
+ dependencies:
+ cluster-key-slot: 1.1.2
+ generic-pool: 3.9.0
+ yallist: 4.0.0
+
+ dependencies:
+ '@redis/client': 1.6.1
+
+ dependencies:
+ '@redis/client': 1.6.1
+
+ dependencies:
+ '@redis/client': 1.6.1
+
+ dependencies:
+ '@redis/client': 1.6.1
+
+ '@scarf/[email protected]': {}
+
+ '@selderee/[email protected]':
+ dependencies:
+ domhandler: 5.0.3
+ selderee: 0.11.0
+ optional: true
+
+ '@sinclair/[email protected]': {}
+
+ '@sinonjs/[email protected]':
+ dependencies:
+ type-detect: 4.0.8
+
+ '@sinonjs/[email protected]':
+ dependencies:
+ '@sinonjs/commons': 3.0.1
+
+ '@testcontainers/[email protected]':
+ dependencies:
+ testcontainers: 10.16.0
+ transitivePeerDependencies:
+ - bare-buffer
+ - supports-color
+
+ '@testcontainers/[email protected]':
+ dependencies:
+ testcontainers: 10.16.0
+ transitivePeerDependencies:
+ - bare-buffer
+ - supports-color
+
+ '@tsconfig/[email protected]': {}
+
+ '@tsconfig/[email protected]': {}
+
+ '@tsconfig/[email protected]': {}
+
+ '@tsconfig/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@babel/parser': 7.26.5
+ '@babel/types': 7.26.5
+ '@types/babel__generator': 7.6.8
+ '@types/babel__template': 7.4.4
+ '@types/babel__traverse': 7.20.6
+
+ '@types/[email protected]':
+ dependencies:
+ '@babel/types': 7.26.5
+
+ '@types/[email protected]':
+ dependencies:
+ '@babel/parser': 7.26.5
+ '@babel/types': 7.26.5
+
+ '@types/[email protected]':
+ dependencies:
+ '@babel/types': 7.26.5
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/connect': 3.4.38
+ '@types/node': 20.17.12
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+ '@types/ssh2': 1.15.4
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/docker-modem': 3.0.6
+ '@types/node': 20.17.12
+ '@types/ssh2': 1.15.4
+
+ '@types/[email protected]':
+ optional: true
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/eslint': 9.6.1
+ '@types/estree': 1.0.6
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/estree': 1.0.6
+ '@types/json-schema': 7.0.15
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+ '@types/qs': 6.14.0
+ '@types/range-parser': 1.2.7
+ '@types/send': 0.17.4
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/body-parser': 1.19.5
+ '@types/express-serve-static-core': 4.19.6
+ '@types/qs': 6.14.0
+ '@types/serve-static': 1.15.7
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/istanbul-lib-coverage': 2.0.6
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/istanbul-lib-report': 3.0.3
+
+ '@types/[email protected]':
+ dependencies:
+ expect: 29.7.0
+ pretty-format: 29.7.0
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ optional: true
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/mjml-core': 4.15.1
+ optional: true
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/express': 4.17.21
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+ form-data: 4.0.3
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ undici-types: 5.26.5
+
+ '@types/[email protected]':
+ dependencies:
+ undici-types: 6.19.8
+
+ '@types/[email protected]':
+ dependencies:
+ undici-types: 6.20.0
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+
+ '@types/[email protected]':
+ optional: true
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/mime': 1.3.5
+ '@types/node': 20.17.12
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/http-errors': 2.0.4
+ '@types/node': 20.17.12
+ '@types/send': 0.17.4
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+ '@types/ssh2-streams': 0.1.12
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 18.19.71
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/cookiejar': 2.1.5
+ '@types/methods': 1.1.4
+ '@types/node': 20.17.12
+ form-data: 4.0.3
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/methods': 1.1.4
+ '@types/superagent': 8.1.9
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/webidl-conversions': 7.0.3
+
+ '@types/[email protected]':
+ dependencies:
+ xml-js: 1.6.11
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 20.17.12
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/yargs-parser': 21.0.3
+
+ dependencies:
+ '@eslint-community/regexpp': 4.12.1
+ '@typescript-eslint/parser': 8.19.1([email protected])([email protected])
+ '@typescript-eslint/scope-manager': 8.19.1
+ '@typescript-eslint/type-utils': 8.19.1([email protected])([email protected])
+ '@typescript-eslint/utils': 8.19.1([email protected])([email protected])
+ '@typescript-eslint/visitor-keys': 8.19.1
+ eslint: 8.57.1
+ graphemer: 1.4.0
+ ignore: 5.3.2
+ natural-compare: 1.4.0
+ ts-api-utils: 2.0.0([email protected])
+ typescript: 5.7.3
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@typescript-eslint/scope-manager': 8.19.1
+ '@typescript-eslint/types': 8.19.1
+ '@typescript-eslint/typescript-estree': 8.19.1([email protected])
+ '@typescript-eslint/visitor-keys': 8.19.1
+ debug: 4.4.0
+ eslint: 8.57.1
+ typescript: 5.7.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@typescript-eslint/[email protected]':
+ dependencies:
+ '@typescript-eslint/types': 8.19.1
+ '@typescript-eslint/visitor-keys': 8.19.1
+
+ dependencies:
+ '@typescript-eslint/typescript-estree': 8.19.1([email protected])
+ '@typescript-eslint/utils': 8.19.1([email protected])([email protected])
+ debug: 4.4.0
+ eslint: 8.57.1
+ ts-api-utils: 2.0.0([email protected])
+ typescript: 5.7.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@typescript-eslint/[email protected]': {}
+
+ '@typescript-eslint/[email protected]([email protected])':
+ dependencies:
+ '@typescript-eslint/types': 8.19.1
+ '@typescript-eslint/visitor-keys': 8.19.1
+ debug: 4.4.0
+ fast-glob: 3.3.3
+ is-glob: 4.0.3
+ minimatch: 9.0.5
+ semver: 7.6.3
+ ts-api-utils: 2.0.0([email protected])
+ typescript: 5.7.3
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@eslint-community/eslint-utils': 4.4.1([email protected])
+ '@typescript-eslint/scope-manager': 8.19.1
+ '@typescript-eslint/types': 8.19.1
+ '@typescript-eslint/typescript-estree': 8.19.1([email protected])
+ eslint: 8.57.1
+ typescript: 5.7.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@typescript-eslint/[email protected]':
+ dependencies:
+ '@typescript-eslint/types': 8.19.1
+ eslint-visitor-keys: 4.2.0
+
+ '@ungap/[email protected]': {}
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@webassemblyjs/helper-numbers': 1.13.2
+ '@webassemblyjs/helper-wasm-bytecode': 1.13.2
+
+ '@webassemblyjs/[email protected]': {}
+
+ '@webassemblyjs/[email protected]': {}
+
+ '@webassemblyjs/[email protected]': {}
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@webassemblyjs/floating-point-hex-parser': 1.13.2
+ '@webassemblyjs/helper-api-error': 1.13.2
+ '@xtuc/long': 4.2.2
+
+ '@webassemblyjs/[email protected]': {}
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@webassemblyjs/ast': 1.14.1
+ '@webassemblyjs/helper-buffer': 1.14.1
+ '@webassemblyjs/helper-wasm-bytecode': 1.13.2
+ '@webassemblyjs/wasm-gen': 1.14.1
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@xtuc/ieee754': 1.2.0
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@xtuc/long': 4.2.2
+
+ '@webassemblyjs/[email protected]': {}
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@webassemblyjs/ast': 1.14.1
+ '@webassemblyjs/helper-buffer': 1.14.1
+ '@webassemblyjs/helper-wasm-bytecode': 1.13.2
+ '@webassemblyjs/helper-wasm-section': 1.14.1
+ '@webassemblyjs/wasm-gen': 1.14.1
+ '@webassemblyjs/wasm-opt': 1.14.1
+ '@webassemblyjs/wasm-parser': 1.14.1
+ '@webassemblyjs/wast-printer': 1.14.1
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@webassemblyjs/ast': 1.14.1
+ '@webassemblyjs/helper-wasm-bytecode': 1.13.2
+ '@webassemblyjs/ieee754': 1.13.2
+ '@webassemblyjs/leb128': 1.13.2
+ '@webassemblyjs/utf8': 1.13.2
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@webassemblyjs/ast': 1.14.1
+ '@webassemblyjs/helper-buffer': 1.14.1
+ '@webassemblyjs/wasm-gen': 1.14.1
+ '@webassemblyjs/wasm-parser': 1.14.1
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@webassemblyjs/ast': 1.14.1
+ '@webassemblyjs/helper-api-error': 1.13.2
+ '@webassemblyjs/helper-wasm-bytecode': 1.13.2
+ '@webassemblyjs/ieee754': 1.13.2
+ '@webassemblyjs/leb128': 1.13.2
+ '@webassemblyjs/utf8': 1.13.2
+
+ '@webassemblyjs/[email protected]':
+ dependencies:
+ '@webassemblyjs/ast': 1.14.1
+ '@xtuc/long': 4.2.2
+
+ '@xtuc/[email protected]': {}
+
+ '@xtuc/[email protected]': {}
+
+ optional: true
+
+ dependencies:
+ event-target-shim: 5.0.1
+
+ dependencies:
+ mime-types: 2.1.35
+ negotiator: 0.6.3
+
+ dependencies:
+ mime-types: 3.0.1
+ negotiator: 1.0.0
+
+ dependencies:
+ acorn: 8.14.0
+
+ dependencies:
+ acorn: 8.14.0
+
+ optional: true
+
+
+
+
+
+ dependencies:
+ debug: 4.4.0
+ transitivePeerDependencies:
+ - supports-color
+
+
+ dependencies:
+ humanize-ms: 1.2.1
+
+ dependencies:
+ humanize-ms: 1.2.1
+
+ optionalDependencies:
+ ajv: 8.12.0
+
+ optionalDependencies:
+ ajv: 8.17.1
+
+ dependencies:
+ ajv: 6.12.6
+
+ dependencies:
+ ajv: 8.17.1
+ fast-deep-equal: 3.1.3
+
+ dependencies:
+ fast-deep-equal: 3.1.3
+ fast-json-stable-stringify: 2.1.0
+ json-schema-traverse: 0.4.1
+ uri-js: 4.4.1
+
+ dependencies:
+ fast-deep-equal: 3.1.3
+ json-schema-traverse: 1.0.0
+ require-from-string: 2.0.2
+ uri-js: 4.4.1
+
+ dependencies:
+ fast-deep-equal: 3.1.3
+ fast-uri: 3.0.5
+ json-schema-traverse: 1.0.0
+ require-from-string: 2.0.2
+
+ dependencies:
+ esprima: 1.2.5
+ estraverse: 1.9.3
+ optional: true
+
+ dependencies:
+ address: 1.2.2
+ agentkeepalive: 3.5.3
+ bowser: 1.9.4
+ copy-to: 2.0.1
+ dateformat: 2.2.0
+ debug: 4.4.0
+ destroy: 1.2.0
+ end-or-error: 1.0.1
+ get-ready: 1.0.0
+ humanize-ms: 1.2.1
+ is-type-of: 1.4.0
+ js-base64: 2.6.4
+ jstoxml: 2.2.9
+ lodash: 4.17.21
+ merge-descriptors: 1.0.3
+ mime: 2.6.0
+ platform: 1.3.6
+ pump: 3.0.2
+ qs: 6.14.0
+ sdk-base: 2.0.1
+ stream-http: 2.8.2
+ stream-wormhole: 1.1.0
+ urllib: 2.44.0
+ utility: 1.18.0
+ xml2js: 0.6.2
+ transitivePeerDependencies:
+ - proxy-agent
+ - supports-color
+
+
+ dependencies:
+ type-fest: 0.21.3
+
+
+
+ dependencies:
+ color-convert: 2.0.1
+
+
+
+
+ dependencies:
+ normalize-path: 3.0.0
+ picomatch: 2.3.1
+
+ dependencies:
+ sylvester: 0.0.12
+
+
+ dependencies:
+ glob: 10.4.5
+ graceful-fs: 4.2.11
+ is-stream: 2.0.1
+ lazystream: 1.0.1
+ lodash: 4.17.21
+ normalize-path: 3.0.0
+ readable-stream: 4.7.0
+
+ dependencies:
+ archiver-utils: 5.0.2
+ async: 3.2.6
+ buffer-crc32: 1.0.0
+ readable-stream: 4.7.0
+ readdir-glob: 1.1.3
+ tar-stream: 3.1.7
+ zip-stream: 6.0.1
+
+
+ dependencies:
+ sprintf-js: 1.0.3
+
+
+
+
+
+ dependencies:
+ safer-buffer: 2.1.2
+
+ optional: true
+
+
+
+
+ dependencies:
+ follow-redirects: 1.15.9
+ form-data: 4.0.3
+ proxy-from-env: 1.1.0
+ transitivePeerDependencies:
+ - debug
+
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@jest/transform': 29.7.0
+ '@types/babel__core': 7.20.5
+ babel-plugin-istanbul: 6.1.1
+ babel-preset-jest: 29.6.3(@babel/[email protected])
+ chalk: 4.1.2
+ graceful-fs: 4.2.11
+ slash: 3.0.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@babel/helper-plugin-utils': 7.26.5
+ '@istanbuljs/load-nyc-config': 1.1.0
+ '@istanbuljs/schema': 0.1.3
+ istanbul-lib-instrument: 5.2.1
+ test-exclude: 6.0.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@babel/template': 7.25.9
+ '@babel/types': 7.26.5
+ '@types/babel__core': 7.20.5
+ '@types/babel__traverse': 7.20.6
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/plugin-syntax-async-generators': 7.8.4(@babel/[email protected])
+ '@babel/plugin-syntax-bigint': 7.8.3(@babel/[email protected])
+ '@babel/plugin-syntax-class-properties': 7.12.13(@babel/[email protected])
+ '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/[email protected])
+ '@babel/plugin-syntax-import-attributes': 7.26.0(@babel/[email protected])
+ '@babel/plugin-syntax-import-meta': 7.10.4(@babel/[email protected])
+ '@babel/plugin-syntax-json-strings': 7.8.3(@babel/[email protected])
+ '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/[email protected])
+ '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/[email protected])
+ '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/[email protected])
+ '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/[email protected])
+ '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/[email protected])
+ '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/[email protected])
+ '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/[email protected])
+ '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/[email protected])
+
+ dependencies:
+ '@babel/core': 7.26.0
+ babel-plugin-jest-hoist: 29.6.3
+ babel-preset-current-node-syntax: 1.1.0(@babel/[email protected])
+
+ dependencies:
+ '@babel/types': 7.26.5
+ optional: true
+
+
+ optional: true
+
+ dependencies:
+ bare-events: 2.5.4
+ bare-path: 3.0.0
+ bare-stream: 2.6.4([email protected])
+ transitivePeerDependencies:
+ - bare-buffer
+ optional: true
+
+ optional: true
+
+ dependencies:
+ bare-os: 3.4.0
+ optional: true
+
+ dependencies:
+ streamx: 2.21.1
+ optionalDependencies:
+ bare-events: 2.5.4
+ optional: true
+
+
+ dependencies:
+ safe-buffer: 5.1.2
+
+ dependencies:
+ tweetnacl: 0.14.5
+
+
+
+
+ dependencies:
+ buffer: 5.7.1
+ inherits: 2.0.4
+ readable-stream: 3.6.2
+
+ dependencies:
+ bytes: 3.1.2
+ content-type: 1.0.5
+ debug: 2.6.9
+ depd: 2.0.0
+ destroy: 1.2.0
+ http-errors: 2.0.0
+ iconv-lite: 0.4.24
+ on-finished: 2.4.1
+ qs: 6.13.0
+ raw-body: 2.5.2
+ type-is: 1.6.18
+ unpipe: 1.0.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ bytes: 3.1.2
+ content-type: 1.0.5
+ debug: 4.4.0
+ http-errors: 2.0.0
+ iconv-lite: 0.6.3
+ on-finished: 2.4.1
+ qs: 6.14.0
+ raw-body: 3.0.0
+ type-is: 2.0.1
+ transitivePeerDependencies:
+ - supports-color
+
+
+
+ dependencies:
+ balanced-match: 1.0.2
+ concat-map: 0.0.1
+
+ dependencies:
+ balanced-match: 1.0.2
+
+ dependencies:
+ fill-range: 7.1.1
+
+ dependencies:
+ caniuse-lite: 1.0.30001692
+ electron-to-chromium: 1.5.80
+ node-releases: 2.0.19
+ update-browserslist-db: 1.1.2([email protected])
+
+ dependencies:
+ fast-json-stable-stringify: 2.1.0
+
+ dependencies:
+ node-int64: 0.4.0
+
+
+
+
+
+ dependencies:
+ base64-js: 1.5.1
+ ieee754: 1.2.1
+
+ dependencies:
+ base64-js: 1.5.1
+ ieee754: 1.2.1
+
+ optional: true
+
+
+ dependencies:
+ cron-parser: 4.9.0
+ ioredis: 5.4.2
+ msgpackr: 1.11.3
+ node-abort-controller: 3.1.1
+ semver: 7.6.3
+ tslib: 2.8.1
+ uuid: 9.0.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ streamsearch: 1.1.0
+
+
+
+ dependencies:
+ es-errors: 1.3.0
+ function-bind: 1.1.2
+
+ dependencies:
+ call-bind-apply-helpers: 1.0.1
+ es-define-property: 1.0.1
+ get-intrinsic: 1.2.7
+ set-function-length: 1.2.2
+
+ dependencies:
+ call-bind-apply-helpers: 1.0.1
+ get-intrinsic: 1.2.7
+
+
+ dependencies:
+ no-case: 2.3.2
+ upper-case: 1.1.3
+ optional: true
+
+
+
+
+ dependencies:
+ ansi-styles: 4.3.0
+ supports-color: 7.2.0
+ optional: true
+
+ dependencies:
+ ansi-styles: 4.3.0
+ supports-color: 7.2.0
+
+
+
+ dependencies:
+ is-regex: 1.2.1
+ optional: true
+
+
+ dependencies:
+ boolbase: 1.0.0
+ css-select: 5.1.0
+ css-what: 6.1.0
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+
+ dependencies:
+ cheerio-select: 2.1.0
+ dom-serializer: 2.0.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+ encoding-sniffer: 0.2.0
+ htmlparser2: 9.1.0
+ parse5: 7.3.0
+ parse5-htmlparser2-tree-adapter: 7.1.0
+ parse5-parser-stream: 7.1.2
+ undici: 6.21.3
+ whatwg-mimetype: 4.0.0
+
+ dependencies:
+ cheerio-select: 2.1.0
+ dom-serializer: 2.0.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+ htmlparser2: 8.0.2
+ parse5: 7.3.0
+ parse5-htmlparser2-tree-adapter: 7.1.0
+ optional: true
+
+ dependencies:
+ anymatch: 3.1.3
+ braces: 3.0.3
+ glob-parent: 5.1.2
+ is-binary-path: 2.1.0
+ is-glob: 4.0.3
+ normalize-path: 3.0.0
+ readdirp: 3.6.0
+ optionalDependencies:
+ fsevents: 2.3.3
+
+
+
+
+
+
+ dependencies:
+ '@types/validator': 13.12.2
+ libphonenumber-js: 1.11.17
+ validator: 13.12.0
+
+ dependencies:
+ source-map: 0.6.1
+ optional: true
+
+ dependencies:
+ restore-cursor: 3.1.0
+
+
+ dependencies:
+ string-width: 4.2.3
+ optionalDependencies:
+ '@colors/colors': 1.5.0
+
+
+
+ dependencies:
+ string-width: 4.2.3
+ strip-ansi: 6.0.1
+ wrap-ansi: 7.0.0
+
+
+
+
+
+ dependencies:
+ color-name: 1.1.4
+
+
+ dependencies:
+ delayed-stream: 1.0.0
+
+ optional: true
+
+
+
+ optional: true
+
+ dependencies:
+ array-timsort: 1.0.3
+ core-util-is: 1.0.3
+ esprima: 4.0.1
+ has-own-prop: 2.0.0
+ repeat-string: 1.6.1
+
+
+ dependencies:
+ crc-32: 1.2.2
+ crc32-stream: 6.0.0
+ is-stream: 2.0.1
+ normalize-path: 3.0.0
+ readable-stream: 4.7.0
+
+
+ dependencies:
+ buffer-from: 1.1.2
+ inherits: 2.0.4
+ readable-stream: 2.3.8
+ typedarray: 0.0.6
+
+ dependencies:
+ ini: 1.3.8
+ proto-list: 1.2.4
+ optional: true
+
+
+ dependencies:
+ '@babel/parser': 7.26.5
+ '@babel/types': 7.26.5
+ optional: true
+
+ dependencies:
+ safe-buffer: 5.2.1
+
+ dependencies:
+ safe-buffer: 5.2.1
+
+
+
+
+
+
+
+
+
+
+
+ dependencies:
+ object-assign: 4.1.1
+ vary: 1.1.2
+
+
+ dependencies:
+ import-fresh: 3.3.0
+ js-yaml: 4.1.0
+ parse-json: 5.2.0
+ path-type: 4.0.0
+ optionalDependencies:
+ typescript: 5.7.2
+
+ dependencies:
+ buildcheck: 0.0.6
+ nan: 2.22.0
+ optional: true
+
+
+ dependencies:
+ crc-32: 1.2.2
+ readable-stream: 4.7.0
+
+ dependencies:
+ '@jest/types': 29.6.3
+ chalk: 4.1.2
+ exit: 0.1.2
+ graceful-fs: 4.2.11
+ jest-util: 29.7.0
+ prompts: 2.4.2
+ transitivePeerDependencies:
+ - '@types/node'
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+
+
+ dependencies:
+ luxon: 3.5.0
+
+ dependencies:
+ '@types/luxon': 3.4.2
+ luxon: 3.5.0
+
+ dependencies:
+ nice-try: 1.0.5
+ path-key: 2.0.1
+ semver: 5.7.2
+ shebang-command: 1.2.0
+ which: 1.3.1
+ optional: true
+
+ dependencies:
+ path-key: 3.1.1
+ shebang-command: 2.0.0
+ which: 2.0.2
+
+ dependencies:
+ boolbase: 1.0.0
+ css-what: 6.1.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+ nth-check: 2.1.1
+
+
+
+ dependencies:
+ ms: 2.0.0
+
+ dependencies:
+ ms: 2.1.3
+
+
+ optional: true
+
+
+
+ dependencies:
+ os-name: 1.0.3
+
+ dependencies:
+ clone: 1.0.4
+
+ dependencies:
+ es-define-property: 1.0.1
+ es-errors: 1.3.0
+ gopd: 1.2.0
+
+
+
+
+
+ optional: true
+
+ optional: true
+
+
+ optional: true
+
+ dependencies:
+ asap: 2.0.6
+ wrappy: 1.0.2
+
+
+
+
+ dependencies:
+ escape-string-applescript: 1.0.0
+ run-applescript: 3.2.0
+ optional: true
+
+ dependencies:
+ yaml: 2.7.0
+
+ dependencies:
+ debug: 4.4.0
+ readable-stream: 3.6.2
+ split-ca: 1.0.1
+ ssh2: 1.16.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@balena/dockerignore': 1.0.2
+ docker-modem: 3.0.8
+ tar-fs: 2.0.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ esutils: 2.0.3
+
+ optional: true
+
+ dependencies:
+ domelementtype: 2.3.0
+ domhandler: 4.3.1
+ entities: 2.2.0
+ optional: true
+
+ dependencies:
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+ entities: 4.5.0
+
+
+ dependencies:
+ domelementtype: 2.3.0
+ optional: true
+
+ dependencies:
+ domelementtype: 2.3.0
+ optional: true
+
+ dependencies:
+ domelementtype: 2.3.0
+
+ dependencies:
+ dom-serializer: 1.4.1
+ domelementtype: 2.3.0
+ domhandler: 4.3.1
+ optional: true
+
+ dependencies:
+ dom-serializer: 2.0.0
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+
+
+
+ dependencies:
+ call-bind-apply-helpers: 1.0.1
+ es-errors: 1.3.0
+ gopd: 1.2.0
+
+
+ dependencies:
+ safe-buffer: 5.2.1
+
+ dependencies:
+ '@one-ini/wasm': 0.1.1
+ commander: 10.0.1
+ minimatch: 9.0.1
+ semver: 7.6.3
+ optional: true
+
+
+ dependencies:
+ jake: 10.9.2
+
+
+
+
+
+
+
+ optional: true
+
+ dependencies:
+ iconv-lite: 0.6.3
+ whatwg-encoding: 3.1.1
+
+ dependencies:
+ once: 1.4.0
+
+
+ dependencies:
+ graceful-fs: 4.2.11
+ tapable: 2.2.1
+
+ optional: true
+
+
+
+ dependencies:
+ is-arrayish: 0.2.1
+
+
+
+
+ dependencies:
+ es-errors: 1.3.0
+
+ dependencies:
+ es-errors: 1.3.0
+ get-intrinsic: 1.2.7
+ has-tostringtag: 1.0.2
+ hasown: 2.0.2
+
+
+ optional: true
+
+
+ optional: true
+
+
+
+
+ dependencies:
+ eslint: 8.57.1
+
+ dependencies:
+ eslint: 8.57.1
+ prettier: 3.4.2
+ prettier-linter-helpers: 1.0.0
+ synckit: 0.9.2
+ optionalDependencies:
+ '@types/eslint': 9.6.1
+ eslint-config-prettier: 9.1.0([email protected])
+
+ dependencies:
+ esrecurse: 4.3.0
+ estraverse: 4.3.0
+
+ dependencies:
+ esrecurse: 4.3.0
+ estraverse: 5.3.0
+
+
+
+ dependencies:
+ '@eslint-community/eslint-utils': 4.4.1([email protected])
+ '@eslint-community/regexpp': 4.12.1
+ '@eslint/eslintrc': 2.1.4
+ '@eslint/js': 8.57.1
+ '@humanwhocodes/config-array': 0.13.0
+ '@humanwhocodes/module-importer': 1.0.1
+ '@nodelib/fs.walk': 1.2.8
+ '@ungap/structured-clone': 1.2.1
+ ajv: 6.12.6
+ chalk: 4.1.2
+ cross-spawn: 7.0.6
+ debug: 4.4.0
+ doctrine: 3.0.0
+ escape-string-regexp: 4.0.0
+ eslint-scope: 7.2.2
+ eslint-visitor-keys: 3.4.3
+ espree: 9.6.1
+ esquery: 1.6.0
+ esutils: 2.0.3
+ fast-deep-equal: 3.1.3
+ file-entry-cache: 6.0.1
+ find-up: 5.0.0
+ glob-parent: 6.0.2
+ globals: 13.24.0
+ graphemer: 1.4.0
+ ignore: 5.3.2
+ imurmurhash: 0.1.4
+ is-glob: 4.0.3
+ is-path-inside: 3.0.3
+ js-yaml: 4.1.0
+ json-stable-stringify-without-jsonify: 1.0.1
+ levn: 0.4.1
+ lodash.merge: 4.6.2
+ minimatch: 3.1.2
+ natural-compare: 1.4.0
+ optionator: 0.9.4
+ strip-ansi: 6.0.1
+ text-table: 0.2.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ acorn: 8.14.0
+ acorn-jsx: 5.3.2([email protected])
+ eslint-visitor-keys: 3.4.3
+
+ optional: true
+
+
+ dependencies:
+ estraverse: 5.3.0
+
+ dependencies:
+ estraverse: 5.3.0
+
+ optional: true
+
+
+
+
+
+
+
+
+
+ dependencies:
+ cross-spawn: 6.0.6
+ get-stream: 3.0.0
+ is-stream: 1.1.0
+ npm-run-path: 2.0.2
+ p-finally: 1.0.0
+ signal-exit: 3.0.7
+ strip-eof: 1.0.0
+ optional: true
+
+ dependencies:
+ cross-spawn: 7.0.6
+ get-stream: 6.0.1
+ human-signals: 2.1.0
+ is-stream: 2.0.1
+ merge-stream: 2.0.0
+ npm-run-path: 4.0.1
+ onetime: 5.1.2
+ signal-exit: 3.0.7
+ strip-final-newline: 2.0.0
+
+
+ dependencies:
+ '@jest/expect-utils': 29.7.0
+ jest-get-type: 29.6.3
+ jest-matcher-utils: 29.7.0
+ jest-message-util: 29.7.0
+ jest-util: 29.7.0
+
+ dependencies:
+ cookie: 0.7.2
+ cookie-signature: 1.0.7
+ debug: 2.6.9
+ depd: 2.0.0
+ on-headers: 1.0.2
+ parseurl: 1.3.3
+ safe-buffer: 5.2.1
+ uid-safe: 2.1.5
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ accepts: 1.3.8
+ array-flatten: 1.1.1
+ body-parser: 1.20.3
+ content-disposition: 0.5.4
+ content-type: 1.0.5
+ cookie: 0.7.1
+ cookie-signature: 1.0.6
+ debug: 2.6.9
+ depd: 2.0.0
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ etag: 1.8.1
+ finalhandler: 1.3.1
+ fresh: 0.5.2
+ http-errors: 2.0.0
+ merge-descriptors: 1.0.3
+ methods: 1.1.2
+ on-finished: 2.4.1
+ parseurl: 1.3.3
+ path-to-regexp: 0.1.12
+ proxy-addr: 2.0.7
+ qs: 6.13.0
+ range-parser: 1.2.1
+ safe-buffer: 5.2.1
+ send: 0.19.0
+ serve-static: 1.16.2
+ setprototypeof: 1.2.0
+ statuses: 2.0.1
+ type-is: 1.6.18
+ utils-merge: 1.0.1
+ vary: 1.1.2
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ accepts: 2.0.0
+ body-parser: 2.2.0
+ content-disposition: 1.0.0
+ content-type: 1.0.5
+ cookie: 0.7.1
+ cookie-signature: 1.2.2
+ debug: 4.4.0
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ etag: 1.8.1
+ finalhandler: 2.1.0
+ fresh: 2.0.0
+ http-errors: 2.0.0
+ merge-descriptors: 2.0.0
+ mime-types: 3.0.1
+ on-finished: 2.4.1
+ once: 1.4.0
+ parseurl: 1.3.3
+ proxy-addr: 2.0.7
+ qs: 6.14.0
+ range-parser: 1.2.1
+ router: 2.2.0
+ send: 1.2.0
+ serve-static: 2.2.0
+ statuses: 2.0.1
+ type-is: 2.0.1
+ vary: 1.1.2
+ transitivePeerDependencies:
+ - supports-color
+
+ optional: true
+
+ dependencies:
+ is-extendable: 0.1.1
+
+
+ dependencies:
+ chardet: 0.7.0
+ iconv-lite: 0.4.24
+ tmp: 0.0.33
+
+
+
+
+ dependencies:
+ '@nodelib/fs.stat': 2.0.5
+ '@nodelib/fs.walk': 1.2.8
+ glob-parent: 5.1.2
+ merge2: 1.4.1
+ micromatch: 4.0.8
+
+
+
+
+
+ dependencies:
+ strnum: 2.0.5
+
+ dependencies:
+ reusify: 1.0.4
+
+ dependencies:
+ bser: 2.1.1
+
+ dependencies:
+ escape-string-regexp: 1.0.5
+
+ dependencies:
+ flat-cache: 3.2.0
+
+ dependencies:
+ minimatch: 5.1.6
+
+ dependencies:
+ to-regex-range: 5.0.1
+
+ dependencies:
+ debug: 2.6.9
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ on-finished: 2.4.1
+ parseurl: 1.3.3
+ statuses: 2.0.1
+ unpipe: 1.0.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ debug: 4.4.0
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ on-finished: 2.4.1
+ parseurl: 1.3.3
+ statuses: 2.0.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ locate-path: 5.0.0
+ path-exists: 4.0.0
+
+ dependencies:
+ locate-path: 6.0.0
+ path-exists: 4.0.0
+
+ dependencies:
+ alce: 1.2.0
+ chalk: 3.0.0
+ detect-indent: 6.1.0
+ detect-newline: 3.1.0
+ extend-object: 1.0.0
+ rc: 1.2.8
+ optional: true
+
+ dependencies:
+ flatted: 3.3.2
+ keyv: 4.5.4
+ rimraf: 3.0.2
+
+
+
+
+ dependencies:
+ cross-spawn: 7.0.6
+ signal-exit: 4.1.0
+
+ dependencies:
+ '@babel/code-frame': 7.26.2
+ chalk: 4.1.2
+ chokidar: 3.6.0
+ cosmiconfig: 8.3.6([email protected])
+ deepmerge: 4.3.1
+ fs-extra: 10.1.0
+ memfs: 3.5.3
+ minimatch: 3.1.2
+ node-abort-controller: 3.1.1
+ schema-utils: 3.3.0
+ semver: 7.6.3
+ tapable: 2.2.1
+ typescript: 5.7.2
+ webpack: 5.97.1
+
+
+ dependencies:
+ asynckit: 0.4.0
+ combined-stream: 1.0.8
+ es-set-tostringtag: 2.1.0
+ mime-types: 2.1.35
+
+ dependencies:
+ asynckit: 0.4.0
+ combined-stream: 1.0.8
+ es-set-tostringtag: 2.1.0
+ hasown: 2.0.2
+ mime-types: 2.1.35
+
+ dependencies:
+ node-domexception: 1.0.0
+ web-streams-polyfill: 4.0.0-beta.3
+
+ dependencies:
+ dezalgo: 1.0.4
+ hexoid: 1.0.0
+ once: 1.4.0
+ qs: 6.14.0
+
+ dependencies:
+ dezalgo: 1.0.4
+ hexoid: 2.0.0
+ once: 1.4.0
+
+ dependencies:
+ destroy: 1.2.0
+ mime: 2.6.0
+ node-hex: 1.0.1
+ pause-stream: 0.0.11
+
+
+
+
+
+ dependencies:
+ graceful-fs: 4.2.11
+ jsonfile: 6.1.0
+ universalify: 2.0.1
+
+
+
+
+ optional: true
+
+
+ dependencies:
+ extend: 3.0.2
+ https-proxy-agent: 7.0.6
+ is-stream: 2.0.1
+ node-fetch: 2.7.0
+ uuid: 9.0.1
+ transitivePeerDependencies:
+ - encoding
+ - supports-color
+
+ dependencies:
+ gaxios: 6.7.1
+ google-logging-utils: 0.0.2
+ json-bigint: 1.0.0
+ transitivePeerDependencies:
+ - encoding
+ - supports-color
+
+
+
+
+ dependencies:
+ call-bind-apply-helpers: 1.0.1
+ es-define-property: 1.0.1
+ es-errors: 1.3.0
+ es-object-atoms: 1.0.0
+ function-bind: 1.1.2
+ get-proto: 1.0.1
+ gopd: 1.2.0
+ has-symbols: 1.1.0
+ hasown: 2.0.2
+ math-intrinsics: 1.1.0
+
+
+
+ dependencies:
+ dunder-proto: 1.0.1
+ es-object-atoms: 1.0.0
+
+
+ optional: true
+
+
+ dependencies:
+ is-glob: 4.0.3
+
+ dependencies:
+ is-glob: 4.0.3
+
+
+ dependencies:
+ foreground-child: 3.3.0
+ jackspeak: 2.3.6
+ minimatch: 9.0.5
+ minipass: 7.1.2
+ path-scurry: 1.11.1
+
+ dependencies:
+ foreground-child: 3.3.0
+ jackspeak: 3.4.3
+ minimatch: 9.0.5
+ minipass: 7.1.2
+ package-json-from-dist: 1.0.1
+ path-scurry: 1.11.1
+
+ dependencies:
+ fs.realpath: 1.0.0
+ inflight: 1.0.6
+ inherits: 2.0.4
+ minimatch: 3.1.2
+ once: 1.4.0
+ path-is-absolute: 1.0.1
+
+
+ dependencies:
+ type-fest: 0.20.2
+
+ dependencies:
+ base64-js: 1.5.1
+ ecdsa-sig-formatter: 1.0.11
+ gaxios: 6.7.1
+ gcp-metadata: 6.1.1
+ gtoken: 7.1.0
+ jws: 4.0.0
+ transitivePeerDependencies:
+ - encoding
+ - supports-color
+
+
+ dependencies:
+ extend: 3.0.2
+ gaxios: 6.7.1
+ google-auth-library: 9.15.1
+ qs: 6.14.0
+ url-template: 2.0.8
+ uuid: 9.0.1
+ transitivePeerDependencies:
+ - encoding
+ - supports-color
+
+ dependencies:
+ google-auth-library: 9.15.1
+ googleapis-common: 7.2.0
+ transitivePeerDependencies:
+ - encoding
+ - supports-color
+
+
+
+
+ dependencies:
+ gaxios: 6.7.1
+ jws: 4.0.0
+ transitivePeerDependencies:
+ - encoding
+ - supports-color
+
+ dependencies:
+ minimist: 1.2.8
+ neo-async: 2.6.2
+ source-map: 0.6.1
+ wordwrap: 1.0.0
+ optionalDependencies:
+ uglify-js: 3.19.3
+
+ dependencies:
+ minimist: 1.2.8
+ neo-async: 2.6.2
+ source-map: 0.6.1
+ wordwrap: 1.0.0
+ optionalDependencies:
+ uglify-js: 3.19.3
+ optional: true
+
+
+
+ dependencies:
+ es-define-property: 1.0.1
+
+
+ dependencies:
+ has-symbols: 1.1.0
+
+ dependencies:
+ function-bind: 1.1.2
+
+ dependencies:
+ handlebars: 4.7.7
+ walk: 2.3.15
+
+
+
+
+ dependencies:
+ whatwg-encoding: 2.0.0
+
+
+ dependencies:
+ camel-case: 3.0.0
+ clean-css: 4.2.4
+ commander: 2.20.3
+ he: 1.2.0
+ param-case: 2.1.1
+ relateurl: 0.2.7
+ uglify-js: 3.19.3
+ optional: true
+
+ dependencies:
+ '@selderee/plugin-htmlparser2': 0.11.0
+ deepmerge: 4.3.1
+ dom-serializer: 2.0.0
+ htmlparser2: 8.0.2
+ selderee: 0.11.0
+ optional: true
+
+ dependencies:
+ domelementtype: 2.3.0
+ domhandler: 3.3.0
+ domutils: 2.8.0
+ entities: 2.2.0
+ optional: true
+
+ dependencies:
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+ entities: 4.5.0
+ optional: true
+
+ dependencies:
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+ entities: 4.5.0
+
+ dependencies:
+ depd: 2.0.0
+ inherits: 2.0.4
+ setprototypeof: 1.2.0
+ statuses: 2.0.1
+ toidentifier: 1.0.1
+
+ dependencies:
+ eventemitter3: 4.0.7
+ follow-redirects: 1.15.9
+ requires-port: 1.0.0
+ transitivePeerDependencies:
+ - debug
+
+ dependencies:
+ basic-auth: 2.0.1
+ chalk: 4.1.2
+ corser: 2.0.1
+ he: 1.2.0
+ html-encoding-sniffer: 3.0.0
+ http-proxy: 1.18.1
+ mime: 1.6.0
+ minimist: 1.2.8
+ opener: 1.5.2
+ portfinder: 1.0.37
+ secure-compare: 3.0.1
+ union: 0.5.0
+ url-join: 4.0.1
+ transitivePeerDependencies:
+ - debug
+ - supports-color
+
+ dependencies:
+ agent-base: 6.0.2
+ debug: 4.4.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ agent-base: 7.1.3
+ debug: 4.4.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@types/node': 20.17.12
+ debug: 4.4.0
+ transitivePeerDependencies:
+ - supports-color
+
+
+ dependencies:
+ ms: 2.1.3
+
+ dependencies:
+ safer-buffer: 2.1.2
+
+ dependencies:
+ safer-buffer: 2.1.2
+
+
+
+ dependencies:
+ parent-module: 1.0.1
+ resolve-from: 4.0.0
+
+ dependencies:
+ pkg-dir: 4.2.0
+ resolve-cwd: 3.0.0
+
+
+ dependencies:
+ once: 1.4.0
+ wrappy: 1.0.2
+
+
+
+
+ dependencies:
+ ansi-escapes: 4.3.2
+ chalk: 4.1.2
+ cli-cursor: 3.1.0
+ cli-width: 3.0.0
+ external-editor: 3.1.0
+ figures: 3.2.0
+ lodash: 4.17.21
+ mute-stream: 0.0.8
+ ora: 5.4.1
+ run-async: 2.4.1
+ rxjs: 7.8.1
+ string-width: 4.2.3
+ strip-ansi: 6.0.1
+ through: 2.3.8
+ wrap-ansi: 6.2.0
+
+ dependencies:
+ '@ljharb/through': 2.3.13
+ ansi-escapes: 4.3.2
+ chalk: 5.4.1
+ cli-cursor: 3.1.0
+ cli-width: 4.1.0
+ external-editor: 3.1.0
+ figures: 3.2.0
+ lodash: 4.17.21
+ mute-stream: 1.0.0
+ ora: 5.4.1
+ run-async: 3.0.0
+ rxjs: 7.8.1
+ string-width: 4.2.3
+ strip-ansi: 6.0.1
+ wrap-ansi: 6.2.0
+
+
+ dependencies:
+ '@ioredis/commands': 1.2.0
+ cluster-key-slot: 1.1.2
+ debug: 4.4.0
+ denque: 2.1.0
+ lodash.defaults: 4.2.0
+ lodash.isarguments: 3.1.0
+ redis-errors: 1.2.0
+ redis-parser: 3.0.0
+ standard-as-callback: 2.1.0
+ transitivePeerDependencies:
+ - supports-color
+
+
+
+ dependencies:
+ binary-extensions: 2.3.0
+
+
+ dependencies:
+ hasown: 2.0.2
+
+ optional: true
+
+ dependencies:
+ acorn: 7.4.1
+ object-assign: 4.1.1
+ optional: true
+
+
+
+
+
+ dependencies:
+ is-extglob: 2.1.1
+
+
+
+
+ optional: true
+
+
+ dependencies:
+ call-bound: 1.0.3
+ gopd: 1.2.0
+ has-tostringtag: 1.0.2
+ hasown: 2.0.2
+ optional: true
+
+ optional: true
+
+
+ dependencies:
+ core-util-is: 1.0.3
+ is-class-hotfix: 0.0.6
+ isstream: 0.1.2
+
+
+ dependencies:
+ is-docker: 2.2.1
+ optional: true
+
+
+
+
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/parser': 7.26.5
+ '@istanbuljs/schema': 0.1.3
+ istanbul-lib-coverage: 3.2.2
+ semver: 6.3.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/parser': 7.26.5
+ '@istanbuljs/schema': 0.1.3
+ istanbul-lib-coverage: 3.2.2
+ semver: 7.6.3
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ istanbul-lib-coverage: 3.2.2
+ make-dir: 4.0.0
+ supports-color: 7.2.0
+
+ dependencies:
+ debug: 4.4.0
+ istanbul-lib-coverage: 3.2.2
+ source-map: 0.6.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ html-escaper: 2.0.2
+ istanbul-lib-report: 3.0.1
+
+
+ dependencies:
+ '@isaacs/cliui': 8.0.2
+ optionalDependencies:
+ '@pkgjs/parseargs': 0.11.0
+
+ dependencies:
+ '@isaacs/cliui': 8.0.2
+ optionalDependencies:
+ '@pkgjs/parseargs': 0.11.0
+
+ dependencies:
+ async: 3.2.6
+ chalk: 4.1.2
+ filelist: 1.0.4
+ minimatch: 3.1.2
+
+ dependencies:
+ execa: 5.1.1
+ jest-util: 29.7.0
+ p-limit: 3.1.0
+
+ dependencies:
+ '@jest/environment': 29.7.0
+ '@jest/expect': 29.7.0
+ '@jest/test-result': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ chalk: 4.1.2
+ co: 4.6.0
+ dedent: 1.5.3
+ is-generator-fn: 2.1.0
+ jest-each: 29.7.0
+ jest-matcher-utils: 29.7.0
+ jest-message-util: 29.7.0
+ jest-runtime: 29.7.0
+ jest-snapshot: 29.7.0
+ jest-util: 29.7.0
+ p-limit: 3.1.0
+ pretty-format: 29.7.0
+ pure-rand: 6.1.0
+ slash: 3.0.0
+ stack-utils: 2.0.6
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+
+ dependencies:
+ '@jest/test-result': 29.7.0
+ '@jest/types': 29.6.3
+ chalk: 4.1.2
+ exit: 0.1.2
+ import-local: 3.2.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ yargs: 17.7.2
+ transitivePeerDependencies:
+ - '@types/node'
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@jest/test-sequencer': 29.7.0
+ '@jest/types': 29.6.3
+ babel-jest: 29.7.0(@babel/[email protected])
+ chalk: 4.1.2
+ ci-info: 3.9.0
+ deepmerge: 4.3.1
+ glob: 7.2.3
+ graceful-fs: 4.2.11
+ jest-circus: 29.7.0
+ jest-environment-node: 29.7.0
+ jest-get-type: 29.6.3
+ jest-regex-util: 29.6.3
+ jest-resolve: 29.7.0
+ jest-runner: 29.7.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ micromatch: 4.0.8
+ parse-json: 5.2.0
+ pretty-format: 29.7.0
+ slash: 3.0.0
+ strip-json-comments: 3.1.1
+ optionalDependencies:
+ '@types/node': 20.17.12
+ ts-node: 10.9.2(@types/[email protected])([email protected])
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+
+ dependencies:
+ chalk: 4.1.2
+ diff-sequences: 29.6.3
+ jest-get-type: 29.6.3
+ pretty-format: 29.7.0
+
+ dependencies:
+ detect-newline: 3.1.0
+
+ dependencies:
+ '@jest/types': 29.6.3
+ chalk: 4.1.2
+ jest-get-type: 29.6.3
+ jest-util: 29.7.0
+ pretty-format: 29.7.0
+
+ dependencies:
+ '@jest/environment': 29.7.0
+ '@jest/fake-timers': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ jest-mock: 29.7.0
+ jest-util: 29.7.0
+
+
+ dependencies:
+ '@jest/types': 29.6.3
+ '@types/graceful-fs': 4.1.9
+ '@types/node': 20.17.12
+ anymatch: 3.1.3
+ fb-watchman: 2.0.2
+ graceful-fs: 4.2.11
+ jest-regex-util: 29.6.3
+ jest-util: 29.7.0
+ jest-worker: 29.7.0
+ micromatch: 4.0.8
+ walker: 1.0.8
+ optionalDependencies:
+ fsevents: 2.3.3
+
+ dependencies:
+ jest-get-type: 29.6.3
+ pretty-format: 29.7.0
+
+ dependencies:
+ chalk: 4.1.2
+ jest-diff: 29.7.0
+ jest-get-type: 29.6.3
+ pretty-format: 29.7.0
+
+ dependencies:
+ '@babel/code-frame': 7.26.2
+ '@jest/types': 29.6.3
+ '@types/stack-utils': 2.0.3
+ chalk: 4.1.2
+ graceful-fs: 4.2.11
+ micromatch: 4.0.8
+ pretty-format: 29.7.0
+ slash: 3.0.0
+ stack-utils: 2.0.6
+
+ dependencies:
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ jest-util: 29.7.0
+
+ optionalDependencies:
+ jest-resolve: 29.7.0
+
+
+ dependencies:
+ jest-regex-util: 29.6.3
+ jest-snapshot: 29.7.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ chalk: 4.1.2
+ graceful-fs: 4.2.11
+ jest-haste-map: 29.7.0
+ jest-pnp-resolver: 1.2.3([email protected])
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ resolve: 1.22.10
+ resolve.exports: 2.0.3
+ slash: 3.0.0
+
+ dependencies:
+ '@jest/console': 29.7.0
+ '@jest/environment': 29.7.0
+ '@jest/test-result': 29.7.0
+ '@jest/transform': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ chalk: 4.1.2
+ emittery: 0.13.1
+ graceful-fs: 4.2.11
+ jest-docblock: 29.7.0
+ jest-environment-node: 29.7.0
+ jest-haste-map: 29.7.0
+ jest-leak-detector: 29.7.0
+ jest-message-util: 29.7.0
+ jest-resolve: 29.7.0
+ jest-runtime: 29.7.0
+ jest-util: 29.7.0
+ jest-watcher: 29.7.0
+ jest-worker: 29.7.0
+ p-limit: 3.1.0
+ source-map-support: 0.5.13
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@jest/environment': 29.7.0
+ '@jest/fake-timers': 29.7.0
+ '@jest/globals': 29.7.0
+ '@jest/source-map': 29.6.3
+ '@jest/test-result': 29.7.0
+ '@jest/transform': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ chalk: 4.1.2
+ cjs-module-lexer: 1.4.1
+ collect-v8-coverage: 1.0.2
+ glob: 7.2.3
+ graceful-fs: 4.2.11
+ jest-haste-map: 29.7.0
+ jest-message-util: 29.7.0
+ jest-mock: 29.7.0
+ jest-regex-util: 29.6.3
+ jest-resolve: 29.7.0
+ jest-snapshot: 29.7.0
+ jest-util: 29.7.0
+ slash: 3.0.0
+ strip-bom: 4.0.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@babel/core': 7.26.0
+ '@babel/generator': 7.26.5
+ '@babel/plugin-syntax-jsx': 7.25.9(@babel/[email protected])
+ '@babel/plugin-syntax-typescript': 7.25.9(@babel/[email protected])
+ '@babel/types': 7.26.5
+ '@jest/expect-utils': 29.7.0
+ '@jest/transform': 29.7.0
+ '@jest/types': 29.6.3
+ babel-preset-current-node-syntax: 1.1.0(@babel/[email protected])
+ chalk: 4.1.2
+ expect: 29.7.0
+ graceful-fs: 4.2.11
+ jest-diff: 29.7.0
+ jest-get-type: 29.6.3
+ jest-matcher-utils: 29.7.0
+ jest-message-util: 29.7.0
+ jest-util: 29.7.0
+ natural-compare: 1.4.0
+ pretty-format: 29.7.0
+ semver: 7.6.3
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ chalk: 4.1.2
+ ci-info: 3.9.0
+ graceful-fs: 4.2.11
+ picomatch: 2.3.1
+
+ dependencies:
+ '@jest/types': 29.6.3
+ camelcase: 6.3.0
+ chalk: 4.1.2
+ jest-get-type: 29.6.3
+ leven: 3.1.0
+ pretty-format: 29.7.0
+
+ dependencies:
+ '@jest/test-result': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 20.17.12
+ ansi-escapes: 4.3.2
+ chalk: 4.1.2
+ emittery: 0.13.1
+ jest-util: 29.7.0
+ string-length: 4.0.2
+
+ dependencies:
+ '@types/node': 20.17.12
+ merge-stream: 2.0.0
+ supports-color: 8.1.1
+
+ dependencies:
+ '@types/node': 20.17.12
+ jest-util: 29.7.0
+ merge-stream: 2.0.0
+ supports-color: 8.1.1
+
+ dependencies:
+ '@jest/types': 29.6.3
+ import-local: 3.2.0
+ transitivePeerDependencies:
+ - '@types/node'
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+
+
+ dependencies:
+ config-chain: 1.1.13
+ editorconfig: 1.0.4
+ glob: 10.4.5
+ js-cookie: 3.0.5
+ nopt: 7.2.1
+ optional: true
+
+ optional: true
+
+ optional: true
+
+
+ dependencies:
+ argparse: 1.0.10
+ esprima: 4.0.1
+
+ dependencies:
+ argparse: 2.0.1
+
+
+ dependencies:
+ bignumber.js: 4.1.0
+
+ dependencies:
+ bignumber.js: 9.3.0
+
+
+
+
+
+
+
+
+
+ dependencies:
+ universalify: 2.0.1
+ optionalDependencies:
+ graceful-fs: 4.2.11
+
+ dependencies:
+ jws: 3.2.2
+ lodash.includes: 4.3.0
+ lodash.isboolean: 3.0.3
+ lodash.isinteger: 4.0.4
+ lodash.isnumber: 3.0.3
+ lodash.isplainobject: 4.0.6
+ lodash.isstring: 4.0.1
+ lodash.once: 4.1.1
+ ms: 2.1.3
+ semver: 7.6.3
+
+
+ dependencies:
+ is-promise: 2.2.2
+ promise: 7.3.1
+ optional: true
+
+ dependencies:
+ cheerio: 1.0.0-rc.12
+ commander: 6.2.1
+ mensch: 0.3.4
+ slick: 1.12.2
+ web-resource-inliner: 6.0.1
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ buffer-equal-constant-time: 1.0.1
+ ecdsa-sig-formatter: 1.0.11
+ safe-buffer: 5.2.1
+
+ dependencies:
+ buffer-equal-constant-time: 1.0.1
+ ecdsa-sig-formatter: 1.0.11
+ safe-buffer: 5.2.1
+
+ dependencies:
+ jwa: 1.4.1
+ safe-buffer: 5.2.1
+
+ dependencies:
+ jwa: 2.0.1
+ safe-buffer: 5.2.1
+
+
+ dependencies:
+ json-buffer: 3.0.1
+
+
+ dependencies:
+ '@types/node': 22.10.7
+
+
+ dependencies:
+ readable-stream: 2.3.8
+
+ optional: true
+
+
+ dependencies:
+ prelude-ls: 1.2.1
+ type-check: 0.4.0
+
+ optional: true
+
+ dependencies:
+ encoding-japanese: 2.2.0
+ iconv-lite: 0.6.3
+ libbase64: 1.3.0
+ libqp: 2.1.1
+ optional: true
+
+
+ optional: true
+
+
+ dependencies:
+ uc.micro: 2.1.0
+ optional: true
+
+ dependencies:
+ commander: 10.0.1
+ optional: true
+
+
+ dependencies:
+ p-locate: 4.1.0
+
+ dependencies:
+ p-locate: 5.0.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+ dependencies:
+ chalk: 4.1.2
+ is-unicode-supported: 0.1.0
+
+ optional: true
+
+
+ dependencies:
+ yallist: 3.1.1
+
+
+ dependencies:
+ '@jridgewell/sourcemap-codec': 1.5.0
+
+ dependencies:
+ encoding-japanese: 2.2.0
+ he: 1.2.0
+ html-to-text: 9.0.5
+ iconv-lite: 0.6.3
+ libmime: 5.3.6
+ linkify-it: 5.0.0
+ mailsplit: 5.4.3
+ nodemailer: 7.0.3
+ punycode.js: 2.3.1
+ tlds: 1.259.0
+ optional: true
+
+ dependencies:
+ libbase64: 1.3.0
+ libmime: 5.3.6
+ libqp: 2.1.1
+ optional: true
+
+ dependencies:
+ semver: 7.6.3
+
+
+ dependencies:
+ tmpl: 1.0.5
+
+
+
+
+ dependencies:
+ fs-monkey: 1.0.6
+
+
+
+ optional: true
+
+
+
+
+
+
+ dependencies:
+ braces: 3.0.3
+ picomatch: 2.3.1
+
+
+
+ dependencies:
+ mime-db: 1.52.0
+
+ dependencies:
+ mime-db: 1.54.0
+
+
+
+
+ dependencies:
+ brace-expansion: 1.1.11
+
+ dependencies:
+ brace-expansion: 2.0.1
+
+ dependencies:
+ brace-expansion: 2.0.1
+ optional: true
+
+ dependencies:
+ brace-expansion: 2.0.1
+
+
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ chokidar: 3.6.0
+ glob: 10.4.5
+ html-minifier: 4.0.0
+ js-beautify: 1.15.4
+ lodash: 4.17.21
+ minimatch: 9.0.5
+ mjml-core: 4.15.3
+ mjml-migrate: 4.15.3
+ mjml-parser-xml: 4.15.3
+ mjml-validator: 4.15.3
+ yargs: 17.7.2
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ cheerio: 1.0.0-rc.12
+ detect-node: 2.1.0
+ html-minifier: 4.0.0
+ js-beautify: 1.15.4
+ juice: 10.0.1
+ lodash: 4.17.21
+ mjml-migrate: 4.15.3
+ mjml-parser-xml: 4.15.3
+ mjml-validator: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ js-beautify: 1.15.4
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ mjml-parser-xml: 4.15.3
+ yargs: 17.7.2
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ detect-node: 2.1.0
+ htmlparser2: 9.1.0
+ lodash: 4.17.21
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ mjml-accordion: 4.15.3
+ mjml-body: 4.15.3
+ mjml-button: 4.15.3
+ mjml-carousel: 4.15.3
+ mjml-column: 4.15.3
+ mjml-divider: 4.15.3
+ mjml-group: 4.15.3
+ mjml-head: 4.15.3
+ mjml-head-attributes: 4.15.3
+ mjml-head-breakpoint: 4.15.3
+ mjml-head-font: 4.15.3
+ mjml-head-html-attributes: 4.15.3
+ mjml-head-preview: 4.15.3
+ mjml-head-style: 4.15.3
+ mjml-head-title: 4.15.3
+ mjml-hero: 4.15.3
+ mjml-image: 4.15.3
+ mjml-navbar: 4.15.3
+ mjml-raw: 4.15.3
+ mjml-section: 4.15.3
+ mjml-social: 4.15.3
+ mjml-spacer: 4.15.3
+ mjml-table: 4.15.3
+ mjml-text: 4.15.3
+ mjml-wrapper: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ lodash: 4.17.21
+ mjml-core: 4.15.3
+ mjml-section: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+ dependencies:
+ '@babel/runtime': 7.27.1
+ mjml-cli: 4.15.3
+ mjml-core: 4.15.3
+ mjml-migrate: 4.15.3
+ mjml-preset-core: 4.15.3
+ mjml-validator: 4.15.3
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+
+ dependencies:
+ minimist: 1.2.8
+
+
+ dependencies:
+ moment: 2.30.1
+
+
+ dependencies:
+ '@types/whatwg-url': 11.0.5
+ whatwg-url: 13.0.0
+
+ dependencies:
+ '@mongodb-js/saslprep': 1.1.9
+ bson: 6.10.1
+ mongodb-connection-string-url: 3.0.1
+
+ dependencies:
+ bson: 6.10.1
+ kareem: 2.6.3
+ mongodb: 6.12.0
+ mpath: 0.9.0
+ mquery: 5.0.0
+ ms: 2.1.3
+ sift: 17.1.3
+ transitivePeerDependencies:
+ - '@aws-sdk/credential-providers'
+ - '@mongodb-js/zstd'
+ - gcp-metadata
+ - kerberos
+ - mongodb-client-encryption
+ - snappy
+ - socks
+ - supports-color
+
+
+ dependencies:
+ debug: 4.4.0
+ transitivePeerDependencies:
+ - supports-color
+
+
+
+ dependencies:
+ node-gyp-build-optional-packages: 5.2.2
+ optionalDependencies:
+ '@msgpackr-extract/msgpackr-extract-darwin-arm64': 3.0.3
+ '@msgpackr-extract/msgpackr-extract-darwin-x64': 3.0.3
+ '@msgpackr-extract/msgpackr-extract-linux-arm': 3.0.3
+ '@msgpackr-extract/msgpackr-extract-linux-arm64': 3.0.3
+ '@msgpackr-extract/msgpackr-extract-linux-x64': 3.0.3
+ '@msgpackr-extract/msgpackr-extract-win32-x64': 3.0.3
+ optional: true
+
+ optionalDependencies:
+ msgpackr-extract: 3.0.3
+
+ dependencies:
+ append-field: 1.0.0
+ busboy: 1.6.0
+ concat-stream: 1.6.2
+ mkdirp: 0.5.6
+ object-assign: 4.1.1
+ type-is: 1.6.18
+ xtend: 4.0.2
+
+ dependencies:
+ append-field: 1.0.0
+ busboy: 1.6.0
+ concat-stream: 1.6.2
+ mkdirp: 0.5.6
+ object-assign: 4.1.1
+ type-is: 1.6.18
+ xtend: 4.0.2
+
+
+
+ dependencies:
+ any-promise: 1.3.0
+ object-assign: 4.1.1
+ thenify-all: 1.6.0
+
+ optional: true
+
+
+ dependencies:
+ afinn-165: 1.0.4
+ afinn-165-financialmarketnews: 3.0.0
+ apparatus: 0.0.10
+ dotenv: 16.4.5
+ http-server: 14.1.1
+ memjs: 1.3.2
+ mongoose: 8.9.4
+ pg: 8.16.0
+ redis: 4.7.1
+ safe-stable-stringify: 2.5.0
+ stopwords-iso: 1.1.0
+ sylvester: 0.0.12
+ underscore: 1.13.7
+ uuid: 9.0.1
+ wordnet-db: 3.1.14
+ transitivePeerDependencies:
+ - '@aws-sdk/credential-providers'
+ - '@mongodb-js/zstd'
+ - debug
+ - gcp-metadata
+ - kerberos
+ - mongodb-client-encryption
+ - pg-native
+ - snappy
+ - socks
+ - supports-color
+
+
+
+
+
+ optional: true
+
+ dependencies:
+ lower-case: 1.1.4
+ optional: true
+
+
+
+ dependencies:
+ lodash: 4.17.21
+
+ dependencies:
+ whatwg-url: 5.0.0
+
+ dependencies:
+ detect-libc: 2.0.4
+ optional: true
+
+
+
+
+ optional: true
+
+
+ dependencies:
+ abbrev: 2.0.0
+ optional: true
+
+
+ dependencies:
+ path-key: 2.0.1
+ optional: true
+
+ dependencies:
+ path-key: 3.1.1
+
+ dependencies:
+ boolbase: 1.0.0
+
+
+
+ dependencies:
+ ee-first: 1.1.1
+
+
+ dependencies:
+ wrappy: 1.0.2
+
+ dependencies:
+ mimic-fn: 2.1.0
+
+ dependencies:
+ is-docker: 2.2.1
+ is-wsl: 2.2.0
+ optional: true
+
+ dependencies:
+ '@types/node': 18.19.71
+ '@types/node-fetch': 2.6.12
+ abort-controller: 3.0.0
+ agentkeepalive: 4.6.0
+ form-data-encoder: 1.7.2
+ formdata-node: 4.4.1
+ node-fetch: 2.7.0
+ transitivePeerDependencies:
+ - encoding
+
+
+ dependencies:
+ deep-is: 0.1.4
+ fast-levenshtein: 2.0.6
+ levn: 0.4.1
+ prelude-ls: 1.2.1
+ type-check: 0.4.0
+ word-wrap: 1.2.5
+
+ dependencies:
+ bl: 4.1.0
+ chalk: 4.1.2
+ cli-cursor: 3.1.0
+ cli-spinners: 2.9.2
+ is-interactive: 1.0.0
+ is-unicode-supported: 0.1.0
+ log-symbols: 4.1.0
+ strip-ansi: 6.0.1
+ wcwidth: 1.0.1
+
+ dependencies:
+ osx-release: 1.1.0
+ win-release: 1.1.1
+
+
+ dependencies:
+ minimist: 1.2.8
+
+ dependencies:
+ p-timeout: 3.2.0
+ optional: true
+
+ optional: true
+
+ dependencies:
+ p-try: 2.2.0
+
+ dependencies:
+ yocto-queue: 0.1.0
+
+ dependencies:
+ p-limit: 2.3.0
+
+ dependencies:
+ p-limit: 3.1.0
+
+ dependencies:
+ p-finally: 1.0.0
+ optional: true
+
+
+ dependencies:
+ p-timeout: 3.2.0
+ optional: true
+
+
+ dependencies:
+ no-case: 2.3.2
+ optional: true
+
+ dependencies:
+ callsites: 3.1.0
+
+ dependencies:
+ '@babel/code-frame': 7.26.2
+ error-ex: 1.3.2
+ json-parse-even-better-errors: 2.3.1
+ lines-and-columns: 1.2.4
+
+ dependencies:
+ domhandler: 5.0.3
+ parse5: 7.3.0
+
+ dependencies:
+ parse5: 7.3.0
+
+ dependencies:
+ entities: 6.0.0
+
+ dependencies:
+ leac: 0.6.0
+ peberminta: 0.9.0
+ optional: true
+
+
+
+
+ optional: true
+
+
+
+ dependencies:
+ lru-cache: 10.4.3
+ minipass: 7.1.2
+
+
+
+
+
+ dependencies:
+ process: 0.11.10
+ util: 0.10.4
+
+ dependencies:
+ through: 2.3.8
+
+ optional: true
+
+ optional: true
+
+
+
+ dependencies:
+ pg: 8.16.0
+
+
+ dependencies:
+ pg-int8: 1.0.1
+ postgres-array: 2.0.0
+ postgres-bytea: 1.0.0
+ postgres-date: 1.0.7
+ postgres-interval: 1.2.0
+
+ dependencies:
+ pg-connection-string: 2.9.0
+ pg-pool: 3.10.0([email protected])
+ pg-protocol: 1.10.0
+ pg-types: 2.2.0
+ pgpass: 1.0.5
+ optionalDependencies:
+ pg-cloudflare: 1.2.5
+
+ dependencies:
+ split2: 4.2.0
+
+
+
+
+
+ dependencies:
+ find-up: 4.1.0
+
+
+
+ dependencies:
+ async: 3.2.6
+ debug: 4.4.0
+ transitivePeerDependencies:
+ - supports-color
+
+
+
+
+ dependencies:
+ xtend: 4.0.2
+
+
+ dependencies:
+ fast-diff: 1.3.0
+
+
+ dependencies:
+ '@jest/schemas': 29.6.3
+ ansi-styles: 5.2.0
+ react-is: 18.3.1
+
+ dependencies:
+ ci-info: 3.9.0
+ display-notification: 2.0.0
+ fixpack: 4.0.0
+ get-port: 5.1.1
+ mailparser: 3.7.3
+ nodemailer: 6.10.1
+ open: 7.4.2
+ p-event: 4.2.0
+ p-wait-for: 3.2.0
+ pug: 3.0.3
+ uuid: 9.0.1
+ optional: true
+
+
+
+ dependencies:
+ asap: 2.0.6
+ optional: true
+
+ dependencies:
+ kleur: 3.0.3
+ sisteransi: 1.0.5
+
+ dependencies:
+ graceful-fs: 4.2.11
+ retry: 0.12.0
+ signal-exit: 3.0.7
+
+ dependencies:
+ mkdirp: 1.0.4
+
+ optional: true
+
+ dependencies:
+ forwarded: 0.2.0
+ ipaddr.js: 1.9.1
+
+
+ dependencies:
+ constantinople: 4.0.1
+ js-stringify: 1.0.2
+ pug-runtime: 3.0.1
+ optional: true
+
+ dependencies:
+ constantinople: 4.0.1
+ doctypes: 1.1.0
+ js-stringify: 1.0.2
+ pug-attrs: 3.0.0
+ pug-error: 2.1.0
+ pug-runtime: 3.0.1
+ void-elements: 3.1.0
+ with: 7.0.2
+ optional: true
+
+ optional: true
+
+ dependencies:
+ constantinople: 4.0.1
+ jstransformer: 1.0.0
+ pug-error: 2.1.0
+ pug-walk: 2.0.0
+ resolve: 1.22.10
+ optional: true
+
+ dependencies:
+ character-parser: 2.2.0
+ is-expression: 4.0.0
+ pug-error: 2.1.0
+ optional: true
+
+ dependencies:
+ pug-error: 2.1.0
+ pug-walk: 2.0.0
+ optional: true
+
+ dependencies:
+ object-assign: 4.1.1
+ pug-walk: 2.0.0
+ optional: true
+
+ dependencies:
+ pug-error: 2.1.0
+ token-stream: 1.0.0
+ optional: true
+
+ optional: true
+
+ dependencies:
+ pug-error: 2.1.0
+ optional: true
+
+ optional: true
+
+ dependencies:
+ pug-code-gen: 3.0.3
+ pug-filters: 4.0.0
+ pug-lexer: 5.0.1
+ pug-linker: 4.0.0
+ pug-load: 3.0.0
+ pug-parser: 6.0.0
+ pug-runtime: 3.0.1
+ pug-strip-comments: 2.0.0
+ optional: true
+
+ dependencies:
+ end-of-stream: 1.4.4
+ once: 1.4.0
+
+ optional: true
+
+
+
+ dependencies:
+ side-channel: 1.1.0
+
+ dependencies:
+ side-channel: 1.1.0
+
+
+
+
+ dependencies:
+ safe-buffer: 5.2.1
+
+
+ dependencies:
+ bytes: 3.1.2
+ http-errors: 2.0.0
+ iconv-lite: 0.4.24
+ unpipe: 1.0.0
+
+ dependencies:
+ bytes: 3.1.2
+ http-errors: 2.0.0
+ iconv-lite: 0.6.3
+ unpipe: 1.0.0
+
+ dependencies:
+ deep-extend: 0.6.0
+ ini: 1.3.8
+ minimist: 1.2.8
+ strip-json-comments: 2.0.1
+ optional: true
+
+
+ dependencies:
+ core-util-is: 1.0.3
+ inherits: 2.0.4
+ isarray: 1.0.0
+ process-nextick-args: 2.0.1
+ safe-buffer: 5.1.2
+ string_decoder: 1.1.1
+ util-deprecate: 1.0.2
+
+ dependencies:
+ inherits: 2.0.4
+ string_decoder: 1.3.0
+ util-deprecate: 1.0.2
+
+ dependencies:
+ abort-controller: 3.0.0
+ buffer: 6.0.3
+ events: 3.3.0
+ process: 0.11.10
+ string_decoder: 1.3.0
+
+ dependencies:
+ minimatch: 5.1.6
+
+ dependencies:
+ picomatch: 2.3.1
+
+
+ dependencies:
+ redis-errors: 1.2.0
+
+ dependencies:
+ '@redis/bloom': 1.2.0(@redis/[email protected])
+ '@redis/client': 1.6.1
+ '@redis/graph': 1.1.1(@redis/[email protected])
+ '@redis/json': 1.0.7(@redis/[email protected])
+ '@redis/search': 1.2.0(@redis/[email protected])
+ '@redis/time-series': 1.1.0(@redis/[email protected])
+
+
+ optional: true
+
+
+
+
+
+ dependencies:
+ resolve-from: 5.0.0
+
+
+
+
+ dependencies:
+ is-core-module: 2.16.1
+ path-parse: 1.0.7
+ supports-preserve-symlinks-flag: 1.0.0
+
+ dependencies:
+ onetime: 5.1.2
+ signal-exit: 3.0.7
+
+
+
+ dependencies:
+ glob: 7.2.3
+
+ dependencies:
+ debug: 4.4.0
+ depd: 2.0.0
+ is-promise: 4.0.0
+ parseurl: 1.3.3
+ path-to-regexp: 8.2.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ execa: 0.10.0
+ optional: true
+
+
+
+ dependencies:
+ queue-microtask: 1.2.3
+
+ dependencies:
+ tslib: 2.8.1
+
+
+
+
+
+
+ dependencies:
+ '@types/json-schema': 7.0.15
+ ajv: 6.12.6
+ ajv-keywords: 3.5.2([email protected])
+
+ dependencies:
+ '@types/json-schema': 7.0.15
+ ajv: 8.17.1
+ ajv-formats: 2.1.1([email protected])
+ ajv-keywords: 5.1.0([email protected])
+
+ dependencies:
+ get-ready: 1.0.0
+
+
+ dependencies:
+ parseley: 0.12.1
+ optional: true
+
+
+
+
+ dependencies:
+ debug: 2.6.9
+ depd: 2.0.0
+ destroy: 1.2.0
+ encodeurl: 1.0.2
+ escape-html: 1.0.3
+ etag: 1.8.1
+ fresh: 0.5.2
+ http-errors: 2.0.0
+ mime: 1.6.0
+ ms: 2.1.3
+ on-finished: 2.4.1
+ range-parser: 1.2.1
+ statuses: 2.0.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ debug: 4.4.0
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ etag: 1.8.1
+ fresh: 2.0.0
+ http-errors: 2.0.0
+ mime-types: 3.0.1
+ ms: 2.1.3
+ on-finished: 2.4.1
+ range-parser: 1.2.1
+ statuses: 2.0.1
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ randombytes: 2.1.0
+
+ dependencies:
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ parseurl: 1.3.3
+ send: 0.19.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ parseurl: 1.3.3
+ send: 1.2.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ define-data-property: 1.1.4
+ es-errors: 1.3.0
+ function-bind: 1.1.2
+ get-intrinsic: 1.2.7
+ gopd: 1.2.0
+ has-property-descriptors: 1.0.2
+
+
+ dependencies:
+ shebang-regex: 1.0.0
+ optional: true
+
+ dependencies:
+ shebang-regex: 3.0.0
+
+ optional: true
+
+
+ dependencies:
+ es-errors: 1.3.0
+ object-inspect: 1.13.3
+
+ dependencies:
+ call-bound: 1.0.3
+ es-errors: 1.3.0
+ get-intrinsic: 1.2.7
+ object-inspect: 1.13.3
+
+ dependencies:
+ call-bound: 1.0.3
+ es-errors: 1.3.0
+ get-intrinsic: 1.2.7
+ object-inspect: 1.13.3
+ side-channel-map: 1.0.1
+
+ dependencies:
+ es-errors: 1.3.0
+ object-inspect: 1.13.3
+ side-channel-list: 1.0.0
+ side-channel-map: 1.0.1
+ side-channel-weakmap: 1.0.2
+
+
+
+
+
+
+ optional: true
+
+
+ dependencies:
+ buffer-from: 1.1.2
+ source-map: 0.6.1
+
+ dependencies:
+ buffer-from: 1.1.2
+ source-map: 0.6.1
+
+
+
+ dependencies:
+ memory-pager: 1.5.0
+
+
+
+
+ dependencies:
+ '@types/ssh2': 0.5.52
+ ssh2: 1.16.0
+
+ dependencies:
+ asn1: 0.2.6
+ bcrypt-pbkdf: 1.0.2
+ optionalDependencies:
+ cpu-features: 0.0.10
+ nan: 2.22.0
+
+ dependencies:
+ escape-string-regexp: 2.0.0
+
+
+
+
+
+ dependencies:
+ builtin-status-codes: 3.0.0
+ inherits: 2.0.4
+ readable-stream: 2.3.8
+ to-arraybuffer: 1.0.1
+ xtend: 4.0.2
+
+
+
+ dependencies:
+ fast-fifo: 1.3.2
+ queue-tick: 1.0.1
+ text-decoder: 1.2.3
+ optionalDependencies:
+ bare-events: 2.5.4
+
+ dependencies:
+ char-regex: 1.0.2
+ strip-ansi: 6.0.1
+
+ dependencies:
+ emoji-regex: 8.0.0
+ is-fullwidth-code-point: 3.0.0
+ strip-ansi: 6.0.1
+
+ dependencies:
+ eastasianwidth: 0.2.0
+ emoji-regex: 9.2.2
+ strip-ansi: 7.1.0
+
+ dependencies:
+ safe-buffer: 5.1.2
+
+ dependencies:
+ safe-buffer: 5.2.1
+
+ dependencies:
+ ansi-regex: 5.0.1
+
+ dependencies:
+ ansi-regex: 6.1.0
+
+
+
+ optional: true
+
+
+ optional: true
+
+
+
+ dependencies:
+ component-emitter: 1.3.1
+ cookiejar: 2.1.4
+ debug: 4.4.0
+ fast-safe-stringify: 2.1.1
+ form-data: 4.0.3
+ formidable: 2.1.2
+ methods: 1.1.2
+ mime: 2.6.0
+ qs: 6.14.0
+ semver: 7.6.3
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ component-emitter: 1.3.1
+ cookiejar: 2.1.4
+ debug: 4.4.0
+ fast-safe-stringify: 2.1.1
+ form-data: 4.0.3
+ formidable: 3.5.2
+ methods: 1.1.2
+ mime: 2.6.0
+ qs: 6.14.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ methods: 1.1.2
+ superagent: 9.0.2
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ has-flag: 4.0.0
+
+ dependencies:
+ has-flag: 4.0.0
+
+
+ dependencies:
+ '@scarf/scarf': 1.4.0
+
+ dependencies:
+ express: 5.1.0
+ swagger-ui-dist: 5.18.2
+
+
+
+ dependencies:
+ '@pkgr/core': 0.1.1
+ tslib: 2.8.1
+
+
+ dependencies:
+ chownr: 1.1.4
+ mkdirp-classic: 0.5.3
+ pump: 3.0.2
+ tar-stream: 2.2.0
+
+ dependencies:
+ pump: 3.0.2
+ tar-stream: 3.1.7
+ optionalDependencies:
+ bare-fs: 4.0.1
+ bare-path: 3.0.0
+ transitivePeerDependencies:
+ - bare-buffer
+
+ dependencies:
+ bl: 4.1.0
+ end-of-stream: 1.4.4
+ fs-constants: 1.0.0
+ inherits: 2.0.4
+ readable-stream: 3.6.2
+
+ dependencies:
+ b4a: 1.6.7
+ fast-fifo: 1.3.2
+ streamx: 2.21.1
+
+ dependencies:
+ form-data: 3.0.3
+ get-stream: 6.0.1
+ https-proxy-agent: 5.0.1
+ is-stream: 2.0.1
+ json-bigint: 1.0.0
+ node-fetch: 2.7.0
+ tslib: 1.13.0
+ uuid: 9.0.1
+ transitivePeerDependencies:
+ - encoding
+ - supports-color
+
+ dependencies:
+ tencentcloud-sdk-nodejs-common: 4.1.1
+ tslib: 1.13.0
+ transitivePeerDependencies:
+ - encoding
+ - supports-color
+
+ dependencies:
+ '@jridgewell/trace-mapping': 0.3.25
+ jest-worker: 27.5.1
+ schema-utils: 4.3.0
+ serialize-javascript: 6.0.2
+ terser: 5.37.0
+ webpack: 5.97.1
+
+ dependencies:
+ '@jridgewell/source-map': 0.3.6
+ acorn: 8.14.0
+ commander: 2.20.3
+ source-map-support: 0.5.21
+
+ dependencies:
+ '@istanbuljs/schema': 0.1.3
+ glob: 7.2.3
+ minimatch: 3.1.2
+
+ dependencies:
+ '@balena/dockerignore': 1.0.2
+ '@types/dockerode': 3.3.34
+ archiver: 7.0.1
+ async-lock: 1.4.1
+ byline: 5.0.0
+ debug: 4.4.0
+ docker-compose: 0.24.8
+ dockerode: 3.3.5
+ get-port: 5.1.1
+ proper-lockfile: 4.1.2
+ properties-reader: 2.3.0
+ ssh-remote-port-forward: 1.0.4
+ tar-fs: 3.0.8
+ tmp: 0.2.3
+ undici: 5.28.4
+ transitivePeerDependencies:
+ - bare-buffer
+ - supports-color
+
+ dependencies:
+ b4a: 1.6.7
+
+
+ dependencies:
+ thenify: 3.3.1
+
+ dependencies:
+ any-promise: 1.3.0
+
+
+ optional: true
+
+ dependencies:
+ os-tmpdir: 1.0.2
+
+
+
+
+ dependencies:
+ is-number: 7.0.0
+
+
+ optional: true
+
+
+ dependencies:
+ punycode: 2.3.1
+
+
+ dependencies:
+ typescript: 5.7.3
+
+ dependencies:
+ bs-logger: 0.2.6
+ ejs: 3.1.10
+ fast-json-stable-stringify: 2.1.0
+ jest-util: 29.7.0
+ json5: 2.2.3
+ lodash.memoize: 4.1.2
+ make-error: 1.3.6
+ semver: 7.6.3
+ typescript: 5.7.3
+ yargs-parser: 21.1.1
+ optionalDependencies:
+ '@babel/core': 7.26.0
+ '@jest/transform': 29.7.0
+ '@jest/types': 29.6.3
+ babel-jest: 29.7.0(@babel/[email protected])
+
+ dependencies:
+ chalk: 4.1.2
+ enhanced-resolve: 5.18.0
+ micromatch: 4.0.8
+ semver: 7.6.3
+ source-map: 0.7.4
+ typescript: 5.7.3
+ webpack: 5.97.1
+
+ dependencies:
+ '@cspotcode/source-map-support': 0.8.1
+ '@tsconfig/node10': 1.0.11
+ '@tsconfig/node12': 1.0.11
+ '@tsconfig/node14': 1.0.3
+ '@tsconfig/node16': 1.0.4
+ '@types/node': 20.17.12
+ acorn: 8.14.0
+ acorn-walk: 8.3.4
+ arg: 4.1.3
+ create-require: 1.1.1
+ diff: 4.0.2
+ make-error: 1.3.6
+ typescript: 5.7.3
+ v8-compile-cache-lib: 3.0.1
+ yn: 3.1.1
+
+ dependencies:
+ chalk: 4.1.2
+ enhanced-resolve: 5.18.0
+ tapable: 2.2.1
+ tsconfig-paths: 4.2.0
+
+ dependencies:
+ json5: 2.2.3
+ minimist: 1.2.8
+ strip-bom: 3.0.0
+
+
+
+
+
+ dependencies:
+ prelude-ls: 1.2.1
+
+
+
+
+ dependencies:
+ media-typer: 0.3.0
+ mime-types: 2.1.35
+
+ dependencies:
+ content-type: 1.0.5
+ media-typer: 1.1.0
+ mime-types: 3.0.1
+
+
+
+
+ optional: true
+
+ optional: true
+
+ dependencies:
+ random-bytes: 1.0.0
+
+ dependencies:
+ '@lukeed/csprng': 1.1.0
+
+
+
+
+
+ dependencies:
+ '@fastify/busboy': 2.1.1
+
+
+ dependencies:
+ extend-shallow: 2.0.1
+
+ dependencies:
+ qs: 6.14.0
+
+
+
+ dependencies:
+ browserslist: 4.24.4
+ escalade: 3.2.0
+ picocolors: 1.1.1
+
+ optional: true
+
+ dependencies:
+ punycode: 2.3.1
+
+
+
+ dependencies:
+ any-promise: 1.3.0
+ content-type: 1.0.5
+ default-user-agent: 1.0.0
+ digest-header: 1.1.0
+ ee-first: 1.1.1
+ formstream: 1.5.1
+ humanize-ms: 1.2.1
+ iconv-lite: 0.6.3
+ pump: 3.0.2
+ qs: 6.14.0
+ statuses: 1.5.0
+ utility: 1.18.0
+
+
+ dependencies:
+ inherits: 2.0.3
+
+ dependencies:
+ copy-to: 2.0.1
+ escape-html: 1.0.3
+ mkdirp: 0.5.6
+ mz: 2.7.0
+ unescape: 1.0.1
+
+
+
+
+
+
+
+ dependencies:
+ '@jridgewell/trace-mapping': 0.3.25
+ '@types/istanbul-lib-coverage': 2.0.6
+ convert-source-map: 2.0.0
+
+ optional: true
+
+
+
+ optional: true
+
+ dependencies:
+ foreachasync: 3.0.0
+
+ dependencies:
+ makeerror: 1.0.12
+
+ dependencies:
+ glob-to-regexp: 0.4.1
+ graceful-fs: 4.2.11
+
+ dependencies:
+ defaults: 1.0.4
+
+ dependencies:
+ ansi-colors: 4.1.3
+ escape-goat: 3.0.0
+ htmlparser2: 5.0.1
+ mime: 2.6.0
+ node-fetch: 2.7.0
+ valid-data-url: 3.0.1
+ transitivePeerDependencies:
+ - encoding
+ optional: true
+
+
+
+
+
+
+ dependencies:
+ '@types/eslint-scope': 3.7.7
+ '@types/estree': 1.0.6
+ '@webassemblyjs/ast': 1.14.1
+ '@webassemblyjs/wasm-edit': 1.14.1
+ '@webassemblyjs/wasm-parser': 1.14.1
+ acorn: 8.14.0
+ browserslist: 4.24.4
+ chrome-trace-event: 1.0.4
+ enhanced-resolve: 5.18.0
+ es-module-lexer: 1.6.0
+ eslint-scope: 5.1.1
+ events: 3.3.0
+ glob-to-regexp: 0.4.1
+ graceful-fs: 4.2.11
+ json-parse-even-better-errors: 2.3.1
+ loader-runner: 4.3.0
+ mime-types: 2.1.35
+ neo-async: 2.6.2
+ schema-utils: 3.3.0
+ tapable: 2.2.1
+ terser-webpack-plugin: 5.3.11([email protected])
+ watchpack: 2.4.2
+ webpack-sources: 3.2.3
+ transitivePeerDependencies:
+ - '@swc/core'
+ - esbuild
+ - uglify-js
+
+ dependencies:
+ '@fidm/x509': 1.2.1
+ superagent: 8.0.6
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ iconv-lite: 0.6.3
+
+ dependencies:
+ iconv-lite: 0.6.3
+
+
+ dependencies:
+ tr46: 4.1.1
+ webidl-conversions: 7.0.0
+
+ dependencies:
+ tr46: 0.0.3
+ webidl-conversions: 3.0.1
+
+ dependencies:
+ isexe: 2.0.0
+ optional: true
+
+ dependencies:
+ isexe: 2.0.0
+
+ dependencies:
+ semver: 5.7.2
+
+ dependencies:
+ '@babel/parser': 7.26.5
+ '@babel/types': 7.26.5
+ assert-never: 1.4.0
+ babel-walk: 3.0.0-canary-5
+ optional: true
+
+
+
+
+ dependencies:
+ ansi-styles: 4.3.0
+ string-width: 4.2.3
+ strip-ansi: 6.0.1
+
+ dependencies:
+ ansi-styles: 4.3.0
+ string-width: 4.2.3
+ strip-ansi: 6.0.1
+
+ dependencies:
+ ansi-styles: 6.2.1
+ string-width: 5.1.2
+ strip-ansi: 7.1.0
+
+
+ dependencies:
+ imurmurhash: 0.1.4
+ signal-exit: 3.0.7
+
+ dependencies:
+ sax: 1.4.1
+
+ dependencies:
+ sax: 1.4.1
+ xmlbuilder: 11.0.1
+
+ dependencies:
+ sax: 1.4.1
+ xmlbuilder: 11.0.1
+
+
+
+
+
+
+
+
+ dependencies:
+ cliui: 8.0.1
+ escalade: 3.2.0
+ get-caller-file: 2.0.5
+ require-directory: 2.1.1
+ string-width: 4.2.3
+ y18n: 5.0.8
+ yargs-parser: 21.1.1
+
+
+
+ dependencies:
+ archiver-utils: 5.0.2
+ compress-commons: 6.0.2
+ readable-stream: 4.7.0
diff --git a/server/src/_swagger.ts b/server/src/_swagger.ts
new file mode 100644
index 00000000..0bb0ae4f
--- /dev/null
+++ b/server/src/_swagger.ts
@@ -0,0 +1,30 @@
+/*
+ * @Author: nevin
+ * @Date: 2021-12-21 18:05:12
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-01-15 14:24:51
+ * @Description: 文档插件
+ */
+import { INestApplication } from '@nestjs/common';
+import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
+const API_URL = '/docs';
+export function createSwagger(app: INestApplication) {
+ // const version = require('../package.json').version || ''; // 获取同项目一致版本号
+ const version = '1.0.0'; // 获取同项目一致版本号
+
+ const docConfig = new DocumentBuilder()
+ .setTitle('爱团团AiToEarnAPI文档')
+ .setVersion(version)
+ .addBearerAuth()
+ .build();
+
+ const document = SwaggerModule.createDocument(app, docConfig, {});
+ SwaggerModule.setup(API_URL, app, document, {
+ customSiteTitle: `爱团团AiToEarnAPI文档`,
+ jsonDocumentUrl: `${API_URL}/openapi.json`, // 文档JSON
+ swaggerOptions: {
+ persistAuthorization: true, // 保持登录
+ },
+ });
+ return API_URL;
+}
diff --git a/server/src/app.controller.spec.ts b/server/src/app.controller.spec.ts
new file mode 100644
index 00000000..d22f3890
--- /dev/null
+++ b/server/src/app.controller.spec.ts
@@ -0,0 +1,22 @@
+import { Test, TestingModule } from '@nestjs/testing';
+import { AppController } from './app.controller';
+import { AppService } from './app.service';
+
+describe('AppController', () => {
+ let appController: AppController;
+
+ beforeEach(async () => {
+ const app: TestingModule = await Test.createTestingModule({
+ controllers: [AppController],
+ providers: [AppService],
+ }).compile();
+
+ appController = app.get<AppController>(AppController);
+ });
+
+ describe('root', () => {
+ it('should return "Hello World!"', () => {
+ expect(appController.getHello()).toBe('Hello World!');
+ });
+ });
+});
diff --git a/server/src/app.controller.ts b/server/src/app.controller.ts
new file mode 100644
index 00000000..b00f4497
--- /dev/null
+++ b/server/src/app.controller.ts
@@ -0,0 +1,37 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-03-19 15:34:32
+ * @LastEditors: nevin
+ * @Description: 应用
+ */
+import { Controller, Get, Req } from '@nestjs/common';
+import { AppService } from './app.service';
+import { Public } from './auth/auth.guard';
+import { Request as ExRequest } from 'express';
+
+@Public()
+@Controller()
+export class AppController {
+ constructor(private readonly appService: AppService) {}
+
+ // 获取应用的下载链接
+ @Get('down')
+ getDownUrl() {
+ return this.appService.getDownUrl();
+ }
+
+ @Get()
+ getHello(): string {
+ return this.appService.getHello();
+ }
+
+ // 获取用户的IP地址
+ @Get('ip')
+ async getIp(@Req() request: ExRequest) {
+ return {
+ xForwardedFor: request.headers['x-forwarded-for'] || '',
+ ip: request.ip || '',
+ };
+ }
+}
diff --git a/server/src/app.module.ts b/server/src/app.module.ts
new file mode 100644
index 00000000..679d6474
--- /dev/null
+++ b/server/src/app.module.ts
@@ -0,0 +1,120 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-15 14:17:16
+ * @LastEditTime: 2025-04-27 17:37:13
+ * @LastEditors: nevin
+ * @Description:
+ */
+import * as Joi from '@hapi/joi';
+import {
+ MiddlewareConsumer,
+ Module,
+ NestModule,
+ RequestMethod,
+} from '@nestjs/common';
+import { ConfigModule, ConfigService } from '@nestjs/config';
+import { APP_FILTER, APP_INTERCEPTOR } from '@nestjs/core';
+import { EventEmitterModule } from '@nestjs/event-emitter';
+import { ScheduleModule } from '@nestjs/schedule';
+import bullMqConfig from '../config/bullMq.config';
+import serverConfig from '../config/server.config';
+import googleConfig from '../config/google.config';
+import { AppController } from './app.controller';
+import { AppService } from './app.service';
+import { AuthModule } from './auth/auth.module';
+import { DbMongoModule } from './db/db-mongo.module';
+import { HttpExceptionFilter } from './filters/http-exception.filter';
+import { LoggingInterceptor } from './interceptor/logging.interceptor';
+import { TransformInterceptor } from './interceptor/transform.interceptor';
+import { OssModule } from './lib/oss/oss.module';
+import { RedisModule } from './lib/redis/redis.module';
+import { AlicloudSmsModule } from './lib/sms/alicloud-sms.module';
+import { WxModule } from './lib/wx/wx.module';
+import { ManagerModule } from './manager/manager.module';
+import { TaskModule } from './modules/task/task.module';
+import { UserModule } from './user/user.module';
+import { XMLMiddleware } from './middleware/xml.middleware';
+import { FinanceModule } from './modules/finance/finance.module';
+import { OtherModule } from './modules/other/other.module';
+import { OperateModule } from './modules/operate/operate.module';
+import { ToolsModule } from './modules/tools/tools.module';
+import { AccountModule } from './modules/account/account.module';
+import { PublishModule } from './modules/publish/publish.module';
+import { TracingModule } from './modules/tracing/tracing.module';
+import { RewardModule } from './modules/reward/reward.module';
+import { TmsModule } from './lib/tms/tms.module';
+import { PlatModule } from './modules/plat/plat.module';
+import { BullModule } from '@nestjs/bullmq';
+import { MailModule } from './lib/mail/mail.module';
+
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ envFilePath: `.env${process.env.NODE_ENV ? '.' + process.env.NODE_ENV : ''}`,
+ isGlobal: true,
+ ignoreEnvFile: false, // 取消忽略配置文件,为true则仅读取操作系统环境变量,常用于生产环境
+ load: [serverConfig, bullMqConfig, googleConfig], // 加载server.config自定义全局配置项
+ validationSchema: Joi.object({
+ // 配置文件.env校验
+ PORT: Joi.string().default('7000'),
+ NODE_ENV: Joi.string()
+ .valid('development', 'production', 'test')
+ .default('development'),
+ }),
+ }),
+ EventEmitterModule.forRoot(),
+ ScheduleModule.forRoot(),
+ DbMongoModule,
+ RedisModule,
+ // 队列
+ BullModule.forRootAsync({
+ imports: [ConfigModule],
+ inject: [ConfigService],
+ useFactory: async (configService: ConfigService) => {
+ return {
+ connection: {
+ host: configService.get<string>('BULLMQ_REDIS_CONFIG.HOST'),
+ port: configService.get<number>('BULLMQ_REDIS_CONFIG.PORT'),
+ password: configService.get<string>('BULLMQ_REDIS_CONFIG.PASSWORD'),
+ db: configService.get<number>('BULLMQ_REDIS_CONFIG.DB'),
+ removeOnComplete: true, // 完成后删除
+ removeOnFail: { count: 1, age: 1000 * 60 * 60 * 3 }, // 失败后保留一条记录一小时
+ },
+ };
+ },
+ }),
+ MailModule,
+ OssModule,
+ TmsModule,
+ AlicloudSmsModule,
+ AuthModule,
+ UserModule,
+ WxModule,
+ ManagerModule,
+ TaskModule,
+ FinanceModule,
+ OtherModule,
+ OperateModule,
+ ToolsModule,
+ AccountModule,
+ PublishModule,
+ TracingModule,
+ RewardModule,
+ PlatModule,
+ ],
+ controllers: [AppController],
+ providers: [
+ AppService,
+ { provide: APP_FILTER, useClass: HttpExceptionFilter },
+ { provide: APP_INTERCEPTOR, useClass: TransformInterceptor },
+ { provide: APP_INTERCEPTOR, useClass: LoggingInterceptor },
+ ],
+})
+export class AppModule implements NestModule {
+ configure(consumer: MiddlewareConsumer) {
+ consumer.apply(XMLMiddleware).forRoutes({
+ path: 'wxGzh/*',
+ method: RequestMethod.POST,
+ });
+ }
+}
diff --git a/server/src/app.service.ts b/server/src/app.service.ts
new file mode 100644
index 00000000..ef2a6600
--- /dev/null
+++ b/server/src/app.service.ts
@@ -0,0 +1,46 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-03-19 15:41:06
+ * @LastEditors: nevin
+ * @Description: 应用
+ */
+import { Injectable } from '@nestjs/common';
+import * as yaml from 'yaml';
+
+async function parseYml(url: string): Promise<any> {
+ try {
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error(`Failed to fetch ${url}: ${response.status}`);
+ }
+ const text = await response.text();
+ return yaml.parse(text.replace(/\\/g, ''));
+ } catch (error) {
+ console.error(`YAML解析失败: ${url}`, error);
+ throw error;
+ }
+}
+
+@Injectable()
+export class AppService {
+ async getDownUrl() {
+ const winYml = 'https://ylzsfile.yikart.cn/att/latest.yml';
+ const macYml = 'https://ylzsfile.yikart.cn/att/latest-mac.yml';
+
+ const [winYmlJson, macYmlJson] = await Promise.all([
+ parseYml(winYml),
+ parseYml(macYml),
+ ]);
+
+ return {
+ win: winYmlJson,
+ mac: macYmlJson,
+ hostUrl: 'https://ylzsfile.yikart.cn/att/',
+ };
+ }
+
+ getHello(): string {
+ return 'Hello!This is 爱团团AiToEarn';
+ }
+}
diff --git a/server/src/auth/auth.guard.ts b/server/src/auth/auth.guard.ts
new file mode 100644
index 00000000..58368f35
--- /dev/null
+++ b/server/src/auth/auth.guard.ts
@@ -0,0 +1,68 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-12-22 21:14:15
+ * @LastEditTime: 2025-02-25 21:33:04
+ * @LastEditors: nevin
+ * @Description:
+ */
+import {
+ CanActivate,
+ createParamDecorator,
+ ExecutionContext,
+ Injectable,
+ UnauthorizedException,
+} from '@nestjs/common';
+import { JwtService } from '@nestjs/jwt';
+import { Request } from 'express';
+import { SetMetadata } from '@nestjs/common';
+import { Reflector } from '@nestjs/core';
+
+export const GetToken = createParamDecorator(
+ async (data: string, ctx: ExecutionContext) => {
+ const req = ctx.switchToHttp().getRequest();
+ return req['user'];
+ },
+);
+
+export const IS_PUBLIC_KEY = 'isPublic';
+export const Public = () => SetMetadata(IS_PUBLIC_KEY, true);
+
+@Injectable()
+export class AuthGuard implements CanActivate {
+ constructor(
+ private jwtService: JwtService,
+ private reflector: Reflector,
+ ) {}
+
+ async canActivate(context: ExecutionContext): Promise<boolean> {
+ const isPublic = this.reflector.getAllAndOverride<boolean>(IS_PUBLIC_KEY, [
+ context.getHandler(),
+ context.getClass(),
+ ]);
+ if (isPublic) {
+ // 💡 查看此条件
+ return true;
+ }
+
+ const request = context.switchToHttp().getRequest();
+ const token = this.extractTokenFromHeader(request);
+ if (!token) {
+ throw new UnauthorizedException();
+ }
+ try {
+ const payload = await this.jwtService.verifyAsync(token, {
+ secret: process.env.AUTH_SECRET,
+ });
+ // 以便我们可以在路由处理器中访问它
+ request['user'] = payload;
+ } catch {
+ throw new UnauthorizedException();
+ }
+ return true;
+ }
+
+ private extractTokenFromHeader(request: Request): string | undefined {
+ const [type, token] = request.headers.authorization?.split(' ') ?? [];
+ return type === 'Bearer' ? token : undefined;
+ }
+}
diff --git a/server/src/auth/auth.module.ts b/server/src/auth/auth.module.ts
new file mode 100644
index 00000000..40c8743c
--- /dev/null
+++ b/server/src/auth/auth.module.ts
@@ -0,0 +1,37 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-04-14 12:28:22
+ * @LastEditors: nevin
+ * @Description: 认证
+ */
+import { Global, Module } from '@nestjs/common';
+import { JwtModule } from '@nestjs/jwt';
+import { AuthService } from './auth.service';
+import { AuthGuard } from './auth.guard';
+import { APP_GUARD } from '@nestjs/core';
+import { ManagerGuard } from './manager.guard';
+
+@Global()
+@Module({
+ imports: [
+ JwtModule.register({
+ global: true,
+ secret: process.env.AUTH_SECRET || '550e8400-e29b-41d4-a716-446655440000',
+ signOptions: { expiresIn: '30d' },
+ }),
+ ],
+ providers: [
+ AuthService,
+ {
+ provide: APP_GUARD,
+ useClass: AuthGuard,
+ },
+ {
+ provide: APP_GUARD,
+ useClass: ManagerGuard,
+ },
+ ],
+ exports: [AuthService],
+})
+export class AuthModule {}
diff --git a/server/src/auth/auth.service.ts b/server/src/auth/auth.service.ts
new file mode 100644
index 00000000..d009ca5a
--- /dev/null
+++ b/server/src/auth/auth.service.ts
@@ -0,0 +1,58 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-21 09:42:13
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-02-26 09:20:47
+ * @Description: 认证
+ */
+import { Injectable, UnauthorizedException } from '@nestjs/common';
+import { JwtService } from '@nestjs/jwt';
+import { TokenInfo } from './interfaces/auth.interfaces';
+
+@Injectable()
+export class AuthService {
+ constructor(private readonly jwtService: JwtService) {}
+
+ /**
+ * 生成Token
+ * @param tokenInfo
+ * @returns
+ */
+ async generateToken(tokenInfo: TokenInfo): Promise<string> {
+ const payload: TokenInfo = {
+ phone: tokenInfo.phone,
+ id: tokenInfo.id,
+ name: tokenInfo.name,
+ isManager: tokenInfo.isManager,
+ };
+ return this.jwtService.sign(payload);
+ }
+
+ /**
+ * 重置Token
+ * @param tokenInfo
+ * @returns
+ */
+ async resetToken(tokenInfo: TokenInfo): Promise<string> {
+ const payload: TokenInfo = {
+ phone: tokenInfo.phone,
+ id: tokenInfo.id,
+ name: tokenInfo.name,
+ isManager: tokenInfo.isManager,
+ };
+ return this.jwtService.sign(payload);
+ }
+
+ async decodeToken(token: string): Promise<TokenInfo> {
+ token = token.replace('Bearer ', '');
+ try {
+ return this.jwtService.decode(token);
+ } catch (error) {
+ if (error.name === 'TokenExpiredError') {
+ throw new UnauthorizedException('Token已过期,请重新登录');
+ } else {
+ throw new UnauthorizedException('Token校验失败,请重新登录');
+ }
+ }
+ }
+}
diff --git a/server/src/auth/interfaces/auth.interfaces.ts b/server/src/auth/interfaces/auth.interfaces.ts
new file mode 100644
index 00000000..bbe69578
--- /dev/null
+++ b/server/src/auth/interfaces/auth.interfaces.ts
@@ -0,0 +1,21 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-21 14:28:19
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-11-22 09:50:08
+ * @Description: 认证相关接口
+ */
+import { Request } from 'express';
+
+export interface TokenInfo {
+ readonly phone?: string;
+ readonly id: string;
+ readonly name?: string;
+ readonly exp?: number;
+ readonly isManager?: boolean;
+ readonly mail?: string;
+}
+
+export interface TokenReq extends Request {
+ tokenInfo: TokenInfo;
+}
diff --git a/server/src/auth/manager.guard.ts b/server/src/auth/manager.guard.ts
new file mode 100644
index 00000000..8699a888
--- /dev/null
+++ b/server/src/auth/manager.guard.ts
@@ -0,0 +1,71 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-06 12:10:04
+ * @LastEditTime: 2025-02-06 14:10:51
+ * @LastEditors: nevin
+ * @Description:
+ */
+import {
+ CanActivate,
+ ExecutionContext,
+ Injectable,
+ UnauthorizedException,
+} from '@nestjs/common';
+import { Reflector } from '@nestjs/core';
+import { JwtService } from '@nestjs/jwt';
+import { Request } from 'express';
+import { SetMetadata } from '@nestjs/common';
+import { IS_PUBLIC_KEY } from './auth.guard';
+
+export const IS_MANAGER_KEY = 'isManager';
+export const Manager = () => SetMetadata(IS_MANAGER_KEY, true);
+
+@Injectable()
+export class ManagerGuard implements CanActivate {
+ constructor(
+ private jwtService: JwtService,
+ private reflector: Reflector,
+ ) {}
+
+ async canActivate(context: ExecutionContext): Promise<boolean> {
+ const isManager = this.reflector.getAllAndOverride<boolean>(
+ IS_MANAGER_KEY,
+ [context.getHandler(), context.getClass()],
+ );
+
+ const isPublic = this.reflector.getAllAndOverride<boolean>(IS_PUBLIC_KEY, [
+ context.getHandler(),
+ context.getClass(),
+ ]);
+
+ if (!isManager || isPublic) {
+ return true;
+ }
+
+ const request = context.switchToHttp().getRequest();
+ const token = this.extractTokenFromHeader(request);
+ if (!token) {
+ throw new UnauthorizedException('token不存在,需要管理员权限');
+ }
+
+ try {
+ const payload = await this.jwtService.verifyAsync(token, {
+ secret: process.env.AUTH_SECRET,
+ });
+
+ if (!payload.isManager) {
+ throw new UnauthorizedException('需要管理员权限1');
+ }
+
+ request['user'] = payload;
+ } catch {
+ throw new UnauthorizedException('需要管理员权限2');
+ }
+ return true;
+ }
+
+ private extractTokenFromHeader(request: Request): string | undefined {
+ const [type, token] = request.headers.authorization?.split(' ') ?? [];
+ return type === 'Bearer' ? token : undefined;
+ }
+}
diff --git a/server/src/common/decorators/api-result.decorator.ts b/server/src/common/decorators/api-result.decorator.ts
new file mode 100644
index 00000000..2700f838
--- /dev/null
+++ b/server/src/common/decorators/api-result.decorator.ts
@@ -0,0 +1,97 @@
+import {
+ applyDecorators,
+ HttpStatus,
+ RequestMethod,
+ Type,
+} from '@nestjs/common';
+import { METHOD_METADATA } from '@nestjs/common/constants';
+import { ApiExtraModels, ApiResponse, getSchemaPath } from '@nestjs/swagger';
+
+import { ResOp } from '../../common/model/response.model';
+
+const baseTypeNames = ['String', 'Number', 'Boolean'];
+
+function genBaseProp(type: Type<any>) {
+ if (baseTypeNames.includes(type.name))
+ return { type: type.name.toLocaleLowerCase() };
+ else return { $ref: getSchemaPath(type) };
+}
+
+/**
+ * @description: 生成返回结果装饰器
+ */
+export function ApiResult<TModel extends Type<any>>({
+ type,
+ isPage,
+ status,
+}: {
+ type?: TModel | TModel[];
+ isPage?: boolean;
+ status?: HttpStatus;
+}) {
+ let prop = null;
+
+ if (Array.isArray(type)) {
+ if (isPage) {
+ prop = {
+ type: 'object',
+ properties: {
+ items: {
+ type: 'array',
+ items: { $ref: getSchemaPath(type[0]) },
+ },
+ meta: {
+ type: 'object',
+ properties: {
+ itemCount: { type: 'number', default: 0 },
+ totalItems: { type: 'number', default: 0 },
+ itemsPerPage: { type: 'number', default: 0 },
+ totalPages: { type: 'number', default: 0 },
+ currentPage: { type: 'number', default: 0 },
+ },
+ },
+ },
+ };
+ } else {
+ prop = {
+ type: 'array',
+ items: genBaseProp(type[0]),
+ };
+ }
+ } else if (type) {
+ prop = genBaseProp(type);
+ } else {
+ prop = { type: 'null', default: null };
+ }
+
+ const model = Array.isArray(type) ? type[0] : type;
+
+ return applyDecorators(
+ ApiExtraModels(model),
+ (
+ target: object,
+ key: string | symbol,
+ descriptor: TypedPropertyDescriptor<any>,
+ ) => {
+ queueMicrotask(() => {
+ const isPost =
+ Reflect.getMetadata(METHOD_METADATA, descriptor.value) ===
+ RequestMethod.POST;
+
+ ApiResponse({
+ status: status ?? (isPost ? HttpStatus.CREATED : HttpStatus.OK),
+ schema: {
+ allOf: [
+ { $ref: getSchemaPath(ResOp) },
+ {
+ properties: {
+ data: prop,
+ },
+ },
+ ],
+ },
+ })(target, key, descriptor);
+ });
+ },
+ );
+}
diff --git a/server/src/common/decorators/is-object-id.decorator.ts b/server/src/common/decorators/is-object-id.decorator.ts
new file mode 100644
index 00000000..0922024c
--- /dev/null
+++ b/server/src/common/decorators/is-object-id.decorator.ts
@@ -0,0 +1,32 @@
+import {
+ registerDecorator,
+ ValidationOptions,
+ ValidatorConstraint,
+ ValidatorConstraintInterface,
+ ValidationArguments,
+} from 'class-validator';
+import { isValidObjectId } from 'mongoose';
+
+@ValidatorConstraint({ name: 'isObjectId', async: false })
+export class IsObjectIdConstraint implements ValidatorConstraintInterface {
+ validate(value: any) {
+ if (!value) return true;
+ return isValidObjectId(value);
+ }
+
+ defaultMessage(args: ValidationArguments) {
+ return `${args.property} 必须是有效的 ObjectId`;
+ }
+}
+
+export function IsObjectId(validationOptions?: ValidationOptions) {
+ return function (object: object, propertyName: string) {
+ registerDecorator({
+ name: 'isObjectId',
+ target: object.constructor,
+ propertyName: propertyName,
+ options: validationOptions,
+ validator: IsObjectIdConstraint,
+ });
+ };
+}
diff --git a/server/src/common/decorators/param-object-id.decorator.ts b/server/src/common/decorators/param-object-id.decorator.ts
new file mode 100644
index 00000000..7cecf456
--- /dev/null
+++ b/server/src/common/decorators/param-object-id.decorator.ts
@@ -0,0 +1,15 @@
+import { Param, PipeTransform, BadRequestException } from '@nestjs/common';
+import { isValidObjectId } from 'mongoose';
+
+export class ObjectIdPipe implements PipeTransform {
+ transform(value: string) {
+ if (!isValidObjectId(value)) {
+ throw new BadRequestException('Invalid ObjectId');
+ }
+ return value;
+ }
+}
+
+export function ParamObjectId(property: string = 'id') {
+ return Param(property, new ObjectIdPipe());
+}
diff --git a/server/src/common/decorators/swagger.decorator.ts b/server/src/common/decorators/swagger.decorator.ts
new file mode 100644
index 00000000..92744d81
--- /dev/null
+++ b/server/src/common/decorators/swagger.decorator.ts
@@ -0,0 +1,11 @@
+import { applyDecorators } from '@nestjs/common';
+import { ApiSecurity } from '@nestjs/swagger';
+
+export const API_SECURITY_AUTH = 'auth';
+
+/**
+ * like to @ApiSecurity('auth')
+ */
+export function ApiSecurityAuth(): ClassDecorator & MethodDecorator {
+ return applyDecorators(ApiSecurity(API_SECURITY_AUTH));
+}
diff --git a/server/src/common/dto/delete.dto.ts b/server/src/common/dto/delete.dto.ts
new file mode 100644
index 00000000..6f87b9e8
--- /dev/null
+++ b/server/src/common/dto/delete.dto.ts
@@ -0,0 +1,8 @@
+import { IsDefined, IsNotEmpty, IsNumber } from 'class-validator';
+
+export class BatchDeleteDto {
+ @IsDefined()
+ @IsNotEmpty()
+ @IsNumber({}, { each: true })
+ ids: number[];
+}
diff --git a/server/src/common/dto/id.dto.ts b/server/src/common/dto/id.dto.ts
new file mode 100644
index 00000000..271bece0
--- /dev/null
+++ b/server/src/common/dto/id.dto.ts
@@ -0,0 +1,6 @@
+import { IsNumber } from 'class-validator';
+
+export class IdDto {
+ @IsNumber()
+ id: number;
+}
diff --git a/server/src/common/dto/multi-image.dto.ts b/server/src/common/dto/multi-image.dto.ts
new file mode 100644
index 00000000..972822db
--- /dev/null
+++ b/server/src/common/dto/multi-image.dto.ts
@@ -0,0 +1,17 @@
+import { ApiProperty } from '@nestjs/swagger';
+import { IsNumber, IsOptional, IsString } from 'class-validator';
+
+export class MultiImage {
+ @ApiProperty({ description: '图片地址' })
+ @IsString()
+ url: string;
+
+ @ApiProperty({ description: '图片名称' })
+ @IsString()
+ name: string;
+
+ @ApiProperty({ description: '图片大小', required: false })
+ @IsNumber()
+ @IsOptional()
+ size?: number;
+}
diff --git a/server/src/common/dto/operator.dto.ts b/server/src/common/dto/operator.dto.ts
new file mode 100644
index 00000000..01d5bcaf
--- /dev/null
+++ b/server/src/common/dto/operator.dto.ts
@@ -0,0 +1,12 @@
+import { ApiHideProperty } from '@nestjs/swagger';
+import { Exclude } from 'class-transformer';
+
+export class OperatorDto {
+ @ApiHideProperty()
+ @Exclude()
+ createBy: number;
+
+ @ApiHideProperty()
+ @Exclude()
+ updateBy: number;
+}
diff --git a/server/src/common/dto/pager.dto.ts b/server/src/common/dto/pager.dto.ts
new file mode 100644
index 00000000..78878806
--- /dev/null
+++ b/server/src/common/dto/pager.dto.ts
@@ -0,0 +1,61 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-20 16:36:41
+ * @LastEditTime: 2025-02-22 18:09:51
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Transform } from 'class-transformer';
+import {
+ Allow,
+ IsEnum,
+ IsInt,
+ IsOptional,
+ IsString,
+ Max,
+ Min,
+} from 'class-validator';
+
+export enum Order {
+ ASC = 'ASC',
+ DESC = 'DESC',
+}
+
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+export class PagerDto<T = any> {
+ @ApiProperty({ minimum: 1, default: 1 })
+ @Min(1)
+ @IsInt()
+ @Expose()
+ @IsOptional({ always: true })
+ @Transform(({ value: val }) => (val ? Number.parseInt(val) : 1), {
+ toClassOnly: true,
+ })
+ page: number = 1;
+
+ @ApiProperty({ minimum: 1, maximum: 100, default: 20 })
+ @Min(1)
+ @Max(100)
+ @IsInt()
+ @IsOptional({ always: true })
+ @Expose()
+ @Transform(({ value: val }) => (val ? Number.parseInt(val) : 20), {
+ toClassOnly: true,
+ })
+ pageSize: number = 20;
+
+ @ApiProperty({ required: false })
+ @IsString()
+ @IsOptional()
+ field?: string;
+
+ @ApiProperty({ enum: Order, required: false })
+ @IsEnum(Order)
+ @IsOptional()
+ @Transform(({ value }) => (value === 'asc' ? Order.ASC : Order.DESC))
+ order?: Order;
+
+ @Allow()
+ _t?: number;
+}
diff --git a/server/src/common/model/response.model.ts b/server/src/common/model/response.model.ts
new file mode 100644
index 00000000..1f017806
--- /dev/null
+++ b/server/src/common/model/response.model.ts
@@ -0,0 +1,37 @@
+import { ApiProperty } from '@nestjs/swagger';
+
+export class ResOp<T = any> {
+ @ApiProperty({ type: 'object', additionalProperties: true })
+ data?: T;
+
+ @ApiProperty({ type: 'number', default: 200 })
+ code: number;
+
+ @ApiProperty({ type: 'string', default: '请求成功' })
+ msg: string;
+
+ constructor(code: number, data: T, message = '请求成功') {
+ this.code = code;
+ this.data = data;
+ this.msg = message;
+ }
+
+ static success<T>(data?: T, message?: string) {
+ return new ResOp(200, data, message);
+ }
+
+ static error(code: number, message) {
+ return new ResOp(code, {}, message);
+ }
+}
+
+export class TreeResult<T> {
+ @ApiProperty()
+ id: number;
+
+ @ApiProperty()
+ parentId: number;
+
+ @ApiProperty()
+ children?: TreeResult<T>[];
+}
diff --git a/server/src/common/paginate/create-pagination.ts b/server/src/common/paginate/create-pagination.ts
new file mode 100644
index 00000000..e04830ba
--- /dev/null
+++ b/server/src/common/paginate/create-pagination.ts
@@ -0,0 +1,83 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-20 16:36:41
+ * @LastEditTime: 2025-02-22 17:43:47
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Model } from 'mongoose';
+import {
+ IPaginationMeta,
+ IPaginationOptions,
+ PaginationTypeEnum,
+} from './interface';
+import { Pagination } from './pagination';
+
+const DEFAULT_LIMIT = 20;
+const DEFAULT_PAGE = 1;
+
+export function resolveOptions(
+ options: IPaginationOptions,
+): [number, number, PaginationTypeEnum] {
+ const { page, pageSize, paginationType } = options;
+
+ return [
+ page || DEFAULT_PAGE,
+ pageSize || DEFAULT_LIMIT,
+ paginationType || PaginationTypeEnum.TAKE_AND_SKIP,
+ ];
+}
+
+export function createPaginationObject<T>({
+ items,
+ totalItems,
+ currentPage,
+ limit,
+}: {
+ items: T[];
+ totalItems?: number;
+ currentPage: number;
+ limit: number;
+}): Pagination<T> {
+ const totalPages =
+ totalItems !== undefined ? Math.ceil(totalItems / limit) : undefined;
+
+ const meta: IPaginationMeta = {
+ totalItems,
+ itemCount: items.length,
+ itemsPerPage: +limit,
+ totalPages,
+ currentPage: +currentPage,
+ };
+
+ return new Pagination<T>(items, meta);
+}
+
+export async function paginateModel<T>(
+ model: Model<T>,
+ options: IPaginationOptions,
+ condition: any,
+ populate?: any,
+ sort?: any,
+): Promise<Pagination<T>> {
+ const [page, limit] = resolveOptions(options);
+
+ const promises: [Promise<T[]>, Promise<number> | undefined] = [
+ model
+ .find(condition)
+ .skip(limit * (page - 1))
+ .limit(limit)
+ .populate(populate)
+ .sort(sort),
+ model.countDocuments(condition),
+ ];
+
+ const [items, total] = await Promise.all(promises);
+
+ return createPaginationObject<T>({
+ items,
+ totalItems: total,
+ currentPage: page,
+ limit,
+ });
+}
diff --git a/server/src/common/paginate/interface.ts b/server/src/common/paginate/interface.ts
new file mode 100644
index 00000000..5f88221c
--- /dev/null
+++ b/server/src/common/paginate/interface.ts
@@ -0,0 +1,25 @@
+export enum PaginationTypeEnum {
+ LIMIT_AND_OFFSET = 'limit',
+ TAKE_AND_SKIP = 'take',
+}
+
+export interface IPaginationOptions {
+ page: number;
+ pageSize: number;
+ paginationType?: PaginationTypeEnum;
+}
+
+export interface IPaginationMeta {
+ itemCount: number;
+ totalItems?: number;
+ itemsPerPage: number;
+ totalPages?: number;
+ currentPage: number;
+}
+
+export interface IPaginationLinks {
+ first?: string;
+ previous?: string;
+ next?: string;
+ last?: string;
+}
diff --git a/server/src/common/paginate/pagination.ts b/server/src/common/paginate/pagination.ts
new file mode 100644
index 00000000..ed28de2d
--- /dev/null
+++ b/server/src/common/paginate/pagination.ts
@@ -0,0 +1,15 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-20 16:36:41
+ * @LastEditTime: 2025-02-22 17:47:03
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { IPaginationMeta } from './interface';
+
+export class Pagination<T> {
+ constructor(
+ public readonly items: T[],
+ public readonly meta: IPaginationMeta,
+ ) {}
+}
diff --git a/server/src/common/validators/date-range.validator.ts b/server/src/common/validators/date-range.validator.ts
new file mode 100644
index 00000000..03eb22d3
--- /dev/null
+++ b/server/src/common/validators/date-range.validator.ts
@@ -0,0 +1,22 @@
+import {
+ ValidationArguments,
+ ValidatorConstraint,
+ ValidatorConstraintInterface,
+} from 'class-validator';
+
+@ValidatorConstraint({ name: 'isDateRange', async: false })
+export class IsDateRange implements ValidatorConstraintInterface {
+ validate(propertyValue: Date, args: ValidationArguments) {
+ const [relatedPropertyName] = args.constraints;
+ const relatedValue = (args.object as any)[relatedPropertyName];
+
+ if (!propertyValue || !relatedValue) return true;
+
+ return propertyValue < relatedValue;
+ }
+
+ defaultMessage(args: ValidationArguments) {
+ const [relatedPropertyName] = args.constraints;
+ return `${args.property}必须早于${relatedPropertyName}`;
+ }
+}
diff --git a/server/src/common/validators/image-url.validator.ts b/server/src/common/validators/image-url.validator.ts
new file mode 100644
index 00000000..ef43fcb4
--- /dev/null
+++ b/server/src/common/validators/image-url.validator.ts
@@ -0,0 +1,31 @@
+import {
+ registerDecorator,
+ ValidationArguments,
+ ValidatorConstraint,
+ ValidatorConstraintInterface,
+} from 'class-validator';
+
+@ValidatorConstraint({ name: 'isValidImageUrl', async: false })
+class IsValidImageUrlConstraint implements ValidatorConstraintInterface {
+ validate(value: string) {
+ if (!value) return false;
+
+ // 检查是否是有效的图片URL
+ const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp'];
+ return imageExtensions.some((ext) => value.toLowerCase().endsWith(ext));
+ }
+
+ defaultMessage(args: ValidationArguments) {
+ return `${args.property}必须是有效的图片URL地址`;
+ }
+}
+
+export function IsValidImageUrl() {
+ return function (object: object, propertyName: string) {
+ registerDecorator({
+ target: object.constructor,
+ propertyName,
+ validator: IsValidImageUrlConstraint,
+ });
+ };
+}
diff --git a/server/src/db/db-mongo.module.ts b/server/src/db/db-mongo.module.ts
new file mode 100644
index 00000000..4ee03ebd
--- /dev/null
+++ b/server/src/db/db-mongo.module.ts
@@ -0,0 +1,35 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-09-23 18:00:51
+ * @LastEditTime: 2025-01-15 14:20:46
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Global, Module } from '@nestjs/common';
+import { ConfigModule, ConfigService } from '@nestjs/config';
+import { MongooseModule } from '@nestjs/mongoose';
+import mongoConfig from '../../config/mongo.config';
+import { Id, IdSchema } from './id.schema';
+import { IdService } from './id.service';
+
+@Global()
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [mongoConfig], // 加载配置
+ }),
+ MongooseModule.forRootAsync({
+ imports: [ConfigModule], // 数据库配置项依赖于ConfigModule,需在此引入
+ inject: [ConfigService],
+ useFactory: (configService: ConfigService) =>
+ configService.get('MONGO_CONFIG'),
+ }),
+ MongooseModule.forFeature([
+ // 挂载实体
+ { name: Id.name, schema: IdSchema },
+ ]),
+ ],
+ providers: [IdService],
+ exports: [IdService],
+})
+export class DbMongoModule {}
diff --git a/server/src/db/id.schema.ts b/server/src/db/id.schema.ts
new file mode 100644
index 00000000..3c624fd5
--- /dev/null
+++ b/server/src/db/id.schema.ts
@@ -0,0 +1,23 @@
+/*
+ * @Author: nevin
+ * @Date: 2021-12-24 13:46:31
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-08-30 15:01:32
+ * @Description: 自增主键ID
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { Document } from 'mongoose';
+
+export type IdDocument = Id & Document;
+@Schema({ collection: 't_ids', versionKey: false })
+export class Id {
+ @Prop({ required: true })
+ id_value: number;
+
+ @Prop({ required: true })
+ id_name: string;
+
+ @Prop()
+ update_time: number;
+}
+export const IdSchema = SchemaFactory.createForClass(Id);
diff --git a/server/src/db/id.service.ts b/server/src/db/id.service.ts
new file mode 100644
index 00000000..f657eca7
--- /dev/null
+++ b/server/src/db/id.service.ts
@@ -0,0 +1,54 @@
+/*
+ * @Author: nevin
+ * @Date: 2021-12-24 13:49:52
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-08-30 15:01:55
+ * @Description: 自增ID
+ */
+import { Model } from 'mongoose';
+import { InjectModel } from '@nestjs/mongoose';
+import { Injectable } from '@nestjs/common';
+import { Id, IdDocument } from './id.schema';
+
+@Injectable()
+export class IdService {
+ constructor(
+ @InjectModel(Id.name) private readonly idModel: Model<IdDocument>,
+ ) {}
+
+ /**
+ * @description: 创建id
+ * @param {string} id_name id名称
+ * @param {number} id_value id
+ * @return: Promise<number>
+ */
+ public async createId<T extends string | number>(
+ id_name: string,
+ id_value: number,
+ id_type: T,
+ ): Promise<T> {
+ const fadArgs = {
+ query: {
+ id_name,
+ },
+ update: {
+ $inc: { id_value: 1 },
+ $set: { update_time: new Date() },
+ },
+ options: { new: true },
+ };
+ let newId = await this.idModel
+ .findOneAndUpdate(fadArgs.query, fadArgs.update, fadArgs.options)
+ .exec();
+ if (newId) {
+ return <T>newId.id_value;
+ }
+ const createdUser = new this.idModel({ id_name, id_value });
+ newId = await createdUser.save();
+
+ const id =
+ typeof id_type === 'string' ? newId.id_value.toString() : newId.id_value;
+
+ return <T>id;
+ }
+}
diff --git a/server/src/db/schema/account.schema.ts b/server/src/db/schema/account.schema.ts
new file mode 100644
index 00000000..718c2ffa
--- /dev/null
+++ b/server/src/db/schema/account.schema.ts
@@ -0,0 +1,171 @@
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { Types } from 'mongoose';
+
+// 平台类型
+export enum AccountType {
+ Douyin = 'douyin', // 抖音
+ Xhs = 'xhs', // 小红书
+ WxSph = 'wxSph', // 微信视频号
+ KWAI = 'KWAI', // 快手
+ YOUTUBE = 'youtube', // youtube
+ TWITTER = 'twitter', // twitter
+ TIKTOK = 'tiktok', // tiktok
+}
+
+// 账号状态
+export enum AccountStatus {
+ // 未失效
+ USABLE = 0,
+ // 失效
+ DISABLE = 1,
+}
+
+@Schema({
+ collection: 'account',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class Account extends TimeTemp {
+ @Prop({
+ required: true,
+ unique: true,
+ type: Number,
+ index: true,
+ })
+ id: number;
+
+ @Prop({
+ required: true,
+ type: String,
+ })
+ userId: string;
+
+ @Prop({
+ required: true,
+ enum: AccountType,
+ })
+ type: AccountType;
+
+ @Prop({
+ required: true,
+ type: String,
+ })
+ loginCookie: string;
+
+ @Prop({
+ required: false,
+ type: String,
+ default: '',
+ })
+ token: string; // 其他token 目前抖音用
+
+ @Prop({
+ required: false,
+ type: Date,
+ })
+ loginTime?: Date;
+
+ @Prop({
+ required: true,
+ })
+ uid: string;
+
+ @Prop({
+ required: true,
+ })
+ account: string;
+
+ @Prop({
+ required: true,
+ })
+ avatar: string;
+
+ @Prop({
+ required: true,
+ })
+ nickname: string;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ fansCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ readCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ likeCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ collectCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ forwardCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ commentCount: number;
+
+ @Prop({
+ required: false,
+ type: Date,
+ })
+ lastStatsTime?: Date;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ workCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ income: number;
+
+ // 账户关联组,与 accountGroup.id 关联
+ @Prop({ type: Number, required: true })
+ groupId: number;
+
+ @Prop({
+ required: true,
+ default: AccountStatus.USABLE,
+ })
+ status: AccountStatus; // 登录状态,用于判断是否失效
+
+ @Prop({
+ required: false,
+ })
+ googleId: string;
+
+ // @Prop({
+ // required: false,
+ // })
+ // accessToken: string;
+
+ // @Prop({
+ // required: false,
+ // })
+ // refreshToken: string;
+}
+
+export const AccountSchema = SchemaFactory.createForClass(Account);
diff --git a/server/src/db/schema/accountGroup.schema.ts b/server/src/db/schema/accountGroup.schema.ts
new file mode 100644
index 00000000..608b018c
--- /dev/null
+++ b/server/src/db/schema/accountGroup.schema.ts
@@ -0,0 +1,58 @@
+// 账户组默认ID
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+
+import { TimeTemp } from './time.tamp';
+
+// 默认用户组类型
+export enum AccountGroupDefaultType {
+ Default = 0,
+ NonDefault = 1,
+}
+
+@Schema({
+ collection: 'accountGroup',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class AccountGroup extends TimeTemp {
+ @Prop({
+ unique: true,
+ index: true,
+ type: Number,
+ required: true,
+ })
+ id: number;
+
+ @Prop({
+ required: true,
+ type: String,
+ })
+ userId: string;
+
+ // 是否为默认用户组
+ @Prop({
+ required: true,
+ type: Number,
+ default: AccountGroupDefaultType.NonDefault,
+ })
+ isDefault: number;
+
+ // 组名称
+ @Prop({
+ required: true,
+ type: String,
+ })
+ name: string;
+
+ // 组排序
+ @Prop({
+ required: true,
+ type: Number,
+ default: 1,
+ })
+ rank: number;
+}
+
+export const AccountGroupSchema = SchemaFactory.createForClass(AccountGroup);
diff --git a/server/src/db/schema/accountToken.schema.ts b/server/src/db/schema/accountToken.schema.ts
new file mode 100644
index 00000000..298916bd
--- /dev/null
+++ b/server/src/db/schema/accountToken.schema.ts
@@ -0,0 +1,83 @@
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { Types } from 'mongoose';
+
+// 平台类型
+export enum TokenPlatform {
+ Douyin = 'douyin', // 抖音
+ Xhs = 'xhs', // 小红书
+ WxSph = 'wxSph', // 微信视频号
+ KWAI = 'KWAI', // 快手
+ YOUTUBE = "youtube", // youtube
+ TWITTER = "twitter", // twitter
+ TIKTOK = "tiktok", // tiktok
+}
+
+// 账号状态
+export enum TokenStatus {
+ // 未失效
+ USABLE = 0,
+ // 失效
+ DISABLE = 1,
+}
+
+@Schema({
+ collection: 'accountToken',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class AccountToken extends TimeTemp {
+
+ @Prop({
+ required: true,
+ type: String,
+ })
+ userId: string;
+
+ @Prop({
+ required: true,
+ enum: TokenPlatform,
+ })
+ platform: TokenPlatform;
+
+ @Prop({
+ required: true,
+ type: String,
+ default: '',
+ })
+ refreshToken: string;
+
+ @Prop({
+ required: true,
+ unique: true,
+ })
+ accountId: string;
+
+ @Prop({
+ required: true,
+ default: TokenStatus.USABLE,
+ })
+ status: TokenStatus;
+
+ @Prop({
+ required: true,
+ type: Date,
+ })
+ createTime: Date;
+
+ @Prop({
+ required: true,
+ type: Date,
+ })
+ expiresAt: Date;
+
+ @Prop({
+ required: true,
+ type: Date,
+ })
+ updateTime: Date;
+}
+
+export const AccountTokenSchema = SchemaFactory.createForClass(AccountToken);
diff --git a/server/src/db/schema/banner.schema.ts b/server/src/db/schema/banner.schema.ts
new file mode 100644
index 00000000..383f23b1
--- /dev/null
+++ b/server/src/db/schema/banner.schema.ts
@@ -0,0 +1,48 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2024-11-27 13:01:10
+ * @LastEditors: nevin
+ * @Description: banner Banner
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { ONOFF } from 'src/global/enum/all.enum';
+
+export enum BannerTag {
+ HOME = 'home',
+}
+
+@Schema({
+ collection: 'banner',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class Banner extends TimeTemp {
+ id: string;
+
+ @Prop({ required: false, comment: '数据ID' })
+ dataId: string;
+
+ @Prop({ required: false, comment: '描述' })
+ desc: string;
+
+ @Prop({ required: false, comment: '链接' })
+ url: string;
+
+ @Prop({ required: true, comment: '图片链接' })
+ imgUrl: string;
+
+ @Prop({ required: true, comment: '标识', enum: BannerTag })
+ tag: BannerTag;
+
+ @Prop({
+ required: true,
+ comments: '是否发布',
+ enum: ONOFF,
+ })
+ isPublish: ONOFF;
+}
+
+export const BannerSchema = SchemaFactory.createForClass(Banner);
diff --git a/server/src/db/schema/cfg.schema.ts b/server/src/db/schema/cfg.schema.ts
new file mode 100644
index 00000000..9c5583fc
--- /dev/null
+++ b/server/src/db/schema/cfg.schema.ts
@@ -0,0 +1,67 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-03-04 15:23:22
+ * @LastEditors: nevin
+ * @Description: 系统配置模块
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { ONOFF } from 'src/global/enum/all.enum';
+
+export enum CfgType {
+ comment = 'comment', // 通用
+}
+
+@Schema({
+ collection: 'cfg',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class Cfg extends TimeTemp {
+ id: string;
+
+ @Prop({
+ required: true,
+ type: String,
+ unique: true,
+ })
+ key: string;
+
+ @Prop({
+ required: true,
+ type: String,
+ })
+ title: string;
+
+ @Prop({
+ required: true,
+ type: Object,
+ })
+ content: any;
+
+ @Prop({
+ required: true,
+ enum: CfgType,
+ default: CfgType.comment,
+ })
+ type: CfgType;
+
+ @Prop({
+ required: true,
+ enum: ONOFF,
+ default: ONOFF.ON,
+ })
+ status: ONOFF;
+
+ @Prop({
+ required: false,
+ type: String,
+ default: '',
+ })
+ desc?: string;
+}
+
+export const CfgSchema = SchemaFactory.createForClass(Cfg);
diff --git a/server/src/db/schema/feedback.schema.ts b/server/src/db/schema/feedback.schema.ts
new file mode 100644
index 00000000..f603d97d
--- /dev/null
+++ b/server/src/db/schema/feedback.schema.ts
@@ -0,0 +1,60 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2024-11-22 09:53:38
+ * @LastEditors: nevin
+ * @Description: 反馈 Feedback feedback
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+
+export enum FeedbackType {
+ errReport = 'errReport', // 错误反馈
+ feedback = 'feedback', // 反馈
+ msgReport = 'msgReport', // 消息举报
+ msgFeedback = 'msgFeedback', // 消息反馈
+}
+
+@Schema({
+ collection: 'feedback',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class Feedback extends TimeTemp {
+ id: string;
+
+ @Prop({ required: true })
+ userId: string;
+
+ @Prop({ comment: '用户名' })
+ userName: string;
+
+ @Prop({
+ comment: '内容',
+ default: '',
+ })
+ content: string;
+
+ @Prop({
+ default: FeedbackType.feedback,
+ enum: FeedbackType,
+ })
+ type: FeedbackType;
+
+ @Prop({
+ comments: '标识数组',
+ type: [String],
+ default: [],
+ })
+ tagList?: string[];
+
+ @Prop({
+ comments: '文件链接数组',
+ type: [String],
+ default: [],
+ })
+ fileUrlList: string[];
+}
+
+export const FeedbackSchema = SchemaFactory.createForClass(Feedback);
diff --git a/server/src/db/schema/manager.schema.ts b/server/src/db/schema/manager.schema.ts
new file mode 100644
index 00000000..212043be
--- /dev/null
+++ b/server/src/db/schema/manager.schema.ts
@@ -0,0 +1,42 @@
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+
+export enum ManagerStatus {
+ STOP = 0, // 停用
+ OPEN = 1, // 正常
+ DELETE = 2, // 删除
+}
+
+@Schema({
+ collection: 'manager',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class Manager extends TimeTemp {
+ id: string;
+
+ @Prop({ required: true, unique: true })
+ account: string;
+
+ @Prop({ required: true })
+ password: string;
+
+ @Prop({ required: true })
+ salt: string;
+
+ @Prop({ required: true })
+ name: string;
+
+ @Prop({ default: ManagerStatus.OPEN })
+ status: ManagerStatus;
+
+ @Prop()
+ avatar?: string;
+
+ @Prop()
+ phone?: string;
+}
+
+export const ManagerSchema = SchemaFactory.createForClass(Manager);
diff --git a/server/src/db/schema/pubRecord.schema.ts b/server/src/db/schema/pubRecord.schema.ts
new file mode 100644
index 00000000..3b75296c
--- /dev/null
+++ b/server/src/db/schema/pubRecord.schema.ts
@@ -0,0 +1,95 @@
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+
+export enum PubType {
+ VIDEO = 'video', // 视频
+ ARTICLE = 'article', // 文章
+ ImageText = 'image-text', // 图文
+}
+
+export enum PubStatus {
+ UNPUBLISH = 0, // 未发布/草稿
+ RELEASED = 1, // 已发布
+ FAIL = 2, // 发布失败
+ PartSuccess = 3, // 部分成功
+}
+
+@Schema({
+ collection: 'pubRecord',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class PubRecord extends TimeTemp {
+ @Prop({
+ required: true,
+ unique: true,
+ type: Number,
+ })
+ id: number;
+
+ @Prop({
+ required: true,
+ })
+ userId: string;
+
+ @Prop({
+ required: true,
+ enum: PubType,
+ })
+ type: PubType;
+
+ @Prop({
+ required: true,
+ default: '',
+ })
+ title: string;
+
+ @Prop({
+ required: true,
+ default: '',
+ })
+ desc: string;
+
+ @Prop({
+ required: true,
+ })
+ accountId: number;
+
+ @Prop({
+ required: false,
+ })
+ videoPath?: string;
+
+ @Prop({
+ required: false,
+ type: Date,
+ })
+ timingTime?: Date; // 定时发布日期
+
+ @Prop({
+ required: false,
+ })
+ coverPath?: string; // '封面路径,展示给前台用
+
+ @Prop({
+ required: false,
+ })
+ commonCoverPath?: string; // 通用封面路径
+
+ @Prop({
+ required: true,
+ type: Date,
+ })
+ publishTime: Date;
+
+ @Prop({
+ required: true,
+ enum: PubStatus,
+ default: PubStatus.UNPUBLISH,
+ })
+ status: PubStatus;
+}
+
+export const PubRecordSchema = SchemaFactory.createForClass(PubRecord);
diff --git a/server/src/db/schema/qaRecord.schema.ts b/server/src/db/schema/qaRecord.schema.ts
new file mode 100644
index 00000000..b2a0954c
--- /dev/null
+++ b/server/src/db/schema/qaRecord.schema.ts
@@ -0,0 +1,54 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2025-04-14 17:40:15
+ * @LastEditors: nevin
+ * @Description: 反馈 Feedback feedback
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+
+export enum QaRecordType {
+ QA = 'qa',
+}
+
+@Schema({
+ collection: 'qaRecord',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class QaRecord extends TimeTemp {
+ id: string;
+
+ @Prop({ comment: '标题', nullable: false })
+ title: string;
+
+ @Prop({
+ comment: '内容',
+ nullable: false,
+ })
+ content: string;
+
+ @Prop({
+ enum: QaRecordType,
+ comment: '类型',
+ default: QaRecordType.QA,
+ })
+ type: QaRecordType;
+
+ @Prop({
+ comments: '标识数组',
+ type: [String],
+ default: [],
+ })
+ tagList: string[];
+
+ @Prop({
+ comment: '排序',
+ default: 0,
+ })
+ sort?: number;
+}
+
+export const QaRecordSchema = SchemaFactory.createForClass(QaRecord);
diff --git a/server/src/db/schema/realAuth.schema.ts b/server/src/db/schema/realAuth.schema.ts
new file mode 100644
index 00000000..3ce46ccc
--- /dev/null
+++ b/server/src/db/schema/realAuth.schema.ts
@@ -0,0 +1,42 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2024-11-27 13:01:10
+ * @LastEditors: nevin
+ * @Description: realAuth RealAuth
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+
+export enum SceneType {
+ Login = 'login',
+ UserWallet = 'userWallet',
+ Register = 'register',
+}
+
+@Schema({
+ collection: 'realAuth',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class RealAuth extends TimeTemp {
+ id: string;
+
+ @Prop({ required: true, comment: '用户ID' })
+ userId: string;
+
+ @Prop({ required: true, comment: '姓名' })
+ userName: string;
+
+ @Prop({ required: true, comment: '身份证号' })
+ identifyNum: string;
+
+ @Prop({ required: false, comment: '数据ID' })
+ dataId?: string;
+
+ @Prop({ required: false, comment: '场景类型', enum: SceneType })
+ sceneType?: SceneType;
+}
+
+export const RealAuthSchema = SchemaFactory.createForClass(RealAuth);
diff --git a/server/src/db/schema/signIn.schema.ts b/server/src/db/schema/signIn.schema.ts
new file mode 100644
index 00000000..1ec4e188
--- /dev/null
+++ b/server/src/db/schema/signIn.schema.ts
@@ -0,0 +1,37 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2025-04-27 17:34:58
+ * @LastEditors: nevin
+ * @Description: signIn SignIn
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+
+export enum SignInType {
+ PUL_VIDEO = 'pul_video',
+}
+
+@Schema({
+ collection: 'signIn',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class SignIn extends TimeTemp {
+ id: string;
+
+ @Prop({ required: true, comment: '用户ID', index: true })
+ userId: string;
+
+ @Prop({ required: true, comment: '类型', enum: SignInType })
+ type: SignInType;
+
+ @Prop({ required: false, comment: '触发时的数据ID' })
+ dataId?: string;
+
+ @Prop({ required: false, comment: '描述' })
+ desc?: string;
+}
+
+export const SignInSchema = SchemaFactory.createForClass(SignIn);
diff --git a/server/src/db/schema/statement.shema.ts b/server/src/db/schema/statement.shema.ts
new file mode 100644
index 00000000..447c9afa
--- /dev/null
+++ b/server/src/db/schema/statement.shema.ts
@@ -0,0 +1,33 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2025-02-27 15:18:16
+ * @LastEditors: nevin
+ * @Description: 用户流水
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { Decimal128 } from 'mongodb';
+
+@Schema({
+ collection: 'statement',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class Statement extends TimeTemp {
+ @Prop({
+ required: true,
+ })
+ userId: string;
+
+ @Prop({
+ type: Decimal128,
+ required: true,
+ default: 0,
+ })
+ balance: Decimal128;
+}
+
+export const StatementSchema = SchemaFactory.createForClass(Statement);
diff --git a/server/src/db/schema/task.schema.ts b/server/src/db/schema/task.schema.ts
new file mode 100644
index 00000000..b77ce1f1
--- /dev/null
+++ b/server/src/db/schema/task.schema.ts
@@ -0,0 +1,218 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-03-04 15:23:22
+ * @LastEditors: nevin
+ * @Description: 任务
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { AccountType } from './account.schema';
+
+export enum TaskType {
+ PRODUCT = 'product', // 商品任务
+ VIDEO = 'video', // 视频任务
+ ARTICLE = 'article', // 文章任务
+ PROMOTION = 'promotion', // 拉新任务
+ INTERACTION = 'interaction', // 互动任务
+}
+
+export enum TaskStatus {
+ ACTIVE = 'active', // 进行中
+ CANCELLED = 'cancelled', // 已取消
+ DEL = 'del', // 已删除
+}
+
+export interface TaskFile {
+ name: string;
+ url: string;
+}
+
+export class TaskFileSchema implements TaskFile {
+ @Prop({
+ required: true,
+ comment: '指标名称',
+ })
+ name: string;
+
+ @Prop({
+ required: true,
+ comment: '指标值',
+ })
+ url: string;
+}
+
+@Schema({ toJSON: { virtuals: true }, toObject: { virtuals: true } })
+export class TaskData {
+ @Prop({ required: false })
+ title?: string;
+
+ @Prop({ required: false })
+ desc?: string;
+}
+// 视频
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class TaskVideo extends TaskData {
+ @Prop({ required: false })
+ coverUrl?: string; // 封面图
+
+ @Prop({ required: true })
+ videoUrl: string;
+
+ @Prop({ required: false, type: [String], default: [] })
+ topicList: string[];
+}
+
+// 文章
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class TaskArticleImg {
+ @Prop({ required: true, default: '' })
+ content: string; // 内容
+
+ @Prop({ required: true })
+ imageUrl: string;
+}
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class TaskArticleMaterial {
+ @Prop({ required: false })
+ coverUrl?: string; // 封面图
+
+ @Prop({ required: false })
+ title?: string; // 标题
+
+ @Prop({ required: true })
+ temp: string; // 模板字符
+
+ // 图片列表
+ @Prop({ required: true, type: [TaskArticleImg], default: [] })
+ imageList: TaskArticleImg[];
+}
+
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class TaskArticle extends TaskData {
+ @Prop({ required: true, type: [TaskArticleMaterial], default: [] })
+ materialList: TaskArticleMaterial[]; // 素材列表
+
+ @Prop({ required: false, type: [String], default: [] })
+ topicList: string[];
+
+ // 图片列表
+ @Prop({ required: true, type: [String], default: [] })
+ imageList: string[];
+}
+
+// 推广
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class TaskPromotion extends TaskData {}
+
+// 商品
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class TaskProduct extends TaskData {
+ @Prop({ required: true }) // 商品价格
+ price: number;
+
+ // 销量
+ @Prop({ required: false })
+ sales?: number;
+}
+
+// 互动
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class TaskInteraction extends TaskData {
+ @Prop({ required: true, enum: AccountType })
+ accountType: AccountType; // 平台类型
+
+ @Prop({ required: true, type: String })
+ worksId: string; // 作品ID
+
+ @Prop({ required: false, type: String })
+ authorId?: string; // 作者ID
+
+ @Prop({ required: false, type: String })
+ commentContent?: string; // 评论内容,不填则使用AI
+}
+
+@Schema({
+ collection: 'task',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class Task extends TimeTemp {
+ id: string;
+
+ @Prop({ required: true })
+ title: string;
+
+ @Prop({
+ required: true,
+ })
+ description: string; // md文档
+
+ @Prop({ required: true, enum: TaskType })
+ type: TaskType;
+
+ @Prop({
+ required: false,
+ })
+ imageUrl: string; // 配图
+
+ @Prop({ type: Object, required: false })
+ dataInfo:
+ | TaskVideo
+ | TaskPromotion
+ | TaskProduct
+ | TaskInteraction
+ | TaskArticle;
+
+ @Prop({ type: [TaskFileSchema], default: [] })
+ fileList: TaskFileSchema[]; // 附件地址列表
+
+ @Prop({ required: true, default: 0 })
+ keepTime: number; // 保持时间(秒)
+
+ @Prop({ default: false })
+ requiresShoppingCart: boolean; // 是否需要挂购物车
+
+ @Prop({ required: true })
+ maxRecruits: number; // 最大招募人数
+
+ @Prop({ default: 0 })
+ currentRecruits: number; // 当前招募人数
+
+ @Prop({ required: true })
+ deadline: Date; // 任务截止时间
+
+ @Prop({ required: true, type: Number })
+ reward: number; // 任务奖励金额
+
+ @Prop({ default: TaskStatus.CANCELLED, enum: TaskStatus })
+ status: TaskStatus;
+
+ @Prop({ type: Array<AccountType>, required: true })
+ accountTypes: AccountType[]; // 支持的平台tag列表
+}
+
+export const TaskSchema = SchemaFactory.createForClass(Task);
diff --git a/server/src/db/schema/taskMaterial.schema.ts b/server/src/db/schema/taskMaterial.schema.ts
new file mode 100644
index 00000000..58c56c18
--- /dev/null
+++ b/server/src/db/schema/taskMaterial.schema.ts
@@ -0,0 +1,63 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-03-04 15:23:22
+ * @LastEditors: nevin
+ * @Description: 任务-素材
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { TaskType } from './task.schema';
+
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class TaskArticleImg {
+ @Prop({ required: false, default: '' })
+ content?: string; // 内容
+
+ @Prop({ required: true })
+ imageUrl: string;
+}
+
+@Schema({
+ collection: 'taskMaterial',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class TaskMaterial extends TimeTemp {
+ id: string;
+
+ @Prop({ required: true, index: true })
+ taskId: string;
+
+ @Prop({ required: true, enum: TaskType })
+ type: TaskType;
+
+ @Prop({ required: false })
+ title?: string; // 标题
+
+ @Prop({ required: false })
+ coverUrl?: string; // 封面图
+
+ @Prop({ required: false })
+ temp?: string; // 模板字符
+
+ @Prop({
+ required: false,
+ })
+ desc?: string;
+
+ // 图片列表
+ @Prop({ required: true, type: [TaskArticleImg], default: [] })
+ imageList: TaskArticleImg[];
+
+ // 已使用次数
+ @Prop({ required: true, default: 0 })
+ usedCount: number;
+}
+
+export const TaskMaterialSchema = SchemaFactory.createForClass(TaskMaterial);
diff --git a/server/src/db/schema/time.tamp.ts b/server/src/db/schema/time.tamp.ts
new file mode 100644
index 00000000..bf64ccf7
--- /dev/null
+++ b/server/src/db/schema/time.tamp.ts
@@ -0,0 +1,16 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-09-02 14:45:57
+ * @LastEditTime: 2025-02-22 12:37:22
+ * @LastEditors: nevin
+ * @Description: 时间模板
+ */
+import { Prop } from '@nestjs/mongoose';
+
+export class TimeTemp {
+ @Prop({ default: Date.now })
+ createTime: Date;
+
+ @Prop({ default: Date.now, set: () => new Date() })
+ updateTime: Date;
+}
diff --git a/server/src/db/schema/tracing.schema.ts b/server/src/db/schema/tracing.schema.ts
new file mode 100644
index 00000000..a38206be
--- /dev/null
+++ b/server/src/db/schema/tracing.schema.ts
@@ -0,0 +1,70 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-03-04 15:23:22
+ * @LastEditors: nevin
+ * @Description: 跟踪
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { SchemaTypes } from 'mongoose';
+import { TimeTemp } from './time.tamp';
+
+export enum TracingType {
+ EVENT = 'event', // 事件
+ ERROR = 'error', // 错误收集
+}
+
+@Schema({
+ collection: 'tracing',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class Tracing extends TimeTemp {
+ id: string;
+
+ @Prop({
+ required: true,
+ type: String,
+ index: true,
+ })
+ userId: string;
+
+ @Prop({
+ required: true,
+ enum: TracingType,
+ })
+ type: TracingType;
+
+ @Prop({
+ required: true,
+ type: String,
+ index: true,
+ })
+ tag: string;
+
+ @Prop({
+ required: false,
+ type: Number,
+ })
+ accountId?: number; // 平台账号ID
+
+ @Prop({
+ required: false,
+ })
+ desc?: string;
+
+ @Prop({
+ required: false,
+ })
+ dataId?: string; // 关联数据id
+
+ @Prop({
+ required: false,
+ type: SchemaTypes.Mixed,
+ })
+ data?: any; // 支持任意类型
+}
+
+export const TracingSchema = SchemaFactory.createForClass(Tracing);
diff --git a/server/src/db/schema/user-task.schema.ts b/server/src/db/schema/user-task.schema.ts
new file mode 100644
index 00000000..72301998
--- /dev/null
+++ b/server/src/db/schema/user-task.schema.ts
@@ -0,0 +1,127 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-09-02 14:45:57
+ * @LastEditTime: 2025-05-06 14:15:29
+ * @LastEditors: nevin
+ * @Description: 用户的任务
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { Types } from 'mongoose';
+import { TimeTemp } from './time.tamp';
+import { AccountType } from './account.schema';
+
+export enum UserTaskStatus {
+ DODING = 'doing', // 进行中
+ PENDING = 'pending', // 待审核
+ APPROVED = 'approved', // 已通过
+ REJECTED = 'rejected', // 已拒绝
+ CANCELLED = 'cancelled', // 已取消
+ DEL = 'del', // 已删除或回退
+}
+
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class AutoData {
+ @Prop({
+ required: true,
+ })
+ status: -1 | 0 | 1;
+
+ @Prop({ required: false })
+ message?: string;
+}
+
+@Schema({
+ collection: 'user_task',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class UserTask extends TimeTemp {
+ id: string;
+
+ @Prop({ type: Types.ObjectId, ref: 'User', required: true, index: true })
+ userId: Types.ObjectId;
+
+ @Prop({ type: Types.ObjectId, ref: 'Task', required: true })
+ taskId: Types.ObjectId;
+
+ @Prop({
+ type: String,
+ enum: UserTaskStatus,
+ default: UserTaskStatus.DODING,
+ index: true,
+ })
+ status: UserTaskStatus;
+
+ @Prop({
+ required: true,
+ enum: AccountType,
+ })
+ accountType: AccountType;
+
+ @Prop({
+ required: true,
+ })
+ uid: string; // 平台的用户ID
+
+ @Prop({
+ required: true,
+ })
+ account: string; // 平台的账号
+
+ @Prop({ required: true, default: 0 })
+ keepTime: number; // 保持时间(秒)
+
+ @Prop()
+ submissionUrl?: string; // 提交的视频、文章或截图URL
+
+ @Prop({
+ required: false,
+ })
+ taskMaterialId?: string; // 任务的素材ID
+
+ @Prop({ type: [String] })
+ screenshotUrls?: string[]; // 任务完成截图
+
+ @Prop()
+ qrCodeScanResult?: string; // 二维码扫描结果
+
+ @Prop()
+ submissionTime?: Date; // 提交时间
+
+ @Prop()
+ completionTime?: Date; // 完成时间
+
+ @Prop()
+ rejectionReason?: string; // 拒绝原因
+
+ @Prop({ type: Object })
+ metadata?: Record<string, any>; // 额外信息,如审核反馈等
+
+ @Prop({ default: false })
+ isFirstTimeSubmission: boolean; // 是否首次提交,用于确定是否给予首次奖励
+
+ @Prop()
+ verificationNote?: string; // 人工核查备注
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ reward: number; // 奖励金额
+
+ @Prop()
+ rewardTime?: Date; // 奖励发放时间
+
+ @Prop({ type: Types.ObjectId, ref: 'User' })
+ verifiedBy?: Types.ObjectId; // 核查人员ID
+
+ @Prop({ type: Object, required: false, default: {} })
+ autoData?: AutoData;
+}
+
+export const UserTaskSchema = SchemaFactory.createForClass(UserTask);
diff --git a/server/src/db/schema/user.schema.ts b/server/src/db/schema/user.schema.ts
new file mode 100644
index 00000000..f10fd846
--- /dev/null
+++ b/server/src/db/schema/user.schema.ts
@@ -0,0 +1,149 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2025-05-06 15:50:05
+ * @LastEditors: nevin
+ * @Description: 用户
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+export enum UserStatus {
+ STOP = 0,
+ OPEN = 1,
+ DELETE = -1,
+}
+
+export enum EarnInfoStatus {
+ CLOSE = 0,
+ OPEN = 1,
+}
+
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class UserBackData {
+ @Prop({
+ required: false,
+ })
+ phone?: string;
+
+ @Prop({ required: false })
+ wxOpenid?: string;
+
+ @Prop({ required: false })
+ wxUnionid?: string;
+}
+
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class UserEarnInfo {
+ @Prop({
+ required: true,
+ enum: EarnInfoStatus,
+ default: EarnInfoStatus.OPEN,
+ })
+ status: EarnInfoStatus;
+
+ @Prop({ required: true })
+ cycleInterval: number;
+}
+
+@Schema({
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+})
+export class GoogleAccount {
+ @Prop({ required: true })
+ googleId: string;
+
+ @Prop({ required: true })
+ email: string;
+
+ @Prop()
+ refreshToken: string;
+
+ @Prop()
+ expiresAt?: number;
+}
+
+@Schema({
+ collection: 'user',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class User extends TimeTemp {
+ id: string;
+
+ @Prop({
+ required: true,
+ default: '',
+ })
+ name: string;
+
+ @Prop({
+ required: false,
+ index: true,
+ unique: true,
+ })
+ mail?: string;
+
+ @Prop({ type: Object, required: false, default: {} })
+ googleAccount?: GoogleAccount;
+
+ @Prop({
+ required: false,
+ index: true,
+ unique: true,
+ })
+ googleId?: string;
+
+ @Prop({
+ required: false,
+ })
+ phone?: string;
+
+ @Prop({
+ required: false,
+ })
+ password?: string;
+
+ @Prop({
+ required: false,
+ })
+ salt?: string;
+
+ @Prop({
+ required: true,
+ enum: UserStatus,
+ default: UserStatus.OPEN,
+ })
+ status: UserStatus;
+
+ @Prop({ required: false })
+ wxOpenid?: string;
+
+ @Prop({ required: false })
+ wxUnionid?: string;
+
+ @Prop({ required: false })
+ popularizeCode?: string; // 我的推广码
+
+ @Prop({ required: false })
+ inviteUserId?: string; // 邀请人用户ID
+
+ @Prop({ required: false })
+ inviteCode?: string; // 我填写的邀请码
+
+ @Prop({ type: Object, required: false, default: {} })
+ backData?: UserBackData;
+
+ @Prop({ type: Object, required: false, default: {} })
+ earnInfo?: UserEarnInfo;
+}
+
+export const UserSchema = SchemaFactory.createForClass(User);
diff --git a/server/src/db/schema/userWallet.shema.ts b/server/src/db/schema/userWallet.shema.ts
new file mode 100644
index 00000000..1b42b882
--- /dev/null
+++ b/server/src/db/schema/userWallet.shema.ts
@@ -0,0 +1,41 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2025-03-24 20:56:59
+ * @LastEditors: nevin
+ * @Description: 用户钱包
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { Decimal128 } from 'mongodb';
+
+@Schema({
+ collection: 'userWallet',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class UserWallet extends TimeTemp {
+ @Prop({
+ required: true,
+ })
+ userId: string;
+
+ @Prop({
+ type: Decimal128,
+ required: true,
+ default: 0,
+ })
+ balance: Decimal128; // 余额
+
+ // 收入
+ @Prop({
+ type: Decimal128,
+ required: true,
+ default: 0,
+ })
+ income: Decimal128;
+}
+
+export const UserWalletSchema = SchemaFactory.createForClass(UserWallet);
diff --git a/server/src/db/schema/userWalletAccount.shema.ts b/server/src/db/schema/userWalletAccount.shema.ts
new file mode 100644
index 00000000..1916862e
--- /dev/null
+++ b/server/src/db/schema/userWalletAccount.shema.ts
@@ -0,0 +1,65 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2025-04-27 12:11:39
+ * @LastEditors: nevin
+ * @Description: 用户钱包账户
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+
+export enum WalletAccountType {
+ ZFB = 'ZFB',
+ WX_PAY = 'WX_PAY',
+}
+
+@Schema({
+ collection: 'userWalletAccount',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class UserWalletAccount extends TimeTemp {
+ id: string;
+
+ @Prop({
+ required: true,
+ })
+ userId: string;
+
+ @Prop({
+ required: true,
+ })
+ userName: string; // 真实姓名
+
+ @Prop({
+ required: false,
+ })
+ account?: string; // 账号
+
+ @Prop({
+ required: true,
+ })
+ cardNum: string; // 身份证号
+
+ @Prop({
+ required: true,
+ })
+ phone: string; // 绑定的手机号
+
+ @Prop({
+ required: true,
+ enum: WalletAccountType,
+ })
+ type: WalletAccountType;
+
+ @Prop({
+ required: true,
+ default: false,
+ })
+ isDef: boolean; // 是否默认
+}
+
+export const UserWalletAccountSchema =
+ SchemaFactory.createForClass(UserWalletAccount);
diff --git a/server/src/db/schema/userWalletRecord.shema.ts b/server/src/db/schema/userWalletRecord.shema.ts
new file mode 100644
index 00000000..00640017
--- /dev/null
+++ b/server/src/db/schema/userWalletRecord.shema.ts
@@ -0,0 +1,93 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-11-16 22:04:18
+ * @LastEditTime: 2025-03-24 21:44:35
+ * @LastEditors: nevin
+ * @Description: 钱包收支记录
+ */
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { Decimal128 } from 'mongodb';
+import { Types } from 'mongoose';
+import { UserWalletAccount } from './userWalletAccount.shema';
+
+export enum UserWalletRecordType {
+ TASK_COMMISSION = 'TASK_COMMISSION', // 任务佣金
+ WITHDRAW = 'WITHDRAW', // 提现
+}
+
+export enum UserWalletRecordStatus {
+ FAIL = -1,
+ WAIT = 0,
+ SUCCESS = 1,
+}
+@Schema({
+ collection: 'userWalletRecord',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class UserWalletRecord extends TimeTemp {
+ id: string;
+
+ @Prop({
+ index: true,
+ required: true,
+ })
+ userId: string;
+
+ @Prop({
+ type: Types.ObjectId,
+ ref: UserWalletAccount.name,
+ required: true,
+ })
+ account: Types.ObjectId;
+
+ @Prop({
+ index: true,
+ required: false,
+ })
+ dataId?: string; // 关联数据的ID
+
+ @Prop({
+ index: true,
+ required: true,
+ enum: UserWalletRecordType,
+ })
+ type: UserWalletRecordType;
+
+ @Prop({
+ index: true,
+ type: Decimal128,
+ required: true,
+ default: 0,
+ })
+ balance: Decimal128;
+
+ // 状态 -1 失败 0 等待 1 完成
+ @Prop({
+ index: true,
+ required: true,
+ default: UserWalletRecordStatus.WAIT,
+ })
+ status: UserWalletRecordStatus;
+
+ @Prop({
+ required: false,
+ })
+ payTime?: Date;
+
+ @Prop({
+ required: false,
+ })
+ des?: string;
+
+ @Prop({
+ required: false,
+ })
+ imgUrl?: string; // 反馈截图
+}
+
+export const UserWalletRecordSchema =
+ SchemaFactory.createForClass(UserWalletRecord);
diff --git a/server/src/db/schema/video.schema.ts b/server/src/db/schema/video.schema.ts
new file mode 100644
index 00000000..b7014523
--- /dev/null
+++ b/server/src/db/schema/video.schema.ts
@@ -0,0 +1,18 @@
+import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
+import { WorkData } from './workData.schema';
+
+@Schema({
+ collection: 'video',
+ versionKey: false,
+ toJSON: { virtuals: true },
+ toObject: { virtuals: true },
+ timestamps: false,
+})
+export class Video extends WorkData {
+ @Prop({
+ required: true,
+ })
+ videoPath: string; // 视频路径
+}
+
+export const VideoSchema = SchemaFactory.createForClass(Video);
diff --git a/server/src/db/schema/workData.schema.ts b/server/src/db/schema/workData.schema.ts
new file mode 100644
index 00000000..f70e8a7e
--- /dev/null
+++ b/server/src/db/schema/workData.schema.ts
@@ -0,0 +1,262 @@
+import { Prop, Schema } from '@nestjs/mongoose';
+import { TimeTemp } from './time.tamp';
+import { AccountType } from './account.schema';
+
+export enum PubStatus {
+ UNPUBLISH = 0, // 未发布/草稿
+ RELEASED = 1, // 已发布
+ FAIL = 2, // 发布失败
+}
+
+export interface ILableValue {
+ label: string;
+ value: string | number;
+}
+
+// 地点数据
+export interface ILocationDataItem {
+ // 地点名称
+ name: string;
+ // 简单地址简介
+ simpleAddress: string;
+ // 地址ID
+ id: string;
+ // 小红书特有
+ poi_type?: number;
+ latitude: number;
+ longitude: number;
+ // 市
+ city: string;
+}
+
+export interface WxSphEvent {
+ eventCreatorNickname: string;
+ eventTopicId: string;
+ eventName: string;
+}
+
+export enum DeclarationDouyin {
+ // 内容由AI生成
+ AIGC = 'aigc',
+ // 可能会引人不适
+ MaybeUnsuitable = 'maybe_unsuitable',
+ // 虚拟作品。仅供娱乐
+ OnlyFunNew = 'only_fun_new',
+ // 危险行为,请勿模仿
+ DangerousBehavior = 'dangerous_behavior',
+ // 内容自行拍摄
+ SelfShoot = 'self_shoot',
+ // 内容取材网络
+ FromNetV3 = 'from_net_v3',
+}
+
+export type DiffParmasType = {
+ [AccountType.Xhs]?: object;
+ [AccountType.Douyin]?: {
+ // 申请关联的热点
+ hotPoint?: ILableValue;
+ // 申请关联的活动
+ activitys?: ILableValue[];
+ // 自主声明
+ selfDeclare?: DeclarationDouyin;
+ };
+ [AccountType.WxSph]?: {
+ // 是否为原创
+ isOriginal?: boolean;
+ // 扩展链接
+ extLink?: string;
+ // 活动
+ activity?: WxSphEvent;
+ };
+ [AccountType.KWAI]?: object;
+};
+
+// 可见性
+export enum VisibleTypeEnum {
+ // 所有人可见
+ Public = 1,
+ // 仅自己可见
+ Private = 2,
+ // 好友可见
+ Friend = 3,
+}
+
+@Schema()
+export class WorkData extends TimeTemp {
+ @Prop({
+ required: true,
+ unique: true,
+ index: true,
+ type: Number,
+ })
+ id: number;
+
+ @Prop({
+ required: false,
+ })
+ dataId?: string;
+
+ @Prop({
+ required: true,
+ index: true,
+ type: String,
+ })
+ userId: string;
+
+ @Prop({
+ required: false,
+ type: Date,
+ })
+ lastStatsTime?: Date; // 最后统计时间
+
+ @Prop({
+ required: false,
+ type: String,
+ })
+ previewVideoLink: string; // 预览地址,这个值是发布完成手动拼接的
+
+ @Prop({
+ required: true,
+ index: true,
+ type: Number,
+ })
+ pubRecordId: number; // 发布记录id,对应PubRecord表id
+
+ @Prop({
+ required: true,
+ index: true,
+ type: Number,
+ })
+ accountId: number; // 账号id
+
+ @Prop({
+ required: true,
+ enum: AccountType,
+ index: true,
+ })
+ type: AccountType; // 平台类型
+
+ @Prop({
+ required: false,
+ type: Date,
+ })
+ publishTime?: Date; // 发布时间
+
+ @Prop({
+ required: false,
+ type: Object,
+ })
+ otherInfo?: Record<string, any>; // 其他信息
+
+ @Prop({
+ required: false,
+ })
+ failMsg?: string; // 发布失败原因(如果失败)
+
+ @Prop({
+ required: true,
+ enum: PubStatus,
+ default: PubStatus.UNPUBLISH,
+ })
+ status: PubStatus;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ readCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ likeCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ collectCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ forwardCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ commentCount: number;
+
+ @Prop({
+ required: true,
+ default: 0,
+ })
+ income: number;
+
+ // 以下为发布需要的参数 --------------------------------------------------------------------
+ @Prop({
+ required: false,
+ })
+ title?: string; // 标题
+
+ @Prop({
+ required: false,
+ })
+ desc?: string; // 简介,简介中不该包含话题,如果有需要每个平台再自己做处理。
+
+ @Prop({
+ required: false,
+ })
+ coverPath?: string; // 封面路径,机器的本地路径
+
+ @Prop({
+ required: false,
+ type: Object,
+ })
+ mixInfo?: ILableValue; // 合集
+
+ @Prop({
+ required: true,
+ type: [String],
+ })
+ topics: string[]; // 话题 格式:['话题1', '话题2'],不该包含 ‘#’
+
+ @Prop({
+ required: false,
+ type: Object,
+ })
+ location?: ILocationDataItem; // 位置
+
+ /**
+ * 差异化参数
+ * 所有平台有通用参数,如:标题、话题、简介
+ * 也有每个平台自己独有的参数,如:抖音活动奖励、抖音热点、视频号声明原创
+ */
+ @Prop({
+ required: false,
+ type: Object,
+ })
+ diffParams?: DiffParmasType;
+
+ @Prop({
+ required: true,
+ enum: VisibleTypeEnum,
+ default: VisibleTypeEnum.Private,
+ })
+ visibleType?: VisibleTypeEnum;
+
+ @Prop({
+ required: false,
+ type: Date,
+ })
+ timingTime?: Date; // 定时发布日期
+
+ @Prop({
+ required: false,
+ type: Object,
+ })
+ cookies?: Record<string, any>;
+}
diff --git a/server/src/files/wxcert/apiclient_cert.pem b/server/src/files/wxcert/apiclient_cert.pem
new file mode 100644
index 00000000..d5eb220a
--- /dev/null
+++ b/server/src/files/wxcert/apiclient_cert.pem
@@ -0,0 +1,3 @@
+-----BEGIN CERTIFICATE-----
+***************************************************************************
+-----END CERTIFICATE-----
diff --git a/server/src/files/wxcert/apiclient_key.pem b/server/src/files/wxcert/apiclient_key.pem
new file mode 100644
index 00000000..47bd97bc
--- /dev/null
+++ b/server/src/files/wxcert/apiclient_key.pem
@@ -0,0 +1,3 @@
+-----BEGIN PRIVATE KEY-----
+***
+-----END PRIVATE KEY-----
diff --git a/server/src/filters/http-exception.back-code.ts b/server/src/filters/http-exception.back-code.ts
new file mode 100644
index 00000000..bd305c9a
--- /dev/null
+++ b/server/src/filters/http-exception.back-code.ts
@@ -0,0 +1,248 @@
+/*
+ * @Author: niuwenzheng
+ * @Date: 2020-08-24 22:51:56
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-12-10 19:02:32
+ * @Description: http业务错误返回map
+ */
+export interface ErrorHttpBack {
+ errCode: string;
+ message: string;
+}
+
+export enum ErrHttpBack {
+ fail = 'fail',
+ err_err_token = 'err_err_token',
+ err_no_other_server = 'err_no_other_server',
+ // ======== 权限相关 ========
+ err_no_permission = 'err_no_permission',
+ err_group = 'err_group',
+ err_no_assigne_menber = 'err_no_assigne_menber',
+ err_group_hasd = 'err_group_hasd',
+
+ // ======= 用户相关 ========
+ err_user_had = 'err_user_had',
+ err_user_no_had = 'err_user_no_had',
+ err_mail_code = 'err_mail_code',
+ err_no_power_login = 'err_no_power_login',
+ err_user_phone_repetition = 'err_user_phone_repetition',
+ err_user_code_had = 'err_user_code_had',
+ err_user_code_nohad = 'err_user_code_nohad',
+ err_user_code_send_fail = 'err_user_code_send_fail',
+ err_user_phone_null = 'err_user_phone_null',
+ err_user_pop_code_null = 'err_user_pop_code_null',
+ err_mail_send_fail = 'err_mail_send_fail',
+
+ // ======= 认证相关 ========
+ err_approve_need_only_one = 'err_approve_need_only_one',
+ err_approve_idcard_invalid = 'err_approve_idcard_invalid',
+
+ // ======= 作品相关 ========
+ err_works_no_had = 'err_works_no_had',
+ err_product_can_buy_one = 'err_product_can_buy_one',
+ err_stamp_insufficient = 'err_stamp_insufficient',
+
+ // ======= 任务相关 ========
+ user_task_no_had = 'user_task_no_had',
+ user_task_err_status = 'user_task_err_status',
+ // ======= 财务相关 ========
+ wallet_account_no_had = 'wallet_account_no_had',
+ wallet_balance_no_enough = 'wallet_balance_no_enough',
+ task_no_material = 'task_no_material',
+}
+
+export const ErrHttpBackMap: Map<string, ErrorHttpBack> = new Map([
+ [ErrHttpBack.fail, { errCode: '1', message: '请求失败' }],
+ // -------- 认证相关 ----------
+ [
+ ErrHttpBack.err_err_token,
+ {
+ errCode: '10010',
+ message: 'token验证失败',
+ },
+ ],
+ [
+ ErrHttpBack.err_no_other_server,
+ {
+ errCode: '10011',
+ message: '错误的服务请求',
+ },
+ ],
+ // -------- 权限相关 ----------
+ [
+ ErrHttpBack.err_no_permission,
+ {
+ errCode: '20010',
+ message: '无操作权限',
+ },
+ ],
+ [
+ ErrHttpBack.err_group,
+ {
+ errCode: '20011',
+ message: '权限组有误',
+ },
+ ],
+ [
+ ErrHttpBack.err_no_assigne_menber,
+ {
+ errCode: '20012',
+ message: '不能没有指定人',
+ },
+ ],
+ [
+ ErrHttpBack.err_group_hasd,
+ {
+ errCode: '20013',
+ message: '该权限组已存在',
+ },
+ ],
+ // -------- 用户相关 ----------
+ [
+ ErrHttpBack.err_no_power_login,
+ {
+ errCode: '40010',
+ message: '您无权登录',
+ },
+ ],
+ [
+ ErrHttpBack.err_user_had,
+ {
+ errCode: '40011',
+ message: '用户已存在',
+ },
+ ],
+ [
+ ErrHttpBack.err_user_no_had,
+ {
+ errCode: '40012',
+ message: '用户不存在',
+ },
+ ],
+ [
+ ErrHttpBack.err_user_phone_repetition,
+ {
+ errCode: '40013',
+ message: '用户手机号重复',
+ },
+ ],
+ [
+ ErrHttpBack.err_user_code_had,
+ {
+ errCode: '40019',
+ message: '验证码未过期',
+ },
+ ],
+ [
+ ErrHttpBack.err_user_code_send_fail,
+ {
+ errCode: '40020',
+ message: '验证码发送失败',
+ },
+ ],
+ [
+ ErrHttpBack.err_stamp_insufficient,
+ {
+ errCode: '40021',
+ message: '用户余额不足',
+ },
+ ],
+ [
+ ErrHttpBack.err_user_code_nohad,
+ {
+ errCode: '40022',
+ message: '验证码验证失败',
+ },
+ ],
+ [
+ ErrHttpBack.err_user_phone_null,
+ {
+ errCode: '40023',
+ message: '用户手机号状态有误',
+ },
+ ],
+
+ [
+ ErrHttpBack.err_user_pop_code_null,
+ {
+ errCode: '40024',
+ message: '填写的邀请码有误',
+ },
+ ],
+
+ [
+ ErrHttpBack.err_mail_send_fail,
+ {
+ errCode: '40025',
+ message: '邮件发送失败',
+ },
+ ],
+
+ // -------- 商品相关 ----------
+ [
+ ErrHttpBack.err_works_no_had,
+ {
+ errCode: '50010',
+ message: '作品不存在',
+ },
+ ],
+ [
+ ErrHttpBack.err_product_can_buy_one,
+ {
+ errCode: '50011',
+ message: '商品只能购买一个',
+ },
+ ],
+ [
+ ErrHttpBack.user_task_no_had,
+ {
+ errCode: '60010',
+ message: '用户任务不存在',
+ },
+ ],
+ [
+ ErrHttpBack.user_task_err_status,
+ {
+ errCode: '60011',
+ message: '用户任务状态错误',
+ },
+ ],
+ // -------- 成员相关 ----------
+ [
+ ErrHttpBack.err_approve_need_only_one,
+ {
+ errCode: '70010',
+ message: '认证类型只能有一个',
+ },
+ ],
+ [
+ ErrHttpBack.err_approve_idcard_invalid,
+ {
+ errCode: '70011',
+ message: '身份证验证失败',
+ },
+ ],
+ // -------- 财务相关 ----------
+ [
+ ErrHttpBack.wallet_account_no_had,
+ {
+ errCode: '80001',
+ message: '用户钱包账户不存在',
+ },
+ ],
+ [
+ ErrHttpBack.wallet_balance_no_enough,
+ {
+ errCode: '80002',
+ message: '用户余额不足',
+ },
+ ],
+ // -------- 素材 ----------
+ [
+ ErrHttpBack.task_no_material,
+ {
+ errCode: '90000',
+ message: '该任务没有添加素材',
+ },
+ ],
+]);
diff --git a/server/src/filters/http-exception.filter.ts b/server/src/filters/http-exception.filter.ts
new file mode 100644
index 00000000..8d51c2bd
--- /dev/null
+++ b/server/src/filters/http-exception.filter.ts
@@ -0,0 +1,170 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 16:05:23
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-04-27 14:35:40
+ * @Description: 全局错误处理
+ */
+import {
+ ArgumentsHost,
+ Catch,
+ ExceptionFilter,
+ HttpException,
+ UnauthorizedException,
+ HttpStatus,
+ Logger,
+ BadRequestException,
+} from '@nestjs/common';
+import { HttpResult } from '../global/interface/response.interface';
+
+import { ErrHttpBackMap } from './http-exception.back-code';
+
+const BASE_ERROR_CODE = '1';
+const ARG_ERROR_CODE = '-1'; // 参数错误码
+
+interface ExceptionResponseObj {
+ message?: '';
+ statusCode?: '';
+ error?: '';
+}
+
+// 全部错误
+@Catch(Error)
+export class AppExceptionFilter implements ExceptionFilter {
+ catch(error: Error, host: ArgumentsHost) {
+ const ctx = host.switchToHttp();
+ const response = ctx.getResponse();
+ const request = ctx.getRequest();
+ console.log('---- Error ---', error);
+
+ Logger.error({
+ url: request.originalUrl,
+ level: 'error',
+ message: request.originalUrl,
+ mate: error.stack,
+ stack: error.stack,
+ });
+
+ const errorResponse: HttpResult<string> = {
+ data: '',
+ msg: '',
+ code: BASE_ERROR_CODE, // 自定义code
+ url: request.originalUrl, // 错误的url地址
+ };
+
+ response.status(HttpStatus.INTERNAL_SERVER_ERROR);
+ response.header('Content-Type', 'application/json; charset=utf-8');
+ response.send(errorResponse);
+ }
+}
+
+@Catch(BadRequestException)
+export class BadExceptionFilter implements ExceptionFilter {
+ catch(error: Error, host: ArgumentsHost) {
+ const ctx = host.switchToHttp();
+ const response = ctx.getResponse();
+ const request = ctx.getRequest();
+ Logger.error({
+ url: request.originalUrl,
+ level: 'error',
+ message: request.originalUrl,
+ mate: error.stack,
+ stack: error.stack,
+ });
+
+ const errorResponse: HttpResult<string> = {
+ data: '',
+ msg: error.message,
+ code: ARG_ERROR_CODE, // 自定义code
+ url: request.originalUrl, // 错误的url地址
+ };
+
+ response.status(HttpStatus.INTERNAL_SERVER_ERROR);
+ response.header('Content-Type', 'application/json; charset=utf-8');
+ response.send(errorResponse);
+ }
+}
+
+// 认证错误
+@Catch(UnauthorizedException)
+export class AuthExceptionFilter implements ExceptionFilter {
+ catch(error: Error, host: ArgumentsHost) {
+ const ctx = host.switchToHttp();
+ const response = ctx.getResponse();
+ const request = ctx.getRequest();
+
+ Logger.error({
+ url: request.originalUrl,
+ level: 'error',
+ message: request.originalUrl,
+ mate: error.stack,
+ stack: error.stack,
+ });
+
+ const errorResponse: HttpResult<string> = {
+ data: '',
+ msg: '',
+ code: BASE_ERROR_CODE, // 自定义code
+ url: request.originalUrl, // 错误的url地址
+ };
+
+ response.status(HttpStatus.UNAUTHORIZED);
+ response.header('Content-Type', 'application/json; charset=utf-8');
+ response.send(errorResponse);
+ }
+}
+
+// 业务报错
+export class AppHttpException extends HttpException {
+ constructor(errKey: string) {
+ super(errKey, HttpStatus.OK);
+ }
+}
+
+@Catch(HttpException)
+export class HttpExceptionFilter implements ExceptionFilter {
+ catch(exception: HttpException, host: ArgumentsHost) {
+ const ctx = host.switchToHttp();
+ const response = ctx.getResponse();
+ const request = ctx.getRequest();
+
+ // 定义错误的返回对象
+ const errorResponse: HttpResult<string | object> = {
+ data: exception.getResponse(),
+ msg: '',
+ code: BASE_ERROR_CODE, // 自定义code
+ url: request.originalUrl, // 错误的url地址
+ };
+
+ const defErrHttpBack = ErrHttpBackMap.get('fail');
+ const errObj = exception.getResponse(); // 获取的错误返回对象
+
+ if (typeof errObj === 'object') {
+ errorResponse.msg =
+ (<ExceptionResponseObj>errObj).message || defErrHttpBack.message;
+ errorResponse.code =
+ (<ExceptionResponseObj>errObj).error || defErrHttpBack.errCode;
+ errorResponse.data = errObj;
+ }
+
+ if (typeof errObj === 'string') {
+ const errBackObj =
+ ErrHttpBackMap.get(exception.message) || defErrHttpBack;
+
+ errorResponse.code = errBackObj.errCode;
+ errorResponse.msg = errBackObj.message || errObj;
+ errorResponse.data = '';
+ }
+
+ Logger.log(errorResponse.code + ':' + errorResponse.msg);
+
+ // 设置返回的状态码、请求头、发送错误信息
+ response.status(
+ exception instanceof HttpException
+ ? exception.getStatus()
+ : HttpStatus.INTERNAL_SERVER_ERROR,
+ );
+ response.header('Content-Type', 'application/json; charset=utf-8');
+ response.send(errorResponse);
+ }
+}
diff --git a/server/src/global/class/correctResponse.class.ts b/server/src/global/class/correctResponse.class.ts
new file mode 100644
index 00000000..9efcc0a4
--- /dev/null
+++ b/server/src/global/class/correctResponse.class.ts
@@ -0,0 +1,16 @@
+import { CorrectResponse } from '../interface/table.interface';
+export class ResponseUtil {
+ static GetCorrectResponse<T>(
+ pageNo: number,
+ pageSize: number,
+ count: number,
+ list: T[],
+ ): CorrectResponse<T> {
+ return {
+ pageNo,
+ pageSize,
+ count,
+ list,
+ };
+ }
+}
diff --git a/server/src/global/class/tableUtli.class.ts b/server/src/global/class/tableUtli.class.ts
new file mode 100644
index 00000000..966b9619
--- /dev/null
+++ b/server/src/global/class/tableUtli.class.ts
@@ -0,0 +1,20 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-10-09 17:08:55
+ * @LastEditTime: 2024-10-10 15:46:56
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { TableDto } from '../dto/table.dto';
+
+export class TableUtil {
+ // 获取分页信息
+ static GetSqlPaging(paging: TableDto) {
+ if (!paging) return {};
+
+ return {
+ skip: (paging.pageNo - 1) * paging.pageSize || 0,
+ take: paging.pageSize,
+ };
+ }
+}
diff --git a/server/src/global/dto/table.dto.ts b/server/src/global/dto/table.dto.ts
new file mode 100644
index 00000000..81226564
--- /dev/null
+++ b/server/src/global/dto/table.dto.ts
@@ -0,0 +1,41 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-03-17 18:14:52
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-10-10 15:45:59
+ * @Description: 表单数据
+ */
+
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import { IsInt, IsOptional } from 'class-validator';
+
+export class TableDto {
+ @Type(() => Number)
+ @IsInt({ message: '页码必须是数值' })
+ @IsOptional()
+ @Expose()
+ readonly pageNo?: number = 1;
+
+ @Type(() => Number)
+ @IsInt({ message: '每页个数必须是数值' })
+ @Expose()
+ @IsOptional()
+ readonly pageSize?: number = 10;
+
+ @Type(() => Number)
+ @IsInt({ message: '分页标识必须是数值' })
+ @IsOptional()
+ readonly paging?: number = 1;
+}
+
+export class TableResDto {
+ @ApiProperty({ title: '页码', description: '页码' })
+ readonly pageNo: number = 1;
+
+ @ApiProperty({ title: '页数', description: '页数' })
+ readonly pageSize: number = 10;
+
+ @ApiProperty({ title: '总数', description: '总数' })
+ readonly count: number = 0;
+}
diff --git a/server/src/global/enum/all.enum.ts b/server/src/global/enum/all.enum.ts
new file mode 100644
index 00000000..2782e776
--- /dev/null
+++ b/server/src/global/enum/all.enum.ts
@@ -0,0 +1,29 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-08-02 16:18:04
+ * @LastEditTime: 2025-01-15 14:37:02
+ * @LastEditors: nevin
+ * @Description:
+ */
+export enum HttpTags {
+ DOC = 'doc',
+}
+
+// 性别
+export enum GenderEnum {
+ MALE = 1, // 男
+ FEMALE = 2, // 女
+}
+
+// 开关
+export enum ONOFF {
+ ON = 1, // 开
+ OFF = 0, // 关
+}
+
+// 0 待审核 1 审核通过 -1 审核不通过
+export enum CheckStatus {
+ PENDING = 0,
+ PASS = 1,
+ FAIL = -1,
+}
diff --git a/server/src/global/enum/area.enum.ts b/server/src/global/enum/area.enum.ts
new file mode 100644
index 00000000..c3edd45c
--- /dev/null
+++ b/server/src/global/enum/area.enum.ts
@@ -0,0 +1,12 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-05-11 14:44:41
+ * @LastEditTime: 2024-06-17 19:28:45
+ * @LastEditors: nevin
+ * @Description:
+ */
+export enum AreaTypes {
+ Province = 1,
+ City = 2,
+ County = 3,
+}
diff --git a/server/src/global/interface/response.interface.ts b/server/src/global/interface/response.interface.ts
new file mode 100644
index 00000000..0294925d
--- /dev/null
+++ b/server/src/global/interface/response.interface.ts
@@ -0,0 +1,14 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 16:41:36
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-06-17 19:37:02
+ * @Description: 请求返回接口
+ */
+
+export interface HttpResult<T> {
+ data: T; // 数据
+ msg: string; // 信息
+ code: 0 | string; // 自定义code
+ url: string; // 错误的url地址
+}
diff --git a/server/src/global/interface/table.interface.ts b/server/src/global/interface/table.interface.ts
new file mode 100644
index 00000000..4464d634
--- /dev/null
+++ b/server/src/global/interface/table.interface.ts
@@ -0,0 +1,13 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-03-17 16:05:38
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-03-03 18:59:47
+ * @Description: 表格状数据
+ */
+export interface CorrectResponse<T> {
+ list: T[];
+ pageSize: number;
+ pageNo: number;
+ count: number;
+}
diff --git a/server/src/guard/original.guard.ts b/server/src/guard/original.guard.ts
new file mode 100644
index 00000000..ae3c3e2f
--- /dev/null
+++ b/server/src/guard/original.guard.ts
@@ -0,0 +1,31 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-12-22 21:14:15
+ * @LastEditTime: 2025-02-25 22:13:11
+ * @LastEditors: nevin
+ * @Description: 保留原始请求守卫
+ */
+import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
+import { SetMetadata } from '@nestjs/common';
+import { Reflector } from '@nestjs/core';
+
+export const IS_ORIGINAL_KEY = 'isOriginal';
+export const Original = () => SetMetadata(IS_ORIGINAL_KEY, true);
+
+@Injectable()
+export class OriginalGuard implements CanActivate {
+ constructor(private reflector: Reflector) {}
+
+ async canActivate(context: ExecutionContext): Promise<boolean> {
+ const isPass = this.reflector.getAllAndOverride<boolean>(IS_ORIGINAL_KEY, [
+ context.getHandler(),
+ context.getClass(),
+ ]);
+ if (isPass) {
+ // 💡 查看此条件
+ return true;
+ }
+
+ return true;
+ }
+}
diff --git a/server/src/interceptor/logging.interceptor.ts b/server/src/interceptor/logging.interceptor.ts
new file mode 100644
index 00000000..1e622bc3
--- /dev/null
+++ b/server/src/interceptor/logging.interceptor.ts
@@ -0,0 +1,33 @@
+import {
+ CallHandler,
+ ExecutionContext,
+ Injectable,
+ Logger,
+ NestInterceptor,
+} from '@nestjs/common';
+import { Observable, tap } from 'rxjs';
+
+@Injectable()
+export class LoggingInterceptor implements NestInterceptor {
+ private logger = new Logger(LoggingInterceptor.name, { timestamp: false });
+
+ intercept(
+ context: ExecutionContext,
+ next: CallHandler<any>,
+ ): Observable<any> {
+ const call$ = next.handle();
+ const request = context.switchToHttp().getRequest();
+ const content = `${request.method} -> ${request.url}`;
+ const isSse = request.headers.accept === 'text/event-stream';
+ this.logger.debug(`+++ 请求:${content}`);
+ const now = Date.now();
+
+ return call$.pipe(
+ tap(() => {
+ if (isSse) return;
+
+ this.logger.debug(`--- 响应:${content}${` +${Date.now() - now}ms`}`);
+ }),
+ );
+ }
+}
diff --git a/server/src/interceptor/transform.interceptor.ts b/server/src/interceptor/transform.interceptor.ts
new file mode 100644
index 00000000..c1fbf260
--- /dev/null
+++ b/server/src/interceptor/transform.interceptor.ts
@@ -0,0 +1,73 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 15:56:08
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-02-25 00:28:07
+ * @Description: 全局拦截器 慢日志打印
+ */
+import {
+ Injectable,
+ NestInterceptor,
+ CallHandler,
+ ExecutionContext,
+ Logger,
+ CanActivate,
+} from '@nestjs/common';
+import { map } from 'rxjs/operators';
+import { Observable } from 'rxjs';
+import { HttpResult } from '../global/interface/response.interface';
+
+@Injectable()
+export class OrgGuard implements CanActivate {
+ canActivate(context: ExecutionContext): boolean {
+ const request = context.switchToHttp().getRequest();
+ request.is_org = true;
+ return true;
+ }
+}
+
+@Injectable()
+export class TransformInterceptor<T>
+ implements NestInterceptor<T, HttpResult<T>>
+{
+ intercept(
+ context: ExecutionContext,
+ next: CallHandler<T>,
+ ): Observable<HttpResult<T>> {
+ const startTime = Date.parse(new Date().toString());
+
+ const ctx = context.switchToHttp();
+ // const response: Response<any> = ctx.getResponse();
+ const request = ctx.getRequest();
+ const reqUrl = request.originalUrl;
+
+ return next.handle().pipe(
+ map((data: T): HttpResult<T> | any => {
+ // --------- 慢日志打印警告 STR ---------
+ const ruqTime = Date.parse(new Date().toString()) - startTime;
+ if (ruqTime >= 50) {
+ Logger.verbose({
+ level: 'verbose',
+ message: `${reqUrl}::${ruqTime}ms`,
+ mate: ruqTime,
+ });
+ }
+ // --------- 慢日志打印警告 END ---------
+
+ // 不进行封装的返回
+ if (request.is_org) return data as any;
+
+ if ((data as unknown as number) !== 0 && !data && data !== false)
+ return data;
+
+ // 封装
+ return {
+ data,
+ code: 0,
+ msg: '请求成功',
+ url: reqUrl,
+ };
+ }),
+ );
+ }
+}
diff --git a/server/src/lib/mail/mail.module.ts b/server/src/lib/mail/mail.module.ts
new file mode 100644
index 00000000..1cd68d5d
--- /dev/null
+++ b/server/src/lib/mail/mail.module.ts
@@ -0,0 +1,31 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-20 09:20:31
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-07-05 15:48:57
+ * @Description: 邮件模块
+ */
+import { Global, Module } from '@nestjs/common';
+import { ConfigModule, ConfigService } from '@nestjs/config';
+import mailConfig from 'config/mail.config';
+import { MailService } from './mail.service';
+import { MailerModule } from '@nestjs-modules/mailer';
+
+@Global()
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [mailConfig], // 加载自定义配置项
+ }),
+
+ MailerModule.forRootAsync({
+ imports: [ConfigModule], // 数据库配置项依赖于ConfigModule,需在此引入
+ inject: [ConfigService],
+ useFactory: (configService: ConfigService) =>
+ configService.get('MAIL_CONFIG'),
+ }),
+ ],
+ providers: [MailService],
+ exports: [MailService],
+})
+export class MailModule {}
diff --git a/server/src/lib/mail/mail.service.ts b/server/src/lib/mail/mail.service.ts
new file mode 100644
index 00000000..d1f5ba05
--- /dev/null
+++ b/server/src/lib/mail/mail.service.ts
@@ -0,0 +1,24 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-11 10:27:06
+ * @LastEditTime: 2024-07-05 15:50:12
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ISendMailOptions, MailerService } from '@nestjs-modules/mailer';
+import { Injectable } from '@nestjs/common';
+
+@Injectable()
+export class MailService {
+ constructor(private readonly mailerService: MailerService) {}
+
+ async sendEmail(p: ISendMailOptions): Promise<boolean> {
+ try {
+ const res = await this.mailerService.sendMail(p);
+ return !!res;
+ } catch (error) {
+ console.log('------- sendEmail error --------', error);
+ return false;
+ }
+ }
+}
diff --git a/server/src/lib/oss/oss-core.module.ts b/server/src/lib/oss/oss-core.module.ts
new file mode 100644
index 00000000..eaee94b1
--- /dev/null
+++ b/server/src/lib/oss/oss-core.module.ts
@@ -0,0 +1,35 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-03-03 16:50:53
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-06-24 17:49:30
+ * @Description: 阿里云OSS文件存储
+ */
+import { DynamicModule, Global, Module } from '@nestjs/common';
+import OSS from 'ali-oss';
+import { OssProvider } from './oss.provider';
+import { OssController } from './oss.controller';
+
+@Global()
+@Module({
+ providers: [OssProvider],
+ controllers: [OssController],
+})
+export class OssCoreModule {
+ /**
+ * 注册OSS服务
+ * @param options
+ * @param resetName 重命名
+ */
+ static forRoot(options: OSS.Options, resetName?: string): DynamicModule {
+ const ossClientProvider = OssProvider.createClientProvider(
+ options,
+ resetName,
+ );
+ return {
+ module: OssCoreModule,
+ providers: [ossClientProvider],
+ exports: [ossClientProvider],
+ };
+ }
+}
diff --git a/server/src/lib/oss/oss.controller.ts b/server/src/lib/oss/oss.controller.ts
new file mode 100644
index 00000000..56e7b9c8
--- /dev/null
+++ b/server/src/lib/oss/oss.controller.ts
@@ -0,0 +1,89 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-03-07 13:37:06
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-12-22 21:58:14
+ * @Description: 文件上传
+ */
+import {
+ Controller,
+ Post,
+ UploadedFile,
+ UploadedFiles,
+ UseInterceptors,
+ Headers,
+ Body,
+} from '@nestjs/common';
+import { FileInterceptor, FilesInterceptor } from '@nestjs/platform-express';
+import { OssService } from './oss.service';
+import { ApiBody, ApiConsumes, ApiOperation, ApiTags } from '@nestjs/swagger';
+import { Public } from '../../auth/auth.guard';
+
+@ApiTags('OSS - 文件(阿里云)')
+@Controller('oss')
+export class OssController {
+ constructor(private readonly ossService: OssService) {}
+
+ @ApiOperation({ description: '存入临时目录', summary: '上传文件' })
+ @ApiConsumes('multipart/form-data')
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ file: {
+ type: 'string',
+ format: 'binary',
+ },
+ },
+ },
+ })
+ @Public()
+ @Post('upload')
+ @UseInterceptors(FileInterceptor('file'))
+ async uploadFile(
+ @UploadedFile() file: Express.Multer.File,
+ @Headers() headers: any,
+ ) {
+ const secondPath: string = headers['second-path'];
+ return await this.ossService.upFileStream(file, secondPath);
+ }
+
+ @ApiOperation({ description: '不存入临时目录', summary: '上传文件' })
+ @Public()
+ @Post('upload/permanent')
+ @UseInterceptors(FileInterceptor('file'))
+ async uploadPermanentFile(
+ @UploadedFile() file: Express.Multer.File,
+ @Headers() headers: any,
+ ) {
+ const secondPath: string = headers['second-path'];
+
+ // 不开启临时目录
+ return await this.ossService.upFileStream(file, secondPath, null, true);
+ }
+
+ @ApiOperation({ description: '存入临时目录', summary: '上传文件数组' })
+ @Public()
+ @Post('upload/list')
+ @UseInterceptors(FilesInterceptor('files'))
+ uploadFileList(
+ @UploadedFiles() files: Express.Multer.File[],
+ @Headers() headers: any,
+ ) {
+ const secondPath: string = headers['second-path'];
+ files.forEach((file) => {
+ this.ossService.upFileStream(file, secondPath);
+ });
+ return { status: 'ok' };
+ }
+
+ @ApiOperation({ description: '上传URL图片', summary: '上传URL图片' })
+ @Public()
+ @Post('upload/url')
+ async uploadFileOfUrl(@Body() body: { path: string; url: string }) {
+ const res = await this.ossService.upFileByUrl(body.url, {
+ path: body.path,
+ });
+ return res;
+ }
+}
diff --git a/server/src/lib/oss/oss.interface.ts b/server/src/lib/oss/oss.interface.ts
new file mode 100644
index 00000000..19725c10
--- /dev/null
+++ b/server/src/lib/oss/oss.interface.ts
@@ -0,0 +1,23 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-03-04 10:40:22
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-12-20 22:45:03
+ * @Description: 阿里云OSS
+ */
+import OSS from 'ali-oss';
+
+export type OssOptions = OSS.Options;
+
+export interface OssModuleAsyncOption {
+ imports?: any;
+ useValue?: OssOptions;
+ useFactory?: (...args: any[]) => OssOptions; // 生成options的构造函数
+ inject?: any[]; // 注入
+}
+
+export interface OssNewFilePath {
+ path?: string;
+ permanent?: boolean;
+ newName?: string;
+}
diff --git a/server/src/lib/oss/oss.module.ts b/server/src/lib/oss/oss.module.ts
new file mode 100644
index 00000000..2cd85487
--- /dev/null
+++ b/server/src/lib/oss/oss.module.ts
@@ -0,0 +1,27 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-03-03 16:50:53
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-06-24 17:48:23
+ * @Description: 阿里云OSS文件存储
+ */
+import { Global, Module } from '@nestjs/common';
+import { ConfigModule } from '@nestjs/config';
+import ossConfig from '../../../config/oss.config';
+import { OssCoreModule } from './oss-core.module';
+import { OssService } from './oss.service';
+import { OssController } from './oss.controller';
+
+@Global()
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [ossConfig], // 加载自定义配置项
+ }),
+ OssCoreModule.forRoot(ossConfig().OSS_CONFIG.INIT_OPTION),
+ ],
+ controllers: [OssController],
+ providers: [OssService],
+ exports: [OssService],
+})
+export class OssModule {}
diff --git a/server/src/lib/oss/oss.provider.ts b/server/src/lib/oss/oss.provider.ts
new file mode 100644
index 00000000..abf5ad40
--- /dev/null
+++ b/server/src/lib/oss/oss.provider.ts
@@ -0,0 +1,36 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-02-18 09:38:19
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-07-18 14:09:07
+ * @Description: 文件描述
+ */
+import * as OSS from 'ali-oss';
+import { Provider } from '@nestjs/common';
+
+export class OssProvider {
+ /**
+ * 创建连接
+ * @param options
+ */
+ private static createClient(options: OSS.Options): OSS {
+ return new OSS(options);
+ }
+
+ /**
+ * 得到 oss 客户端连接的 provider
+ * @return {Provider}
+ */
+ public static createClientProvider(
+ options: OSS.Options,
+ resetName?: string,
+ ): Provider {
+ return {
+ provide: resetName || 'OSS_CLIENT_PROVIDER',
+ useFactory: () => {
+ return this.createClient(options);
+ },
+ // inject: ['OSS_CLIENT_PROVIDER'],
+ };
+ }
+}
diff --git a/server/src/lib/oss/oss.service.ts b/server/src/lib/oss/oss.service.ts
new file mode 100644
index 00000000..827d2652
--- /dev/null
+++ b/server/src/lib/oss/oss.service.ts
@@ -0,0 +1,229 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-03-03 16:59:23
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-02-25 23:11:01
+ * @Description: oss函数
+ */
+import { Injectable, Inject, HttpStatus } from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+import OSS from 'ali-oss';
+import * as moment from 'moment';
+import { Duplex } from 'stream';
+import { v4 as uuidv4 } from 'uuid';
+import { OssNewFilePath } from './oss.interface';
+import axios from 'axios';
+@Injectable()
+export class OssService {
+ private HOST_URL: string;
+ private NODE_ENV: string;
+ constructor(
+ @Inject('OSS_CLIENT_PROVIDER') private client: OSS,
+ private configService: ConfigService,
+ ) {
+ this.HOST_URL = this.configService.get('OSS_CONFIG.HOST_URL');
+ this.NODE_ENV = this.configService.get('SERVER_CONFIG.NODE_ENV');
+ }
+
+ private getNewFilePath(opt: OssNewFilePath) {
+ let { path, newName } = opt;
+
+ path = `${this.NODE_ENV}/${opt.permanent ? '' : 'temp/'}${path || `nopath/${moment().format('YYYYMM')}`}`;
+ path = path.replace('//', '/');
+ newName = newName || uuidv4();
+
+ return {
+ path,
+ newName,
+ };
+ }
+
+ /**
+ * 获取完整url中的文件名即去除host域名
+ * @param url
+ * @returns
+ */
+ getFileNameFromUrl(url: string) {
+ const tempStr = url.split(`${this.HOST_URL}/`);
+ return tempStr.length <= 0 ? '' : tempStr[tempStr.length - 1];
+ }
+
+ /**
+ * 文件上传
+ * @param {Express.Multer.File} file 文件buffer流对象
+ * @param {string | undefined} path 路径,不传就会使用‘nopath’前缀
+ * @param {string | undefined} newName 新的文件名
+ * @param {string | undefined} permanent 是否为永久目录,默认临时
+ * @returns
+ */
+ async upFileStream(
+ file: Express.Multer.File,
+ path?: string,
+ newName?: string,
+ permanent?: boolean,
+ ) {
+ const { buffer, mimetype } = file;
+ const ret = this.getNewFilePath({ path, newName, permanent });
+ path = ret.path;
+ newName = ret.newName;
+
+ const tempStr = mimetype.split('/');
+ const fileTypeStr = tempStr[tempStr.length - 1];
+
+ const stream = new Duplex();
+ stream.push(buffer);
+ stream.push(null);
+
+ try {
+ const upRes = await this.client.putStream(
+ `${path}/${newName}.${fileTypeStr}`,
+ stream,
+ );
+
+ const {
+ name,
+ res: { status },
+ } = upRes;
+
+ if (status !== HttpStatus.OK) throw new Error('文件上传失败');
+
+ return {
+ name,
+ };
+ } catch (error) {
+ throw error;
+ }
+ }
+
+ /**
+ * 去除文件前置
+ * @param filePath
+ */
+ private noHostFilePath(filePath: string) {
+ const hostUrl = this.configService.get('OSS_CONFIG.HOST_URL');
+
+ const _hostUrl = hostUrl.replace('https', 'http');
+ if (filePath.indexOf(_hostUrl) === 0) {
+ filePath = filePath.replace(`${_hostUrl}/`, '');
+ return this.noHostFilePath(filePath);
+ }
+
+ return filePath;
+ }
+
+ /**
+ * 将临时目录文件转到新的目录文件
+ * @param filePath 原文件地址
+ * @param newFilePath 不填就是去除temp标识
+ * @returns
+ */
+ async changeFilePath(
+ filePath: string,
+ newFilePath?: string,
+ ): Promise<string> {
+ // 干掉前置
+ filePath = this.noHostFilePath(filePath);
+
+ // 复制文件
+ newFilePath = newFilePath || filePath.replace('temp/', '');
+
+ if (filePath === newFilePath) return filePath;
+
+ try {
+ const {
+ res: { status },
+ } = await this.client.copy(newFilePath, filePath);
+ if (status !== HttpStatus.OK) throw new Error('文件上传失败');
+ return newFilePath;
+ } catch (error) {
+ console.log('========== error', error);
+ throw error;
+ }
+ }
+
+ /**
+ * 上传二进制流文件
+ * @param buffer 二进制流 base64格式
+ * @param path 路径
+ * @param permanent 是否为永久目录,默认临时
+ */
+ async uploadByStream(
+ buffer: Buffer, // base64格式(不带前缀)
+ option: {
+ path?: string;
+ permanent?: boolean;
+ fileType: string;
+ },
+ ): Promise<string> {
+ const { path, permanent, fileType } = option;
+ const objectName = `${this.NODE_ENV}/${permanent ? '' : 'temp/'}${path || 'nopath'}${`/${moment().format('YYYYMM')}/${uuidv4()}.${fileType}`}`;
+
+ // 上传到阿里云
+ try {
+ const res = await this.client.put(objectName, buffer);
+ return res.name;
+ } catch (error) {
+ console.log('----- uploadByBase64 error -----', error);
+ return '';
+ }
+ }
+
+ /**
+ * 根据网络地址上传到阿里云
+ * @param url
+ * @param option
+ * @returns
+ */
+ async upFileByUrl(
+ url: string,
+ option: {
+ path?: string;
+ permanent?: boolean;
+ },
+ ) {
+ const { path, permanent } = option;
+ let fileType = '';
+ if (url.includes('.')) {
+ fileType = url.split('.').pop();
+ }
+ const objectName = `${this.NODE_ENV}/${permanent ? '' : 'temp/'}${path || 'nopath'}${`/${moment().format('YYYYMM')}/${uuidv4()}.${fileType}`}`;
+
+ try {
+ const response = await axios.get(url, { responseType: 'arraybuffer' });
+ const buffer = Buffer.from(response.data);
+
+ const res = await this.client.put(objectName, buffer);
+ return res.name;
+ } catch (error) {
+ console.log('----- upFileByUrl error -----', error);
+ return '';
+ }
+ }
+
+ /**
+ * TODO: 未完成 未使用 上传base64图片
+ */
+ async uploadByBuffer(
+ base64Img: string,
+ path?: string,
+ permanent?: boolean,
+ ): Promise<string> {
+ const imageBuffer = Buffer.from(base64Img, 'base64');
+ const objectName = `${this.NODE_ENV}/${permanent ? '' : 'temp/'}${`nopath/${moment().format('YYYYMM')}/${uuidv4()}.png`}`;
+ try {
+ const {
+ url,
+ res: { status },
+ } = await this.client.put(objectName, imageBuffer);
+
+ if (status === 200) {
+ return url;
+ } else {
+ return '';
+ }
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ } catch (error) {
+ return '';
+ }
+ }
+}
diff --git a/server/src/lib/platAuth/comment.ts b/server/src/lib/platAuth/comment.ts
new file mode 100644
index 00000000..736c3126
--- /dev/null
+++ b/server/src/lib/platAuth/comment.ts
@@ -0,0 +1,2 @@
+export const BaseUrl = 'http://plat-auth.yikart.cn';
+// export const BaseUrl = 'http://127.0.0.1:3333';
diff --git a/server/src/lib/platAuth/platAuth.module.ts b/server/src/lib/platAuth/platAuth.module.ts
new file mode 100644
index 00000000..c34116fd
--- /dev/null
+++ b/server/src/lib/platAuth/platAuth.module.ts
@@ -0,0 +1,22 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 16:12:27
+ * @LastEditTime: 2025-02-25 09:47:37
+ * @LastEditors: nevin
+ * @Description: platAuth PlatAuth
+ */
+import { Module } from '@nestjs/common';
+import { ConfigModule } from '@nestjs/config';
+import wxConfig from '../../../config/wx.config';
+import { PlatAuthWxGzhService } from './wxGzh.service';
+
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [wxConfig], // 加载自定义配置项
+ }),
+ ],
+ providers: [PlatAuthWxGzhService],
+ exports: [PlatAuthWxGzhService],
+})
+export class PlatAuthModule {}
diff --git a/server/src/lib/platAuth/wxGzh.service.ts b/server/src/lib/platAuth/wxGzh.service.ts
new file mode 100644
index 00000000..a4c4ef85
--- /dev/null
+++ b/server/src/lib/platAuth/wxGzh.service.ts
@@ -0,0 +1,110 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 16:12:56
+ * @LastEditTime: 2025-04-14 17:10:59
+ * @LastEditors: nevin
+ * @Description: 艺咖三方平台认证服务 PlatAuth platAuth
+ */
+import { Injectable } from '@nestjs/common';
+import axios from 'axios';
+import { ConfigService } from '@nestjs/config';
+import { BaseUrl } from './comment';
+import * as crypto from 'crypto';
+
+@Injectable()
+export class PlatAuthWxGzhService {
+ appId = '';
+ secret = '';
+ vi = 'yika2025'; // 盐
+ constructor(private readonly configService: ConfigService) {
+ this.appId = this.configService.get('WX_GZH.WX_GZH_ID');
+ this.secret = this.configService.get('WX_GZH.WX_GZH_SECRET');
+ }
+
+ // 生成加密
+ private async generateEncryptionKey(): Promise<string> {
+ // 1.appId+secret进行sha1加密
+ const encryptionKey = crypto
+ .createHash('sha256')
+ .update(this.appId + this.secret)
+ .digest();
+
+ const vi = Buffer.from(this.vi, 'utf8')
+ .toString()
+ .padEnd(16, '0')
+ .slice(0, 16); // 强制16字节
+
+ // 加入当前时间戳,进行AES加密
+ // 3. 时间戳 AES 加密
+ const timestamp = Date.now().toString(); // 显式转为字符串
+ const cipher = crypto.createCipheriv('aes-256-cbc', encryptionKey, vi);
+ let encrypted = cipher.update(timestamp, 'utf8', 'hex');
+ encrypted += cipher.final('hex'); // 合并 update 和 final 的结果
+ return encrypted;
+ }
+
+ /**
+ * 获取微信登录二维码的票据
+ * @returns
+ */
+ async getWxLoginQrcode(): Promise<{
+ key: string;
+ ticket: string;
+ }> {
+ const url = `${BaseUrl}/wxGzh/qrcode/get/${this.appId}`;
+ const result = await axios.get<{
+ code: number;
+ message: string;
+ data: {
+ key: string;
+ ticket: string;
+ };
+ }>(url);
+
+ return result.data.data;
+ }
+
+ /**
+ * 创建公众号菜单
+ */
+ async createWxGzhMenu(body: any): Promise<{
+ errcode: number;
+ errmsg: string;
+ }> {
+ if (typeof body !== 'object' || body === null || Array.isArray(body))
+ return { errcode: 400, errmsg: '菜单必须为非空对象' };
+
+ const sign = await this.generateEncryptionKey();
+ console.log('----- sign: ', sign);
+
+ const url = `${BaseUrl}/wxGzh/menu/create/${this.appId}`;
+ const result = await axios.post<{
+ code: number;
+ message: string;
+ data: {
+ errcode: number;
+ errmsg: string;
+ };
+ }>(url, { data: body, authKey: sign });
+
+ return result.data.data;
+ }
+
+ /**
+ * 获取菜单
+ */
+ async getMenu(): Promise<{
+ errcode: number;
+ errmsg: string;
+ data: any;
+ }> {
+ const url = `${BaseUrl}/wxGzh/menu/get/${this.appId}`;
+ const result = await axios.get<{
+ code: number;
+ message: string;
+ data: any;
+ }>(url);
+
+ return result.data.data;
+ }
+}
diff --git a/server/src/lib/realAuth/realAuth.module.ts b/server/src/lib/realAuth/realAuth.module.ts
new file mode 100644
index 00000000..9a402d6c
--- /dev/null
+++ b/server/src/lib/realAuth/realAuth.module.ts
@@ -0,0 +1,22 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 16:12:27
+ * @LastEditTime: 2025-02-25 09:47:37
+ * @LastEditors: nevin
+ * @Description: realAuth RealAuth
+ */
+import { Module } from '@nestjs/common';
+import { ConfigModule } from '@nestjs/config';
+import realAuth from '../../../config/realAuth.config';
+import { AlicloudRealAuthService } from './realAuth.service';
+
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [realAuth], // 加载自定义配置项
+ }),
+ ],
+ providers: [AlicloudRealAuthService],
+ exports: [AlicloudRealAuthService],
+})
+export class RealAuthModule {}
diff --git a/server/src/lib/realAuth/realAuth.service.ts b/server/src/lib/realAuth/realAuth.service.ts
new file mode 100644
index 00000000..47c510c9
--- /dev/null
+++ b/server/src/lib/realAuth/realAuth.service.ts
@@ -0,0 +1,68 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-04-27 06:41:31
+ * @LastEditTime: 2025-04-27 14:03:43
+ * @LastEditors: nevin
+ * @Description:
+ */
+import Cloudauth20190307, * as $Cloudauth20190307 from '@alicloud/cloudauth20190307';
+import * as $OpenApi from '@alicloud/openapi-client';
+import * as $Util from '@alicloud/tea-util';
+import { Injectable } from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+
+@Injectable()
+export class AlicloudRealAuthService {
+ private client: any;
+ constructor(private configService: ConfigService) {
+ const options: {
+ accessKeyId: string;
+ accessKeySecret: string;
+ } = this.configService.get('REAL_NAME_CONFIG');
+
+ const config = new $OpenApi.Config({
+ ...options,
+ });
+
+ config.endpoint = `cloudauth.cn-beijing.aliyuncs.com`;
+ this.client = new Cloudauth20190307(config);
+ }
+
+ /**
+ * 身份号认证
+ * @param identifyNum
+ * @param userName
+ */
+ public async realNameAuth(
+ identifyNum: string,
+ userName: string,
+ ): Promise<boolean> {
+ const id2MetaVerifyRequest = new $Cloudauth20190307.Id2MetaVerifyRequest({
+ paramType: 'normal',
+ identifyNum,
+ userName,
+ });
+ const runtime = new $Util.RuntimeOptions({});
+ try {
+ const res: {
+ body: {
+ code: string;
+ message: string;
+ requestId: string;
+ resultObject: {
+ bizCode: '1' | '2' | '3';
+ };
+ };
+ } = await this.client.id2MetaVerifyWithOptions(
+ id2MetaVerifyRequest,
+ runtime,
+ );
+
+ return res.body.resultObject.bizCode === '1';
+ } catch (error) {
+ console.log('----- realNameAuth error ------', error.message);
+
+ return false;
+ }
+ }
+}
diff --git a/server/src/lib/redis/redis.constant.ts b/server/src/lib/redis/redis.constant.ts
new file mode 100644
index 00000000..7c34e517
--- /dev/null
+++ b/server/src/lib/redis/redis.constant.ts
@@ -0,0 +1,8 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-10-29 22:19:30
+ * @LastEditTime: 2024-08-31 18:55:18
+ * @LastEditors: nevin
+ * @Description:
+ */
+export const REDIS_CLIENT = 'REDIS_CLIENT';
diff --git a/server/src/lib/redis/redis.module.ts b/server/src/lib/redis/redis.module.ts
new file mode 100644
index 00000000..45261920
--- /dev/null
+++ b/server/src/lib/redis/redis.module.ts
@@ -0,0 +1,40 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-30 14:39:05
+ * @LastEditTime: 2024-09-14 19:03:21
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Global, Module } from '@nestjs/common';
+import { ConfigModule, ConfigService } from '@nestjs/config';
+import { RedisService } from './redis.service';
+import { REDIS_CLIENT } from './redis.constant';
+import Redis from 'ioredis';
+import redisConfig from '../../../config/redis.config';
+
+@Global()
+@Module({
+ imports: [ConfigModule.forRoot({ load: [redisConfig] })],
+ providers: [
+ RedisService,
+ {
+ provide: REDIS_CLIENT,
+ useFactory: async (configService: ConfigService) => {
+ const client = new Redis(configService.get('REDIS_CONFIG'));
+ console.log('Redis client connected.');
+ client.on('error', (err) => {
+ console.error('Redis client encountered an error:', err);
+ });
+
+ client.on('end', () => {
+ console.log('Connection to Redis closed.');
+ });
+
+ return client;
+ },
+ inject: [ConfigService],
+ },
+ ],
+ exports: [REDIS_CLIENT, RedisService],
+})
+export class RedisModule {}
diff --git a/server/src/lib/redis/redis.service.ts b/server/src/lib/redis/redis.service.ts
new file mode 100644
index 00000000..fd6a53ba
--- /dev/null
+++ b/server/src/lib/redis/redis.service.ts
@@ -0,0 +1,103 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-31 19:15:15
+ * @LastEditTime: 2024-09-18 11:42:41
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable, Inject } from '@nestjs/common';
+import { Redis } from 'ioredis';
+import { REDIS_CLIENT } from './redis.constant';
+
+@Injectable()
+export class RedisService {
+ constructor(@Inject(REDIS_CLIENT) private readonly client: Redis) {}
+
+ /**
+ * 设置key-value
+ * @param key
+ * @param value
+ * @param seconds
+ * @returns
+ */
+ async setKey(key: string, value: any, seconds?: number): Promise<boolean> {
+ value = JSON.stringify(value);
+ if (!seconds) return !!(await this.client.set(key, value));
+
+ return !!(await this.client.set(key, value, 'EX', seconds));
+ }
+
+ /**
+ * 获取值
+ * @param key
+ * @returns
+ */
+ async get(key: string, isObj = true): Promise<any> {
+ const data = await this.client.get(key);
+ if (!data) return null;
+ return isObj ? JSON.parse(data) : data;
+ }
+
+ /**
+ * 清除值
+ * @param key
+ * @returns
+ */
+ async del(key: string): Promise<boolean> {
+ const data = await this.client.del(key);
+ return !!data;
+ }
+
+ /**
+ * 设置过期时间
+ * @param key
+ * @param times
+ * @returns
+ */
+ async setPexire(key: string, times = 0): Promise<boolean> {
+ const data = await this.client.pexpire(key, times);
+ return data === 1;
+ }
+
+ /**
+ * 生成订单号
+ * @param h 前置标识
+ */
+ async generateOrderNumber(h: string = '') {
+ try {
+ // 获取今天的日期,格式化为 YYYYMMDD
+ const today = new Date();
+ const datePrefix = `${today.getFullYear()}${today.getMonth() + 1}${today.getDate()}`;
+
+ // 使用 Redis 的 INCR 命令生成递增的序列号
+ const sequence = await this.client.incr(`order_seq:${h}${datePrefix}`);
+
+ // 格式化序列号,确保它有固定的位数,例如8位
+ const formattedSequence = sequence.toString().padStart(8, '0');
+
+ // 拼接日期前缀和序列号,形成完整的订单号
+ const orderNumber = `${h}${datePrefix}-${formattedSequence}`;
+
+ return orderNumber;
+ } catch (error) {
+ console.error('Error generating order number:', error);
+ throw error;
+ }
+ }
+
+ /**
+ * 重置订单号
+ * @param h 前置标识
+ */
+ async resetOrderNumber(h: string = '') {
+ try {
+ const today = new Date();
+ const datePrefix = `${today.getFullYear()}${today.getMonth() + 1}${today.getDate()}`;
+
+ // 删除前一天的序列号键
+ await this.client.del(`order_seq:${h}${datePrefix}`);
+ } catch (error) {
+ console.error('Error resetting order sequence:', error);
+ }
+ }
+}
diff --git a/server/src/lib/sms/alicloud-pns.service.ts b/server/src/lib/sms/alicloud-pns.service.ts
new file mode 100644
index 00000000..91df5a20
--- /dev/null
+++ b/server/src/lib/sms/alicloud-pns.service.ts
@@ -0,0 +1,52 @@
+import { Injectable } from '@nestjs/common';
+import * as $OpenApi from '@alicloud/openapi-client';
+import * as $Util from '@alicloud/tea-util';
+import { AlicloudSmsOptions } from './interfaces/alicloud-sms-options.interface';
+import { ConfigService } from '@nestjs/config';
+import Dypnsapi20170525, * as $Dypnsapi20170525 from '@alicloud/dypnsapi20170525';
+
+@Injectable()
+export class AlicloudPnsService {
+ private client: Dypnsapi20170525;
+ constructor(private configService: ConfigService) {
+ const options: AlicloudSmsOptions = this.configService.get('SMS_CONFIG');
+ const config = new $OpenApi.Config({
+ accessKeyId: options.config.accessKeyId,
+ accessKeySecret: options.config.accessKeySecret,
+ });
+
+ config.endpoint = `dypnsapi.aliyuncs.com`;
+ this.client = new Dypnsapi20170525(config);
+ }
+
+ /**
+ * 获取一键登录的手机号
+ * @param accessToken
+ * @param outId
+ * @returns
+ */
+ async getOneKeyLoginPhone(
+ accessToken: string,
+ outId?: string,
+ ): Promise<string> {
+ const runtime = new $Util.RuntimeOptions({});
+ const getMobileRequest = new $Dypnsapi20170525.GetMobileRequest({
+ accessToken,
+ outId,
+ });
+ try {
+ const res = await this.client.getMobileWithOptions(
+ getMobileRequest,
+ runtime,
+ );
+
+ if (res.statusCode !== 200) throw new Error('not 200' + res.statusCode);
+ if (res.body.code !== 'OK') throw new Error(res.body.message);
+
+ return res.body.getMobileResultDTO.mobile;
+ } catch (error) {
+ console.log('------ getOneKeyLoginPhone ---- error', error);
+ return '';
+ }
+ }
+}
diff --git a/server/src/lib/sms/alicloud-sms.module.ts b/server/src/lib/sms/alicloud-sms.module.ts
new file mode 100644
index 00000000..b9b5d7c2
--- /dev/null
+++ b/server/src/lib/sms/alicloud-sms.module.ts
@@ -0,0 +1,24 @@
+/*
+ * @Author: lish
+ * @Date: 2024-07-08 20:13:01
+ * @LastEditors: lish
+ * @LastEditTime: 2024-07-08 21:06:37
+ * @Description: Do not edit
+ */
+import { Module, Global } from '@nestjs/common';
+import { AlicloudSmsService } from './alicloud-sms.service';
+import { ConfigModule } from '@nestjs/config';
+import smsConfig from '../../../config/sms.config';
+import { AlicloudPnsService } from './alicloud-pns.service';
+
+@Global()
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [smsConfig], // 加载自定义配置项
+ }),
+ ],
+ providers: [AlicloudSmsService, AlicloudPnsService],
+ exports: [AlicloudSmsService, AlicloudPnsService],
+})
+export class AlicloudSmsModule {}
diff --git a/server/src/lib/sms/alicloud-sms.service.ts b/server/src/lib/sms/alicloud-sms.service.ts
new file mode 100644
index 00000000..72d718b1
--- /dev/null
+++ b/server/src/lib/sms/alicloud-sms.service.ts
@@ -0,0 +1,54 @@
+import { Injectable } from '@nestjs/common';
+import Dysmsapi20170525, * as $Dysmsapi20170525 from '@alicloud/dysmsapi20170525';
+import * as $OpenApi from '@alicloud/openapi-client';
+import * as $Util from '@alicloud/tea-util';
+import { AlicloudSmsOptions } from './interfaces/alicloud-sms-options.interface';
+import { ConfigService } from '@nestjs/config';
+
+@Injectable()
+export class AlicloudSmsService {
+ private client: Dysmsapi20170525;
+ private options: AlicloudSmsOptions;
+ constructor(private configService: ConfigService) {
+ const options: AlicloudSmsOptions = this.configService.get('SMS_CONFIG');
+ this.options = options;
+ const config = new $OpenApi.Config({
+ ...options.config,
+ });
+
+ this.client = new Dysmsapi20170525(config);
+ }
+
+ /**
+ * Send message.
+ * @param phone 手机号
+ * @param code 验证码
+ */
+ public async sendLoginSms(phone: string, code: string): Promise<boolean> {
+ const sendSmsRequest = new $Dysmsapi20170525.SendSmsRequest({
+ phoneNumbers: phone,
+ signName: this.options.defaults.signName,
+ templateCode: this.options.defaults.templateCode,
+ templateParam: JSON.stringify({ code }),
+ });
+
+ const runtime = new $Util.RuntimeOptions({});
+
+ try {
+ const result = await this.client.sendSmsWithOptions(
+ sendSmsRequest,
+ runtime,
+ );
+
+ if (result.body.code === 'isv.BUSINESS_LIMIT_CONTROL') {
+ console.log('发送短信失败,请稍后再试');
+ return false;
+ }
+
+ return true;
+ } catch (error: any) {
+ console.log('==== sendLoginSms ====', error);
+ return false;
+ }
+ }
+}
diff --git a/server/src/lib/sms/interfaces/alicloud-sms-options.interface.ts b/server/src/lib/sms/interfaces/alicloud-sms-options.interface.ts
new file mode 100644
index 00000000..f4f439a7
--- /dev/null
+++ b/server/src/lib/sms/interfaces/alicloud-sms-options.interface.ts
@@ -0,0 +1,100 @@
+/*
+ * @Author: lish
+ * @Date: 2024-07-08 20:13:01
+ * @LastEditors: lish
+ * @LastEditTime: 2024-07-08 20:27:44
+ * @Description: Do not edit
+ */
+export interface AlicloudSmsOptions {
+ config: {
+ /**
+ * Alicloud account accessKey ID.
+ *
+ * @see https://usercenter.console.aliyun.com/#/manage/ak
+ * @type {string}
+ */
+ accessKeyId: string;
+
+ /**
+ * Alicloud account accessKey secret.
+ *
+ * @see https://usercenter.console.aliyun.com/#/manage/ak
+ * @type {string}
+ */
+ accessKeySecret: string;
+
+ /**
+ * Alicloud API service url.
+ *
+ * @default 'https://dysmsapi.aliyuncs.com'
+ * @type {string}
+ */
+ endpoint?: string;
+
+ /**
+ * Alicloud SMS API version.
+ *
+ * @default 2017-05-25
+ * @type {string}
+ */
+ apiVersion?: string;
+
+ opts?: {
+ /**
+ * @default 3000
+ * @type {number}
+ */
+ timeout?: number;
+
+ /**
+ * Format the parameter name to first letter upper case
+ *
+ * @default true
+ * @type {boolean}
+ */
+ formatParams?: boolean;
+
+ /**
+ * Set the http method
+ *
+ * @default GET
+ * @type {('GET' | 'POST')}
+ */
+ method?: 'GET' | 'POST';
+
+ /**
+ * Http request headers
+ *
+ * @type {object}
+ */
+ headers?: object;
+ };
+ };
+ defaults?: {
+ /**
+ * SMS message template ID.
+ *
+ * @see 请在控制台模板管理页面模板CODE一列查看。
+ * @type {string}
+ */
+ signName?: string;
+
+ /**
+ * Alicloud region ID.
+ *
+ * @type {string}
+ */
+ regionId?: string;
+
+ templateCode?: string;
+ };
+
+ /**
+ * Log sent message on dashboard.
+ *
+ * @default false
+ * @type {boolean}
+ * @memberof AlicloudSmsOptions
+ */
+ logger?: boolean;
+}
diff --git a/server/src/lib/sms/interfaces/index.ts b/server/src/lib/sms/interfaces/index.ts
new file mode 100644
index 00000000..caead431
--- /dev/null
+++ b/server/src/lib/sms/interfaces/index.ts
@@ -0,0 +1,8 @@
+/*
+ * @Author: lish
+ * @Date: 2024-07-08 20:13:01
+ * @LastEditors: lish
+ * @LastEditTime: 2024-07-08 20:44:01
+ * @Description: Do not edit
+ */
+export * from './alicloud-sms-options.interface';
diff --git a/server/src/lib/tms/tms.module.ts b/server/src/lib/tms/tms.module.ts
new file mode 100644
index 00000000..6bada913
--- /dev/null
+++ b/server/src/lib/tms/tms.module.ts
@@ -0,0 +1,23 @@
+/*
+ * @Author: lish
+ * @Date: 2024-07-08 20:13:01
+ * @LastEditors: lish
+ * @LastEditTime: 2024-07-08 21:06:37
+ * @Description: 内容安全模块
+ */
+import { Module, Global } from '@nestjs/common';
+import { TmsService } from './tms.service';
+import { ConfigModule } from '@nestjs/config';
+import tmsConfig from 'config/tms.config';
+
+@Global()
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [tmsConfig],
+ }),
+ ],
+ providers: [TmsService],
+ exports: [TmsService],
+})
+export class TmsModule {}
diff --git a/server/src/lib/tms/tms.service.ts b/server/src/lib/tms/tms.service.ts
new file mode 100644
index 00000000..2adee46c
--- /dev/null
+++ b/server/src/lib/tms/tms.service.ts
@@ -0,0 +1,54 @@
+import { Injectable } from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+import * as tencentcloud from 'tencentcloud-sdk-nodejs-tms';
+import { Client } from 'tencentcloud-sdk-nodejs-tms/tencentcloud/services/tms/v20201229/tms_client';
+const TmsClient = tencentcloud.tms.v20201229.Client;
+
+export enum TmsLabels {
+ Normal = 'Normal',
+ Porn = 'Porn',
+ Abuse = 'Abuse',
+ Ad = 'Ad',
+ Error = 'Error',
+}
+
+@Injectable()
+export class TmsService {
+ private client: Client;
+ constructor(private configService: ConfigService) {
+ const options: { secretId: string; secretKey: string } =
+ this.configService.get('TMS_CONFIG');
+
+ const clientConfig = {
+ credential: options,
+
+ region: 'ap-beijing',
+ profile: {
+ httpProfile: {
+ endpoint: 'tms.tencentcloudapi.com',
+ },
+ },
+ };
+
+ this.client = new TmsClient(clientConfig);
+ }
+
+ /**
+ * 内容安全验证
+ * @param content 文本内容
+ * **Normal**:正常,**Porn**:色情,**Abuse**:谩骂,**Ad**:广告;以及其他令人反感、不安全或不适宜的内容类型 **Error**
+ */
+ public async textModeration(content: string): Promise<TmsLabels> {
+ try {
+ const base64 = Buffer.from(content).toString('base64');
+ const result = await this.client.TextModeration({
+ Content: base64,
+ });
+
+ return result.Label as TmsLabels;
+ } catch (error: any) {
+ console.log('==== textModeration ====', error);
+ return TmsLabels.Error;
+ }
+ }
+}
diff --git a/server/src/lib/wx/utils.ts b/server/src/lib/wx/utils.ts
new file mode 100644
index 00000000..19c26c11
--- /dev/null
+++ b/server/src/lib/wx/utils.ts
@@ -0,0 +1,14 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-20 16:36:41
+ * @LastEditTime: 2025-02-26 14:41:25
+ * @LastEditors: nevin
+ * @Description:
+ */
+import * as crypto from 'crypto';
+
+export function generateSignature(sessionKey: string) {
+ const hmac = crypto.createHmac('sha256', sessionKey);
+ hmac.update('');
+ return hmac.digest('hex');
+}
diff --git a/server/src/lib/wx/wx.module.ts b/server/src/lib/wx/wx.module.ts
new file mode 100644
index 00000000..f1cf87bf
--- /dev/null
+++ b/server/src/lib/wx/wx.module.ts
@@ -0,0 +1,36 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 16:12:27
+ * @LastEditTime: 2025-02-25 09:47:37
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Module } from '@nestjs/common';
+import { ConfigModule, ConfigService } from '@nestjs/config';
+import { WxService } from './wx.service';
+import wxConfig from '../../../config/wx.config';
+import { WxPayService } from './wxPay.service';
+import { WeChatPayModule } from 'nest-wechatpay-node-v3';
+import { WxGzhService } from './wxGzh.service';
+
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [wxConfig], // 加载自定义配置项
+ }),
+ WeChatPayModule.registerAsync({
+ inject: [ConfigService],
+ useFactory: async (configService: ConfigService) => {
+ return {
+ appid: configService.get('WX_CONFIG.APP_ID'),
+ mchid: configService.get('WX_CONFIG.MCH_ID'),
+ publicKey: configService.get('WX_CONFIG.PUBLIC_KEY'),
+ privateKey: configService.get('WX_CONFIG.PRIVATE_KEY'),
+ };
+ },
+ }),
+ ],
+ providers: [WxService, WxPayService, WxGzhService],
+ exports: [WxService, WxPayService, WxGzhService],
+})
+export class WxModule {}
diff --git a/server/src/lib/wx/wx.service.ts b/server/src/lib/wx/wx.service.ts
new file mode 100644
index 00000000..0418b8aa
--- /dev/null
+++ b/server/src/lib/wx/wx.service.ts
@@ -0,0 +1,122 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 16:12:56
+ * @LastEditTime: 2025-02-24 22:20:10
+ * @LastEditors: nevin
+ * @Description: 微信服务
+ */
+import { Injectable } from '@nestjs/common';
+import axios from 'axios';
+import { ConfigService } from '@nestjs/config';
+import { generateSignature } from './utils';
+import { RedisService } from '../redis/redis.service';
+
+@Injectable()
+export class WxService {
+ appId = '';
+ appSecret = '';
+ constructor(
+ private readonly configService: ConfigService,
+ private readonly redisService: RedisService,
+ ) {
+ this.appId = this.configService.get('WX_CONFIG.APP_ID');
+ this.appSecret = this.configService.get('WX_CONFIG.APP_SECRET');
+ }
+
+ /**
+ * 获取access_token
+ * @returns
+ */
+ private async getMiniAppAccessToken(): Promise<string> {
+ const orgValue: string = await this.redisService.get(
+ `${this.appId}:access_token`,
+ );
+ if (orgValue) return orgValue;
+
+ const url = `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${this.appId}&secret=${this.appSecret}`;
+ const result: {
+ data: {
+ access_token: string;
+ expires_in: number;
+ };
+ } = await axios.get(url);
+
+ if (result.data.access_token) {
+ await this.redisService.setKey(
+ `${this.appId}:access_token`,
+ result.data.access_token,
+ result.data.expires_in,
+ );
+ }
+
+ return result.data.access_token;
+ }
+
+ async code2Session(code: string): Promise<{
+ session_key: string;
+ unionid: string;
+ errmsg: string;
+ openid: string;
+ errcode: number;
+ }> {
+ const url = `https://api.weixin.qq.com/sns/jscode2session?appid=${this.appId}&secret=${this.appSecret}&js_code=${code}&grant_type=authorization_code`;
+ const result = await axios.get(url);
+ return result.data;
+ }
+
+ /**
+ * 校验登录状态
+ * @param openid
+ * @param session_key
+ * @returns
+ */
+ async checkSessionKey(openid: string, session_key: string): Promise<boolean> {
+ const access_token: string = await this.getMiniAppAccessToken();
+
+ const url = `https://api.weixin.qq.com/wxa/checksession?access_token=${access_token}&signature=${generateSignature(session_key)}&openid=${openid}&sig_method=hmac_sha256`;
+ const result = await axios.get(url);
+ return result.data.errcode === 0;
+ }
+
+ /**
+ * 获取手机号
+ * @param code
+ * @returns
+ */
+ async getPhoneNumber(code: string): Promise<string> {
+ const access_token: string = await this.getMiniAppAccessToken();
+
+ const url = `https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=${access_token}`;
+ const result = await axios.post(url, {
+ code: code,
+ });
+
+ return result.data.phone_info.phoneNumber;
+ }
+
+ /**
+ * 获取app的认证信息
+ * @param code
+ * @returns
+ */
+ async getAppAuthInfo(code: string): Promise<{
+ access_token: string;
+ expires_in: number;
+ refresh_token: string;
+ openid: string;
+ scope: string;
+ unionid: string;
+ }> {
+ const key: string = `wx_auth_info:${code}`;
+ const orgValue = await this.redisService.get(key);
+ if (orgValue) return orgValue;
+
+ const url = `https://api.weixin.qq.com/sns/oauth2/access_token?appid=${this.appId}&secret=${this.appSecret}&code=${code}&grant_type=authorization_code`;
+ const result = await axios.get(url);
+
+ if (result.data)
+ this.redisService.setKey(key, result.data, result.data.expires_in);
+
+ return result.data;
+ }
+}
diff --git a/server/src/lib/wx/wxGzh.service.ts b/server/src/lib/wx/wxGzh.service.ts
new file mode 100644
index 00000000..0f54fab2
--- /dev/null
+++ b/server/src/lib/wx/wxGzh.service.ts
@@ -0,0 +1,166 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 16:12:56
+ * @LastEditTime: 2025-02-26 10:12:02
+ * @LastEditors: nevin
+ * @Description: 微信公众号服务
+ */
+import { Injectable } from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+import * as crypto from 'crypto';
+import { RedisService } from '../redis/redis.service';
+import axios from 'axios';
+
+@Injectable()
+export class WxGzhService {
+ appId = '';
+ secret = '';
+ token = '';
+ aesKey = '';
+ constructor(
+ private readonly configService: ConfigService,
+ private readonly redisService: RedisService,
+ ) {
+ this.appId = this.configService.get('WX_GZH.WX_GZH_ID');
+ this.secret = this.configService.get('WX_GZH.WX_GZH_SECRET');
+ this.token = this.configService.get('WX_GZH.WX_GZH_TOKEN');
+ this.aesKey = this.configService.get('WX_GZH.WX_GZH_AES_KEY');
+ }
+
+ /**
+ * 获取access_token
+ * @returns
+ */
+ private async getAccessToken(): Promise<string> {
+ try {
+ const orgValue: string = await this.redisService.get(
+ `${this.appId}:access_token`,
+ );
+ if (orgValue) return orgValue;
+
+ const url = `https://api.weixin.qq.com/cgi-bin/stable_token`;
+ const result: {
+ data: {
+ access_token: string;
+ expires_in: number;
+ errcode: number;
+ errmsg: string;
+ };
+ } = await axios.post(url, {
+ grant_type: 'client_credential',
+ appid: this.appId,
+ secret: this.secret,
+ });
+
+ if (!!result.data.errcode)
+ throw new Error(result.data.errcode + '---' + result.data.errmsg);
+
+ if (result.data.access_token) {
+ await this.redisService.setKey(
+ `${this.appId}:access_token`,
+ result.data.access_token,
+ result.data.expires_in,
+ );
+ }
+
+ return result.data.access_token;
+ } catch (error: any) {
+ console.log('--------- getAccessToken ---- error', error);
+
+ return '';
+ }
+ }
+
+ /**
+ * 创建二维码
+ * @returns
+ */
+ async createQrcode(sceneStr: string): Promise<string> {
+ const orgValue: string = await this.redisService.get(
+ `${this.appId}:create_qrcode_ticket:${sceneStr}`,
+ );
+ if (orgValue) return orgValue;
+
+ const accessToken = await this.getAccessToken();
+ if (!accessToken) return '';
+
+ try {
+ const url = `https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=${accessToken}`;
+ const result: {
+ data: {
+ errcode: number;
+ errmsg: string;
+ ticket: string;
+ expire_seconds: number;
+ url: string;
+ };
+ } = await axios.post(url, {
+ expire_seconds: 60 * 8,
+ action_name: 'QR_STR_SCENE',
+ action_info: { scene: { scene_str: sceneStr } },
+ });
+
+ if (!!result.data.errcode)
+ throw new Error(result.data.errcode + '---' + result.data.errmsg);
+
+ if (!!result.data.ticket) {
+ await this.redisService.setKey(
+ `${this.appId}:create_qrcode_ticket:${sceneStr}`,
+ result.data.ticket,
+ result.data.expire_seconds,
+ );
+ }
+
+ return result.data.ticket;
+ } catch (error) {
+ console.log('--------- createQrcode ---- error', error);
+ return '';
+ }
+ }
+
+ /**
+ * 提供给微信进行验证
+ * @returns
+ */
+ async checkCallback(param: {
+ signature: string;
+ echostr: string;
+ timestamp: string;
+ nonce: string;
+ }): Promise<string> {
+ const { signature, echostr, timestamp, nonce } = param;
+
+ // 将 token、timestamp、nonce三个参数按字典序排序
+ const str = [this.token, timestamp, nonce].sort().join('');
+
+ // 加密字符串, 建议使用 sha1加密
+ const sha1 = crypto.createHash('sha1');
+ sha1.update(str);
+ const sha1Str = sha1.digest('hex');
+
+ if (sha1Str === signature) {
+ console.log('验证成功');
+ return echostr;
+ } else {
+ return 'error';
+ }
+ }
+
+ async doMsg(
+ param: {
+ signature: string;
+ timestamp: string;
+ nonce: string;
+ },
+ xml: {
+ ToUserName: string;
+ FromUserName: string;
+ CreateTime: string;
+ MsgType: string;
+ Event: string;
+ EventKey: string;
+ },
+ ): Promise<string> {
+ return '';
+ }
+}
diff --git a/server/src/lib/wx/wxPay.service.ts b/server/src/lib/wx/wxPay.service.ts
new file mode 100644
index 00000000..33410d13
--- /dev/null
+++ b/server/src/lib/wx/wxPay.service.ts
@@ -0,0 +1,168 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 16:12:56
+ * @LastEditTime: 2024-07-30 17:50:07
+ * @LastEditors: nevin
+ * @Description: 微信服务
+ */
+import {
+ HttpException,
+ HttpStatus,
+ Inject,
+ Injectable,
+ Logger,
+} from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+import WxPay from 'wechatpay-node-v3';
+import { WECHAT_PAY_MANAGER } from 'nest-wechatpay-node-v3';
+import { sleep } from '../../util';
+
+@Injectable()
+export class WxPayService {
+ appId = '';
+ mchId = '';
+ notifyUrl = '';
+ key = '';
+ constructor(
+ private readonly configService: ConfigService,
+ @Inject(WECHAT_PAY_MANAGER) private wxPay: WxPay,
+ ) {
+ this.appId = this.configService.get('WX_CONFIG.APP_ID');
+ this.mchId = this.configService.get('WX_CONFIG.MCH_ID');
+ this.notifyUrl = this.configService.get('WX_CONFIG.NOTIFY_URL');
+ this.key = this.configService.get('WX_CONFIG.KEY');
+ }
+
+ /**
+ * 小程序下单
+ * @param openid
+ * @param money
+ * @returns
+ */
+ async miniAppToPay(
+ openid: string,
+ money: number,
+ outTradeNo: string,
+ description: string,
+ ): Promise<any> {
+ if (process.env.NODE_ENV !== 'production') {
+ money = 0.01;
+ }
+ const params = {
+ appid: this.appId,
+ mchid: this.mchId,
+ description: description,
+ out_trade_no: outTradeNo,
+ notify_url: this.notifyUrl,
+ amount: {
+ total: money * 100,
+ },
+ payer: {
+ openid: openid,
+ },
+ };
+ const result = await this.wxPay.transactions_jsapi(params);
+ if (result.error) {
+ Logger.error(result.error);
+ return null;
+ }
+
+ return result.data;
+ }
+
+ async appToPay(money: number, outTradeNo: string, description: string) {
+ const params = {
+ appid: this.appId,
+ mchid: this.mchId,
+ description: description,
+ out_trade_no: outTradeNo,
+ notify_url: this.notifyUrl,
+ amount: {
+ total: money * 100,
+ // total: money, // TODO: 测试使用1分钱
+ },
+ payer: {},
+ };
+ const result = await this.wxPay.transactions_app(params);
+ if (result.error) {
+ Logger.error(result.error);
+ return null;
+ }
+
+ return result.data;
+ }
+
+ async decipherGcm(
+ ciphertext: string,
+ associated_data: string,
+ nonce: string,
+ key?: string,
+ ): Promise<{
+ out_trade_no: string;
+ trade_state: string; // 'SUCCESS'
+ amount: {
+ total: number;
+ };
+ }> {
+ try {
+ if (!key) key = this.key;
+
+ return this.wxPay.decipher_gcm(ciphertext, associated_data, nonce, key);
+ } catch (error) {
+ console.log('===decipherGcm==', error);
+ Logger.error(error);
+
+ return null;
+ }
+ }
+
+ /**
+ * 发送红包
+ * @param openId
+ * @param transAmount 金额 单位元
+ * @param outBizNo 业务单号
+ * @param retry
+ * @returns
+ */
+ async sendRedPacket(
+ openId: string,
+ transAmount: number,
+ outBizNo: string,
+ retry = 0,
+ ) {
+ const result = await this.wxPay.batches_transfer({
+ out_batch_no: outBizNo,
+ batch_name: '提现红包',
+ batch_remark: '提现红包',
+ total_amount: transAmount * 100,
+ total_num: 1,
+ transfer_detail_list: [
+ {
+ out_detail_no: outBizNo,
+ transfer_amount: transAmount * 100,
+ transfer_remark: '提现红包',
+ openid: openId,
+ },
+ ],
+ });
+
+ if (result.status === 200) {
+ return result;
+ } else if (result.error === 'SYSTEM_ERROR' && result.status === 500) {
+ Logger.error('系统错误', 'SYSTEM_ERROR', 'wxPayService', result);
+ if (retry > 5) {
+ throw new HttpException('系统错误', HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ await sleep((retry + 1) * 1000);
+ return await this.sendRedPacket(
+ openId,
+ transAmount,
+ outBizNo,
+ (retry = retry + 1),
+ );
+ } else {
+ Logger.error('系统错误', 'wxPayService', result);
+ return null;
+ }
+ }
+}
diff --git a/server/src/main.ts b/server/src/main.ts
new file mode 100644
index 00000000..4ea29a34
--- /dev/null
+++ b/server/src/main.ts
@@ -0,0 +1,72 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-15 14:17:16
+ * @LastEditTime: 2025-02-25 22:17:43
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { NestFactory } from '@nestjs/core';
+import { AppModule } from './app.module';
+import { NestExpressApplication } from '@nestjs/platform-express';
+import { ConfigService } from '@nestjs/config';
+import { createSwagger } from './_swagger';
+import {
+ BadRequestException,
+ HttpStatus,
+ ValidationPipe,
+} from '@nestjs/common';
+import { join } from 'path';
+
+async function bootstrap() {
+ const app = await NestFactory.create<NestExpressApplication>(AppModule, {
+ bufferLogs: true,
+ });
+ const config = app.get(ConfigService);
+
+ app.enableCors({
+ origin: '*',
+ methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
+ preflightContinue: false,
+ optionsSuccessStatus: 200,
+ });
+
+ app.setGlobalPrefix('api', { exclude: ['/'] }); // 路由添加api开头
+
+ const { ENABLE_SWAGGER, NODE_ENV, PORT } = config.get('SERVER_CONFIG');
+
+ const docsUrl = ENABLE_SWAGGER ? createSwagger(app) : ''; // 文档插件
+
+ app.useGlobalPipes(
+ new ValidationPipe({
+ transform: true,
+ whitelist: true,
+ transformOptions: { enableImplicitConversion: true },
+ // forbidNonWhitelisted: true, // 禁止 无装饰器验证的数据通过
+ errorHttpStatusCode: HttpStatus.BAD_REQUEST,
+ stopAtFirstError: true,
+ exceptionFactory: (errors) =>
+ new BadRequestException(
+ errors.map((e) => {
+ const rule = Object.keys(e.constraints!)[0];
+ const msg = e.constraints![rule];
+ return msg;
+ })[0],
+ ),
+ }),
+ );
+ app.useBodyParser('json', { limit: '50mb' });
+ app.useBodyParser('urlencoded', { limit: '50mb', extended: true });
+ app.setBaseViewsDir(join(__dirname, '..', 'views'));
+ app.setViewEngine('hbs');
+ // app.useGlobalInterceptors(
+ // new TransformInterceptor(),
+ // new LoggingInterceptor(),
+ // ); // 全局注册拦截器
+ // app.useGlobalFilters(new HttpExceptionFilter()); // 全局错误拦截器
+ await app.listen(PORT);
+ console.info(
+ `Application-${NODE_ENV} is running on: http://127.0.0.1:${PORT}`,
+ );
+ console.info(`Swagger Docs: http://127.0.0.1:${PORT}${docsUrl}`);
+}
+bootstrap();
diff --git a/server/src/manager/dto/manager.dto.ts b/server/src/manager/dto/manager.dto.ts
new file mode 100644
index 00000000..db6b4b2f
--- /dev/null
+++ b/server/src/manager/dto/manager.dto.ts
@@ -0,0 +1,63 @@
+import { ApiProperty } from '@nestjs/swagger';
+import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
+
+export class LoginDto {
+ @ApiProperty({ description: '账号' })
+ @IsString()
+ @IsNotEmpty()
+ account: string;
+
+ @ApiProperty({ description: '密码' })
+ @IsString()
+ @IsNotEmpty()
+ password: string;
+}
+
+export class CreateManagerDto {
+ @ApiProperty({ description: '账号' })
+ @IsString()
+ @IsNotEmpty()
+ account: string;
+
+ @ApiProperty({ description: '密码' })
+ @IsString()
+ @IsNotEmpty()
+ password: string;
+
+ @ApiProperty({ description: '姓名' })
+ @IsString()
+ @IsNotEmpty()
+ name: string;
+
+ @ApiProperty({ description: '手机号', required: false })
+ @IsString()
+ @IsOptional()
+ phone?: string;
+}
+
+export class UpdateManagerDto {
+ @ApiProperty({ description: '姓名', required: false })
+ @IsString()
+ @IsOptional()
+ name?: string;
+
+ @ApiProperty({ description: '手机号', required: false })
+ @IsString()
+ @IsOptional()
+ phone?: string;
+
+ @ApiProperty({ description: '头像', required: false })
+ @IsString()
+ @IsOptional()
+ avatar?: string;
+
+ @ApiProperty({ description: '密码', required: false })
+ @IsString()
+ @IsOptional()
+ password?: string;
+
+ @ApiProperty({ description: '盐', required: false })
+ @IsString()
+ @IsOptional()
+ salt?: string;
+}
diff --git a/server/src/manager/manager.controller.ts b/server/src/manager/manager.controller.ts
new file mode 100644
index 00000000..19ea8d81
--- /dev/null
+++ b/server/src/manager/manager.controller.ts
@@ -0,0 +1,92 @@
+import { Body, Controller, Delete, Get, Post, Put } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { ManagerService } from './manager.service';
+import {
+ CreateManagerDto,
+ LoginDto,
+ UpdateManagerDto,
+} from './dto/manager.dto';
+import { AuthService } from '../auth/auth.service';
+import { Manager } from '../auth/manager.guard';
+import { GetToken, Public } from '../auth/auth.guard';
+import { TokenInfo } from '../auth/interfaces/auth.interfaces';
+import { validatePassWord } from '../util/password.util';
+import { AppHttpException } from '../filters/http-exception.filter';
+import { ErrHttpBack } from '../filters/http-exception.back-code';
+
+@ApiTags('manager - 管理员')
+@Controller('manager')
+export class ManagerController {
+ constructor(
+ private readonly managerService: ManagerService,
+ private readonly authService: AuthService,
+ ) {}
+
+ @ApiOperation({ summary: '管理员登录' })
+ @Public()
+ @Post('login')
+ async login(@Body() loginDto: LoginDto) {
+ const manager = await this.managerService.findByAccount(loginDto.account);
+ if (!manager) {
+ throw new AppHttpException(ErrHttpBack.err_user_no_had);
+ }
+
+ const isValid = validatePassWord(
+ manager.password,
+ manager.salt,
+ loginDto.password,
+ );
+ if (!isValid) {
+ throw new AppHttpException(ErrHttpBack.err_no_power_login);
+ }
+
+ const token = await this.authService.generateToken({
+ id: manager.id,
+ phone: manager.phone || '',
+ name: manager.name,
+ isManager: true,
+ });
+
+ return {
+ token,
+ managerInfo: manager,
+ };
+ }
+
+ @ApiOperation({ summary: '获取管理员信息' })
+ @Manager()
+ @Get('info')
+ async getInfo(@GetToken() token: TokenInfo) {
+ return this.managerService.findById(token.id);
+ }
+
+ @ApiOperation({ summary: '创建管理员' })
+ @Manager()
+ @Post()
+ async create(@Body() createManagerDto: CreateManagerDto) {
+ const existManager = await this.managerService.findByAccount(
+ createManagerDto.account,
+ );
+ if (existManager) {
+ throw new AppHttpException(ErrHttpBack.err_user_had);
+ }
+ return this.managerService.create(createManagerDto);
+ }
+
+ @ApiOperation({ summary: '更新管理员信息' })
+ @Manager()
+ @Put()
+ async update(
+ @GetToken() token: TokenInfo,
+ @Body() updateManagerDto: UpdateManagerDto,
+ ) {
+ return this.managerService.update(token.id, updateManagerDto);
+ }
+
+ @ApiOperation({ summary: '删除管理员' })
+ @Manager()
+ @Delete()
+ async delete(@GetToken() token: TokenInfo) {
+ return this.managerService.delete(token.id);
+ }
+}
diff --git a/server/src/manager/manager.module.ts b/server/src/manager/manager.module.ts
new file mode 100644
index 00000000..29cb1a46
--- /dev/null
+++ b/server/src/manager/manager.module.ts
@@ -0,0 +1,15 @@
+import { Module } from '@nestjs/common';
+import { ManagerController } from './manager.controller';
+import { ManagerService } from './manager.service';
+import { MongooseModule } from '@nestjs/mongoose';
+import { Manager, ManagerSchema } from '../db/schema/manager.schema';
+
+@Module({
+ imports: [
+ MongooseModule.forFeature([{ name: Manager.name, schema: ManagerSchema }]),
+ ],
+ controllers: [ManagerController],
+ providers: [ManagerService],
+ exports: [ManagerService],
+})
+export class ManagerModule {}
diff --git a/server/src/manager/manager.service.ts b/server/src/manager/manager.service.ts
new file mode 100644
index 00000000..83528721
--- /dev/null
+++ b/server/src/manager/manager.service.ts
@@ -0,0 +1,56 @@
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { Manager, ManagerStatus } from '../db/schema/manager.schema';
+import { CreateManagerDto, UpdateManagerDto } from './dto/manager.dto';
+import { encryptPassword } from '../util/password.util';
+
+@Injectable()
+export class ManagerService {
+ constructor(
+ @InjectModel(Manager.name)
+ private readonly managerModel: Model<Manager>,
+ ) {}
+
+ async findByAccount(account: string) {
+ return this.managerModel.findOne({
+ account,
+ status: ManagerStatus.OPEN,
+ });
+ }
+
+ async findById(id: string) {
+ return this.managerModel.findById(id);
+ }
+
+ async create(createManagerDto: CreateManagerDto) {
+ const { password, salt } = encryptPassword(createManagerDto.password);
+ const manager = new this.managerModel({
+ ...createManagerDto,
+ password,
+ salt,
+ });
+ return manager.save();
+ }
+
+ async update(id: string, updateManagerDto: UpdateManagerDto) {
+ if (updateManagerDto.password) {
+ const { password, salt } = encryptPassword(updateManagerDto.password);
+ updateManagerDto.password = password;
+ updateManagerDto.salt = salt;
+ }
+ return this.managerModel.findByIdAndUpdate(
+ id,
+ { $set: updateManagerDto },
+ { new: true },
+ );
+ }
+
+ async delete(id: string) {
+ return this.managerModel.findByIdAndUpdate(
+ id,
+ { $set: { status: ManagerStatus.DELETE } },
+ { new: true },
+ );
+ }
+}
diff --git a/server/src/middleware/xml.middleware.ts b/server/src/middleware/xml.middleware.ts
new file mode 100644
index 00000000..03ce975b
--- /dev/null
+++ b/server/src/middleware/xml.middleware.ts
@@ -0,0 +1,34 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-25 14:39:09
+ * @LastEditTime: 2025-02-25 21:34:03
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable, NestMiddleware } from '@nestjs/common';
+import * as bodyParser from 'body-parser';
+import { NextFunction } from 'express';
+import * as xml2js from 'xml2js';
+
+@Injectable()
+export class XMLMiddleware implements NestMiddleware {
+ private xmlParser = bodyParser.text({ type: 'text/xml' });
+
+ use(req: any, res: any, next: NextFunction) {
+ this.xmlParser(req, res, (err) => {
+ if (err) return next(err);
+
+ if (req.body) {
+ xml2js.parseString(
+ req.body,
+ { explicitArray: false },
+ (parseErr, result) => {
+ if (parseErr) return next(parseErr);
+ req.body = result.xml;
+ },
+ );
+ }
+ next();
+ });
+ }
+}
diff --git a/server/src/modules/account/account.controller.ts b/server/src/modules/account/account.controller.ts
new file mode 100644
index 00000000..43d7e66e
--- /dev/null
+++ b/server/src/modules/account/account.controller.ts
@@ -0,0 +1,164 @@
+import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { AccountService } from './account.service';
+import { Account } from '../../db/schema/account.schema';
+import { ApiResult } from '../../common/decorators/api-result.decorator';
+import {
+ AccountIdDto,
+ AccountListByIdsDto,
+ AccountStatisticsDto,
+ CreateAccountDto,
+ UpdateAccountStatusDto,
+ UpdateAccountStatisticsDto,
+ GoogleLoginDto,
+ DeleteAccountsDto,
+ UpdateAccountDto,
+} from './dto/account.dto';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { GetToken } from 'src/auth/auth.guard';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { Public } from '../../auth/auth.guard';
+import { AccountGroup } from '../../db/schema/accountGroup.schema';
+import { DeleteAccountGroupDto } from './accountGroup/dto/accountGroup.dto';
+
+@ApiTags('账户')
+@Controller('account')
+export class AccountController {
+ constructor(private readonly accountService: AccountService) {}
+
+ @ApiOperation({ summary: '创建账号' })
+ @Post('login')
+ @ApiResult({ type: Account })
+ async createOrUpdateAccount(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: CreateAccountDto,
+ ) {
+ return this.accountService.addOrUpdateAccount({
+ userId: token.id,
+ ...body,
+ });
+ }
+
+ @ApiOperation({ summary: '创建或更新账号' })
+ @Post('update')
+ @ApiResult({ type: Account })
+ async updateOrUpdateAccount(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: UpdateAccountDto,
+ ) {
+ return this.accountService.addOrUpdateAccount({
+ userId: token.id,
+ ...body,
+ });
+ }
+
+ @ApiOperation({ summary: '更新账号状态' })
+ @Post('status')
+ @ApiResult({ type: Account })
+ async updateAccountStatus(
+ @Body(new ParamsValidationPipe()) body: UpdateAccountStatusDto,
+ ) {
+ return this.accountService.updateAccountStatus(body.id, body.status);
+ }
+
+ @ApiOperation({ summary: '获取账号信息' })
+ @Get(':id')
+ @ApiResult({ type: Account })
+ async getAccountInfo(@Param(new ParamsValidationPipe()) param: AccountIdDto) {
+ return this.accountService.getAccountById(param.id);
+ }
+
+ @ApiOperation({ summary: '获取用户所有账户' })
+ @Get('list/all')
+ @ApiResult({ type: [Account] })
+ async getUserAccounts(@GetToken() token: TokenInfo) {
+ return this.accountService.getAccounts(token.id);
+ }
+
+ @ApiOperation({ summary: '删除多个账户' })
+ @Post('deletes')
+ @ApiResult({ type: AccountGroup })
+ async deletes(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: DeleteAccountsDto,
+ ) {
+ return this.accountService.deleteAccounts(body.ids, token.id);
+ }
+
+ @ApiOperation({ summary: '获取账户列表' })
+ @Post('list/ids')
+ @ApiResult({ type: Account })
+ async getAccountListByIds(
+ @GetToken() token: TokenInfo,
+ @Query(new ParamsValidationPipe()) query: AccountListByIdsDto,
+ ) {
+ return this.accountService.getAccountListByIds(token.id, query.ids);
+ }
+
+ @ApiOperation({ summary: '获取账户总数' })
+ @Get('count')
+ @ApiResult({ type: Number })
+ async getAccountCount(@GetToken() token: TokenInfo) {
+ return this.accountService.getAccountCount(token.id);
+ }
+
+ @ApiOperation({ summary: '获取账户统计' })
+ @Get('statistics')
+ @ApiResult({ type: Account })
+ async getAccountStatistics(
+ @GetToken() token: TokenInfo,
+ @Query(new ParamsValidationPipe()) query: AccountStatisticsDto,
+ ) {
+ return this.accountService.getAccountStatistics(token.id, query.type);
+ }
+
+ @ApiOperation({ summary: '删除账户' })
+ @Post('delete/:id')
+ @ApiResult({ type: Boolean })
+ async deleteAccount(
+ @GetToken() token: TokenInfo,
+ @Param(new ParamsValidationPipe()) param: AccountIdDto,
+ ) {
+ return this.accountService.deleteAccount(param.id, token.id);
+ }
+
+ @ApiOperation({ summary: '更新账户统计信息' })
+ @Post('statistics/update')
+ @ApiResult({ type: Boolean })
+ async updateAccountStatistics(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: UpdateAccountStatisticsDto,
+ ) {
+ const {
+ id,
+ fansCount,
+ readCount,
+ likeCount,
+ collectCount,
+ commentCount,
+ income,
+ workCount,
+ } = body;
+ return this.accountService.updateAccountStatistics(
+ id,
+ fansCount,
+ readCount,
+ likeCount,
+ collectCount,
+ commentCount,
+ income,
+ workCount,
+ );
+ }
+
+ // @ApiOperation({ summary: 'Google登录' })
+ // @Post('login/google')
+ // @Public()
+ // @ApiResult({ type: Account })
+ // async googleLogin(
+ // @Body(new ParamsValidationPipe()) body: GoogleLoginDto,
+ // ) {
+ // // console.log(body.clientId, body.credential)
+ // return this.accountService.googleLogin(body.clientId, body.credential);
+ // }
+}
diff --git a/server/src/modules/account/account.module.ts b/server/src/modules/account/account.module.ts
new file mode 100644
index 00000000..3d5ab67d
--- /dev/null
+++ b/server/src/modules/account/account.module.ts
@@ -0,0 +1,25 @@
+import { Global, Module } from '@nestjs/common';
+import { MongooseModule } from '@nestjs/mongoose';
+import { Account, AccountSchema } from '../../db/schema/account.schema';
+import { AccountService } from './account.service';
+import { AccountController } from './account.controller';
+import { AccountGroupController } from './accountGroup/accountGroup.controller';
+import { AccountGroupService } from './accountGroup/accountGroup.service';
+import {
+ AccountGroup,
+ AccountGroupSchema,
+} from '../../db/schema/accountGroup.schema';
+
+@Global()
+@Module({
+ imports: [
+ MongooseModule.forFeature([{ name: Account.name, schema: AccountSchema }]),
+ MongooseModule.forFeature([
+ { name: AccountGroup.name, schema: AccountGroupSchema },
+ ]),
+ ],
+ providers: [AccountService, AccountGroupService],
+ controllers: [AccountController, AccountGroupController],
+ exports: [AccountService, AccountGroupService],
+})
+export class AccountModule {}
diff --git a/server/src/modules/account/account.service.ts b/server/src/modules/account/account.service.ts
new file mode 100644
index 00000000..ca40f6d5
--- /dev/null
+++ b/server/src/modules/account/account.service.ts
@@ -0,0 +1,291 @@
+import { forwardRef, Inject, Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { Account, AccountType } from '../../db/schema/account.schema';
+import { IdService } from 'src/db/id.service';
+
+import { AccountGroupService } from './accountGroup/accountGroup.service';
+
+@Injectable()
+export class AccountService {
+
+ constructor(
+ @InjectModel(Account.name)
+ private readonly accountModel: Model<Account>,
+
+ private readonly idService: IdService,
+ @Inject(forwardRef(() => AccountGroupService))
+ private readonly accountGroupService: AccountGroupService,
+ ) {
+ }
+
+ private async getId() {
+ return this.idService.createId('accountId', 100000000, 1);
+ }
+
+ /**
+ * 将用户组下的账户切换到默认组
+ * @param userId
+ * @param groupId
+ * @param defaultGroupId
+ */
+ async switchToDefaultGroup(
+ userId: string,
+ groupId: number,
+ defaultGroupId: number,
+ ) {
+ return this.accountModel.updateMany(
+ { userId, groupId: { $ne: groupId } },
+ { groupId: defaultGroupId },
+ );
+ }
+
+ /**
+ * 添加或更新账号
+ * @param account
+ * @returns
+ */
+ async addOrUpdateAccount(account: Partial<Account>): Promise<Account> {
+ const existingAccount = await this.accountModel.findOne(
+ account.id
+ ? {
+ id: account.id,
+ }
+ : {
+ userId: account.userId,
+ uid: account.uid,
+ type: account.type,
+ },
+ );
+
+ if (existingAccount) {
+ return this.accountModel.findOneAndUpdate(
+ { id: existingAccount.id },
+ account,
+ {
+ new: true,
+ },
+ );
+ }
+
+ // 获取默认用户组
+ let defaultGrpoupId: number;
+ const defaultGroup = await this.accountGroupService.getDefaultGroup(
+ account.userId,
+ );
+ if (defaultGroup) {
+ defaultGrpoupId = defaultGroup.id;
+ } else {
+ // 如果没有默认用户组,则创建一个默认用户组
+ const newGroup = await this.accountGroupService.createDefaultGroup(
+ account.userId,
+ );
+ defaultGrpoupId = newGroup.id;
+ }
+
+ account.id = await this.getId();
+ account.groupId = defaultGrpoupId;
+ return this.accountModel.create(account);
+ }
+
+ /**
+ * 根据用户id获取账号
+ */
+ async getAccountById(id: number) {
+ return this.accountModel.findOne({ id });
+ }
+
+ /**
+ * 获取所有账户
+ * @param userId
+ * @returns
+ */
+ async getAccounts(userId: string) {
+ return await this.accountModel.find({
+ userId,
+ });
+ }
+
+ /**
+ * 根据ID数组ids获取账户列表数组
+ * @param userId
+ * @param ids
+ * @returns
+ */
+ async getAccountListByIds(userId: string, ids: number[]) {
+ return await this.accountModel.find({
+ userId,
+ id: { $in: ids },
+ });
+ }
+
+ /**
+ * 获取账户的统计信息
+ * @param userId
+ * @param type
+ * @returns
+ */
+ async getAccountStatistics(
+ userId: string,
+ type?: AccountType,
+ ): Promise<{
+ accountTotal: number;
+ list: Account[];
+ fansCount?: number;
+ readCount?: number;
+ likeCount?: number;
+ collectCount?: number;
+ commentCount?: number;
+ income?: number;
+ }> {
+ const accountList = await this.accountModel.find({
+ userId,
+ ...(type && { type }),
+ });
+
+ const res = {
+ accountTotal: accountList.length,
+ list: accountList,
+ fansCount: 0,
+ };
+
+ for (const element of accountList) {
+ // TODO: 获取统计信息
+ // const ret = await platController.getStatistics(element).catch((err) => {
+ // console.error(err);
+ // });
+ // res.fansCount += ret?.fansCount || 0;
+ }
+
+ return res;
+ }
+
+ /**
+ * 获取用户的账户总数
+ * @param userId
+ * @returns
+ */
+ async getAccountCount(userId: string) {
+ return await this.accountModel.countDocuments({ userId });
+ }
+
+ /**
+ * 根据多个账户id查询账户信息
+ * @param ids
+ * @returns
+ */
+ async getAccountsByIds(ids: number[]) {
+ return await this.accountModel.find({
+ id: { $in: ids },
+ });
+ }
+
+ /**
+ * 更新粉丝数量
+ * @param userId
+ * @param account
+ * @param fansCount
+ * @returns
+ */
+ async updateFansCount(userId: string, account: string, fansCount: number) {
+ return await this.accountModel.updateOne(
+ { userId, account },
+ { fansCount: fansCount },
+ );
+ }
+
+ // 获取用户的所有账户的总粉丝量
+ async getUserFansCount(userId: string) {
+ const accounts = await this.accountModel.find({ userId });
+ return accounts.reduce((acc, cur) => acc + (cur.fansCount || 0), 0);
+ }
+
+ /**
+ * 删除
+ * @param id
+ * @param userId
+ * @returns
+ */
+ async deleteAccount(id: number, userId: string): Promise<boolean> {
+ const res = await this.accountModel.deleteOne({
+ id,
+ userId: userId,
+ });
+
+ return res.deletedCount > 0;
+ }
+
+ // 删除多个账户
+ async deleteAccounts(ids: string[], userId: string) {
+ const res = await this.accountModel.deleteMany({
+ _id: { $in: ids },
+ userId,
+ });
+ return res.deletedCount > 0;
+ }
+
+ /**
+ * 更新用户状态
+ * @param id
+ * @param status
+ * @returns
+ */
+ async updateAccountStatus(id: number, status: number) {
+ return await this.accountModel.updateOne({ id }, { status });
+ }
+
+ // 更新账户的统计信息
+ async updateAccountStatistics(
+ id: number,
+ fansCount: number,
+ readCount: number,
+ likeCount: number,
+ collectCount: number,
+ commentCount: number,
+ income: number,
+ workCount: number,
+ ) {
+ return await this.accountModel.updateOne(
+ { id },
+ {
+ fansCount,
+ readCount,
+ likeCount,
+ collectCount,
+ commentCount,
+ income,
+ workCount,
+ },
+ );
+ }
+
+ // /**
+ // * Google登录
+ // * @param clientId Google客户端ID
+ // * @param credential Google认证凭证
+ // * @returns Account
+ // */
+ // async googleLogin(clientId: string, credential: string): Promise<any> {
+ // try {
+ // console.log('Verifying Google token with:');
+
+ // // 验证Google token
+ // const ticket = await this.googleClient.verifyIdToken({
+ // idToken: credential,
+ // audience: clientId,
+ // });
+ // console.log('ticket',ticket)
+ // const payload = ticket.getPayload();
+ // console.log('payload',payload)
+ // if (!payload) {
+ // throw new Error('Invalid Google token');
+ // }
+
+ // console.log('Google login success, payload:', payload);
+ // return payload;
+ // } catch (error) {
+ // console.error('Google login error:', error);
+ // throw new Error(`Google login failed: ${error.message}`);
+ // }
+ // }
+}
diff --git a/server/src/modules/account/accountGroup/accountGroup.controller.ts b/server/src/modules/account/accountGroup/accountGroup.controller.ts
new file mode 100644
index 00000000..0e619dc9
--- /dev/null
+++ b/server/src/modules/account/accountGroup/accountGroup.controller.ts
@@ -0,0 +1,63 @@
+import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { AccountGroupService } from './accountGroup.service';
+import { ApiResult } from '../../../common/decorators/api-result.decorator';
+import { AccountGroup } from '../../../db/schema/accountGroup.schema';
+import { GetToken } from '../../../auth/auth.guard';
+import { TokenInfo } from '../../../auth/interfaces/auth.interfaces';
+import { ParamsValidationPipe } from '../../../validation.pipe';
+import {
+ CreateAccountGroupDto,
+ DeleteAccountGroupDto,
+ UpdateAccountGroupDto,
+} from './dto/accountGroup.dto';
+import { Account } from '../../../db/schema/account.schema';
+
+@ApiTags('账户组')
+@Controller('accountGroup')
+export class AccountGroupController {
+ constructor(private readonly accountGroupService: AccountGroupService) {}
+
+ @ApiOperation({ summary: '创建组' })
+ @Post('create')
+ @ApiResult({ type: AccountGroup })
+ async create(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: CreateAccountGroupDto,
+ ) {
+ return this.accountGroupService.addOrUpdateAccountGroup({
+ userId: token.id,
+ ...body,
+ });
+ }
+
+ @ApiOperation({ summary: '更新组' })
+ @Post('update')
+ @ApiResult({ type: AccountGroup })
+ async update(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: UpdateAccountGroupDto,
+ ) {
+ return this.accountGroupService.addOrUpdateAccountGroup({
+ userId: token.id,
+ ...body,
+ });
+ }
+
+ @ApiOperation({ summary: '删除账户组' })
+ @Post('deletes')
+ @ApiResult({ type: AccountGroup })
+ async deletes(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: DeleteAccountGroupDto,
+ ) {
+ return this.accountGroupService.deleteAccountGroup(body.ids, token.id);
+ }
+
+ @ApiOperation({ summary: '获取用户所有账户组' })
+ @Get('getList')
+ @ApiResult({ type: [Account] })
+ async getUserAccounts(@GetToken() token: TokenInfo) {
+ return this.accountGroupService.getAccountGroup(token.id);
+ }
+}
diff --git a/server/src/modules/account/accountGroup/accountGroup.service.ts b/server/src/modules/account/accountGroup/accountGroup.service.ts
new file mode 100644
index 00000000..4538ab27
--- /dev/null
+++ b/server/src/modules/account/accountGroup/accountGroup.service.ts
@@ -0,0 +1,113 @@
+import { forwardRef, Inject, Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import {
+ AccountGroup,
+ AccountGroupDefaultType,
+} from '../../../db/schema/accountGroup.schema';
+import { AccountService } from '../account.service';
+import { IdService } from '../../../db/id.service';
+
+@Injectable()
+export class AccountGroupService {
+ constructor(
+ @InjectModel(AccountGroup.name)
+ private readonly accountGroupModel: Model<AccountGroup>,
+ @Inject(forwardRef(() => AccountService))
+ private readonly accountService: AccountService,
+ private readonly idService: IdService,
+ ) {}
+
+ private async getId() {
+ return this.idService.createId('accountGroupId', 100000000, 1);
+ }
+
+ /**
+ * 添加或者更新组
+ * @param accountGroup
+ */
+ async addOrUpdateAccountGroup(
+ accountGroup: Partial<AccountGroup>,
+ ): Promise<AccountGroup> {
+ // 更新数据
+ if (accountGroup.id) {
+ return this.accountGroupModel.findOneAndUpdate(
+ { id: accountGroup.id },
+ accountGroup,
+ {
+ new: true,
+ },
+ );
+ }
+
+ accountGroup.id = await this.getId();
+ // 添加数据
+ return this.accountGroupModel.create(accountGroup);
+ }
+
+ /**
+ * 删除多个组
+ * @param ids
+ * @param userId
+ */
+ async deleteAccountGroup(ids: number[], userId: string): Promise<boolean> {
+ const accountGorupList = await this.accountGroupModel
+ .find({ userId, id: { $in: ids } })
+ .exec();
+ // 默认用户组
+ const defaultGroup = await this.getDefaultGroup(userId);
+
+ // 将删除的组下面的账户切换为默认组
+ for (const gorup of accountGorupList) {
+ await this.accountService.switchToDefaultGroup(
+ userId,
+ gorup.id,
+ defaultGroup.id,
+ );
+ }
+
+ // 删除
+ const res = await this.accountGroupModel.deleteMany({
+ id: { $in: ids },
+ userId,
+ });
+ return res.deletedCount > 0;
+ }
+
+ // 获取默认用户组
+ async getDefaultGroup(userId: string) {
+ return this.accountGroupModel
+ .findOne({
+ userId,
+ isDefault: AccountGroupDefaultType.Default,
+ })
+ .exec();
+ }
+
+ // 创建默认用户组
+ async createDefaultGroup(userId: string): Promise<AccountGroup> {
+ return this.addOrUpdateAccountGroup({
+ name: '默认列表',
+ rank: 0,
+ createTime: new Date(),
+ updateTime: new Date(),
+ userId,
+ isDefault: AccountGroupDefaultType.Default,
+ });
+ }
+
+ // 获取所有组
+ async getAccountGroup(userId: string): Promise<AccountGroup[]> {
+ const accountGroupList = await this.accountGroupModel
+ .find({ userId })
+ .exec();
+
+ // 创建默认用户组
+ if (accountGroupList.length === 0) {
+ const accountGroup = await this.createDefaultGroup(userId);
+ return [accountGroup];
+ }
+
+ return accountGroupList;
+ }
+}
diff --git a/server/src/modules/account/accountGroup/dto/accountGroup.dto.ts b/server/src/modules/account/accountGroup/dto/accountGroup.dto.ts
new file mode 100644
index 00000000..72751104
--- /dev/null
+++ b/server/src/modules/account/accountGroup/dto/accountGroup.dto.ts
@@ -0,0 +1,32 @@
+// 创建组 Dto
+import { IsArray, IsNumber, IsOptional, IsString } from 'class-validator';
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+
+export class CreateAccountGroupDto {
+ @ApiProperty({ description: '组名称' })
+ @IsString()
+ @Expose()
+ name: string;
+
+ @ApiProperty({ description: '组排序,默认为 1' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ rank?: number;
+}
+
+export class UpdateAccountGroupDto extends CreateAccountGroupDto {
+ @ApiProperty({ description: '更新ID' })
+ @IsNumber()
+ @Expose()
+ id: number;
+}
+
+export class DeleteAccountGroupDto {
+ @ApiProperty({ description: '要删除的ID' })
+ @IsArray()
+ @IsNumber({}, { each: true })
+ @Expose()
+ ids: number[];
+}
diff --git a/server/src/modules/account/dto/account.dto.ts b/server/src/modules/account/dto/account.dto.ts
new file mode 100644
index 00000000..c2869950
--- /dev/null
+++ b/server/src/modules/account/dto/account.dto.ts
@@ -0,0 +1,219 @@
+import { ApiProperty, PartialType } from '@nestjs/swagger';
+import {
+ IsArray,
+ IsDate,
+ IsEnum,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { Expose } from 'class-transformer';
+import { AccountStatus, AccountType } from '../../../db/schema/account.schema';
+
+export class CreateAccountDto {
+ @ApiProperty({ description: '平台类型', enum: AccountType })
+ @IsEnum(AccountType)
+ @Expose()
+ type: AccountType;
+
+ @ApiProperty({ description: '登录Cookie' })
+ @IsString()
+ @Expose()
+ loginCookie: string;
+
+ @ApiProperty({ description: '登录时间' })
+ @IsOptional()
+ @IsDate()
+ @Expose()
+ loginTime?: Date;
+
+ @ApiProperty({ description: '平台用户ID' })
+ @IsString()
+ @Expose()
+ uid: string;
+
+ @ApiProperty({ description: '账号' })
+ @IsString()
+ @Expose()
+ account: string;
+
+ @ApiProperty({ description: '头像' })
+ @IsString()
+ @Expose()
+ avatar: string;
+
+ @ApiProperty({ description: '昵称' })
+ @IsString()
+ @Expose()
+ nickname: string;
+
+ @ApiProperty({ description: '粉丝数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ fansCount?: number;
+
+ @ApiProperty({ description: '阅读数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ readCount?: number;
+
+ @ApiProperty({ description: '点赞数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ likeCount?: number;
+
+ @ApiProperty({ description: '收藏数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ collectCount?: number;
+
+ @ApiProperty({ description: '转发数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ forwardCount?: number;
+
+ @ApiProperty({ description: '评论数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ commentCount?: number;
+
+ @ApiProperty({ description: '最后统计时间' })
+ @IsDate()
+ @IsOptional()
+ @Expose()
+ lastStatsTime?: Date;
+
+ @ApiProperty({ description: '作品数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ workCount?: number;
+
+ @ApiProperty({ description: '收入' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ income?: number;
+
+ @ApiProperty({ description: '账户组ID' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ groupId?: number;
+}
+
+export class UpdateAccountDto extends PartialType(CreateAccountDto) {
+ @ApiProperty({ description: '更新ID' })
+ @IsNumber()
+ @Expose()
+ id: number;
+}
+
+export class AccountIdDto {
+ @ApiProperty({ description: '账号ID' })
+ @IsNumber()
+ @Expose()
+ id: number;
+}
+
+export class UpdateAccountStatusDto extends AccountIdDto {
+ @ApiProperty({ description: '状态' })
+ @IsEnum(AccountStatus, {
+ message: `status must be one of these values: ${Object.values(
+ AccountStatus,
+ ).join(', ')}`,
+ })
+ @Expose()
+ status: AccountStatus;
+}
+
+export class AccountListByIdsDto {
+ @ApiProperty({ description: '账号ID数组', type: [Number] })
+ @IsArray()
+ @IsNumber({}, { each: true })
+ @Expose()
+ ids: number[];
+}
+
+export class AccountStatisticsDto {
+ @ApiProperty({ description: '账户类型', enum: AccountType, required: false })
+ @IsEnum(AccountType)
+ @IsOptional()
+ @Expose()
+ type?: AccountType;
+}
+
+export class UpdateAccountStatisticsDto {
+ @ApiProperty({ description: '账号ID' })
+ @IsNumber()
+ @Expose()
+ id: number;
+
+ @ApiProperty({ description: '作品数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ workCount?: number;
+
+ @ApiProperty({ description: '粉丝数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ fansCount?: number;
+
+ @ApiProperty({ description: '阅读数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ readCount?: number;
+
+ @ApiProperty({ description: '点赞数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ likeCount?: number;
+
+ @ApiProperty({ description: '收藏数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ collectCount?: number;
+
+ @ApiProperty({ description: '评论数' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ commentCount?: number;
+
+ @ApiProperty({ description: '收入' })
+ @IsNumber()
+ @IsOptional()
+ @Expose()
+ income?: number;
+}
+
+export class GoogleLoginDto {
+ @ApiProperty({ description: 'Google客户端ID' })
+ @IsString()
+ @Expose()
+ clientId: string;
+
+ @ApiProperty({ description: 'Google认证凭证' })
+ @IsString()
+ @Expose()
+ credential: string;
+}
+
+export class DeleteAccountsDto {
+ @ApiProperty({ description: '要删除的ID' })
+ @IsArray()
+ @IsNumber({}, { each: true })
+ @Expose()
+ ids: string[];
+}
diff --git a/server/src/modules/finance/adminFinance.controller.ts b/server/src/modules/finance/adminFinance.controller.ts
new file mode 100644
index 00000000..f6619205
--- /dev/null
+++ b/server/src/modules/finance/adminFinance.controller.ts
@@ -0,0 +1,62 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-03-02 23:45:48
+ * @LastEditors: nevin
+ * @Description: 管理员-财务
+ */
+import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
+import { FinanceService } from './finance.service';
+import {
+ GetUserWalletRecordListByAdminDto,
+ UpUserWalletRecordPul,
+} from './dto/userWalletRecord.dto';
+import { ObjectId } from 'mongodb';
+import { UserService } from 'src/user/user.service';
+
+@Controller('adminFinance')
+export class AdminFinanceController {
+ constructor(
+ private readonly financeService: FinanceService,
+ private readonly userService: UserService,
+ ) {}
+
+ // 获取用户账户信息
+ @Get('userWallet/info/:userId')
+ async getUserWalletInfoByUserId(@Param() param: { userId: string }) {
+ const user = await this.userService.getUserInfoById(param.userId);
+ if (!user) return null;
+
+ return this.financeService.getUserWalletByUserId(
+ new ObjectId(param.userId),
+ );
+ }
+
+ // --------- userWalletRecord STR ---------
+ // 获取用户账户记录列表
+ @Get('userWalletRecord/list')
+ async getUserWalletRecordList(
+ @Query() query: GetUserWalletRecordListByAdminDto,
+ ) {
+ return this.financeService.getWalletRecordList(query);
+ }
+
+ // 提交记录发放
+ @Post('userWalletRecord/submit/:id')
+ async submitUserWalletRecord(
+ @Param('id') id: string,
+ @Body() body: UpUserWalletRecordPul,
+ ) {
+ return this.financeService.submitUserWalletRecord(id, body);
+ }
+
+ // 打款拒绝
+ @Post('userWalletRecord/reject/:id')
+ async rejectUserWalletRecord(
+ @Param('id') id: string,
+ @Body() body: UpUserWalletRecordPul,
+ ) {
+ return this.financeService.rejectUserWalletRecord(id, body);
+ }
+ // --------- userWalletRecord END ---------
+}
diff --git a/server/src/modules/finance/dto/userWalletAccount.dto.ts b/server/src/modules/finance/dto/userWalletAccount.dto.ts
new file mode 100644
index 00000000..df9c2c7a
--- /dev/null
+++ b/server/src/modules/finance/dto/userWalletAccount.dto.ts
@@ -0,0 +1,46 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 12:11:19
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator';
+import {
+ UserWalletAccount,
+ WalletAccountType,
+} from 'src/db/schema/userWalletAccount.shema';
+
+export class CreateUserWalletAccountDto implements Partial<UserWalletAccount> {
+ @ApiProperty({ type: String })
+ @IsString({ message: '账号号码必须是字符串' })
+ @IsOptional()
+ @Expose()
+ account?: string;
+
+ @ApiProperty({ type: String })
+ @IsNotEmpty({ message: '姓名不能为空' })
+ @IsString()
+ @Expose()
+ userName: string;
+
+ @ApiProperty({ type: String })
+ @IsNotEmpty({ message: '身份证不能为空' })
+ @IsString()
+ @Expose()
+ cardNum: string;
+
+ @ApiProperty({ type: String })
+ @IsNotEmpty({ message: '手机号不能为空' })
+ @IsString()
+ @Expose()
+ phone: string;
+
+ @ApiProperty({ enum: WalletAccountType })
+ @IsNotEmpty({ message: '钱包类型不能为空' })
+ @IsEnum(WalletAccountType)
+ @Expose()
+ type: WalletAccountType;
+}
diff --git a/server/src/modules/finance/dto/userWalletRecord.dto.ts b/server/src/modules/finance/dto/userWalletRecord.dto.ts
new file mode 100644
index 00000000..b22e9a55
--- /dev/null
+++ b/server/src/modules/finance/dto/userWalletRecord.dto.ts
@@ -0,0 +1,99 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-03-24 21:52:23
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import {
+ ArrayMaxSize,
+ ArrayMinSize,
+ IsArray,
+ IsDateString,
+ IsEnum,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { PagerDto } from 'src/common/dto/pager.dto';
+import {
+ UserWalletRecordStatus,
+ UserWalletRecordType,
+} from 'src/db/schema/userWalletRecord.shema';
+
+export class GetUserWalletRecordListDto extends PagerDto {
+ @ApiProperty({ title: '创建时间区间', required: false })
+ @IsArray({ message: '创建时间区间必须是一个数组' })
+ @ArrayMinSize(2, { message: '创建时间区间必须包含两个日期' })
+ @ArrayMaxSize(2, { message: '创建时间区间必须包含两个日期' })
+ // @IsDate({ each: true, message: '创建时间区间中的每个元素必须是有效的日期' })
+ @IsDateString({}, { each: true })
+ @IsOptional()
+ @Expose()
+ readonly time?: [Date, Date];
+
+ @ApiProperty({ enum: UserWalletRecordType })
+ @IsEnum(UserWalletRecordType)
+ @IsOptional()
+ @Expose()
+ type?: UserWalletRecordType;
+}
+
+export class GetUserWalletRecordListByAdminDto extends PagerDto {
+ // 起始时间
+ @ApiProperty({ type: [String] })
+ @Expose()
+ time?: [string, string];
+
+ @ApiProperty({ enum: UserWalletRecordType })
+ @Expose()
+ type?: UserWalletRecordType;
+
+ @ApiProperty({ enum: UserWalletRecordStatus })
+ @Expose()
+ status?: UserWalletRecordStatus;
+
+ @ApiProperty({ type: String })
+ @Expose()
+ userId?: string;
+}
+
+export class UpUserWalletRecordPul {
+ @IsString({
+ message: '说明',
+ })
+ @IsOptional()
+ @Expose()
+ des?: string;
+
+ @IsString({
+ message: '反馈截图',
+ })
+ @IsOptional()
+ @Expose()
+ imgUrl?: string; // 反馈截图
+}
+
+export class CreateUserWalletRecordDto {
+ @ApiProperty({ type: String, description: '钱包账户id', required: true })
+ @IsString({
+ message: '钱包账户id必须为字符串',
+ })
+ @Expose()
+ walletAccountId: string;
+
+ @ApiProperty({ type: Number, description: '金额', required: true })
+ @IsNumber(
+ {
+ allowNaN: false,
+ },
+ { message: '金额必须为数字' },
+ )
+ @Expose()
+ balance: number;
+
+ @ApiProperty({ enum: UserWalletRecordStatus })
+ status?: UserWalletRecordStatus;
+}
diff --git a/server/src/modules/finance/finance.controller.ts b/server/src/modules/finance/finance.controller.ts
new file mode 100644
index 00000000..d2ff0ffd
--- /dev/null
+++ b/server/src/modules/finance/finance.controller.ts
@@ -0,0 +1,157 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 14:07:03
+ * @LastEditors: nevin
+ * @Description: 财务
+ */
+import {
+ Body,
+ Controller,
+ Delete,
+ Get,
+ Param,
+ Post,
+ Query,
+} from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { ApiResult } from '../../common/decorators/api-result.decorator';
+import { FinanceService } from './finance.service';
+import { GetToken, Public } from '../../auth/auth.guard';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { CreateUserWalletAccountDto } from './dto/userWalletAccount.dto';
+import { UserWalletAccount } from 'src/db/schema/userWalletAccount.shema';
+import {
+ CreateUserWalletRecordDto,
+ GetUserWalletRecordListDto,
+} from './dto/userWalletRecord.dto';
+import {
+ UserWalletRecordStatus,
+ UserWalletRecordType,
+} from 'src/db/schema/userWalletRecord.shema';
+import { UserWallet } from 'src/db/schema/userWallet.shema';
+import { ObjectId } from 'mongodb';
+import { AppHttpException } from 'src/filters/http-exception.filter';
+import { ErrHttpBack } from 'src/filters/http-exception.back-code';
+import { RealAuthService } from '../tools/realAuth.service';
+import { SceneType } from 'src/db/schema/realAuth.schema';
+
+@ApiTags('finance - 财务')
+@Controller('finance')
+export class FinanceController {
+ constructor(
+ private readonly financeService: FinanceService,
+ private readonly realAuthService: RealAuthService,
+ ) {}
+
+ // --------- userWalletAccount STR ---------
+ @ApiOperation({ summary: '发送创建账户的短信码' })
+ @ApiResult({ type: String })
+ @Public()
+ @Post('userWalletAccount/phoneCode/:phone')
+ async postCreateUserWalletAccountCode(@Param('phone') phone: string) {
+ return await this.financeService.postCreateUserWalletAccountCode(phone);
+ }
+
+ @ApiOperation({ summary: '创建用户钱包账户' })
+ @Post('userWalletAccount')
+ @ApiResult({ type: UserWalletAccount })
+ async createUserWalletAccount(
+ @GetToken() token: TokenInfo,
+ @Body() body: CreateUserWalletAccountDto,
+ ) {
+ // 验证身份证
+ const res = await this.realAuthService.realNameAuth(
+ token.id,
+ body.cardNum,
+ body.userName,
+ SceneType.UserWallet,
+ );
+ if (!res)
+ throw new AppHttpException(ErrHttpBack.err_approve_idcard_invalid);
+
+ return await this.financeService.createUserWalletAccount(token.id, body);
+ }
+
+ @ApiOperation({ summary: '获取用户钱包账户列表' })
+ @Get('userWalletAccount/list')
+ @ApiResult({ type: [UserWalletAccount] })
+ async getUserWalletAccountList(@GetToken() token: TokenInfo) {
+ return this.financeService.getUserWalletAccountList(token.id);
+ }
+
+ @ApiOperation({ summary: '删除用户钱包账户' })
+ @Delete('userWalletAccount/delete/:id')
+ @ApiResult({ type: String })
+ async deleteUserWalletAccount(
+ @GetToken() token: TokenInfo,
+ @Param('id') id: string,
+ ) {
+ return await this.financeService.deleteUserWalletAccount(token.id, id);
+ }
+ // --------- userWalletAccount END ---------
+
+ // --------- userWalletRecord STR ---------
+ @ApiOperation({ summary: '创建用户提现记录-提交提现' })
+ @Post('userWalletRecord')
+ @ApiResult({ type: UserWalletAccount })
+ async addUserWalletRecord(
+ @GetToken() token: TokenInfo,
+ @Body() body: CreateUserWalletRecordDto,
+ ) {
+ const { walletAccountId, balance } = body;
+
+ const walletAccount =
+ await this.financeService.getUserWalletAccountById(walletAccountId);
+
+ if (!walletAccount)
+ throw new AppHttpException(ErrHttpBack.wallet_account_no_had);
+
+ // 获取余额
+ const userWallet = await this.financeService.getUserWalletByUserId(
+ new ObjectId(token.id),
+ );
+
+ // 获取待提现金额
+ const waitCount = await this.financeService.getDoingWalletRecordCount(
+ token.id,
+ );
+
+ // 计算可用余额
+ const availableBalance =
+ parseFloat(userWallet.balance.toString()) - waitCount;
+
+ if (!userWallet || availableBalance < balance)
+ throw new AppHttpException(ErrHttpBack.wallet_balance_no_enough);
+
+ const res = await this.financeService.createUserWalletRecord(
+ token.id,
+ walletAccount,
+ {
+ type: UserWalletRecordType.WITHDRAW,
+ balance,
+ status: UserWalletRecordStatus.WAIT,
+ },
+ );
+
+ return res;
+ }
+
+ @ApiOperation({ summary: '获取用户账户记录列表' })
+ @Get('userWalletRecord/list')
+ @ApiResult({ type: [UserWalletAccount] })
+ async getUserWalletRecordList(
+ @GetToken() token: TokenInfo,
+ @Query() query: GetUserWalletRecordListDto,
+ ) {
+ return this.financeService.getUserWalletRecordList(token.id, query);
+ }
+
+ @ApiOperation({ summary: '获取用户钱包信息' })
+ @Get('userWallet/info')
+ @ApiResult({ type: UserWallet })
+ async getUserWalletInfo(@GetToken() token: TokenInfo) {
+ return this.financeService.getUserWalletByUserId(new ObjectId(token.id));
+ }
+ // --------- userWalletRecord END ---------
+}
diff --git a/server/src/modules/finance/finance.module.ts b/server/src/modules/finance/finance.module.ts
new file mode 100644
index 00000000..41cd87bd
--- /dev/null
+++ b/server/src/modules/finance/finance.module.ts
@@ -0,0 +1,35 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-03-25 09:43:22
+ * @LastEditors: nevin
+ * @Description: 用户财产模块
+ */
+import { Module } from '@nestjs/common';
+import { MongooseModule } from '@nestjs/mongoose';
+import { FinanceService } from './finance.service';
+import { FinanceController } from './finance.controller';
+import {
+ UserWalletAccount,
+ UserWalletAccountSchema,
+} from 'src/db/schema/userWalletAccount.shema';
+import {
+ UserWalletRecord,
+ UserWalletRecordSchema,
+} from 'src/db/schema/userWalletRecord.shema';
+import { AdminFinanceController } from './adminFinance.controller';
+import { UserWallet, UserWalletSchema } from 'src/db/schema/userWallet.shema';
+
+@Module({
+ imports: [
+ MongooseModule.forFeature([
+ { name: UserWalletAccount.name, schema: UserWalletAccountSchema },
+ { name: UserWalletRecord.name, schema: UserWalletRecordSchema },
+ { name: UserWallet.name, schema: UserWalletSchema },
+ ]),
+ ],
+ controllers: [FinanceController, AdminFinanceController],
+ providers: [FinanceService],
+ exports: [FinanceService],
+})
+export class FinanceModule {}
diff --git a/server/src/modules/finance/finance.service.ts b/server/src/modules/finance/finance.service.ts
new file mode 100644
index 00000000..eb3f216f
--- /dev/null
+++ b/server/src/modules/finance/finance.service.ts
@@ -0,0 +1,290 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 14:05:49
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery } from 'mongoose';
+import { paginateModel } from 'src/common/paginate/create-pagination';
+import { UserWalletAccount } from 'src/db/schema/userWalletAccount.shema';
+import {
+ UserWalletRecord,
+ UserWalletRecordStatus,
+ UserWalletRecordType,
+} from 'src/db/schema/userWalletRecord.shema';
+import { ErrHttpBack } from 'src/filters/http-exception.back-code';
+import { AppHttpException } from 'src/filters/http-exception.filter';
+import { RedisService } from 'src/lib/redis/redis.service';
+import { AlicloudSmsService } from 'src/lib/sms/alicloud-sms.service';
+import { getRandomString } from 'src/util';
+import {
+ GetUserWalletRecordListByAdminDto,
+ GetUserWalletRecordListDto,
+} from './dto/userWalletRecord.dto';
+import { UserWallet } from 'src/db/schema/userWallet.shema';
+import { ObjectId } from 'mongodb';
+@Injectable()
+export class FinanceService {
+ constructor(
+ private readonly redisService: RedisService,
+ private readonly alicloudSmsService: AlicloudSmsService,
+ @InjectModel(UserWallet.name)
+ private readonly userWalletModel: Model<UserWallet>,
+ @InjectModel(UserWalletAccount.name)
+ private readonly userWalletAccountModel: Model<UserWalletAccount>,
+ @InjectModel(UserWalletRecord.name)
+ private readonly userWalletRecordModel: Model<UserWalletRecord>,
+ ) {}
+
+ // ------- 用户的钱包账户 START ---------
+ /**
+ * 获取用户钱包账户
+ * @param userId
+ * @returns
+ */
+ async getUserWalletByUserId(userId: ObjectId): Promise<UserWallet> {
+ const account = await this.userWalletModel.findOne({ userId });
+ if (account) return account;
+
+ return await this.userWalletModel.create({
+ userId,
+ });
+ }
+
+ /**
+ * 更新用户钱包账户的余额
+ * @param userWallet
+ * @param balance
+ * @returns
+ */
+ async updateUserWalletBalance(
+ userId: ObjectId,
+ balance: number,
+ ): Promise<boolean> {
+ const userWallet = await this.getUserWalletByUserId(userId);
+ const res = await this.userWalletModel.updateOne(
+ { userId: userWallet.userId },
+ {
+ $inc: {
+ balance,
+ },
+ },
+ );
+
+ return res.modifiedCount > 0;
+ }
+
+ // ------- 用户的钱包账户 END ---------
+
+ // --------- userWalletAccount STR ---------
+ /**
+ * 发送手机号验证码-创建用户钱包账户
+ * @param phone
+ */
+ async postCreateUserWalletAccountCode(phone: string) {
+ const cacheKey = `CreateUserWalletAccount:${phone}`;
+ let code = await this.redisService.get(cacheKey);
+ if (code) throw new AppHttpException(ErrHttpBack.err_user_code_had);
+
+ code = getRandomString(6, true);
+ const res = await this.alicloudSmsService.sendLoginSms(phone, code);
+
+ if (process.env.NODE_ENV === 'production') {
+ if (!res) throw new AppHttpException(ErrHttpBack.err_user_code_send_fail);
+ }
+
+ this.redisService.setKey(cacheKey, code, 60 * 5);
+ return process.env.NODE_ENV === 'production' ? res : code;
+ }
+
+ /**
+ * 创建用户钱包账户
+ * @param user
+ * @param data
+ * @returns
+ */
+ async createUserWalletAccount(
+ userId: string,
+ data: Partial<UserWalletAccount>,
+ ) {
+ return await this.userWalletAccountModel.create({
+ ...data,
+ isDef: false,
+ userId,
+ });
+ }
+
+ // 根据ID获取用户钱包账户
+ async getUserWalletAccountById(id: string) {
+ return await this.userWalletAccountModel.findOne({ _id: id });
+ }
+ // 获取用户钱包账户列表
+ async getUserWalletAccountList(userId: string) {
+ return await this.userWalletAccountModel.find({ userId });
+ }
+
+ // 删除用户钱包账户
+ async deleteUserWalletAccount(userId: string, id: string): Promise<boolean> {
+ const res = await this.userWalletAccountModel.deleteOne({
+ userId,
+ _id: id,
+ });
+ return res.deletedCount > 0;
+ }
+ // --------- userWalletAccount END ---------
+
+ // --------- userWalletRecord STR ---------
+ // 创建用户钱包记录
+ async createUserWalletRecord(
+ userId: string,
+ account: UserWalletAccount,
+ data: {
+ dataId?: string; // 关联数据的ID
+ type: UserWalletRecordType;
+ balance: number;
+ status: UserWalletRecordStatus;
+ des?: string;
+ },
+ ) {
+ return await this.userWalletRecordModel.create({
+ ...data,
+ userId,
+ account: account.id,
+ });
+ }
+
+ // 分页获取记录列表
+ async getUserWalletRecordList(
+ userId: string,
+ query: GetUserWalletRecordListDto,
+ ) {
+ const { page, pageSize, type, time } = query;
+ const filter: RootFilterQuery<UserWalletRecord> = {
+ userId,
+ ...(type && { type }),
+ ...(time && {
+ createTime: {
+ $gte: new Date(time[0]),
+ $lte: new Date(time[1]),
+ },
+ }),
+ };
+
+ return paginateModel(
+ this.userWalletRecordModel,
+ { page, pageSize },
+ filter,
+ 'account',
+ { _id: -1 },
+ );
+ }
+
+ /**
+ * 获取列表
+ * @param query
+ * @returns
+ */
+ async getWalletRecordList(query: GetUserWalletRecordListByAdminDto) {
+ const { page, pageSize, type, userId, status, time } = query;
+ const filter: RootFilterQuery<UserWalletRecord> = {
+ ...(type && { type }),
+ ...(userId && { userId }),
+ ...(status !== undefined && { status }),
+ ...(time && {
+ payTime: {
+ $gte: new Date(time[0]),
+ $lte: new Date(time[1]),
+ },
+ }),
+ };
+
+ return paginateModel(
+ this.userWalletRecordModel,
+ { page, pageSize },
+ filter,
+ 'account',
+ { _id: -1 },
+ );
+ }
+
+ /**
+ * 提交发布奖励
+ * @param id
+ * @param data
+ * @returns
+ */
+ async submitUserWalletRecord(
+ id: string,
+ data: {
+ imgUrl?: string; // 反馈截图
+ des?: string;
+ },
+ ): Promise<boolean> {
+ const { balance, userId } = await this.userWalletRecordModel.findOne({
+ _id: id,
+ });
+
+ const res = await this.userWalletRecordModel.updateOne(
+ { _id: id },
+ {
+ ...data,
+ status: UserWalletRecordStatus.SUCCESS,
+ payTime: new Date(),
+ },
+ );
+
+ // 减少余额
+ this.updateUserWalletBalance(new ObjectId(userId), -balance);
+
+ return res.modifiedCount > 0;
+ }
+
+ /**
+ * 拒绝发布奖励
+ * @param id
+ * @param data
+ * @returns
+ */
+ async rejectUserWalletRecord(
+ id: string,
+ data: {
+ imgUrl?: string; // 反馈截图
+ des?: string;
+ },
+ ): Promise<boolean> {
+ const res = await this.userWalletRecordModel.updateOne(
+ { _id: id },
+ {
+ ...data,
+ status: UserWalletRecordStatus.FAIL,
+ },
+ );
+
+ return res.modifiedCount > 0;
+ }
+
+ // --------- userWalletRecord END ---------
+
+ // 获取提现中的钱数总和
+ async getDoingWalletRecordCount(userId: string) {
+ const result = await this.userWalletRecordModel.aggregate([
+ {
+ $match: {
+ userId,
+ status: UserWalletRecordStatus.WAIT,
+ },
+ },
+ {
+ $group: {
+ _id: null,
+ totalBalance: { $sum: '$balance' },
+ },
+ },
+ ]);
+
+ return result.length > 0 ? result[0].totalBalance : 0;
+ }
+}
diff --git a/server/src/modules/operate/adminBanner.controller.ts b/server/src/modules/operate/adminBanner.controller.ts
new file mode 100644
index 00000000..84a73550
--- /dev/null
+++ b/server/src/modules/operate/adminBanner.controller.ts
@@ -0,0 +1,130 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-03-03 18:45:45
+ * @LastEditors: nevin
+ * @Description: banner Banner
+ */
+import {
+ Body,
+ Controller,
+ Delete,
+ Get,
+ Param,
+ Post,
+ Put,
+ Query,
+} from '@nestjs/common';
+import { ApiOperation } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { BannerService } from './banner.service';
+import { AppHttpException } from 'src/filters/http-exception.filter';
+import { ErrHttpBack } from 'src/filters/http-exception.back-code';
+import { TableDto } from 'src/global/dto/table.dto';
+import {
+ ActionBannerDto,
+ BannerIdDto,
+ GetBannerListDto,
+} from './dto/banner.dto';
+import { ONOFF } from 'src/global/enum/all.enum';
+import { Banner } from 'src/db/schema/banner.schema';
+import { Manager } from 'src/auth/manager.guard';
+
+@Manager()
+@Controller('admin/banner')
+export class AdminBannerController {
+ constructor(private readonly bannerService: BannerService) {}
+
+ @ApiOperation({
+ description: '创建',
+ summary: '创建',
+ })
+ @Post()
+ async create(@Body(new ParamsValidationPipe()) body: ActionBannerDto) {
+ const newData = new Banner();
+ newData.dataId = body.dataId;
+ newData.desc = body.desc;
+ newData.url = body.url;
+ newData.imgUrl = body.imgUrl;
+ newData.tag = body.tag;
+ newData.isPublish = ONOFF.ON;
+
+ const res = await this.bannerService.create(newData);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取信息',
+ summary: '获取信息',
+ })
+ @Get('info/:id')
+ async getBannerInfoById(
+ @Param(new ParamsValidationPipe()) param: BannerIdDto,
+ ) {
+ const res = await this.bannerService.getBannerInfo(param.id);
+ return res;
+ }
+
+ // 获取列表
+ @Get('list/:pageNo/:pageSize')
+ getMineBannerList(
+ @Param(new ParamsValidationPipe()) param: TableDto,
+ @Query(new ParamsValidationPipe()) query: GetBannerListDto,
+ ) {
+ return this.bannerService.getBannerList(param, query);
+ }
+
+ @ApiOperation({
+ description: '更新',
+ summary: '更新',
+ })
+ @Put('info/:id')
+ async update(
+ @Param(new ParamsValidationPipe()) param: BannerIdDto,
+ @Body(new ParamsValidationPipe()) body: ActionBannerDto,
+ ) {
+ const oldData = await this.bannerService.getBannerInfo(param.id);
+ if (!oldData) throw new AppHttpException(ErrHttpBack.fail);
+
+ oldData.dataId = body.dataId;
+ oldData.desc = body.desc;
+ oldData.url = body.url;
+ oldData.imgUrl = body.imgUrl;
+ oldData.tag = body.tag;
+
+ const res = await this.bannerService.updateBannerInfo(param.id, oldData);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '更新发布状态',
+ summary: '更新发布状态',
+ })
+ @Put('publish/:id')
+ async updateBannerPublishStatus(
+ @Param(new ParamsValidationPipe()) param: BannerIdDto,
+ @Body(new ParamsValidationPipe()) body: any,
+ ) {
+ const bannerInfo = await this.bannerService.getBannerInfo(param.id);
+ if (!bannerInfo) throw new AppHttpException(ErrHttpBack.fail);
+
+ const res = await this.bannerService.updateBannerPublish(
+ param.id,
+ body.checkStatus,
+ );
+ return res;
+ }
+
+ @ApiOperation({
+ description: '删除',
+ summary: '删除',
+ })
+ @Delete(':id')
+ async delete(@Param(new ParamsValidationPipe()) param: BannerIdDto) {
+ const bannerInfo = await this.bannerService.getBannerInfo(param.id);
+ if (!bannerInfo) throw new AppHttpException(ErrHttpBack.fail);
+
+ const res = await this.bannerService.deleteBanner(param.id);
+ return res;
+ }
+}
diff --git a/server/src/modules/operate/adminGzh.controller.ts b/server/src/modules/operate/adminGzh.controller.ts
new file mode 100644
index 00000000..0429b84f
--- /dev/null
+++ b/server/src/modules/operate/adminGzh.controller.ts
@@ -0,0 +1,40 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-04-14 17:11:23
+ * @LastEditors: nevin
+ * @Description: adminGzh AdminGzh
+ */
+import { Body, Controller, Get, Post } from '@nestjs/common';
+import { ApiOperation } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { Manager } from 'src/auth/manager.guard';
+import { CreateGzhMenuDto } from './dto/gzh.dto';
+import { PlatAuthWxGzhService } from 'src/lib/platAuth/wxGzh.service';
+
+@Manager()
+@Controller('admin/gzh')
+export class AdminGzhController {
+ constructor(private readonly platAuthWxGzhService: PlatAuthWxGzhService) {}
+
+ @ApiOperation({
+ description: 'body是JSON对象',
+ summary: '创建菜单',
+ })
+ @Post('menu')
+ async createMenu(@Body(new ParamsValidationPipe()) body: CreateGzhMenuDto) {
+ const menuData = JSON.parse(body.menuStr);
+ const res = await this.platAuthWxGzhService.createWxGzhMenu(menuData);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取菜单',
+ summary: '获取菜单',
+ })
+ @Get('menu')
+ async getMenu() {
+ const res = await this.platAuthWxGzhService.getMenu();
+ return res;
+ }
+}
diff --git a/server/src/modules/operate/banner.controller.ts b/server/src/modules/operate/banner.controller.ts
new file mode 100644
index 00000000..3d5eae50
--- /dev/null
+++ b/server/src/modules/operate/banner.controller.ts
@@ -0,0 +1,39 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-03-03 18:45:45
+ * @LastEditors: nevin
+ * @Description: banner Banner
+ */
+import { Controller, Get, Param, Query } from '@nestjs/common';
+import { ApiOperation } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { BannerService } from './banner.service';
+import { AppGetBannerListDto, BannerIdDto } from './dto/banner.dto';
+
+@Controller('banner')
+export class BannerController {
+ constructor(private readonly bannerService: BannerService) {}
+ @ApiOperation({
+ description: '获取信息',
+ summary: '获取信息',
+ })
+ @Get('info/:id')
+ async getBannerInfoById(
+ @Param(new ParamsValidationPipe()) param: BannerIdDto,
+ ) {
+ const res = await this.bannerService.getBannerInfo(param.id);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取列表',
+ summary: '获取列表',
+ })
+ @Get('list')
+ getMineBannerList(
+ @Query(new ParamsValidationPipe()) query: AppGetBannerListDto,
+ ) {
+ return this.bannerService.getBannerAll(query.tag);
+ }
+}
diff --git a/server/src/modules/operate/banner.service.ts b/server/src/modules/operate/banner.service.ts
new file mode 100644
index 00000000..eb5bebac
--- /dev/null
+++ b/server/src/modules/operate/banner.service.ts
@@ -0,0 +1,101 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2025-03-03 18:41:40
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery } from 'mongoose';
+import { Banner } from 'src/db/schema/banner.schema';
+import { ResponseUtil } from 'src/global/class/correctResponse.class';
+import { TableUtil } from 'src/global/class/tableUtli.class';
+import { TableDto } from 'src/global/dto/table.dto';
+import { ONOFF } from 'src/global/enum/all.enum';
+
+@Injectable()
+export class BannerService {
+ constructor(
+ @InjectModel(Banner.name)
+ private readonly bannerModel: Model<Banner>,
+ ) {}
+
+ // 创建
+ async create(data: Banner) {
+ return await this.bannerModel.create(data);
+ }
+
+ // 获取
+ async getBannerInfo(id: string): Promise<Banner> {
+ const res = await this.bannerModel.findOne({ _id: id });
+ return res;
+ }
+
+ /**
+ * 获取列表
+ * @param pageInfo
+ * @param query
+ * @returns
+ */
+ async getBannerList(pageInfo: TableDto, query: any) {
+ const { skip, take } = TableUtil.GetSqlPaging(pageInfo);
+ const filter: RootFilterQuery<Banner> = {
+ ...(query.createTimeArray && {
+ createTime: {
+ $gte: query.createTimeArray[0],
+ $lte: query.createTimeArray[1],
+ },
+ }),
+ };
+ const tatal = await this.bannerModel.countDocuments(filter);
+ const data = await this.bannerModel
+ .find(filter)
+ .sort({ createTime: -1 })
+ .skip(skip)
+ .limit(take);
+
+ return ResponseUtil.GetCorrectResponse(
+ pageInfo.pageNo,
+ pageInfo.pageSize,
+ tatal,
+ data,
+ );
+ }
+
+ /**
+ * 获取全部
+ * @param tag
+ * @returns
+ */
+ async getBannerAll(tag?: string) {
+ const filter: RootFilterQuery<Banner> = {
+ ...(tag && {
+ tag,
+ }),
+ };
+ const data = await this.bannerModel.find(filter).sort({ createTime: -1 });
+ return data;
+ }
+
+ // 更新信息
+ async updateBannerInfo(id: string, data: Banner): Promise<boolean> {
+ const res = await this.bannerModel.updateOne({ _id: id }, data);
+ return res.modifiedCount > 0;
+ }
+
+ // 更新发布状态
+ async updateBannerPublish(id: string, isPublish: ONOFF): Promise<boolean> {
+ const res = await this.bannerModel.updateOne(
+ { _id: id },
+ { $set: { isPublish } },
+ );
+ return res.modifiedCount > 0;
+ }
+
+ // 删除
+ async deleteBanner(id: string): Promise<boolean> {
+ const res = await this.bannerModel.deleteOne({ _id: id });
+ return res.deletedCount > 0;
+ }
+}
diff --git a/server/src/modules/operate/cfg.controller.ts b/server/src/modules/operate/cfg.controller.ts
new file mode 100644
index 00000000..c34ca555
--- /dev/null
+++ b/server/src/modules/operate/cfg.controller.ts
@@ -0,0 +1,27 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-03-03 18:45:45
+ * @LastEditors: nevin
+ * @Description: Cfg cfg
+ */
+import { Controller, Get, Param } from '@nestjs/common';
+import { ApiOperation } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { CfgService } from './cfg.service';
+import { CfgKeyDto } from './dto/cfg.dto';
+
+@Controller('cfg')
+export class CfgController {
+ constructor(private readonly bannerService: CfgService) {}
+
+ @ApiOperation({
+ description: '获取信息',
+ summary: '获取信息',
+ })
+ @Get('info/:key')
+ async getInfoByKey(@Param(new ParamsValidationPipe()) param: CfgKeyDto) {
+ const res = await this.bannerService.getInfoByKey(param.key);
+ return res;
+ }
+}
diff --git a/server/src/modules/operate/cfg.service.ts b/server/src/modules/operate/cfg.service.ts
new file mode 100644
index 00000000..374694d5
--- /dev/null
+++ b/server/src/modules/operate/cfg.service.ts
@@ -0,0 +1,94 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2025-03-03 18:41:40
+ * @LastEditors: nevin
+ * @Description: Cfg cfg
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery } from 'mongoose';
+import { Cfg } from 'src/db/schema/cfg.schema';
+import { ResponseUtil } from 'src/global/class/correctResponse.class';
+import { TableUtil } from 'src/global/class/tableUtli.class';
+import { TableDto } from 'src/global/dto/table.dto';
+import { ONOFF } from 'src/global/enum/all.enum';
+
+@Injectable()
+export class CfgService {
+ constructor(
+ @InjectModel(Cfg.name)
+ private readonly cfgModel: Model<Cfg>,
+ ) {}
+
+ // 创建或者更新
+ async create(data: Partial<Cfg>) {
+ const { key, ...restData } = data;
+ const options = {
+ upsert: true,
+ new: true,
+ setDefaultsOnInsert: true,
+ };
+ return await this.cfgModel.findOneAndUpdate(
+ { key },
+ { $set: restData },
+ options,
+ );
+ }
+
+ // 获取
+ async getInfoById(id: string): Promise<Cfg> {
+ const res = await this.cfgModel.findOne({ _id: id });
+ return res;
+ }
+
+ // 获取
+ async getInfoByKey(key: string): Promise<Cfg> {
+ const res = await this.cfgModel.findOne({ key });
+ return res;
+ }
+
+ /**
+ * 获取列表
+ * @param pageInfo
+ * @returns
+ */
+ async getCfgList(pageInfo: TableDto) {
+ const { skip, take } = TableUtil.GetSqlPaging(pageInfo);
+ const filter: RootFilterQuery<Cfg> = {};
+ const tatal = await this.cfgModel.countDocuments(filter);
+ const data = await this.cfgModel
+ .find(filter)
+ .sort({ createTime: -1 })
+ .skip(skip)
+ .limit(take);
+
+ return ResponseUtil.GetCorrectResponse(
+ pageInfo.pageNo,
+ pageInfo.pageSize,
+ tatal,
+ data,
+ );
+ }
+
+ // 更新信息
+ async updateValue(id: string, data: any): Promise<boolean> {
+ const res = await this.cfgModel.updateOne({ _id: id }, data);
+ return res.modifiedCount > 0;
+ }
+
+ // 更新状态
+ async updateStatus(id: string, status: ONOFF): Promise<boolean> {
+ const res = await this.cfgModel.updateOne(
+ { _id: id },
+ { $set: { status } },
+ );
+ return res.modifiedCount > 0;
+ }
+
+ // 删除
+ async del(key: string): Promise<boolean> {
+ const res = await this.cfgModel.deleteMany({ key });
+ return res.deletedCount > 0;
+ }
+}
diff --git a/server/src/modules/operate/cfgAdmin.controller.ts b/server/src/modules/operate/cfgAdmin.controller.ts
new file mode 100644
index 00000000..777cbd5c
--- /dev/null
+++ b/server/src/modules/operate/cfgAdmin.controller.ts
@@ -0,0 +1,59 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-03-03 18:45:45
+ * @LastEditors: nevin
+ * @Description: Cfg cfg
+ */
+import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
+import { ApiOperation } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { CfgService } from './cfg.service';
+import { TableDto } from 'src/global/dto/table.dto';
+import { CfgIdDto, CfgKeyDto, CreateCfgDto } from './dto/cfg.dto';
+import { Manager } from 'src/auth/manager.guard';
+
+@Manager()
+@Controller('admin/cfg')
+export class AdminCfgController {
+ constructor(private readonly cfgService: CfgService) {}
+
+ @ApiOperation({
+ description: '创建',
+ summary: '创建',
+ })
+ @Post()
+ async create(@Body(new ParamsValidationPipe()) body: CreateCfgDto) {
+ const res = await this.cfgService.create(body);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取信息',
+ summary: '获取信息',
+ })
+ @Get('info/:id')
+ async getInfoById(@Param(new ParamsValidationPipe()) param: CfgIdDto) {
+ const res = await this.cfgService.getInfoById(param.id);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取列表',
+ summary: '获取列表',
+ })
+ @Get('list/:pageNo/:pageSize')
+ getList(@Param(new ParamsValidationPipe()) param: TableDto) {
+ return this.cfgService.getCfgList(param);
+ }
+
+ @ApiOperation({
+ description: '删除',
+ summary: '删除',
+ })
+ @Delete(':key')
+ async del(@Param(new ParamsValidationPipe()) param: CfgKeyDto) {
+ const res = await this.cfgService.del(param.key);
+ return res;
+ }
+}
diff --git a/server/src/modules/operate/dto/banner.dto.ts b/server/src/modules/operate/dto/banner.dto.ts
new file mode 100644
index 00000000..abc4e38d
--- /dev/null
+++ b/server/src/modules/operate/dto/banner.dto.ts
@@ -0,0 +1,73 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 20:12:31
+ * @LastEditTime: 2025-03-03 19:00:31
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import { IsEnum, IsOptional, IsString } from 'class-validator';
+import { Banner, BannerTag } from 'src/db/schema/banner.schema';
+import { ONOFF } from 'src/global/enum/all.enum';
+
+export class ActionBannerDto implements Partial<Banner> {
+ @ApiProperty({ required: false })
+ @IsString({ message: '数据ID' })
+ @IsOptional()
+ @Expose()
+ readonly dataId?: string;
+
+ @ApiProperty({ required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ required: false })
+ @IsString({ message: '链接' })
+ @IsOptional()
+ @Expose()
+ readonly url?: string;
+
+ @ApiProperty({ title: '图片链接', required: true })
+ @IsString({ message: '图片链接' })
+ @Expose()
+ readonly imgUrl: string;
+
+ @ApiProperty({ title: '标识', required: true })
+ @IsEnum(BannerTag, { message: '标识' })
+ @Expose()
+ readonly tag: BannerTag;
+}
+
+export class BannerIdDto {
+ @ApiProperty({ title: 'ID', required: true })
+ @IsString({ message: 'ID' })
+ @Expose()
+ id: string;
+}
+
+export class GetBannerListDto {
+ @ApiProperty({ title: 'ID', required: false })
+ @IsString({ message: 'ID' })
+ @IsOptional()
+ @Expose()
+ readonly id?: string;
+}
+
+export class AppGetBannerListDto {
+ @ApiProperty({ title: 'tag', required: false })
+ @IsEnum(BannerTag, { message: 'tag' })
+ @IsOptional()
+ @Expose()
+ readonly tag?: BannerTag;
+}
+
+export class UpdateBannerPublishDto {
+ @ApiProperty({ title: '是否发布', required: true })
+ @IsEnum(ONOFF, { message: '是否发布' })
+ @Type(() => Number)
+ @Expose()
+ readonly isPublish: ONOFF;
+}
diff --git a/server/src/modules/operate/dto/cfg.dto.ts b/server/src/modules/operate/dto/cfg.dto.ts
new file mode 100644
index 00000000..f8fcfe66
--- /dev/null
+++ b/server/src/modules/operate/dto/cfg.dto.ts
@@ -0,0 +1,48 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 20:12:31
+ * @LastEditTime: 2025-03-03 19:00:31
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsObject, IsString } from 'class-validator';
+
+export class CreateCfgDto {
+ @ApiProperty({ required: true })
+ @IsString({ message: 'key' })
+ @Expose()
+ readonly key: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '标题必须填写' })
+ @Expose()
+ readonly title: string;
+
+ @ApiProperty({ required: true })
+ @IsObject({ message: '内容' })
+ @Expose()
+ readonly content: any;
+}
+
+export class UpdateCfgDto {
+ @ApiProperty({ required: true })
+ @IsString({ message: '内容' })
+ @Expose()
+ readonly content: string;
+}
+
+export class CfgIdDto {
+ @ApiProperty({ title: 'ID', required: true })
+ @IsString({ message: 'ID' })
+ @Expose()
+ id: string;
+}
+
+export class CfgKeyDto {
+ @ApiProperty({ title: 'key', required: true })
+ @IsString({ message: 'key' })
+ @Expose()
+ key: string;
+}
diff --git a/server/src/modules/operate/dto/gzh.dto.ts b/server/src/modules/operate/dto/gzh.dto.ts
new file mode 100644
index 00000000..a8b7f4df
--- /dev/null
+++ b/server/src/modules/operate/dto/gzh.dto.ts
@@ -0,0 +1,17 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 20:12:31
+ * @LastEditTime: 2025-04-14 16:36:06
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsString } from 'class-validator';
+
+export class CreateGzhMenuDto {
+ @ApiProperty({ title: '菜单JSON字符', required: true })
+ @IsString({ message: '菜单JSON字符' })
+ @Expose()
+ readonly menuStr: string;
+}
diff --git a/server/src/modules/operate/operate.module.ts b/server/src/modules/operate/operate.module.ts
new file mode 100644
index 00000000..5b0ee897
--- /dev/null
+++ b/server/src/modules/operate/operate.module.ts
@@ -0,0 +1,39 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:07
+ * @LastEditTime: 2025-04-14 16:41:35
+ * @LastEditors: nevin
+ * @Description: 运营模块
+ */
+import { Global, Module } from '@nestjs/common';
+import { MongooseModule } from '@nestjs/mongoose';
+import { BannerService } from './banner.service';
+import { BannerController } from './banner.controller';
+import { Banner, BannerSchema } from 'src/db/schema/banner.schema';
+import { AdminBannerController } from './adminBanner.controller';
+import { PlatAuthModule } from 'src/lib/platAuth/platAuth.module';
+import { AdminGzhController } from './adminGzh.controller';
+import { Cfg, CfgSchema } from 'src/db/schema/cfg.schema';
+import { CfgController } from './cfg.controller';
+import { CfgService } from './cfg.service';
+import { AdminCfgController } from './cfgAdmin.controller';
+
+@Global()
+@Module({
+ imports: [
+ PlatAuthModule,
+ MongooseModule.forFeature([
+ { name: Banner.name, schema: BannerSchema },
+ { name: Cfg.name, schema: CfgSchema },
+ ]),
+ ],
+ providers: [BannerService, CfgService],
+ controllers: [
+ BannerController,
+ AdminBannerController,
+ AdminGzhController,
+ CfgController,
+ AdminCfgController,
+ ],
+})
+export class OperateModule {}
diff --git a/server/src/modules/other/adminQa.controller.ts b/server/src/modules/other/adminQa.controller.ts
new file mode 100644
index 00000000..4fc75146
--- /dev/null
+++ b/server/src/modules/other/adminQa.controller.ts
@@ -0,0 +1,24 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-04-14 17:45:14
+ * @LastEditors: nevin
+ * @Description: QA
+ */
+import { Controller, Post } from '@nestjs/common';
+import { FeedbackService } from './feedback.service';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { GetToken } from 'src/auth/auth.guard';
+import { Manager } from 'src/auth/manager.guard';
+
+@Manager()
+@Controller('admin/qa')
+export class AdminQaController {
+ constructor(private readonly feedbackService: FeedbackService) {}
+
+ // 创建QA
+ @Post()
+ async createQa(@GetToken() token: TokenInfo) {
+ return 1;
+ }
+}
diff --git a/server/src/modules/other/dto/feedback.dto.ts b/server/src/modules/other/dto/feedback.dto.ts
new file mode 100644
index 00000000..8c91f50a
--- /dev/null
+++ b/server/src/modules/other/dto/feedback.dto.ts
@@ -0,0 +1,90 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-19 15:58:47
+ * @LastEditTime: 2025-03-17 12:41:12
+ * @LastEditors: nevin
+ * @Description: 反馈
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import {
+ ArrayMaxSize,
+ ArrayMinSize,
+ IsArray,
+ IsEnum,
+ IsNotEmpty,
+ IsOptional,
+ IsString,
+ Validate,
+} from 'class-validator';
+import { FeedbackType } from 'src/db/schema/feedback.schema';
+
+export class CreateFeedBackDto {
+ @ApiProperty({ title: '内容', required: true })
+ @IsString({ message: '内容' })
+ @Expose()
+ readonly content: string;
+
+ @ApiProperty({
+ title: '类型',
+ required: false,
+ description: '',
+ })
+ @IsEnum(FeedbackType, { message: '类型' })
+ @IsOptional()
+ @Expose()
+ readonly type?: FeedbackType;
+
+ @ApiProperty({ type: [String], description: '标识数组' })
+ @IsArray()
+ @IsString({ each: true, message: '字符串数组' })
+ @IsOptional()
+ @Expose()
+ readonly tagList?: string[];
+
+ @ApiProperty({ type: [String], description: '文件链接数组' })
+ @IsArray()
+ @IsString({ each: true, message: '文件链接' })
+ @IsOptional()
+ @Expose()
+ readonly fileUrlList?: string[];
+}
+
+export class GetFeedbackListDto {
+ @ApiProperty({
+ title: '起始时间',
+ required: false,
+ type: [String],
+ description: '时间范围数组,格式为[startDate, endDate],格式YYYY-MM-DD',
+ example: ['2023-01-01', '2023-12-31'],
+ })
+ @Type(() => Date) // 将传入的字符串自动转换为Date对象
+ @IsArray({ message: '时间范围必须为数组' })
+ @ArrayMinSize(2, { message: '时间范围需要两个元素' })
+ @ArrayMaxSize(2, { message: '时间范围不能超过两个元素' })
+ @Validate(
+ (value: Date[]) => {
+ return value;
+ },
+ {
+ each: true,
+ message: '必须为有效的日期格式',
+ },
+ )
+ @IsOptional()
+ @Expose()
+ readonly time?: [Date, Date];
+
+ @ApiProperty({ type: String })
+ @IsNotEmpty({ message: '用户ID不能为空' })
+ @IsString()
+ @IsOptional()
+ @Expose()
+ userId?: string;
+
+ @ApiProperty({ enum: FeedbackType })
+ @IsEnum(FeedbackType)
+ @IsOptional()
+ @Expose()
+ type?: FeedbackType;
+}
diff --git a/server/src/modules/other/feedback.controller.ts b/server/src/modules/other/feedback.controller.ts
new file mode 100644
index 00000000..74e4b1fd
--- /dev/null
+++ b/server/src/modules/other/feedback.controller.ts
@@ -0,0 +1,72 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2024-12-23 12:45:22
+ * @LastEditors: nevin
+ * @Description: 反馈
+ */
+import { Body, Controller, Post, Sse } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { FeedbackService } from './feedback.service';
+import { CreateFeedBackDto } from './dto/feedback.dto';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { UserService } from 'src/user/user.service';
+import { interval, map, Observable } from 'rxjs';
+import { GetToken } from 'src/auth/auth.guard';
+import { Feedback } from 'src/db/schema/feedback.schema';
+
+@ApiTags('反馈')
+@Controller('feedback')
+export class FeedbackController {
+ constructor(
+ private readonly feedbackService: FeedbackService,
+ private readonly userService: UserService,
+ ) {}
+
+ @ApiOperation({
+ description: '提交反馈',
+ summary: '提交反馈',
+ })
+ @Post()
+ async createFeedback(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: CreateFeedBackDto,
+ ) {
+ const { fileUrlList, content, type, tagList } = body;
+ const userInfo = await this.userService.getUserInfoById(token.id);
+ const newData = new Feedback();
+ newData.content = content;
+ newData.userId = userInfo.id;
+ newData.userName = userInfo.name;
+ newData.fileUrlList = fileUrlList; // TODO: 去除临时目录
+ newData.type = type;
+ newData.tagList = tagList;
+
+ const res = await this.feedbackService.createFeedback(newData);
+ return res;
+ }
+
+ @ApiOperation({
+ description: 'sse接口测试',
+ summary: 'sse接口测试',
+ })
+ @Post('sse')
+ @Sse('sse')
+ sse2(): Observable<any> {
+ const text = [
+ '这是第一句话',
+ '这是第二句话',
+ '这是第三句话',
+ '这是第四句话',
+ ];
+ console.log(text);
+ return interval(1000).pipe(
+ map((i) => {
+ return {
+ data: text[i],
+ };
+ }),
+ );
+ }
+}
diff --git a/server/src/modules/other/feedback.service.ts b/server/src/modules/other/feedback.service.ts
new file mode 100644
index 00000000..63f83b44
--- /dev/null
+++ b/server/src/modules/other/feedback.service.ts
@@ -0,0 +1,72 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2024-09-05 15:19:25
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery } from 'mongoose';
+import { Feedback } from 'src/db/schema/feedback.schema';
+import { ResponseUtil } from 'src/global/class/correctResponse.class';
+import { TableUtil } from 'src/global/class/tableUtli.class';
+import { TableDto } from 'src/global/dto/table.dto';
+import { GetFeedbackListDto } from './dto/feedback.dto';
+
+@Injectable()
+export class FeedbackService {
+ constructor(
+ @InjectModel(Feedback.name)
+ private readonly feedbackModel: Model<Feedback>,
+ ) {}
+
+ async createFeedback(newData: Feedback) {
+ return await this.feedbackModel.create(newData);
+ }
+
+ /**
+ * 获取列表
+ * @param pageInfo
+ * @param query
+ * @returns
+ */
+ async getFeedbackList(pageInfo: TableDto, query: GetFeedbackListDto) {
+ const { skip, take } = TableUtil.GetSqlPaging(pageInfo);
+ const filter: RootFilterQuery<Feedback> = {
+ ...(query.time && {
+ createTime: {
+ $gte: query.time[0],
+ $lte: query.time[1],
+ },
+ }),
+ ...(query.userId && { userId: query.userId }),
+ ...(query.type && { type: query.type }),
+ };
+ const tatal = await this.feedbackModel.countDocuments(filter);
+ const data = await this.feedbackModel
+ .find(filter)
+ .sort({ createTime: -1 })
+ .skip(skip)
+ .limit(take);
+
+ return ResponseUtil.GetCorrectResponse(
+ pageInfo.pageNo,
+ pageInfo.pageSize,
+ tatal,
+ data,
+ );
+ }
+
+ // 根据ID获取信息
+ async getFeedbackInfo(id: string) {
+ const data = await this.feedbackModel.findOne({ _id: id });
+ return data;
+ }
+
+ // 根据ID删除
+ async delFeedback(id: string) {
+ const data = await this.feedbackModel.deleteOne({ _id: id });
+ return data;
+ }
+}
diff --git a/server/src/modules/other/feedbackAdmin.controller.ts b/server/src/modules/other/feedbackAdmin.controller.ts
new file mode 100644
index 00000000..35562043
--- /dev/null
+++ b/server/src/modules/other/feedbackAdmin.controller.ts
@@ -0,0 +1,57 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2024-12-23 12:45:22
+ * @LastEditors: nevin
+ * @Description: 反馈
+ */
+import { Controller, Get, Param, Query } from '@nestjs/common';
+import { ApiOperation } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { FeedbackService } from './feedback.service';
+import { UserService } from 'src/user/user.service';
+import { Manager } from 'src/auth/manager.guard';
+import { TableDto } from 'src/global/dto/table.dto';
+import { GetFeedbackListDto } from './dto/feedback.dto';
+
+@Manager()
+@Controller('admin/feedback')
+export class FeedbackAdminController {
+ constructor(
+ private readonly feedbackService: FeedbackService,
+ private readonly userService: UserService,
+ ) {}
+
+ @ApiOperation({
+ description: '反馈列表',
+ summary: '反馈列表',
+ })
+ @Get('list/:pageNo/:pageSize')
+ async getList(
+ @Param(new ParamsValidationPipe()) param: TableDto,
+ @Query(new ParamsValidationPipe()) query: GetFeedbackListDto,
+ ) {
+ const res = await this.feedbackService.getFeedbackList(param, query);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '反馈详情',
+ summary: '反馈详情',
+ })
+ @Get('info/:id')
+ async getInfo(@Param('id') id: string) {
+ const res = await this.feedbackService.getFeedbackInfo(id);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '删除反馈',
+ summary: '删除反馈',
+ })
+ @Get('del/:id')
+ async delFeedback(@Param('id') id: string) {
+ const res = await this.feedbackService.delFeedback(id);
+ return res;
+ }
+}
diff --git a/server/src/modules/other/other.module.ts b/server/src/modules/other/other.module.ts
new file mode 100644
index 00000000..44e6ad51
--- /dev/null
+++ b/server/src/modules/other/other.module.ts
@@ -0,0 +1,29 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:07
+ * @LastEditTime: 2025-04-14 19:22:41
+ * @LastEditors: nevin
+ * @Description: 其他模块
+ */
+import { Global, Module } from '@nestjs/common';
+import { FeedbackService } from './feedback.service';
+import { FeedbackController } from './feedback.controller';
+import { MongooseModule } from '@nestjs/mongoose';
+import { Feedback, FeedbackSchema } from 'src/db/schema/feedback.schema';
+import { QaService } from './qa.service';
+import { QaRecord, QaRecordSchema } from 'src/db/schema/qaRecord.schema';
+import { QaController } from './qa.controller';
+import { FeedbackAdminController } from './feedbackAdmin.controller';
+
+@Global()
+@Module({
+ imports: [
+ MongooseModule.forFeature([
+ { name: Feedback.name, schema: FeedbackSchema },
+ { name: QaRecord.name, schema: QaRecordSchema },
+ ]),
+ ],
+ providers: [FeedbackService, QaService],
+ controllers: [FeedbackController, QaController, FeedbackAdminController],
+})
+export class OtherModule {}
diff --git a/server/src/modules/other/qa.controller.ts b/server/src/modules/other/qa.controller.ts
new file mode 100644
index 00000000..a3f069e5
--- /dev/null
+++ b/server/src/modules/other/qa.controller.ts
@@ -0,0 +1,34 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-04-14 19:21:01
+ * @LastEditors: nevin
+ * @Description: QA
+ */
+import { Controller, Get, Param, Query } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { GetToken } from 'src/auth/auth.guard';
+import { TableDto } from 'src/global/dto/table.dto';
+import { QaService } from './qa.service';
+
+@ApiTags('QA')
+@Controller('qa')
+export class QaController {
+ constructor(private readonly qaService: QaService) {}
+
+ @ApiOperation({
+ description: '获取列表',
+ summary: '获取列表',
+ })
+ @Get('list/:pageNo/:pageSize')
+ async getPubRecordDraftsList(
+ @GetToken() token: TokenInfo,
+ @Param(new ParamsValidationPipe()) param: TableDto,
+ @Query(new ParamsValidationPipe()) query: any,
+ ) {
+ const res = await this.qaService.getQaRecordList(param, query);
+ return res;
+ }
+}
diff --git a/server/src/modules/other/qa.service.ts b/server/src/modules/other/qa.service.ts
new file mode 100644
index 00000000..4781a000
--- /dev/null
+++ b/server/src/modules/other/qa.service.ts
@@ -0,0 +1,55 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2025-04-14 17:53:17
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery } from 'mongoose';
+import { QaRecord } from 'src/db/schema/qaRecord.schema';
+import { TableDto } from 'src/global/dto/table.dto';
+
+@Injectable()
+export class QaService {
+ constructor(
+ @InjectModel(QaRecord.name)
+ private readonly qaRecordModel: Model<QaRecord>,
+ ) {}
+
+ async createQaRecord(newData: Partial<QaRecord>) {
+ return await this.qaRecordModel.create(newData);
+ }
+
+ /**
+ * 获取记录列表
+ * @param userId
+ * @param page
+ * @returns
+ */
+ async getQaRecordList(
+ page: TableDto,
+ query: any,
+ ): Promise<{
+ list: QaRecord[];
+ totalCount: number;
+ }> {
+ const filters: RootFilterQuery<QaRecord> = {
+ ...(query.type !== undefined && { type: query.type }),
+ };
+
+ const list = await this.qaRecordModel
+ .find(filters)
+ .skip((page.pageNo - 1) * page.pageSize)
+ .limit(page.pageSize)
+ .sort({ sort: -1 });
+
+ const totalCount = await this.qaRecordModel.countDocuments(filters);
+
+ return {
+ list,
+ totalCount,
+ };
+ }
+}
diff --git a/server/src/modules/plat/bilibili/bilibili.controller.ts b/server/src/modules/plat/bilibili/bilibili.controller.ts
new file mode 100644
index 00000000..7919d173
--- /dev/null
+++ b/server/src/modules/plat/bilibili/bilibili.controller.ts
@@ -0,0 +1,108 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:00:18
+ * @LastEditors: nevin
+ * @Description: signIn SignIn 签到
+ */
+import {
+ Body,
+ Controller,
+ Get,
+ Param,
+ Post,
+ Query,
+ UploadedFile,
+ UseInterceptors,
+} from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import {
+ AccessBackDto,
+ ArchiveAddByUtokenBodyDto,
+ ArchiveAddByUtokenQueryDto,
+} from './dto/bilibili.dto';
+import { BilibiliService } from './bilibili.service';
+import { GetToken, Public } from 'src/auth/auth.guard';
+import { FileInterceptor } from '@nestjs/platform-express';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+
+@ApiTags('plat/bilibili - B站平台')
+@Controller('plat/bilibili')
+export class BilibiliController {
+ constructor(private readonly bilibiliService: BilibiliService) {}
+
+ @ApiOperation({ summary: '获取页面的认证URL' })
+ @Get('auth/url/:type')
+ async getAuthUrl(
+ @GetToken() token: TokenInfo,
+ @Param('type') type: 'h5' | 'pc',
+ ) {
+ const res = await this.bilibiliService.getAuthUrl(token.id, type);
+ return res;
+ }
+
+ @ApiOperation({ summary: '获取AccessToken,并记录到用户,给平台回调用' })
+ @Public()
+ @Get('auth/back/:userId')
+ async getAccessToken(
+ @Param('userId') userId: string,
+ @Query() query: AccessBackDto,
+ ) {
+ const res = await this.bilibiliService.setUserAccessToken({
+ userId,
+ ...query,
+ });
+ return res;
+ }
+
+ @ApiOperation({ summary: '查询用户已授权权限列表' })
+ @Get('account/scopes')
+ async getAccountScopes(@GetToken() token: TokenInfo) {
+ const accessToken = await this.bilibiliService.getUserAccessToken(token.id);
+ return this.bilibiliService.getAccountScopes(accessToken);
+ }
+
+ @ApiOperation({ summary: '视频初始化' })
+ @Post('video/init')
+ async videoInit(@GetToken() token: TokenInfo) {
+ const accessToken = await this.bilibiliService.getUserAccessToken(token.id);
+ return this.bilibiliService.videoInit(accessToken);
+ }
+
+ @ApiOperation({ summary: '封面上传' })
+ @UseInterceptors(FileInterceptor('file'))
+ @Post('cover/upload')
+ async coverUpload(
+ @GetToken() token: TokenInfo,
+ @UploadedFile() file: Express.Multer.File,
+ ) {
+ const accessToken = await this.bilibiliService.getUserAccessToken(token.id);
+ return this.bilibiliService.coverUpload(accessToken, file);
+ }
+
+ @ApiOperation({ summary: '视频稿件提交' })
+ @Post('archive/add-by-utoken')
+ async archiveAddByUtoken(
+ @Query() query: ArchiveAddByUtokenQueryDto,
+ @Body() body: ArchiveAddByUtokenBodyDto,
+ ) {
+ const data = {
+ ...body,
+ no_reprint: body.noReprint,
+ tag: body.tag.join(','),
+ };
+ const { accessToken, uploadToken } = query;
+ return this.bilibiliService.archiveAddByUtoken(
+ accessToken,
+ uploadToken,
+ data,
+ );
+ }
+
+ @ApiOperation({ summary: '分区查询' })
+ @Get('archive/type/list/:accessToken')
+ async archiveTypeList(@GetToken() token: TokenInfo) {
+ const accessToken = await this.bilibiliService.getUserAccessToken(token.id);
+ return this.bilibiliService.archiveTypeList(accessToken);
+ }
+}
diff --git a/server/src/modules/plat/bilibili/bilibili.module.ts b/server/src/modules/plat/bilibili/bilibili.module.ts
new file mode 100644
index 00000000..c0cc0feb
--- /dev/null
+++ b/server/src/modules/plat/bilibili/bilibili.module.ts
@@ -0,0 +1,24 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-04-27 17:36:19
+ * @LastEditors: nevin
+ * @Description: bilibili Bilibili B站模块
+ */
+import { Module } from '@nestjs/common';
+import { BilibiliController } from './bilibili.controller';
+import { BilibiliService } from './bilibili.service';
+import { ConfigModule } from '@nestjs/config';
+import bilibiliConfig from 'config/bilibili.config';
+
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [bilibiliConfig],
+ }),
+ ],
+ controllers: [BilibiliController],
+ providers: [BilibiliService],
+ exports: [BilibiliService],
+})
+export class BilibiliModule {}
diff --git a/server/src/modules/plat/bilibili/bilibili.service.ts b/server/src/modules/plat/bilibili/bilibili.service.ts
new file mode 100644
index 00000000..d97f5932
--- /dev/null
+++ b/server/src/modules/plat/bilibili/bilibili.service.ts
@@ -0,0 +1,355 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 17:58:21
+ * @LastEditors: nevin
+ * @Description: b站
+ */
+import { Injectable } from '@nestjs/common';
+import axios from 'axios';
+import { v4 as uuidv4 } from 'uuid';
+import { createHash, createHmac } from 'crypto';
+import { AccessToken, BClient, VideoUTypes } from './comment';
+import { ConfigService } from '@nestjs/config';
+import { getRandomString } from 'src/util';
+import { RedisService } from 'src/lib/redis/redis.service';
+import { getCurrentTimestamp } from 'src/util/time.util';
+@Injectable()
+export class BilibiliService {
+ private clientId = '';
+ private clientSecret = '';
+ private clientName = '';
+ private authBackUrl = '';
+ constructor(
+ private readonly configService: ConfigService,
+ private readonly redisService: RedisService,
+ ) {
+ const cfg = this.configService.get<BClient>('BILIBILI_CONFIG');
+ this.clientId = cfg.clientId;
+ this.clientSecret = cfg.clientSecret;
+ this.clientName = cfg.clientName;
+ this.authBackUrl = cfg.authBackUrl;
+ }
+
+ /**
+ * 获取用户的授权链接
+ * @param userId
+ * @returns
+ */
+ async getAuthUrl(userId: string, type: 'h5' | 'pc') {
+ const gourl = encodeURIComponent(
+ `${this.authBackUrl}/api/plat/bilibili/auth/back/${userId}`,
+ );
+
+ const state = getRandomString(8);
+
+ this.redisService.setKey(`bilibili:state:${state}`, { userId }, 60 * 5);
+
+ if (type === 'h5')
+ return `https://account.bilibili.com/h5/account-h5/auth/oauth?navhide=1&callback=close&gourl=${gourl}&client_id=${this.clientId}&state=${state}`;
+
+ return `https://account.bilibili.com/pc/account-pc/auth/oauth?client_id=${this.clientId}&gourl=${gourl}&state=${state}`;
+ }
+
+ /**
+ * 设置用户的授权Token
+ * @param data
+ * @returns
+ */
+ async setUserAccessToken(data: {
+ code: string;
+ userId: string;
+ state: string;
+ }) {
+ const { code, userId, state } = data;
+
+ const query = {
+ client_id: this.clientId,
+ client_secret: this.clientSecret,
+ grant_type: 'authorization_code',
+ code,
+ };
+
+ const stateData = await this.redisService.get(`bilibili:state:${state}`);
+ if (!stateData || stateData.userId !== userId) return false;
+
+ try {
+ const result = await axios.post<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ data: AccessToken;
+ }>('https://api.bilibili.com/x/account-oauth2/v1/token', null, {
+ params: query,
+ });
+
+ const accessTokenInfo = result.data.data;
+
+ // 剩余有效秒数
+ const expires =
+ accessTokenInfo.expires_in - getCurrentTimestamp() - 60 * 60;
+
+ this.redisService.setKey(
+ `bilibili:accessToken:${userId}`,
+ accessTokenInfo,
+ expires,
+ );
+
+ return true;
+ } catch (error) {
+ console.log('Error during getUserAccessToken:', error);
+ return false;
+ }
+ }
+
+ async getUserAccessToken(userId: string): Promise<string> {
+ const res: AccessToken = await this.redisService.get(
+ `bilibili:accessToken:${userId}`,
+ );
+ if (!res) return '';
+
+ // 剩余时间
+ const overTime = res.expires_in - getCurrentTimestamp();
+
+ if (overTime < 60 * 60 && overTime > 0) {
+ // 刷新token
+ this.refreshAccessToken(userId, res.refresh_token);
+ }
+
+ return res.access_token;
+ }
+
+ /**
+ * 刷新授权Token
+ * @param userId
+ * @param refreshToken
+ * @returns
+ */
+ async refreshAccessToken(userId: string, refreshToken: string) {
+ const query = {
+ client_id: this.clientId,
+ client_secret: this.clientSecret,
+ grant_type: 'refresh_token',
+ refresh_token: refreshToken,
+ };
+
+ const url = `https://api.bilibili.com/x/account-oauth2/v1/refresh_token`;
+ try {
+ const result = await axios.post<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ data: AccessToken;
+ }>(url, null, { params: query });
+
+ const accessTokenInfo = result.data.data;
+
+ // 剩余有效秒数
+ const expires =
+ accessTokenInfo.expires_in - getCurrentTimestamp() - 60 * 60;
+
+ this.redisService.setKey(
+ `bilibili:accessToken:${userId}`,
+ accessTokenInfo,
+ expires,
+ );
+
+ return true;
+ } catch (error) {
+ console.log('Error during getAccessToken:', error);
+ return false;
+ }
+ }
+
+ /**
+ * 查询用户已授权权限列表
+ * @returns
+ */
+ async getAccountScopes(accessToken: string) {
+ const url = `https://member.bilibili.com/arcopen/fn/user/account/scopes`;
+ const result = await axios.get<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ data: {
+ openid: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ scopes: string[]; // ['USER_INFO', 'ATC_DATA', 'ATC_BASE'];
+ };
+ }>(url, {
+ headers: this.generateBilibiliHeader({
+ accessToken,
+ isForm: true,
+ }),
+ });
+
+ return result.data.data;
+ }
+
+ /**
+ * 生成请求头
+ * @param data
+ */
+ private generateBilibiliHeader(data: {
+ accessToken: string;
+ body?: { [key: string]: any };
+ isForm?: boolean;
+ }) {
+ const { accessToken, body, isForm } = data;
+ const xBiliContentMd5 = body
+ ? createHash('md5').update(JSON.stringify(body)).digest('hex')
+ : '';
+
+ const header = {
+ Accept: 'application/json',
+ 'Content-Type': isForm ? 'multipart/form-data' : 'application/json', // 或者 multipart/form-data
+ 'x-bili-content-md5': xBiliContentMd5,
+ 'x-bili-timestamp': Math.floor(Date.now() / 1000),
+ 'x-bili-signature-method': 'HMAC-SHA256',
+ 'x-bili-signature-nonce': uuidv4(),
+ 'x-bili-accesskeyid': this.clientId,
+ 'x-bili-signature-version': '1.0',
+ 'access-token': accessToken, // 需要在请求头中添加access-token
+ Authorization: '',
+ };
+
+ // 抽取带”x-bili-“前缀的自定义header,按字典排序拼接,构建完整的待签名字符串:
+ // 待签名字符串包含换行符\n
+ const headerStr = Object.keys(header)
+ .filter((key) => key.startsWith('x-bili-'))
+ .sort()
+ .map((key) => `${key}:${header[key]}\n`)
+ .join('');
+
+ // 使用 createHmac 正确创建签名
+ const signature = createHmac('sha256', this.clientSecret)
+ .update(headerStr)
+ .digest('hex');
+
+ // 将签名加入 header
+ header.Authorization = signature;
+
+ return header;
+ }
+
+ /**
+ * 视频初始化
+ * @param fileName
+ * @param utype // 1-单个小文件(不超过100M)。默认值为0
+ * @returns
+ */
+ async videoInit(fileName: string, utype: VideoUTypes = 0): Promise<string> {
+ const body = {
+ name: fileName, // test.mp4
+ utype,
+ };
+
+ const url = `https://member.bilibili.com/arcopen/fn/archive/video/init`;
+ const result = await axios.post<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ request_id: string; // '7b753a287405461f5afa526a1f672094';
+ data: {
+ upload_token: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ };
+ }>(url, body);
+ return result.data.data.upload_token;
+ }
+
+ /**
+ * 封面上传
+ * @param accessToken
+ * @param file
+ * @returns
+ */
+ async coverUpload(
+ accessToken: string,
+ file: Express.Multer.File,
+ ): Promise<string> {
+ const url = `https://member.bilibili.com/arcopen/fn/archive/cover/upload`;
+
+ const formData = new FormData();
+ const blob = new Blob([file.buffer], { type: file.mimetype });
+ formData.append('file', blob, file.originalname);
+
+ const result = await axios.post<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ request_id: string; // '7b753a287405461f5afa526a1f672094';
+ data: {
+ url: string; // "https://archive.biliimg.com/bfs/..."
+ };
+ }>(url, formData, {
+ headers: this.generateBilibiliHeader({
+ accessToken: accessToken,
+ isForm: true,
+ }),
+ });
+ return result.data.data.url;
+ }
+
+ /**
+ * 视频稿件提交
+ * @param accessToken
+ * @param uploadToken
+ * @param data
+ * @returns
+ */
+ async archiveAddByUtoken(
+ accessToken: string,
+ uploadToken: string,
+ data: {
+ title: string; // 标题
+ cover?: string; // 封面url
+ tid: number; // 分区ID,由获取分区信息接口得到
+ no_reprint?: 0 | 1; // 是否允许转载 0-允许,1-不允许。默认0
+ desc?: string; // 描述
+ tag: string; // 标签, 多个标签用英文逗号分隔,总长度小于200
+ copyright: 1 | 2; // 1-原创,2-转载(转载时source必填)
+ source?: string; // 如果copyright为转载,则此字段表示转载来源
+ topic_id?: number; // 参加的话题ID,默认情况下不填写,需要填写和运营联系
+ },
+ ): Promise<string> {
+ const url = `https://member.bilibili.com/arcopen/fn/archive/add-by-utoken`;
+
+ const result = await axios.post<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ data: {
+ resource_id: string; // 'BV17B4y1s7R1';
+ };
+ }>(url, data, {
+ headers: this.generateBilibiliHeader({
+ accessToken,
+ }),
+ params: {
+ upload_token: uploadToken,
+ },
+ });
+ return result.data.data.resource_id;
+ }
+
+ /**
+ * 分区查询
+ * @param accessToken
+ * @returns
+ */
+ async archiveTypeList(accessToken: string) {
+ const url = `https://member.bilibili.com/arcopen/fn/archive/type/list`;
+
+ const result = await axios.get<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ request_id: string; // '35f4a1e0d3765a92510f919d0b6721dd';
+ data: any;
+ }>(url, {
+ headers: this.generateBilibiliHeader({
+ accessToken,
+ }),
+ });
+ return result.data.data;
+ }
+}
diff --git a/server/src/modules/plat/bilibili/comment.ts b/server/src/modules/plat/bilibili/comment.ts
new file mode 100644
index 00000000..cd38ddd0
--- /dev/null
+++ b/server/src/modules/plat/bilibili/comment.ts
@@ -0,0 +1,18 @@
+export enum VideoUTypes {
+ Little = 0,
+ Big = 1,
+}
+
+export interface BClient {
+ clientName: string;
+ clientId: string;
+ clientSecret: string;
+ authBackUrl: string;
+}
+
+export interface AccessToken {
+ access_token: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ expires_in: number; // 1630220614;
+ refresh_token: string; // 'WxFDKwqScZIQDm4iWmKDvetyFugM6HkX';
+ scopes: string[]; // ['USER_INFO', 'ATC_DATA', 'ATC_BASE'];
+}
diff --git a/server/src/modules/plat/bilibili/dto/bilibili.dto.ts b/server/src/modules/plat/bilibili/dto/bilibili.dto.ts
new file mode 100644
index 00000000..c06a4457
--- /dev/null
+++ b/server/src/modules/plat/bilibili/dto/bilibili.dto.ts
@@ -0,0 +1,114 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:16:37
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import {
+ IsArray,
+ IsEnum,
+ IsNotEmpty,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { VideoUTypes } from '../comment';
+
+export class AccessBackDto {
+ @Expose()
+ code: string;
+
+ @Expose()
+ state: string;
+}
+
+export class VideoInitDto {
+ @ApiProperty({ title: '文件名称(带格式)', required: true })
+ @IsString({ message: '文件名称' })
+ @Expose()
+ readonly fileName: string;
+
+ @ApiProperty({ enum: VideoUTypes })
+ @IsNotEmpty({ message: '文件类型不能为空' })
+ @IsEnum(VideoUTypes)
+ @Type(() => Number)
+ @Expose()
+ readonly utype: VideoUTypes;
+}
+
+export class ArchiveAddByUtokenQueryDto {
+ @ApiProperty({ title: '用户token', required: true })
+ @IsString({ message: '用户token' })
+ @Expose()
+ readonly accessToken: string;
+
+ @ApiProperty({ title: '上传token', required: true })
+ @IsString({ message: '上传token' })
+ @Expose()
+ readonly uploadToken: string;
+}
+
+export class ArchiveAddByUtokenBodyDto {
+ @ApiProperty({ title: '标题', required: true })
+ @IsString({ message: '标题' })
+ @Expose()
+ readonly title: string;
+
+ @ApiProperty({ title: '封面url', required: false })
+ @IsString({ message: '封面url' })
+ @IsOptional()
+ @Expose()
+ readonly cover?: string;
+
+ @ApiProperty({ title: '分区ID,由获取分区信息接口得到', required: true })
+ @IsNumber({ allowNaN: false }, { message: '分区ID,由获取分区信息接口得到' })
+ @Expose()
+ readonly tid: number;
+
+ @ApiProperty({
+ title: '是否允许转载 0-允许,1-不允许。默认0',
+ required: true,
+ })
+ @IsNumber(
+ { allowNaN: false },
+ { message: '是否允许转载 0-允许,1-不允许。默认0' },
+ )
+ @IsOptional()
+ @Expose()
+ readonly noReprint?: 0 | 1;
+
+ @ApiProperty({ title: '描述', required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ title: '标签', required: false })
+ @IsArray({ message: '标签必须是字符串数组' })
+ @IsString({ each: true, message: '描述' })
+ @Expose()
+ readonly tag: string[];
+
+ @ApiProperty({
+ title: '1-原创,2-转载(转载时source必填)',
+ required: true,
+ })
+ @IsNumber(
+ { allowNaN: false },
+ { message: '1-原创,2-转载(转载时source必填)' },
+ )
+ @Expose()
+ readonly copyright: 1 | 2;
+
+ @ApiProperty({
+ title: '如果copyright为转载,则此字段表示转载来源',
+ required: false,
+ })
+ @IsString({ message: '如果copyright为转载,则此字段表示转载来源' })
+ @IsOptional()
+ @Expose()
+ readonly source?: string;
+}
diff --git a/server/src/modules/plat/google/comment.ts b/server/src/modules/plat/google/comment.ts
new file mode 100644
index 00000000..905e4f4f
--- /dev/null
+++ b/server/src/modules/plat/google/comment.ts
@@ -0,0 +1,15 @@
+export enum VideoUTypes {
+ Little = 0,
+ Big = 1,
+}
+
+
+export interface AccessToken {
+ access_token: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ expires_in: number; // 1630220614;
+ refresh_token: string; // 'WxFDKwqScZIQDm4iWmKDvetyFugM6HkX';
+ scopes: string[]; // ['USER_INFO', 'ATC_DATA', 'ATC_BASE'];
+ token_type: string;
+ id_token: string;
+}
+
diff --git a/server/src/modules/plat/google/dto/google.dto.ts b/server/src/modules/plat/google/dto/google.dto.ts
new file mode 100644
index 00000000..5966d671
--- /dev/null
+++ b/server/src/modules/plat/google/dto/google.dto.ts
@@ -0,0 +1,126 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:16:37
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import {
+ IsArray,
+ IsEnum,
+ IsNotEmpty,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { VideoUTypes } from '../comment';
+
+export class AccessBackDto {
+ @Expose()
+ code: string;
+
+ @Expose()
+ state: string;
+}
+
+export class VideoInitDto {
+ @ApiProperty({ title: '文件名称(带格式)', required: true })
+ @IsString({ message: '文件名称' })
+ @Expose()
+ readonly fileName: string;
+
+ @ApiProperty({ enum: VideoUTypes })
+ @IsNotEmpty({ message: '文件类型不能为空' })
+ @IsEnum(VideoUTypes)
+ @Type(() => Number)
+ @Expose()
+ readonly utype: VideoUTypes;
+}
+
+export class ArchiveAddByUtokenQueryDto {
+ @ApiProperty({ title: '用户token', required: true })
+ @IsString({ message: '用户token' })
+ @Expose()
+ readonly accessToken: string;
+
+ @ApiProperty({ title: '上传token', required: true })
+ @IsString({ message: '上传token' })
+ @Expose()
+ readonly uploadToken: string;
+}
+
+export class ArchiveAddByUtokenBodyDto {
+ @ApiProperty({ title: '标题', required: true })
+ @IsString({ message: '标题' })
+ @Expose()
+ readonly title: string;
+
+ @ApiProperty({ title: '封面url', required: false })
+ @IsString({ message: '封面url' })
+ @IsOptional()
+ @Expose()
+ readonly cover?: string;
+
+ @ApiProperty({ title: '分区ID,由获取分区信息接口得到', required: true })
+ @IsNumber({ allowNaN: false }, { message: '分区ID,由获取分区信息接口得到' })
+ @Expose()
+ readonly tid: number;
+
+ @ApiProperty({
+ title: '是否允许转载 0-允许,1-不允许。默认0',
+ required: true,
+ })
+ @IsNumber(
+ { allowNaN: false },
+ { message: '是否允许转载 0-允许,1-不允许。默认0' },
+ )
+ @IsOptional()
+ @Expose()
+ readonly noReprint?: 0 | 1;
+
+ @ApiProperty({ title: '描述', required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ title: '标签', required: false })
+ @IsArray({ message: '标签必须是字符串数组' })
+ @IsString({ each: true, message: '描述' })
+ @Expose()
+ readonly tag: string[];
+
+ @ApiProperty({
+ title: '1-原创,2-转载(转载时source必填)',
+ required: true,
+ })
+ @IsNumber(
+ { allowNaN: false },
+ { message: '1-原创,2-转载(转载时source必填)' },
+ )
+ @Expose()
+ readonly copyright: 1 | 2;
+
+ @ApiProperty({
+ title: '如果copyright为转载,则此字段表示转载来源',
+ required: false,
+ })
+ @IsString({ message: '如果copyright为转载,则此字段表示转载来源' })
+ @IsOptional()
+ @Expose()
+ readonly source?: string;
+}
+
+export class GoogleLoginDto {
+ @ApiProperty({ description: 'Google客户端ID' })
+ @IsString()
+ @Expose()
+ clientId: string;
+
+ @ApiProperty({ description: 'Google认证凭证' })
+ @IsString()
+ @Expose()
+ credential: string;
+}
diff --git a/server/src/modules/plat/google/google.controller.ts b/server/src/modules/plat/google/google.controller.ts
new file mode 100644
index 00000000..b6c0b918
--- /dev/null
+++ b/server/src/modules/plat/google/google.controller.ts
@@ -0,0 +1,168 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:00:18
+ * @LastEditors: nevin
+ * @Description: signIn SignIn 签到
+ */
+import {
+ Body,
+ Controller,
+ Get,
+ Param,
+ Post,
+ Query,
+ UploadedFile,
+ UseInterceptors,
+ BadRequestException,
+ Render,
+ Res
+} from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import {
+ AccessBackDto,
+ ArchiveAddByUtokenBodyDto,
+ ArchiveAddByUtokenQueryDto,
+ GoogleLoginDto
+} from './dto/google.dto';
+import { GoogleService } from './google.service';
+import { GetToken, Public } from 'src/auth/auth.guard';
+import { FileInterceptor } from '@nestjs/platform-express';
+import { Response } from 'express';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { Account } from 'src/db/schema/account.schema';
+import { ApiResult } from 'src/common/decorators/api-result.decorator';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+
+@ApiTags('plat/google - Google账号登录')
+@Controller('plat/google')
+export class GoogleController {
+ constructor(private readonly googleService: GoogleService) {}
+
+ @ApiOperation({ summary: '测试' })
+ @Public()
+ @Get('test')
+ // @Render('google/index')
+ async getTest(@Res() res: Response) {
+ // const res = "success";
+ const result = { message: "hello" };
+ console.log(result); // 在控制台输出,确保数据正确
+ // return result;
+ return res.render('google/index', result);
+ }
+
+
+ @ApiOperation({ summary: '获取用户登录授权URL' })
+ @Public()
+ @Get('auth/code')
+ async getGooleAuthCode(
+ // @GetToken() token: TokenInfo,
+ @Param('type') type: 'h5' | 'pc',
+ @Query('platform') platform: string,
+ @Query('userEmail') userEmail?: string,
+ ) {
+ // const result = await this.googleService.getAuthCode(userEmail, platform, type);
+ const result = await this.googleService.getAuthCode_v2(platform, type);
+ console.log(result.data);
+ return result;
+ }
+
+ @ApiOperation({ summary: 'Google登录' })
+ @Public()
+ // @Get('auth/login')
+ @Post('auth/login')
+ @Public()
+ @ApiResult({ type: Account })
+ async googleLogin(
+ @Body(new ParamsValidationPipe()) body: GoogleLoginDto,
+ ) {
+ // console.log(body.clientId, body.credential)
+ return this.googleService.googleLogin(body.clientId, body.credential);
+ }
+
+ @ApiOperation({ summary: '获取AccessToken' })
+ @Public()
+ @Get('auth/accessToken')
+ async getAccessToken(
+ @Query('code') code: string,
+ @Query('state') state: string,
+ // @Query() query: AccessBackDto,
+ // @Res() res: Response
+ ) {
+
+ try {
+ // 使用授权码 (code) 交换访问令牌
+ const systemToken = await this.googleService.setUserAccessToken_V2({
+ code,
+ state
+ });
+ console.log("+++++++++++++++++++++++");
+ console.log(systemToken );
+ console.log("+++++++++++++++++++++++");
+
+ // 成功获取令牌后,返回成功消息或视图
+ // return res.redirect(301, 'https://www.example.com?name=JohnDoe&age=30');
+ // return res.render('google/index', { message: '授权成功', userInfo: userInfo})
+ return systemToken;
+ } catch (err) {
+ console.log('Error during access token exchange', err);
+ // return res.render('google/index', { message: '授权失败', error: err });
+ return false
+ }
+
+ // const result = await this.googleService.getAccessToken(code)
+ // return result;
+
+ // const result = { message: "hello" };
+ // return result;
+ // return res.render('google/index', { message: result});
+ // const data = {
+ // ...body,
+ // code: body.code,
+ // state: body.state,
+ // };
+ // const { accessToken, uploadToken } = query;
+ // return this.bilibiliService.archiveAddByUtoken(
+ // accessToken,
+ // uploadToken,
+ // data,
+ // );
+ }
+
+
+ @ApiOperation({ summary: '刷新授权Token' })
+ // @Public()
+ @Get('auth/refreshAccessToken')
+ async refreshAccessToken(
+ @GetToken() token: TokenInfo,
+ ) {
+ return this.googleService.refreshAccessToken(token.id);
+ }
+
+ @ApiOperation({ summary: '获取已授权用户信息' })
+ // @Public()
+ // @Get('auth/userinfo/:accessToken')
+ @Get('auth/userinfo')
+ async getUserInfo(
+ // @Param('accessToken') accessToken: string,
+ // @Query('userId') userId: string,
+ @GetToken() token: TokenInfo,
+ ) {
+ // return this.googleService.getUserInfo(accessToken, token);
+ console.log("前端传来的token: ", token);
+ const accessToken = await this.googleService.getUserAccessToken(token.id);
+ return this.googleService.getUserInfo(accessToken, token);
+ }
+
+ @ApiOperation({ summary: '查询用户已授权权限列表' })
+ // @Public()
+ @Get('auth/scopes')
+ async getAccountScopes(
+ // @Param('accessToken') accessToken: string
+ @GetToken() token: TokenInfo,
+ ) {
+ const accessToken = await this.googleService.getUserAccessToken(token.id);
+ return this.googleService.getAccountScopes(accessToken);
+ }
+
+}
diff --git a/server/src/modules/plat/google/google.module.ts b/server/src/modules/plat/google/google.module.ts
new file mode 100644
index 00000000..0457026f
--- /dev/null
+++ b/server/src/modules/plat/google/google.module.ts
@@ -0,0 +1,32 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-04-27 17:36:19
+ * @LastEditors: nevin
+ * @Description: google google B站模块
+ */
+import { Module } from '@nestjs/common';
+// import { MongooseModule } from '@nestjs/mongoose';
+// import { User, UserSchema } from 'src/db/schema/user.schema';
+import { GoogleController } from './google.controller';
+import { GoogleService } from './google.service';
+import { UserModule } from 'src/user/user.module';
+import { ConfigModule } from '@nestjs/config';
+import { RedisModule } from 'src/lib/redis/redis.module';
+import googleConfig from 'config/google.config';
+// import { UserService } from 'src/user/user.service';
+
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [googleConfig],
+ }),
+ // MongooseModule.forFeature([{ name: User.name, schema: UserSchema }]),
+ UserModule,
+ RedisModule,
+ ],
+ controllers: [GoogleController],
+ providers: [GoogleService],
+ exports: [GoogleService],
+})
+export class GoogleModule {}
diff --git a/server/src/modules/plat/google/google.service.ts b/server/src/modules/plat/google/google.service.ts
new file mode 100644
index 00000000..1d77bf57
--- /dev/null
+++ b/server/src/modules/plat/google/google.service.ts
@@ -0,0 +1,828 @@
+/*
+ * @Author: zhangwei
+ * @Date: 2025-05-15 20:59:55
+ * @LastEditTime: 2025-04-27 17:58:21
+ * @LastEditors: zhangwei
+ * @Description: youtube
+ */
+
+import axios from 'axios';
+import { v4 as uuidv4 } from 'uuid';
+import { createHash, createHmac } from 'crypto';
+import { AccessToken } from './comment';
+import { URLSearchParams } from 'url';
+
+import { RedisService } from 'src/lib/redis/redis.service';
+import { getCurrentTimestamp } from 'src/util/time.util';
+import { getRandomString } from 'src/util';
+import { AuthService } from 'src/auth/auth.service';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { User, UserStatus } from 'src/db/schema/user.schema';
+import { Injectable, Inject, forwardRef } from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+
+const fs = require('fs');
+const readline = require('readline');
+const { google } = require('googleapis');
+// const OAuth2 = google.auth.OAuth2;
+
+@Injectable()
+export class GoogleService {
+ private oauth2Client: any;
+ private webClientSecret: string;
+ private webClientId: string;
+ private webRenderBaseUrl: string;
+
+ constructor(
+ private configService: ConfigService,
+ @InjectModel(User.name) // 注入 User 模型
+ private userModel: Model<User>,
+
+ private readonly redisService: RedisService,
+ @Inject(forwardRef(() => AuthService))
+ private readonly AuthService: AuthService,
+
+ ) {
+ this.oauth2Client = new google.auth.OAuth2();
+ this.initGoogleSecrets();
+ }
+
+ /**
+ * 初始化 OAuth2 客户端并设置凭证
+ * @param accessToken 传入的 access_token
+ */
+ setCredentials(accessToken: string) {
+ this.oauth2Client.setCredentials({
+ access_token: accessToken,
+ });
+ }
+
+ /**
+ * 获取初始化好的 OAuth2 客户端
+ * @returns 返回 OAuth2 客户端
+ */
+ getClient() {
+ return this.oauth2Client;
+ }
+
+ async initGoogleSecrets() {
+ this.webClientSecret = this.configService.get<string>("GOOGLE_CONFIG.WEB_CLIENT_SECRET");
+ this.webClientId = this.configService.get<string>("GOOGLE_CONFIG.WEB_CLIENT_ID");
+ this.webRenderBaseUrl = this.configService.get<string>("GOOGLE_CONFIG.WEB_RENDER_URL");
+ }
+
+ async getAuthCode(mail: string, platform: string, type: string) {
+ try {
+ // const { tokens } = await this.oauth2Client.getToken(code);
+ // this.oauth2Client.setCredentials(tokens);
+ // this.oauth2Client.credentials = tokens;
+
+
+ const state = getRandomString(8);
+ this.redisService.setKey(`google:state:${state}`, { mail }, 60 * 10);
+
+ // 根据参数platform选择 平台的权限
+ let platScope = "";
+ const platformScopes = {
+ google: [
+ "openid",
+ "email",
+ "https://www.googleapis.com/auth/calendar.readonly",
+ "https://www.googleapis.com/auth/userinfo.profile",
+ "https://www.googleapis.com/auth/youtube.force-ssl",
+ "https://www.googleapis.com/auth/youtube.readonly",
+ "https://www.googleapis.com/auth/youtube.upload",
+ "https://www.googleapis.com/auth/userinfo.profile"
+ ],
+ youtube: [
+ "https://www.googleapis.com/auth/youtube.force-ssl",
+ "https://www.googleapis.com/auth/youtube.readonly",
+ "https://www.googleapis.com/auth/youtube.upload",
+ "https://www.googleapis.com/auth/userinfo.profile"
+ ],
+ meta: [
+ "https://www.googleapis.com/auth/meta",
+ "https://www.googleapis.com/auth/userinfo.profile"
+ ]
+ };
+
+ if (platform === "google") {
+ platScope += "" + platformScopes.google.join(" ");
+ } else if (platformScopes.hasOwnProperty(platform)) {
+ platScope += " " + platformScopes[platform].join(" ");
+ }
+
+
+ const params = new URLSearchParams({
+ // scope: "openid email https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.upload",
+ // scope: "openid https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.upload",
+ scope: platScope,
+ access_type: "offline",
+ include_granted_scopes: "true",
+ response_type: "code",
+ state: state,
+ redirect_uri: `${this.webRenderBaseUrl}/api/plat/${platform}/auth/callback`,
+ client_id: this.webClientId,
+ // prompt: "none", // 默认 consent
+ prompt: "consent" // 强制重新授权
+ // login_hint: mail,
+ });
+ // const authUrl = `https://accounts.google.com/o/oauth2/v2/auth`;
+ const authUrl = new URL('https://accounts.google.com/o/oauth2/v2/auth');
+
+ // const result = await axios.post<{
+ // code: number; // 0;
+ // message: string; // '0';
+ // ttl: number; // 1;
+ // request_id: string; // '7b753a287405461f5afa526a1f672094';
+ // data: {
+ // upload_token: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ // };
+ // }>(url, body.toString(), {
+ // headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ // // headers: { 'Content-Type': 'application/json' }
+ // });
+ // // return result.data.data.upload_token;
+
+ // return result.data;
+
+ authUrl.search = params.toString();
+
+ return authUrl.toString(); // 返回生成的 URL
+
+ } catch (err) {
+ console.log('Error while trying to retrieve access token', err);
+ return err;
+ };
+ }
+
+
+ async getAuthCode_v2(platform: string, type: string) {
+ try {
+ const state = getRandomString(8);
+ // this.redisService.setKey(`google:state:${state}`, { mail }, 60 * 10);
+
+ console.log("++++++++++++++++++++++++")
+ console.log(this.webClientId);
+ console.log("++++++++++++++++++++++++")
+ // 根据参数platform选择 平台的权限
+ let platScope = "";
+ const platformScopes = {
+ google: [
+ "openid",
+ "email",
+ "https://www.googleapis.com/auth/calendar.readonly",
+ "https://www.googleapis.com/auth/userinfo.profile",
+ "https://www.googleapis.com/auth/youtube.force-ssl",
+ "https://www.googleapis.com/auth/youtube.readonly",
+ "https://www.googleapis.com/auth/youtube.upload",
+ "https://www.googleapis.com/auth/userinfo.profile"
+ ],
+ youtube: [
+ "https://www.googleapis.com/auth/youtube.force-ssl",
+ "https://www.googleapis.com/auth/youtube.readonly",
+ "https://www.googleapis.com/auth/youtube.upload",
+ "https://www.googleapis.com/auth/userinfo.profile"
+ ],
+ meta: [
+ "https://www.googleapis.com/auth/meta",
+ "https://www.googleapis.com/auth/userinfo.profile"
+ ]
+ };
+
+ if (platform === "google") {
+ platScope += "" + platformScopes.google.join(" ");
+ } else if (platformScopes.hasOwnProperty(platform)) {
+ platScope += " " + platformScopes[platform].join(" ");
+ }
+
+ const params = new URLSearchParams({
+ // scope: "openid email https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.upload",
+ // scope: "openid https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.upload",
+ scope: platScope,
+ access_type: "offline",
+ include_granted_scopes: "true",
+ response_type: "code",
+ state: state,
+ redirect_uri: `${this.webRenderBaseUrl}/api/plat/google/auth/accessToken`,
+ client_id: this.webClientId,
+ // prompt: "none", // 默认 consent
+ // prompt: "consent"
+ // login_hint: mail,
+ });
+ // const authUrl = `https://accounts.google.com/o/oauth2/v2/auth`;
+ const authUrl = new URL('https://accounts.google.com/o/oauth2/v2/auth');
+
+ // const result = await axios.post<{
+ // code: number; // 0;
+ // message: string; // '0';
+ // ttl: number; // 1;
+ // request_id: string; // '7b753a287405461f5afa526a1f672094';
+ // data: {
+ // upload_token: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ // };
+ // }>(url, body.toString(), {
+ // headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ // // headers: { 'Content-Type': 'application/json' }
+ // });
+ // // return result.data.data.upload_token;
+
+ // return result.data;
+
+ authUrl.search = params.toString();
+
+ return authUrl.toString(); // 返回生成的 URL
+
+ } catch (err) {
+ console.log('Error while trying to retrieve access token', err);
+ return err;
+ };
+ }
+
+
+ /**
+ * 获取授权Token
+ * @param code
+ * @returns
+ */
+ async setUserAccessToken(data: {
+ code: string;
+ state: string;
+ }) {
+
+ const { code, state } = data;
+ console.log("================ code state=======================")
+ console.log(code, state);
+ console.log("=============================================")
+
+ try {
+ const params = new URLSearchParams({
+ code: code,
+ redirect_uri: `${this.webRenderBaseUrl}/api/plat/google/auth/accessToken`,
+ client_id: this.webClientId,
+ grant_type: "authorization_code",
+ client_secret: this.webClientSecret,
+ });
+ const tokenUrl = `https://oauth2.googleapis.com/token`;
+
+ const result = await axios.post<{
+ access_token: string;
+ expires_in: number;
+ token_type: string;
+ refresh_token: string;
+ id_token: string;
+ }>(tokenUrl , params.toString(), {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ });
+
+ const mailInfo = await this.redisService.get(`google:state:${state}`);
+ // console.log("----------------");
+ // console.log(result.data);
+ // console.log("mail:", mailInfo);
+ const accessTokenInfo = result.data;
+
+ // 初始化 OAuth2 客户端
+ // const oAuth2Client = new google.auth.OAuth2();
+ this.oauth2Client.setCredentials({
+ access_token: accessTokenInfo.access_token,
+ });
+
+ const idToken = accessTokenInfo.id_token;
+ const ticket = await this.oauth2Client.verifyIdToken({ idToken, audience: this.webClientId });
+ const googleUser = ticket.getPayload();
+ const googleAccount = { // Google 唯一 ID
+ googleId: googleUser.sub,
+ email: googleUser.email,
+ accessToken: result.data.access_token,
+ refreshToken: result.data.refresh_token,
+ expiresAt: getCurrentTimestamp() + result.data.expires_in
+ };
+
+ let userInfo: User | null = null;
+ // 优先用 Google ID 查找(最准确)
+ if (googleUser.sub) {
+ userInfo = await this.userModel.findOne({
+ 'googleAccount.googleId': googleUser.sub,
+ status: UserStatus.OPEN,
+ });
+ }
+ // console.log("这里的info:", userInfo, googleUser.sub, googleUser.email)
+ // 如果没有找到,再用 email 兜底查找(存在被别人注册的风险,需谨慎)
+ if (!userInfo && googleUser.email) {
+ userInfo = await this.userModel.findOne({
+ mail: googleUser.email,
+ status: UserStatus.OPEN,
+ });
+ }
+ console.log("这里的info2222:", userInfo, googleUser.email)
+
+ if (userInfo) {
+ // 绑定 Google 信息
+ // userInfo.googleId = googleId;
+ // userInfo.mail = mailInfo.mail;
+ userInfo.googleAccount = googleAccount
+ // if(userInfo.googleAccount.googleId=== googleAccount.googleId) {
+ // userInfo.googleAccount = googleAccount; // 覆盖旧 token
+ // } else {
+ // userInfo.googleAccount.push(googleAccount); // 添加新 Google 帐号
+ // }
+
+ console.log("更新后的数据:--", userInfo.googleAccount, userInfo.id)
+ await this.userModel.updateOne(
+ { _id: Object(userInfo.id) },
+ { $set: { googleAccount: userInfo.googleAccount } },
+ );
+
+ // return userInfo;
+ } else {
+ console.log("用户不存在,创建");
+ const newData = {
+ name: `用户_${getRandomString(8)}`,
+ mail: mailInfo.mail,
+ googleAccount: googleAccount,
+ status: UserStatus.OPEN,
+ };
+
+ userInfo = await this.userModel.create(newData);
+ // console.log("新创建的用户:", userInfo);
+ }
+ console.log("userInfo22222:---", userInfo);
+ const userId = userInfo.id
+
+ this.redisService.del(`UserInfo:${userInfo.id}`);
+
+ const TokenInfo = {
+ phone: userInfo.phone,
+ id: userInfo.id,
+ name: userInfo.name,
+ isManager: false,
+ googleId: userInfo.googleAccount.googleId
+ }
+ console.log("发送获取systemToken的info---", TokenInfo);
+ const systemToken = await this.AuthService.generateToken(TokenInfo)
+ // 剩余有效秒数
+ // const expires =
+ // accessTokenInfo.expires_in - getCurrentTimestamp() - 60 * 60;
+
+ // const expires = 30 * 24 * 60 * 60
+ console.log("accessTokenInfo:---", accessTokenInfo);
+ // console.log("expires:---", accessTokenInfo.expires_in);
+ this.redisService.setKey(
+ `google:accessToken:${userId}`,
+ accessTokenInfo,
+ accessTokenInfo.expires_in
+ );
+
+ // return result.data;
+ return systemToken;
+ } catch (err) {
+ console.log('Error while trying to retrieve access token', err);
+ return err;
+ };
+ }
+
+ /**
+ * Google登录
+ * @param clientId Google客户端ID
+ * @param credential Google认证凭证
+ * @returns Account
+ */
+ async googleLogin(clientId: string, credential: string): Promise<any> {
+ try {
+ console.log('Verifying Google token with:');
+ // 验证Google token
+ const ticket = await this.oauth2Client.verifyIdToken({
+ idToken: credential,
+ audience: clientId,
+ });
+ console.log('ticket',ticket)
+ const googleUser = ticket.getPayload();
+ console.log('payload',googleUser)
+ if (!googleUser) {
+ throw new Error('Invalid Google token');
+ }
+
+ console.log('Google login success, googleUser:', googleUser);
+
+ const googleAccount = {
+ googleId: googleUser.sub,
+ email: googleUser.email,
+ // accessToken: result.data.access_token,
+ refreshToken: null,
+ // expiresAt: result.data.expires_in
+ };
+
+ let userInfo: User | null = null;
+ // 优先用 Google ID 查找(最准确)
+ if (googleUser.sub) {
+ userInfo = await this.userModel.findOne({
+ 'googleAccount.googleId': googleUser.sub,
+ status: UserStatus.OPEN,
+ });
+ }
+ // console.log("这里的info:", userInfo, googleUser.sub, googleUser.email)
+ // 如果没有找到,再用 email 兜底查找(存在被别人注册的风险,需谨慎)
+ if (!userInfo && googleUser.email) {
+ userInfo = await this.userModel.findOne({
+ mail: googleUser.email,
+ status: UserStatus.OPEN,
+ });
+ }
+ console.log("这里的info2222:", userInfo, googleUser.email)
+
+ if (userInfo) {
+ console.log("已有用户,更新绑定的 googleAccount:", userInfo);
+ // 绑定 Google 信息
+ // userInfo.googleId = googleId;
+ // userInfo.mail = mailInfo.mail;
+ // userInfo.googleAccount = googleAccount
+ // 合并逻辑:仅在新 refresh_token 存在时覆盖旧的
+ const updatedGoogleAccount = {
+ ...userInfo.googleAccount, // 原有内容
+ ...googleAccount, // 新数据覆盖(但不覆盖 refresh_token)
+ refreshToken: googleAccount.refreshToken != null && googleAccount.refreshToken !== ''
+ ? googleAccount.refreshToken
+ : userInfo.googleAccount?.refreshToken,
+ };
+
+ console.log("更新后的数据:--", updatedGoogleAccount, userInfo.id);
+
+ // console.log("更新后的数据:--", userInfo.googleAccount, userInfo.id)
+ // await this.userModel.updateOne(
+ // { _id: Object(userInfo.id) },
+ // { $set: { googleAccount: userInfo.googleAccount } },
+ // );
+ await this.userModel.updateOne(
+ { _id: Object(userInfo.id) },
+ { $set: { googleAccount: updatedGoogleAccount } },
+ );
+
+ // return userInfo;
+ } else {
+ console.log("用户不存在,创建");
+ const newData = {
+ name: `用户_${getRandomString(8)}`,
+ mail: googleUser.email,
+ googleAccount: googleAccount,
+ status: UserStatus.OPEN,
+ };
+
+ userInfo = await this.userModel.create(newData);
+ // console.log("新创建的用户:", userInfo);
+ }
+ console.log("userInfo22222:---", userInfo);
+ this.redisService.del(`UserInfo:${userInfo.id}`);
+
+ const TokenInfo = {
+ phone: userInfo.phone,
+ id: userInfo.id,
+ name: userInfo.name,
+ isManager: false,
+ createTime: userInfo.createTime,
+ mail: userInfo.mail,
+ status: userInfo.status,
+ updateTime: userInfo.updateTime,
+ googleAccount: userInfo.googleAccount
+ }
+ console.log("发送获取systemToken的info---", TokenInfo);
+ const systemToken = await this.AuthService.generateToken(TokenInfo)
+ // 剩余有效秒数
+ // const expires =
+ // accessTokenInfo.expires_in - getCurrentTimestamp() - 60 * 60;
+
+ // const expires = 30 * 24 * 60 * 60
+ // console.log("accessTokenInfo:---", accessTokenInfo);
+ // console.log("expires:---", accessTokenInfo.expires_in);
+ // this.redisService.setKey(
+ // `google:accessToken:${userId}`,
+ // accessTokenInfo,
+ // accessTokenInfo.expires_in
+ // );
+ const loginResult = {
+ token: null,
+ type: "login",
+ userInfo: TokenInfo
+ }
+ loginResult.token = systemToken
+ return loginResult;
+ } catch (error) {
+ console.error('Google login error:', error);
+ throw new Error(`Google login failed: ${error.message}`);
+ }
+ }
+
+ async setUserAccessToken_V2(data: {
+ code: string;
+ state: string;
+ }) {
+
+ const { code, state } = data;
+ console.log("================ code state=======================")
+ console.log(code, state);
+ console.log("=============================================")
+
+ try {
+ const params = new URLSearchParams({
+ code: code,
+ redirect_uri: `${this.webRenderBaseUrl}/api/plat/google/auth/accessToken`,
+ client_id: this.webClientId,
+ grant_type: "authorization_code",
+ client_secret: this.webClientSecret,
+ });
+ const tokenUrl = `https://oauth2.googleapis.com/token`;
+
+ const result = await axios.post<{
+ access_token: string;
+ expires_in: number;
+ token_type: string;
+ refresh_token: string;
+ id_token: string;
+ }>(tokenUrl , params.toString(), {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ // headers: { 'Content-Type': 'application/json' }
+ });
+
+ // const mailInfo = await this.redisService.get(`google:state:${state}`);
+ console.log("----------------");
+ console.log(result.data);
+ // console.log("mail:", mailInfo);
+ const accessTokenInfo = result.data;
+
+ // 初始化 OAuth2 客户端
+ // const oAuth2Client = new google.auth.OAuth2();
+ this.oauth2Client.setCredentials({
+ access_token: accessTokenInfo.access_token,
+ });
+
+ const idToken = accessTokenInfo.id_token;
+ const ticket = await this.oauth2Client.verifyIdToken({ idToken, audience: this.webClientId });
+ const googleUser = ticket.getPayload();
+ console.log(googleUser);
+ // const googleId = googleUser.sub; // Google 唯一 ID
+ const googleAccount = {
+ googleId: googleUser.sub,
+ email: googleUser.email,
+ accessToken: result.data.access_token,
+ refreshToken: result.data.refresh_token,
+ expiresAt: getCurrentTimestamp() + result.data.expires_in
+ };
+
+ let userInfo: User | null = null;
+ // 优先用 Google ID 查找(最准确)
+ if (googleUser.sub) {
+ userInfo = await this.userModel.findOne({
+ 'googleAccount.googleId': googleUser.sub,
+ status: UserStatus.OPEN,
+ });
+ }
+ // console.log("这里的info:", userInfo, googleUser.sub, googleUser.email)
+ // 如果没有找到,再用 email 兜底查找(存在被别人注册的风险,需谨慎)
+ if (!userInfo && googleUser.email) {
+ userInfo = await this.userModel.findOne({
+ mail: googleUser.email,
+ status: UserStatus.OPEN,
+ });
+ }
+ console.log("这里的info2222:", userInfo, googleUser.email)
+
+ if (userInfo) {
+ console.log("已有用户,更新绑定的 googleAccount:", userInfo);
+ // 绑定 Google 信息
+ // userInfo.googleId = googleId;
+ // userInfo.mail = mailInfo.mail;
+ // userInfo.googleAccount = googleAccount
+ // 合并逻辑:仅在新 refresh_token 存在时覆盖旧的
+ const updatedGoogleAccount = {
+ ...userInfo.googleAccount, // 原有内容
+ ...googleAccount, // 新数据覆盖(但不覆盖 refresh_token)
+ refreshToken: googleAccount.refreshToken != null && googleAccount.refreshToken !== ''
+ ? googleAccount.refreshToken
+ : userInfo.googleAccount?.refreshToken,
+ };
+
+ console.log("更新后的数据:--", updatedGoogleAccount, userInfo.id);
+
+ // console.log("更新后的数据:--", userInfo.googleAccount, userInfo.id)
+ // await this.userModel.updateOne(
+ // { _id: Object(userInfo.id) },
+ // { $set: { googleAccount: userInfo.googleAccount } },
+ // );
+ await this.userModel.updateOne(
+ { _id: Object(userInfo.id) },
+ { $set: { googleAccount: updatedGoogleAccount } },
+ );
+
+ // return userInfo;
+ } else {
+ console.log("用户不存在,创建");
+ const newData = {
+ name: `用户_${getRandomString(8)}`,
+ mail: googleUser.email,
+ googleAccount: googleAccount,
+ status: UserStatus.OPEN,
+ };
+
+ userInfo = await this.userModel.create(newData);
+ // console.log("新创建的用户:", userInfo);
+ }
+ console.log("userInfo22222:---", userInfo);
+ const userId = userInfo.id
+
+ this.redisService.del(`UserInfo:${userInfo.id}`);
+
+ const TokenInfo = {
+ phone: userInfo.phone,
+ id: userInfo.id,
+ name: userInfo.name,
+ isManager: false,
+ googleId: userInfo.googleAccount.googleId,
+ mail: userInfo.mail
+ }
+ console.log("发送获取systemToken的info---", TokenInfo);
+ const systemToken = await this.AuthService.generateToken(TokenInfo)
+ // 剩余有效秒数
+ // const expires =
+ // accessTokenInfo.expires_in - getCurrentTimestamp() - 60 * 60;
+
+ // const expires = 30 * 24 * 60 * 60
+ console.log("accessTokenInfo:---", accessTokenInfo);
+ // console.log("expires:---", accessTokenInfo.expires_in);
+ this.redisService.setKey(
+ `google:accessToken:${userId}`,
+ accessTokenInfo,
+ accessTokenInfo.expires_in
+ );
+
+ const loginResult = {
+ token: null,
+ type: "login",
+ userInfo: TokenInfo
+ }
+ loginResult.token = systemToken
+ return loginResult;
+
+ // return result.data;
+ // return systemToken;
+ } catch (err) {
+ console.log('Error while trying to retrieve access token', err);
+ return err;
+ };
+ }
+
+ async getUserAccessToken(userId: string): Promise<string> {
+ const res: AccessToken = await this.redisService.get(
+ `google:accessToken:${userId}`,
+ );
+ // if (!res) return '';
+
+ // // 剩余时间
+ // const overTime = res.expires_in;
+
+ // if (overTime < 60 * 60 && overTime > 0) {
+ // // 刷新token
+ // this.refreshAccessToken(userId, res.refresh_token);
+ // }
+ const userInfo = await this.userModel.findOne({_id: userId});
+ this.refreshAccessToken(userId, userInfo.googleAccount.refreshToken);
+ return res.access_token;
+ }
+
+ /**
+ * 刷新授权Token
+ * @param refreshToken
+ * @returns
+ */
+ async refreshAccessToken(userId: string, refreshToken?: string) {
+ try {
+ const userInfo = await this.userModel.findOne({_id: userId});
+ if(!refreshToken) {
+
+ console.log("=============userInfo====================");
+ console.log(userInfo)
+ refreshToken = userInfo?.googleAccount?.refreshToken ?? ''
+ }
+
+ const tokenUrl = 'https://oauth2.googleapis.com/token';
+
+ // 请求体的参数
+ const params = new URLSearchParams({
+ client_id: this.webClientId, // 使用你的 client_id
+ client_secret: this.webClientSecret, // 使用你的 client_secret
+ refresh_token: refreshToken, // 提供刷新令牌
+ grant_type: 'refresh_token', // 认证类型是刷新令牌
+ });
+
+ // 发送 POST 请求到 Google token endpoint 来刷新 access token
+ const response = await axios.post(tokenUrl, params.toString(), {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ });
+ console.log("================response================")
+ console.log(response);
+ const accessTokenInfo = response.data;
+ // console.log("================accessTokenInfo================")
+ // console.log(accessTokenInfo);
+ // 剩余有效秒数
+ const expires = accessTokenInfo.expires_in
+ // accessTokenInfo.expires_in - getCurrentTimestamp() - 60 * 60;
+ this.redisService.setKey(
+ `google:accessToken:${userId}`,
+ accessTokenInfo,
+ expires,
+ );
+
+
+ const TokenInfo = {
+ phone: userInfo?.phone ?? '', // 如果 userInfo.phone 为 undefined 或 null,则使用空字符串
+ id: userId,
+ name: userInfo.name,
+ isManager: false,
+ googleId: userInfo?.googleAccount?.googleId ?? ''
+ }
+ console.log("发送获取systemToken的info---", TokenInfo);
+ const systemToken = await this.AuthService.generateToken(TokenInfo)
+ // 剩余有效秒数
+ // const expires =
+ // accessTokenInfo.expires_in - getCurrentTimestamp() - 60 * 60;
+
+ // const expires = 30 * 24 * 60 * 60
+ console.log("accessTokenInfo:---", accessTokenInfo);
+ // console.log("expires:---", accessTokenInfo.expires_in);
+ this.redisService.setKey(
+ `google:accessToken:${userId}`,
+ accessTokenInfo,
+ accessTokenInfo.expires_in
+ );
+
+ // return result.data;
+ return systemToken;
+
+
+ // 返回新的 access token 和其他信息
+ // return response.data; // 包含新的 access_token、expires_in、token_type 等信息
+ } catch (err) {
+ console.log('Error while refreshing access token', err);
+ throw new Error('Failed to refresh access token');
+ }
+ }
+
+ /**
+ * 查询用户已授权权限列表
+ * @returns
+ */
+ async getAccountScopes(accessToken: string) {
+ try {
+ // 初始化 OAuth2 客户端
+ // const oAuth2Client = new google.auth.OAuth2();
+ this.oauth2Client.setCredentials({
+ access_token: accessToken,
+ });
+
+ // 通过访问 token 查询 token 信息
+ const tokenInfo = await google.oauth2('v2').tokeninfo({
+ access_token: accessToken,
+ });
+
+ console.log('Token Info:', tokenInfo.data);
+
+ // 查询用户的基本信息
+ const userInfo = await google.oauth2('v2').userinfo.get({
+ auth: this.oauth2Client,
+ });
+
+ console.log('User Info:', userInfo.data);
+
+ // 返回用户的权限和信息
+ return {
+ tokenInfo: tokenInfo.data,
+ userInfo: userInfo.data,
+ };
+ } catch (error) {
+ console.error('Error getting user permissions:', error);
+ throw new Error('Failed to get user permissions');
+ }
+ }
+
+ /**
+ * 获取已授权的用户信息
+ * @param data
+ */
+ async getUserInfo(accessToken: string, token) {
+ try {
+ const response = await axios.get('https://www.googleapis.com/oauth2/v3/userinfo', {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ });
+
+ // 返回用户信息
+ return response.data;
+ } catch (err) {
+ console.error('Error fetching user info:', err);
+ throw new Error('Failed to fetch user info');
+ }
+ }
+
+}
+
+
diff --git a/server/src/modules/plat/gzh/comment.ts b/server/src/modules/plat/gzh/comment.ts
new file mode 100644
index 00000000..389fec52
--- /dev/null
+++ b/server/src/modules/plat/gzh/comment.ts
@@ -0,0 +1,4 @@
+export enum VideoUTypes {
+ Little = 0,
+ Big = 1,
+}
diff --git a/server/src/modules/plat/gzh/dto/bilibili.dto.ts b/server/src/modules/plat/gzh/dto/bilibili.dto.ts
new file mode 100644
index 00000000..c06a4457
--- /dev/null
+++ b/server/src/modules/plat/gzh/dto/bilibili.dto.ts
@@ -0,0 +1,114 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:16:37
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import {
+ IsArray,
+ IsEnum,
+ IsNotEmpty,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { VideoUTypes } from '../comment';
+
+export class AccessBackDto {
+ @Expose()
+ code: string;
+
+ @Expose()
+ state: string;
+}
+
+export class VideoInitDto {
+ @ApiProperty({ title: '文件名称(带格式)', required: true })
+ @IsString({ message: '文件名称' })
+ @Expose()
+ readonly fileName: string;
+
+ @ApiProperty({ enum: VideoUTypes })
+ @IsNotEmpty({ message: '文件类型不能为空' })
+ @IsEnum(VideoUTypes)
+ @Type(() => Number)
+ @Expose()
+ readonly utype: VideoUTypes;
+}
+
+export class ArchiveAddByUtokenQueryDto {
+ @ApiProperty({ title: '用户token', required: true })
+ @IsString({ message: '用户token' })
+ @Expose()
+ readonly accessToken: string;
+
+ @ApiProperty({ title: '上传token', required: true })
+ @IsString({ message: '上传token' })
+ @Expose()
+ readonly uploadToken: string;
+}
+
+export class ArchiveAddByUtokenBodyDto {
+ @ApiProperty({ title: '标题', required: true })
+ @IsString({ message: '标题' })
+ @Expose()
+ readonly title: string;
+
+ @ApiProperty({ title: '封面url', required: false })
+ @IsString({ message: '封面url' })
+ @IsOptional()
+ @Expose()
+ readonly cover?: string;
+
+ @ApiProperty({ title: '分区ID,由获取分区信息接口得到', required: true })
+ @IsNumber({ allowNaN: false }, { message: '分区ID,由获取分区信息接口得到' })
+ @Expose()
+ readonly tid: number;
+
+ @ApiProperty({
+ title: '是否允许转载 0-允许,1-不允许。默认0',
+ required: true,
+ })
+ @IsNumber(
+ { allowNaN: false },
+ { message: '是否允许转载 0-允许,1-不允许。默认0' },
+ )
+ @IsOptional()
+ @Expose()
+ readonly noReprint?: 0 | 1;
+
+ @ApiProperty({ title: '描述', required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ title: '标签', required: false })
+ @IsArray({ message: '标签必须是字符串数组' })
+ @IsString({ each: true, message: '描述' })
+ @Expose()
+ readonly tag: string[];
+
+ @ApiProperty({
+ title: '1-原创,2-转载(转载时source必填)',
+ required: true,
+ })
+ @IsNumber(
+ { allowNaN: false },
+ { message: '1-原创,2-转载(转载时source必填)' },
+ )
+ @Expose()
+ readonly copyright: 1 | 2;
+
+ @ApiProperty({
+ title: '如果copyright为转载,则此字段表示转载来源',
+ required: false,
+ })
+ @IsString({ message: '如果copyright为转载,则此字段表示转载来源' })
+ @IsOptional()
+ @Expose()
+ readonly source?: string;
+}
diff --git a/server/src/modules/plat/gzh/gzh.controller.ts b/server/src/modules/plat/gzh/gzh.controller.ts
new file mode 100644
index 00000000..49420589
--- /dev/null
+++ b/server/src/modules/plat/gzh/gzh.controller.ts
@@ -0,0 +1,93 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:00:18
+ * @LastEditors: nevin
+ * @Description: signIn SignIn 签到
+ */
+import {
+ Body,
+ Controller,
+ Get,
+ Param,
+ Post,
+ Query,
+ UploadedFile,
+ UseInterceptors,
+} from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import {
+ AccessBackDto,
+ ArchiveAddByUtokenBodyDto,
+ ArchiveAddByUtokenQueryDto,
+} from './dto/bilibili.dto';
+import { GzhService } from './gzh.service';
+import { Public } from 'src/auth/auth.guard';
+import { FileInterceptor } from '@nestjs/platform-express';
+
+@ApiTags('plat/gzh - B站平台')
+@Controller('plat/gzh')
+export class GzhController {
+ constructor(private readonly bilibiliService: GzhService) {}
+
+ @ApiOperation({ summary: '获取AccessToken' })
+ @Public()
+ @Get('accessToken')
+ async getAccessToken(@Query() query: AccessBackDto) {
+ // const res = await this.bilibiliService.getAccessToken(query.code);
+ // return res;
+ }
+
+ @ApiOperation({ summary: '刷新授权Token' })
+ @Get('refreshAccessToken/:refreshToken')
+ async refreshAccessToken(@Param('refreshToken') refreshToken: string) {
+ return this.bilibiliService.refreshAccessToken(refreshToken);
+ }
+
+ @ApiOperation({ summary: '查询用户已授权权限列表' })
+ @Get('account/scopes/:accessToken')
+ async getAccountScopes(@Param('accessToken') accessToken: string) {
+ return this.bilibiliService.getAccountScopes(accessToken);
+ }
+
+ @ApiOperation({ summary: '视频初始化' })
+ @Post('video/init/:accessToken')
+ async videoInit(@Param('accessToken') accessToken: string) {
+ return this.bilibiliService.videoInit(accessToken);
+ }
+
+ @ApiOperation({ summary: '封面上传' })
+ @UseInterceptors(FileInterceptor('file'))
+ @Post('cover/upload')
+ async coverUpload(
+ @Param('accessToken') accessToken: string,
+ @UploadedFile() file: Express.Multer.File,
+ ) {
+ return this.bilibiliService.coverUpload(accessToken, file);
+ }
+
+ @ApiOperation({ summary: '视频稿件提交' })
+ @Post('archive/add-by-utoken')
+ async archiveAddByUtoken(
+ @Query() query: ArchiveAddByUtokenQueryDto,
+ @Body() body: ArchiveAddByUtokenBodyDto,
+ ) {
+ const data = {
+ ...body,
+ no_reprint: body.noReprint,
+ tag: body.tag.join(','),
+ };
+ const { accessToken, uploadToken } = query;
+ // return this.bilibiliService.archiveAddByUtoken(
+ // accessToken,
+ // uploadToken,
+ // data,
+ // );
+ }
+
+ @ApiOperation({ summary: '分区查询' })
+ @Get('archive/type/list/:accessToken')
+ async archiveTypeList(@Param('accessToken') accessToken: string) {
+ return this.bilibiliService.archiveTypeList(accessToken);
+ }
+}
diff --git a/server/src/modules/plat/gzh/gzh.module.ts b/server/src/modules/plat/gzh/gzh.module.ts
new file mode 100644
index 00000000..3f769aed
--- /dev/null
+++ b/server/src/modules/plat/gzh/gzh.module.ts
@@ -0,0 +1,22 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-04-27 17:36:19
+ * @LastEditors: nevin
+ * @Description: Gzh 公众号模块
+ */
+import { Module } from '@nestjs/common';
+import { MongooseModule } from '@nestjs/mongoose';
+import { SignIn, SignInSchema } from 'src/db/schema/signIn.schema';
+import { GzhController } from './gzh.controller';
+import { GzhService } from './gzh.service';
+
+@Module({
+ imports: [
+ MongooseModule.forFeature([{ name: SignIn.name, schema: SignInSchema }]),
+ ],
+ controllers: [GzhController],
+ providers: [GzhService],
+ exports: [GzhService],
+})
+export class GzhModule {}
diff --git a/server/src/modules/plat/gzh/gzh.service.ts b/server/src/modules/plat/gzh/gzh.service.ts
new file mode 100644
index 00000000..b0c800f1
--- /dev/null
+++ b/server/src/modules/plat/gzh/gzh.service.ts
@@ -0,0 +1,224 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 17:58:21
+ * @LastEditors: nevin
+ * @Description: gzh Gzh 公众号
+ */
+import { Injectable } from '@nestjs/common';
+import axios from 'axios';
+import { v4 as uuidv4 } from 'uuid';
+import { createHash, createHmac } from 'crypto';
+import { VideoUTypes } from './comment';
+
+@Injectable()
+export class GzhService {
+ private componentAppid = '';
+ private componentAppsecret = '';
+ constructor() {}
+
+ /**
+ * 获取授权Token
+ * @param ticket 票据
+ * @returns
+ */
+ async getComponentAccessToken(ticket: string) {
+ const url = `https://api.weixin.qq.com/cgi-bin/component/api_component_token`;
+ const result = await axios.post<{
+ component_access_token: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ expires_in: number; // 1630220614;
+ }>(url, {
+ component_appid: this.componentAppid,
+ component_appsecret: this.componentAppsecret,
+ component_verify_ticket: ticket,
+ });
+
+ return result.data;
+ }
+
+ /**
+ * 刷新授权Token
+ * @param refreshToken
+ * @returns
+ */
+ async refreshAccessToken(refreshToken: string) {
+ return null;
+ }
+
+ /**
+ * 查询用户已授权权限列表
+ * @returns
+ */
+ async getAccountScopes(accessToken: string) {
+ const url = `https://member.bilibili.com/arcopen/fn/user/account/scopes`;
+ const result = await axios.get<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ data: {
+ openid: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ scopes: string[]; // ['USER_INFO', 'ATC_DATA', 'ATC_BASE'];
+ };
+ }>(url, {
+ headers: this.generateBilibiliHeader({
+ accessToken,
+ isForm: true,
+ }),
+ });
+
+ return result.data.data;
+ }
+
+ /**
+ * 生成请求头
+ * @param data
+ */
+ private generateBilibiliHeader(data: {
+ accessToken: string;
+ body?: { [key: string]: any };
+ isForm?: boolean;
+ }) {
+ const { accessToken, body, isForm } = data;
+ const xBiliContentMd5 = body
+ ? createHash('md5').update(JSON.stringify(body)).digest('hex')
+ : '';
+
+ const header = {
+ Accept: 'application/json',
+ 'Content-Type': isForm ? 'multipart/form-data' : 'application/json', // 或者 multipart/form-data
+ 'x-bili-content-md5': xBiliContentMd5,
+ 'x-bili-timestamp': Math.floor(Date.now() / 1000),
+ 'x-bili-signature-method': 'HMAC-SHA256',
+ 'x-bili-signature-nonce': uuidv4(),
+ 'x-bili-signature-version': '1.0',
+ 'access-token': accessToken, // 需要在请求头中添加access-token
+ Authorization: '',
+ };
+
+ // 抽取带”x-bili-“前缀的自定义header,按字典排序拼接,构建完整的待签名字符串:
+ // 待签名字符串包含换行符\n
+ const headerStr = Object.keys(header)
+ .filter((key) => key.startsWith('x-bili-'))
+ .sort()
+ .map((key) => `${key}:${header[key]}\n`)
+ .join('');
+
+ // 使用 createHmac 正确创建签名
+ const signature = createHmac('sha256', '').update(headerStr).digest('hex');
+
+ // 将签名加入 header
+ header.Authorization = signature;
+
+ return header;
+ }
+
+ /**
+ * 视频初始化
+ * @param fileName
+ * @param utype // 1-单个小文件(不超过100M)。默认值为0
+ * @returns
+ */
+ async videoInit(fileName: string, utype: VideoUTypes = 0): Promise<string> {
+ const body = {
+ name: fileName, // test.mp4
+ utype,
+ };
+
+ const url = `https://member.bilibili.com/arcopen/fn/archive/video/init`;
+ const result = await axios.post<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ request_id: string; // '7b753a287405461f5afa526a1f672094';
+ data: {
+ upload_token: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ };
+ }>(url, body);
+ return result.data.data.upload_token;
+ }
+
+ /**
+ * 封面上传
+ * @param accessToken
+ * @param file
+ * @returns
+ */
+ async coverUpload(
+ accessToken: string,
+ file: Express.Multer.File,
+ ): Promise<string> {
+ const url = `https://member.bilibili.com/arcopen/fn/archive/cover/upload`;
+
+ const formData = new FormData();
+ const blob = new Blob([file.buffer], { type: file.mimetype });
+ formData.append('file', blob, file.originalname);
+
+ const result = await axios.post<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ request_id: string; // '7b753a287405461f5afa526a1f672094';
+ data: {
+ url: string; // "https://archive.biliimg.com/bfs/..."
+ };
+ }>(url, formData, {
+ headers: this.generateBilibiliHeader({
+ accessToken: accessToken,
+ isForm: true,
+ }),
+ });
+ return result.data.data.url;
+ }
+
+ /**
+ * 公众号素材发布
+ * @param accessToken
+ * @param mediaId
+ * @returns
+ */
+ async freepublishSubmit(
+ accessToken: string,
+ mediaId: string,
+ ): Promise<string> {
+ const url = `https://api.weixin.qq.com/cgi-bin/freepublish/submit?access_token=${accessToken}`;
+
+ const result = await axios.post<{
+ errcode: number; // 0;
+ errmsg: string; // 'ok';
+ publish_id: string; // '100000001';
+ }>(
+ url,
+ {
+ media_id: mediaId,
+ },
+ {
+ headers: this.generateBilibiliHeader({
+ accessToken,
+ }),
+ },
+ );
+ return result.data.publish_id;
+ }
+
+ /**
+ * 分区查询
+ * @param accessToken
+ * @returns
+ */
+ async archiveTypeList(accessToken: string) {
+ const url = `https://member.bilibili.com/arcopen/fn/archive/type/list`;
+
+ const result = await axios.get<{
+ code: number; // 0;
+ message: string; // '0';
+ ttl: number; // 1;
+ request_id: string; // '35f4a1e0d3765a92510f919d0b6721dd';
+ data: any;
+ }>(url, {
+ headers: this.generateBilibiliHeader({
+ accessToken,
+ }),
+ });
+ return result.data.data;
+ }
+}
diff --git a/server/src/modules/plat/plat.module.ts b/server/src/modules/plat/plat.module.ts
new file mode 100644
index 00000000..e0415d47
--- /dev/null
+++ b/server/src/modules/plat/plat.module.ts
@@ -0,0 +1,19 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-04-27 17:36:19
+ * @LastEditors: nevin
+ * @Description: plat Plat 三方平台模块
+ */
+import { Module } from '@nestjs/common';
+import { BilibiliModule } from './bilibili/bilibili.module';
+import { GzhModule } from './gzh/gzh.module';
+import { GoogleModule } from './google/google.module';
+import { YoutubeModule } from './youtube/youtube.module';
+import { TwitterModule } from './twitter/twitter.module';
+import { TiktokModule } from './tiktok/tiktok.module';
+
+@Module({
+ imports: [BilibiliModule, GzhModule, GoogleModule, YoutubeModule, TwitterModule, TiktokModule],
+})
+export class PlatModule {}
diff --git a/server/src/modules/plat/tiktok/comment.ts b/server/src/modules/plat/tiktok/comment.ts
new file mode 100644
index 00000000..e69de29b
diff --git a/server/src/modules/plat/tiktok/dto/tiktok.dto.ts b/server/src/modules/plat/tiktok/dto/tiktok.dto.ts
new file mode 100644
index 00000000..ce84bdb2
--- /dev/null
+++ b/server/src/modules/plat/tiktok/dto/tiktok.dto.ts
@@ -0,0 +1,158 @@
+import { IsString, IsOptional, IsArray, IsNumber, IsBoolean, IsUrl } from 'class-validator';
+import { ApiProperty } from '@nestjs/swagger';
+
+export class CreateVideoDto {
+ @ApiProperty({ description: 'TikTok账号ID' })
+ @IsString()
+ accountId: string;
+
+ @ApiProperty({ description: '视频描述/标题' })
+ @IsString()
+ description: string;
+
+ @ApiProperty({ description: '视频是否为私有', required: false, default: false })
+ @IsBoolean()
+ @IsOptional()
+ private?: boolean;
+
+ @ApiProperty({ description: '视频话题标签列表', required: false, type: [String] })
+ @IsArray()
+ @IsOptional()
+ hashtags?: string[];
+}
+
+export class TikTokCommentDto {
+ @ApiProperty({ description: 'TikTok账号ID' })
+ @IsString()
+ accountId: string;
+
+ @ApiProperty({ description: '视频ID' })
+ @IsString()
+ videoId: string;
+
+ @ApiProperty({ description: '评论内容' })
+ @IsString()
+ text: string;
+}
+
+export class GetVideosQueryDto {
+ @ApiProperty({ description: 'TikTok账号ID' })
+ @IsString()
+ accountId: string;
+
+ @ApiProperty({ description: '每页结果数', required: false, default: 10 })
+ @IsNumber()
+ @IsOptional()
+ limit?: number;
+
+ @ApiProperty({ description: '用于分页的游标', required: false })
+ @IsString()
+ @IsOptional()
+ cursor?: string;
+}
+
+export class TikTokVideoFilterDto {
+ @ApiProperty({ description: 'TikTok账号ID' })
+ @IsString()
+ accountId: string;
+
+ @ApiProperty({ description: '关键词搜索', required: false })
+ @IsString()
+ @IsOptional()
+ keyword?: string;
+
+ @ApiProperty({ description: '最低播放次数', required: false })
+ @IsNumber()
+ @IsOptional()
+ minPlayCount?: number;
+
+ @ApiProperty({ description: '每页结果数', required: false, default: 10 })
+ @IsNumber()
+ @IsOptional()
+ limit?: number;
+
+ @ApiProperty({ description: '用于分页的游标', required: false })
+ @IsString()
+ @IsOptional()
+ cursor?: string;
+}
+
+export interface TikTokOAuthTokenResponse {
+ access_token: string;
+ refresh_token: string;
+ expires_in: number;
+ token_type: string;
+ scope: string;
+ open_id: string;
+}
+
+export interface TikTokUser {
+ open_id: string;
+ union_id: string;
+ username: string;
+ display_name: string;
+ avatar_url: string;
+ bio_description: string;
+ profile_deep_link: string;
+ is_verified: boolean;
+ follower_count: number;
+ following_count: number;
+ likes_count: number;
+ video_count: number;
+}
+
+export class CombinedVideoUploadDto {
+ @ApiProperty({ description: 'TikTok账号ID' })
+ @IsString()
+ accountId: string;
+
+ @ApiProperty({ description: '视频标题', required: false })
+ @IsString()
+ @IsOptional()
+ title?: string;
+
+ @ApiProperty({ description: '视频描述', required: false })
+ @IsString()
+ @IsOptional()
+ description?: string;
+
+ @ApiProperty({ description: '隐私级别', required: false, default: 'PUBLIC', enum: ['PUBLIC', 'PRIVATE', 'FRIENDS'] })
+ @IsString()
+ @IsOptional()
+ privacyStatus?: string;
+
+ @ApiProperty({ description: '是否禁用评论', required: false, default: false })
+ @IsBoolean()
+ @IsOptional()
+ disableComment?: boolean;
+
+ @ApiProperty({ description: '是否禁用二重奏', required: false, default: false })
+ @IsBoolean()
+ @IsOptional()
+ disableDuet?: boolean;
+
+ @ApiProperty({ description: '是否禁用Stitch', required: false, default: false })
+ @IsBoolean()
+ @IsOptional()
+ disableStitch?: boolean;
+
+ @ApiProperty({ description: '视频封面时间点(毫秒)', required: false })
+ @IsNumber()
+ @IsOptional()
+ videoCoverTimestampMs?: number;
+
+ @ApiProperty({ description: '话题标签列表', required: false, type: [String] })
+ @IsArray()
+ @IsOptional()
+ tags?: string[];
+
+ @ApiProperty({ description: '轮询间隔(毫秒)', required: false, default: 2000 })
+ @IsNumber()
+ @IsOptional()
+ pollInterval?: number;
+
+ @ApiProperty({ description: '最大重试次数', required: false, default: 30 })
+ @IsNumber()
+ @IsOptional()
+ maxRetries?: number;
+}
diff --git a/server/src/modules/plat/tiktok/tiktok.auth.service.ts b/server/src/modules/plat/tiktok/tiktok.auth.service.ts
new file mode 100644
index 00000000..de7f77bc
--- /dev/null
+++ b/server/src/modules/plat/tiktok/tiktok.auth.service.ts
@@ -0,0 +1,587 @@
+import { Injectable, Inject, forwardRef, BadRequestException, HttpException, HttpStatus, Logger } from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+import { HttpService } from '@nestjs/axios';
+import { Model } from 'mongoose';
+import { InjectModel } from '@nestjs/mongoose';
+import { firstValueFrom } from 'rxjs';
+import * as crypto from 'crypto';
+
+import { RedisService } from 'src/lib/redis/redis.service';
+import { IdService } from 'src/db/id.service';
+
+import { AuthService } from 'src/auth/auth.service';
+import { AccountService } from 'src/modules/account/account.service';
+import { User } from 'src/db/schema/user.schema';
+import { Account, AccountType, AccountStatus } from 'src/db/schema/account.schema';
+import { AccountToken, TokenPlatform, TokenStatus } from 'src/db/schema/accountToken.schema';
+import { TikTokOAuthTokenResponse, TikTokUser } from './dto/tiktok.dto';
+
+// 工具函数
+function getCurrentTimestamp(): number {
+ return Math.floor(Date.now() / 1000);
+}
+
+@Injectable()
+export class TikTokAuthService {
+ private readonly logger = new Logger(TikTokAuthService.name);
+ private clientId: string;
+ private clientSecret: string;
+ private redirectUri: string;
+ private authUrl: string;
+ private tokenUrl: string;
+ private revokeUrl: string;
+ private refreshTokenUrl: string;
+ private apiBaseUrl: string;
+ private scopes: string;
+
+ private state: string;
+
+ constructor(
+ private readonly configService: ConfigService,
+ private readonly httpService: HttpService,
+ private readonly redisService: RedisService,
+
+ @Inject(forwardRef(() => AuthService))
+ private readonly authService: AuthService,
+
+ @Inject(forwardRef(() => AccountService))
+ private readonly accountService: AccountService,
+
+ @InjectModel(User.name) private readonly userModel: Model<User>,
+ @InjectModel(Account.name) private readonly accountModel: Model<Account>,
+ @InjectModel(AccountToken.name) private readonly accountTokenModel: Model<AccountToken>,
+ ) {
+ this.initTikTokSecrets();
+ }
+
+ /**
+ * 初始化TikTok API密钥和配置
+ */
+ private initTikTokSecrets() {
+ const tikTokConfig = this.configService.get('tiktok');
+ if (!tikTokConfig) {
+ throw new Error('TikTok配置未找到,请检查环境变量和配置文件');
+ }
+
+ this.clientId = tikTokConfig.clientId;
+ this.clientSecret = tikTokConfig.clientSecret;
+ this.redirectUri = tikTokConfig.redirectUri;
+ this.authUrl = tikTokConfig.authUrl;
+ this.tokenUrl = tikTokConfig.tokenUrl;
+ this.revokeUrl = tikTokConfig.revokeUrl;
+ this.refreshTokenUrl = tikTokConfig.refreshTokenUrl;
+ this.apiBaseUrl = tikTokConfig.apiBaseUrl;
+ this.scopes = tikTokConfig.scopes;
+
+ if (!this.clientId || !this.clientSecret) {
+ this.logger.error('TikTok客户端ID或密钥未设置');
+ }
+ }
+
+ /**
+ * 生成随机状态码用于OAuth流程
+ */
+ private generateState(): string {
+ return crypto.randomBytes(20).toString('hex');
+ }
+
+ /**
+ * 生成PKCE的code_verifier和code_challenge
+ * @returns 包含code_verifier和code_challenge的对象
+ */
+ private generatePKCE(): { codeVerifier: string; codeChallenge: string } {
+ // 生成随机码验证器
+ const codeVerifier = crypto.randomBytes(32).toString('base64url');
+
+ // 生成码挑战
+ const codeChallenge = crypto
+ .createHash('sha256')
+ .update(codeVerifier)
+ .digest('base64url');
+
+ return { codeVerifier, codeChallenge };
+ }
+
+ /**
+ * 获取TikTok授权URL
+ * @param mail 用户邮箱
+ * @returns 包含授权URL的对象
+ */
+ async getAuthorizationUrl(userId: string, mail: string): Promise<object> {
+ if (!userId) {
+ throw new BadRequestException('userId是必需的');
+ }
+
+ // 生成状态参数以防止CSRF攻击
+ const state = this.generateState();
+
+ // 生成PKCE的code_verifier和code_challenge
+ const { codeVerifier, codeChallenge } = this.generatePKCE();
+
+ const stateData = {
+ originalState: state, // 保留原始state值
+ userId: userId, // 用户ID
+ email: mail, // 邮箱
+ codeVerifier: codeVerifier // 保存code_verifier用于后续交换token
+ };
+
+ // 将状态与用户数据关联并存储在Redis中 (10分钟有效期)
+ await this.redisService.setKey(`tiktok:state:${state}`, JSON.stringify(stateData), 600);
+
+ // 构建TikTok授权URL
+ // const authUrl = new URL(this.authUrl);
+ // authUrl.searchParams.append('client_key', this.clientId);
+ // authUrl.searchParams.append('response_type', 'code');
+ // authUrl.searchParams.append('redirect_uri', `${this.redirectUri}/api/plat/tiktok/auth/callback`);
+ // authUrl.searchParams.append('scope', this.scopes);
+ // authUrl.searchParams.append('state', state);
+ // // 添加PKCE参数
+ // authUrl.searchParams.append('code_challenge', codeChallenge);
+ // authUrl.searchParams.append('code_challenge_method', 'S256');
+
+ // return {
+ // url: authUrl.toString()
+ // };
+
+ // 构建授权URL参数
+ const params = new URLSearchParams({
+ response_type: 'code',
+ client_key: this.clientId,
+ redirect_uri: `${this.redirectUri}/api/plat/tiktok/auth/callback`,
+ scope: this.scopes,
+ state: state,
+ code_challenge: codeChallenge,
+ // disable_auto_auth: '0',
+ code_challenge_method: 'S256', // 使用SHA-256算法
+ });
+
+ // 构建完整的授权URL
+ const authUrl = `${this.authUrl}?${params.toString()}`;
+ console.log('TikTok授权URL:', authUrl);
+
+ return { url: authUrl };
+
+ }
+
+ /**
+ * 处理TikTok授权回调
+ * @param code 授权码
+ * @param state 状态码
+ * @returns 处理结果
+ */
+ async handleAuthorizationCallback(code: string, state: string): Promise<object> {
+ // // 解析状态参数
+ // let parsedState;
+ // try {
+ // parsedState = JSON.parse(decodeURIComponent(state));
+ // } catch (error) {
+ // this.logger.error('无法解析状态参数:', error);
+ // throw new BadRequestException('无效的状态参数格式');
+ // }
+
+ // 从Redis获取保存的状态信息
+ // const originalState = parsedState.state;
+
+ const stateDataJson = await this.redisService.get(`tiktok:state:${state}`);
+ if (!stateDataJson) {
+ throw new BadRequestException('无效的状态参数或状态已过期');
+ }
+ // 解析状态数据
+ const stateData = JSON.parse(stateDataJson);
+ console.log('stateData:------', stateData);
+ const { userId, codeVerifier } = stateData;
+ if (!userId || !codeVerifier) {
+ throw new BadRequestException('状态数据不完整');
+ }
+
+ // 删除Redis中的状态信息
+ await this.redisService.del(`tiktok:state:${state}`);
+
+ try {
+ // 使用授权码交换令牌,并传入codeVerifier
+ const tokenResponse = await this.exchangeCodeForTokens(code, codeVerifier);
+ console.log("获取授权码成功!", tokenResponse);
+ // 获取用户信息
+ const userProfile = await this.getTikTokUserProfile(tokenResponse.access_token, tokenResponse.open_id);
+
+ // 更新或创建TikTok账户信息
+ await this.updateTikTokAccountInfo(
+ userId,
+ userProfile.open_id,
+ tokenResponse.access_token,
+ tokenResponse.refresh_token,
+ tokenResponse.expires_in
+ );
+
+ // 保存访问令牌到Redis以便后续使用
+ await this.redisService.setKey(
+ `tiktok:accessToken:${userProfile.open_id}`,
+ {
+ access_token: tokenResponse.access_token,
+ refresh_token: tokenResponse.refresh_token,
+ expires_in: tokenResponse.expires_in,
+ expiry_time: getCurrentTimestamp() + tokenResponse.expires_in
+ },
+ tokenResponse.expires_in - 300 // 令牌过期前5分钟
+ );
+
+ // 生成系统令牌
+ const userInfo = await this.userModel.findOne({ _id: userId });
+ const systemTokenInfo = {
+ phone: userInfo?.phone ?? '',
+ id: userId,
+ name: userInfo.name,
+ isManager: false,
+ googleId: userInfo?.googleAccount?.googleId ?? ''
+ };
+
+ const systemToken = await this.authService.generateToken(systemTokenInfo);
+
+ return { data: systemTokenInfo };
+ } catch (error) {
+ this.logger.error('处理TikTok授权回调失败:', error);
+ throw new HttpException(
+ '授权TikTok账户失败: ' + (error.response?.data?.error_description || error.message),
+ error.response?.status || HttpStatus.INTERNAL_SERVER_ERROR
+ );
+ }
+ }
+
+ /**
+ * 交换授权码获取令牌
+ * @param code 授权码
+ * @returns TikTok OAuth令牌响应
+ */
+ private async exchangeCodeForTokens(code: string, codeVerifier: string): Promise<TikTokOAuthTokenResponse> {
+ try {
+ // 构建请求体
+ const params = new URLSearchParams({
+ client_key: this.clientId,
+ client_secret: this.clientSecret,
+ code: code,
+ grant_type: 'authorization_code',
+ redirect_uri: `${this.redirectUri}/api/plat/tiktok/auth/callback`,
+ // 添加PKCE code_verifier
+ // code_verifier: codeVerifier // Required for mobile and desktop app only.
+ });
+
+ // const base64Credentials = Buffer.from(`${this.clientId}:${this.clientSecret}`).toString('base64');
+
+ const { data } = await firstValueFrom(
+ this.httpService.post(this.tokenUrl, params.toString(), {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ // 'Authorization': `Basic ${base64Credentials}`,
+ }
+ })
+ );
+
+ if (data.error) {
+ throw new BadRequestException(`交换令牌失败: ${data}`);
+ }
+
+ // return {
+ // access_token: data.access_token,
+ // refresh_token: data.refresh_token,
+ // expires_in: data.expires_in,
+ // token_type: data.token_type,
+ // scope: data.scope,
+ // open_id: data.open_id
+ // };
+ return data;
+ } catch (error) {
+ this.logger.error('交换TikTok授权码失败:', error);
+ throw new BadRequestException(`交换授权码失败: ${error.response?.data?.error_description || error.message}`);
+ }
+ }
+
+ /**
+ * 获取TikTok用户资料
+ * @param accessToken 访问令牌
+ * @param openId 用户开放ID
+ * @returns TikTok用户资料
+ */
+ async getTikTokUserProfile(accessToken: string, openId: string): Promise<TikTokUser> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.get(`${this.apiBaseUrl}/v2/user/info/`, {
+ params: {
+ fields: 'open_id,union_id,avatar_url,bio_description,profile_deep_link,is_verified,follower_count,following_count,likes_count,video_count,username, display_name',
+ // open_id: openId
+ },
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ console.log(data)
+ // if (data.error) {
+ // throw new BadRequestException(`获取用户信息失败: ${data.error.message}`);
+ // }
+
+ return data.data.user;
+ } catch (error) {
+ this.logger.error('获取TikTok用户信息失败:', error);
+ throw new BadRequestException(`获取用户信息失败: ${error.response?.data?.error?.message || error.message || error.code}`);
+ }
+ }
+
+ /**
+ * 更新TikTok账户信息
+ * @param userId 用户ID
+ * @param tikTokId TikTok用户ID
+ * @param accessToken 访问令牌
+ * @param refreshToken 刷新令牌
+ * @param expires_in 令牌有效期(秒)
+ */
+ async updateTikTokAccountInfo(
+ userId: string,
+ tikTokId: string,
+ accessToken: string,
+ refreshToken: string,
+ expires_in: number
+ ): Promise<void> {
+ try {
+ // 获取TikTok用户信息
+ const tikTokUser = await this.getTikTokUserProfile(accessToken, tikTokId);
+
+ // 准备账号信息
+ const channelInfo = {
+ userId: userId,
+ type: AccountType.TIKTOK, // 需要在AccountType中添加TIKTOK类型
+ uid: tikTokId,
+ account: tikTokUser.username,
+ nickname: tikTokUser.display_name,
+ avatar: tikTokUser.avatar_url,
+ homePage: tikTokUser.profile_deep_link,
+ fansCount: tikTokUser.follower_count,
+ followCount: tikTokUser.following_count,
+ workCount: tikTokUser.video_count,
+ likeCount: tikTokUser.likes_count,
+ readCount: 0,
+ collectCount: 0,
+ forwardCount: 0,
+ commentCount: 0,
+ updateTime: new Date(),
+ status: AccountStatus.USABLE,
+ loginCookie: "1111", // TikTok不使用cookie认证
+ token: "111", // 存储访问令牌
+ };
+
+ // 使用AccountService创建或更新账户
+ const account = await this.accountService.addOrUpdateAccount(channelInfo);
+ this.logger.log("成功创建或更新TikTok账号:", account);
+
+ // 检查是否存在账号Token
+ let accountToken = await this.accountTokenModel.findOne({
+ accountId: tikTokId,
+ platform: TokenPlatform.TIKTOK // 需要在TokenPlatform中添加TIKTOK类型
+ });
+
+ if (accountToken) {
+ if (refreshToken && refreshToken.trim() !== '') {
+ accountToken.refreshToken = refreshToken;
+ }
+ accountToken.expiresAt = new Date((getCurrentTimestamp() + expires_in) * 1000);
+ accountToken.updateTime = new Date();
+ await accountToken.save();
+ this.logger.log("成功更新TikTok账号Token");
+ } else {
+ // 创建新Token
+ await this.accountTokenModel.create({
+ userId,
+ accountId: tikTokId,
+ platform: TokenPlatform.TIKTOK, // 需要在TokenPlatform中添加TIKTOK类型
+ refreshToken: refreshToken,
+ expiresAt: new Date((getCurrentTimestamp() + expires_in) * 1000),
+ status: TokenStatus.USABLE,
+ createTime: new Date(),
+ updateTime: new Date(),
+ });
+ this.logger.log("成功创建TikTok账号Token");
+ }
+ } catch (error) {
+ this.logger.error('更新TikTok账号信息失败:', error);
+ // 不抛出异常,避免影响授权流程
+ }
+ }
+
+ /**
+ * 刷新用户的TikTok访问令牌
+ * @param userId 用户ID
+ * @param accountId 账号ID
+ * @param refreshToken 刷新令牌
+ * @returns 新的访问令牌信息
+ */
+ async refreshAccessToken(userId: string, accountId: string, refreshToken: string): Promise<object> {
+ this.logger.log(`尝试刷新TikTok令牌: userId=${userId}, accountId=${accountId}`);
+ try {
+ const params = new URLSearchParams({
+ client_key: this.clientId,
+ client_secret: this.clientSecret,
+ grant_type: 'refresh_token',
+ refresh_token: refreshToken
+ });
+
+ const { data } = await firstValueFrom(
+ this.httpService.post(this.refreshTokenUrl, params.toString(), {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ }
+ })
+ );
+
+ if (data.error) {
+ throw new BadRequestException(`刷新令牌失败: ${data.error_description}`);
+ }
+
+ // 保存新令牌到Redis
+ await this.redisService.setKey(
+ `tiktok:accessToken:${accountId}`,
+ {
+ access_token: data.access_token,
+ refresh_token: data.refresh_token || refreshToken, // 有些OAuth提供商在刷新时不返回新的刷新令牌
+ expires_in: data.expires_in,
+ expiry_time: getCurrentTimestamp() + data.expires_in
+ },
+ data.expires_in - 300 // 令牌过期前5分钟
+ );
+
+ // 更新数据库中的刷新令牌
+ if (data.refresh_token) {
+ await this.accountTokenModel.updateOne(
+ { accountId: accountId, platform: TokenPlatform.TIKTOK },
+ {
+ refreshToken: data.refresh_token,
+ expiresAt: new Date((getCurrentTimestamp() + data.expires_in) * 1000),
+ updateTime: new Date()
+ }
+ );
+ }
+
+ this.logger.log('刷新TikTok访问令牌成功');
+ // 返回系统令牌用于前端重定向
+ const userInfo = await this.userModel.findOne({_id: userId});
+ const systemTokenInfo = {
+ phone: userInfo?.phone ?? '',
+ id: userId,
+ name: userInfo.name,
+ isManager: false,
+ googleId: userInfo?.googleAccount?.googleId ?? ''
+ };
+
+ const systemToken = await this.authService.generateToken(systemTokenInfo);
+ return { url: systemToken };
+ } catch (err) {
+ this.logger.error('刷新TikTok访问令牌失败:', err.response?.data || err.message);
+ throw new HttpException(
+ err.response?.data?.error_description || '刷新令牌失败',
+ err.response?.status || HttpStatus.BAD_REQUEST
+ );
+ }
+ }
+
+ /**
+ * 获取用户的TikTok访问令牌
+ * @param accountId 账号ID
+ * @returns 访问令牌
+ */
+ async getUserAccessToken(accountId: string): Promise<string> {
+ this.logger.log(`获取TikTok访问令牌: accountId=${accountId}`);
+
+ // 先检查Redis缓存
+ const cachedToken = await this.redisService.get(`tiktok:accessToken:${accountId}`);
+ if (cachedToken && cachedToken.access_token) {
+ this.logger.log("从Redis获取到有效令牌");
+ return cachedToken.access_token;
+ }
+
+ // 如果缓存中没有,尝试刷新
+ const accountTokenInfo = await this.accountTokenModel.findOne({
+ accountId: accountId,
+ platform: TokenPlatform.TIKTOK
+ });
+
+ if (!accountTokenInfo || !accountTokenInfo.refreshToken) {
+ throw new BadRequestException('无效的账号或刷新令牌丢失');
+ }
+
+ // 刷新并获取新令牌
+ const refreshResult = await this.refreshAccessToken(
+ accountTokenInfo.userId,
+ accountTokenInfo.accountId,
+ accountTokenInfo.refreshToken
+ );
+
+ // 刷新后再次从Redis获取
+ const newToken = await this.redisService.get(`tiktok:accessToken:${accountId}`);
+ if (!newToken || !newToken.access_token) {
+ throw new BadRequestException('刷新令牌后未能获取访问令牌');
+ }
+
+ return newToken.access_token;
+ }
+
+ /**
+ * 检查用户是否已授权TikTok
+ * @param accountId 账号ID
+ * @returns 是否已授权
+ */
+ async isAuthorized(accountId: string): Promise<boolean> {
+ try {
+ const accessToken = await this.getUserAccessToken(accountId);
+ return !!accessToken;
+ } catch (error) {
+ return false;
+ }
+ }
+
+ /**
+ * 撤销TikTok授权
+ * @param accountId 账号ID
+ * @returns 撤销结果
+ */
+ async revokeAuthorization(accountId: string): Promise<boolean> {
+ try {
+ const accessToken = await this.getUserAccessToken(accountId);
+ if (!accessToken) {
+ return true; // 已经没有授权了
+ }
+
+ // 撤销TikTok令牌
+ const params = new URLSearchParams({
+ access_token: accessToken,
+ client_key: this.clientId,
+ client_secret: this.clientSecret
+ });
+
+ await firstValueFrom(
+ this.httpService.post(`${this.revokeUrl}`, params.toString(), {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ }
+ })
+ );
+
+ // 删除Redis中的令牌
+ await this.redisService.del(`tiktok:accessToken:${accountId}`);
+
+ // 更新数据库记录状态
+ await this.accountTokenModel.updateOne(
+ { accountId: accountId, platform: TokenPlatform.TIKTOK },
+ { status: TokenStatus.DISABLE, updateTime: new Date() }
+ );
+
+ await this.accountModel.updateOne(
+ { uid: accountId, type: AccountType.TIKTOK },
+ { status: AccountStatus.DISABLE, updateTime: new Date() }
+ );
+
+ return true;
+ } catch (error) {
+ this.logger.error('撤销TikTok授权失败:', error);
+ return false;
+ }
+ }
+}
diff --git a/server/src/modules/plat/tiktok/tiktok.controller.ts b/server/src/modules/plat/tiktok/tiktok.controller.ts
new file mode 100644
index 00000000..c229d76d
--- /dev/null
+++ b/server/src/modules/plat/tiktok/tiktok.controller.ts
@@ -0,0 +1,547 @@
+import { Controller, Get, Post, Body, Query, Res, Param, Delete, UseInterceptors, BadRequestException,
+ UploadedFile, HttpException, HttpStatus, UseGuards } from '@nestjs/common';
+import { FileInterceptor } from '@nestjs/platform-express';
+import { ApiTags, ApiOperation, ApiBody, ApiConsumes, ApiQuery, ApiParam } from '@nestjs/swagger';
+import { Express } from 'express';
+import { TikTokService } from './tiktok.service';
+import { TikTokAuthService } from './tiktok.auth.service';
+import { GetToken, Public, AuthGuard } from 'src/auth/auth.guard';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { CreateVideoDto, TikTokCommentDto, GetVideosQueryDto, TikTokVideoFilterDto, CombinedVideoUploadDto } from './dto/tiktok.dto';
+import { Response } from 'express';
+
+@ApiTags('plat/tiktok - TikTok 平台')
+@Controller('plat/tiktok')
+// @UseGuards(AuthGuard)
+export class TikTokController {
+ constructor(
+ private readonly tikTokService: TikTokService,
+ private readonly tikTokAuthService: TikTokAuthService,
+ ) {}
+
+ /**
+ * 获取TikTok授权URL
+ */
+ @Get('auth/url')
+ @ApiOperation({ summary: '获取TikTok授权URL' })
+ @ApiQuery({ name: 'mail', required: false, description: '用户邮箱' })
+ async getAuthUrl(
+ @GetToken() systemToken: TokenInfo,
+ @Query('mail') mail: string,
+ ) {
+ if (!systemToken.id || !mail) {
+ throw new BadRequestException('token和mail是必须的');
+ }
+ return this.tikTokAuthService.getAuthorizationUrl(systemToken.id, mail);
+ }
+
+ /**
+ * TikTok OAuth2回调处理
+ */
+
+ @ApiOperation({ summary: 'TikTok OAuth2回调处理' })
+ @Public()
+ @ApiQuery({ name: 'code', type: String, description: 'OAuth2授权码' })
+ @ApiQuery({ name: 'state', type: String, description: '状态码' })
+ @Get('auth/callback')
+ async handleAuthCallback(
+ @Query('code') code: string,
+ @Query('state') state: string,
+ @Res() res: Response,
+ ) {
+ if (!code || !state) {
+ throw new BadRequestException('缺少必要的参数');
+ }
+ console.log(code, state);
+
+ try {
+ // 处理授权回调
+ const results = await this.tikTokAuthService.handleAuthorizationCallback(code, state);
+ const render_msg = {
+ message: "授权成功! 这里是添加账号成功后的前端页面," ,
+ datas: results
+ };
+
+ return res.render('google/index', render_msg);
+ } catch (error) {
+ console.error('处理TikTok授权回调失败:', error.response?.data || error.message);
+ throw new BadRequestException(`处理授权回调失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 检查用户是否已授权TikTok
+ */
+ @Get('auth/check')
+ @ApiOperation({ summary: '检查用户是否已授权TikTok' })
+ @ApiQuery({ name: 'accountId', type: String, description: 'TikTok账号ID' })
+ async checkAuth(@Query('accountId') accountId: string) {
+ if (!accountId) {
+ throw new BadRequestException('accountId是必须的');
+ }
+
+ const isAuthorized = await this.tikTokAuthService.isAuthorized(accountId);
+ return { authorized: isAuthorized };
+ }
+
+ /**
+ * 撤销TikTok授权
+ */
+ @Post('auth/revoke')
+ @ApiOperation({ summary: '撤销TikTok授权' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' }
+ },
+ required: ['accountId']
+ }
+ })
+ async revokeAuth(@GetToken() systemToken: TokenInfo, @Body('accountId') accountId: string) {
+ if (!accountId) {
+ throw new BadRequestException('accountId是必须的');
+ }
+
+ const result = await this.tikTokAuthService.revokeAuthorization(accountId);
+ return { success: result };
+ }
+
+ /**
+ * 获取用户视频列表
+ */
+ @Get('videos/list')
+ @ApiOperation({ summary: '获取用户视频列表' })
+ async getUserVideos(
+ @GetToken() systemToken: TokenInfo,
+ @Query() queryDto: GetVideosQueryDto
+ ) {
+ const userId = systemToken.id;
+ if (!queryDto.accountId) {
+ throw new BadRequestException('accountId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(queryDto.accountId);
+ return this.tikTokService.getUserVideos(
+ accessToken,
+ userId,
+ queryDto.accountId,
+ queryDto.limit,
+ queryDto.cursor
+ );
+ }
+
+ /**
+ * 获取视频详情
+ */
+ @Get('videos/detail')
+ @ApiOperation({ summary: '获取视频详情' })
+ @ApiQuery({ name: 'videoId', description: '视频ID' })
+ @ApiQuery({ name: 'accountId', description: 'TikTok账号ID' })
+ async getVideoDetail(
+ @Query('videoId') videoId: string,
+ @Query('accountId') accountId: string
+ ) {
+ if (!videoId || !accountId) {
+ throw new BadRequestException('videoId和accountId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+ return this.tikTokService.getVideoDetail(accessToken, videoId);
+ }
+
+ /**
+ * 上传视频
+ */
+ @Post('videos/upload')
+ @ApiOperation({ summary: '上传视频文件' })
+ @ApiConsumes('multipart/form-data')
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string' },
+ file: {
+ type: 'string',
+ format: 'binary',
+ description: '视频文件'
+ }
+ },
+ required: ['accountId', 'file']
+ }
+ })
+ @UseInterceptors(FileInterceptor('file'))
+ async uploadVideo(
+ @GetToken() systemToken: TokenInfo,
+ @Body('accountId') accountId: string,
+ @UploadedFile() file: Express.Multer.File
+ ) {
+ if (!accountId || !file) {
+ throw new BadRequestException('accountId和视频文件是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+ return this.tikTokService.uploadVideo(accessToken, file.buffer);
+ }
+
+ /**
+ * 发布视频
+ */
+ @Post('videos/publish')
+ @ApiOperation({ summary: '发布视频' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' },
+ description: { type: 'string', description: '视频描述' },
+ videoId: { type: 'string', description: '上传后的视频ID' },
+ private: { type: 'boolean', description: '是否为私有视频' },
+ hashtags: {
+ type: 'array',
+ items: { type: 'string' },
+ description: '话题标签列表'
+ }
+ },
+ required: ['accountId', 'description', 'videoId']
+ }
+ })
+ async publishVideo(
+ @GetToken() systemToken: TokenInfo,
+ @Body() createVideoDto: CreateVideoDto,
+ @Body('videoId') videoId: string
+ ) {
+ const userId = systemToken.id;
+ if (!createVideoDto.accountId || !videoId) {
+ throw new BadRequestException('accountId和videoId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(createVideoDto.accountId);
+ return this.tikTokService.publishVideo(
+ accessToken,
+ userId,
+ createVideoDto.accountId,
+ createVideoDto,
+ videoId
+ );
+ }
+
+ /**
+ * 删除视频
+ */
+ @Post('videos/delete')
+ @ApiOperation({ summary: '删除视频' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' },
+ videoId: { type: 'string', description: '视频ID' }
+ },
+ required: ['accountId', 'videoId']
+ }
+ })
+ async deleteVideo(
+ @GetToken() systemToken: TokenInfo,
+ @Body('videoId') videoId: string,
+ @Body('accountId') accountId: string
+ ) {
+ if (!videoId || !accountId) {
+ throw new BadRequestException('videoId和accountId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+ return this.tikTokService.deleteVideo(accessToken, videoId);
+ }
+
+ /**
+ * 获取视频评论
+ */
+ @Get('videos/:videoId/comments')
+ @ApiOperation({ summary: '获取视频评论' })
+ @ApiParam({ name: 'videoId', description: '视频ID' })
+ @ApiQuery({ name: 'accountId', description: 'TikTok账号ID' })
+ @ApiQuery({ name: 'limit', description: '每页结果数', required: false })
+ @ApiQuery({ name: 'cursor', description: '分页游标', required: false })
+ async getVideoComments(
+ @Param('videoId') videoId: string,
+ @Query('accountId') accountId: string,
+ @Query('limit') limit?: number,
+ @Query('cursor') cursor?: string
+ ) {
+ if (!videoId || !accountId) {
+ throw new BadRequestException('videoId和accountId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+ return this.tikTokService.getVideoComments(accessToken, videoId, limit, cursor);
+ }
+
+ /**
+ * 发表评论
+ */
+ @Post('videos/comment')
+ @ApiOperation({ summary: '发表评论' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' },
+ videoId: { type: 'string', description: '视频ID' },
+ text: { type: 'string', description: '评论内容' }
+ },
+ required: ['accountId', 'videoId', 'text']
+ }
+ })
+ async postComment(
+ @GetToken() systemToken: TokenInfo,
+ @Body() commentDto: TikTokCommentDto
+ ) {
+ if (!commentDto.accountId || !commentDto.videoId || !commentDto.text) {
+ throw new BadRequestException('accountId, videoId和text是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(commentDto.accountId);
+ return this.tikTokService.postComment(accessToken, commentDto);
+ }
+
+ /**
+ * 删除评论
+ */
+ @Post('videos/comment/delete')
+ @ApiOperation({ summary: '删除评论' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' },
+ videoId: { type: 'string', description: '视频ID' },
+ commentId: { type: 'string', description: '评论ID' }
+ },
+ required: ['accountId', 'videoId', 'commentId']
+ }
+ })
+ async deleteComment(
+ @GetToken() systemToken: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('videoId') videoId: string,
+ @Body('commentId') commentId: string
+ ) {
+ if (!accountId || !videoId || !commentId) {
+ throw new BadRequestException('accountId, videoId和commentId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+ return this.tikTokService.deleteComment(accessToken, videoId, commentId);
+ }
+
+ /**
+ * 视频点赞或取消点赞
+ */
+ @Post('videos/rate')
+ @ApiOperation({ summary: '视频点赞或取消点赞' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' },
+ videoId: { type: 'string', description: '视频ID' },
+ rating: { type: 'string', description: '操作类型: like 或 unlike' }
+ },
+ required: ['accountId', 'videoId', 'rating']
+ }
+ })
+ async rateVideo(
+ @GetToken() systemToken: TokenInfo,
+ @Body('videoId') videoId: string,
+ @Body('accountId') accountId: string,
+ @Body('rating') rating: string
+ ) {
+ const userId = systemToken.id;
+ if (!videoId || !userId || !accountId) {
+ throw new BadRequestException('videoId, userId和accountId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+
+ // 在方法开始处验证
+ if (!["like", "unlike"].includes(rating)) {
+ throw new BadRequestException('参数错误: rating必须为like或unlike');
+ }
+
+ // 后续处理
+ if (rating === "like") {
+ return this.tikTokService.likeVideo(accessToken, userId, accountId, videoId);
+ } else {
+ return this.tikTokService.unlikeVideo(accessToken, userId, accountId, videoId);
+ }
+ }
+
+ /**
+ * 搜索TikTok视频
+ */
+ @Get('search')
+ @ApiOperation({ summary: '搜索TikTok视频' })
+ async searchVideos(
+ @GetToken() systemToken: TokenInfo,
+ @Query() filterDto: TikTokVideoFilterDto
+ ) {
+ if (!filterDto.accountId) {
+ throw new BadRequestException('accountId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(filterDto.accountId);
+ return this.tikTokService.searchVideos(accessToken, filterDto);
+ }
+
+ /**
+ * 初始化视频发布(新版API)
+ */
+ @Post('videos/init-publish')
+ @ApiOperation({ summary: '初始化视频发布(新版API)' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' },
+ title: { type: 'string', description: '视频标题' },
+ description: { type: 'string', description: '视频描述' },
+ privacyLevel: { type: 'string', description: '隐私级别', enum: ['PUBLIC', 'PRIVATE', 'FRIENDS'], default: 'PUBLIC' },
+ disableComment: { type: 'boolean', description: '是否禁用评论', default: false },
+ disableDuet: { type: 'boolean', description: '是否禁用二重奏', default: false },
+ disableStitch: { type: 'boolean', description: '是否禁用Stitch', default: false },
+ videoCoverTimestampMs: { type: 'number', description: '视频封面时间点(毫秒)' },
+ hashtags: { type: 'array', items: { type: 'string' }, description: '话题标签列表' },
+ videoSize: { type: 'number', description: '视频大小(字节)' }
+ },
+ required: ['accountId', 'videoSize']
+ }
+ })
+ async initVideoPublish(
+ @GetToken() systemToken: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('videoSize') videoSize: number,
+ @Body() videoInfo: {
+ title?: string;
+ description?: string;
+ privacyLevel?: string;
+ disableComment?: boolean;
+ disableDuet?: boolean;
+ disableStitch?: boolean;
+ videoCoverTimestampMs?: number;
+ hashtags?: string[];
+ }
+ ) {
+ if (!accountId || !videoSize) {
+ throw new BadRequestException('accountId和视频大小是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+ return this.tikTokService.initVideoPublish(accessToken, videoSize, videoInfo);
+ }
+
+ /**
+ * 检查视频发布状态(新版API)
+ */
+ @Post('videos/publish/status')
+ @ApiOperation({ summary: '检查视频发布状态' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' },
+ publishId: { type: 'string', description: '发布ID' }
+ },
+ required: ['accountId', 'publishId']
+ }
+ })
+ async checkPublishStatus(
+ @GetToken() systemToken: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('publishId') publishId: string
+ ) {
+ if (!accountId || !publishId) {
+ throw new BadRequestException('accountId和publishId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+ return this.tikTokService.checkPublishStatus(accessToken, publishId);
+ }
+
+ /**
+ * 一键上传并发布视频(新版API三步法)
+ */
+ @Post('videos/publish')
+ @ApiOperation({ summary: '一键上传并发布视频(新版API)' })
+ @ApiConsumes('multipart/form-data')
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'TikTok账号ID' },
+ title: { type: 'string', description: '视频标题' },
+ description: { type: 'string', description: '视频描述' },
+ privacyStatus: { type: 'string', description: '隐私级别', enum: ['PUBLIC', 'PRIVATE', 'FRIENDS'], default: 'PUBLIC' },
+ disableComment: { type: 'boolean', description: '是否禁用评论', default: false },
+ disableDuet: { type: 'boolean', description: '是否禁用二重奏', default: false },
+ disableStitch: { type: 'boolean', description: '是否禁用Stitch', default: false },
+ videoCoverTimestampMs: { type: 'number', description: '视频封面时间点(毫秒)' },
+ hashtags: { type: 'array', items: { type: 'string' }, description: '话题标签列表' },
+ pollInterval: { type: 'number', description: '轮询间隔(毫秒)', default: 2000 },
+ maxRetries: { type: 'number', description: '最大重试次数', default: 30 },
+ file: { type: 'string', format: 'binary', description: '视频文件' }
+ },
+ required: ['accountId', 'file']
+ }
+ })
+ @UseInterceptors(FileInterceptor('file'))
+ async uploadAndPublishVideo(
+ @GetToken() systemToken: TokenInfo,
+ @Body() uploadDto: CombinedVideoUploadDto,
+ @UploadedFile() file: Express.Multer.File
+ ) {
+ const userId = systemToken.id;
+ if (!uploadDto.accountId || !file) {
+ throw new BadRequestException('accountId和视频文件是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(uploadDto.accountId);
+ return this.tikTokService.uploadAndPublishVideo(
+ accessToken,
+ userId,
+ uploadDto.accountId,
+ file.buffer,
+ {
+ title: uploadDto.title,
+ description: uploadDto.description,
+ privacyStatus: uploadDto.privacyStatus || 'PUBLIC',
+ disableComment: uploadDto.disableComment || false,
+ disableDuet: uploadDto.disableDuet || false,
+ disableStitch: uploadDto.disableStitch || false,
+ videoCoverTimestampMs: uploadDto.videoCoverTimestampMs,
+ tags: uploadDto.tags
+ },
+ uploadDto.pollInterval,
+ uploadDto.maxRetries
+ );
+ }
+
+ /**
+ * 获取TikTok账号信息
+ */
+ @Get('user/profile')
+ @ApiOperation({ summary: '获取TikTok账号信息' })
+ @ApiQuery({ name: 'accountId', description: 'TikTok账号ID' })
+ async getUserProfile(
+ @GetToken() systemToken: TokenInfo,
+ @Query('accountId') accountId: string
+ ) {
+ if (!accountId) {
+ throw new BadRequestException('accountId是必须的');
+ }
+
+ const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);
+ return this.tikTokService.getUserProfile(accessToken, accountId);
+ }
+
+}
\ No newline at end of file
diff --git a/server/src/modules/plat/tiktok/tiktok.module.ts b/server/src/modules/plat/tiktok/tiktok.module.ts
new file mode 100644
index 00000000..0d85e2f8
--- /dev/null
+++ b/server/src/modules/plat/tiktok/tiktok.module.ts
@@ -0,0 +1,47 @@
+/*
+ * @Author:
+ * @Date: 2025-06-06
+ * @LastEditTime: 2025-06-06
+ * @Description: TikTok模块
+ */
+import { Module } from '@nestjs/common';
+import { HttpModule } from '@nestjs/axios';
+import { ConfigModule } from '@nestjs/config';
+import { MongooseModule } from '@nestjs/mongoose';
+
+import { TikTokController } from './tiktok.controller';
+import { TikTokService } from './tiktok.service';
+import { TikTokAuthService } from './tiktok.auth.service';
+import { PubRecord, PubRecordSchema } from 'src/db/schema/pubRecord.schema';
+import tiktokConfig from 'config/tiktok.config';
+import { User, UserSchema } from 'src/db/schema/user.schema';
+import { Account, AccountSchema } from 'src/db/schema/account.schema';
+import { AccountToken, AccountTokenSchema } from 'src/db/schema/accountToken.schema';
+import { UserModule } from 'src/user/user.module';
+import { RedisModule } from 'src/lib/redis/redis.module';
+import { AuthModule } from 'src/auth/auth.module';
+import { AccountModule } from 'src/modules/account/account.module';
+import { forwardRef } from '@nestjs/common';
+
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [tiktokConfig],
+ }),
+ HttpModule,
+ MongooseModule.forFeature([
+ { name: User.name, schema: UserSchema },
+ { name: Account.name, schema: AccountSchema },
+ { name: AccountToken.name, schema: AccountTokenSchema },
+ { name: PubRecord.name, schema: PubRecordSchema },
+ ]),
+ UserModule,
+ RedisModule,
+ forwardRef(() => AuthModule),
+ forwardRef(() => AccountModule),
+ ],
+ controllers: [TikTokController],
+ providers: [TikTokService, TikTokAuthService],
+ exports: [TikTokService, TikTokAuthService]
+})
+export class TiktokModule { }
diff --git a/server/src/modules/plat/tiktok/tiktok.service.ts b/server/src/modules/plat/tiktok/tiktok.service.ts
new file mode 100644
index 00000000..c7c85eed
--- /dev/null
+++ b/server/src/modules/plat/tiktok/tiktok.service.ts
@@ -0,0 +1,991 @@
+import { Injectable, BadRequestException, Logger, Inject, forwardRef } from '@nestjs/common';
+import { HttpService } from '@nestjs/axios';
+import { ConfigService } from '@nestjs/config';
+import { Model } from 'mongoose';
+import { InjectModel } from '@nestjs/mongoose';
+import { firstValueFrom } from 'rxjs';
+import * as FormData from 'form-data';
+
+import { PubRecord, PubStatus, PubType } from 'src/db/schema/pubRecord.schema';
+import { TikTokAuthService } from './tiktok.auth.service';
+import { CreateVideoDto, TikTokCommentDto, GetVideosQueryDto, TikTokVideoFilterDto } from './dto/tiktok.dto';
+
+@Injectable()
+export class TikTokService {
+ private readonly logger = new Logger(TikTokService.name);
+ private readonly apiBaseUrl: string;
+ private readonly uploadApiBaseUrl: string;
+
+ constructor(
+ private readonly httpService: HttpService,
+ private readonly configService: ConfigService,
+ private readonly tikTokAuthService: TikTokAuthService,
+ @InjectModel(PubRecord.name) private readonly pubRecordModel: Model<PubRecord>,
+ ) {
+ const tiktokConfig = this.configService.get('tiktok');
+ if (!tiktokConfig) {
+ throw new Error('TikTok配置未找到,请检查环境变量和配置文件');
+ }
+ this.apiBaseUrl = tiktokConfig.apiBaseUrl;
+ this.uploadApiBaseUrl = tiktokConfig.uploadApiBaseUrl;
+ }
+
+ /**
+ * 获取用户视频列表
+ * @param accessToken 访问令牌
+ * @param userId 用户ID
+ * @param accountId TikTok账号ID
+ * @param limit 每页结果数
+ * @param cursor 分页游标
+ * @returns 用户视频列表
+ */
+ async getUserVideos(
+ accessToken: string,
+ userId: string,
+ accountId: string,
+ limit = 10,
+ cursor?: string
+ ): Promise<any> {
+ try {
+ // 确保limit是数字且在有效范围内
+ limit = isNaN(Number(limit)) ? 10 : Math.min(Math.max(Number(limit), 1), 50);
+
+ const params: any = {
+ fields: 'id,create_time,video_description,duration,height,width,share_count,comment_count,like_count,view_count,title,embed_link,embed_html,thumbnail_url',
+ max_count: limit
+ };
+
+ if (cursor) {
+ params.cursor = cursor;
+ }
+
+ const { data } = await firstValueFrom(
+ this.httpService.get(`${this.apiBaseUrl}/v2/video/list`, {
+ params,
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return data.data;
+ } catch (error) {
+ this.logger.error('获取TikTok视频列表失败:', error.response?.data || error.message);
+ throw new BadRequestException(`获取视频列表失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 获取视频详情
+ * @param accessToken 访问令牌
+ * @param videoId 视频ID
+ * @returns 视频详情
+ */
+ async getVideoDetail(
+ accessToken: string,
+ videoId: string
+ ): Promise<any> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.get(`${this.apiBaseUrl}/v2/video/info/`, {
+ params: {
+ fields: 'id,create_time,video_description,duration,height,width,share_count,comment_count,like_count,view_count,title,embed_link,embed_html,thumbnail_url',
+ video_id: videoId
+ },
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return data.data;
+ } catch (error) {
+ this.logger.error('获取TikTok视频详情失败:', error.response?.data || error.message);
+ throw new BadRequestException(`获取视频详情失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 方式1:初始化视频上传(旧版)
+ * @param accessToken 访问令牌
+ * @param videoSize 视频文件总大小(字节)
+ * @param chunkSize 分片大小(字节),默认为5MB
+ * @returns 初始化结果,包含上传所需的参数
+ */
+ async initVideoUpload(
+ accessToken: string,
+ videoSize?: number,
+ chunkSize: number = 5 * 1024 * 1024 // 默认5MB
+ ): Promise<any> {
+ try {
+ const requestBody: any = {};
+
+ // 如果提供了视频大小,添加分片上传的相关信息
+ if (videoSize) {
+ const totalChunkCount = Math.ceil(videoSize / chunkSize);
+ requestBody.source_info = {
+ source: "FILE_UPLOAD",
+ video_size: videoSize,
+ chunk_size: chunkSize,
+ total_chunk_count: totalChunkCount
+ };
+ }
+
+ const { data } = await firstValueFrom(
+ this.httpService.post(`${this.apiBaseUrl}/v2/post/publish/inbox/video/init/`, requestBody, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return data.data;
+ } catch (error) {
+ this.logger.error('初始化TikTok视频上传失败:', error.response?.data || error.message);
+ throw new BadRequestException(`初始化视频上传失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 方式2:初始化视频发布(直接发布,新版)
+ * @param accessToken 访问令牌
+ * @param videoSize 视频文件总大小(字节)
+ * @param videoInfo 视频相关信息,包含标题、隐私级别等
+ * @param chunkSize 分片大小(字节),默认为10MB
+ * @returns 初始化结果,包含上传所需的参数
+ */
+ async initVideoPublish(
+ accessToken: string,
+ videoSize: number,
+ videoInfo: {
+ title?: string;
+ description?: string;
+ privacyStatus?: string;
+ disableComment?: boolean;
+ disableDuet?: boolean;
+ disableStitch?: boolean;
+ videoCoverTimestampMs?: number;
+ tags?: string[];
+ },
+ chunkSize: number = 10 * 1024 * 1024 // 默认10MB
+ ): Promise<any> {
+ try {
+ // 计算总分片数
+ const totalChunkCount = Math.ceil(videoSize / chunkSize);
+
+ // 处理hashtags,如果提供了
+ let title = videoInfo.title || videoInfo.description || '';
+ if (videoInfo.tags && videoInfo.tags.length > 0) {
+ const hashtagText = videoInfo.tags
+ .map(tag => `#${tag.replace(/^#/, '')}`)
+ .join(' ');
+ if (title) {
+ title = `${title} ${hashtagText}`;
+ } else {
+ title = hashtagText;
+ }
+ }
+
+ // 构建请求体
+ const requestBody: any = {
+ post_info: {
+ title: title,
+ privacy_level: videoInfo.privacyStatus || 'PUBLIC',
+ disable_duet: videoInfo.disableDuet || false,
+ disable_comment: videoInfo.disableComment || false,
+ disable_stitch: videoInfo.disableStitch || false
+ },
+ source_info: {
+ source: "FILE_UPLOAD",
+ video_size: videoSize,
+ chunk_size: chunkSize,
+ total_chunk_count: totalChunkCount
+ }
+ };
+
+ // 添加视频封面时间戳,如果提供了
+ if (videoInfo.videoCoverTimestampMs) {
+ requestBody.post_info.video_cover_timestamp_ms = videoInfo.videoCoverTimestampMs;
+ }
+
+ this.logger.debug('初始化视频发布请求:', JSON.stringify(requestBody));
+
+ const { data } = await firstValueFrom(
+ this.httpService.post(`${this.apiBaseUrl}/v2/post/publish/video/init/`, requestBody, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ if (!data.data.publish_id || !data.data.upload_url) {
+ throw new BadRequestException('初始化视频发布失败,缺少publish_id或upload_url');
+ }
+
+ return data.data;
+ } catch (error) {
+ this.logger.error('初始化TikTok视频发布失败:', error.response?.data || error.message);
+ throw new BadRequestException(`初始化视频发布失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 上传视频文件
+ * @param accessToken 访问令牌
+ * @param videoBuffer 视频文件缓冲区
+ * @param initData 初始化返回的数据
+ * @returns 上传结果
+ */
+ async uploadVideo(
+ accessToken: string,
+ videoBuffer: Buffer,
+ initData?: any
+ ): Promise<any> {
+ try {
+ // 如果没有提供初始化数据,先进行初始化
+ if (!initData) {
+ // 计算视频大小并进行初始化
+ const videoSize = videoBuffer.length;
+ initData = await this.initVideoUpload(accessToken, videoSize);
+ }
+
+ // 检查是否需要分片上传
+ if (initData.publish_id && initData.upload_url && videoBuffer.length > 10 * 1024 * 1024) {
+ // 如果有publish_id和upload_url,并且视频超过10MB,则使用分片上传
+ return await this.uploadVideoChunked(accessToken, videoBuffer, initData);
+ }
+
+ // 如果不需要分片,使用单次上传
+ // 创建Node.js版的FormData
+ const formData = new FormData();
+
+ // 直接将Buffer添加到FormData中
+ const filename = `video_${Date.now()}.mp4`;
+ formData.append('video', videoBuffer, {
+ filename,
+ contentType: 'video/mp4'
+ });
+
+ // 添加初始化返回的必要参数
+ if (initData.upload_params) {
+ Object.entries(initData.upload_params).forEach(([key, value]) => {
+ formData.append(key, value);
+ });
+ }
+
+ // 使用初始化返回的上传URL,如果没有则使用默认URL
+ const uploadUrl = initData.upload_url || `${this.apiBaseUrl}/v2/video/upload/`;
+
+ const { data } = await firstValueFrom(
+ this.httpService.post(uploadUrl, formData, {
+ headers: {
+ ...formData.getHeaders(),
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return {
+ ...data.data,
+ init_data: initData, // 返回初始化数据,可能在发布时需要
+ };
+ } catch (error) {
+ this.logger.error('上传TikTok视频失败:', error.response?.data || error.message);
+ throw new BadRequestException(`上传视频失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 方式1:分片上传视频(POST方式)
+ * @param accessToken 访问令牌
+ * @param videoBuffer 视频文件缓冲区
+ * @param initData 初始化返回的数据,包含 publish_id 和 upload_url
+ * @returns 上传结果
+ */
+ private async uploadVideoChunked(
+ accessToken: string,
+ videoBuffer: Buffer,
+ initData: any
+ ): Promise<any> {
+ try {
+ const { publish_id, upload_url } = initData;
+
+ if (!publish_id || !upload_url) {
+ throw new BadRequestException('初始化响应缺少 publish_id 或 upload_url');
+ }
+
+ // 设置分片大小(每个分片5MB)
+ const chunkSize = 5 * 1024 * 1024;
+ const totalSize = videoBuffer.length;
+ const totalChunkCount = Math.ceil(totalSize / chunkSize);
+
+ this.logger.debug(`视频总大小: ${totalSize} 字节, 分片数: ${totalChunkCount}`);
+
+ // 选择视频内容类型
+ const contentType = 'video/mp4';
+
+ // 存储每个分片的上传响应
+ const uploadResponses = [];
+
+ // 上传每个分片
+ for (let i = 0; i < totalChunkCount; i++) {
+ const start = i * chunkSize;
+ const end = Math.min(start + chunkSize, totalSize);
+ const chunkBuffer = videoBuffer.subarray(start, end);
+ const chunkLength = chunkBuffer.length;
+
+ this.logger.debug(`正在上传第${i + 1}/${totalChunkCount}个分片,范围: ${start}-${end-1}/${totalSize}, 大小: ${chunkLength} 字节`);
+
+ // 使用原生的请求头而不是FormData
+ const { data } = await firstValueFrom(
+ this.httpService.post(upload_url, chunkBuffer, {
+ headers: {
+ 'Content-Type': contentType,
+ 'Content-Length': chunkLength.toString(),
+ 'Content-Range': `bytes ${start}-${end-1}/${totalSize}`,
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ uploadResponses.push(data);
+ }
+
+ // 使用最后一个分片的响应作为最终响应
+ const finalResponse = uploadResponses[totalChunkCount - 1];
+
+ return {
+ ...finalResponse.data,
+ publish_id,
+ video_id: finalResponse.data?.video_id || finalResponse.data?.id,
+ init_data: initData, // 返回初始化数据,可能在发布时需要
+ };
+ } catch (error) {
+ this.logger.error('分片上传TikTok视频失败:', error.response?.data || error.message);
+ throw new BadRequestException(`分片上传视频失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 方式2:直接上传视频(PUT方式)
+ * @param accessToken 访问令牌
+ * @param videoBuffer 视频文件缓冲区
+ * @param initData 初始化返回的数据,包含 publish_id 和 upload_url
+ * @returns 上传结果
+ */
+ async directUploadVideo(
+ accessToken: string,
+ videoBuffer: Buffer,
+ initData: any
+ ): Promise<any> {
+ try {
+ const { publish_id, upload_url } = initData;
+
+ if (!publish_id || !upload_url) {
+ throw new BadRequestException('初始化响应缺少 publish_id 或 upload_url');
+ }
+
+ const totalSize = videoBuffer.length;
+ // 建议的分片大小,如果文件大于10MB则分片上传
+ const chunkSize = 10 * 1024 * 1024;
+ const needChunking = totalSize > chunkSize;
+
+ // 选择视频内容类型
+ const contentType = 'video/mp4';
+
+ this.logger.debug(`直接上传视频,总大小: ${totalSize} 字节, 是否需要分片: ${needChunking}`);
+
+ if (!needChunking) {
+ // 单次上传整个文件
+ const { data } = await firstValueFrom(
+ this.httpService.put(upload_url, videoBuffer, {
+ headers: {
+ 'Content-Type': contentType,
+ 'Content-Length': totalSize.toString(),
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return {
+ publish_id,
+ ...data?.data,
+ };
+ } else {
+ // 分片上传
+ const totalChunkCount = Math.ceil(totalSize / chunkSize);
+ let lastResponse = null;
+
+ // 上传每个分片
+ for (let i = 0; i < totalChunkCount; i++) {
+ const start = i * chunkSize;
+ const end = Math.min(start + chunkSize, totalSize);
+ const chunkBuffer = videoBuffer.subarray(start, end);
+ const chunkLength = chunkBuffer.length;
+
+ this.logger.debug(`正在上传第${i + 1}/${totalChunkCount}个分片,范围: ${start}-${end-1}/${totalSize}, 大小: ${chunkLength} 字节`);
+
+ const { data } = await firstValueFrom(
+ this.httpService.put(upload_url, chunkBuffer, {
+ headers: {
+ 'Content-Type': contentType,
+ 'Content-Length': chunkLength.toString(),
+ 'Content-Range': `bytes ${start}-${end-1}/${totalSize}`,
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ lastResponse = data;
+ }
+
+ return {
+ publish_id,
+ ...lastResponse?.data,
+ };
+ }
+ } catch (error) {
+ this.logger.error('直接上传TikTok视频失败:', error.response?.data || error.message);
+ throw new BadRequestException(`直接上传视频失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 检查视频发布状态
+ * @param accessToken 访问令牌
+ * @param publishId 发布ID
+ * @returns 发布状态信息
+ */
+ async checkPublishStatus(
+ accessToken: string,
+ publishId: string
+ ): Promise<any> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.post(
+ `${this.apiBaseUrl}/v2/post/publish/status/fetch/`,
+ { publish_id: publishId },
+ {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ }
+ )
+ );
+
+ return data.data;
+ } catch (error) {
+ this.logger.error('检查TikTok视频发布状态失败:', error.response?.data || error.message);
+ throw new BadRequestException(`检查视频发布状态失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 三步式完整上传并发布视频(新版API)
+ * @param accessToken 访问令牌
+ * @param userId 用户ID
+ * @param accountId TikTok账号ID
+ * @param videoBuffer 视频数据
+ * @param videoInfo 视频信息
+ * @param pollInterval 轮询状态的时间间隔(毫秒)。默认2秒。
+ * @param maxRetries 最大重试次数。默认30次,大约60秒。
+ * @returns 视频发布结果
+ */
+ async uploadAndPublishVideo(
+ accessToken: string,
+ userId: string,
+ accountId: string,
+ videoBuffer: Buffer,
+ videoInfo: {
+ title?: string;
+ description?: string;
+ privacyStatus?: string;
+ disableComment?: boolean;
+ disableDuet?: boolean;
+ disableStitch?: boolean;
+ videoCoverTimestampMs?: number;
+ tags?: string[];
+ },
+ pollInterval: number = 2000,
+ maxRetries: number = 30
+ ): Promise<any> {
+ try {
+ // 1. 第一步:初始化视频发布
+ this.logger.debug('第一步:初始化视频发布...');
+ const videoSize = videoBuffer.length;
+ const initResult = await this.initVideoPublish(accessToken, videoSize, videoInfo);
+
+ if (!initResult.publish_id || !initResult.upload_url) {
+ throw new BadRequestException('初始化失败,缺少必要的上传参数');
+ }
+
+ const { publish_id } = initResult;
+
+ // 2. 第二步:上传视频文件
+ this.logger.debug(`第二步:上传视频文件,publish_id: ${publish_id}...`);
+ await this.directUploadVideo(accessToken, videoBuffer, initResult);
+
+ // 3. 第三步:轮询视频发布状态 // 每分钟不超过30次
+ this.logger.debug(`第三步:轮询视频发布状态,publish_id: ${publish_id}...`);
+
+ // 存储发布记录
+ const maxRecord = await this.pubRecordModel.findOne().sort({ id: -1 });
+ const newId = maxRecord ? maxRecord.id + 1 : 1;
+
+ const pubRecord = await this.pubRecordModel.create({
+ id: newId,
+ userId,
+ accountId,
+ type: PubType.VIDEO,
+ status: PubStatus.UNPUBLISH,
+ title: videoInfo.title,
+ desc: videoInfo.description,
+ attachments: [publish_id],
+ publishTime: new Date(),
+ createTime: new Date(),
+ updateTime: new Date(),
+ });
+
+ let finalStatus = null;
+ let tries = 0;
+
+ // 轮询检查发布状态
+ while (tries < maxRetries) {
+ tries++;
+
+ const statusResult = await this.checkPublishStatus(accessToken, publish_id);
+ this.logger.debug(`状态检查 ${tries}/${maxRetries}: ${JSON.stringify(statusResult)}`);
+
+ // 判断视频是否发布成功
+ // 根据实际API返回的状态字段来判断(这里的status字段可能需要根据实际情况调整)
+ if (statusResult.status === 'SUCCESS' || statusResult.status === 'PUBLISHED') {
+ finalStatus = statusResult;
+ break;
+ } else if (statusResult.status === 'FAILED' || statusResult.status === 'ERROR') {
+ // 更新发布记录为失败状态
+ await this.pubRecordModel.findByIdAndUpdate(pubRecord._id, {
+ status: PubStatus.FAIL,
+ failReason: statusResult.error_message || '发布失败',
+ updateTime: new Date()
+ });
+
+ throw new BadRequestException(`视频发布失败: ${statusResult.error_message || '未知错误'}`);
+ }
+
+ // 等待指定时间后再次查询
+ await new Promise(resolve => setTimeout(resolve, pollInterval));
+ }
+
+ if (!finalStatus) {
+ // 超时仍未完成
+ await this.pubRecordModel.findByIdAndUpdate(pubRecord._id, {
+ status: PubStatus.FAIL,
+ failReason: '检查视频发布状态超时',
+ updateTime: new Date()
+ });
+
+ throw new BadRequestException('视频发布状态检查超时,请稍后在TikTok应用中查看发布状态');
+ }
+
+ // 更新发布记录为成功状态
+ const videoId = finalStatus.video_id || finalStatus.id || publish_id;
+ await this.pubRecordModel.findByIdAndUpdate(pubRecord._id, {
+ status: PubStatus.RELEASED,
+ resourceId: videoId,
+ updateTime: new Date()
+ });
+
+ return {
+ ...finalStatus,
+ resourceId: videoId,
+ publish_id,
+ };
+ } catch (error) {
+ this.logger.error('三步式视频上传发布失败:', error.response?.data || error.message);
+ throw new BadRequestException(`视频上传发布失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 发布视频(原始方式)
+ * @param accessToken 访问令牌
+ * @param userId 用户ID
+ * @param accountId TikTok账号ID
+ * @param videoDto 视频发布参数
+ * @param uploadResult 上传结果,包含视频ID和初始化数据
+ * @returns 发布结果
+ */
+ async publishVideo(
+ accessToken: string,
+ userId: string,
+ accountId: string,
+ videoDto: CreateVideoDto,
+ uploadResult: any
+ ): Promise<any> {
+ try {
+ const videoId = uploadResult.video_id || (uploadResult.init_data?.video_id);
+ if (!videoId) {
+ throw new BadRequestException('无效的视频上传结果,缺少视频ID');
+ }
+
+ const params: any = {
+ video_id: videoId,
+ text: videoDto.description,
+ disable_comment: false,
+ disable_duet: false,
+ privacy_level: videoDto.private ? 'private' : 'public'
+ };
+
+ if (videoDto.hashtags && videoDto.hashtags.length > 0) {
+ // 添加话题标签
+ const hashtags = videoDto.hashtags.map(tag => `#${tag.replace(/^#/, '')}`).join(' ');
+ params.text = `${params.text} ${hashtags}`;
+ }
+
+ // 如果有初始化数据,添加必要的发布参数
+ if (uploadResult.init_data && uploadResult.init_data.publish_params) {
+ Object.assign(params, uploadResult.init_data.publish_params);
+ }
+
+ // 获取当前最大的 id
+ const maxRecord = await this.pubRecordModel.findOne().sort({ id: -1 });
+ const newId = maxRecord ? maxRecord.id + 1 : 1;
+
+ // 创建发布记录
+ const pubRecord = await this.pubRecordModel.create({
+ id: newId,
+ userId,
+ accountId,
+ type: PubType.VIDEO,
+ status: PubStatus.UNPUBLISH,
+ content: videoDto.description,
+ attachments: [videoId],
+ publishTime: new Date(),
+ createTime: new Date(),
+ updateTime: new Date(),
+ });
+
+ try {
+ // 获取发布URL,可能在初始化时已提供
+ const publishUrl = (uploadResult.init_data && uploadResult.init_data.publish_url) ||
+ `${this.apiBaseUrl}/v2/video/publish/`;
+
+ const { data } = await firstValueFrom(
+ this.httpService.post(publishUrl, params, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ // 更新发布记录状态
+ await this.pubRecordModel.findByIdAndUpdate(pubRecord._id, {
+ status: PubStatus.RELEASED,
+ remoteId: data.data.share_id || videoId,
+ updateTime: new Date()
+ });
+
+ return data.data;
+ } catch (error) {
+ // 更新发布记录为失败状态
+ await this.pubRecordModel.findByIdAndUpdate(pubRecord._id, {
+ status: PubStatus.FAIL,
+ failReason: error.response?.data?.error?.message || error.message,
+ updateTime: new Date()
+ });
+
+ throw error;
+ }
+ } catch (error) {
+ this.logger.error('发布TikTok视频失败:', error.response?.data || error.message);
+ throw new BadRequestException(`发布视频失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 删除视频
+ * @param accessToken 访问令牌
+ * @param videoId 视频ID
+ * @returns 删除结果
+ */
+ async deleteVideo(
+ accessToken: string,
+ videoId: string
+ ): Promise<any> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.post(`${this.apiBaseUrl}/v2/video/delete/`, {
+ video_id: videoId
+ }, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return { success: true };
+ } catch (error) {
+ this.logger.error('删除TikTok视频失败:', error.response?.data || error.message);
+ throw new BadRequestException(`删除视频失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 获取视频评论列表
+ * @param accessToken 访问令牌
+ * @param videoId 视频ID
+ * @param limit 每页结果数
+ * @param cursor 分页游标
+ * @returns 评论列表
+ */
+ async getVideoComments(
+ accessToken: string,
+ videoId: string,
+ limit = 20,
+ cursor?: string
+ ): Promise<any> {
+ try {
+ // 确保limit是数字且在有效范围内
+ limit = isNaN(Number(limit)) ? 20 : Math.min(Math.max(Number(limit), 1), 50);
+
+ const params: any = {
+ fields: 'id,text,create_time,like_count,reply_comment_total,user',
+ video_id: videoId,
+ max_count: limit
+ };
+
+ if (cursor) {
+ params.cursor = cursor;
+ }
+
+ const { data } = await firstValueFrom(
+ this.httpService.get(`${this.apiBaseUrl}/v2/comment/list/`, {
+ params,
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return data.data;
+ } catch (error) {
+ this.logger.error('获取TikTok视频评论失败:', error.response?.data || error.message);
+ throw new BadRequestException(`获取评论失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 发表评论
+ * @param accessToken 访问令牌
+ * @param commentDto 评论参数
+ * @returns 评论结果
+ */
+ async postComment(
+ accessToken: string,
+ commentDto: TikTokCommentDto
+ ): Promise<any> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.post(`${this.apiBaseUrl}/v2/comment/post/`, {
+ video_id: commentDto.videoId,
+ text: commentDto.text
+ }, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return data.data;
+ } catch (error) {
+ this.logger.error('发表TikTok评论失败:', error.response?.data || error.message);
+ throw new BadRequestException(`发表评论失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 删除评论
+ * @param accessToken 访问令牌
+ * @param videoId 视频ID
+ * @param commentId 评论ID
+ * @returns 删除结果
+ */
+ async deleteComment(
+ accessToken: string,
+ videoId: string,
+ commentId: string
+ ): Promise<any> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.post(`${this.apiBaseUrl}/v2/comment/delete/`, {
+ video_id: videoId,
+ comment_id: commentId
+ }, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return { success: true };
+ } catch (error) {
+ this.logger.error('删除TikTok评论失败:', error.response?.data || error.message);
+ throw new BadRequestException(`删除评论失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 点赞视频
+ * @param accessToken 访问令牌
+ * @param userId 用户ID
+ * @param accountId TikTok账号ID
+ * @param videoId 视频ID
+ * @returns 点赞结果
+ */
+ async likeVideo(
+ accessToken: string,
+ userId: string,
+ accountId: string,
+ videoId: string
+ ): Promise<any> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.post(`${this.apiBaseUrl}/v2/video/like/`, {
+ video_id: videoId
+ }, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return { success: true };
+ } catch (error) {
+ this.logger.error('TikTok视频点赞失败:', error.response?.data || error.message);
+ throw new BadRequestException(`视频点赞失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 取消点赞视频
+ * @param accessToken 访问令牌
+ * @param userId 用户ID
+ * @param accountId TikTok账号ID
+ * @param videoId 视频ID
+ * @returns 取消点赞结果
+ */
+ async unlikeVideo(
+ accessToken: string,
+ userId: string,
+ accountId: string,
+ videoId: string
+ ): Promise<any> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.post(`${this.apiBaseUrl}/v2/video/unlike/`, {
+ video_id: videoId
+ }, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return { success: true };
+ } catch (error) {
+ this.logger.error('取消TikTok视频点赞失败:', error.response?.data || error.message);
+ throw new BadRequestException(`取消视频点赞失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 搜索视频
+ * @param accessToken 访问令牌
+ * @param filterDto 搜索过滤参数
+ * @returns 搜索结果
+ */
+ async searchVideos(
+ accessToken: string,
+ filterDto: TikTokVideoFilterDto
+ ): Promise<any> {
+ try {
+ // 确保limit是数字且在有效范围内
+ const limit = isNaN(Number(filterDto.limit)) ? 10 : Math.min(Math.max(Number(filterDto.limit), 1), 50);
+
+ const params: any = {
+ fields: 'id,create_time,video_description,duration,height,width,share_count,comment_count,like_count,view_count,title,embed_link,thumbnail_url',
+ max_count: limit,
+ search_key: filterDto.keyword || ''
+ };
+
+ if (filterDto.cursor) {
+ params.cursor = filterDto.cursor;
+ }
+
+ const { data } = await firstValueFrom(
+ this.httpService.get(`${this.apiBaseUrl}/v2/video/search/`, {
+ params,
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ // 如果设置了最低播放次数过滤
+ let videos = data.data.videos || [];
+ if (filterDto.minPlayCount && !isNaN(Number(filterDto.minPlayCount)) && Number(filterDto.minPlayCount) > 0) {
+ videos = videos.filter(video => {
+ return video.view_count >= Number(filterDto.minPlayCount);
+ });
+ }
+
+ return {
+ videos: videos,
+ cursor: data.data.cursor,
+ has_more: data.data.has_more
+ };
+ } catch (error) {
+ this.logger.error('搜索TikTok视频失败:', error.response?.data || error.message);
+ throw new BadRequestException(`搜索视频失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+
+ /**
+ * 获取用户TikTok账号信息
+ * @param accessToken 访问令牌
+ * @param accountId TikTok账号ID
+ * @returns 账号信息
+ */
+ async getUserProfile(
+ accessToken: string,
+ accountId: string
+ ): Promise<any> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.get(`${this.apiBaseUrl}/v2/user/info/`, {
+ params: {
+ fields: 'open_id,union_id,avatar_url,bio_description,profile_deep_link,is_verified,follower_count,following_count,likes_count,video_count,nickname',
+ open_id: accountId
+ },
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return data.data.user;
+ } catch (error) {
+ this.logger.error('获取TikTok用户信息失败:', error.response?.data || error.message);
+ throw new BadRequestException(`获取用户信息失败: ${error.response?.data?.error?.message || error.message}`);
+ }
+ }
+}
diff --git a/server/src/modules/plat/twitter/comment.ts b/server/src/modules/plat/twitter/comment.ts
new file mode 100644
index 00000000..73a91e28
--- /dev/null
+++ b/server/src/modules/plat/twitter/comment.ts
@@ -0,0 +1,13 @@
+export enum VideoUTypes {
+ Little = 0,
+ Big = 1,
+}
+
+export interface AccessToken {
+ access_token: string;
+ expires_in: number;
+ refresh_token: string;
+ scopes: string[];
+ token_type: string;
+ id_token: string;
+}
diff --git a/server/src/modules/plat/twitter/dto/twitter.dto.ts b/server/src/modules/plat/twitter/dto/twitter.dto.ts
new file mode 100644
index 00000000..9c6408e5
--- /dev/null
+++ b/server/src/modules/plat/twitter/dto/twitter.dto.ts
@@ -0,0 +1,32 @@
+export interface TwitterOAuthTokenResponse {
+ token_type: 'bearer';
+ expires_in: number; // typically 7200 seconds (2 hours)
+ access_token: string;
+ scope: string; // e.g., "users.read tweet.read offline.access"
+ refresh_token?: string; // Present if 'offline.access' scope was requested
+}
+
+export interface TwitterUser {
+ id: string;
+ name: string; // Display name
+ username: string; // Handle
+ profile_image_url?: string;
+ description?: string;
+ public_metrics?: {
+ followers_count: number;
+ following_count: number;
+ tweet_count: number;
+ listed_count: number;
+ };
+ created_at?: string; // ISO 8601 date string
+ verified?: boolean;
+ // Add other fields as needed from the Twitter API v2 user object
+}
+
+// For storing in our AccountToken schema
+export interface TwitterStoredTokenInfo {
+ accessToken: string;
+ refreshToken?: string;
+ expiresAt: Date;
+ scopes: string[];
+}
\ No newline at end of file
diff --git a/server/src/modules/plat/twitter/twitter.auth.service.ts b/server/src/modules/plat/twitter/twitter.auth.service.ts
new file mode 100644
index 00000000..8401dbb5
--- /dev/null
+++ b/server/src/modules/plat/twitter/twitter.auth.service.ts
@@ -0,0 +1,584 @@
+import { Injectable, Inject, forwardRef, BadRequestException, HttpException, HttpStatus } from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+import { HttpService } from '@nestjs/axios';
+import { Model } from 'mongoose';
+import { InjectModel } from '@nestjs/mongoose';
+import { firstValueFrom } from 'rxjs';
+import * as crypto from 'crypto';
+
+import { RedisService } from 'src/lib/redis/redis.service';
+import { AuthService } from 'src/auth/auth.service';
+import { AccountService } from 'src/modules/account/account.service';
+import { Account, AccountStatus, AccountType } from 'src/db/schema/account.schema';
+import { AccountToken, TokenPlatform, TokenStatus } from 'src/db/schema/accountToken.schema';
+import { User } from 'src/db/schema/user.schema';
+import { IdService } from 'src/db/id.service';
+import { getCurrentTimestamp } from 'src/util/time.util';
+import axios from 'axios'
+
+import { TwitterOAuthTokenResponse, TwitterUser } from './dto/twitter.dto';
+
+// Twitter API Constants
+const TWITTER_API_V2_BASE_URL = 'https://api.twitter.com/2';
+const TOKEN_URL = 'https://api.twitter.com/2/oauth2/token';
+const AUTHORIZE_URL = 'https://twitter.com/i/oauth2/authorize';
+
+@Injectable()
+export class TwitterAuthService {
+ private webClientSecret: string;
+ private webClientId: string;
+ private webRenderBaseUrl: string;
+
+ constructor(
+ private readonly configService: ConfigService,
+ private readonly httpService: HttpService,
+ private readonly redisService: RedisService,
+ private readonly idService: IdService,
+ @Inject(forwardRef(() => AuthService))
+ private readonly authService: AuthService,
+ private readonly accountService: AccountService,
+ @InjectModel(User.name) private readonly userModel: Model<User>,
+ @InjectModel(Account.name) private readonly accountModel: Model<Account>,
+ @InjectModel(AccountToken.name) private readonly accountTokenModel: Model<AccountToken>,
+ ) {
+ this.initTwitterSecrets();
+ }
+ /**
+ * 初始化Twitter API密钥
+ */
+ private initTwitterSecrets() {
+ // 从配置服务获取Twitter API密钥
+ this.webClientId = this.configService.get<string>('TWITTER_CONFIG.WEB_CLIENT_ID');
+ this.webClientSecret = this.configService.get<string>('TWITTER_CONFIG.WEB_CLIENT_SECRET');
+ this.webRenderBaseUrl = this.configService.get<string>('TWITTER_CONFIG.WEB_RENDER_URL');
+
+ if (!this.webClientId || !this.webClientSecret || !this.webRenderBaseUrl) {
+ console.warn('Twitter API配置缺失,请检查环境变量或配置文件');
+ }
+ }
+
+ /**
+ * 生成PKCE码校验器和挑战码
+ */
+ private generatePKCE(): { codeVerifier: string; codeChallenge: string } {
+ // 生成随机码验证器
+ const codeVerifier = crypto.randomBytes(32).toString('base64url');
+
+ // 生成码挑战
+ const codeChallenge = crypto
+ .createHash('sha256')
+ .update(codeVerifier)
+ .digest('base64url');
+
+ return { codeVerifier, codeChallenge };
+ }
+
+ /**
+ * 获取Twitter授权URL
+ * @param userId 用户ID
+ * @param mail 用户邮箱
+ * @returns 包含授权URL的对象
+ */
+ async getAuthorizationUrl(userId: string, mail?: string): Promise<object> {
+ const state = crypto.randomBytes(16).toString('hex');
+ const { codeVerifier, codeChallenge } = this.generatePKCE();
+
+ // 存储状态数据和PKCE验证码
+ const stateData = {
+ originalState: state,
+ userId: userId,
+ email: mail,
+ codeVerifier: codeVerifier
+ };
+
+ // 将状态数据保存到Redis,5分钟有效期
+ await this.redisService.setKey(`twitter:state:${state}`, JSON.stringify(stateData), 600);
+
+ // 定义请求的权限范围
+ const scopes = [
+ 'tweet.write',
+ 'tweet.read',
+ 'tweet.moderate.write',
+ 'users.read',
+ 'space.read',
+ 'like.read',
+ 'like.write',
+ 'list.read',
+ 'list.write',
+ 'media.write',
+ 'offline.access']; // offline.access用于获取刷新令牌
+
+ // 构建授权URL参数
+ const params = new URLSearchParams({
+ response_type: 'code',
+ client_id: this.webClientId,
+ redirect_uri: `${this.webRenderBaseUrl}/api/plat/twitter/auth/callback`,
+ scope: scopes.join(' '),
+ state: state,
+ code_challenge: codeChallenge,
+ code_challenge_method: 'S256', // 使用SHA-256算法
+ });
+
+ // 构建完整的授权URL
+ const authUrl = `${AUTHORIZE_URL}?${params.toString()}`;
+ console.log('Twitter授权URL:', authUrl);
+
+ return { url: authUrl };
+ }
+
+ /**
+ * 处理Twitter授权回调
+ * @param code 授权码
+ * @param state 状态码
+ * @returns 处理结果
+ */
+ async handleAuthorizationCallback(code: string, state: string): Promise<object> {
+ // 从Redis获取存储的状态数据
+ const stateDataJson = await this.redisService.get(`twitter:state:${state}`);
+ if (!stateDataJson) {
+ throw new BadRequestException('无效或过期的状态码');
+ }
+ // 解析状态数据
+ const stateData = JSON.parse(stateDataJson);
+ const { userId, codeVerifier } = stateData;
+
+ // 验证状态数据
+ if (!userId || !codeVerifier) {
+ throw new BadRequestException('状态数据不完整');
+ }
+
+ try {
+ // 删除Redis中的状态数据
+ await this.redisService.del(`twitter:state:${state}`);
+
+ // 交换授权码获取访问令牌
+ const tokenResponse = await this.exchangeCodeForTokens(code, codeVerifier);
+ const { access_token, refresh_token, expires_in, scope } = tokenResponse;
+
+ // 获取Twitter用户资料
+ const twitterUser = await this.getTwitterUserProfile(access_token);
+
+ // 获取或存储刷新令牌
+ console.log('获取到Twitter访问令牌:', access_token.substring(0, 10) + '...');
+ console.log('有效期:', expires_in, '秒');
+
+ // 更新或创建账户信息
+ await this.updateTwitterAccountInfo(
+ userId,
+ twitterUser.id,
+ access_token,
+ refresh_token,
+ expires_in
+ );
+
+ // 缓存访问令牌
+ await this.redisService.setKey(
+ `twitter:accessToken:${twitterUser.id}`,
+ {
+ access_token,
+ refresh_token,
+ expires_in
+ },
+ expires_in
+ );
+
+ // 查询更新后的账号信息
+ const existingAccount = await this.accountModel.findOne({
+ type: AccountType.TWITTER,
+ uid: twitterUser.id
+ });
+
+ // 生成并返回结果
+ const results = {
+ data: {
+ accountInfo: existingAccount,
+ userInfo: {
+ userId: userId,
+ uid: twitterUser.id
+ }
+ },
+ msg: "success",
+ code: 0
+ };
+
+ console.log("最终返回", results);
+ return results;
+
+ } catch (error) {
+ console.error('处理Twitter授权回调失败:', error);
+ throw new HttpException(
+ error.response?.data?.error_description || '授权失败',
+ error.response?.status || HttpStatus.INTERNAL_SERVER_ERROR
+ );
+ }
+ }
+ /**
+ * 交换授权码获取令牌
+ * @param code 授权码
+ * @param codeVerifier PKCE验证码
+ * @returns Twitter OAuth令牌响应
+ */
+ private async exchangeCodeForTokens(code: string, codeVerifier: string): Promise<TwitterOAuthTokenResponse> {
+ const params = new URLSearchParams({
+ grant_type: 'authorization_code',
+ code: code,
+ client_id: this.webClientId,
+ redirect_uri: `${this.webRenderBaseUrl}/api/plat/twitter/auth/callback`,
+ code_verifier: codeVerifier,
+ });
+
+ const base64Credentials = Buffer.from(`${this.webClientId}:${this.webClientSecret}`).toString('base64');
+
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.post<TwitterOAuthTokenResponse>(TOKEN_URL, params.toString(), {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Authorization': `Basic ${base64Credentials}`,
+ },
+ }),
+ );
+ return data;
+ } catch (error) {
+ console.error('交换Twitter授权码失败:', error.response?.data || error.message);
+ throw new HttpException(
+ error.response?.data?.error_description || '获取Twitter令牌失败',
+ error.response?.status || HttpStatus.BAD_REQUEST,
+ );
+ }
+ }
+
+ /**
+ * 获取Twitter用户资料
+ * @param accessToken 访问令牌
+ * @returns Twitter用户资料
+ */
+ private async getTwitterUserProfile(accessToken: string): Promise<TwitterUser> {
+ try {
+ const { data } = await firstValueFrom(
+ this.httpService.get<{ data: TwitterUser }>(`${TWITTER_API_V2_BASE_URL}/users/me`, {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ params: {
+ 'user.fields': 'id,name,username,profile_image_url,description,public_metrics,created_at,verified',
+ },
+ }),
+ );
+ return data.data;
+ } catch (error) {
+ console.error('获取Twitter用户资料失败:', error.response?.data || error.message);
+ throw new HttpException(
+ error.response?.data?.detail || '获取Twitter用户资料失败',
+ error.response?.status || HttpStatus.INTERNAL_SERVER_ERROR,
+ );
+ }
+ }
+
+ /**
+ * 更新Twitter账户信息
+ * 根据Twitter用户ID创建或更新账户
+ * @param userId 用户ID
+ * @param twitterId Twitter用户ID
+ * @param accessToken 访问令牌
+ * @param refreshToken 刷新令牌
+ * @param expires_in 令牌有效期(秒)
+ */
+ private async updateTwitterAccountInfo(
+ userId: string,
+ twitterId: string,
+ accessToken: string,
+ refreshToken: string,
+ expires_in: number
+ ): Promise<void> {
+ try {
+ // 获取Twitter用户资料
+ const twitterUser = await this.getTwitterUserProfile(accessToken);
+
+ // 准备账号信息
+ const channelInfo = {
+ userId: userId,
+ type: AccountType.TWITTER,
+ uid: twitterId,
+ account: twitterUser.username,
+ nickname: twitterUser.name,
+ avatar: twitterUser.profile_image_url,
+ homePage: `https://twitter.com/${twitterUser.username}`,
+ fansCount: twitterUser.public_metrics?.followers_count || 0,
+ followCount: twitterUser.public_metrics?.following_count || 0,
+ workCount: twitterUser.public_metrics?.tweet_count || 0,
+ likeCount: 0,
+ readCount: 0,
+ collectCount: 0,
+ forwardCount: 0,
+ commentCount: 0,
+ updateTime: new Date(),
+ status: AccountStatus.USABLE,
+ loginCookie: "1111", // Twitter不使用cookie认证
+ token: "111", // 存储访问令牌
+ };
+
+ console.log(channelInfo);
+
+ // 使用AccountService创建或更新账户
+ const account = await this.accountService.addOrUpdateAccount(channelInfo);
+ console.log("成功创建或更新Twitter账号:", account);
+
+ // 检查是否存在账号Token
+ let accountToken = await this.accountTokenModel.findOne({
+ accountId: twitterId,
+ platform: TokenPlatform.TWITTER
+ });
+
+ if (accountToken) {
+ if (refreshToken && refreshToken.trim() !== '') {
+ accountToken.refreshToken = refreshToken;
+ }
+ // 更新现有Token
+ // await this.accountTokenModel.findOneAndUpdate(
+ // { accountId: twitterId, platform: TokenPlatform.TWITTER },
+ // {
+ // refreshToken: refreshToken,
+ // updateTime: new Date(),
+ // expiresAt: new Date((getCurrentTimestamp() + expires_in) * 1000)
+ // },
+ // );
+ accountToken.expiresAt = new Date((getCurrentTimestamp() + expires_in) * 1000);
+ accountToken.updateTime = new Date();
+ await accountToken.save();
+ console.log("成功更新Twitter账号Token");
+ } else {
+ // 创建新Token
+ await this.accountTokenModel.create({
+ userId,
+ accountId: twitterId,
+ platform: TokenPlatform.TWITTER,
+ refreshToken: refreshToken,
+ expiresAt: new Date((getCurrentTimestamp() + expires_in) * 1000),
+ status: TokenStatus.USABLE,
+ createTime: new Date(),
+ updateTime: new Date(),
+ });
+ console.log("成功创建Twitter账号Token");
+ }
+ } catch (error) {
+ console.error('更新Twitter账号信息失败:', error);
+ // 不抛出异常,避免影响授权流程
+ }
+ }
+
+ /**
+ * 刷新用户的Twitter访问令牌
+ * @param userId 用户ID
+ * @param accountId 账号ID
+ * @param refreshToken 刷新令牌
+ * @returns 新的访问令牌信息
+ */
+ async refreshAccessToken(userId: string, accountId: string, refreshToken: string): Promise<object> {
+ console.log(userId, accountId, refreshToken);
+ try {
+ const params = new URLSearchParams({
+ grant_type: 'refresh_token',
+ refresh_token: refreshToken,
+ client_id: this.webClientId,
+ // redirect_uri: `${this.webRenderBaseUrl}/api/plat/twitter/auth/callback`,
+ });
+ // 请求体的参数
+ // const params = new URLSearchParams({
+ // client_id: this.webClientId, // 使用你的 client_id
+ // client_secret: this.webClientSecret, // 使用你的 client_secret
+ // refresh_token: refreshToken, // 提供刷新令牌
+ // grant_type: 'refresh_token', // 认证类型是刷新令牌
+ // });
+
+ const base64Credentials = Buffer.from(`${this.webClientId}:${this.webClientSecret}`).toString('base64');
+
+ const { data } = await firstValueFrom(
+ this.httpService.post(TOKEN_URL, params.toString(), {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Authorization': `Basic ${base64Credentials}`,
+ },
+ // auth: {
+ // username: this.webClientId,
+ // password: this.webClientSecret
+ // }
+ })
+ );
+ // const response = await axios.post(TOKEN_URL, params.toString(), {
+ // headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ // });
+ // console.log("================response================")
+ // console.log(response);
+ // const accessTokenInfo = response.data;
+ // // console.log("================accessTokenInfo================")
+ // // console.log(accessTokenInfo);
+ // // 剩余有效秒数
+ // const expires = accessTokenInfo.expires_in
+ // const { data } = await firstValueFrom(
+ // this.httpService.post(TOKEN_URL, params.toString(), {
+ // headers: {
+ // 'Content-Type': 'application/x-www-form-urlencoded'
+ // }
+ // })
+ // );
+ // await this.redisService.setKey(
+ // `twitter:accessToken:${accountId}`,
+ // accessTokenInfo,
+ // expires
+ // );
+ console.log('Twitter API响应:', JSON.stringify(data));
+ const { access_token, refresh_token, expires_in } = data;
+
+ // 更新Redis中的令牌
+ const TokenInfo = { access_token, refresh_token, expires_in };
+ await this.redisService.setKey(
+ `twitter:accessToken:${accountId}`,
+ TokenInfo,
+ expires_in
+ );
+
+ console.log('刷新Twitter访问令牌成功');
+ const userInfo = await this.userModel.findOne({_id: userId});
+ const systemTokenInfo = {
+ phone: userInfo?.phone ?? '', // 如果 userInfo.phone 为 undefined 或 null,则使用空字符串
+ id: userId,
+ name: userInfo.name,
+ isManager: false,
+ googleId: userInfo?.googleAccount?.googleId ?? ''
+ }
+ // 生成系统令牌
+ const systemToken = await this.authService.generateToken(systemTokenInfo);
+
+ return { url: systemToken };
+ } catch (err) {
+ console.log(err);
+ console.error('刷新Twitter访问令牌失败:', err.response?.data || err.message);
+ throw new HttpException(
+ err.response?.data?.error_description || '刷新令牌失败',
+ err.response?.status || HttpStatus.BAD_REQUEST
+ );
+ }
+ }
+
+ /**
+ * 获取用户的Twitter访问令牌
+ * @param accountId 账号ID
+ * @returns 访问令牌
+ */
+ async getUserAccessToken(accountId: string): Promise<string> {
+ console.log("获取访问令牌,accountId:", accountId);
+
+ // 先检查Redis缓存
+ const cachedToken = await this.redisService.get(`twitter:accessToken:${accountId}`);
+ if (cachedToken && cachedToken.access_token) {
+ console.log("从Redis获取到有效令牌");
+ return cachedToken.access_token;
+ }
+
+ // 如果缓存中没有,尝试刷新
+ const accountTokenInfo = await this.accountTokenModel.findOne({accountId: accountId});
+ if (!accountTokenInfo || !accountTokenInfo.refreshToken) {
+ throw new BadRequestException('无效的账号或刷新令牌丢失');
+ }
+
+ // 刷新并获取新令牌
+ const refreshResult = await this.refreshAccessToken(
+ accountTokenInfo.userId,
+ accountTokenInfo.accountId,
+ accountTokenInfo.refreshToken
+ );
+
+ // 刷新后再次从Redis获取
+ const newToken = await this.redisService.get(`twitter:accessToken:${accountId}`);
+ if (!newToken || !newToken.access_token) {
+ throw new BadRequestException('刷新令牌后未能获取访问令牌');
+ }
+
+ return newToken.access_token;
+ }
+
+ /**
+ * 检查用户是否已授权Twitter
+ * @param accountId 账号ID
+ * @returns 是否已授权
+ */
+ async isAuthorized(accountId: string): Promise<boolean> {
+ try {
+ const accessToken = await this.getUserAccessToken(accountId);
+ return !!accessToken;
+ } catch (error) {
+ return false;
+ }
+ }
+
+ /**
+ * 撤销Twitter授权
+ * @param accountId 账号ID
+ * @returns 撤销结果
+ */
+ async revokeAuthorization(accountId: string): Promise<boolean> {
+ try {
+ const accessToken = await this.getUserAccessToken(accountId);
+ if (!accessToken) {
+ return true; // 已经没有授权了
+ }
+
+ // 撤销Twitter令牌
+ const params = new URLSearchParams({
+ token: accessToken,
+ client_id: this.webClientId,
+ token_type_hint: 'access_token'
+ });
+
+ const base64Credentials = Buffer.from(`${this.webClientId}:${this.webClientSecret}`).toString('base64');
+
+ await firstValueFrom(
+ this.httpService.post(`${TWITTER_API_V2_BASE_URL}/oauth2/revoke`, params.toString(), {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Authorization': `Basic ${base64Credentials}`,
+ },
+ }),
+ );
+
+ // 删除缓存的令牌
+ await this.redisService.del(`twitter:accessToken:${accountId}`);
+
+ // 更新用户信息,移除授权信息
+ await this.accountTokenModel.updateOne(
+ { accountId: accountId },
+ { $unset: { 'refreshToken': 1, 'expiresAt': 1 } }
+ );
+
+ return true;
+ } catch (error) {
+ console.error('撤销Twitter授权失败:', error);
+ return false;
+ }
+ }
+
+ /**
+ * 获取初始化后的Twitter API客户端
+ * @param accountId 账号ID
+ * @returns 初始化后的客户端
+ */
+ async getTwitterClient(accountId: string): Promise<any> {
+ const accessToken = await this.getUserAccessToken(accountId);
+ if (!accessToken) {
+ throw new Error('No access token available, user needs to authorize');
+ }
+
+ // 返回一个简单的API客户端,可以根据需要扩展
+ return {
+ headers: {
+ Authorization: `Bearer ${accessToken}`
+ },
+ baseUrl: TWITTER_API_V2_BASE_URL,
+ async get(endpoint: string, params = {}) {
+ // 这里可以实现实际的API调用逻辑
+ // 或者使用第三方Twitter客户端库
+ }
+ };
+ }
+}
diff --git a/server/src/modules/plat/twitter/twitter.controller.ts b/server/src/modules/plat/twitter/twitter.controller.ts
new file mode 100644
index 00000000..0ccd657f
--- /dev/null
+++ b/server/src/modules/plat/twitter/twitter.controller.ts
@@ -0,0 +1,385 @@
+import { Controller, Get, Post, Body, Query, Res, BadRequestException, Delete, Param, HttpCode, UploadedFile, UseInterceptors } from '@nestjs/common';
+import { ApiTags, ApiOperation, ApiQuery, ApiBody, ApiParam, ApiConsumes } from '@nestjs/swagger';
+import { Response } from 'express';
+import { GetToken, Public } from 'src/auth/auth.guard';
+import { FileInterceptor } from '@nestjs/platform-express';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+
+import { TwitterAuthService } from './twitter.auth.service';
+import { TwitterService } from './twitter.service';
+
+@ApiTags('plat/twitter - twitter平台')
+@Controller('plat/twitter')
+export class TwitterController {
+ constructor(
+ private readonly twitterAuthService: TwitterAuthService,
+ private readonly twitterService: TwitterService,
+ ) {}
+
+ /**
+ * 获取Twitter授权URL
+ */
+ @Get('auth/url')
+ @ApiOperation({ summary: '获取Twitter授权URL' })
+ @ApiQuery({ name: 'mail', required: false, description: '用户邮箱' })
+ async getAuthUrl(
+ @GetToken() systemToken: TokenInfo,
+ @Query('mail') mail: string,
+ ) {
+ if (!systemToken.id || !mail) {
+ throw new BadRequestException('token和mail是必须的');
+ }
+ return this.twitterAuthService.getAuthorizationUrl(systemToken.id, mail);
+ }
+
+ /**
+ * 处理Twitter OAuth回调
+ */
+ @Get('auth/callback')
+ @ApiOperation({ summary: 'Twitter授权回调' })
+ // @ApiQuery({ name: 'code', required: true, description: '授权码' })
+ // @ApiQuery({ name: 'state', required: true, description: '状态值' })
+ @Public()
+ async handleOAuthCallback(
+ // @GetToken() systemToken: TokenInfo,
+ @Query('code') code: string,
+ @Query('state') state: string,
+ @Res() res: Response,
+ ) {
+ if (!code || !state) {
+ throw new BadRequestException('缺少必要的参数');
+ }
+ console.log(code, state);
+ try {
+
+ // 处理授权回调
+ const results = await this.twitterAuthService.handleAuthorizationCallback(code, state);
+
+ // 获取重定向URL,如果存在的话
+ // const redirectUrl = process.env.TWITTER_AUTH_SUCCESS_REDIRECT || 'https://your-frontend-app/auth/success';
+
+ // // 重定向到前端应用,带上必要的参数
+ // return res.redirect(`${redirectUrl}?success=true`);
+ const render_msg = {
+ message: "授权成功! 这里是添加账号成功后的前端页面," ,
+ datas: results
+ };
+
+ return res.render('google/index', render_msg);
+
+ } catch (error) {
+ console.error('Twitter授权回调处理失败:', error);
+
+ // 获取失败重定向URL
+ const failureRedirectUrl = process.env.TWITTER_AUTH_FAILURE_REDIRECT || 'https://your-frontend-app/auth/failure';
+
+ // 重定向到前端失败页面,带上错误信息
+ // return res.redirect(`${failureRedirectUrl}?error=${encodeURIComponent(error.message || 'Unknown error')}`);
+ return false
+ }
+ }
+
+ /**
+ * 检查用户是否已授权Twitter
+ */
+ @Get('auth/check')
+ @ApiOperation({ summary: '检查用户Twitter授权状态' })
+ @ApiQuery({ name: 'accountId', required: true, description: 'Twitter账号ID' })
+ async checkAuthStatus(
+ @GetToken() systemToken: TokenInfo,
+ @Query('accountId') accountId: string
+ ) {
+ if (!accountId) {
+ throw new BadRequestException('accountId是必须的');
+ }
+
+ return await this.twitterAuthService.isAuthorized(accountId);
+ }
+
+ /**
+ * 撤销Twitter授权
+ */
+ @Post('auth/revoke')
+ @ApiOperation({ summary: '撤销Twitter授权' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: 'Twitter账号ID' }
+ }
+ }
+ })
+ async revokeAuth(
+ @GetToken() systemToken: TokenInfo,
+ @Body('accountId') accountId: string
+ ) {
+ if (!accountId) {
+ throw new BadRequestException('accountId是必须的');
+ }
+
+ return await this.twitterAuthService.revokeAuthorization(accountId);
+ }
+
+ /**
+ * 刷新Twitter访问令牌
+ */
+ @Post('auth/refresh')
+ @ApiOperation({ summary: '刷新Twitter访问令牌' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ userId: { type: 'string', description: '用户ID' },
+ accountId: { type: 'string', description: 'Twitter账号ID' },
+ refreshToken: { type: 'string', description: '刷新令牌' }
+ }
+ }
+ })
+ async refreshToken(
+ @GetToken() systemToken: TokenInfo,
+ @Body('userId') userId: string,
+ @Body('accountId') accountId: string,
+ @Body('refreshToken') refreshToken: string
+ ) {
+ if (!userId || !accountId || !refreshToken) {
+ throw new BadRequestException('缺少必要的参数');
+ }
+
+ return this.twitterAuthService.refreshAccessToken(userId, accountId, refreshToken);
+ }
+
+ /**
+ * 获取用户的Twitter时间线
+ */
+ @Get('timeline')
+ @ApiOperation({ summary: '获取用户的Twitter时间线' })
+ // @ApiQuery({ name: 'userId', required: true, description: '用户ID' })
+ @ApiQuery({ name: 'accountId', required: true, description: '账号ID' })
+ @ApiQuery({ name: 'maxResults', required: false, description: '最大结果数', type: 'number' })
+ async getUserTimeline(
+ @GetToken() systemToken: TokenInfo,
+ // @Query('userId') userId: string,
+ @Query('accountId') accountId: string,
+ @Query('maxResults') maxResults?: number,
+ ) {
+
+ const userId = systemToken.id;
+ if (!userId || !accountId) {
+ throw new BadRequestException('userId和accountId是必须的');
+ }
+
+ const accessToken = await this.twitterAuthService.getUserAccessToken(accountId);
+
+ return this.twitterService.getUserTimeline(accessToken, userId, accountId, maxResults);
+ }
+
+ /**
+ * 发布新推文
+ */
+ @Post('tweets/create')
+ @ApiOperation({ summary: '发布新推文' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ // userId: { type: 'string', description: '用户ID' },
+ accountId: { type: 'string', description: 'Twitter账号ID' },
+ text: { type: 'string', description: '推文内容' },
+ mediaIds: { type: 'array', items: { type: 'string' }, description: '媒体ID列表(可选)' }
+ },
+ required: ['userId', 'accountId', 'text']
+ }
+ })
+ @HttpCode(201)
+ async createTweet(
+ @GetToken() systemToken: TokenInfo,
+ // @Body('userId') userId: string,
+ @Body('accountId') accountId: string,
+ @Body('text') text: string,
+ @Body('mediaIds') mediaIds?: string[],
+ ) {
+ const userId = systemToken.id;
+ if (!userId || !accountId || !text) {
+ throw new BadRequestException('userId, accountId和text是必须的');
+ }
+
+ const accessToken = await this.twitterAuthService.getUserAccessToken(accountId);
+ return this.twitterService.createTweet(accessToken, userId, accountId, text, mediaIds);
+ }
+
+ /**
+ * 上传媒体文件
+ */
+ @Post('media/upload')
+ @ApiOperation({ summary: '上传媒体文件' })
+ @ApiConsumes('multipart/form-data')
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ userId: { type: 'string' },
+ accountId: { type: 'string' },
+ file: {
+ type: 'string',
+ format: 'binary',
+ },
+ },
+ },
+ })
+ @UseInterceptors(FileInterceptor('file'))
+ async uploadMedia(
+ @GetToken() systemToken: TokenInfo,
+ // @Body('userId') userId: string,
+ @Body('accountId') accountId: string,
+ @UploadedFile() file: Express.Multer.File,
+ ) {
+ const userId = systemToken.id;
+ if (!userId || !accountId || !file) {
+ throw new BadRequestException('userId, accountId和file是必须的');
+ }
+
+ const accessToken = await this.twitterAuthService.getUserAccessToken(accountId);
+ return this.twitterService.uploadMedia(accessToken, userId, accountId, file.buffer, file.mimetype);
+ }
+
+ /**
+ * 获取推文详情
+ */
+ @Get('tweets/detail')
+ @ApiOperation({ summary: '获取推文详情' })
+ @ApiQuery({ name: 'tweetId', type: 'string', description: '推文ID' })
+ // @ApiQuery({ name: 'userId', required: true, description: '用户ID' })
+ @ApiQuery({ name: 'accountId', required: true, description: 'Twitter账号ID' })
+ async getTweetDetail(
+ @GetToken() systemToken: TokenInfo,
+ @Query('tweetId') tweetId: string,
+ // @Query('userId') userId: string,
+ @Query('accountId') accountId: string,
+ ) {
+ const userId = systemToken.id;
+ if (!tweetId || !userId || !accountId) {
+ throw new BadRequestException('tweetId, userId和accountId是必须的');
+ }
+
+ const accessToken = await this.twitterAuthService.getUserAccessToken(accountId);
+ return this.twitterService.getTweetDetail(accessToken, userId, accountId, tweetId);
+ }
+
+ /**
+ * 获取推文统计数据
+ */
+ @Get('tweets/metrics')
+ @ApiOperation({ summary: '获取推文统计数据' })
+ @ApiQuery({ name: 'tweetId', type: 'string', description: '推文ID' })
+ // @ApiQuery({ name: 'userId', required: true, description: '用户ID' })
+ @ApiQuery({ name: 'accountId', required: true, description: 'Twitter账号ID' })
+ async getTweetMetrics(
+ @GetToken() systemToken: TokenInfo,
+ @Query('tweetId') tweetId: string,
+ // @Query('userId') userId: string,
+ @Query('accountId') accountId: string,
+ ) {
+ const userId = systemToken.id;
+ if (!tweetId || !userId || !accountId) {
+ throw new BadRequestException('tweetId, userId和accountId是必须的');
+ }
+
+ const accessToken = await this.twitterAuthService.getUserAccessToken(accountId);
+ return this.twitterService.getTweetMetrics(accessToken, userId, accountId, tweetId);
+ }
+
+ /**
+ * 删除推文
+ */
+ @Post('tweets/delete')
+ @ApiOperation({ summary: '删除推文' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: '账号ID' },
+ tweetId: { type: 'string', description: '推文ID' }
+ },
+ required: ['accountId', 'tweetId']
+ }
+ })
+
+ async deleteTweet(
+ @GetToken() systemToken: TokenInfo,
+ @Body('tweetId') tweetId: string,
+ @Body('accountId') accountId: string,
+ ) {
+ const userId = systemToken.id;
+ if (!tweetId || !userId || !accountId) {
+ throw new BadRequestException('tweetId, userId和accountId是必须的');
+ }
+
+ const accessToken = await this.twitterAuthService.getUserAccessToken(accountId);
+ return this.twitterService.deleteTweet(accessToken, userId, accountId, tweetId);
+ }
+
+ /**
+ * 搜索推文
+ */
+ @Get('tweets/search')
+ @ApiOperation({ summary: '搜索推文' })
+ @ApiQuery({ name: 'accountId', required: true, description: 'Twitter账号ID' })
+ @ApiQuery({ name: 'query', required: true, description: '搜索关键词' })
+ @ApiQuery({ name: 'maxResults', required: false, description: '最大结果数', type: 'number' })
+ async searchTweets(
+ @GetToken() systemToken: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('query') query: string,
+ @Query('maxResults') maxResults?: number,
+ ) {
+ const userId = systemToken.id;
+ if (!userId || !accountId || !query) {
+ throw new BadRequestException('userId, accountId和query是必须的');
+ }
+
+ const accessToken = await this.twitterAuthService.getUserAccessToken(accountId);
+ return this.twitterService.searchTweets(accessToken, userId, accountId, query, maxResults);
+ }
+
+ /**
+ * 对推文点赞、取消点赞
+ */
+ @Post('tweets/rate')
+ @ApiOperation({ summary: '对推文点赞、取消点赞' })
+ @ApiBody({
+ schema: {
+ type: 'object',
+ properties: {
+ accountId: { type: 'string', description: '账号ID' },
+ tweetId: { type: 'string', description: '推文ID' },
+ rating: { type: 'string', description: '点赞 like、取消点赞 unlike' }
+ },
+ required: ['accountId', 'tweetId', 'rating']
+ }
+ })
+ async rateTweet(
+ @GetToken() systemToken: TokenInfo,
+ @Body('tweetId') tweetId: string,
+ @Body('accountId') accountId: string,
+ @Body('rating') rating: string,
+ ) {
+ const userId = systemToken.id;
+ if (!tweetId || !userId || !accountId || ! rating) {
+ throw new BadRequestException('tweetId, rating和accountId是必须的');
+ }
+
+ const accessToken = await this.twitterAuthService.getUserAccessToken(accountId);
+ // 在方法开始处验证
+ if (!["like", "unlike"].includes(rating)) {
+ throw new BadRequestException('参数错误: rating必须为like或unlike');
+ }
+
+ // 后续处理
+ if (rating === "like") {
+ return this.twitterService.likeTweet(accessToken, userId, accountId, tweetId);
+ } else {
+ return this.twitterService.unlikeTweet(accessToken, userId, accountId, tweetId);
+ }
+ }
+
+}
diff --git a/server/src/modules/plat/twitter/twitter.module.ts b/server/src/modules/plat/twitter/twitter.module.ts
new file mode 100644
index 00000000..53c97060
--- /dev/null
+++ b/server/src/modules/plat/twitter/twitter.module.ts
@@ -0,0 +1,45 @@
+import { Module, forwardRef } from '@nestjs/common';
+import { MongooseModule } from '@nestjs/mongoose';
+import { HttpModule } from '@nestjs/axios';
+import { ConfigModule, ConfigService } from '@nestjs/config';
+
+import { TwitterController } from './twitter.controller';
+import { TwitterService } from './twitter.service';
+import { TwitterAuthService } from './twitter.auth.service';
+
+import { Account, AccountSchema } from 'src/db/schema/account.schema';
+import { AccountToken, AccountTokenSchema } from 'src/db/schema/accountToken.schema';
+import { PubRecord, PubRecordSchema } from 'src/db/schema/pubRecord.schema';
+import { User, UserSchema } from 'src/db/schema/user.schema';
+
+import { AccountModule } from 'src/modules/account/account.module';
+import { AuthModule } from 'src/auth/auth.module';
+import { RedisModule } from 'src/lib/redis/redis.module';
+import { UserModule } from 'src/user/user.module';
+import googleConfig from 'config/google.config';
+
+// You'll need to create a twitter.config.ts similar to your google.config.ts
+// import twitterConfig from 'config/twitter.config';
+
+@Module({
+ imports: [
+ HttpModule, // For making HTTP requests
+ ConfigModule.forRoot({
+ load: [googleConfig],
+ }),
+ MongooseModule.forFeature([
+ { name: User.name, schema: UserSchema },
+ { name: Account.name, schema: AccountSchema },
+ { name: AccountToken.name, schema: AccountTokenSchema },
+ { name: PubRecord.name, schema: PubRecordSchema },
+ ]),
+ forwardRef(() => AuthModule),
+ forwardRef(() => AccountModule),
+ forwardRef(() => UserModule),
+ RedisModule,
+ ],
+ controllers: [TwitterController],
+ providers: [TwitterService, TwitterAuthService, ConfigService],
+ exports: [TwitterService, TwitterAuthService],
+})
+export class TwitterModule {}
\ No newline at end of file
diff --git a/server/src/modules/plat/twitter/twitter.service.ts b/server/src/modules/plat/twitter/twitter.service.ts
new file mode 100644
index 00000000..6e325b89
--- /dev/null
+++ b/server/src/modules/plat/twitter/twitter.service.ts
@@ -0,0 +1,374 @@
+import { Injectable, Logger, BadRequestException, NotFoundException } from '@nestjs/common';
+import { ConfigService } from '@nestjs/config';
+import { HttpService } from '@nestjs/axios';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { lastValueFrom } from 'rxjs';
+import { PubType, PubStatus, PubRecord } from 'src/db/schema/pubRecord.schema'
+
+import { TwitterAuthService } from './twitter.auth.service';
+
+// Twitter API V2基础URL
+const TWITTER_API_V2_URL = 'https://api.twitter.com/2';
+
+@Injectable()
+export class TwitterService {
+ private readonly logger = new Logger(TwitterService.name);
+
+ constructor(
+ private readonly configService: ConfigService,
+ private readonly httpService: HttpService,
+ private readonly twitterAuthService: TwitterAuthService,
+ @InjectModel(PubRecord.name)
+ private readonly PubRecordModel: Model<PubRecord>,
+
+ ) {}
+
+
+ /**
+ * 获取用户的Twitter时间线
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param maxResults 最大结果数
+ * @returns Twitter时间线数据
+ */
+ async getUserTimeline(accessToken: string, userId: string, accountId: string, maxResults: number = 10) {
+ try {
+ // 确保maxResults是一个有效的整数
+ const validMaxResults = Number(maxResults);
+
+ // 调用Twitter API获取时间线
+ const url = `${TWITTER_API_V2_URL}/users/${accountId}/tweets`;
+ // console.log("timeline url:", url);
+ const params = {
+ 'max_results': isNaN(validMaxResults) ? 10 : validMaxResults, // 如果是NaN则使用默认值10
+ 'tweet.fields': 'created_at,public_metrics,text,source',
+ 'expansions': 'attachments.media_keys',
+ 'media.fields': 'url,preview_image_url,type'
+ };
+ console.log("请求参数:", params);
+ // console.log("accessToken:", accessToken);
+ const response = await lastValueFrom(
+ this.httpService.get(url, {
+ params,
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ })
+ );
+ console.log("==============response============");
+ console.log(response);
+ return response.data
+ } catch (error) {
+ console.error('完整错误对象:', JSON.stringify(error.response?.data || error.message));
+
+ this.logger.error(`获取Twitter时间线失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`获取Twitter时间线失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+ /**
+ * 发布新推文
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param text 推文内容
+ * @param mediaIds 媒体ID数组
+ * @returns 发布结果
+ */
+ async createTweet(accessToken: string, userId: string, accountId: string, text: string, mediaIds?: string[]) {
+ // 获取当前最大的 id
+ const maxRecord = await this.PubRecordModel.findOne().sort({ id: -1 });
+ const newId = maxRecord ? maxRecord.id + 1 : 1;
+
+ try {
+
+
+ const url = `${TWITTER_API_V2_URL}/tweets`;
+ const payload: any = { text };
+
+ // 如果有媒体附件,添加媒体信息
+ if (mediaIds && mediaIds.length > 0) {
+ payload.media = {
+ media_ids: mediaIds
+ };
+ }
+
+ // 创建发布记录
+ let newData: any = {
+ userId: userId,
+ type: PubType.ARTICLE,
+ title: text,
+ desc: text,
+ accountId: accountId,
+ status:PubStatus.UNPUBLISH,
+ // timingTime: publishAt,
+ publishTime: new Date()
+ }
+
+ // if (publishAt) {
+ // requestBody.status.publishAt = publishAt; // 如果提供了 publishAt 则使用 publishAt
+ // }
+
+ // console.log(requestBody);
+
+ await this.PubRecordModel.create({
+ ...newData,
+ id: newId,
+ });
+
+ const response = await lastValueFrom(
+ this.httpService.post(url, payload, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ this.logger.log(`成功发布推文: userId=${userId}, accountId=${accountId}`);
+
+ // 更新发布记录
+ await this.PubRecordModel.updateOne({ id:newId }, {
+ status: PubStatus.RELEASED,
+ publishTime: new Date()
+ });
+
+ return response.data.data
+ } catch (error) {
+ await this.PubRecordModel.updateOne({ id:newId }, { status: PubStatus.FAIL });
+ this.logger.error(`发布推文失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`发布推文失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+ /**
+ * 上传媒体文件
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param mediaFile 媒体文件Buffer
+ * @param mimeType 媒体类型
+ * @returns 媒体上传结果
+ */
+ async uploadMedia(accessToken, userId: string, accountId: string, mediaFile: Buffer, mimeType: string) {
+ try {
+
+
+ // Twitter有单独的媒体上传API
+ const url = 'https://upload.twitter.com/1.1/media/upload.json';
+
+ // 创建表单数据
+ const formData = new FormData();
+ formData.append('media', new Blob([mediaFile], { type: mimeType }));
+
+ const response = await lastValueFrom(
+ this.httpService.post(url, formData, {
+ headers: {
+ 'Content-Type': 'multipart/form-data',
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ this.logger.log(`媒体上传成功: userId=${userId}, accountId=${accountId}`);
+
+ return response.data
+ } catch (error) {
+ this.logger.error(`上传媒体失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`上传媒体失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+ /**
+ * 删除推文
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param tweetId 推文ID
+ * @returns 删除结果
+ */
+ async deleteTweet(accessToken, userId: string, accountId: string, tweetId: string) {
+ try {
+
+ const url = `${TWITTER_API_V2_URL}/tweets/${tweetId}`;
+
+ await lastValueFrom(
+ this.httpService.delete(url, {
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ this.logger.log(`成功删除推文: tweetId=${tweetId}, accountId=${accountId}`);
+
+ return true
+ } catch (error) {
+ this.logger.error(`删除推文失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`删除推文失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+ /**
+ * 获取推文详情
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param tweetId 推文ID
+ * @returns 推文详情
+ */
+ async getTweetDetail(accessToken, userId: string, accountId: string, tweetId: string) {
+ try {
+
+ const url = `${TWITTER_API_V2_URL}/tweets/${tweetId}`;
+ const params = {
+ 'tweet.fields': 'created_at,public_metrics,text,source',
+ 'expansions': 'attachments.media_keys,author_id',
+ 'media.fields': 'url,preview_image_url,type'
+ };
+
+ const response = await lastValueFrom(
+ this.httpService.get(url, {
+ params,
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return response.data.data
+ } catch (error) {
+ this.logger.error(`获取推文详情失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`获取推文详情失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+ /**
+ * 获取推文的统计数据
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param tweetId 推文ID
+ * @returns 推文统计数据
+ */
+ async getTweetMetrics(accessToken, userId: string, accountId: string, tweetId: string) {
+ try {
+
+ const url = `${TWITTER_API_V2_URL}/tweets/${tweetId}`;
+ const params = {
+ 'tweet.fields': 'public_metrics,non_public_metrics,organic_metrics', // 注意:某些指标需要高级API访问权限
+ };
+
+ const response = await lastValueFrom(
+ this.httpService.get(url, {
+ params,
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return response.data;
+ } catch (error) {
+ this.logger.error(`获取推文统计数据失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`获取推文统计数据失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+ /**
+ * 查找用户的推文
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param query 查询内容
+ * @param maxResults 最大结果数
+ * @returns 搜索结果
+ */
+ async searchTweets(accessToken, userId: string, accountId: string, query: string, maxResults: number = 10) {
+ try {
+ // 确保maxResults是一个有效的整数
+ const validMaxResults = Number(maxResults);
+
+ const url = `${TWITTER_API_V2_URL}/tweets/search/recent`;
+ const params = {
+ 'query': `from:${accountId} ${query}`,
+ 'max_results': isNaN(validMaxResults) ? 10 : validMaxResults, // 如果是NaN则使用默认值10
+ 'tweet.fields': 'created_at,public_metrics,text',
+ 'expansions': 'attachments.media_keys',
+ 'media.fields': 'url,preview_image_url,type'
+ };
+
+ const response = await lastValueFrom(
+ this.httpService.get(url, {
+ params,
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ return response.data;
+ } catch (error) {
+ this.logger.error(`搜索推文失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`搜索推文失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+ /**
+ * 对推文点赞
+ * @param accessToken 访问令牌
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param tweetId 推文ID
+ * @returns 点赞结果
+ */
+ async likeTweet(accessToken: string, userId: string, accountId: string, tweetId: string) {
+ try {
+ // Twitter API V2 点赞端点
+ const url = `${TWITTER_API_V2_URL}/users/${accountId}/likes`;
+ const data = {
+ tweet_id: tweetId
+ };
+
+ const response = await lastValueFrom(
+ this.httpService.post(url, data, {
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`,
+ 'Content-Type': 'application/json'
+ }
+ })
+ );
+
+ this.logger.log(`成功点赞推文: userId=${userId}, accountId=${accountId}, tweetId=${tweetId}`);
+ return response.data;
+ } catch (error) {
+ this.logger.error(`点赞推文失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`点赞推文失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+ /**
+ * 取消对推文的点赞
+ * @param accessToken 访问令牌
+ * @param userId 用户ID
+ * @param accountId Twitter账号ID
+ * @param tweetId 推文ID
+ * @returns 取消点赞结果
+ */
+ async unlikeTweet(accessToken: string, userId: string, accountId: string, tweetId: string) {
+ try {
+ // Twitter API V2 取消点赞端点
+ const url = `${TWITTER_API_V2_URL}/users/${accountId}/likes/${tweetId}`;
+
+ const response = await lastValueFrom(
+ this.httpService.delete(url, {
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ })
+ );
+
+ this.logger.log(`成功取消点赞推文: userId=${userId}, accountId=${accountId}, tweetId=${tweetId}`);
+ return response.data;
+ } catch (error) {
+ this.logger.error(`取消点赞推文失败: ${error.message}`, error.stack);
+ throw new BadRequestException(`取消点赞推文失败: ${error.response?.data?.error || error.message}`);
+ }
+ }
+
+}
diff --git a/server/src/modules/plat/youtube/comment.ts b/server/src/modules/plat/youtube/comment.ts
new file mode 100644
index 00000000..2fd4f47f
--- /dev/null
+++ b/server/src/modules/plat/youtube/comment.ts
@@ -0,0 +1,13 @@
+export enum VideoUTypes {
+ Little = 0,
+ Big = 1,
+}
+
+export interface AccessToken {
+ access_token: string; // 'd30bedaa4d8eb3128cf35ddc1030e27d';
+ expires_in: number; // 1630220614;
+ refresh_token: string; // 'WxFDKwqScZIQDm4iWmKDvetyFugM6HkX';
+ scopes: string[]; // ['USER_INFO', 'ATC_DATA', 'ATC_BASE'];
+ token_type: string;
+ id_token: string;
+}
diff --git a/server/src/modules/plat/youtube/dto/youtube.dto.ts b/server/src/modules/plat/youtube/dto/youtube.dto.ts
new file mode 100644
index 00000000..93469fc3
--- /dev/null
+++ b/server/src/modules/plat/youtube/dto/youtube.dto.ts
@@ -0,0 +1,132 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:16:37
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import {
+ IsArray,
+ IsEnum,
+ IsNotEmpty,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { VideoUTypes } from '../comment';
+
+export class AccessBackDto {
+ @Expose()
+ code: string;
+
+ @Expose()
+ state: string;
+}
+
+export class VideoInitDto {
+ @ApiProperty({ title: '文件名称(带格式)', required: true })
+ @IsString({ message: '文件名称' })
+ @Expose()
+ readonly fileName: string;
+
+ @ApiProperty({ enum: VideoUTypes })
+ @IsNotEmpty({ message: '文件类型不能为空' })
+ @IsEnum(VideoUTypes)
+ @Type(() => Number)
+ @Expose()
+ readonly utype: VideoUTypes;
+}
+
+export class ArchiveAddByUtokenQueryDto {
+ @ApiProperty({ title: '用户token', required: true })
+ @IsString({ message: '用户token' })
+ @Expose()
+ readonly accessToken: string;
+
+ @ApiProperty({ title: '上传token', required: true })
+ @IsString({ message: '上传token' })
+ @Expose()
+ readonly uploadToken: string;
+}
+
+export class ArchiveAddByUtokenBodyDto {
+ @ApiProperty({ title: '标题', required: true })
+ @IsString({ message: '标题' })
+ @Expose()
+ readonly title: string;
+
+ @ApiProperty({ title: '封面url', required: false })
+ @IsString({ message: '封面url' })
+ @IsOptional()
+ @Expose()
+ readonly cover?: string;
+
+ @ApiProperty({ title: '分区ID,由获取分区信息接口得到', required: true })
+ @IsNumber({ allowNaN: false }, { message: '分区ID,由获取分区信息接口得到' })
+ @Expose()
+ readonly tid: number;
+
+ @ApiProperty({
+ title: '是否允许转载 0-允许,1-不允许。默认0',
+ required: true,
+ })
+ @IsNumber(
+ { allowNaN: false },
+ { message: '是否允许转载 0-允许,1-不允许。默认0' },
+ )
+ @IsOptional()
+ @Expose()
+ readonly noReprint?: 0 | 1;
+
+ @ApiProperty({ title: '描述', required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ title: '标签', required: false })
+ @IsArray({ message: '标签必须是字符串数组' })
+ @IsString({ each: true, message: '描述' })
+ @Expose()
+ readonly tag: string[];
+
+ @ApiProperty({
+ title: '1-原创,2-转载(转载时source必填)',
+ required: true,
+ })
+ @IsNumber(
+ { allowNaN: false },
+ { message: '1-原创,2-转载(转载时source必填)' },
+ )
+ @Expose()
+ readonly copyright: 1 | 2;
+
+ @ApiProperty({
+ title: '如果copyright为转载,则此字段表示转载来源',
+ required: false,
+ })
+ @IsString({ message: '如果copyright为转载,则此字段表示转载来源' })
+ @IsOptional()
+ @Expose()
+ readonly source?: string;
+}
+
+// 定义类型
+export interface YoutubePlaylistSnippet {
+ title?: string;
+ description?: string;
+ defaultLanguage?: string;
+}
+
+export interface YoutubePlaylistStatus {
+ privacyStatus?: string;
+ podcastStatus?: string;
+}
+
+export interface YouTubeAuthTokens {
+ accessToken: string;
+ refreshToken?: string;
+ expiresAt?: number;
+}
diff --git a/server/src/modules/plat/youtube/youtube.auth.service.ts b/server/src/modules/plat/youtube/youtube.auth.service.ts
new file mode 100644
index 00000000..7819f793
--- /dev/null
+++ b/server/src/modules/plat/youtube/youtube.auth.service.ts
@@ -0,0 +1,644 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-05-27 14:48:12
+ * @LastEditTime: 2025-05-27 14:48:12
+ * @LastEditors: nevin
+ * @Description: YouTube授权服务
+ */
+import { Injectable, Inject, forwardRef } from '@nestjs/common';
+import { GoogleService } from '../google/google.service';
+import { google } from 'googleapis';
+import { AccessToken } from './comment';
+import { getRandomString } from 'src/util';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { User } from 'src/db/schema/user.schema';
+import { Account, AccountType, AccountStatus } from 'src/db/schema/account.schema';
+import { AccountToken, TokenPlatform, TokenStatus } from 'src/db/schema/accountToken.schema';
+import { RedisService } from 'src/lib/redis/redis.service';
+import { AuthService } from 'src/auth/auth.service';
+import { getCurrentTimestamp } from 'src/util/time.util';
+import { YouTubeAuthTokens } from './dto/youtube.dto'
+import axios from 'axios';
+import { ConfigService } from '@nestjs/config';
+import { IdService } from 'src/db/id.service';
+import { AccountService } from 'src/modules/account/account.service';
+
+
+@Injectable()
+export class YouTubeAuthService {
+
+ private webClientSecret: string;
+ private webClientId: string;
+ private webRenderBaseUrl: string;
+
+ constructor(
+ private configService: ConfigService,
+ private readonly idService: IdService,
+
+ @Inject(forwardRef(() => GoogleService))
+ private readonly googleService: GoogleService,
+ private readonly redisService: RedisService,
+ @InjectModel(User.name)
+ private userModel: Model<User>,
+ @InjectModel(Account.name)
+ private accountModel: Model<Account>,
+ private readonly AuthService: AuthService,
+ @InjectModel(AccountToken.name)
+ private AccountTokenModel: Model<AccountToken>,
+ private readonly accountService: AccountService,
+ ) {
+ this.initGoogleSecrets();
+ }
+
+ private async initGoogleSecrets() {
+ this.webClientSecret = this.configService.get<string>("GOOGLE_CONFIG.WEB_CLIENT_SECRET");
+ this.webClientId = this.configService.get<string>("GOOGLE_CONFIG.WEB_CLIENT_ID");
+ this.webRenderBaseUrl = this.configService.get<string>("GOOGLE_CONFIG.WEB_RENDER_URL");
+ }
+
+ private async getId() {
+ return this.idService.createId('accountId', 100000000, 1);
+ }
+
+ /**
+ * 初始化YouTube API客户端
+ * @param accessToken 访问令牌
+ * @returns YouTube API客户端
+ */
+ initializeYouTubeClient(accessToken: string): any {
+ const auth = new google.auth.OAuth2();
+ auth.setCredentials({ access_token: accessToken });
+ return google.youtube({ version: 'v3', auth });
+ }
+
+ /**
+ * 获取YouTube授权URL
+ * @param mail 用户邮箱
+ * @returns 授权URL
+ */
+ async getAuthorizationUrl(mail: string, userId: string): Promise<object> {
+ try {
+ const state = getRandomString(8);
+ this.redisService.setKey(`youtube:state:${userId}:${state}`, { mail }, 60 * 10);
+
+ // 指定YouTube特定的scope
+ const youtubeScopes = [
+ "https://www.googleapis.com/auth/youtube.force-ssl",
+ "https://www.googleapis.com/auth/youtube.readonly",
+ "https://www.googleapis.com/auth/youtube.upload",
+ "https://www.googleapis.com/auth/userinfo.profile"
+ ];
+
+ const stateData = {
+ originalState: state, // 保留原始state值
+ userId: userId, // 添加token
+ email: mail
+ };
+
+ // 将状态数据转换为JSON字符串并编码
+ const encodedState = encodeURIComponent(JSON.stringify(stateData));
+
+ const params = new URLSearchParams({
+ scope: youtubeScopes.join(" "),
+ access_type: "offline",
+ include_granted_scopes: "true",
+ response_type: "code",
+ state: encodedState,
+ redirect_uri: `${this.webRenderBaseUrl}/api/plat/youtube/auth/callback`,
+ client_id: this.webClientId,
+ prompt: "consent", // 强制要求用户确认授权,以便我们能够获取refresh_token
+ // login_hint: userId,
+ });
+
+ const authUrl = new URL('https://accounts.google.com/o/oauth2/v2/auth');
+ authUrl.search = params.toString();
+
+ return {url: authUrl.toString()};
+ } catch (error) {
+ console.error('Error generating auth URL:', error);
+ throw new Error('无法生成授权URL');
+ }
+ }
+
+ /**
+ * 获取用户的YouTube访问令牌
+ * @param accountId 账号ID
+ * @returns 访问令牌
+ */
+ async getUserAccessToken(accountId: string): Promise<string> {
+ console.log("accountId:--", accountId);
+ const accountTokenInfo = await this.AccountTokenModel.findOne({accountId: accountId});
+
+ // if (!res) return '';
+
+ // // 剩余时间
+ // const overTime = res.expires_in;
+
+ // if (overTime < 60 * 60 && overTime > 0) {
+ // // 刷新token
+ // this.refreshAccessToken(userId, res.refresh_token);
+// }
+ // const accountTokenInfo = await this.AccountTokenModel.findOne({accountId: accountId});
+ await this.refreshAccessToken(accountTokenInfo.userId, accountTokenInfo.accountId, accountTokenInfo.refreshToken);
+
+ const res: AccessToken = await this.redisService.get(
+ `youtube:accessToken:${accountId}`,
+ );
+ return res.access_token;
+ }
+
+ /**
+ * 刷新用户的YouTube访问令牌
+ * @param accountId 账号ID
+ * @returns 新的系统令牌
+ */
+ async refreshAccessToken(userId: string, accountId: string, refreshToken: string): Promise<object> {
+ try {
+ const userInfo = await this.userModel.findOne({_id: userId});
+ // if(!refreshToken) {
+
+ // console.log("=============userInfo====================");
+ // console.log(userInfo)
+ // refreshToken = userInfo?.googleAccount?.refreshToken ?? ''
+ // }
+
+ const tokenUrl = 'https://oauth2.googleapis.com/token';
+
+ // 请求体的参数
+ const params = new URLSearchParams({
+ client_id: this.webClientId, // 使用你的 client_id
+ client_secret: this.webClientSecret, // 使用你的 client_secret
+ refresh_token: refreshToken, // 提供刷新令牌
+ grant_type: 'refresh_token', // 认证类型是刷新令牌
+ });
+
+ // 发送 POST 请求到 Google token endpoint 来刷新 access token
+ const response = await axios.post(tokenUrl, params.toString(), {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ });
+ console.log("================response================")
+ console.log(response);
+ const accessTokenInfo = response.data;
+ // console.log("================accessTokenInfo================")
+ // console.log(accessTokenInfo);
+ // 剩余有效秒数
+ const expires = accessTokenInfo.expires_in
+ // accessTokenInfo.expires_in - getCurrentTimestamp() - 60 * 60;
+ this.redisService.setKey(
+ `youtube:accessToken:${accountId}`,
+ accessTokenInfo,
+ expires,
+ );
+
+ const TokenInfo = {
+ phone: userInfo?.phone ?? '', // 如果 userInfo.phone 为 undefined 或 null,则使用空字符串
+ id: userId,
+ name: userInfo.name,
+ isManager: false,
+ googleId: userInfo?.googleAccount?.googleId ?? ''
+ }
+ console.log("发送获取systemToken的info---", TokenInfo);
+ const systemToken = await this.AuthService.generateToken(TokenInfo)
+
+ const returnRes = {url: systemToken};
+ return returnRes;
+ // 返回新的 access token 和其他信息
+ // return response.data; // 包含新的 access_token、expires_in、token_type 等信息
+ } catch (err) {
+ console.log('Error while refreshing access token', err);
+ throw new Error('Failed to refresh access token');
+ }
+ }
+
+ /**
+ * 验证并保存授权码
+ * @param code 授权码
+ * @param state 状态码
+ * @returns 系统令牌
+ */
+ async handleAuthorizationCode(code: string, state: string, userId: string) {
+ try {
+ // 获取state关联的邮箱信息
+ const stateInfo = await this.redisService.get(`youtube:state:${userId}:${state}`);
+ if (!stateInfo || !stateInfo.mail) {
+ throw new Error('无效的状态码');
+ }
+
+ // 使用授权码获取访问令牌和刷新令牌
+ const params = new URLSearchParams({
+ code: code,
+ redirect_uri: `${this.webRenderBaseUrl}/api/plat/youtube/auth/callback`,
+ client_id: this.webClientId,
+ grant_type: "authorization_code",
+ client_secret: this.webClientSecret,
+ });
+
+ const response = await axios.post('https://oauth2.googleapis.com/token', params.toString(), {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ });
+
+ const { access_token, refresh_token, expires_in, id_token } = response.data;
+
+ // 验证ID令牌以获取用户信息
+ const oauth2Client = new google.auth.OAuth2();
+ oauth2Client.setCredentials({ access_token });
+
+ const ticket = await oauth2Client.verifyIdToken({
+ idToken: id_token,
+ audience: this.webClientId
+ });
+
+ const payload = ticket.getPayload();
+ const googleId = payload.sub;
+ const email = payload.email;
+
+ // 获取YouTube频道信息,用于更新账号数据库
+ await this.updateYouTubeAccountInfo(userId, email, googleId, access_token, refresh_token, expires_in);
+
+ // 缓存令牌
+ await this.redisService.setKey(
+ `youtube:accessToken:${googleId}`,
+ {
+ access_token,
+ refresh_token,
+ expiresAt: getCurrentTimestamp() + expires_in
+ },
+ expires_in
+ );
+
+ // 查询AccountToken数据库里是否存在令牌,如果存在,且上面获得refresh_token 存在,且不为空或null,则更新
+ // 如果不存在,则创建
+ let accountToken = await this.AccountTokenModel.findOne({
+ platform: AccountType.YOUTUBE,
+ accountId: googleId
+ });
+
+ if (accountToken) {
+ // 更新现有令牌
+ if (refresh_token && refresh_token.trim() !== '') {
+ accountToken.refreshToken = refresh_token;
+ }
+
+ accountToken.expiresAt = new Date((getCurrentTimestamp() + expires_in) * 1000);
+ accountToken.updateTime = new Date();
+ await accountToken.save();
+ } else {
+ // 创建新的令牌记录
+ accountToken = await this.AccountTokenModel.create({
+ userId,
+ platform: AccountType.YOUTUBE,
+ accountId: googleId,
+ refreshToken: refresh_token,
+ status: TokenStatus.USABLE,
+ createTime: new Date(),
+ updateTime: new Date(),
+ expiresAt: new Date((getCurrentTimestamp() + expires_in) * 1000)
+ });
+ }
+
+ // // 返回系统令牌
+ // return this.AuthService.generateToken(TokenInfo);
+ const existingAccount = await this.accountModel.findOne({
+ type: AccountType.YOUTUBE,
+ googleId: googleId
+ });
+
+ const results = {
+ data:
+ {
+ accountInfo: existingAccount,
+ userInfo: {
+ "userId": userId,
+ "uid": googleId
+ }
+ },
+ msg:"success", code: 0
+
+ };
+ console.log("最终返回", results);
+
+ return results;
+
+ } catch (error) {
+ console.error('处理授权码失败:', error);
+ throw new Error('授权失败');
+ }
+ }
+
+ /**
+ * 获取YouTube频道信息并更新账号数据库
+ * @param userId 用户ID
+ * @param googleId Google ID
+ * @param accessToken 访问令牌
+ * @param refreshToken 刷新令牌
+ */
+ private async updateYouTubeAccountInfo(
+ userId: string,
+ email: string,
+ googleId: string,
+ accessToken: string,
+ refreshToken: string,
+ expires_in: number
+ ): Promise<void> {
+ try {
+ // 初始化YouTube客户端
+ const youtube = this.initializeYouTubeClient(accessToken);
+
+ const channelInfo = {
+ // id: await this.getId(),
+ userId: userId,
+ type: AccountType.YOUTUBE,
+ uid: googleId,
+ googleId: googleId,
+ account: "accountUrl",
+ nickname: "",
+ avatar: "",
+ fansCount: 0,
+ workCount: 0,
+ likeCount: 0, // YouTube API不直接提供此信息
+ readCount: 0,
+ collectCount: 0, // YouTube API不直接提供此信息
+ forwardCount: 0, // YouTube API不直接提供此信息
+ commentCount: 0, // YouTube API不直接提供此信息
+ // loginTime: new Date(),
+ updateTime: new Date(),
+ status: AccountStatus.USABLE,
+ loginCookie: "1111", // YouTube不使用cookie认证
+ token: "111", // 存储访问令牌
+ // groupId: defaultGrpoupId, // 默认分组,可以根据需要调整
+ // income: 0
+ };
+
+ let hasChannel = false;
+ // 获取当前用户的YouTube频道信息
+ const response = await youtube.channels.list({
+ part: 'snippet,statistics',
+ mine: true
+ });
+
+ if (!response.data.items || response.data.items.length === 0) {
+
+ console.error("获取YouTube频道信息失败");
+ hasChannel = false;
+ // 如果没有频道或获取频道信息失败,则从Google用户信息获取
+ if (!hasChannel) {
+ console.log("无法获取YouTube频道信息,将从Google用户信息获取");
+ try {
+ const responseGoogle = await axios.get('https://www.googleapis.com/oauth2/v3/userinfo', {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ });
+
+ const userInfoData = responseGoogle.data;
+
+ // 使用Google用户信息更新账号数据
+ channelInfo.account = userInfoData.email || googleId;
+ channelInfo.nickname = userInfoData.name || '';
+ channelInfo.avatar = userInfoData.picture || '';
+
+ console.log("成功获取Google用户信息:", userInfoData);
+ } catch (error) {
+ console.error("获取Google用户信息失败:", error);
+ // 使用基本信息,确保至少有账号名称
+ channelInfo.account = googleId;
+ channelInfo.nickname = "YouTube User";
+ }
+ }
+
+ } else {
+ hasChannel = true;
+ const channel = response.data.items[0];
+ // 使用频道信息更新账号数据
+ channelInfo.account = channel.snippet.customUrl || channel.id;
+ channelInfo.nickname = channel.snippet.title;
+ channelInfo.avatar = channel.snippet.thumbnails.default.url;
+ channelInfo.fansCount = parseInt(channel.statistics.subscriberCount) || 0;
+ channelInfo.workCount = parseInt(channel.statistics.videoCount) || 0;
+ channelInfo.readCount = parseInt(channel.statistics.viewCount) || 0;
+
+ console.log("成功获取YouTube频道信息:", channel.snippet.title);
+ }
+
+ console.log(channelInfo);
+
+ // 创建或更新账号
+ // const account = await this.accountModel.findOneAndUpdate(
+ // { googleId: googleId, type: AccountType.YOUTUBE },
+ // channelInfo,
+ // { upsert: true, new: true }
+ // );
+ const account = await this.accountService.addOrUpdateAccount(channelInfo);
+
+ console.log("成功创建或更新YouTube账号:", account);
+
+
+ // 检查是否存在账号Token
+ const existingToken = await this.AccountTokenModel.findOne({
+ accountId: googleId,
+ platform: TokenPlatform.YOUTUBE
+ });
+
+ if (existingToken) {
+ // 更新现有Token
+ await this.AccountTokenModel.findOneAndUpdate(
+ { accountId: googleId, platform: TokenPlatform.YOUTUBE },
+ { refreshToken: refreshToken, updateTime: new Date() },
+ );
+ console.log("成功更新YouTube账号Token");
+ } else {
+ // 创建新Token
+ await this.AccountTokenModel.create({
+ accountId: googleId,
+ platform: TokenPlatform.YOUTUBE,
+ refreshToken: refreshToken,
+ expiresAt: new Date((getCurrentTimestamp() + expires_in) * 1000),
+ status: TokenStatus.USABLE,
+ createTime: new Date(),
+ updateTime: new Date(),
+ });
+ console.log("成功创建YouTube账号Token");
+ }
+
+
+ // // 检查账号是否存在
+ // const existingAccount = await this.accountModel.findOne({
+ // type: AccountType.YOUTUBE,
+ // googleId: googleId
+ // });
+
+ // if (existingAccount) {
+ // // 更新现有账号,保留原有的createTime
+ // channelInfo.status = existingAccount.status;
+ // channelInfo.groupId = existingAccount.groupId;
+ // channelInfo.income = existingAccount.income;
+
+ // // 更新账号信息
+ // await this.accountModel.findOneAndUpdate(
+ // { googleId: googleId, type: AccountType.YOUTUBE },
+ // channelInfo,
+ // { new: true }
+ // );
+
+ // console.log("成功更新YouTube账号信息");
+
+ // // 更新refresh_token
+ // await this.AccountTokenModel.findOneAndUpdate(
+ // { accountId: googleId, platform: TokenPlatform.YOUTUBE },
+ // { refreshToken: refreshToken, updateTime: new Date() },
+ // );
+ // console.log("平台:", TokenPlatform.YOUTUBE);
+
+ // const updateInfo = {
+ // nickname: channel.snippet.title,
+ // avatar: channel.snippet.thumbnails.default.url,
+ // fansCount: channel.statistics.subscriberCount || 0,
+ // workCount: channel.statistics.videoCount || 0,
+ // // likeCount: 0, // YouTube API不直接提供此信息
+ // readCount: channel.statistics.viewCount || 0,
+ // // collectCount: 0, // YouTube API不直接提供此信息
+ // // forwardCount: 0, // YouTube API不直接提供此信息
+ // // commentCount: 0, // YouTube API不直接提供此信息
+ // // loginTime: new Date(),
+ // updateTime: new Date(),
+ // status: AccountStatus.USABLE,
+ // // loginCookie: '', // YouTube不使用cookie认证
+ // // token: "", // 存储访问令牌
+ // // groupId: 1, // 默认分组,可以根据需要调整
+ // // income: 0
+ // }
+
+ // await this.accountModel.updateOne(
+ // { _id: existingAccount._id },
+ // { $set: updateInfo }
+ // );
+ // console.log(`已更新YouTube账号: ${updateInfo.nickname}`);
+
+
+ // } else {
+ // // 获取当前最大ID
+ // const maxIdAccount = await this.accountModel.findOne({}, { id: 1 }).sort({ id: -1 });
+ // const nextId = maxIdAccount ? maxIdAccount.id + 1 : 1;
+
+ // // 创建新账号
+ // await this.accountModel.create({
+ // ...channelInfo,
+ // id: nextId
+ // });
+ // console.log(`已创建新YouTube账号: ${channelInfo.nickname} (${channelInfo.uid})`);
+
+ // // 创建refresh_token和access_token
+ // const accountTokenInfo = {
+ // userId: userId,
+ // platform: TokenPlatform.YOUTUBE,
+ // refreshToken: refreshToken,
+ // accountId: googleId,
+ // status: TokenStatus.USABLE,
+ // createTime: new Date(),
+ // updateTime: new Date(),
+ // expiresAt: new Date((getCurrentTimestamp() + expires_in) * 1000)
+ // }
+ // await this.AccountTokenModel.create({
+ // ...accountTokenInfo
+ // });
+ // console.log(`已创建新YouTube账号Token: ${accountTokenInfo.accountId} (${accountTokenInfo.userId})`);
+
+ // }
+ } catch (error) {
+ console.error('更新YouTube账号信息失败:', error);
+ // 不抛出异常,避免影响授权流程
+ }
+ }
+
+ /**
+ * 获取初始化后的YouTube API客户端
+ * @param accountId 账号id
+ * @returns 初始化后的YouTube API客户端
+ */
+ async getYouTubeClient(accountId: string): Promise<any> {
+ const accessToken = await this.getUserAccessToken(accountId);
+ if (!accessToken) {
+ throw new Error('No access token available, user needs to authorize');
+ }
+
+ return this.initializeYouTubeClient(accessToken);
+ }
+
+ /**
+ * 检查用户是否已授权YouTube
+ * @param accountId 账号ID
+ * @returns 是否已授权
+ */
+ async isAuthorized(accountId: string): Promise<boolean> {
+ try {
+ const accessToken = await this.getUserAccessToken(accountId);
+ return !!accessToken;
+ } catch (error) {
+ return false;
+ }
+ }
+
+ /**
+ * 撤销YouTube授权
+ * @param accountId 账号ID
+ * @returns 撤销结果
+ */
+ async revokeAuthorization(accountId: string): Promise<boolean> {
+ try {
+ const accessToken = await this.getUserAccessToken(accountId);
+ if (!accessToken) {
+ return true; // 已经没有授权了
+ }
+
+ // 撤销令牌
+ await this.googleService.getClient().revokeToken(accessToken);
+
+ // 删除缓存的令牌
+ await this.redisService.del(`youtube:accessToken:${accountId}`);
+
+ // 更新用户信息,移除授权信息
+ await this.AccountTokenModel.updateOne(
+ { accountId: accountId },
+ { $unset: { 'refreshToken': 1, 'expiresAt': 1 } }
+ );
+
+ return true;
+ } catch (error) {
+ console.error('Error revoking authorization:', error);
+ return false;
+ }
+ }
+
+ /**
+ * 保存用户YouTube授权信息
+ * @param userId 用户ID
+ * @param tokens 授权令牌
+ */
+ async saveUserTokens(userId: string, tokens: YouTubeAuthTokens): Promise<void> {
+ try {
+ // 更新用户信息
+ await this.userModel.updateOne(
+ { _id: userId },
+ {
+ $set: {
+ 'googleAccount.accessToken': tokens.accessToken,
+ 'googleAccount.refreshToken': tokens.refreshToken,
+ 'googleAccount.expiresAt': tokens.expiresAt || (getCurrentTimestamp() + 3600)
+ }
+ }
+ );
+
+ // 缓存访问令牌
+ const expiresIn = tokens.expiresAt ? tokens.expiresAt - getCurrentTimestamp() : 3600;
+ await this.redisService.setKey(
+ `google:accessToken:${userId}`,
+ { access_token: tokens.accessToken, refresh_token: tokens.refreshToken },
+ expiresIn > 0 ? expiresIn : 3600
+ );
+ } catch (error) {
+ console.error('Error saving user tokens:', error);
+ throw new Error('Failed to save user tokens');
+ }
+ }
+}
diff --git a/server/src/modules/plat/youtube/youtube.controller.ts b/server/src/modules/plat/youtube/youtube.controller.ts
new file mode 100644
index 00000000..a2583f99
--- /dev/null
+++ b/server/src/modules/plat/youtube/youtube.controller.ts
@@ -0,0 +1,555 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:00:18
+ * @LastEditors: nevin
+ * @Description: signIn SignIn 签到
+ */
+import {
+ Body,
+ Controller,
+ Get,
+ Param,
+ Post,
+ Query,
+ UploadedFile,
+ UseInterceptors,
+ BadRequestException,
+ Res
+} from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import {
+ AccessBackDto,
+ ArchiveAddByUtokenBodyDto,
+ ArchiveAddByUtokenQueryDto,
+} from './dto/youtube.dto';
+import { YoutubeService } from './youtube.service';
+import { GoogleService } from '../google/google.service';
+import { GetToken, Public } from 'src/auth/auth.guard';
+import { FileInterceptor } from '@nestjs/platform-express';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { YouTubeAuthService } from './youtube.auth.service';
+import { Response } from 'express';
+
+@ApiTags('plat/youtube - Youtube平台')
+@Controller('plat/youtube')
+export class YoutubeController {
+ constructor(
+ private readonly youtubeService: YoutubeService,
+ private readonly youtubeAuthService: YouTubeAuthService,
+ ) {}
+
+ @ApiOperation({ summary: '测试' })
+ @Public()
+ @Get('test')
+ async getTest() {
+ const res = "success";
+ return res;
+ }
+
+ @ApiOperation({ summary: '获取YouTube授权URL' })
+ @Get('auth/url')
+ async getAuthUrl(
+ @GetToken() systemToken: TokenInfo,
+ @Query('mail') mail: string) {
+ if (!mail) {
+ throw new BadRequestException('邮箱参数不能为空');
+ }
+ // async getAuthUrl(@GetToken() token: TokenInfo) {
+ // // mail = token.id
+ // // if (!mail) {
+ // // throw new BadRequestException('邮箱参数不能为空');
+ // // }
+
+ return this.youtubeAuthService.getAuthorizationUrl(mail, systemToken.id);
+ }
+
+ @ApiOperation({ summary: '处理YouTube授权回调' })
+ @Public()
+ @Get('auth/callback')
+ async handleAuthCallback(
+ // @GetToken() systemToken: TokenInfo,
+ @Query('code') code: string,
+ @Query('state') state: string,
+ // @Query('userId') userId: string,
+ @Res() res: Response
+ ) {
+
+ if (!code || !state) {
+ throw new BadRequestException('授权参数不完整');
+ }
+ // 解析state参数以获取token
+ let stateData;
+ try {
+ stateData = JSON.parse(decodeURIComponent(state));
+ } catch (error) {
+ throw new BadRequestException('无效的state参数');
+ }
+
+ const { originalState, userId, email } = stateData;
+
+ // 现在您可以使用token变量
+ console.log('Retrieved userId and originalState:', userId, originalState, email);
+
+ try {
+ const results = await this.youtubeAuthService.handleAuthorizationCode(code, originalState, userId);
+ // 重定向到前端页面,带上token
+ // return res.redirect(`/auth/success?token=${token}`);
+ // return results
+ const render_msg = {
+ message: "授权成功! 这里是添加账号成功后的前端页面," ,
+ datas: results
+ };
+
+ return res.render('google/index', render_msg);
+
+ } catch (error) {
+ console.error('授权失败:', error);
+ // return res.redirect('/auth/error?message=授权失败');
+ return false
+ }
+ }
+
+ @ApiOperation({ summary: '检查是否已授权YouTube' })
+ @Get('auth/check')
+ async checkAuth(
+ @GetToken() systemToken: TokenInfo,
+ @Query('accountId') accountId: string,
+ ) {
+ // return {
+ // authorized: await this.youtubeAuthService.isAuthorized(systemToken.id)
+ // };
+ return await this.youtubeAuthService.isAuthorized(accountId)
+
+ }
+
+ @ApiOperation({ summary: '撤销YouTube授权' })
+ @Post('auth/revoke')
+ async revokeAuth(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ ) {
+ const result = await this.youtubeAuthService.revokeAuthorization(accountId);
+ return result
+ }
+
+
+ @ApiOperation({ summary: '获取频道列表' })
+ @Get('channels/list')
+ async getChannelsList(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('handle') handle?: string,
+ @Query('userName') userName?: string,
+ @Query('id') id?: string,
+ @Query('mine') mine?: boolean
+ ) {
+ // 校验确保只有一个参数传递
+ const params = [handle, userName, id, mine];
+ const nonEmptyParams = params.filter(param => param !== undefined && param !== null && param !== '');
+
+ if (nonEmptyParams.length > 1) {
+ throw new BadRequestException('只能选择一个参数: handle, userName, id 或 mine');
+ }
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+
+ return this.youtubeService.getChannelsList(accessToken, handle, userName, id, mine);
+ }
+
+ @ApiOperation({ summary: '更新频道' })
+ @Post('channels/update')
+ async channelsUpdate(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('id') id: string,
+ @Body('brandingSettings') brandingSettings?: Record<string, any>,
+ @Body('status') status?: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.updateChannels(accessToken, id, brandingSettings, status);
+ }
+
+ @ApiOperation({ summary: '获取频道板块列表' })
+ @Get('channels/sections/list')
+ async getChannelSectionsList(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('channelId') channelId?: string,
+ @Query('id') id?: string,
+ @Query('maxResults') maxResults?: string,
+ @Query('mine') mine?: boolean,
+ @Query('pageToken') pageToken?: string,
+ ) {
+ // 校验确保只有一个参数传递
+ const params = [channelId, id, mine];
+ const nonEmptyParams = params.filter(param => param !== undefined && param !== null && param !== '');
+
+ if (nonEmptyParams.length > 1) {
+ throw new BadRequestException('只能选择一个参数: channelId, id, mine');
+ }
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.getChannelSectionsList(accessToken, channelId, id, mine, maxResults, pageToken);
+ }
+
+ @ApiOperation({ summary: '创建频道板块' })
+ @Post('channels/sections/insert')
+ async channelsSectionsInsert(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('snippet') snippet?: Record<string, any>,
+ @Body('contentDetails') contentDetails?: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.insertChannelSection(accessToken, snippet, contentDetails);
+ }
+
+ @ApiOperation({ summary: '更新频道版块' })
+ @Post('channels/sections/update')
+ async channelsSectionsUpdate(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId,
+ @Body('snippet') snippet?: Record<string, any>,
+ @Body('contentDetails') contentDetails?: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.updateChannelSection(accessToken, snippet, contentDetails);
+ }
+
+ @ApiOperation({ summary: '删除频道版块' })
+ @Post('channels/sections/delete')
+ async channelsSectionsDelete(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('id') channelSectionId: string,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.deleteChannelsSections(accessToken, channelSectionId);
+ }
+
+ @ApiOperation({ summary: '获取评论列表' })
+ @Get('comments/list')
+ async getCommentsList(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('parentId') parentId: string,
+ @Query('id') id: string,
+ @Query('maxResults') maxResults?: string,
+ @Query('pageToken') pageToken?: string,
+ ) {
+ // 校验确保只有一个参数传递
+ const params = [parentId, id];
+ const nonEmptyParams = params.filter(param => param !== undefined && param !== null && param !== '');
+
+ if (nonEmptyParams.length > 1) {
+ throw new BadRequestException('只能选择一个参数: channelId, id, mine');
+ }
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.getCommentsList(accessToken, parentId, id, maxResults, pageToken);
+ }
+
+ @ApiOperation({ summary: '创建对现有评论的回复' })
+ @Post('comments/insert')
+ async commentsInsert(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('snippet') snippet: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.insertComment(accessToken, snippet);
+ }
+
+ @ApiOperation({ summary: '修改评论' })
+ @Post('comments/update')
+ async commentsUpdate(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('snippet') snippet: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.updateComments(accessToken, snippet);
+ }
+
+ @ApiOperation({ summary: '设置一条或多条评论的审核状态' })
+ @Post('comments/setModerationStatus')
+ async commentsSetModerationStatus(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('id') id: string,
+ @Body('moderationStatus') moderationStatus: string,
+ @Body('banAuthor') banAuthor?: boolean
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.setModerationStatusComments(accessToken, id, moderationStatus, banAuthor);
+ }
+
+ @ApiOperation({ summary: '删除评论' })
+ @Post('comments/delete')
+ async commentsDelete(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('id') id: string,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.deleteComments(accessToken, id);
+ }
+
+ @ApiOperation({ summary: '获取评论会话列表' })
+ @Get('commentThreads/list')
+ async getCommentThreadsList(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('allThreadsRelatedToChannelId') allThreadsRelatedToChannelId: string,
+ @Query('id') id: string,
+ @Query('videoId') videoId: string,
+ @Query('order') order?: string,
+ @Query('searchTerms') searchTerms?: string,
+ @Query('maxResults') maxResults?: string,
+ @Query('pageToken') pageToken?: string,
+ ) {
+ // 校验确保只有一个参数传递
+ const params = [allThreadsRelatedToChannelId, id, videoId];
+ const nonEmptyParams = params.filter(param => param !== undefined && param !== null && param !== '');
+
+ if (nonEmptyParams.length > 1) {
+ throw new BadRequestException('只能选择一个参数: allThreadsRelatedToChannelId, id, videoId');
+ }
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.getCommentThreadsList(accessToken, allThreadsRelatedToChannelId, id, videoId, maxResults, pageToken, order, searchTerms);
+ }
+
+ @ApiOperation({ summary: '创建顶级评论' })
+ @Post('commentThreads/insert')
+ async commentThreadsInsert(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('snippet') snippet: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.insertCommentThreads(accessToken, snippet);
+ }
+
+ @ApiOperation({ summary: '获取视频类别列表' })
+ @Get('video/categories/list')
+ async getVideoCategoriesList(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('regionCode') regionCode?: string,
+ @Query('id') id?: string
+ ) {
+ // 校验确保只有一个参数传递
+ const params = [regionCode, id];
+ const nonEmptyParams = params.filter(param => param !== undefined && param !== null && param !== '');
+
+ if (nonEmptyParams.length > 1) {
+ throw new BadRequestException('只能选择一个参数: regionCode, id');
+ }
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.getVideoCategoriesList(accessToken, id, regionCode);
+ }
+
+ @ApiOperation({ summary: '获取视频列表' })
+ @Get('videos/list')
+ async getVideosList(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('id') id?: string,
+ @Query('myRating') myRating?: string,
+ @Query('maxResults') maxResults?: string,
+ @Query('pageToken') pageToken?: string,
+ ) {
+ // 校验确保只有一个参数传递
+ const params = [id, myRating];
+ const nonEmptyParams = params.filter(param => param !== undefined && param !== null && param !== '');
+
+ if (nonEmptyParams.length > 1) {
+ throw new BadRequestException('只能选择一个参数: id, myRating');
+ }
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.getVideosList(accessToken, id, myRating, maxResults, pageToken);
+ }
+
+ @ApiOperation({ summary: '视频上传' })
+ @UseInterceptors(FileInterceptor('file'))
+ @Post('videos/upload')
+ async videoUpload(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @UploadedFile() file: Express.Multer.File,
+ @Body('title') title: string,
+ @Body('description') description: string,
+ @Body('keywords') keywords?: string,
+ @Body('categoryId') categoryId?: string,
+ @Body('privacyStatus') privacyStatus?: string,
+ @Body('publishAt') publishAt?: Date
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.uploadVideo(token.id, accountId, accessToken, file, title, description, keywords, categoryId, privacyStatus, publishAt);
+ }
+
+ @ApiOperation({ summary: '视频删除' })
+ @Post('videos/delete')
+ async videoDelete(
+ @GetToken() token: TokenInfo,
+ @Body('id') videoId: string,
+ @Body('accountId') accountId: string,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.deleteVideo(accessToken, videoId);
+ }
+
+ @ApiOperation({ summary: '更新视频' })
+ @Post('videos/update')
+ async videoUpdate(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('id') videoId: string,
+ @Body('snippet') snippet?: Record<string, any>,
+ @Body('status') status?: Record<string, any>,
+ @Body('recordingDetails') recordingDetails?: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.updateVideo(accessToken, videoId, snippet, status, recordingDetails);
+ }
+
+ @ApiOperation({ summary: '创建播放列表' })
+ @Post('playlist/insert')
+ async playlistInsert(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('snippet') snippet?: Record<string, any>,
+ @Body('status') status?: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.insertPlayList(accessToken, snippet, status);
+ }
+
+ @ApiOperation({ summary: '获取播放列表' })
+ @Get('playlist/list')
+ async getPlayList(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('channelId') channelId?: string,
+ @Query('id') playListIds?: string,
+ @Query('mine') mine?: boolean,
+ @Query('maxResults') maxResults?: string,
+ @Query('pageToken') pageToken?: string,
+ ) {
+ // 校验确保只有一个参数传递
+ const params = [channelId, playListIds, mine];
+ const nonEmptyParams = params.filter(param => param !== undefined && param !== null && param !== '');
+
+ if (nonEmptyParams.length > 1) {
+ throw new BadRequestException('只能选择一个参数: channelId, playListIds, mine');
+ }
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.getPlayList(accessToken, channelId, playListIds, mine, maxResults, pageToken);
+ }
+
+ @ApiOperation({ summary: '更新播放列表' })
+ @Post('playlist/update')
+ async playlistUpdate(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('playListId') playListId: string,
+ @Body('snippet') snippet?: Record<string, any>,
+ @Body('status') status?: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.updatePlayList(accessToken, playListId, snippet, status);
+ }
+
+ @ApiOperation({ summary: '删除播放列表' })
+ @Post('playlist/delete')
+ async playlistDelete(
+ @GetToken() token: TokenInfo,
+ @Body('id') playListId: string,
+ @Body('accountId') accountId: string,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.deletePlaylist(accessToken, playListId);
+ }
+
+ @ApiOperation({ summary: '获取播放列表项' })
+ // @Public()
+ @Get('playlist/items/list')
+ async getPlayItemsList(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('playlistId') playlistId: string,
+ @Query('id') playlistItemsIds: string,
+ @Query('maxResults') maxResults?: string,
+ @Query('pageToken') pageToken?: string,
+ ) {
+ // 校验确保只有一个参数传递
+ const params = [playlistId, playlistItemsIds];
+ const nonEmptyParams = params.filter(param => param !== undefined && param !== null && param !== '');
+
+ if (nonEmptyParams.length > 1) {
+ throw new BadRequestException('只能选择一个参数: playlistId, playlistItemsIds');
+ }
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.getPlayItemsList(accessToken, playlistId, playlistItemsIds, maxResults, pageToken);
+ }
+
+ @ApiOperation({ summary: '添加播放列表项' })
+ @Post('playlist/items/insert')
+ async PlayItemsInsert(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('snippet') snippet?: Record<string, any>,
+ @Body('contentDetails') contentDetails?: Record<string, any>,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.insertPlayItems(accessToken, snippet, contentDetails);
+ }
+
+ @ApiOperation({ summary: '更新播放列表项' })
+ @Post('playlist/items/update')
+ async playItemsUpdate(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('id') playlistItemsId: string,
+ @Body('snippet') snippet?: Record<string, any>,
+ @Body('contentDetails') contentDetails?: Record<string, any>,
+
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.updatePlayItems(accessToken, playlistItemsId, snippet, contentDetails);
+ }
+
+ @ApiOperation({ summary: '删除播放列表项' })
+ @Post('playlist/items/delete')
+ async playItemsDelete(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('id') playlistItemsId: string,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.deletePlayItems(accessToken, playlistItemsId);
+ }
+
+ @ApiOperation({ summary: '视频的点赞、踩' })
+ @Post('videos/rate')
+ async videosRate(
+ @GetToken() token: TokenInfo,
+ @Body('accountId') accountId: string,
+ @Body('id') videoId: string,
+ @Body('rating') rating: string,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.videosRate(accessToken, videoId, rating);
+ }
+
+ @ApiOperation({ summary: '获取视频的点赞、踩' })
+ @Get('videos/rate/list')
+ async getVideosRating(
+ @GetToken() token: TokenInfo,
+ @Query('accountId') accountId: string,
+ @Query('id') videoIds: string,
+ ) {
+ const accessToken = await this.youtubeAuthService.getUserAccessToken(accountId);
+ return this.youtubeService.getVideosRating(accessToken, videoIds);
+ }
+
+}
+
diff --git a/server/src/modules/plat/youtube/youtube.module.ts b/server/src/modules/plat/youtube/youtube.module.ts
new file mode 100644
index 00000000..91e26ddb
--- /dev/null
+++ b/server/src/modules/plat/youtube/youtube.module.ts
@@ -0,0 +1,50 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-04-27 17:36:19
+ * @LastEditors: nevin
+ * @Description: bilibili Bilibili B站模块
+ */
+import { Module, forwardRef } from '@nestjs/common';
+import { MongooseModule } from '@nestjs/mongoose';
+import { YoutubeController } from './youtube.controller';
+import { YoutubeService } from './youtube.service';
+import { GoogleService } from '../google/google.service';
+import { UserModule } from 'src/user/user.module';
+import { RedisModule } from 'src/lib/redis/redis.module';
+import { AuthModule } from 'src/auth/auth.module';
+import { YouTubeAuthService } from './youtube.auth.service';
+import { User, UserSchema } from 'src/db/schema/user.schema';
+import { Account, AccountSchema } from 'src/db/schema/account.schema';
+import { AccountToken, AccountTokenSchema } from 'src/db/schema/accountToken.schema';
+import { PubRecord, PubRecordSchema } from 'src/db/schema/pubRecord.schema';
+import { GoogleModule } from '../google/google.module';
+import googleConfig from 'config/google.config';
+import { ConfigModule } from '@nestjs/config';
+import { AccountModule } from 'src/modules/account/account.module';
+
+@Module({
+ imports: [
+ ConfigModule.forRoot({
+ load: [googleConfig],
+ }),
+
+ MongooseModule.forFeature([
+ { name: User.name, schema: UserSchema },
+ { name: Account.name, schema: AccountSchema },
+ { name: AccountToken.name, schema: AccountTokenSchema },
+ { name: PubRecord.name, schema: PubRecordSchema },
+ ]),
+ UserModule,
+ RedisModule,
+ AuthModule,
+ forwardRef(() => GoogleModule),
+ AccountModule,
+ ],
+ controllers: [YoutubeController],
+ providers: [YoutubeService,
+ YouTubeAuthService,
+ GoogleService],
+ exports: [YoutubeService, YouTubeAuthService],
+})
+export class YoutubeModule {}
diff --git a/server/src/modules/plat/youtube/youtube.service.ts b/server/src/modules/plat/youtube/youtube.service.ts
new file mode 100644
index 00000000..c69500b2
--- /dev/null
+++ b/server/src/modules/plat/youtube/youtube.service.ts
@@ -0,0 +1,1316 @@
+/*
+ * @Author: zhangwei
+ * @Date: 2025-05-15 20:59:55
+ * @LastEditTime: 2025-04-27 17:58:21
+ * @LastEditors: zhangwei
+ * @Description: youtube
+ */
+import { Injectable, BadRequestException } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import axios from 'axios';
+import { v4 as uuidv4 } from 'uuid';
+
+const multer = require('multer');
+const readline = require('readline');
+const { google } = require('googleapis');
+const OAuth2 = google.auth.OAuth2;
+import { GoogleService } from '../google/google.service';
+import { Readable } from 'stream';
+import { Model } from 'mongoose';
+import { PubType, PubStatus, PubRecord } from 'src/db/schema/pubRecord.schema'
+
+// 配置 multer 存储设置(内存存储或本地存储)
+const storage = multer.memoryStorage(); // 存储在内存中
+const upload = multer({ storage: storage });
+
+@Injectable()
+export class YoutubeService {
+ private youtubeService = google.youtube('v3');
+
+ constructor(
+ private oauth2Service: GoogleService,
+ @InjectModel(PubRecord.name)
+ private readonly PubRecordModel: Model<PubRecord>,
+
+ ) {}
+
+ /**
+ * 获取频道列表
+ * @param userId 用户ID
+ * @param handle 频道handle
+ * @param userName 用户名
+ * @param id 频道ID
+ * @param mine 是否查询自己的频道
+ * @returns 频道列表
+ */
+ async getChannelsList(accessToken, handle, userName, id, mine) {
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ access_token: accessToken, // 使用授权的 access token
+ part: 'contentOwnerDetails, snippet, contentDetails, statistics, status, topicDetails',
+ };
+
+ // 根据参数选择 `id` 或 `forUsername`
+ if (id) {
+ requestParams.id = id; // 如果提供了 id, 使用 id
+ } else if (handle) {
+ requestParams.forHandle = handle; // 如果提供了 handle, 使用 handle
+ } else if (userName) {
+ requestParams.forUsername = userName; // 如果提供了 userName, 使用 userName
+ } else if (mine !== undefined) {
+ // 如果 mine 被传递且是布尔值, 可以检查是否为 `true`
+ if (mine) {
+ requestParams.mine = true; // 请求当前登录用户的频道
+ }
+ }
+
+ try {
+ const response = await this.youtubeService.channels.list(requestParams);
+
+ const channels = response.data;
+ console.log(channels);
+ if (channels.length === 0) {
+ console.log('No channel found.');
+ return [];
+ } else {
+ console.log(`This channel's ID is ${channels}`);
+ return channels;
+ }
+ } catch (err) {
+ console.log('The API returned an error: ' + err);
+ return err;
+ }
+ }
+
+ /**
+ * 更新频道
+ * @param accessToken
+ * @param ChannelId 频道ID
+ * @param brandingSettings 品牌设置
+ * @param status 状态
+ * @returns 更新结果
+ */
+ async updateChannels(accessToken, ChannelId, brandingSettings, status) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody: any = {
+ id: ChannelId,
+ // snippet: {
+ // playlistId: playlistId,
+ // resourceId: resourceId,
+ // },
+ // contentDetails: {},
+ };
+
+ // 如果传递了 note,则添加到请求体
+ if (brandingSettings !== undefined) {
+ requestBody.brandingSettings = brandingSettings;
+ }
+ if (status !== undefined) {
+ requestBody.status = status;
+ }
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.channelSections.update(
+ {
+ auth: oauth2Client,
+ part: 'brandingSettings',
+ requestBody
+ }
+ );
+
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Channels update successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Channels updated failed';
+ }
+ } catch (error) {
+ console.error('Error Channels update:', error);
+ return error;
+ }
+
+ }
+
+ /**
+ * 获取频道板块列表
+ * @param accessToken
+ * @param channelId 频道ID
+ * @param id 板块ID
+ * @param mine 是否查询自己的板块
+ * @param maxResults 最大结果数
+ * @param pageToken 分页令牌
+ * @returns 频道板块列表
+ */
+ async getChannelSectionsList(accessToken, channelId, id, mine, maxResults, pageToken) {
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ access_token: accessToken, // 使用授权的 access token
+ part: 'contentDetails, id, snippet',
+ };
+
+ // 根据参数选择 `id` 或 `forUsername`
+ if (id) {
+ requestParams.id = id; // 如果提供了 id, 使用 id
+ } else if (channelId) {
+ requestParams.channelId = channelId; // 如果提供了 handle, 使用 handle
+ } else if (mine !== undefined) {
+ // 如果 mine 被传递且是布尔值, 可以检查是否为 `true`
+ if (mine) {
+ requestParams.mine = true; // 请求当前登录用户的频道
+ }
+ } else if (maxResults) {
+ requestParams.maxResults = maxResults; // 如果提供了 handle, 使用 handle
+ } else if (pageToken) {
+ requestParams.pageToken = pageToken; // 如果提供了 handle, 使用 handle
+ }
+
+ try {
+ const response = await this.youtubeService.channelSections.list(requestParams);
+ const sections = response.data;
+ console.log(sections);
+ if (sections.length === 0) {
+ console.log('No sections found.');
+ return [];
+ } else {
+ console.log(`This sections's ID is ${sections}.`);
+ return sections;
+ }
+ } catch (err) {
+ console.log('The API returned an error: ' + err);
+ return err;
+ }
+ }
+
+ /**
+ * 创建频道板块。
+ *
+ * @param snippet 元数据
+ * @param contentDetails 内容详情
+ * @returns 创建结果
+ */
+ async insertChannelSection(accessToken, snippet, contentDetails) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody = {
+ snippet: snippet,
+ contentDetails: contentDetails,
+ };
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.channelSections.insert(
+ {
+ auth: oauth2Client,
+ part: 'snippet,id, contentDetails',
+ requestBody
+ }
+ );
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Channel Section insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Channel Section insert failed';
+ }
+ } catch (error) {
+ console.error('Error Channel Section insert:', error);
+ return error;
+ }
+ }
+
+ /**
+ * 更新频道板块。
+ * @param snippet 元数据
+ * @param contentDetails 内容详情
+ * @returns 创建结果
+ */
+ async updateChannelSection(accessToken, snippet, contentDetails) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody = {
+ snippet: snippet,
+ contentDetails: contentDetails,
+ };
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.channelSections.update(
+ {
+ auth: oauth2Client,
+ part: 'snippet,id, contentDetails',
+ requestBody
+ }
+ );
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+ }
+
+ /**
+ * 删除频道板块
+ * @param channelSectionId 频道板块ID
+* @returns 删除结果
+ */
+ async deleteChannelsSections(accessToken, channelSectionId) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ try {
+ const response = await this.youtubeService.channelSections.delete({
+ auth: oauth2Client,
+ id: channelSectionId,
+ });
+ console.log('Video deleted:', response.data);
+ } catch (error) {
+ console.error('Error deleting video:', error);
+ return error
+ }
+ }
+
+ /**
+ * 获取频道板块列表。
+ * @param parentId 父评论ID
+ * @param id 评论ID
+ * @param maxResults 最大结果数
+ * @param pageToken 分页令牌
+ * @returns 评论列表
+ */
+ async getCommentsList(accessToken, parentId, id, maxResults, pageToken) {
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ access_token: accessToken, // 使用授权的 access token
+ part: 'id, snippet',
+ };
+
+ // 根据参数选择 `id` 或 `forUsername`
+ if (id) {
+ requestParams.id = id; // 如果提供了 id, 使用 id
+ } else if (parentId) {
+ requestParams.channelId = parentId; // 如果提供了 handle, 使用 handle
+ } else if (maxResults) {
+ requestParams.maxResults = maxResults; // 如果提供了 handle, 使用 handle
+ } else if (pageToken) {
+ requestParams.pageToken = pageToken; // 如果提供了 handle, 使用 handle
+ }
+
+ try {
+ const response = await this.youtubeService.comments.list(requestParams);
+ const sections = response.data;
+ console.log(sections);
+ if (sections.length === 0) {
+ console.log('No sections found.');
+ return [];
+ } else {
+ console.log(`This sections's ID is ${sections}.`);
+ return sections;
+ }
+ } catch (err) {
+ console.log('The API returned an error: ' + err);
+ return err;
+ }
+ }
+
+ /**
+ * 创建对现有评论的回复
+ * @param snippet 元数据
+ * @returns 创建结果
+ */
+ async insertComment(accessToken, snippet) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody = {
+ snippet: snippet
+ };
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.comments.insert(
+ {
+ auth: oauth2Client,
+ part: 'snippet,id',
+ requestBody
+ }
+ );
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+ }
+
+ /**
+ * 更新评论。
+ * @param snippet 元数据
+ * @returns 创建结果
+ */
+ async updateComments(accessToken, snippet) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody = {
+ snippet: snippet
+ };
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.comments.update(
+ {
+ auth: oauth2Client,
+ part: 'snippet,id',
+ requestBody
+ }
+ );
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+ }
+
+ /**
+ * 设置一条或多条评论的审核状态。
+ * @param id 评论ID
+ * @param moderationStatus 审核状态
+ * @param banAuthor 是否禁止作者
+ * @returns 设置结果
+ */
+ async setModerationStatusComments(accessToken, id, moderationStatus, banAuthor) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody = {
+ id: id,
+ moderationStatus:moderationStatus, // heldForReview 等待管理员审核 published - 清除要公开显示的评论。 rejected - 不显示该评论
+ banAuthor: banAuthor // 自动拒绝评论作者撰写的任何其他评论 将作者加入黑名单
+ };
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.comments.setModerationStatus(
+ {
+ auth: oauth2Client,
+ part: 'snippet,id',
+ requestBody
+ }
+ );
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+ }
+
+ /**
+ * 删除评论
+ * @param id 评论ID
+ * @returns 删除结果
+ */
+ async deleteComments(accessToken, id) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ try {
+ const response = await this.youtubeService.comments.delete({
+ auth: oauth2Client,
+ id: id,
+ });
+ console.log('Video deleted:', response.data);
+ } catch (error) {
+ console.error('Error deleting video:', error);
+ return error
+ }
+ }
+
+
+ /**
+ * 获取评论会话列表。
+ */
+ async getCommentThreadsList(accessToken, allThreadsRelatedToChannelId, id, videoId, maxResults, pageToken, order, searchTerms) {
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ access_token: accessToken, // 使用授权的 access token
+ part: 'id, snippet',
+ };
+
+ // 根据参数选择 `id` 或 `forUsername`
+ if (id) {
+ requestParams.id = id; // 如果提供了 id, 使用 id
+ } else if (allThreadsRelatedToChannelId) {
+ requestParams.allThreadsRelatedToChannelId = allThreadsRelatedToChannelId; // 如果提供了 handle, 使用 handle
+ } else if (maxResults) {
+ requestParams.maxResults = maxResults; // 如果提供了 handle, 使用 handle
+ } else if (pageToken) {
+ requestParams.pageToken = pageToken; // 如果提供了 handle, 使用 handle
+ }
+ else if (videoId) {
+ requestParams.videoId = videoId; // 如果提供了 handle, 使用 handle
+ }
+ else if (order) {
+ requestParams.order = order; // 如果提供了 handle, 使用 handle
+ }
+ else if (searchTerms) {
+ requestParams.searchTerms = searchTerms; // 如果提供了 handle, 使用 handle
+ }
+
+ try {
+ const response = await this.youtubeService.commentThreads.list(requestParams);
+ const sections = response.data;
+ console.log(sections);
+ if (sections.length === 0) {
+ console.log('No sections found.');
+ return [];
+ } else {
+ console.log(`This sections's ID is ${sections}.`);
+ return sections;
+ }
+ } catch (err) {
+ console.log('The API returned an error: ' + err);
+ return err;
+ }
+ }
+
+
+ /**
+ * 创建顶级评论
+ */
+ async insertCommentThreads(accessToken, snippet) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody = {
+ snippet: snippet
+ };
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.commentThreads.insert(
+ {
+ auth: oauth2Client,
+ part: 'snippet,id',
+ requestBody
+ }
+ );
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+ }
+
+ /**
+ * 获取视频类别列表。
+ */
+ async getVideoCategoriesList(accessToken, id, regionCode) {
+
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ access_token: accessToken, // 使用授权的 access token
+ part: 'snippet',
+ };
+
+ // 根据参数选择 `id` 或 `forUsername`
+ if (id) {
+ requestParams.id = id; // 如果提供了 id, 使用 id
+ } else if (regionCode) {
+ requestParams.regionCode = regionCode; // 如果提供了 handle, 使用 handle
+ }
+
+ try {
+ const response = await this.youtubeService.videoCategories.list(requestParams);
+
+ const categories = response.data;
+ console.log(categories);
+ if (categories.length === 0) {
+ console.log('No categories found.');
+ return [];
+ } else {
+ console.log(`This categories's ID is ${categories}.`);
+ return categories;
+ }
+ } catch (err) {
+ console.log('The API returned an error: ' + err);
+ return err;
+ }
+ }
+
+ /**
+ * 获取视频列表。
+ * @param id 视频ID
+ * @param chart 图表类型
+ * @param maxResults 最大结果数
+ * @param pageToken 分页令牌
+ * @returns 视频列表
+ */
+ async getVideosList(accessToken, id, myRating, maxResults, pageToken) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ auth: oauth2Client,
+ part: 'snippet,contentDetails,statistics, id, status, topicDetails',
+ // id: ids
+ };
+
+ // 根据参数选择 `id` 或 `forUsername`
+ if (id) {
+ requestParams.id = id; // 如果提供了 id, 使用 id
+ } else if (myRating !== undefined) {
+ // 如果 mine 被传递且是布尔值, 可以检查是否为 `true`
+ if (myRating) {
+ requestParams.myRating = myRating; // 请求当前登录用户的频道
+ }
+ } else if (maxResults) {
+ requestParams.maxResults = maxResults; // 如果提供了 handle, 使用 handle
+ } else if (pageToken) {
+ requestParams.pageToken = pageToken; // 如果提供了 handle, 使用 handle
+ }
+
+ try {
+ const response = await this.youtubeService.videos.list(requestParams);
+
+ const infos = response.data;
+ console.log(infos);
+ if (infos.length === 0) {
+ console.log('No categories found.');
+ return [];
+ } else {
+ console.log(`This infos's ID is ${infos}.`);
+ return infos;
+ }
+ } catch (err) {
+ console.log('The API returned an error: ' + err);
+ return err;
+ }
+ }
+
+ /**
+ * 上传视频。
+ * @param file 视频文件
+ * @param accountId 账号ID
+ * @param title 标题
+ * @param description 描述
+ * @param keywords 关键词
+ * @param categoryId 分类ID
+ * @param privacyStatus 状态(公开?私密)
+ * @returns 视频ID
+ */
+ async uploadVideo(userId, accountId, accessToken, file, title, description, keywords, categoryId, privacyStatus, publishAt) {
+ // 获取当前最大的 id
+ const maxRecord = await this.PubRecordModel.findOne().sort({ id: -1 });
+ const newId = maxRecord ? maxRecord.id + 1 : 1;
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ try {
+ const channelInfo = await this.youtubeService.channels.list({
+ part: ['snippet'],
+ mine: true,
+ auth: oauth2Client,
+ });
+
+ if (!channelInfo.data.items || channelInfo.data.items.length === 0) {
+ throw new Error('未检测到可用的 YouTube 频道,请先创建频道');
+ }
+
+ // 可以上传
+ } catch (err) {
+ if (err.errors?.[0]?.reason === 'youtubeSignupRequired') {
+ throw new Error('当前账号未启用 YouTube,请先创建频道');
+ }
+ }
+
+
+ // 准备视频的元数据
+ const fileStream = Readable.from(file.buffer); // 使用文件的 Buffer 转为可读取流
+ const fileSize = file.size; // 获取文件大小
+
+ // 构造请求体
+ let requestBody: any = {
+ snippet: {
+ title: title,
+ description: description,
+ // tags: keywords ? keywords.split(',') : [],
+ tags: keywords ? keywords : [],
+ categoryId: categoryId || '22', // 默认 categoryId 为 '22',如果没有指定
+ },
+ status: {
+ privacyStatus: privacyStatus, // 可以是 'public', 'private', 'unlisted'
+ },
+ };
+
+
+ // 创建发布记录
+ let newData: any = {
+ userId: userId,
+ type: PubType.VIDEO,
+ title: title,
+ desc: description,
+ accountId: accountId,
+ status:PubStatus.UNPUBLISH,
+ timingTime: publishAt,
+ publishTime: new Date()
+ }
+
+ if (publishAt) {
+ requestBody.status.publishAt = publishAt; // 如果提供了 publishAt 则使用 publishAt
+ }
+
+ console.log(requestBody);
+
+ await this.PubRecordModel.create({
+ ...newData,
+ id: newId,
+ });
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.videos.insert(
+ {
+ auth: oauth2Client,
+ part: 'snippet,status, id, contentDetails',
+ requestBody,
+ media: {
+ body: fileStream, // 上传的文件流
+ },
+ },
+ {
+ onUploadProgress: (e) => {
+ const progress = Math.round((e.bytesRead / fileSize) * 100);
+ console.log(`Uploading... ${progress}%`);
+ },
+ }
+ );
+
+ // const response = { "data": {
+ // "id": "7RckZHFBu7A"
+ // },}
+ // 返回上传的视频 ID
+ if (response.data.id) {
+ console.log('Video uploaded successfully, video ID:', response.data);
+ // return { videoId: response.data.id };
+ // 更新发布记录
+ await this.PubRecordModel.updateOne({ id:newId }, {
+ status: PubStatus.RELEASED,
+ publishTime: response.data.snippet.publishedAt,
+ coverPath: response.data.snippet.thumbnails.url
+ });
+
+ return response.data
+ } else {
+ await this.PubRecordModel.updateOne({ id:newId }, { status: PubStatus.FAIL });
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ await this.PubRecordModel.updateOne({ id:newId }, { status: PubStatus.FAIL });
+ console.error('Error uploading video:', error);
+ return error;
+ }
+
+ }
+
+ /**
+ * 删除视频
+ */
+ async deleteVideo(accessToken, videoId) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ try {
+ const response = await this.youtubeService.videos.delete({
+ auth: oauth2Client,
+ id: videoId,
+ });
+ // await this.PubRecordModel.updateOne({ id:videoId }, { status: PubStatus.FAIL });
+ console.log('Video deleted:', response.data);
+ } catch (error) {
+ console.error('Error deleting video:', error);
+ return error
+ }
+ }
+
+ /**
+ * 更新视频。
+ */
+ async updateVideo(accessToken, videoId, snippet, status, recordingDetails) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ const requestBody: any = {
+ id: videoId,
+ snippet: snippet,
+ status: status,
+ recordingDetails: recordingDetails
+ };
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.videos.update(
+ {
+ auth: oauth2Client,
+ part: 'snippet,status,id',
+ requestBody
+ }
+ );
+
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+
+ }
+
+
+ /**
+ * 创建播放列表。
+ */
+ async insertPlayList(accessToken, snippet, status) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ // const requestBody = {
+ // snippet: {
+ // title: title,
+ // description: description
+ // },
+ // status: {
+ // privacyStatus: privacyStatus, // 可以是 'public', 'private', 'unlisted'
+ // },
+ // };
+ const requestBody = {
+ snippet: snippet,
+ status: status,
+ };
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.playlists.insert(
+ {
+ auth: oauth2Client,
+ part: 'snippet,status, id, contentDetails',
+ requestBody
+ }
+ );
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+ }
+
+ /**
+ * 获取播放列表。
+ */
+ async getPlayList(accessToken, channelId, playListIds, mine, maxResults, pageToken) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ auth: oauth2Client,
+ part: 'snippet,contentDetails, id, status, topicDetails, player',
+ // id: ids
+ };
+
+ // 根据参数选择 `id` 或 `forUsername`
+ if (playListIds) {
+ requestParams.ids = playListIds; // 如果提供了 id, 使用 id
+ } else if (channelId) {
+ requestParams.channelId = channelId; // 如果提供了 handle, 使用 handle
+ } else if (mine !== undefined) {
+ // 如果 mine 被传递且是布尔值, 可以检查是否为 `true`
+ if (mine) {
+ requestParams.mine = true; // 请求当前登录用户的频道
+ }
+ } else if (maxResults) {
+ requestParams.maxResults = maxResults; // 如果提供了 handle, 使用 handle
+ } else if (pageToken) {
+ requestParams.pageToken = pageToken; // 如果提供了 handle, 使用 handle
+ }
+
+ try {
+ const response = await this.youtubeService.playlist.list(requestParams);
+
+ const infos = response.data;
+ console.log(infos);
+ if (infos.length === 0) {
+ console.log('No categories found.');
+ return [];
+ } else {
+ console.log(`This infos's ID is ${infos}.`);
+ return infos;
+ }
+ } catch (err) {
+ console.log('The API returned an error: ' + err);
+ return err;
+ }
+}
+
+ /**
+ * 更新播放列表。
+ */
+ async updatePlayList(accessToken, playListId, snippet, status) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody: any = {
+ id: playListId, // 必填
+ snippet: snippet, // 类型断言
+ status: status // 类型断言
+ };
+
+ // 根据参数选择 `title`、`description`、`privacyStatus` 或 `podcastStatus`
+
+ // if (description) {
+ // requestBody.snippet.description = description; // 如果提供了 id, 使用 id
+ // }
+
+ // if (privacyStatus || podcastStatus) {
+ // if (privacyStatus) {
+ // requestBody.status.privacyStatus = privacyStatus; // 如果提供了 id, 使用 id
+ // }
+ // if (podcastStatus) {
+ // requestBody.status.podcastStatus = podcastStatus; // 如果提供了 id, 使用 id
+ // }
+ // }
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.playlists.update(
+ {
+ auth: oauth2Client,
+ part: 'snippet,status,id',
+ requestBody
+ }
+ );
+
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+
+ }
+
+ /**
+ * 删除播放列表
+ */
+ async deletePlaylist(accessToken, playListId) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ try {
+ const response = await this.youtubeService.playlists.delete({
+ auth: oauth2Client,
+ id: playListId,
+ });
+ console.log('Video deleted:', response.data);
+ } catch (error) {
+ console.error('Error deleting video:', error);
+ return error
+ }
+ }
+
+ /**
+ * 将视频添加到播放列表中
+ */
+ async addVideoToPlaylist(accessToken, videoId, playlistId) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody = {
+ snippet: {
+ playlistId: playlistId,
+ resourceId: {
+ kind: 'youtube#video',
+ videoId: videoId,
+ },
+ }
+ };
+
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.playlistItems.insert(
+ {
+ auth: oauth2Client,
+ part: 'snippet,status, id, contentDetails',
+ requestBody
+ }
+ );
+
+ // const response = { "data": {
+ // "id": "7RckZHFBu7A"
+ // },}
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ throw new Error('Video upload failed');
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ throw error;
+ }
+
+ }
+
+
+ /**
+ * 获取播放列表项。
+ */
+ async getPlayItemsList(accessToken, playlistId, itemsIds, maxResults, pageToken) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ auth: oauth2Client,
+ part: 'snippet, contentDetails, id, status',
+ // id: ids
+ };
+
+ // 根据参数选择 `id` 或 `forUsername`
+ if (itemsIds) {
+ requestParams.ids = itemsIds; // 如果提供了 id, 使用 id
+ } else if (playlistId) {
+ requestParams.playlistId = playlistId; // 如果提供了 handle, 使用 handle
+ } else if (maxResults) {
+ requestParams.maxResults = maxResults; // 如果提供了 handle, 使用 handle
+ } else if (pageToken) {
+ requestParams.pageToken = pageToken; // 如果提供了 handle, 使用 handle
+ }
+
+ try {
+ const response = await this.youtubeService.playlistItems.list(requestParams);
+
+ const infos = response.data;
+ console.log(infos);
+ if (infos.length === 0) {
+ console.log('No categories found.');
+ return [];
+ } else {
+ console.log(`This infos's ID is ${infos}.`);
+ return infos;
+ }
+ } catch (err) {
+ console.log('The API returned an error: ' + err);
+ return err;
+ }
+ }
+
+ /**
+ * 插入播放列表项。
+ */
+ async insertPlayItems(accessToken, snippet, contentDetails) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // // 构造请求体
+ // const requestBody: any = {
+ // snippet: {
+ // playlistId: playlistId,
+ // resourceId: resourceId,
+ // },
+ // contentDetails: {},
+ // };
+
+ // // 如果传递了 position,则添加到请求体
+ // if (position !== undefined) {
+ // requestBody.snippet.position = position;
+ // }
+
+ // // 如果传递了 note,则添加到请求体
+ // if (note !== undefined) {
+ // requestBody.contentDetails.note = note;
+ // }
+ const requestBody: any = {
+ snippet: snippet,
+ contentDetails: contentDetails,
+ };
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.playlistItems.insert(
+ {
+ auth: oauth2Client,
+ part: 'snippet,status, id, contentDetails',
+ requestBody
+ }
+ );
+
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+ }
+
+ /**
+ * 更新播放列表项。
+ */
+ async updatePlayItems(accessToken, playlistItemsId, snippet, contentDetails) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ const requestBody: any = {
+ id: playlistItemsId,
+ snippet: snippet,
+ contentDetails: contentDetails,
+ };
+ console.log(requestBody);
+
+ // 调用 YouTube API 上传视频
+ const response = await this.youtubeService.playlistItems.update(
+ {
+ auth: oauth2Client,
+ part: 'snippet,status,id',
+ requestBody
+ }
+ );
+
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video upload failed';
+ }
+ } catch (error) {
+ console.error('Error uploading video:', error);
+ return error;
+ }
+
+ }
+
+/**
+ * 删除播放列表项
+ */
+ async deletePlayItems(accessToken, playlistItemsId) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ try {
+ const response = await this.youtubeService.playlistItems.delete({
+ auth: oauth2Client,
+ id: playlistItemsId,
+ });
+ console.log('Video deleted:', response.data);
+ } catch (error) {
+ console.error('Error deleting video:', error);
+ return error
+ }
+ }
+
+ /**
+ * 对视频的点赞、踩。
+ */
+ async videosRate(accessToken, videoId, rating) {
+ try {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 构造请求体
+ const requestBody: any = {
+ id: videoId,
+ rating: rating // like | dislike | none
+ };
+
+ console.log(requestBody);
+
+ // 调用 API 进行点赞或踩
+ const response = await this.youtubeService.videos.rate(
+ {
+ auth: oauth2Client,
+ requestBody
+ }
+ );
+
+ // 返回上传的视频 ID
+ if (response.data) {
+ console.log('Playlist insert successfully:', response.data);
+ return response.data;
+ } else {
+ return 'Video rating failed';
+ }
+ } catch (error) {
+ console.error('Error rating video:', error);
+ this.handleApiError(error);
+ }
+
+ }
+
+ /**
+ * 获取视频的点赞、踩。
+ */
+ async getVideosRating(accessToken, videoIds) {
+ // 设置 OAuth2 客户端凭证
+ this.oauth2Service.setCredentials(accessToken);
+ const oauth2Client = this.oauth2Service.getClient();
+
+ // 根据传入的参数来选择一个有效的请求参数
+ let requestParams: any = {
+ auth: oauth2Client,
+ id: videoIds
+ };
+
+ try {
+ const response = await this.youtubeService.videos.getRating(requestParams);
+
+ const infos = response.data;
+ console.log(infos);
+ if (infos.length === 0) {
+ console.log('No categories found.');
+ return [];
+ } else {
+ console.log(`This infos's ID is ${infos}.`);
+ return infos;
+ }
+ } catch (err) {
+ this.handleApiError(err);
+ }
+}
+
+ /**
+ * 处理API错误
+ * @param error 错误对象
+ */
+ private handleApiError(error: any) {
+ console.error('YouTube API Error:', error);
+
+ if (error.response) {
+ // API响应错误
+ const { status, data } = error.response;
+ if (status === 401) {
+ throw new BadRequestException('授权已过期,请重新授权');
+ } else if (status === 403) {
+ throw new BadRequestException('权限不足,无法执行此操作');
+ } else if (data && data.error && data.error.message) {
+ throw new BadRequestException(`YouTube API错误: ${data.error.message}`);
+ }
+ }
+
+ throw new BadRequestException('YouTube API请求失败');
+ }
+
+}
+
diff --git a/server/src/modules/publish/dto/publish.dto.ts b/server/src/modules/publish/dto/publish.dto.ts
new file mode 100644
index 00000000..a79b7602
--- /dev/null
+++ b/server/src/modules/publish/dto/publish.dto.ts
@@ -0,0 +1,114 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-19 15:58:47
+ * @LastEditTime: 2025-03-17 12:41:12
+ * @LastEditors: nevin
+ * @Description: publish
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Transform } from 'class-transformer';
+import {
+ ArrayMaxSize,
+ ArrayMinSize,
+ IsArray,
+ IsDate,
+ IsEnum,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { AccountType } from 'src/db/schema/account.schema';
+import { PubType, PubStatus } from 'src/db/schema/pubRecord.schema';
+
+export class CreatePublishDto {
+ @ApiProperty({
+ title: '类型',
+ required: true,
+ enum: PubType,
+ description: '类型',
+ })
+ @IsEnum(PubType, { message: '类型' })
+ @Expose()
+ readonly type: PubType;
+
+ @ApiProperty({ title: '标题', required: true })
+ @IsString({ message: '标题' })
+ @Expose()
+ readonly title: string;
+
+ @ApiProperty({ title: '描述', required: true })
+ @IsString({ message: '描述' })
+ @Expose()
+ readonly desc: string;
+
+ @ApiProperty({ title: '账户ID', required: true })
+ @IsNumber({ allowNaN: false }, { message: '账户ID' })
+ @Expose()
+ readonly accountId: number;
+
+ @ApiProperty({ title: '视频路径', required: false })
+ @IsString({ message: '视频路径' })
+ @IsOptional()
+ @Expose()
+ readonly videoPath?: string;
+
+ @ApiProperty({ title: '定时发布日期', required: false })
+ @IsDate({ message: '定时发布日期必须是有效的日期' })
+ @IsOptional()
+ @Expose()
+ @Transform(({ value }) => new Date(value))
+ readonly timingTime?: Date;
+
+ @ApiProperty({ title: '封面路径,展示给前台用', required: false })
+ @IsString({ message: '封面路径,展示给前台用' })
+ @IsOptional()
+ @Expose()
+ readonly coverPath?: string;
+
+ @ApiProperty({ title: '通用封面路径', required: false })
+ @IsString({ message: '通用封面路径' })
+ @IsOptional()
+ @Expose()
+ readonly commonCoverPath?: string;
+
+ @ApiProperty({ title: '发布日期', required: false })
+ @IsDate({ message: '发布日期必须是有效的日期' })
+ @IsOptional()
+ @Expose()
+ @Transform(({ value }) => new Date(value))
+ readonly publishTime?: Date;
+
+ @ApiProperty({
+ title: '发布状态',
+ required: false,
+ enum: PubStatus,
+ description: '发布状态',
+ })
+ @IsEnum(PubStatus, { message: '发布状态' })
+ @IsOptional()
+ @Expose()
+ readonly status?: PubStatus;
+}
+
+export class PubRecordListDto {
+ @ApiProperty({
+ title: '账户类型',
+ required: false,
+ enum: AccountType,
+ description: '账户类型',
+ })
+ @IsEnum(AccountType, { message: '账户类型' })
+ @IsOptional()
+ @Expose()
+ readonly type?: AccountType;
+
+ @ApiProperty({ title: '创建时间区间', required: false })
+ @IsArray({ message: '创建时间区间必须是一个数组' })
+ @ArrayMinSize(2, { message: '创建时间区间必须包含两个日期' })
+ @ArrayMaxSize(2, { message: '创建时间区间必须包含两个日期' })
+ @IsDate({ each: true, message: '创建时间区间中的每个元素必须是有效的日期' })
+ @IsOptional()
+ @Expose()
+ @Transform(({ value }) => value ? value.map((v: string) => new Date(v)) : undefined)
+ readonly time?: [Date, Date];
+}
diff --git a/server/src/modules/publish/dto/video.dto.ts b/server/src/modules/publish/dto/video.dto.ts
new file mode 100644
index 00000000..3260ea4c
--- /dev/null
+++ b/server/src/modules/publish/dto/video.dto.ts
@@ -0,0 +1,65 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-19 15:58:47
+ * @LastEditTime: 2025-03-17 12:41:12
+ * @LastEditors: nevin
+ * @Description: publish
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Transform } from 'class-transformer';
+import {
+ ArrayMaxSize,
+ ArrayMinSize,
+ IsArray,
+ IsDate,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { CreateWorkDataDto } from './workData.dto';
+
+export class PubRecordIdDto {
+ @ApiProperty({ title: '发布记录ID', required: true })
+ @IsNumber({ allowNaN: false }, { message: '发布记录ID' })
+ @Expose()
+ readonly pubRecordId: number;
+}
+
+export class VideoPulIdDto {
+ @ApiProperty({ title: 'ID', required: true })
+ @IsNumber({ allowNaN: false }, { message: 'ID' })
+ @Expose()
+ readonly id: number;
+}
+
+export class VideoPulListDto {
+ @ApiProperty({ title: '发布记录ID', required: false })
+ @IsNumber({ allowNaN: false }, { message: '发布记录ID' })
+ @IsOptional()
+ @Expose()
+ readonly pubRecordId?: number;
+
+ @ApiProperty({ title: '创建时间区间', required: false })
+ @IsArray({ message: '创建时间区间必须是一个数组' })
+ @ArrayMinSize(2, { message: '创建时间区间必须包含两个日期' })
+ @ArrayMaxSize(2, { message: '创建时间区间必须包含两个日期' })
+ @IsDate({ each: true, message: '创建时间区间中的每个元素必须是有效的日期' })
+ @IsOptional()
+ @Expose()
+ @Transform(({ value }) => value.map((v: string) => new Date(v)))
+ readonly time?: [Date, Date];
+
+ @ApiProperty({ title: '标题', required: false })
+ @IsString({ message: '标题必须是一个字符串' })
+ @IsOptional()
+ @Expose()
+ readonly title?: string;
+}
+
+export class CreateVideoPulDto extends CreateWorkDataDto {
+ @ApiProperty({ title: '视频路径', required: false })
+ @IsString({ message: '视频路径必须是一个字符串' })
+ @IsOptional()
+ @Expose()
+ readonly videoPath: string;
+}
diff --git a/server/src/modules/publish/dto/workData.dto.ts b/server/src/modules/publish/dto/workData.dto.ts
new file mode 100644
index 00000000..acea418b
--- /dev/null
+++ b/server/src/modules/publish/dto/workData.dto.ts
@@ -0,0 +1,54 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-19 15:58:47
+ * @LastEditTime: 2025-03-17 12:41:12
+ * @LastEditors: nevin
+ * @Description: WorkData
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsOptional, IsString } from 'class-validator';
+import { AccountType } from 'src/db/schema/account.schema';
+import {
+ DiffParmasType,
+ ILableValue,
+ ILocationDataItem,
+ PubStatus,
+ VisibleTypeEnum,
+} from 'src/db/schema/workData.schema';
+
+export class CreateWorkDataDto {
+ dataId?: string;
+ userId: string;
+ lastStatsTime?: Date; // 最后统计时间
+ previewVideoLink: string; // 预览地址,这个值是发布完成手动拼接的
+ pubRecordId: number; // 发布记录id,对应PubRecord表id
+ accountId: number; // 账号id
+ type: AccountType; // 平台类型
+ publishTime?: Date; // 发布时间
+ otherInfo?: Record<string, any>; // 其他信息
+ failMsg?: string; // 发布失败原因(如果失败)
+ status: PubStatus;
+ readCount: number;
+ likeCount: number;
+ collectCount: number;
+ forwardCount: number;
+ commentCount: number;
+ income: number;
+ title?: string; // 标题
+ desc?: string; // 简介,简介中不该包含话题,如果有需要每个平台再自己做处理。
+ coverPath?: string; // 封面路径,机器的本地路径
+ mixInfo?: ILableValue; // 合集
+ topics: string[]; // 话题 格式:['话题1', '话题2'],不该包含 ‘#’
+ location?: ILocationDataItem; // 位置
+ diffParams?: DiffParmasType;
+ visibleType?: VisibleTypeEnum;
+ timingTime?: Date; // 定时发布日期
+ cookies?: Record<string, any>;
+
+ // @ApiProperty({ title: '视频路径', required: false })
+ // @IsString({ message: '视频路径必须是一个字符串' })
+ // @IsOptional()
+ // @Expose()
+ // readonly videoPath: string;
+}
diff --git a/server/src/modules/publish/publish.controller.ts b/server/src/modules/publish/publish.controller.ts
new file mode 100644
index 00000000..2a83f867
--- /dev/null
+++ b/server/src/modules/publish/publish.controller.ts
@@ -0,0 +1,102 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2024-12-23 12:45:22
+ * @LastEditors: nevin
+ * @Description: 发布
+ */
+import { Body, Controller, Get, Param, Post, Query, Delete } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { GetToken } from 'src/auth/auth.guard';
+import { PublishService } from './publish.service';
+import { CreatePublishDto, PubRecordListDto } from './dto/publish.dto';
+import { TableDto } from 'src/global/dto/table.dto';
+import { PubStatus } from 'src/db/schema/pubRecord.schema';
+
+@ApiTags('发布')
+@Controller('publish')
+export class PublishController {
+ constructor(private readonly pubRecordService: PublishService) {}
+
+ @ApiOperation({
+ description: '创建发布记录',
+ summary: '创建发布记录',
+ })
+ @Post()
+ async createPubRecord(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: CreatePublishDto,
+ ) {
+ console.log(body)
+ const res = await this.pubRecordService.createPubRecord({
+ userId: token.id,
+ ...body,
+ });
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取发布记录列表',
+ summary: '获取发布记录列表',
+ })
+ @Get('list/:pageNo/:pageSize')
+ async getPubRecordList(
+ @GetToken() token: TokenInfo,
+ @Param(new ParamsValidationPipe()) param: TableDto,
+ @Query(new ParamsValidationPipe()) query: PubRecordListDto,
+ ) {
+ const res = await this.pubRecordService.getPubRecordList(
+ token.id,
+ param,
+ query,
+ );
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取草稿列表',
+ summary: '获取草稿列表',
+ })
+ @Get('drafts/list/:pageNo/:pageSize')
+ async getPubRecordDraftsList(
+ @GetToken() token: TokenInfo,
+ @Param(new ParamsValidationPipe()) param: TableDto,
+ @Query(new ParamsValidationPipe()) query: PubRecordListDto,
+ ) {
+ const res = await this.pubRecordService.getPubRecordDraftsList(
+ token.id,
+ param,
+ query,
+ );
+ return res;
+ }
+
+ @ApiOperation({
+ description: '更新发布记录状态',
+ summary: '更新发布记录状态',
+ })
+ @Post('status/:id')
+ async updatePubRecordStatus(
+ @GetToken() token: TokenInfo,
+ @Param('id', new ParamsValidationPipe()) id: number,
+ @Body('status', new ParamsValidationPipe()) status: PubStatus,
+ ) {
+ const res = await this.pubRecordService.updatePubRecordStatus(id, status);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '删除发布记录',
+ summary: '删除发布记录',
+ })
+ @Delete(':id')
+ async deletePubRecord(
+ @GetToken() token: TokenInfo,
+ @Param('id', new ParamsValidationPipe()) id: number,
+ ) {
+ const res = await this.pubRecordService.deletePubRecordById(id);
+ return res;
+ }
+}
diff --git a/server/src/modules/publish/publish.module.ts b/server/src/modules/publish/publish.module.ts
new file mode 100644
index 00000000..1337389e
--- /dev/null
+++ b/server/src/modules/publish/publish.module.ts
@@ -0,0 +1,27 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:07
+ * @LastEditTime: 2024-09-05 15:18:26
+ * @LastEditors: nevin
+ * @Description: 发布模块
+ */
+import { Module } from '@nestjs/common';
+import { PublishService } from './publish.service';
+import { PublishController } from './publish.controller';
+import { MongooseModule } from '@nestjs/mongoose';
+import { PubRecord, PubRecordSchema } from 'src/db/schema/pubRecord.schema';
+import { VideoService } from './video/video.service';
+import { VideoController } from './video/video.controller';
+import { Video, VideoSchema } from 'src/db/schema/video.schema';
+
+@Module({
+ imports: [
+ MongooseModule.forFeature([
+ { name: PubRecord.name, schema: PubRecordSchema },
+ { name: Video.name, schema: VideoSchema },
+ ]),
+ ],
+ providers: [PublishService, VideoService],
+ controllers: [PublishController, VideoController],
+})
+export class PublishModule {}
diff --git a/server/src/modules/publish/publish.service.ts b/server/src/modules/publish/publish.service.ts
new file mode 100644
index 00000000..0394a5ab
--- /dev/null
+++ b/server/src/modules/publish/publish.service.ts
@@ -0,0 +1,120 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2024-09-05 15:19:25
+ * @LastEditors: nevin
+ * @Description: PubRecord
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery } from 'mongoose';
+import { PubRecord, PubStatus } from 'src/db/schema/pubRecord.schema';
+import { TableDto } from 'src/global/dto/table.dto';
+import { PubRecordListDto } from './dto/publish.dto';
+
+@Injectable()
+export class PublishService {
+ constructor(
+ @InjectModel(PubRecord.name)
+ private readonly PubRecordModel: Model<PubRecord>,
+ ) {}
+
+ async createPubRecord(newData: Partial<PubRecord>) {
+ // 获取当前最大的 id
+ const maxRecord = await this.PubRecordModel.findOne().sort({ id: -1 });
+ const newId = maxRecord ? maxRecord.id + 1 : 1;
+
+ return await this.PubRecordModel.create({
+ ...newData,
+ id: newId,
+ });
+ }
+
+ /**
+ * 获取发布记录列表
+ * @param userId
+ * @param page
+ * @returns
+ */
+ async getPubRecordList(
+ userId: string,
+ page: TableDto,
+ query: PubRecordListDto,
+ ): Promise<{
+ list: PubRecord[];
+ totalCount: number;
+ }> {
+ const filters: RootFilterQuery<PubRecord> = {
+ userId,
+ ...(query.type !== undefined && { type: query.type }),
+ ...(query.time !== undefined &&
+ query.time.length === 2 && {
+ createdAt: { $gte: query.time[0], $lte: query.time[1] },
+ }),
+ };
+ const list = await this.PubRecordModel.find(filters)
+ .skip((page.pageNo - 1) * page.pageSize)
+ .limit(page.pageSize)
+ .sort({ createdAt: -1 });
+
+ const totalCount = await this.PubRecordModel.countDocuments(filters);
+
+ return {
+ list,
+ totalCount,
+ };
+ }
+
+ /**
+ * 获取发布记录列表
+ * @param userId
+ * @param page
+ * @returns
+ */
+ async getPubRecordDraftsList(
+ userId: string,
+ page: TableDto,
+ query: PubRecordListDto,
+ ): Promise<{
+ list: PubRecord[];
+ totalCount: number;
+ }> {
+ const filters: RootFilterQuery<PubRecord> = {
+ userId,
+ status: PubStatus.UNPUBLISH,
+ ...(query.type !== undefined && { type: query.type }),
+ ...(query.time !== undefined &&
+ query.time.length === 2 && {
+ createdAt: { $gte: query.time[0], $lte: query.time[1] },
+ }),
+ };
+ const list = await this.PubRecordModel.find(filters)
+ .skip((page.pageNo - 1) * page.pageSize)
+ .limit(page.pageSize)
+ .sort({ createdAt: -1 });
+
+ const totalCount = await this.PubRecordModel.countDocuments(filters);
+
+ return {
+ list,
+ totalCount,
+ };
+ }
+
+ // 获取发布记录信息
+ async getPubRecordInfo(id: number) {
+ return await this.PubRecordModel.findOne({ id });
+ }
+
+ // 更新发布记录的状态
+ async updatePubRecordStatus(id: number, status: PubStatus): Promise<boolean> {
+ const res = await this.PubRecordModel.updateOne({ id }, { status });
+ return res.modifiedCount > 0;
+ }
+
+ // 删除发布记录
+ async deletePubRecordById(id: number): Promise<boolean> {
+ const res = await this.PubRecordModel.deleteOne({ id });
+ return res.deletedCount > 0;
+ }
+}
diff --git a/server/src/modules/publish/video/video.controller.ts b/server/src/modules/publish/video/video.controller.ts
new file mode 100644
index 00000000..cb8659df
--- /dev/null
+++ b/server/src/modules/publish/video/video.controller.ts
@@ -0,0 +1,119 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2024-12-23 12:45:22
+ * @LastEditors: nevin
+ * @Description: video
+ */
+import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { GetToken } from 'src/auth/auth.guard';
+import { VideoService } from './video.service';
+import { AccountType } from 'src/db/schema/account.schema';
+import { TableDto } from 'src/global/dto/table.dto';
+import {
+ CreateVideoPulDto,
+ PubRecordIdDto,
+ VideoPulIdDto,
+ VideoPulListDto,
+} from '../dto/video.dto';
+
+@ApiTags('视频发布')
+@Controller('video')
+export class VideoController {
+ constructor(private readonly videoService: VideoService) {}
+
+ @ApiOperation({
+ description: '获取发布记录',
+ summary: '获取发布记录',
+ })
+ @Get('list/:pubRecordId')
+ async getVideoRecord(
+ @Param(new ParamsValidationPipe()) param: PubRecordIdDto,
+ ) {
+ return this.videoService.getVideoPulListByPubRecordId(param.pubRecordId);
+ }
+
+ @ApiOperation({
+ description: '获取发布记录列表',
+ summary: '获取发布记录列表',
+ })
+ @Get('list/:pageNo/:pageSize')
+ async getVideoPulList(
+ @GetToken() token: TokenInfo,
+ @Param(new ParamsValidationPipe()) param: TableDto,
+ @Query(new ParamsValidationPipe()) query: VideoPulListDto,
+ ) {
+ const res = await this.videoService.getVideoPulList(token.id, param, query);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取视频发布信息',
+ summary: '获取视频发布信息',
+ })
+ @Get('info/:id')
+ async getVideoPulInfo(
+ @Param(new ParamsValidationPipe()) param: VideoPulIdDto,
+ ) {
+ const res = await this.videoService.getVideoPulInfo(param.id);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '创建视频发布记录',
+ summary: '创建视频发布记录',
+ })
+ @Post('')
+ async newVideoPul(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: CreateVideoPulDto,
+ ) {
+ const res = await this.videoService.newVideoPul(token.id, body);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '获取视频发布记录类型统计',
+ summary: '获取视频发布记录类型统计',
+ })
+ @Get('count')
+ async getVideoPulTypeCount(
+ @GetToken() token: TokenInfo,
+ @Query(new ParamsValidationPipe())
+ query: {
+ type?: AccountType;
+ },
+ ) {
+ const res = await this.videoService.getVideoPulTypeCount(
+ token.id,
+ query.type,
+ );
+ return res;
+ }
+
+ @ApiOperation({
+ description: '更新视频发布数据',
+ summary: '更新视频发布数据',
+ })
+ @Post('up/:id')
+ async updateVideoPul(
+ @Param(new ParamsValidationPipe()) param: VideoPulIdDto,
+ @Body(new ParamsValidationPipe()) body: CreateVideoPulDto,
+ ) {
+ const res = await this.videoService.updateVideoPul(param.id, body);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '删除发布记录',
+ summary: '删除发布记录',
+ })
+ @Post('del/:id')
+ async delVideoPul(@Param(new ParamsValidationPipe()) param: VideoPulIdDto) {
+ const res = await this.videoService.deleteVideoPulByPubRecordId(param.id);
+ return res;
+ }
+}
diff --git a/server/src/modules/publish/video/video.service.ts b/server/src/modules/publish/video/video.service.ts
new file mode 100644
index 00000000..31483654
--- /dev/null
+++ b/server/src/modules/publish/video/video.service.ts
@@ -0,0 +1,144 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2024-09-05 15:19:25
+ * @LastEditors: nevin
+ * @Description: Video
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery } from 'mongoose';
+import { AccountType } from 'src/db/schema/account.schema';
+import { Video } from 'src/db/schema/video.schema';
+import { TableDto } from 'src/global/dto/table.dto';
+import { VideoPulListDto } from '../dto/video.dto';
+
+@Injectable()
+export class VideoService {
+ constructor(
+ @InjectModel(Video.name)
+ private readonly videoModel: Model<Video>,
+ ) {}
+
+ /**
+ * 创建视频发布数据
+ * @param userId
+ * @param video
+ * @returns
+ */
+ async newVideoPul(userId: string, video: Partial<Video>) {
+ video.userId = userId;
+ return await this.videoModel.create(video);
+ }
+
+ /**
+ * 更新视频数据
+ * @param id
+ * @param video
+ * @returns
+ */
+ async updateVideoPul(id: number, video: Partial<Video>): Promise<boolean> {
+ const res = await this.videoModel.updateOne({ id }, video);
+ return res.modifiedCount > 0;
+ }
+
+ /**
+ * 获取视频发布信息
+ * @param id
+ * @returns
+ */
+ async getVideoPulInfo(id: number): Promise<Video> {
+ return await this.videoModel.findOne({ id });
+ }
+
+ /**
+ * 获取发布记录相关的视频发布列表
+ * @param pubRecordId
+ * @returns
+ */
+ async getVideoPulListByPubRecordId(pubRecordId: number): Promise<Video[]> {
+ const list = await this.videoModel.find({ pubRecordId });
+ return list;
+ }
+
+ // 获取发布记录相关的视频发布列表
+ async getVideoPulListByPubRecordIdToShow(
+ pubRecordId: number,
+ page: {
+ page_size: number;
+ page_no: number;
+ },
+ ) {
+ const list = await this.videoModel
+ .find({ pubRecordId })
+ .skip((page.page_no - 1) * page.page_size)
+ .limit(page.page_size)
+ .sort({ createdAt: -1 });
+
+ const totalCount = await this.videoModel.countDocuments({ pubRecordId });
+
+ return {
+ list,
+ totalCount,
+ };
+ }
+
+ // 视频发布列表
+ async getVideoPulList(
+ userId: string,
+ page: TableDto,
+ query: VideoPulListDto,
+ ) {
+ const filter: RootFilterQuery<Video> = {
+ userId,
+ ...(query.pubRecordId && { pubRecordId: query.pubRecordId }),
+ ...(query.title && { title: query.title }),
+ ...(query.time !== undefined &&
+ query.time.length === 2 && {
+ createdAt: { $gte: query.time[0], $lte: query.time[1] },
+ }),
+ };
+ const list = await this.videoModel
+ .find(filter)
+ .skip((page.pageNo - 1) * page.pageSize)
+ .limit(page.pageSize)
+ .sort({ createdAt: -1 });
+
+ return {
+ list,
+ totalCount: await this.videoModel.countDocuments(filter),
+ };
+ }
+
+ // 删除视频发布
+ async deleteVideoPul(id: number): Promise<boolean> {
+ const res = await this.videoModel.deleteOne({ id });
+ return res.deletedCount > 0;
+ }
+
+ // 获取不同类型的视频发布的总数
+ async getVideoPulTypeCount(
+ userId: string,
+ type?: AccountType,
+ ): Promise<number> {
+ return await this.videoModel.countDocuments({ userId, type });
+ }
+
+ // 删除
+ async deleteVideoPulByPubRecordId(pubRecordId: number): Promise<boolean> {
+ const res = await this.videoModel.deleteMany({ pubRecordId });
+ return res.deletedCount > 0;
+ }
+
+ // 删除
+ async deleteByPubRecordAndAccount(
+ pubRecordId: number,
+ accountId: number,
+ ): Promise<boolean> {
+ const res = await this.videoModel.deleteMany({
+ pubRecordId,
+ accountId,
+ });
+ return res.deletedCount > 0;
+ }
+}
diff --git a/server/src/modules/reward/dto/signIn.dto.ts b/server/src/modules/reward/dto/signIn.dto.ts
new file mode 100644
index 00000000..3404a561
--- /dev/null
+++ b/server/src/modules/reward/dto/signIn.dto.ts
@@ -0,0 +1,45 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:16:37
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import {
+ ArrayMaxSize,
+ ArrayMinSize,
+ IsArray,
+ IsDateString,
+ IsEnum,
+ IsNotEmpty,
+ IsOptional,
+} from 'class-validator';
+import { PagerDto } from 'src/common/dto/pager.dto';
+import { SignIn, SignInType } from 'src/db/schema/signIn.schema';
+
+export class CreateSignInDto implements Partial<SignIn> {
+ @ApiProperty({ enum: SignInType })
+ @IsNotEmpty({ message: '类型不能为空' })
+ @IsEnum(SignInType)
+ @Expose()
+ type: SignInType;
+}
+
+export class QuerySignInListDto extends PagerDto {
+ @ApiProperty({ enum: SignInType })
+ @IsNotEmpty({ message: '类型不能为空' })
+ @IsEnum(SignInType)
+ @Expose()
+ readonly type: SignInType;
+
+ @ApiProperty({ title: '创建时间区间', required: false })
+ @IsArray({ message: '创建时间区间必须是一个数组' })
+ @ArrayMinSize(2, { message: '创建时间区间必须包含两个日期' })
+ @ArrayMaxSize(2, { message: '创建时间区间必须包含两个日期' })
+ @IsDateString({}, { each: true })
+ @IsOptional()
+ @Expose()
+ readonly time?: [Date, Date];
+}
diff --git a/server/src/modules/reward/reward.module.ts b/server/src/modules/reward/reward.module.ts
new file mode 100644
index 00000000..9508e70f
--- /dev/null
+++ b/server/src/modules/reward/reward.module.ts
@@ -0,0 +1,22 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-04-27 17:36:19
+ * @LastEditors: nevin
+ * @Description: reward Reward 奖励模块
+ */
+import { Module } from '@nestjs/common';
+import { MongooseModule } from '@nestjs/mongoose';
+import { SignInService } from './signIn.service';
+import { SignInController } from './signIn.controller';
+import { SignIn, SignInSchema } from 'src/db/schema/signIn.schema';
+
+@Module({
+ imports: [
+ MongooseModule.forFeature([{ name: SignIn.name, schema: SignInSchema }]),
+ ],
+ controllers: [SignInController],
+ providers: [SignInService],
+ exports: [SignInService],
+})
+export class RewardModule {}
diff --git a/server/src/modules/reward/signIn.controller.ts b/server/src/modules/reward/signIn.controller.ts
new file mode 100644
index 00000000..26b68e2e
--- /dev/null
+++ b/server/src/modules/reward/signIn.controller.ts
@@ -0,0 +1,44 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 18:00:18
+ * @LastEditors: nevin
+ * @Description: signIn SignIn 签到
+ */
+import { Body, Controller, Get, Post, Query } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { ApiResult } from '../../common/decorators/api-result.decorator';
+import { SignInService } from './signIn.service';
+import { GetToken } from '../../auth/auth.guard';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { CreateSignInDto, QuerySignInListDto } from './dto/signIn.dto';
+import { SignIn } from 'src/db/schema/signIn.schema';
+
+@ApiTags('reward/signIn - 奖励/签到')
+@Controller('reward/signIn')
+export class SignInController {
+ constructor(private readonly signInService: SignInService) {}
+
+ @ApiOperation({ summary: '创建签到记录' })
+ @Post()
+ @ApiResult({ type: SignIn })
+ async createSignInRecord(
+ @GetToken() token: TokenInfo,
+ @Body() body: CreateSignInDto,
+ ) {
+ const res = await this.signInService.createSignInRecord(
+ token.id,
+ body.type,
+ );
+ return res;
+ }
+
+ @ApiOperation({ summary: '获取时间段内的签到列表' })
+ @Get('list')
+ async getSignInList(
+ @GetToken() token: TokenInfo,
+ @Query() query: QuerySignInListDto,
+ ) {
+ return this.signInService.getSignInList(token.id, query);
+ }
+}
diff --git a/server/src/modules/reward/signIn.service.ts b/server/src/modules/reward/signIn.service.ts
new file mode 100644
index 00000000..d3a397d7
--- /dev/null
+++ b/server/src/modules/reward/signIn.service.ts
@@ -0,0 +1,76 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-15 20:59:55
+ * @LastEditTime: 2025-04-27 17:58:21
+ * @LastEditors: nevin
+ * @Description: signIn SignIn 签到
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery } from 'mongoose';
+import { SignIn, SignInType } from 'src/db/schema/signIn.schema';
+import { QuerySignInListDto } from './dto/signIn.dto';
+import { paginateModel } from 'src/common/paginate/create-pagination';
+
+@Injectable()
+export class SignInService {
+ constructor(
+ @InjectModel(SignIn.name)
+ private readonly signInModel: Model<SignIn>,
+ ) {}
+
+ /**
+ * 创建签到记录,有则更新创建时间
+ * @param userId
+ * @param type
+ * @returns
+ */
+ async createSignInRecord(userId: string, type: SignInType): Promise<SignIn> {
+ return await this.signInModel.findOneAndUpdate(
+ {
+ userId,
+ type,
+ },
+ {
+ $set: {
+ userId,
+ type,
+ createTime: new Date(),
+ },
+ },
+ {
+ upsert: true,
+ new: true,
+ },
+ );
+ }
+
+ /**
+ * 获取时间段内的签到列表
+ * @param userId
+ * @param query
+ * @returns
+ */
+ async getSignInList(userId: string, query: QuerySignInListDto) {
+ const { page, pageSize, type, time } = query;
+ const filter: RootFilterQuery<SignIn> = { userId, type };
+
+ if (time) {
+ filter.createTime = {
+ $gte: new Date(time[0]),
+ $lte: new Date(time[1]),
+ };
+ }
+
+ return paginateModel(
+ this.signInModel,
+ {
+ page,
+ pageSize,
+ },
+ filter,
+ undefined,
+ { _id: -1 },
+ );
+ }
+}
diff --git a/server/src/modules/task/adminTask.controller.ts b/server/src/modules/task/adminTask.controller.ts
new file mode 100644
index 00000000..bd843041
--- /dev/null
+++ b/server/src/modules/task/adminTask.controller.ts
@@ -0,0 +1,140 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-20 16:23:34
+ * @LastEditTime: 2025-04-27 16:10:15
+ * @LastEditors: nevin
+ * @Description: 管理端任务管理
+ */
+import {
+ Body,
+ Controller,
+ Delete,
+ Get,
+ Param,
+ Post,
+ Put,
+ Query,
+} from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { Manager } from '../../auth/manager.guard';
+import { ApiResult } from '../../common/decorators/api-result.decorator';
+import { Task, TaskStatus } from '../../db/schema/task.schema';
+import { CreateTaskDto } from './dto/create-task.dto';
+import { QueryTaskDto } from './dto/query-task.dto';
+import { QueryVerificationDto } from './dto/query-verification.dto';
+import {
+ ActionTaskFileDto,
+ UpdateTaskDto,
+ UpTaskStatusDto,
+} from './dto/task.dto';
+import { UserTaskService } from './user-task.service';
+import { AdminTaskService } from './adminTask.service';
+import { PagerDto } from 'src/common/dto/pager.dto';
+import { ActionTaskMaterialDto } from './dto/adminTask.dto';
+import { AppHttpException } from 'src/filters/http-exception.filter';
+import { ErrHttpBack } from 'src/filters/http-exception.back-code';
+
+@ApiTags('admin/tasks - 任务管理')
+@Controller('admin/tasks')
+@Manager()
+export class AdminTaskController {
+ constructor(
+ private readonly userTaskService: UserTaskService,
+ private readonly adminTaskService: AdminTaskService,
+ ) {}
+
+ @ApiOperation({ summary: '创建任务' })
+ @ApiResult({ type: Task })
+ @Post('create')
+ async createTask(@Body() body: CreateTaskDto) {
+ return this.adminTaskService.create(body);
+ }
+
+ @ApiOperation({ summary: '更新任务' })
+ @ApiResult({ type: Task })
+ @Put('update/:id')
+ async updateTask(@Param('id') id: string, @Body() body: UpdateTaskDto) {
+ return this.adminTaskService.update(id, body);
+ }
+
+ @ApiOperation({ summary: '添加任务附件' })
+ @Post('file/:id')
+ async addTaskFile(@Param('id') id: string, @Body() body: ActionTaskFileDto) {
+ return this.adminTaskService.addTaskFile(id, body);
+ }
+
+ @ApiOperation({ summary: '删除任务附件' })
+ @Delete('file/:id')
+ async delTaskFile(@Param('id') id: string, @Body() body: ActionTaskFileDto) {
+ return this.adminTaskService.deleteTaskFile(id, body);
+ }
+
+ @ApiOperation({ summary: '删除任务' })
+ @Delete('delete/:id')
+ @ApiResult({ type: Boolean })
+ async deleteTask(@Param('id') id: string) {
+ return this.adminTaskService.delTask(id);
+ }
+
+ // 更新任务状态
+ @Put('status/:id/:status')
+ @ApiResult({ type: Boolean })
+ async upTaskStatus(@Param() param: UpTaskStatusDto) {
+ const tastInfo = await this.adminTaskService.findOne(param.id);
+ return this.adminTaskService.updateStatus(tastInfo, param.status);
+ }
+
+ @ApiOperation({ summary: '获取任务列表' })
+ @ApiResult({ type: [Task], isPage: true })
+ @Get('list')
+ async getTasks(@Query() query: QueryTaskDto) {
+ return this.adminTaskService.findAll(query);
+ }
+
+ @ApiOperation({ summary: '获取任务详情' })
+ @ApiResult({ type: Task })
+ @Get('info/:id')
+ async getTask(@Param('id') id: string) {
+ return this.adminTaskService.findOne(id);
+ }
+
+ @ApiOperation({ summary: '获取待验证任务列表' })
+ @ApiResult({ type: [Task], isPage: true })
+ @Get('verification/pending')
+ async getTasksForVerification(@Query() query: QueryVerificationDto) {
+ return this.userTaskService.getTasksForVerification(query);
+ }
+
+ // 获取任务素材列表
+ @Get('material/list/:taskId')
+ async getMaterialList(
+ @Param('taskId') taskId: string,
+ @Query() query: PagerDto,
+ ) {
+ return this.adminTaskService.findTaskMaterialList(taskId, query);
+ }
+
+ // 添加任务素材列表
+ @Post('material')
+ async addTaskMaterial(@Body() body: ActionTaskMaterialDto) {
+ return this.adminTaskService.createTaskMaterial(body);
+ }
+
+ // 更新任务素材
+ @Put('material/:id')
+ async upTaskMaterial(
+ @Param('id') id: string,
+ @Body() body: ActionTaskMaterialDto,
+ ) {
+ const info = await this.adminTaskService.getTaskMaterialById(id);
+ if (!info) throw new AppHttpException(ErrHttpBack.fail);
+
+ return this.adminTaskService.upTaskMaterial(id, body);
+ }
+
+ // 删除任务素材
+ @Delete('material/:id')
+ async deleteTaskMaterial(@Param('id') id: string) {
+ return this.adminTaskService.deleteTaskMaterial(id);
+ }
+}
diff --git a/server/src/modules/task/adminTask.service.ts b/server/src/modules/task/adminTask.service.ts
new file mode 100644
index 00000000..d1b916f8
--- /dev/null
+++ b/server/src/modules/task/adminTask.service.ts
@@ -0,0 +1,213 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-04-27 17:55:50
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable, NotFoundException } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { paginateModel } from '../../common/paginate/create-pagination';
+import {
+ Task,
+ TaskFile,
+ TaskStatus,
+ TaskType,
+} from '../../db/schema/task.schema';
+import { UserTask } from '../../db/schema/user-task.schema';
+import { CreateTaskDto } from './dto/create-task.dto';
+import { QueryTaskDto } from './dto/query-task.dto';
+import { UpdateTaskDto } from './dto/task.dto';
+import { TaskMaterial } from 'src/db/schema/taskMaterial.schema';
+import { ActionTaskMaterialDto } from './dto/adminTask.dto';
+import { PagerDto } from 'src/common/dto/pager.dto';
+import { AppHttpException } from 'src/filters/http-exception.filter';
+import { ErrHttpBack } from 'src/filters/http-exception.back-code';
+
+@Injectable()
+export class AdminTaskService {
+ constructor(
+ @InjectModel(Task.name) private taskModel: Model<Task>,
+ @InjectModel(UserTask.name) private userTaskModel: Model<UserTask>,
+ @InjectModel(TaskMaterial.name)
+ private taskMaterialModel: Model<TaskMaterial>,
+ ) {}
+
+ async create(createTaskDto: CreateTaskDto): Promise<Task> {
+ const createdTask = new this.taskModel({
+ ...createTaskDto,
+ keepTime: 5 * 60, // TODO: 先暂时默认为5分钟
+ });
+ return createdTask.save();
+ }
+
+ /**
+ * 获取任务列表
+ * @param query
+ * @returns
+ */
+ async findAll(query: QueryTaskDto) {
+ const {
+ page = 1,
+ pageSize = 10,
+ type,
+ keyword,
+ productLevel,
+ requiresShoppingCart,
+ status,
+ } = query;
+ const filter: any = {};
+
+ if (type) filter.type = type;
+ if (productLevel) filter.productLevel = productLevel;
+ if (requiresShoppingCart !== undefined)
+ filter.requiresShoppingCart = requiresShoppingCart;
+ if (keyword) filter.title = new RegExp(keyword, 'i');
+ if (status !== undefined) filter.status = status;
+
+ return paginateModel(
+ this.taskModel,
+ {
+ page,
+ pageSize,
+ },
+ filter,
+ undefined,
+ { _id: -1 },
+ );
+ }
+
+ async findOne(id: string): Promise<Task> {
+ const task = await this.taskModel.findById(id).exec();
+ if (!task) {
+ throw new NotFoundException('Task not found');
+ }
+ return task;
+ }
+
+ async update(id: string, data: UpdateTaskDto): Promise<Task> {
+ const updatedTask = await this.taskModel.findByIdAndUpdate(id, data).exec();
+ if (!updatedTask) throw new NotFoundException('Task not found');
+ return updatedTask;
+ }
+
+ /**
+ * 更新任务状态
+ * @param task
+ * @param status
+ * @returns
+ */
+ async updateStatus(task: Task, status: TaskStatus): Promise<Task> {
+ if (status === TaskStatus.ACTIVE && task.type === TaskType.ARTICLE) {
+ // 查询是否存在任务的素材
+ const material = await this.taskMaterialModel.findOne({
+ taskId: task.id,
+ });
+
+ if (!material) throw new AppHttpException(ErrHttpBack.task_no_material);
+ }
+
+ const res = await this.taskModel.findByIdAndUpdate(
+ { _id: task.id },
+ {
+ status,
+ },
+ );
+
+ return res;
+ }
+
+ /**
+ * 更新任务状态
+ * @param id
+ * @param status
+ * @returns
+ */
+ async delTask(id: string): Promise<Task> {
+ const res = await this.taskModel.findByIdAndUpdate(id, {
+ status: TaskStatus.DEL,
+ });
+
+ return res;
+ }
+
+ // 添加任务文件
+ async addTaskFile(id: string, file: TaskFile): Promise<TaskFile[]> {
+ const res = await this.taskModel.findByIdAndUpdate(id, {
+ $push: {
+ fileList: file,
+ },
+ });
+ return res.fileList;
+ }
+
+ // 删除任务文件
+ async deleteTaskFile(id: string, file: TaskFile): Promise<TaskFile[]> {
+ const res = await this.taskModel.findByIdAndUpdate(id, {
+ $pull: {
+ fileList: file,
+ },
+ });
+ return res.fileList;
+ }
+
+ /**
+ * 获取任务素材列表
+ * @param query
+ * @returns
+ */
+ async findTaskMaterialList(taskId: string, query: PagerDto) {
+ const { page = 1, pageSize = 10 } = query;
+ return paginateModel(
+ this.taskMaterialModel,
+ {
+ page,
+ pageSize,
+ },
+ {
+ taskId,
+ },
+ undefined,
+ { usedCount: 1 },
+ );
+ }
+
+ /**
+ * 创建任务素材
+ * @param data
+ * @returns
+ */
+ async createTaskMaterial(data: ActionTaskMaterialDto): Promise<TaskMaterial> {
+ const taskMaterial = new this.taskMaterialModel(data);
+ return taskMaterial.save();
+ }
+
+ /**
+ * 更新任务素材
+ * @param data
+ * @returns
+ */
+ async upTaskMaterial(
+ id: string,
+ data: ActionTaskMaterialDto,
+ ): Promise<boolean> {
+ const res = await this.taskMaterialModel.updateOne({ _id: id }, data);
+ return res.modifiedCount > 0;
+ }
+
+ // 根据ID获取
+ async getTaskMaterialById(id: string): Promise<TaskMaterial> {
+ return this.taskMaterialModel.findById(id);
+ }
+
+ /**
+ * 删除任务素材
+ * @param id
+ * @returns
+ */
+ async deleteTaskMaterial(id: string): Promise<TaskMaterial> {
+ const res = await this.taskMaterialModel.findByIdAndDelete(id);
+ return res;
+ }
+}
diff --git a/server/src/modules/task/adminUserTask.controller.ts b/server/src/modules/task/adminUserTask.controller.ts
new file mode 100644
index 00000000..8382ed2e
--- /dev/null
+++ b/server/src/modules/task/adminUserTask.controller.ts
@@ -0,0 +1,142 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-20 16:23:34
+ * @LastEditTime: 2025-05-06 14:19:19
+ * @LastEditors: nevin
+ * @Description: 管理端-用户任务管理
+ */
+import {
+ Body,
+ Controller,
+ Get,
+ NotFoundException,
+ Param,
+ Put,
+ Query,
+} from '@nestjs/common';
+import { Manager } from '../../auth/manager.guard';
+import { AdminUserTaskService } from './adminUserTask.service';
+import { AdminQueryUserTaskDto } from './dto/userTask.dto';
+import { ApiResult } from 'src/common/decorators/api-result.decorator';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { GetToken } from 'src/auth/auth.guard';
+import { UserTaskStatus } from 'src/db/schema/user-task.schema';
+import { AppHttpException } from 'src/filters/http-exception.filter';
+import { ErrHttpBack } from 'src/filters/http-exception.back-code';
+import { RejectedTaskDto } from './dto/verify-task.dto';
+import { UserTaskService } from './user-task.service';
+
+@Controller('admin/userTasks')
+@Manager()
+export class AdminUserTaskController {
+ constructor(
+ private readonly adminUserTaskService: AdminUserTaskService,
+ private readonly userTaskService: UserTaskService,
+ ) {}
+
+ @Get('list')
+ async getTasks(@Query() query: AdminQueryUserTaskDto) {
+ return this.adminUserTaskService.getList(query);
+ }
+
+ @Get('info/:id')
+ async getTask(@Param('id') id: string) {
+ return this.adminUserTaskService.getUserTaskInfoById(id);
+ }
+
+ @Get('count/approved/task')
+ async getCompletedTaskCount() {
+ return this.adminUserTaskService.getCompletedTaskCount();
+ }
+
+ @Get('count/approved/user')
+ async getCompletedUserCount() {
+ return this.adminUserTaskService.getCompletedUserCount();
+ }
+
+ // 通过
+ @ApiResult({ type: Boolean })
+ @Put('verify/approved/:id')
+ async verifyUserTaskApproved(
+ @GetToken() verifier: TokenInfo,
+ @Param('id') id: string,
+ ) {
+ const userTask = await this.userTaskService.getUserTaskInfoById(id);
+ if (!userTask) throw new NotFoundException('任务不存在');
+ if (userTask.status !== UserTaskStatus.PENDING)
+ throw new AppHttpException(ErrHttpBack.user_task_err_status);
+
+ return this.adminUserTaskService.verifyUserTaskApproved(userTask, {
+ verifierUserId: verifier.id,
+ });
+ }
+
+ // 拒绝
+ @ApiResult({ type: Boolean })
+ @Put('verify/rejected/:id')
+ async verifyUserTaskRejected(
+ @GetToken() verifier: TokenInfo,
+ @Param('id') id: string,
+ @Body() data: RejectedTaskDto,
+ ) {
+ const userTask = await this.userTaskService.getUserTaskInfoById(id);
+ if (!userTask) throw new NotFoundException('任务不存在');
+ return this.adminUserTaskService.verifyUserTaskRejected(userTask, {
+ verifierUserId: verifier.id,
+ ...data,
+ });
+ }
+
+ @ApiResult({ type: Boolean })
+ @Put('rollback/rejected/:id')
+ async rollbackUserTaskApproved(
+ @GetToken() verifier: TokenInfo,
+ @Param('id') id: string,
+ @Body() data: RejectedTaskDto,
+ ) {
+ const userTask = await this.userTaskService.getUserTaskInfoById(id);
+ if (!userTask) throw new NotFoundException('任务不存在');
+ if (userTask.status !== UserTaskStatus.PENDING)
+ throw new NotFoundException('任务不存在或状态不正确');
+
+ return this.adminUserTaskService.rollbackUserTaskApproved(userTask, {
+ verifierUserId: verifier.id,
+ ...data,
+ });
+ }
+
+ // 运行自动审核的任务
+ @ApiResult({ type: Boolean })
+ @Put('audit/auto/run/:id')
+ async runUserTaskAuditAuto(@Param('id') id: string) {
+ const userTaskInfo =
+ await this.adminUserTaskService.getUserTaskInfoById(id);
+ if (!userTaskInfo) throw new NotFoundException('任务不存在或状态不正确');
+
+ const { status, message, retry, data } =
+ await this.adminUserTaskService.autoAuditTask(id);
+
+ this.adminUserTaskService.updateUserTaskAutoStatus(id, { status, message });
+
+ if (!status)
+ return {
+ status,
+ message,
+ retry,
+ };
+
+ // 根据审核状态确定是否通过
+ if (data) {
+ this.adminUserTaskService.verifyUserTaskApproved(userTaskInfo, {});
+ } else {
+ this.adminUserTaskService.verifyUserTaskRejected(userTaskInfo, {
+ verificationNote: `人工触发自动审核---${message}`,
+ });
+ }
+
+ return {
+ status: true,
+ message: '审核成功',
+ };
+ }
+}
diff --git a/server/src/modules/task/adminUserTask.service.ts b/server/src/modules/task/adminUserTask.service.ts
new file mode 100644
index 00000000..557ce517
--- /dev/null
+++ b/server/src/modules/task/adminUserTask.service.ts
@@ -0,0 +1,344 @@
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, RootFilterQuery, Types } from 'mongoose';
+import { paginateModel } from '../../common/paginate/create-pagination';
+import { Task, TaskType } from '../../db/schema/task.schema';
+import { UserTask, UserTaskStatus } from '../../db/schema/user-task.schema';
+import { QueryVerificationDto } from './dto/query-verification.dto';
+import { AdminQueryUserTaskDto } from './dto/userTask.dto';
+import { FinanceService } from '../finance/finance.service';
+import { UserTaskService } from './user-task.service';
+import { TaskService } from './task.service';
+import { TaskUtilService } from './util.service';
+import { AccountType } from '../../db/schema/account.schema';
+
+@Injectable()
+export class AdminUserTaskService {
+ constructor(
+ @InjectModel(UserTask.name) private userTaskModel: Model<UserTask>,
+ @InjectModel(Task.name) private taskModel: Model<Task>,
+ private readonly financeService: FinanceService,
+ readonly userTaskService: UserTaskService,
+ readonly taskUtilService: TaskUtilService,
+ readonly taskService: TaskService,
+ ) {}
+
+ async getUserTaskInfoById(id: string): Promise<UserTask> {
+ const task = await this.userTaskModel.findById(id).exec();
+ return task;
+ }
+
+ async getUserTaskInfoByTaskIdOfUser(
+ taskId: string,
+ userId: string,
+ ): Promise<UserTask> {
+ const res = await this.userTaskModel
+ .findOne({
+ userId: new Types.ObjectId(userId),
+ taskId: new Types.ObjectId(taskId),
+ })
+ .exec();
+ return res;
+ }
+
+ /**
+ * 获取用户的任务列表
+ * @param query
+ * @returns
+ */
+ async getList(query: AdminQueryUserTaskDto) {
+ const { page, pageSize, status, keyword, time } = query;
+ const filter: RootFilterQuery<UserTask> = {
+ ...(status !== undefined && { status }),
+ ...(keyword && { title: { $regex: keyword, $options: 'i' } }),
+ ...(time && {
+ createdAt: {
+ $gte: new Date(time[0]),
+ $lte: new Date(time[1]),
+ },
+ }),
+ };
+
+ return paginateModel(
+ this.userTaskModel,
+ {
+ page,
+ pageSize,
+ },
+ filter,
+ 'taskId',
+ { _id: -1 },
+ );
+ }
+
+ /**
+ * 获取任务列表进行审核
+ * @param query
+ * @returns
+ */
+ async getTasksForVerification(query: QueryVerificationDto) {
+ const { page = 1, pageSize = 10, status } = query;
+
+ const filter: any = {};
+ if (status) filter.status = status;
+
+ return paginateModel(
+ this.userTaskModel,
+ {
+ page,
+ pageSize,
+ },
+ filter,
+ 'taskId',
+ { _id: -1 },
+ );
+ }
+
+ /**
+ * 验证任务-通过
+ * @param userTask
+ * @returns
+ */
+ async verifyUserTaskApproved(
+ userTask: UserTask,
+ data: {
+ verifierUserId?: string;
+ },
+ ): Promise<boolean> {
+ const task = await this.taskModel.findById(userTask.taskId);
+ if (!task) return false;
+
+ const res = await this.userTaskModel.updateOne(
+ { _id: userTask.id },
+ {
+ $set: {
+ status: UserTaskStatus.APPROVED,
+ verificationNote: '审核通过',
+ ...data,
+ rewardTime: new Date(),
+ reward: task.reward,
+ },
+ },
+ );
+
+ // 更新用户余额
+ await this.financeService.updateUserWalletBalance(
+ userTask.userId,
+ task.reward,
+ );
+
+ return res.modifiedCount > 0;
+ }
+
+ /**
+ * 验证任务-拒绝
+ * @param userTask
+ * @returns
+ */
+ async verifyUserTaskRejected(
+ userTask: UserTask,
+ data: {
+ verifierUserId?: string;
+ verificationNote?: string; // 人工核查备注
+ },
+ ): Promise<boolean> {
+ if (userTask.status === UserTaskStatus.PENDING) return false;
+
+ const res = await this.userTaskModel.updateOne(
+ { _id: userTask.id },
+ {
+ $set: {
+ status: UserTaskStatus.REJECTED,
+ ...data,
+ },
+ },
+ );
+
+ // 该对应的任务,发布次数+1
+ await this.taskModel.updateOne(
+ { _id: userTask.taskId },
+ {
+ $inc: {
+ currentRecruits: +1,
+ },
+ },
+ );
+
+ return res.modifiedCount > 0;
+ }
+
+ /**
+ * 验证任务-回退
+ * @param userTask
+ * @returns
+ */
+ async rollbackUserTaskApproved(
+ userTask: UserTask,
+ data: {
+ verifierUserId: string;
+ verificationNote: string; // 人工核查备注
+ },
+ ): Promise<boolean> {
+ const task = await this.taskModel.findById(userTask.taskId);
+ if (!task) return false;
+
+ const res = await this.userTaskModel.updateOne(
+ { _id: userTask.id },
+ {
+ $set: {
+ status: UserTaskStatus.DEL,
+ verificationNote: '任务撤回,并扣除余额',
+ ...data,
+ },
+ },
+ );
+
+ // 更新用户余额
+ await this.financeService.updateUserWalletBalance(
+ userTask.userId,
+ -task.reward,
+ );
+
+ // 该对应的任务,发布次数+1
+ await this.taskModel.updateOne(
+ { _id: userTask.taskId },
+ {
+ $inc: {
+ currentRecruits: +1,
+ },
+ },
+ );
+
+ return res.modifiedCount > 0;
+ }
+
+ // 获取已完成任务的总数
+ getCompletedTaskCount() {
+ return this.userTaskModel.countDocuments({
+ status: UserTaskStatus.APPROVED,
+ });
+ }
+
+ // 获取完成过任务的用户总数
+ async getCompletedUserCount(): Promise<number> {
+ const result = await this.userTaskModel
+ .aggregate([
+ { $match: { status: UserTaskStatus.APPROVED } },
+ { $group: { _id: '$userId' } },
+ { $count: 'uniqueUsers' },
+ ])
+ .exec();
+ return result[0]?.uniqueUsers || 0;
+ }
+
+ /**
+ * 自动审核
+ * @param userTaskId
+ */
+ async autoAuditTask(userTaskId: string): Promise<{
+ status: 0 | 1; // 0:成功 1:失败
+ message: string;
+ retry: boolean;
+ data?: boolean;
+ }> {
+ const userTaskInfo =
+ await this.userTaskService.getUserTaskInfoById(userTaskId);
+ if (!userTaskInfo)
+ return {
+ status: 0,
+ message: '用户任务不存在',
+ retry: false,
+ };
+
+ if (userTaskInfo.status !== UserTaskStatus.PENDING)
+ return {
+ status: 0,
+ message: '用户任务状态错误',
+ retry: false,
+ };
+
+ const taskInfo = await this.taskService.findOne(
+ userTaskInfo.taskId.toString(),
+ );
+ if (!taskInfo)
+ return {
+ status: 0,
+ message: '任务不存在',
+ retry: false,
+ };
+
+ // 获取使用的素材信息
+ const taskMaterialInfo = await this.taskService.getTaskMaterialById(
+ userTaskInfo.taskMaterialId,
+ );
+ if (!taskMaterialInfo)
+ return {
+ status: 0,
+ message: '素材信息不存在',
+ retry: false,
+ };
+
+ if (
+ taskInfo.type === TaskType.ARTICLE &&
+ userTaskInfo.accountType === AccountType.Xhs
+ ) {
+ // 对比文本内容
+ const { status: contentCheckStatus, extent } =
+ await this.taskUtilService.articleXhsContentCheck(
+ taskMaterialInfo.desc,
+ userTaskInfo.submissionUrl,
+ );
+
+ if (contentCheckStatus === 0) {
+ return {
+ status: 0,
+ message: '内容检测失败,请重试',
+ retry: true,
+ };
+ }
+
+ if (extent <= 0.8) {
+ return {
+ status: 1,
+ message: '内容相似度小于80%,请重新提交',
+ retry: false,
+ data: false,
+ };
+ }
+
+ // 进行奖励发放
+ const res = await this.verifyUserTaskApproved(userTaskInfo, {});
+ if (!res) {
+ return {
+ status: 0,
+ message: '自动审核或发放奖励失败,请重试',
+ retry: true,
+ };
+ }
+
+ return {
+ status: 1,
+ message: '成功',
+ retry: false,
+ data: true,
+ };
+ }
+ }
+
+ // 更新用户任务自动状态
+ async updateUserTaskAutoStatus(
+ userTaskId: string,
+ data: { status: 0 | 1; message: string },
+ ): Promise<boolean> {
+ const res = await this.userTaskModel.updateOne(
+ { _id: userTaskId },
+ {
+ $set: {
+ autoData: data,
+ },
+ },
+ );
+
+ return res.modifiedCount > 0;
+ }
+}
diff --git a/server/src/modules/task/bullTaskAudit.processor.ts b/server/src/modules/task/bullTaskAudit.processor.ts
new file mode 100644
index 00000000..2bb2bdbe
--- /dev/null
+++ b/server/src/modules/task/bullTaskAudit.processor.ts
@@ -0,0 +1,45 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-07-03 15:16:12
+ * @LastEditTime: 2025-02-10 17:18:50
+ * @LastEditors: nevin
+ * @Description: 任务自动审核队列
+ */
+import { Processor, WorkerHost } from '@nestjs/bullmq';
+import { Job } from 'bullmq';
+import { AdminUserTaskService } from './adminUserTask.service';
+
+@Processor('bull_aotu_task_audit')
+export class BullTaskAuditProcessor extends WorkerHost {
+ constructor(readonly adminUserTaskService: AdminUserTaskService) {
+ super();
+ }
+
+ async process(job: Job<{ userTaskId: string }>): Promise<any> {
+ console.log('----进入任务----bullTaskAudit: 自动审核任务开始执行----');
+
+ const userTaskInfo = await this.adminUserTaskService.getUserTaskInfoById(
+ job.data.userTaskId,
+ );
+ if (!userTaskInfo) return;
+
+ const { status, message, retry, data } =
+ await this.adminUserTaskService.autoAuditTask(job.data.userTaskId);
+
+ this.adminUserTaskService.updateUserTaskAutoStatus(job.data.userTaskId, {
+ status,
+ message,
+ });
+
+ if (retry) return job.retry();
+
+ // 根据审核状态确定是否通过
+ if (data) {
+ this.adminUserTaskService.verifyUserTaskApproved(userTaskInfo, {});
+ } else {
+ this.adminUserTaskService.verifyUserTaskRejected(userTaskInfo, {
+ verificationNote: `机器自动审核---${message}`,
+ });
+ }
+ }
+}
diff --git a/server/src/modules/task/dto/adminTask.dto.ts b/server/src/modules/task/dto/adminTask.dto.ts
new file mode 100644
index 00000000..42e4501b
--- /dev/null
+++ b/server/src/modules/task/dto/adminTask.dto.ts
@@ -0,0 +1,45 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-05-06 13:46:44
+ * @LastEditors: nevin
+ * @Description: 任务接受
+ */
+import { Expose } from 'class-transformer';
+import { IsEnum, IsOptional, IsString } from 'class-validator';
+import { TaskType } from 'src/db/schema/task.schema';
+
+export class ActionTaskMaterialDto {
+ @IsString()
+ @Expose()
+ taskId: string;
+
+ @IsString()
+ @IsOptional()
+ @Expose()
+ title?: string;
+
+ @IsEnum(TaskType)
+ @Expose()
+ type: TaskType;
+
+ @IsString()
+ @IsOptional()
+ @Expose()
+ coverUrl?: string;
+
+ @IsString()
+ @IsOptional()
+ @Expose()
+ temp?: string;
+
+ @IsString()
+ @IsOptional()
+ @Expose()
+ desc?: string;
+
+ // 图片对象列表
+ @IsOptional()
+ @Expose()
+ imageList?: any;
+}
diff --git a/server/src/modules/task/dto/applyTask.dto.ts b/server/src/modules/task/dto/applyTask.dto.ts
new file mode 100644
index 00000000..dcdb67cf
--- /dev/null
+++ b/server/src/modules/task/dto/applyTask.dto.ts
@@ -0,0 +1,28 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-05-06 13:46:44
+ * @LastEditors: nevin
+ * @Description: 任务接受
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { IsEnum, IsString } from 'class-validator';
+import { AccountType } from 'src/db/schema/account.schema';
+
+export class ApplyTaskDto {
+ @ApiProperty({ description: '账号' })
+ @IsString()
+ account: string;
+
+ @ApiProperty({ description: '用户ID' })
+ @IsString()
+ uid: string;
+
+ @ApiProperty({ description: '平台类型', enum: AccountType })
+ @IsEnum(AccountType)
+ accountType: AccountType;
+
+ @ApiProperty({ description: '任务素材ID', required: false })
+ @IsString()
+ taskMaterialId?: string;
+}
diff --git a/server/src/modules/task/dto/create-task.dto.ts b/server/src/modules/task/dto/create-task.dto.ts
new file mode 100644
index 00000000..86664eab
--- /dev/null
+++ b/server/src/modules/task/dto/create-task.dto.ts
@@ -0,0 +1,79 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-03-03 17:34:24
+ * @LastEditors: nevin
+ * @Description: 任务
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import {
+ IsArray,
+ IsDate,
+ IsEnum,
+ IsNumber,
+ IsObject,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import {
+ TaskArticle,
+ TaskInteraction,
+ TaskProduct,
+ TaskPromotion,
+ TaskType,
+ TaskVideo,
+} from '../../../db/schema/task.schema';
+import { AccountType } from 'src/db/schema/account.schema';
+
+export class CreateTaskDto {
+ @ApiProperty({ description: '任务标题' })
+ @IsString()
+ title: string;
+
+ @ApiProperty({ description: '任务描述' })
+ @IsString()
+ description: string;
+
+ @ApiProperty({ description: '任务类型', enum: TaskType })
+ @IsEnum(TaskType)
+ type: TaskType;
+
+ @ApiProperty({ description: '任务主体属性' })
+ @IsObject()
+ dataInfo:
+ | TaskVideo
+ | TaskPromotion
+ | TaskProduct
+ | TaskArticle
+ | TaskInteraction;
+
+ @ApiProperty({ description: '任务配图URL' })
+ @IsString()
+ @IsOptional()
+ imageUrl?: string;
+
+ @ApiProperty({ description: '附件地址列表' })
+ @IsArray()
+ fileList: string[];
+
+ @ApiProperty({ description: '是否需要挂购物车' })
+ @IsOptional()
+ requiresShoppingCart?: boolean;
+
+ @ApiProperty({ description: '收益' })
+ @IsNumber()
+ reward: number;
+
+ @ApiProperty({ description: '招募人数' })
+ @IsNumber()
+ maxRecruits: number;
+
+ @ApiProperty({ description: '任务截止时间' })
+ @IsDate()
+ deadline: Date;
+
+ @ApiProperty({ description: '支持的账号类型列表' })
+ @IsArray()
+ @IsEnum(AccountType, { each: true })
+ accountTypes: AccountType[];
+}
diff --git a/server/src/modules/task/dto/query-task.dto.ts b/server/src/modules/task/dto/query-task.dto.ts
new file mode 100644
index 00000000..9d7746ec
--- /dev/null
+++ b/server/src/modules/task/dto/query-task.dto.ts
@@ -0,0 +1,57 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-02-27 20:22:49
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { IsEnum, IsOptional, IsString } from 'class-validator';
+import { Type } from 'class-transformer';
+import { TaskStatus, TaskType } from '../../../db/schema/task.schema';
+import { PagerDto } from '../../../common/dto/pager.dto';
+import { UserTaskStatus } from 'src/db/schema/user-task.schema';
+
+export class QueryTaskDto extends PagerDto {
+ @ApiProperty({ description: '任务类型', enum: TaskType, required: false })
+ @IsEnum(TaskType)
+ @IsOptional()
+ type?: TaskType;
+
+ @ApiProperty({ description: '任务状态', enum: TaskStatus, required: false })
+ @IsEnum(TaskStatus)
+ @IsOptional()
+ status?: TaskStatus;
+
+ @ApiProperty({ description: '搜索关键词(标题)', required: false })
+ @IsString()
+ @IsOptional()
+ keyword?: string;
+
+ @ApiProperty({ description: '带货等级', required: false })
+ @IsString()
+ @IsOptional()
+ productLevel?: string;
+
+ @ApiProperty({ description: '是否需要挂购物车', required: false })
+ @Type(() => Boolean)
+ @IsOptional()
+ requiresShoppingCart?: boolean;
+}
+
+export class QueryMineTaskDto extends PagerDto {
+ @ApiProperty({ description: '任务类型', enum: TaskType, required: false })
+ @IsEnum(TaskType)
+ @IsOptional()
+ type?: TaskType;
+
+ @ApiProperty({ description: '搜索关键词(标题)', required: false })
+ @IsString()
+ @IsOptional()
+ keyword?: string;
+
+ @ApiProperty({ description: '状态', required: false })
+ @IsEnum(UserTaskStatus)
+ @IsOptional()
+ status?: UserTaskStatus;
+}
diff --git a/server/src/modules/task/dto/query-verification.dto.ts b/server/src/modules/task/dto/query-verification.dto.ts
new file mode 100644
index 00000000..5973e804
--- /dev/null
+++ b/server/src/modules/task/dto/query-verification.dto.ts
@@ -0,0 +1,15 @@
+import { ApiProperty } from '@nestjs/swagger';
+import { IsEnum, IsOptional } from 'class-validator';
+import { PagerDto } from '../../../common/dto/pager.dto';
+import { UserTaskStatus } from '../../../db/schema/user-task.schema';
+
+export class QueryVerificationDto extends PagerDto {
+ @ApiProperty({
+ description: '任务状态',
+ enum: UserTaskStatus,
+ required: false,
+ })
+ @IsEnum(UserTaskStatus)
+ @IsOptional()
+ status?: UserTaskStatus;
+}
diff --git a/server/src/modules/task/dto/submit-task.dto.ts b/server/src/modules/task/dto/submit-task.dto.ts
new file mode 100644
index 00000000..d29621cb
--- /dev/null
+++ b/server/src/modules/task/dto/submit-task.dto.ts
@@ -0,0 +1,20 @@
+import { ApiProperty } from '@nestjs/swagger';
+import { IsArray, IsOptional, IsString } from 'class-validator';
+
+export class SubmitTaskDto {
+ @ApiProperty({ description: '任务完成截图', type: [String], required: false })
+ @IsArray()
+ @IsString({ each: true })
+ @IsOptional()
+ screenshotUrls?: string[];
+
+ @ApiProperty({ description: '二维码扫描结果', required: false })
+ @IsString()
+ @IsOptional()
+ qrCodeScanResult?: string;
+
+ @ApiProperty({ description: '提交的URL', required: false })
+ @IsString()
+ @IsOptional()
+ submissionUrl?: string;
+}
diff --git a/server/src/modules/task/dto/task.dto.ts b/server/src/modules/task/dto/task.dto.ts
new file mode 100644
index 00000000..759baa85
--- /dev/null
+++ b/server/src/modules/task/dto/task.dto.ts
@@ -0,0 +1,31 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-03-03 19:28:44
+ * @LastEditors: nevin
+ * @Description: 更新
+ */
+import { ApiProperty, PartialType } from '@nestjs/swagger';
+import { CreateTaskDto } from './create-task.dto';
+import { IsEnum, IsString } from 'class-validator';
+import { TaskStatus } from 'src/db/schema/task.schema';
+
+export class UpdateTaskDto extends PartialType(CreateTaskDto) {}
+
+export class ActionTaskFileDto {
+ @ApiProperty({ description: '名称' })
+ @IsString()
+ name: string;
+
+ @ApiProperty({ description: '文件URL' })
+ @IsString()
+ url: string;
+}
+
+export class UpTaskStatusDto {
+ @IsString()
+ id: string;
+
+ @IsEnum(TaskStatus)
+ status: TaskStatus;
+}
diff --git a/server/src/modules/task/dto/userTask.dto.ts b/server/src/modules/task/dto/userTask.dto.ts
new file mode 100644
index 00000000..5eb6ad22
--- /dev/null
+++ b/server/src/modules/task/dto/userTask.dto.ts
@@ -0,0 +1,26 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-02-27 20:22:49
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { IsEnum, IsOptional, IsString } from 'class-validator';
+import { TaskStatus } from '../../../db/schema/task.schema';
+import { PagerDto } from '../../../common/dto/pager.dto';
+
+export class AdminQueryUserTaskDto extends PagerDto {
+ @ApiProperty({ description: '任务状态', enum: TaskStatus, required: false })
+ @IsEnum(TaskStatus)
+ @IsOptional()
+ status?: TaskStatus;
+
+ @ApiProperty({ description: '搜索关键词(标题)', required: false })
+ @IsString()
+ @IsOptional()
+ keyword?: string;
+
+ @ApiProperty({ type: [String] })
+ time?: [string, string];
+}
diff --git a/server/src/modules/task/dto/verify-task.dto.ts b/server/src/modules/task/dto/verify-task.dto.ts
new file mode 100644
index 00000000..5bf3df91
--- /dev/null
+++ b/server/src/modules/task/dto/verify-task.dto.ts
@@ -0,0 +1,10 @@
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsString } from 'class-validator';
+
+export class RejectedTaskDto {
+ @ApiProperty({ description: '验证备注', required: false })
+ @IsString()
+ @Expose()
+ verificationNote: string;
+}
diff --git a/server/src/modules/task/task.controller.ts b/server/src/modules/task/task.controller.ts
new file mode 100644
index 00000000..d8646001
--- /dev/null
+++ b/server/src/modules/task/task.controller.ts
@@ -0,0 +1,173 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-05-06 13:47:50
+ * @LastEditors: nevin
+ * @Description:
+ */
+import {
+ Body,
+ Controller,
+ Get,
+ NotFoundException,
+ Param,
+ Post,
+ Query,
+} from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { GetToken, Public } from '../../auth/auth.guard';
+import { TokenInfo } from '../../auth/interfaces/auth.interfaces';
+import { ApiResult } from '../../common/decorators/api-result.decorator';
+import { Task } from '../../db/schema/task.schema';
+import { QueryMineTaskDto, QueryTaskDto } from './dto/query-task.dto';
+import { TaskService } from './task.service';
+import { UserTaskService } from './user-task.service';
+import { SubmitTaskDto } from './dto/submit-task.dto';
+import { UserTaskStatus } from 'src/db/schema/user-task.schema';
+import { FinanceService } from '../finance/finance.service';
+import {
+ UserWalletRecordStatus,
+ UserWalletRecordType,
+} from 'src/db/schema/userWalletRecord.shema';
+import { AppHttpException } from 'src/filters/http-exception.filter';
+import { ErrHttpBack } from 'src/filters/http-exception.back-code';
+import { ApplyTaskDto } from './dto/applyTask.dto';
+import { TaskMaterial } from 'src/db/schema/taskMaterial.schema';
+import { Queue } from 'bullmq';
+import { InjectQueue } from '@nestjs/bullmq';
+@ApiTags('tasks - 任务')
+@Controller('tasks')
+export class TaskController {
+ constructor(
+ private readonly taskService: TaskService,
+ private readonly userTaskService: UserTaskService,
+ private readonly financeService: FinanceService,
+ @InjectQueue('bull_aotu_task_audit') private bullTaskAuditQueue: Queue,
+ ) {}
+
+ @Get('list')
+ @ApiOperation({ summary: '获取任务列表' })
+ @ApiResult({ type: [Task], isPage: true })
+ async findAll(@GetToken() token: TokenInfo, @Query() query: QueryTaskDto) {
+ return await this.taskService.findAll(token.id, query);
+ }
+
+ @Get('mine/list')
+ @ApiOperation({ summary: '获取我的任务列表' })
+ @ApiResult({ type: [Task], isPage: true })
+ async findMineList(
+ @GetToken() token: TokenInfo,
+ @Query() query: QueryMineTaskDto,
+ ) {
+ return await this.userTaskService.getUserTasks(token.id, query);
+ }
+
+ @Public()
+ @Get('info/:id')
+ @ApiOperation({ summary: '获取任务详情' })
+ @ApiResult({ type: Task })
+ async findOne(@Param('id') id: string) {
+ return await this.taskService.findOne(id);
+ }
+
+ @ApiOperation({ summary: '申请任务: 保持一定时间' })
+ @ApiResult({ type: Boolean })
+ @Post('apply/:id')
+ async applyForTask(
+ @Param('id') id: string,
+ @GetToken() token: TokenInfo,
+ @Body() body: ApplyTaskDto,
+ ) {
+ const task = await this.taskService.findOne(id);
+ if (!task) throw new NotFoundException('任务不存在');
+
+ if (!!body.taskMaterialId) {
+ const taskMaterial = await this.taskService.getTaskMaterialById(
+ body.taskMaterialId,
+ );
+ if (!taskMaterial) throw new NotFoundException('任务素材不存在');
+ }
+
+ const res = await this.userTaskService.userApplyTask(token.id, task, body);
+
+ if (!!body.taskMaterialId)
+ this.taskService.upTaskMaterialUsedCount(body.taskMaterialId);
+
+ return res;
+ }
+
+ @ApiOperation({ summary: '提交任务 id是用户任务ID' })
+ @ApiResult({ type: Boolean })
+ @Post('submit/:id')
+ async submitTask(
+ @GetToken() token: TokenInfo,
+ @Param('id') id: string,
+ @Body() data: SubmitTaskDto,
+ ) {
+ const userTask = await this.userTaskService.getUserTaskInfoById(id);
+ if (!userTask || userTask.userId.toString() !== token.id)
+ throw new AppHttpException(ErrHttpBack.user_task_no_had);
+
+ const res = await this.userTaskService.submitTask(userTask, data);
+
+ if (res.status === UserTaskStatus.PENDING) {
+ this.bullTaskAuditQueue.add(
+ 'start',
+ {
+ userTaskId: id,
+ },
+ {
+ attempts: 5, // 这个作业特定的重试次数
+ backoff: {
+ type: 'fixed', // 固定间隔重试
+ delay: 1000 * 30, // 每次重试间隔5秒
+ },
+ },
+ );
+ }
+
+ return res;
+ }
+
+ // 任务提现(创建提现数据)
+ @ApiOperation({ summary: '用户任务提现' })
+ @ApiResult({ type: Boolean })
+ @Post('withdraw/:id')
+ async withdrawCashUserTask(
+ @GetToken() token: TokenInfo,
+ @Param('id') id: string,
+ @Body() data: { accountId: string },
+ ) {
+ const userTask = await this.userTaskService.getUserTaskInfoById(id);
+ if (!userTask || userTask.userId.toString() !== token.id)
+ throw new NotFoundException('任务不存在');
+ if (userTask.status !== UserTaskStatus.APPROVED)
+ throw new NotFoundException('任务状态不正确');
+ const account = await this.financeService.getUserWalletAccountById(
+ data.accountId,
+ );
+ if (!account) throw new NotFoundException('钱包账户不存在');
+
+ return await this.financeService.createUserWalletRecord(token.id, account, {
+ dataId: userTask.id,
+ type: UserWalletRecordType.WITHDRAW,
+ balance: userTask.reward, // 将 number 转换为 Decimal128
+ des: '任务提现',
+ status: UserWalletRecordStatus.WAIT,
+ });
+ }
+
+ @ApiOperation({ summary: '统计合计进行中的任务的金额总数' })
+ @Get('reward/amount')
+ @ApiResult({ type: Number })
+ async getTotalAmountOfDoingTasks(@GetToken() token: TokenInfo) {
+ return await this.taskService.getTotalAmountOfDoingTasks(token.id);
+ }
+
+ @ApiOperation({ summary: '获取任务的最优素材' })
+ @Get('material/frist/:id')
+ @ApiResult({ type: TaskMaterial })
+ async getFristTaskMaterial(@Param('id') id: string) {
+ return await this.taskService.getFristTaskMaterial(id);
+ }
+}
diff --git a/server/src/modules/task/task.module.ts b/server/src/modules/task/task.module.ts
new file mode 100644
index 00000000..a878ef36
--- /dev/null
+++ b/server/src/modules/task/task.module.ts
@@ -0,0 +1,51 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-01 19:27:26
+ * @LastEditTime: 2025-03-02 20:46:08
+ * @LastEditors: nevin
+ * @Description: 任务模块
+ */
+import { Module } from '@nestjs/common';
+import { MongooseModule } from '@nestjs/mongoose';
+import { Task, TaskSchema } from '../../db/schema/task.schema';
+import { UserTask, UserTaskSchema } from '../../db/schema/user-task.schema';
+import { TaskController } from './task.controller';
+import { AdminTaskController } from './adminTask.controller';
+import { TaskService } from './task.service';
+import { UserTaskService } from './user-task.service';
+import { FinanceModule } from '../finance/finance.module';
+import { AdminTaskService } from './adminTask.service';
+import { AdminUserTaskService } from './adminUserTask.service';
+import { AdminUserTaskController } from './adminUserTask.controller';
+import {
+ TaskMaterial,
+ TaskMaterialSchema,
+} from 'src/db/schema/taskMaterial.schema';
+import { BullModule } from '@nestjs/bullmq';
+import { BullTaskAuditProcessor } from './bullTaskAudit.processor';
+import { TaskUtilService } from './util.service';
+
+@Module({
+ imports: [
+ MongooseModule.forFeature([
+ { name: Task.name, schema: TaskSchema },
+ { name: UserTask.name, schema: UserTaskSchema },
+ { name: TaskMaterial.name, schema: TaskMaterialSchema },
+ ]),
+ FinanceModule,
+ BullModule.registerQueue({
+ name: 'bull_aotu_task_audit', // 队列名称-任务自动审核
+ }),
+ ],
+ controllers: [TaskController, AdminTaskController, AdminUserTaskController],
+ providers: [
+ TaskService,
+ UserTaskService,
+ AdminTaskService,
+ AdminUserTaskService,
+ BullTaskAuditProcessor,
+ TaskUtilService
+ ],
+ exports: [TaskService, UserTaskService],
+})
+export class TaskModule {}
diff --git a/server/src/modules/task/task.service.ts b/server/src/modules/task/task.service.ts
new file mode 100644
index 00000000..fdd843d3
--- /dev/null
+++ b/server/src/modules/task/task.service.ts
@@ -0,0 +1,167 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-02-27 22:43:33
+ * @LastEditors: nevin
+ * @Description: 用户端任务
+ */
+import { Injectable, NotFoundException } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, Types } from 'mongoose';
+import { Task, TaskStatus } from '../../db/schema/task.schema';
+import { UserTask, UserTaskStatus } from '../../db/schema/user-task.schema';
+import { QueryTaskDto } from './dto/query-task.dto';
+import { createPaginationObject } from 'src/common/paginate/create-pagination';
+import { ObjectId } from 'mongodb';
+import { TaskMaterial } from 'src/db/schema/taskMaterial.schema';
+
+@Injectable()
+export class TaskService {
+ constructor(
+ @InjectModel(Task.name) private taskModel: Model<Task>,
+ @InjectModel(UserTask.name) private userTaskModel: Model<UserTask>,
+ @InjectModel(TaskMaterial.name)
+ private taskMaterialModel: Model<TaskMaterial>,
+ ) {}
+
+ /**
+ * 获取任务列表
+ * @param query
+ * @returns
+ */
+ async findAll(userId: string, query: QueryTaskDto) {
+ const {
+ page = 1,
+ pageSize = 10,
+ type,
+ keyword,
+ productLevel,
+ requiresShoppingCart,
+ } = query;
+ const filter: any = {
+ status: TaskStatus.ACTIVE,
+ };
+
+ if (type) filter.type = type;
+ if (productLevel) filter.productLevel = productLevel;
+ if (requiresShoppingCart !== undefined)
+ filter.requiresShoppingCart = requiresShoppingCart;
+ if (keyword) filter.title = new RegExp(keyword, 'i');
+
+ const listP = this.taskModel.aggregate([
+ {
+ $match: {
+ ...filter,
+ },
+ },
+ {
+ $lookup: {
+ from: 'user_task', // 连接 user_task 表
+ let: { task_id: '$_id' }, // 定义变量 task_id 为当前任务的 _id
+ pipeline: [
+ {
+ $match: {
+ $expr: {
+ $and: [
+ { $eq: ['$taskId', '$$task_id'] }, // 匹配 taskId
+ { $eq: ['$userId', new Types.ObjectId(userId)] }, // 匹配 userId
+ ],
+ },
+ },
+ },
+ ],
+ as: 'accepted_info', // 将匹配的结果存放到 user_tasks 字段中
+ },
+ },
+ {
+ $addFields: {
+ isAccepted: {
+ $cond: {
+ if: { $gt: [{ $size: '$accepted_info' }, 0] }, // 如果 accepted_info 数组不为空
+ then: true, // 则 is_accepted 为 true
+ else: false, // 否则为 false
+ },
+ },
+ },
+ },
+ {
+ $project: {
+ accepted_info: 0, // 移除 accepted_info 字段(可选)
+ },
+ },
+ { $skip: (page - 1) * pageSize }, // 跳过前面的记录
+ { $limit: pageSize }, // 限制每页的记录数量
+ ]);
+
+ const totaP = this.taskModel.countDocuments(filter);
+ const [items, total] = await Promise.all([listP, totaP]);
+
+ return createPaginationObject<Task>({
+ items,
+ totalItems: total,
+ currentPage: page,
+ limit: pageSize,
+ });
+ }
+
+ async findOne(id: string): Promise<Task> {
+ const task = await this.taskModel.findById(id).exec();
+ if (!task) {
+ throw new NotFoundException('Task not found');
+ }
+ return task;
+ }
+
+ // 统计合计进行中的任务的金额总数
+ async getTotalAmountOfDoingTasks(userId: string): Promise<number> {
+ const tasks = await this.userTaskModel.find({
+ status: UserTaskStatus.APPROVED,
+ userId: new ObjectId(userId),
+ });
+
+ let totalAmount = 0;
+
+ for (const task of tasks) totalAmount += task.reward;
+ return totalAmount;
+ }
+
+ // 根据ID获取素材
+ async getTaskMaterialById(taskMaterialId: string): Promise<TaskMaterial> {
+ const materials = await this.taskMaterialModel.findById(taskMaterialId);
+ return materials;
+ }
+
+ /**
+ * 获取最优素材
+ * @param taskId
+ * @returns
+ */
+ async getFristTaskMaterial(taskId: string) {
+ const res = await this.taskMaterialModel
+ .findOne({
+ taskId: new ObjectId(taskId),
+ })
+ .sort({ usedCount: 1 });
+
+ return res;
+ }
+
+ // 素材使用次数+1
+ async upTaskMaterialUsedCount(taskMaterialId: string): Promise<boolean> {
+ try {
+ const res = await this.taskMaterialModel.updateOne(
+ { _id: new ObjectId(taskMaterialId) },
+ { $inc: { usedCount: 1 } },
+ );
+
+ return res.modifiedCount > 0;
+ } catch (error) {
+ console.log(
+ '----------- upTaskMaterialUsedCount error -----------',
+ error,
+ );
+
+ return false;
+ }
+ }
+}
diff --git a/server/src/modules/task/user-task.service.ts b/server/src/modules/task/user-task.service.ts
new file mode 100644
index 00000000..112cf8e8
--- /dev/null
+++ b/server/src/modules/task/user-task.service.ts
@@ -0,0 +1,220 @@
+import { BadRequestException, Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model, Types } from 'mongoose';
+import { paginateModel } from '../../common/paginate/create-pagination';
+import { Task } from '../../db/schema/task.schema';
+import { UserTask, UserTaskStatus } from '../../db/schema/user-task.schema';
+import { QueryVerificationDto } from './dto/query-verification.dto';
+import { QueryMineTaskDto } from './dto/query-task.dto';
+import { SubmitTaskDto } from './dto/submit-task.dto';
+import { ApplyTaskDto } from './dto/applyTask.dto';
+
+@Injectable()
+export class UserTaskService {
+ constructor(
+ @InjectModel(UserTask.name) private userTaskModel: Model<UserTask>,
+ @InjectModel(Task.name) private taskModel: Model<Task>,
+ ) {}
+
+ async getUserTaskInfoById(id: string): Promise<UserTask> {
+ const task = await this.userTaskModel.findById(id).exec();
+ return task;
+ }
+
+ async getUserTaskInfoByTaskIdOfUser(
+ taskId: string,
+ userId: string,
+ ): Promise<UserTask> {
+ const res = await this.userTaskModel
+ .findOne({
+ userId: new Types.ObjectId(userId),
+ taskId: new Types.ObjectId(taskId),
+ })
+ .exec();
+ return res;
+ }
+
+ /**
+ * 用户接受任务
+ * @param userId
+ * @param taskId
+ * @returns
+ */
+ async userApplyTask(
+ userId: string,
+ task: Task,
+ account: ApplyTaskDto,
+ ): Promise<{
+ code: number;
+ msg: string;
+ data: UserTask;
+ }> {
+ const res = {
+ code: 0,
+ msg: '任务申请中',
+ data: null,
+ };
+
+ // 最大人数
+ if (task.currentRecruits >= task.maxRecruits) {
+ res.msg = '该任务已超过最大人数';
+ return res;
+ }
+
+ const session = await this.userTaskModel.db.startSession();
+ session.startTransaction();
+
+ try {
+ const oldUserTask = await this.userTaskModel
+ .findOne({
+ userId: new Types.ObjectId(userId),
+ taskId: new Types.ObjectId(task.id),
+ ...account,
+ })
+ .session(session);
+
+ if (!!oldUserTask) {
+ res.msg = '你已经用该账号接受过该任务';
+ return res;
+ }
+
+ // 创建
+ const userTask = new this.userTaskModel({
+ userId: new Types.ObjectId(userId),
+ taskId: new Types.ObjectId(task.id),
+ status: UserTaskStatus.DODING,
+ isFirstTimeSubmission: true,
+ reward: task.reward,
+ ...account,
+ });
+
+ // Increment current recruits and applicant count
+ await this.taskModel
+ .findByIdAndUpdate(task.id, {
+ $inc: {
+ currentRecruits: 1,
+ applicantCount: 1,
+ },
+ })
+ .session(session);
+
+ const newData = await userTask.save({ session });
+
+ await session.commitTransaction();
+ session.endSession();
+
+ return {
+ code: 0,
+ msg: '任务申请完成',
+ data: newData,
+ };
+ } catch (error) {
+ await session.abortTransaction();
+ session.endSession();
+ throw error;
+ }
+ }
+
+ /**
+ * 提交任务
+ * @param userTask
+ * @param data
+ * @returns
+ */
+ async submitTask(userTask: UserTask, data: SubmitTaskDto): Promise<UserTask> {
+ const userTaskD = await this.userTaskModel.findById(userTask.id);
+
+ // 只有拒绝和进行中的才能提交
+ if (
+ ![UserTaskStatus.REJECTED, UserTaskStatus.DODING].includes(
+ userTask.status,
+ )
+ ) {
+ throw new BadRequestException('Cannot submit task in current status');
+ }
+
+ userTaskD.submissionUrl = data.submissionUrl;
+ userTaskD.screenshotUrls = data.screenshotUrls;
+ userTaskD.qrCodeScanResult = data.qrCodeScanResult;
+ userTaskD.submissionTime = new Date();
+ userTaskD.status = UserTaskStatus.PENDING;
+
+ // 保存
+ return userTaskD.save();
+ }
+
+ /**
+ * 获取用户的任务列表
+ * @param userId
+ * @param query
+ * @returns
+ */
+ async getUserTasks(userId: string, query: QueryMineTaskDto) {
+ const { page, pageSize, status } = query;
+ const filter: any = { userId: new Types.ObjectId(userId) };
+
+ if (status) filter.status = status;
+
+ return paginateModel(
+ this.userTaskModel,
+ {
+ page,
+ pageSize,
+ },
+ filter,
+ 'taskId',
+ { _id: -1 },
+ );
+ }
+
+ /**
+ * 获取任务列表进行审核
+ * @param query
+ * @returns
+ */
+ async getTasksForVerification(query: QueryVerificationDto) {
+ const { page = 1, pageSize = 10, status } = query;
+
+ const filter: any = {};
+ if (status) filter.status = status;
+
+ return paginateModel(
+ this.userTaskModel,
+ {
+ page,
+ pageSize,
+ },
+ filter,
+ ['taskId', 'userId'],
+ { _id: -1 },
+ );
+ }
+
+ // TODO: 定时任务,每天凌晨1点清理过期的用户任务,并补充回任务的剩余量
+ // @Cron('0 1 * * *')
+ async clearExpiredUserTasks() {
+ const now = new Date();
+ const oneDayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
+
+ const expiredUserTasks = await this.userTaskModel.find({
+ status: UserTaskStatus.DODING,
+ createdAt: { $lt: oneDayAgo },
+ });
+
+ for (const userTask of expiredUserTasks) {
+ if (
+ userTask.createTime.getTime() + userTask.keepTime * 1000 >
+ now.getTime()
+ )
+ continue;
+
+ const task = await this.taskModel.findById(userTask.taskId);
+ if (task) {
+ task.currentRecruits += 1;
+ await task.save();
+ }
+ // 删除过期的用户任务
+ await this.userTaskModel.findByIdAndDelete(userTask._id);
+ }
+ }
+}
diff --git a/server/src/modules/task/util.service.ts b/server/src/modules/task/util.service.ts
new file mode 100644
index 00000000..47b0fb51
--- /dev/null
+++ b/server/src/modules/task/util.service.ts
@@ -0,0 +1,80 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-18 22:32:02
+ * @LastEditTime: 2025-02-27 22:43:33
+ * @LastEditors: nevin
+ * @Description: 任务模块的工具服务
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { Task } from '../../db/schema/task.schema';
+import { UserTask } from '../../db/schema/user-task.schema';
+import { TaskMaterial } from 'src/db/schema/taskMaterial.schema';
+import axios from 'axios';
+import * as natural from 'natural';
+import { URL } from 'url';
+
+@Injectable()
+export class TaskUtilService {
+ constructor(
+ @InjectModel(Task.name) private taskModel: Model<Task>,
+ @InjectModel(UserTask.name) private userTaskModel: Model<UserTask>,
+ @InjectModel(TaskMaterial.name)
+ private taskMaterialModel: Model<TaskMaterial>,
+ ) {}
+
+ /**
+ * 小红书内容相似度检测
+ * @param content 内容
+ * @param articleUrl 文章链接
+ * @returns
+ */
+ async articleXhsContentCheck(
+ content: string,
+ articleUrl: string,
+ ): Promise<{
+ status: 1 | 0;
+ extent: number;
+ }> {
+ try {
+ // 解析URL
+ // https://www.xiaohongshu.com/explore/68063228000000001202f814?xsec_token=AB1nbuHhtoNuSMgYHIwZMaZqY1eo-IsGJkdrW04BZHKZQ=&xsec_source=pc_feed
+
+ const inUrl = new URL(articleUrl);
+ const xsecToken = inUrl.searchParams.get('xsec_token');
+ const noteId = inUrl.pathname.split('/').pop();
+
+ const body = {
+ note_id: noteId,
+ xsec_token: xsecToken,
+ };
+
+ const response = await axios.post<{
+ code: number; // 200
+ msg: string;
+ data: {
+ xsec_token: string;
+ title: string;
+ desc: string;
+ };
+ }>(`https://platapi.yikart.cn/api/xhs/note_detail_v2`, body);
+ let { desc } = response.data.data;
+
+ // desc 根据"[话题]"分割取出第一个
+ const descArr = desc.split('[话题]');
+ if (descArr.length > 1) desc = descArr[0];
+ const res: number = natural.JaroWinklerDistance(content, desc);
+ return {
+ status: 1,
+ extent: res,
+ };
+ } catch (error) {
+ console.log('------- 小红书内容相似度检测失败 -------', error);
+ return {
+ status: 0,
+ extent: 0,
+ };
+ }
+ }
+}
diff --git a/server/src/modules/tools/ai.controller.ts b/server/src/modules/tools/ai.controller.ts
new file mode 100644
index 00000000..d57b1e63
--- /dev/null
+++ b/server/src/modules/tools/ai.controller.ts
@@ -0,0 +1,154 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2024-12-23 12:45:22
+ * @LastEditors: nevin
+ * @Description: AI工具
+ */
+import { Body, Controller, Post, Sse } from '@nestjs/common';
+import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import {
+ AiArticleHtmlDto,
+ AiArticleHtmlTestDto,
+ ReviewAi,
+ ReviewAiRecover,
+ ReviewImgAi,
+ VideoAiDesDto,
+} from './dto/ai.dto';
+import { AiToolsService } from './ai.service';
+import { Public } from 'src/auth/auth.guard';
+@ApiTags('AI工具')
+@Public()
+@Controller('tools/ai')
+export class AiToolsController {
+ constructor(private readonly aiToolsService: AiToolsService) {}
+
+ @ApiOperation({
+ summary: '视频AI标题',
+ description: '视频文件只能输入一个,大小限制为 150 MB,时长限制为 40s。',
+ })
+ @ApiResponse({
+ description: '视频AI标题',
+ type: String,
+ })
+ @Post('video/title')
+ async videoAiTitle(
+ // @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: VideoAiDesDto,
+ ) {
+ const res = await this.aiToolsService.videoAiTitle(body.url);
+ return res;
+ }
+
+ @ApiOperation({
+ summary: '智能评论',
+ description: '对作品进行智能评论',
+ })
+ @ApiResponse({
+ description: '评论',
+ type: String,
+ })
+ @Post('review')
+ async reviewAi(
+ // @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: ReviewAi,
+ ) {
+ const res = await this.aiToolsService.reviewAi(
+ body.title,
+ body.desc,
+ body.max,
+ );
+ return res;
+ }
+
+ @ApiOperation({
+ summary: '智能评论',
+ description: '对作品封面图进行智能评论',
+ })
+ @ApiResponse({
+ description: '评论',
+ type: String,
+ })
+ @Post('reviewImg')
+ async reviewImgAi(
+ // @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: ReviewImgAi,
+ ) {
+ const res = await this.aiToolsService.reviewImgByAi(
+ body.imgUrl,
+ body.title,
+ body.desc,
+ body.max,
+ );
+ return res;
+ }
+
+ @ApiOperation({
+ summary: '智能评论回复',
+ description: '对作品进行智能评论回复',
+ })
+ @ApiResponse({
+ description: '评论',
+ type: String,
+ })
+ @Post('recover/review')
+ async reviewAiRecover(
+ // @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: ReviewAiRecover,
+ ) {
+ const res = await this.aiToolsService.reviewAiRecover(
+ body.content,
+ body.title,
+ body.desc,
+ body.max,
+ );
+ return res;
+ }
+
+ @ApiOperation({
+ summary: '生成AI的html图文',
+ description: '生成AI的html图文',
+ })
+ @ApiResponse({
+ description: '生成AI的html图文',
+ type: String,
+ })
+ @Post('article/html')
+ async aiArticleHtml(
+ // @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: AiArticleHtmlDto,
+ ) {
+ const res = await this.aiToolsService.aiArticleHtml(body.content);
+ return res;
+ }
+
+ @ApiOperation({
+ summary: '生成AI的html图文',
+ description: '生成AI的html图文',
+ })
+ @ApiResponse({
+ description: '生成AI的html图文',
+ type: String,
+ })
+ @Public()
+ @Post('article/html2')
+ async aiArticleHtml2(
+ // @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: AiArticleHtmlTestDto,
+ ) {
+ const res = await this.aiToolsService.aiArticleHtml2(
+ body.model,
+ body.content,
+ body.content2,
+ );
+ return res;
+ }
+
+ @Public()
+ @Post('article/html/sse')
+ @Sse('article/html/sse')
+ aiArticleHtmlSse(@Body(new ParamsValidationPipe()) body: AiArticleHtmlDto) {
+ return this.aiToolsService.aiArticleHtmlSse(body.content);
+ }
+}
diff --git a/server/src/modules/tools/ai.service.ts b/server/src/modules/tools/ai.service.ts
new file mode 100644
index 00000000..96a19795
--- /dev/null
+++ b/server/src/modules/tools/ai.service.ts
@@ -0,0 +1,602 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2024-09-05 15:19:25
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import axios from 'axios';
+import OpenAI from 'openai';
+import { Observable } from 'rxjs';
+import { RedisService } from 'src/lib/redis/redis.service';
+import { v4 as uuidv4 } from 'uuid';
+
+export enum FireflycardTempTypes {
+ A = 'tempA', // 默认
+ B = 'tempB', // 书摘
+ C = 'tempC', // 透明
+ Jin = 'tempJin', // 金句
+ Memo = 'tempMemo', // 备忘录
+ Easy = 'tempEasy', // 便当
+ BlackSun = 'tempBlackSun', // 黑日
+ E = 'tempE', // 框界
+ Write = 'tempWrite', // 手写
+ Code = 'code', // 代码
+ D = 'tempD', // 图片(暂时不用)
+}
+@Injectable()
+export class AiToolsService {
+ openai: OpenAI;
+
+ constructor(private readonly redisService: RedisService) {
+ this.openai = new OpenAI({
+ apiKey: process.env.QWEN_KEY,
+ baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
+ });
+ }
+
+ /**
+ * 视频智能标题
+ * @param url
+ * @param min
+ * @param max
+ * @returns
+ */
+ async videoAiTitle(url: string, min?: 5, max?: 50) {
+ const completion = await this.openai.chat.completions.create({
+ model: 'qwen-omni-turbo', //模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
+ stream: true,
+ messages: [
+ {
+ role: 'system',
+ content: [
+ {
+ type: 'text',
+ text: '你是一个短视频创作者,请帮我作品进行智能标题设置,只需要返回标题',
+ },
+ ],
+ },
+ {
+ role: 'user',
+ content: [
+ {
+ type: 'video_url',
+ video_url: {
+ url: url,
+ },
+ },
+ {
+ type: 'text',
+ text: `给视频设置一个标题,长度为${min}到${max}个字. 只需要返回该标题`,
+ },
+ ] as any,
+ },
+ ],
+ stream_options: {
+ include_usage: true,
+ },
+ modalities: ['text'],
+ });
+ let res = '';
+
+ for await (const chunk of completion) {
+ if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
+ const content = chunk.choices[0].delta.content;
+ if (content === null) return res;
+ res += content;
+ } else {
+ console.log(chunk.usage);
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * 智能评论图片
+ * @param imgUrl
+ * @param title
+ * @param desc
+ * @param max
+ * @returns
+ */
+ async reviewImgByAi(
+ imgUrl: string,
+ title: string = '无',
+ desc: string = '无',
+ max = 50,
+ ): Promise<string> {
+ const completion = await this.openai.chat.completions.create({
+ stream: true,
+ model: 'qwen-omni-turbo',
+ messages: [
+ {
+ role: 'system',
+ content: `你是我的好友,请对我发的短视频的作品或者朋友圈短视频作品进行评论,我会提供作品的封面图. 请用中文回复,并且回复内容不超过${max}字.只需要返回评论内容.`,
+ },
+ {
+ role: 'user',
+ content: [
+ {
+ type: 'image_url',
+ image_url: {
+ url: imgUrl,
+ },
+ },
+ {
+ type: 'text',
+ text: `作品标题: ${title}, 作品描述: ${desc}`,
+ },
+ ],
+ },
+ ],
+ stream_options: {
+ include_usage: true,
+ },
+ modalities: ['text'],
+ });
+
+ let res = '';
+
+ for await (const chunk of completion) {
+ if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
+ console.log(chunk.choices[0].delta);
+ const content = chunk.choices[0].delta.content;
+ if (content === null) return res;
+ res += content;
+ } else {
+ console.log(chunk.usage);
+ }
+ }
+
+ return res;
+ }
+
+ // 智能评论
+ async reviewAi(
+ title: string,
+ desc: string = '无',
+ max = 50,
+ ): Promise<string> {
+ const completion = await this.openai.chat.completions.create({
+ stream: true,
+ model: 'qwen-omni-turbo',
+ messages: [
+ {
+ role: 'system',
+ content: `你是我的好友,请对我发的短视频作品或者朋友圈作品进行评论. 请用中文回复,并且回复内容不超过${max}字.只需要返回评论内容.`,
+ },
+ {
+ role: 'user',
+ content: `作品标题: ${title}, 作品描述: ${desc}`,
+ },
+ ],
+ stream_options: {
+ include_usage: true,
+ },
+ modalities: ['text'],
+ });
+
+ let res = '';
+
+ for await (const chunk of completion) {
+ if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
+ console.log(chunk.choices[0].delta);
+ const content = chunk.choices[0].delta.content;
+ if (content === null) return res;
+ res += content;
+ } else {
+ console.log(chunk.usage);
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * 智能回复评论
+ * @param content
+ * @param title
+ * @param desc
+ * @param max
+ */
+ async reviewAiRecover(
+ content: string,
+ title: string = '无',
+ desc: string = '无',
+ max = 50,
+ ): Promise<string> {
+ const completion = await this.openai.chat.completions.create({
+ stream: true,
+ model: 'qwen-omni-turbo',
+ messages: [
+ {
+ role: 'system',
+ content: `你是一个风趣幽默又有分寸的文字创作者的助手,请帮我对别人对我作品的评论进行回复. 请用中文回复,并且回复内容不超过${max}字.只需要返回你的回复内容.`,
+ },
+ {
+ role: 'user',
+ content: `作品标题: ${title}, 作品描述: ${desc}, 评论内容: ${content}`,
+ },
+ ],
+ stream_options: {
+ include_usage: true,
+ },
+ modalities: ['text'],
+ });
+
+ let res = '';
+
+ for await (const chunk of completion) {
+ if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
+ console.log(chunk.choices[0].delta);
+ const content = chunk.choices[0].delta.content;
+ if (content === null) return res;
+ res += content;
+ } else {
+ console.log(chunk.usage);
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * 生成AI的html图文
+ * @param content
+ */
+ async aiArticleHtml(content: string): Promise<string> {
+ const completion = await this.openai.chat.completions.create({
+ stream: true,
+ model: 'deepseek-v3',
+ messages: [
+ {
+ role: 'system',
+ content: `你是一个web前端开发者,根据我发的内容进行web页面开发.注意,只需要返回代码`,
+ },
+ {
+ role: 'user',
+ content,
+ },
+ ],
+ stream_options: {
+ include_usage: true,
+ },
+ modalities: ['text'],
+ });
+
+ let res = '';
+
+ for await (const chunk of completion) {
+ if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
+ console.log(chunk.choices[0].delta);
+ const content = chunk.choices[0].delta.content;
+ if (content === null) return res;
+ res += content;
+ } else {
+ console.log(chunk.usage);
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * 生成AI的html图文-测试
+ * @param content
+ */
+ async aiArticleHtml2(
+ model: string,
+ content: string,
+ content2: string,
+ ): Promise<string> {
+ const completion = await this.openai.chat.completions.create({
+ stream: true,
+ model,
+ messages: [
+ {
+ role: 'system',
+ content: content2,
+ },
+ {
+ role: 'user',
+ content,
+ },
+ ],
+ stream_options: {
+ include_usage: true,
+ },
+ modalities: ['text'],
+ });
+
+ let res = '';
+
+ for await (const chunk of completion) {
+ if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
+ console.log(chunk.choices[0].delta);
+ const content = chunk.choices[0].delta.content;
+ if (content === null) return res;
+ res += content;
+ } else {
+ console.log(chunk.usage);
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * 获取AI的markdown
+ * @param content
+ */
+ async aiMarkdown(data: { content: string; prompt: string }): Promise<string> {
+ const taskId = uuidv4().replace(/-/g, '');
+ this.openai.chat.completions
+ .create({
+ stream: true,
+ model: 'deepseek-v3',
+ messages: [
+ {
+ role: 'system',
+ content: `将以下内容美化成Markdown格式,${data.prompt},只需要美化样式,内容不改变,只返回markdown格式,不返回其他内容`,
+ },
+ {
+ role: 'user',
+ content: data.content,
+ },
+ ],
+ stream_options: {
+ include_usage: true,
+ },
+ modalities: ['text'],
+ })
+ .then(async (completion) => {
+ let text = '';
+
+ for await (const chunk of completion) {
+ if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
+ console.log(chunk.choices[0].delta);
+ const content = chunk.choices[0].delta.content;
+ if (content !== null) text += content;
+ } else {
+ console.log(chunk.usage);
+ }
+ }
+ this.redisService.setKey(`aiMarkdown:${taskId}`, text, 60 * 5);
+ });
+
+ return taskId;
+ }
+
+ // 获取aiMarkdown的结果
+ async getAiMarkdown(taskId: string) {
+ try {
+ const text = await this.redisService.get(`aiMarkdown:${taskId}`, false);
+ return text;
+ } catch (error) {
+ console.log('------ getAiMarkdown error ----', error);
+
+ return '';
+ }
+ }
+
+ /**
+ * 生成AI的html图文
+ * @param content
+ */
+ async aiArticleHtmlSse(content: string): Promise<Observable<any>> {
+ const completion = await this.openai.chat.completions.create({
+ stream: true,
+ model: 'deepseek-v3',
+ messages: [
+ {
+ role: 'system',
+ content: `你是一个web前端开发者,根据我发的内容进行web页面开发.注意,只需要返回代码`,
+ },
+ {
+ role: 'user',
+ content,
+ },
+ ],
+ stream_options: {
+ include_usage: true,
+ },
+ modalities: ['text'],
+ });
+
+ return new Observable((observer) => {
+ (async () => {
+ for await (const chunk of completion) {
+ if (Array.isArray(chunk.choices) && chunk.choices.length > 0) {
+ console.log(chunk.choices[0].delta);
+ const content = chunk.choices[0].delta.content;
+ if (content === null) return observer.complete();
+ observer.next(content);
+ } else {
+ console.log(chunk.usage);
+ }
+ }
+ observer.complete();
+ })();
+ });
+ }
+
+ /**
+ * 获取流光卡片内容
+ * @param title
+ * @param content
+ * @returns Promise<string> 返回流光卡片图片编码
+ */
+ async fireflycard(
+ content: string,
+ temp: FireflycardTempTypes,
+ title: string = '',
+ ): Promise<Buffer> {
+ const url = `https://fireflycard-api.302ai.cn/api/saveImg`;
+
+ const body = {
+ form: {
+ title,
+ content,
+ pagination: '01',
+ },
+ style: {
+ align: 'left',
+ backgroundName: 'vertical-blue-color-29',
+ backShadow: '',
+ font: 'Alibaba-PuHuiTi-Regular',
+ width: 440,
+ ratio: '',
+ height: 0,
+ fontScale: 1,
+ padding: '30px',
+ borderRadius: '15px',
+ color: '#000000',
+ opacity: 1,
+ blur: 0,
+ backgroundAngle: '0deg',
+ lineHeights: {
+ content: '',
+ },
+ letterSpacings: {
+ content: '',
+ },
+ },
+ switchConfig: {
+ showIcon: false,
+ showDate: true,
+ showTitle: !!title,
+ showContent: true,
+ showAuthor: false,
+ showTextCount: false,
+ showQRCode: false,
+ showPageNum: false,
+ showWatermark: false,
+ },
+ temp,
+ language: 'zh',
+ };
+
+ const response = await axios.post(url, body, {
+ responseType: 'arraybuffer',
+ });
+ return response.data;
+ }
+
+ /**
+ * 即梦生成封面 任务提交
+ * @returns
+ */
+ async upJmImgTask(data: {
+ prompt: string;
+ width: number;
+ height: number;
+ sessionIds: string[];
+ }) {
+ const body = {
+ id: uuidv4(), // 标识符
+ // jimeng-3.0(默认) / jimeng-2.1 / jimeng-2.0-pro / jimeng-2.0 / jimeng-1.4 / jimeng-xl-pro
+ model: 'jimeng-3.0',
+ // 提示词,必填
+ prompt: data.prompt,
+ // 反向提示词,默认空字符串
+ negativePrompt: '',
+ // 图像宽度,默认1024
+ width: data.width,
+ // 图像高度,默认1024
+ height: data.height,
+ // 精细度,取值范围0-1,默认0.5
+ sample_strength: 0.5,
+ sessionId: data.sessionIds.join(','),
+ };
+
+ const result = await axios.post<{
+ code: number; // 0;
+ msg: string; // 'success';
+ data: {
+ _id: string; // 'f05f1c88b28ced57d42c29b799185079';
+ taskId: string; // 'f05f1c88b28ced57d42c29b799185079';
+ id: string; // '0130c639-3d80-4e77-8da3-64de1dba8d2e';
+ model: string; // 'jimeng-3.0';
+ prompt: string; // '美好花园';
+ negativePrompt: string; // '';
+ width: number; // 10;
+ height: number; // 10;
+ sample_strength: number; // 0.5;
+ status: string; // 'pending';
+ createTime: string; // '2025-05-14 22:31:32';
+ images: string[]; // [];
+ };
+ }>('https://att-contents.yikart.cn/api/third/v1/images/generations', body);
+
+ if (!!result.data.code) {
+ console.log('------- upJmImgTask error ---', result.data.msg);
+ return '';
+ }
+
+ return result.data.data.taskId;
+ }
+
+ /**
+ * 即梦生成图片任务获取
+ * @returns
+ */
+ async getJmImgTaskRes(taskId: string): Promise<{
+ taskId: string;
+ status: string;
+ imgList: string[];
+ }> {
+ const result = await axios.get<{
+ code: number; // 0;
+ msg: string; // 'success';
+ data: {
+ status: string;
+ taskId: string; // '997272a47ac2b46e2b7660ae905b33cb';
+ images: {
+ url: string;
+ }[];
+ };
+ }>('https://att-contents.yikart.cn/api/third/v1/images/query', {
+ params: { taskId },
+ });
+
+ console.log(
+ '----------- getJmImgTaskRes result.data ----------',
+ result.data,
+ );
+
+ if (!!result.data.code) {
+ console.log('------- getJmImgTaskRes error ---', result.data.msg);
+ return {
+ taskId: '',
+ status: 'error',
+ imgList: [],
+ };
+ }
+
+ if (result.data.data.status === 'failed') {
+ return {
+ taskId,
+ status: 'failed',
+ imgList: [],
+ };
+ }
+
+ if (result.data.data.status !== 'success') {
+ return {
+ taskId,
+ status: result.data.data.status,
+ imgList: [],
+ };
+ }
+
+ return {
+ taskId,
+ status: 'success',
+ imgList: result.data.data.images.map((item: any) => {
+ return item.url;
+ }),
+ };
+ }
+}
diff --git a/server/src/modules/tools/aiAdmin.controller.ts b/server/src/modules/tools/aiAdmin.controller.ts
new file mode 100644
index 00000000..61502911
--- /dev/null
+++ b/server/src/modules/tools/aiAdmin.controller.ts
@@ -0,0 +1,75 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2024-12-23 12:45:22
+ * @LastEditors: nevin
+ * @Description: admin AI工具
+ */
+import { Body, Controller, Get, Param, Post } from '@nestjs/common';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { AiToolsService } from './ai.service';
+import { Manager } from 'src/auth/manager.guard';
+import {
+ AdminAiIdDto,
+ AdminAiMarkdownDto,
+ AdminFireflycardDto,
+ AdminJmTaskDto,
+} from './dto/aiAdmin.dto';
+import { OssService } from 'src/lib/oss/oss.service';
+@Manager()
+@Controller('admin/tools/ai')
+export class AiToolsAdminController {
+ constructor(
+ private readonly aiToolsService: AiToolsService,
+ private readonly ossService: OssService,
+ ) {}
+
+ @Post('fireflycard')
+ async fireflycard(
+ @Body(new ParamsValidationPipe()) body: AdminFireflycardDto,
+ ) {
+ // 二进制文件流
+ const res = await this.aiToolsService.fireflycard(
+ body.content,
+ body.temp,
+ body.title,
+ );
+
+ const fileRes = await this.ossService.uploadByStream(res, {
+ path: 'fireflycard',
+ fileType: 'png',
+ });
+
+ return fileRes;
+ }
+
+ @Post('markdown')
+ async aiMarkdown(@Body(new ParamsValidationPipe()) body: AdminAiMarkdownDto) {
+ const res = await this.aiToolsService.aiMarkdown(body);
+ return res;
+ }
+
+ /**
+ * 获取AI的mk结果
+ * @param id
+ * @returns
+ */
+ @Get('markdown/:id')
+ async getAiMarkdown(@Param(new ParamsValidationPipe()) param: AdminAiIdDto) {
+ const res = await this.aiToolsService.getAiMarkdown(param.id);
+ return res;
+ }
+
+ @Post('jm/task')
+ async upJmImgTask(@Body(new ParamsValidationPipe()) body: AdminJmTaskDto) {
+ const res = await this.aiToolsService.upJmImgTask(body);
+
+ return res;
+ }
+
+ @Get('jm/task/:id')
+ async getJmImgTaskRes(@Param('id') id: string) {
+ const res = await this.aiToolsService.getJmImgTaskRes(id);
+ return res;
+ }
+}
diff --git a/server/src/modules/tools/dto/ai.dto.ts b/server/src/modules/tools/dto/ai.dto.ts
new file mode 100644
index 00000000..2725ed90
--- /dev/null
+++ b/server/src/modules/tools/dto/ai.dto.ts
@@ -0,0 +1,110 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-19 15:58:47
+ * @LastEditTime: 2024-10-17 19:07:10
+ * @LastEditors: nevin
+ * @Description: AI工具
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsNumber, IsOptional, IsString } from 'class-validator';
+
+export class VideoAiDesDto {
+ @ApiProperty({ title: '视频URL', required: true })
+ @IsString({ message: '视频URL' })
+ @Expose()
+ readonly url: string;
+}
+
+export class ReviewAi {
+ @ApiProperty({ title: '标题', required: true })
+ @IsString({ message: '标题' })
+ @Expose()
+ readonly title: string;
+
+ @ApiProperty({ title: '描述', required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ title: '最大字数', required: false })
+ @IsNumber({ allowNaN: false }, { message: '最大字数' })
+ @IsOptional()
+ @Expose()
+ readonly max?: number;
+}
+
+export class ReviewImgAi {
+ @ApiProperty({ title: '图片链接', required: true })
+ @IsString({ message: '图片链接' })
+ @Expose()
+ readonly imgUrl: string;
+
+ @ApiProperty({ title: '标题', required: true })
+ @IsString({ message: '标题' })
+ @IsOptional()
+ @Expose()
+ readonly title?: string;
+
+ @ApiProperty({ title: '描述', required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ title: '最大字数', required: false })
+ @IsNumber({ allowNaN: false }, { message: '最大字数' })
+ @IsOptional()
+ @Expose()
+ readonly max?: number;
+}
+
+export class ReviewAiRecover {
+ @ApiProperty({ title: '评论内容', required: true })
+ @IsString({ message: '评论内容' })
+ @Expose()
+ readonly content: string;
+
+ @ApiProperty({ title: '标题', required: false })
+ @IsString({ message: '标题' })
+ @IsOptional()
+ @Expose()
+ readonly title?: string;
+
+ @ApiProperty({ title: '描述', required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ title: '最大字数', required: false })
+ @IsNumber({ allowNaN: false }, { message: '最大字数' })
+ @IsOptional()
+ @Expose()
+ readonly max?: number;
+}
+
+export class AiArticleHtmlDto {
+ @ApiProperty({ title: '内容', required: true })
+ @IsString({ message: '内容' })
+ @Expose()
+ readonly content: string;
+}
+
+export class AiArticleHtmlTestDto {
+ @ApiProperty({ title: '模型', required: true })
+ @IsString({ message: '模型' })
+ @Expose()
+ readonly model: string;
+
+ @ApiProperty({ title: '内容', required: true })
+ @IsString({ message: '内容' })
+ @Expose()
+ readonly content: string;
+
+ @ApiProperty({ title: '内容', required: true })
+ @IsString({ message: '内容' })
+ @Expose()
+ readonly content2: string;
+}
diff --git a/server/src/modules/tools/dto/aiAdmin.dto.ts b/server/src/modules/tools/dto/aiAdmin.dto.ts
new file mode 100644
index 00000000..fd692786
--- /dev/null
+++ b/server/src/modules/tools/dto/aiAdmin.dto.ts
@@ -0,0 +1,89 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-19 15:58:47
+ * @LastEditTime: 2024-10-17 19:07:10
+ * @LastEditors: nevin
+ * @Description: AI工具
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import {
+ IsEnum,
+ IsNumber,
+ IsOptional,
+ IsString,
+ Max,
+ Min,
+} from 'class-validator';
+import { FireflycardTempTypes } from '../ai.service';
+
+export class AdminFireflycardDto {
+ @ApiProperty({ title: '内容', required: true })
+ @IsString({ message: '内容' })
+ @Expose()
+ readonly content: string;
+
+ @ApiProperty({ description: '模板', enum: FireflycardTempTypes })
+ @IsEnum(FireflycardTempTypes)
+ @Expose()
+ temp: FireflycardTempTypes;
+
+ @ApiProperty({ title: '标题', required: false })
+ @IsString({ message: '标题' })
+ @IsOptional()
+ @Expose()
+ readonly title?: string;
+}
+
+export class AdminAiMarkdownDto {
+ @ApiProperty({ title: '系统提示词', required: true })
+ @IsString({ message: '系统提示词' })
+ @Expose()
+ readonly prompt: string;
+
+ @ApiProperty({ title: '内容', required: true })
+ @IsString({ message: '内容' })
+ @Expose()
+ readonly content: string;
+}
+
+export class AdminJmTaskDto {
+ @IsString({ message: '提示词' })
+ @Expose()
+ readonly prompt: string;
+
+ @Min(520, { message: '最小520' })
+ @Max(1300, { message: '最大1300' })
+ @IsNumber(
+ {
+ allowNaN: false,
+ },
+ { message: '宽度' },
+ )
+ @Type(() => Number)
+ @Expose()
+ readonly width: number;
+
+ @Min(520, { message: '最小520' })
+ @Max(1300, { message: '最大1300' })
+ @IsNumber(
+ {
+ allowNaN: false,
+ },
+ { message: '高度' },
+ )
+ @Type(() => Number)
+ @Expose()
+ readonly height: number;
+
+ @IsString({ each: true, message: 'sessionIds' })
+ @Expose()
+ readonly sessionIds: string[];
+}
+
+export class AdminAiIdDto {
+ @ApiProperty({ title: 'ID', required: true })
+ @IsString({ message: 'ID' })
+ @Expose()
+ readonly id: string;
+}
diff --git a/server/src/modules/tools/dto/tools.dto.ts b/server/src/modules/tools/dto/tools.dto.ts
new file mode 100644
index 00000000..08d62e62
--- /dev/null
+++ b/server/src/modules/tools/dto/tools.dto.ts
@@ -0,0 +1,38 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-19 15:58:47
+ * @LastEditTime: 2024-10-17 19:07:10
+ * @LastEditors: nevin
+ * @Description: AI工具
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsEnum, IsObject, IsString } from 'class-validator';
+
+export class TextModerationDto {
+ @ApiProperty({ title: '内容', required: true })
+ @IsString({ message: '内容' })
+ @Expose()
+ readonly content: string;
+}
+
+export class KwaiSignDto {
+ @ApiProperty({
+ description: '请求体的 JSON 内容',
+ type: 'object',
+ additionalProperties: true,
+ example: { key1: 'value1', key2: 123 },
+ })
+ @IsObject()
+ @Expose()
+ json: Record<string, any>;
+
+ @ApiProperty({
+ description: '请求类型,form-data 或 json',
+ enum: ['form-data', 'json'],
+ example: 'json',
+ })
+ @IsEnum(['form-data', 'json'])
+ @Expose()
+ type: 'form-data' | 'json';
+}
diff --git a/server/src/modules/tools/kwaiSign/kuaiShoSignCore.js b/server/src/modules/tools/kwaiSign/kuaiShoSignCore.js
new file mode 100644
index 00000000..b99e18fd
--- /dev/null
+++ b/server/src/modules/tools/kwaiSign/kuaiShoSignCore.js
@@ -0,0 +1,681 @@
+'use strict';
+Object.defineProperty(exports, '__esModule', { value: true });
+
+const window = {};
+
+exports.default = {
+ 75407: e => {
+ ! function(t, n) {
+ e.exports = n()
+ }(window, (function() {
+ return n = {}, e.m = t = [function(e, t) {
+ (function() {
+ var e = function(e) {
+ return e.constructor.prototype
+ },
+ n = Object.create,
+ r = function(e, t) {
+ return Object.prototype.hasOwnProperty.call(e, t)
+ },
+ i = Array.isArray,
+ o = function(e, t, n) {
+ return Object.defineProperty(e, t, n)
+ };
+ t.prototypeOf = e, t.create = n, t.hasProp = r, t.isArray = i, t.defProp = o
+ }).call(this)
+ }, function(e, t) {
+ (function() {
+ function e(e) {
+ this.elements = e, this.index = 0
+ }
+ e.prototype.next = function() {
+ if (this.index >= this.elements.length) throw new Error("array over");
+ return this.elements[this.index++]
+ }, t.ArrayIterator = e
+ }).call(this)
+ }, function(e, t, n) {
+ function r(e) {
+ return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
+ return typeof e
+ } : function(e) {
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
+ })(e)
+ }(function() {
+ var e = {}.hasOwnProperty,
+ i = n(0).isArray,
+ o = (a.prototype.run = function() {
+ for (var e = this.callStack[this.depth], t = e.error; 0 <= this.depth && e && !this.paused;)
+ if ((e = t ? this.unwind(t) : e).run(), (t = e.error) instanceof Error && this.injectStackTrace(t), e.done()) {
+ if (e.guards.length) {
+ var n = e.guards.pop();
+ if (n.finalizer) {
+ e.ip = n.finalizer, e.exitIp = n.end, e.paused = !1;
+ continue
+ }
+ }!e.construct || "object" !== (n = r(this.rv)) && "function" !== n && (this.rv = e.scope.get(0)), (e = this.popFrame()) && !t && (e.evalStack.push(this.rv), this.rv = void 0)
+ } else t = (e = this.callStack[this.depth]).error;
+ if (this.timedOut() && (t = new Error(this), this.injectStackTrace(t)), t) throw t
+ }, a.prototype.unwind = function(e) {
+ for (var t = this.callStack[this.depth]; t;) {
+ t.error = e;
+ var n = t.ip - 1,
+ r = t.guards.length;
+ if (r && (r = t.guards[r - 1], r.start <= n && n <= r.end)) {
+ if (null !== r.handler)
+ if (n <= r.handler) t.evalStack.push(e), t.error = null, t.ip = r.handler;
+ else {
+ if (!(r.finalizer && t.ip <= r.finalizer)) {
+ t = this.popFrame();
+ continue
+ }
+ t.ip = r.finalizer
+ }
+ else t.ip = r.finalizer;
+ return t.paused = !1, t
+ }
+ t = this.popFrame()
+ }
+ throw e
+ }, a.prototype.injectStackTrace = function(e) {
+ var t, n, r, o, a, s, c, u = [],
+ l = 0;
+ for (this.depth > this.maxTraceDepth && (l = this.depth - this.maxTraceDepth), n = r = a = this.depth, s = l; a <= s ? r <= s : s <= r; n = a <= s ? ++r : --r) "<anonymous>" === (o = (t = this.callStack[n]).script.name) && t.fname && (o = t.fname), u.push({
+ at: {
+ name: o,
+ filename: t.script.filename
+ },
+ line: t.line,
+ column: t.column
+ });
+ if (e.trace) {
+ for (c = e.trace; i(c[c.length - 1]);) c = c[c.length - 1];
+ c.push(u)
+ } else e.trace = u;
+ return e.stack = e.toString()
+ }, a.prototype.pushFrame = function(e, t, n, r, i, o, a) {
+ if (null == o && (o = "<anonymous>"), null == a && (a = !1), this.checkCallStack()) return n = new d(n, e.localNames, e.localLength), n.set(0, t), a = new s(this, e, n, this.realm, o, a), i && a.evalStack.push(i), r && a.evalStack.push(r), this.callStack[++this.depth] = a
+ }, a.prototype.checkCallStack = function() {
+ return this.depth !== this.maxDepth || (this.callStack[this.depth].error = new Error("maximum call stack size exceeded"), this.pause(), !1)
+ }, a.prototype.popFrame = function() {
+ var e = this.callStack[--this.depth];
+ return e && (e.paused = !1), e
+ }, a.prototype.pause = function() {
+ return this.paused = this.callStack[this.depth].paused = !0
+ }, a.prototype.resume = function(e) {
+ if (this.timeout = null != e ? e : -1, this.paused = !1, this.callStack[this.depth].paused = !1, this.run(), !this.paused) return this.rexp
+ }, a.prototype.timedOut = function() {
+ return 0 === this.timeout
+ }, a.prototype.send = function(e) {
+ return this.callStack[this.depth].evalStack.push(e)
+ }, a.prototype.done = function() {
+ return -1 === this.depth
+ }, a);
+
+ function a(e, t) {
+ this.realm = e, this.timeout = null != t ? t : -1, this.maxDepth = 1e3, this.maxTraceDepth = 50, this.callStack = [], this.evalStack = null, this.depth = -1, this.yielded = this.rv = void 0, this.paused = !1, this.r1 = this.r2 = this.r3 = null, this.rexp = null
+ }
+ var s = (c.prototype.run = function() {
+ for (var e = this.script.instructions; this.ip !== this.exitIp && !this.paused && 0 !== this.fiber.timeout;) this.fiber.timeout--, e[this.ip++].exec(this, this.evalStack, this.scope, this.realm);
+ 0 === this.fiber.timeout && (this.paused = this.fiber.paused = !0);
+ var t = this.evalStack.len();
+ if (!this.paused && !this.error && 0 !== t) throw new Error("Evaluation stack has " + t + " items after execution")
+ }, c.prototype.done = function() {
+ return this.ip === this.exitIp
+ }, c.prototype.setLine = function(e) {
+ this.line = e
+ }, c.prototype.setColumn = function(e) {
+ this.column = e
+ }, c);
+
+ function c(e, t, n, r, i, o) {
+ this.fiber = e, this.script = t, this.scope = n, this.realm = r, this.fname = i, this.construct = null != o && o, this.evalStack = new u(this.script.stackSize, this.fiber), this.ip = 0, this.exitIp = this.script.instructions.length, this.paused = !1, this.finalizer = null, this.guards = [], this.rv = void 0, this.line = this.column = -1
+ }
+ var u = (l.prototype.push = function(e) {
+ if (this.idx === this.array.length) throw new Error("maximum evaluation stack size exceeded");
+ return this.array[this.idx++] = e
+ }, l.prototype.pop = function() {
+ return this.array[--this.idx]
+ }, l.prototype.top = function() {
+ return this.array[this.idx - 1]
+ }, l.prototype.len = function() {
+ return this.idx
+ }, l.prototype.clear = function() {
+ return this.idx = 0
+ }, l);
+
+ function l(e, t) {
+ this.fiber = t, this.array = new Array(e), this.idx = 0
+ }
+ var d = (f.prototype.get = function(e) {
+ return this.data[e]
+ }, f.prototype.set = function(e, t) {
+ return this.data[e] = t
+ }, f.prototype.name = function(t) {
+ var n, r = this.names;
+ for (n in r)
+ if (e.call(r, n) && r[n] === t) return parseInt(n);
+ return -1
+ }, f);
+
+ function f(e, t, n) {
+ this.parent = e, this.names = t, this.data = new Array(n)
+ }
+ var p = (h.prototype.get = function(e) {
+ return this.object[e]
+ }, h.prototype.set = function(e, t) {
+ return this.object[e] = t
+ }, h.prototype.has = function(e) {
+ return e in this.object
+ }, h);
+
+ function h(e, t) {
+ this.parent = e, this.object = t
+ }
+ t.Fiber = o, t.Scope = d, t.WithScope = p
+ }).call(this)
+ }, function(e, t, n) {
+ n = new(n(4));
+ n.eval('["<script>",0,[[21]č75ċ,falseĒď4,1,nullĝ16]ĝĀĂĄĆĈĊāanonymousĉč[Ĕ,3ČĘĚĜčŁĖ44ħĝĿ29ėęěĝŇČ43ŋēĕ28ŐńœČŕ2ŘľŚ7ŝŒņŠ,4đčŭŤ,26ŧŅ[Ŕū0ţōĕŃŨŶŪ39źŚğŽŵŷ37ƃű3ŴşĖ3ŗŮŌŚ2ƎũƐŢƓřűġƆƏČ3ůůōłőƇƀŹƛŰ1ŏƟƘČŎƋ1ŜƯſĖśƳŦƶŷ2ƊƫĿĨƗƷƱĩǀĕ1żƧƠű5ƳƅNjưƌƳƍƼŪ2ƚ[ƤLjƖǖƸƣƔĠƞǑDŽűƪǚǡ1ƦŞǒƭƋƮǤŷƴƋƵDZŪ1ƿǨƜƻǶĖĨƋųǞČljƋNJǬǥ1ŊLJūǃDzƒǺŰǕǽȃǙǛűȍǷǠƜǣȇDzǧȖǫžŷƂƫ2ȡŵ7ŠĝŎǾȫdžǥȏǿčȬȃƤČ"$encode"ȫŏơħƣȟȱȊďǹȲďɂŀǹȩ,ȸȺĄyćɀȳɍȱɅħɇȫɊȯȴūǙɐȸȾɔɖɁƐɄħɆħɈƾħȯ7ġǧŷɈɋɳĠnjǎŮɲġǙŷȯɸȔ0Ǫ8786ȤľČ7ś038ƢɲČ-1247Ƣ74ʅŌʕƉ5Đ7ȩ8ʟ,ʖ8Ȧ1Ĩ53ʔŀ95ʝʪƹēȃ4ʪʲ6Đǧɐʖ9045Ǹȩɲğʦʷʨ93Ŏ60ʮɏʕʒ9ʉ46ʊʧ8ʲ˕ʯǮˊˍˍȦʐˉʌĠˁʇʹƭʾʍʈɳʘʼnʧ-Ȧǘ813Ŭɼ˦ʖ0˛ʼn06˛Ōˈ̃űnjɟʧɋŷ˥ʃǢĨ3ʢʴ̉˛9ʼnʜŬʧŁ4ˌ2˸ɳ̙9ʽ0ʲʚʧ96ƭʇ̏̉5˽9ȩ9ˌʧʘʮ6̐ʜ˥ɐśȩ7̶ǘȶŀʼŖ˶˽ˬŀǪ5˕ʝ̀ˏʎ2ʢʈ̉4Ų8˶˕˒˧͏0ʈʑ̹ƱĨȦʈȦʰŲȉ͕̈́ȏɐˍʹǘ͏8͆ʑ̐Ɓ˂ʞˊʝͭʘʤɈ̺6Ŗʙ͛͞,ˏʹ͛ʼ΁ʤ0͏͉ʒ̉ʘ9ljʅǘ̬5̭˶ʊɣȃ̱ˏͽ˕ͤΔ͓Ȧ͕Θűʪƴ˸˸ʋ̺ʲŎ̧ͯ΁ˍǪƢʯ̟ˠƑ65ɳ˛̀̐8˃̻ʬ̉˷̡ʊ̲εʪŬ˛˺ɐ˘̶͛Ȧϊ˭̐άʗ΍̕Ĕʚʎ̉Ɓ̨ʵΏ̉ʊ˄ʒȩ̩͆ό͈̀ʣȩŲ̴̐͆ϠˏƉ̳ʚ˂8͉Đ̳ʪʐΉŬλ͏̯ŁͯͰ˸θͽʤλ˄Λ5˶͘ʯ0ʐʢͯͻṛ́˃ɳˁΩƱĔ͓Ƒ˱ͶŁǘʤ˸ʧ̭ʊʹ̨ʰηˁˏΔʰ͕Ɓ̯ʇ͘ʲ˶Ɓθ̀˷˵ͭdzˊljƉЎͣͩȃʜˮƉ7И˧Δ5ʼ̳ͭϻǪ˪ϐűРϳξ̳˞ϵʘʘ̳͓νʯʙВűĔ6ʚψЌȦʝƢʙчƑŎˍʢ˕̅ͽnjњɽĪĽāăąćļ"rĊĎȦ,truƇƍ"Datȿċɬɜʧ"ĴwɗďĕȷҒҔƑɑ҉ҋĊǧ̝ɺǒȕɠɍȕɭˊ"toLocęeS҃ingҔ͏ĖҩҫҭүұąҴҔŊĝӂčĒŏ[ӃǧѸĮѻınѿďČ҃҅Ōɴѳɱ̅ɵƀӗˊәňӛɌӞˠȯЊĝ́ū˥Қ"MҊhҞҎŮсɑrijdomҶҖӲӴӶҔɐɋ˃œ҇ӫtӭҍŮҧ˦"flooѾȫLjɑԋԍԏмɩƱӯǚӱ"subs҃ӸȗԜԞԠԕӠɃԇҏҨpĺӭԐĠɑԭsԯѵɘӡǚȕ˺̘ǒɷħ˺ů˘ĠǧՂʑʧѠȉԗŀɫԪӰɮɞӟӾʋɡȏŲ̙ĝʢ˚՘зՊҦԫԉԝԟԡ԰ƖԤբԧՒՊɚԙ˷Տȳ̈ēġϨՕəՌǚԈՉկ̓ժնǪ՟չɉϚռŮɛՎŮɯ͘˥ՔսոֈՑɿփշ՟ɤjoҳԢġ"֕֗ĝӁӄčģĥĢĤl֣֢ҩıԧĘ̄č"ΑЃѣ˛abcȾfı-ıҔĒӉĭѺİɑtӏҁӒȨȪԷȃȮnjȱʰůɡ׎ȯɶӟŜҟյԷɿ˺ʘԱȸҙӚԶԨՋחĠיğ֙dםƸՑׇӠġǹՖՍԚҐslicȿ԰ȷ׳׵׷ǒՀҤש׈,יŏղɠğեpרČʂ׿؋ɩɿ؆כDҶ؄ףȫץɑקӖןӾ؏,׮ʂԈɤ׺׶Ԣ׹״إɻӟɡǙɡ؃Աɋך؈؊΂֏Ԇǥհ˦וĖɠʰׅ؞ŁؗԣjشعɹӝČ̌ɾҡנӨ֝ȏ̋ثؕɯɍَčŖnjيӔ̆עՕɠӥŦ̡źȃЎnjʋɸġմԱٞȫ٠ՃȚ˦ǪوՃתٌɹ٪٩֌տɯȯ٘ֆǚ֎ןɡчƶȬ٩ҟ؇ɑلՊٖ[پǥٚ؁վˊڅؕفȳډ֚ؔĖڍڏّڂɍ׮ٕœُٙٵʭ̐ͬ͏ʧڕ٫ڈكڛىڤِٗŪڑľġٔڜڳڎڵڻ؜ġدڲņڥǒڷɡ֊ؕխژכҵnjπڠǾ׎ڣۄڴڦۑۃ׬ĠحؘԜشۇ۔נɷآġɠԑ֡ĦןՂƭɈDzңՊϔ؁ۣ֓׭԰ġۨӟɂѶӇ֤֦֥֠ۨӲӍıaıҌ"oıַɑvıcıu֩ҔԹĠϵʨղ̕ѶܖĀıʳ˃ıԠartupRӻӷɑȼunׂɑʅЎܰ0ıܱܱܠu܏ɑer֪طӊֿѼs׃ӑ҄׆ط׏׊ǒ׌Әnjɷ؍סۚˍق֙kش׾ҐlȺgԄڱ؂݉ٱ֝ںČיבŪ،ʧٳعɡ͘"ݙҴݜՊݤ̉ݡ՘˥Ӧ̨ՊڢĖݲ؁ӣ٪ʍ՘ӱΊ՘حڡՊɷօױևՐۘ؟ħԺ֝ůŷɊԿţՂׯ[Ղ˄Պݏݺŕٺٿրɰލں٩Օ۝xӀۻĝ܁ޭ۾ѽ܃ׁ܄܆ֻŀğۼۼֽѹįѼҵĽׄ݅ݨ۰ݟƈْɪٝۜכݕݍٵٳݗӜnjݧݽݘݚݰ۲ݟӤčӦڏɡݏټ̳ΔބݱڼڞŪߏנʂސٗޒݦţȄƫ۫ǹՅݿݞˊރߚՄŦʹӥųߙנԻߎڧߣەڽتލё߷[ՙ׽߆ݣ؞ޢ۝܍֝ޫ۽֢ޮ֧Ѿɑӎ޲ɑ܅Ӄƾ֟޹ĝܿ޼ı܍޿݄ӓߐڒ߄מǚًٳݎ֑ɐǧъٮڗנӱɋ߾ѣ˧ٛՄųȦٛзݏȱآȷҪҽҳێȳԑҹࡊҿۅǥ࠲ߚųƑٛʀŪࡔۢࠓӃ[ࠗ܀ޯ࠙ґ޵Ǹܴܴ֭ܳӈࠣ־ؙࠥ݃҂߁ࠫנא׋ڧʶŶ҇ࡐ޾ȟࡇԒrӶChܢCȽ׼ҕכfࢀmࢂࢄࢆݝِࡒ߅؜ȷݮݛԵ࠹ݟɐɈ˗̳࢒࡚ࠍū؞˥࢝ņԂӬӮװۋԉ׶il֘ܪeࢮݖՑğٳߒغ̇ţݫࠃࠊݶŜljϊࢶݹޜޠފڀތ࠯߂ۆࢻۡچ,˥࠼ࣀԀ؁͘Ѳٗۂ࣐Շ֝Իߴࡆ֓ȷcࢃrࢅȾAׂ۶ܪࣣࣥeࣧӽƱ࢜ۉĖࣖ࢜ࣙ΁ࣵࡒ؝ۖ؁ࣟٿɤ࣢ࢎࣦࣨࡍכऀࣤࢆ࣮ϟ࣑֝ۓࣳʧࣗڎࣶࣹࣛࣘԘ࢙ࣻࢪԛआ࣬उऄ֙छईः˦ࢤऌࣄˊऐٍࣔओऑकݐߜז֒ࣾ࣡࣫डࢰ"ठंҔޛ؁ࣲހߓȳʂމࢫޢݪۡ۱ǚԻ߬ڿȐ߯Ȑޚݶų˷ࣙɊߪڎॊाौՀ߼ɢज़ȉёݭߕ࢘֋ीࢣफऩڏࣺڎۭŪ٧ݏчࢤࠈ̙ʀࢧݜطړࣇɤpoғդԲॻӀ׿ġ΁ǙН߿ݳٗݢص।քլɝպۑং࢞ঈࢽ३অߝݟޘөԃԅࡽ࣠ԒԌԎशԓড॥߶ݴ؁ёůখɍؽࣆृځ࣊؁९ࣜՇƠ̆ѣŎ˺ࠋۚ΁পউ঩ধߨݟېऱࣇॄࢡٽࠔ࡟۾ࡠ܂ࠚıܮ"܅ܺı܉Ԓࡥƴּࠡ࡬޻ӌԲࡰؿࡳ݈ঋȰࠂࠬ৤ג؜ࣃࠌ࢔ɑ࢖ߖघďݥǾࢸ࠴ۏԾڒউ࠻ࢿɎΣٳ्ऍȃد঑č࣒؂ݏ्׏উ٬৤׏ࣙՀू঎ցލ਀ॕԼȈग़ŮਙޙࡁʋՂࢥ়ۏਛ਎एɈਆʗਁؖদওনঘؕϷی֙ӷ۰ёǹফݻݟयǾ঩ԻিਮԱࡂ਱ɑyӀߴ्Ӿٽਾ৤਺ਂࢽৄॷযࣉ̧͓̍̕ʎʲ਴੎਑ծ৲ߢޡরرɍਕޕ߫ਢ߮ਛޚਞ॑ৄ৶ߗ২߭৭਩ߟǒنख࡜੯ो̍ߴੳǥ७फɡ੼Ȟٵࣙઁșٵߞ࠭Ǿۯˊޞࢢ੸ȃ݋ࡳDzਣ੢ёऐਆљ۰੆ػܘݓɑॼग׏ػȵ۰ޅੀ߉Ԃ੅ਖ਼עѴ੝ડકࢽޘߥǾॅؼࠏ֊۝Aݝޝڌ؞̝قࡺપǭ۠ઊۏઑࡴॗۛࢡॷDzƣ८۰ਸ਼ӱ੔ষ੗঺࡙ǾȟݏӨ६ࢡǹڟ঱ূੴોઍлࠅͶশ੖হਫ਼ǥࢸਤŮਖૉ਀੤ॎ॑ऐޗݒৢɍ੼গग࢛૨স੘ਅ৾އম਒ޣૠ३઀ਿक़२š੕଀૖ই੷ǚਜ਼ދএଈ੶ଊ਍ۡ଍ɢଏ૕૫̺଄ঌङੜଇ੺ଣમנʋଝ૓૩ଁࠊΣ੻ଅଦੵ઎ଓޘઢभମଐଡޟ੮ଔ঍ଵઃ଩ହ੢প૒૿ଠଂУ଩੏֍੒Ш୅ਈ঄୉ଟ૪ୌध୎କࣈଗ̍ઍૻ੢ȏଭ୊୘଱ʧୠ଴ଖਓૠਊޏ૳ਗDz৸ैޖࡁǙՅʼ଩֞޸্܁ް৏ࠜ৒޴ɑ৖Ԋࠦ܎ܐıiıԅݭܠı޾"ؚ֟Ǹ޷࡫֭࡭৞ஂࠨࡱࠪࢹ১ପ࢓ଘٌৣ஡ࢠޤ֑̭଩ͪદԩ४ऋ՛࡝ࠡ୽ࡢ܃Ӄʬ৚ܾங׀"઺ஜৡடࡴઉம̍஭ݐ࣏Ǹقեࠞмࣞࠏ׮ڙௌࠊނெٸĠௐԣ௒ʮல୼ৌ௞࠘ࡥƍ޸৛஘ঢ়஼ғிࡲு஥ঙ࠮̍ࡅ௏ொ࣯ࠝǢ֑ை௘ோऺނࣙ௖௉ی௹ށ௜ެ௟ࡡ௠ஷ௢஗Ĭ௦Ѽ੄௩ஞ੭ூએݐୟ௶ۊ௸௳ջࣼ௱௿ఘਅ௎ˠ՘࠵ୣ৊ழఆஔƖ௣஺ఋıܩҀ݆ࠩણத৳௄׍ઍ௽గஂ̉Փर௷௲హఞ࠳٤డఁٗతఄۿ܂ஷనఉࠤசMৠ௪ఐ௬ళఓ׍߃ఒ࡛ଢ஠௭ਸލଳ୙ৱʝࢽ঻௛౅࡞థ֥୿ࡤ޲ొஹ޺Ӌ஼S౐ఏ׫౓ࡶੱ౗஦Ը௅౹౜ࠎ౞଩঻ॣআౠ౥ସɍ଑ీ౦ளే୾ࡣࠛ֨ஷ஖֟౯݀ı$౳ర౽౔ેה࠿ۗଈ৫੽ߍߌǀ࢕ॡ࢐௃ঊȐଚૡࢾӥࣀ˘୅र੐चऴहࣩषಷ࣭ढŷߧخ΍࣑ݶŦȉ఻ౝ˦ѧೂٮиঔݣѯӣ֊ٮபȥಈУѤɈݸߚೄ˽୎૰ಥख़ઇΔʯ್ՃિౠӾǧ߻ୀಃವҐस಼श೯झٱΉȏ౤ୈࠆணʘఱ঩ࢤʋऻٱࡸೀм঄ч̶૫ഀӾംೕ୚ٗആ೶ǙഉȔऽߵ˦ഇಅ਩٧ࡾ"ԳॢĕğജԮҔɋ۫Ƣ̳ભഃഁ֝೿зഋೇϋഫएഐறഄഔખളਅങୂԬഢ԰҇ഝണȯ۫೪ٱ٢ਭ഍ڎബು೤ഗ୧ഹՊചঞഡԴԢ؈ഽ۪॑࠶േଫ഻ԉീಹൟந૯୰ૉ୳૲ࡕƝढ़൚ு৩Ȑɤ৯ॢɍՓ౔ޔ೫ކਅৼʫಳĖ൳ԁɑࡻࢩ৅ࢫɤࢊࢁ಻ঢࢋࢍइȾݝڝھۙ੡౻ೞԽ੧୵ௗ೘॑Ϟ़ࠓ൨ȦʋંןөEܼড݇ƍʾĝۺ౧಍வ஀֨௳৔஄܊ܒīŦѧܗǦƂӅŜܜౌ஻Ѽؓఎಚ౛ಜض࠱ತ৬൮ಧݯ൱߇౺क़਩॓ݵರ؟ߴ௼ਿɿસכܑಠ̍ࢷ٣৮ನઽఒ٧ࣅলීߚŜ്ૼप২ࡺҲҿॶഛඅࢌඇಹ෴ඊ࣬ݝۭ࢟౻ݏߩ൤ߑඕ߰ࡖൂ߽ූ୯ਚޑ೹ƣ੨߲॑ų෫ૺంࠕఅถৎ౫ද஛"܇அַӃƢࡧ඾ఫܪಙ࣋఑ාౕ݌ඔ৭ࠁࠇ଒͉ුਗಃഩɐ॰ృ߶ߡౠഩಭ୏ٻ୑੎ඓǥਛ൧ਜ૊൨ദୀ୻ఃࠖే౪ಐढĒƭ౮ড়౰Ѽܑෂว౶݊ࢵط൭ନ෉ෑว೙ޙŜੌேഌण঴ਅϭฺൎ˦จਬଓ฾੟เ൛े्͓ฌ૳Ձ॑୷ࡖ౟ڎెํຄ౩ಏ৐޵ҁ఩ಕ࡮"Iฦૹȭఒેʜ๞஧ணฮ୭๩ͪ՘ਞ๦਩๱๪औ๬ߠಉ಄๳ଡ଼েฯൣช੥๡๼ढ़๿͇୺຃ทಎޱ಑ஔӆร๖ıل๙ຑ׉ຓ০ศ౾ଷ٨ຖೇɸಢʁࢡ೘බ෗બՓ۝ຏข൘ŀఱ௖ം۝ොǒ৵׫ޓ૝ߔ෌઻ߘৼัࣕ෦ପைɯࠑݝ˺ୣඏകඑැโ໡ƫๅ߳ज़̛ࢽ๋ตైືථ৑৓ผຉ޷"޵ຌசҌమ஝ස໅ළಀмבിܢěIܭඁزԲ༖e༘ಽທ౼Ҩ൰಩৤ౚڎЭ๫ࡹɑছඁ೭Ԭॿॽജ༱๡ઈ൛༧ਠক೘߹́໻ੲ໽५෾ິණ຅ై๏ຈࠟోಔ๕ಖɑݕເ௫੢ಪດ໌༡ʰນ໴ക൯෢చ৤ਆำປଙ಴ഛաԦൕɑཥգٝ׎۝ࢇ฽ഛൡ࢈ཱ֙༢ວ໱๻൨े໺๊ີༀතน๑Ǧ๔௥ຽɑީཐ౒དྷໃۀ້ିຘฌݏय़༤௶೐าມิΞ຦໬ઞ"ࠒໞৈ଩ཷฬບ໊໶ߦฃ૴็ๆࡗོངຶཿ๐޳ஷӆ༈ຼཌྷ"Nຐདຒษດໂ༐೟ཱུ๛ใד఼݇ؕঁūާԣFش৵ཕऎ৭Ɖ̡̐ˁʳા໓כ໕໩ଥҨȼȻҊೱĵҮ༠࿑ண૸ۚଇךटݝɊഛ࿟࿤࿢࿠࿥ැ࠰ـ߉ݔ࿭൝ࣿ࿣࿡ಹ࿰࿾ૢ৭ʝ̯ા௘࿬दංच࿽ढҷटဌمઇ̅਩࿮൒ကဍࡎဗထൢۚำ۝qڛɿ࿙֙࿛נပलܪတ࿿ဪဂྤہဓဉ༯ࢬာིဩ࿳ရྤ؎עသכဠ࿘ྜဥࢼ࿝ဳ့ါ၅ိ̍ॠ໤໪୆ੀဣɑ၁൷ည೮ဴဎံ࿱ࢺލ઼၃࿼၇ဵषဴ໷္ގ๷ۤத֤ۧӟൃ໰ڶ໢ၥ۴ٜဵ۸ןඪಌཅ༁ྀ޳නްīࡦ˷ųʖĠԀĒɐĀܵႇႈܵ3ܷܹผܼ༉ཌຍXྺྉྼໆ྾෡။ཝษ࡛ಭөAܼa఍ҟƍૉߧఐໍၚಁৼʙ၌ལဖ಻ೳၖ಺ँ೰Ⴎ໊ຩ੠෿ฉ୴ຮ૬ྨ๽࠾่ઍԻ্ཽཇ஁௒ĒҠ຋႑சZ႔Ʊ൫႟ႡႣȫႥƏ٩ڷႨ௮௰ูྕ෩΂໙࿁༩༵แ୰૗౿ೠსའԸ३೓ଓჯ୷ŦೣࡳՅЌ˕ʺ̝νౄࡓၪ඙ൻம࣏Նତၓ୫ଧპԹก๜໸ฎ,੪؂Źྮཾ௠༂ຉųჍ྄ྷဠྈ౵ྊ྽ࢡȏऐه՘ൂೄటๆཙ௖Ɓྜ႓ფ˲Ⴆٵ၊ࢗ෻ಪໟྍၤီŀӨ҇ܬֶҳeקط൫࠽ТჃ؞ౢیȷა෈ڐࢡഔრ๥؟ெഔઅ࿦ཙිಊೈ๮ಂږ֊ྑ՚຤ᅚಾᅏႼ๹ૉ̌ະ൨ᅉๆ୹൛ᅬఐჰ໾োၷྰຈධ༅඲ภనԜ෰ࡌࠢᄚຍzბ࿆႖༑ண਩ࡵྣ࿂ᄟໆߧಞ߶ᄨဲأب཮ࡎؤ཮࿈ᅈ࿋ե࿍໖ၣᅠၜӕञۿჿūၬᅗႻၯࣾղࣩၳૠၵ௝ᅵᄕၹᅸԧǚჴႀڹǎ჋௢Ԥႍܻܽ༊஼࿍ᄝᆅ྿႗ໄ࿃๟ʰͫΕ̶ඟȃ޶ઇʆƁʤ৳٩Ⴇšъʈ˕̣კ༽လჳǍźᆣჾ৭ᄳৰಭᆎࡷࢽচࢨෲ൒maީ༲ᇳᇵࢦɑႠӳზȳიྟอၙၣჄ෨ᅒ̽๚ၒᇫءႰႵႲမႱဍሉব୪ଢ଼୬ཙ॔ᄋظჀ໻ฆ΂བྷሂᅘဉଝेਧ̀ဉ෬၍ც၂૦ಮ๴৆Ⴚေྦᅗज़цज़Ѱ઒Ūવक़࢛ህӦlj࿉ᅆຢڎഔ࢜͘ߴভ൏Ƙ٩ႝږёतဉሼયશཞॊᇙ߆٩ქቃቐྎ๧ቈࠊቕᇡሃᅦॉሠᅪᄩᇟཹ༹ᄞ٫ਦᄦĠ๤۫ᄣơ̴˽ᇐᇠቁෞـ঺ቮĨᄐǸΣ̨˽ᇖሇቊŀᇚᆅቘᄥೋʤढ़ͯ঵ᇜ˛ͯᇑ٫࿏ᄸმ໠ሹၮԉྒྷႛޘઘࢫራ྘ᅈ໭כG࿺ඛᄅဲສቢຬႽॖብཹʉज़Ϗ෣ຂᄓჇງ჉ஃ܈޵̡֭ks-ěᅁ႐ᆁசኦᇆఱᆊ৥৭ĐџϢਠᇌ̉͛Ɖψდྦྷው́Ŗʳ߾Ⴉ೺ȉ̸ў૞ኙੱዔʜƴ೦ᅎዙѝዜᆨČ੾߶ዠʹў૛૘ٵˢʗ͏ʙჩ௵ဃΉηƢν৿ઋ൬Ƿેᄃীౠ୲቗ቡჲ੦ሁǭ૭੢቙ਧഒኈᇓԖಅ߲١ቀՈุဦ૫ŇቋᅍᄃౖጚٮΌٝጦࠊఱ೿૗኉ጐਘᆦରጥ໪ჯఢથഴƷጰᆈጏૠഥޥጘჱ྿ჰಆ଺቉ጻፂቹٝጉ๯θೋΒፌะఱ࣑ጯኆᅍጋ໗˷ፁ̐೤ůፅ੆፟በ፝౸ǭቌǾ࠺ர৹ફ௓ጺȎો฀ອኯ጑ඖ໼ቩᄨ׏೶໲ጇरᅳ౨ธྱᅸฝඳ܌ஈɑ๘"஋ɑ஍ࢯཨ޵ͽ๔์ྯ֧ᎊ"஍พıᎍ"Cܒᄖᎎɑ஑ࠧஒı؉ᅸா"௨"఍"ܩӪı౲ɑbಗıශषஉၐ຾ኻཏ"྇"BıEıLıྐྵɑRı႓ɑაɑᄜ"ᆃɑᇅ"ኦఇ༇ʅŁı1ıdX1fNIZB5mlA͕6౲࡫࡞Ēಓࠢ');
+ e.exports = n;
+ }, function(e, t, n) {
+ (function(t) {
+ var r = n(5),
+ i = n(6),
+ o = n(2).Fiber;
+
+ function a(e) {
+ this.realm = new r(e), this.realm.global.startupRandom = Date.parse(new Date) / 1e3, this.realm.global.count = 100
+ }
+ a.prototype.eval = function(e, t) {
+ return e = function(e) {
+ var t, n = {},
+ r = e.split(""),
+ i = r[0],
+ o = r[0],
+ a = [i],
+ s = 256;
+ for (e = 1; e < r.length; e++) t = (t = r[e].charCodeAt(0)) < 256 ? r[e] : n[t] || o + i, a.push(t), i = t.charAt(0), n[s] = o + i, s++, o = t;
+ return a.join("")
+ }(e), this.run(a.fromJSON(JSON.parse(e)), t)
+ }, a.prototype.run = function(e, t) {
+ if (t = this.createFiber(e, t), t.run(), !t.paused) return t.rexp
+ }, a.prototype.call = function(e, t) {
+ // console.log(e, t)
+ // console.log(this.realm.global[e])
+ try {
+ return this.realm.global[e].apply(this, t)
+ } catch (i) {}
+ }, a.prototype.createFiber = function(e, t) {
+ return t = new o(this.realm, t), t.pushFrame(e, this.realm.global), t
+ }, a.fromJSON = i.fromJSON, e.exports = a
+ }).call(this)
+ }, function(e, t, n) {
+ function r(e) {
+ return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
+ return typeof e
+ } : function(e) {
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
+ })(e)
+ }(function() {
+ var t = {}.hasOwnProperty,
+ i = n(0),
+ o = i.prototypeOf,
+ a = i.hasProp,
+ s = (i = n(1), i.ArrayIterator),
+ c = i.StopIteration;
+ u.prototype.inv = function(e) {
+ return -e
+ }, u.prototype.lnot = function(e) {
+ return !e
+ }, u.prototype.not = function(e) {
+ return ~e
+ }, u.prototype.inc = function(e) {
+ return e + 1
+ }, u.prototype.dec = function(e) {
+ return e - 1
+ }, u.prototype.add = function(e, t) {
+ return t + e
+ }, u.prototype.sub = function(e, t) {
+ return t - e
+ }, u.prototype.mul = function(e, t) {
+ return t * e
+ }, u.prototype.div = function(e, t) {
+ return t / e
+ }, u.prototype.mod = function(e, t) {
+ return t % e
+ }, u.prototype.shl = function(e, t) {
+ return t << e
+ }, u.prototype.sar = function(e, t) {
+ return t >> e
+ }, u.prototype.shr = function(e, t) {
+ return t >>> e
+ }, u.prototype.or = function(e, t) {
+ return t | e
+ }, u.prototype.and = function(e, t) {
+ return t & e
+ }, u.prototype.xor = function(e, t) {
+ return t ^ e
+ }, u.prototype.ceq = function(e, t) {
+ return t == e
+ }, u.prototype.cneq = function(e, t) {
+ return t != e
+ }, u.prototype.cid = function(e, t) {
+ return t === e
+ }, u.prototype.cnid = function(e, t) {
+ return t !== e
+ }, u.prototype.lt = function(e, t) {
+ return t < e
+ }, u.prototype.lte = function(e, t) {
+ return t <= e
+ }, u.prototype.gt = function(e, t) {
+ return e < t
+ }, u.prototype.gte = function(e, t) {
+ return e <= t
+ }, i = u;
+
+ function u(e) {
+ var n, i, u = {
+ window: "undefined" == typeof window ? {} : window,
+ undefined: void 0,
+ Object,
+ Function,
+ Number,
+ Boolean,
+ String,
+ Array,
+ Date,
+ RegExp,
+ Error,
+ StopIteration: c,
+ Math,
+ JSON,
+ console,
+ encodeURIComponent,
+ unescape,
+ Uint8Array,
+ parseInt,
+ escape,
+ decodeURIComponent
+ };
+ for (n in u.global = u, this.has = function(e, t) {
+ return null != e && (!!a(e, t) || this.has(o(e), t))
+ }, this.get = function(e, t) {
+ if (null != e) return a(e, t) || "string" == typeof e && "number" == typeof t || "length" === t ? e[t] : this.get(o(e), t)
+ }, this.set = function(e, t, n) {
+ var i = r(e);
+ return ("object" === i || "function" === i) && (e[t] = n), n
+ }, this.del = function(e, t) {
+ var n = r(e);
+ return "object" !== n && "function" !== n || delete e[t]
+ }, this.instanceOf = function(e, t) {
+ var n;
+ return null != t && ("object" === (n = r(t)) || "function" === n) && t instanceof e
+ }, this.enumerateKeys = function(e) {
+ var t, n = [];
+ for (t in e) "__mdid__" !== t && n.push(t);
+ return new s(n)
+ }, e) t.call(e, n) && (i = e[n], u[n] = i);
+ this.global = u
+ }
+ e.exports = i
+ }).call(this)
+ }, function(e, t, n) {
+ (function() {
+ var t = n(7),
+ r = function e(t) {
+ for (var n = i(t[2]), r = [], s = t[3], c = 0; c < s.length; c++) {
+ var u = s[c];
+ r.push(e(u))
+ }
+ for (var l = t[4], d = l.length, f = [], p = t[5], h = 0; h < p.length; h++) {
+ var m = p[h];
+ f.push({
+ start: -1 !== m[0] ? m[0] : null,
+ handler: -1 !== m[1] ? m[1] : null,
+ finalizer: -1 !== m[2] ? m[2] : null,
+ end: -1 !== m[3] ? m[3] : null
+ })
+ }
+ for (var g = t[6], v = t[7], y = [], b = t[8], w = 0; w < b.length; w++) {
+ var _ = b[w];
+ y.push(o(_))
+ }
+ return new a(null, null, n, r, l, d, f, g, v, y, null)
+ },
+ i = function(e) {
+ for (var n = [], r = 0; r < e.length; r++) {
+ for (var i = e[r], o = t[i[0]], a = [], s = 1, c = 1, u = i.length; 1 <= u ? c < u : u < c; s = 1 <= u ? ++c : --c) {
+ a.push(i[s])
+ };
+ o = new o(a.length ? a : null), n.push(o)
+ }
+ return n
+ },
+ o = function(e) {
+ var t = e.lastIndexOf("/"),
+ n = e.slice(0, t);
+ t = e.slice(t + 1);
+ return new RegExp(n, t)
+ },
+ a = (s.fromJSON = r, s);
+
+ function s(e, t, n, r, i, o, a, s, c, u, l) {
+ this.filename = e, this.name = t, this.instructions = n, this.scripts = r, this.localNames = i, this.localLength = o, this.guards = a, this.stackSize = s, this.strings = c, this.regexps = u, this.source = l
+ }
+ e.exports = a
+ }).call(this)
+ }, function(e, t, n) {
+ function r(e) {
+ return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
+ return typeof e
+ } : function(e) {
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
+ })(e)
+ }(function() {
+ var t, i, o = n(1).StopIteration,
+ a = n(0),
+ s = (a.defProp, a.hasProp),
+ c = (a = n(2), a.Fiber),
+ u = a.Scope,
+ l = a.WithScope,
+ d = (t = 0, function(e, n, r) {
+ var i;
+ return i = function(e) {
+ e && (this.args = e)
+ }, Object.defineProperty(i, "name", {
+ writable: !0,
+ value: e
+ }), i.prototype.id = t++, i.prototype.name = e, i.prototype.exec = n, i.prototype.calculateFactor = r || function() {
+ return 2
+ }, i
+ }),
+ f = (a = [new(i = function(e, t, n) {
+ return d(e, t, n)
+ })("", (function(e, t, n) {
+ return y(e)
+ })), new i("", (function(e, t, n) {
+ return t.pop()
+ })), new i("", (function(e, t, n) {
+ return t.push(t.top())
+ })), new i("", (function(e, t, n) {
+ var r = t.pop(),
+ i = t.pop();
+ return t.push(r), t.push(i)
+ })), new i("", (function(e, t, n) {
+ return e.fiber.rv = t.pop(), y(e)
+ })), new i("", (function(e, t) {
+ return e.paused = !0
+ })), new i("", (function(e, t) {
+ return e.fiber.yielded = t.pop(), e.fiber.pause()
+ })), new i("", (function(e, t, n) {
+ return b(e, t.pop())
+ })), new i("", (function(e) {
+ return e.guards.push(e.script.guards[this.args[0]])
+ })), new i("", (function(e) {
+ var t = e.guards[e.guards.length - 1];
+ if (e.script.guards[this.args[0]] === t) return e.guards.pop()
+ })), new i("", (function(e, t, n) {
+ return e.fiber.r1 = t.pop()
+ })), new i("", (function(e, t, n) {
+ return e.fiber.r2 = t.pop()
+ })), new i("", (function(e, t, n) {
+ return e.fiber.r3 = t.pop()
+ })), new i("", (function(e, t, n) {
+ return t.push(e.fiber.r1)
+ })), new i("", (function(e, t, n) {
+ return t.push(e.fiber.r2)
+ })), new i("", (function(e, t, n) {
+ return t.push(e.fiber.r3)
+ })), new i("", (function(e, t, n) {
+ return t.fiber.rexp = t.pop()
+ })), new i("", (function(e, t, n) {
+ return f(e, 0, "iterator", t.pop())
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.enumerateKeys(t.pop()))
+ })), new i("", (function(e, t, n) {
+ if (f(e, 0, "next", t.pop()), e.error instanceof o) return e.error = null, e.paused = !1, e.ip = this.args[0]
+ })), new i("", (function(e, t, n) {
+ if (n.set(1, t.pop()), t = t.pop(), this.args[0]) return n.set(2, t)
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.global)
+ })), new i("", (function(e, t, n, r) {
+ var i = this.args[0],
+ o = this.args[1],
+ a = n.get(1);
+ if (i < a.length) return n.set(o, Array.prototype.slice.call(a, i))
+ })), new i("", (function(e, t, n) {
+ return p(e, this.args[0], t.pop(), null, null, !0)
+ })), new i("", (function(e, t, n) {
+ return p(e, this.args[0], t.pop(), null, this.args[1])
+ })), new i("", (function(e, t, n) {
+ return f(e, this.args[0], t.pop(), t.pop(), this.args[1])
+ })), new i("", (function(e, t, n, r) {
+ var i = t.pop(),
+ o = t.pop();
+ return null == i ? b(e, new Error("Cannot read property '" + o + "' of " + i)) : t.push(r.get(i, o))
+ })), new i("", (function(e, t, n, r) {
+ var i = t.pop(),
+ o = t.pop(),
+ a = t.pop();
+ return null == i ? b(e, new Error("Cannot set property '" + o + "' of " + i)) : t.push(r.set(i, o, a))
+ })), new i("", (function(e, t, n, r) {
+ var i = t.pop(),
+ o = t.pop();
+ return null == i ? b(e, new Error("Cannot convert null to object")) : t.push(r.del(i, o))
+ })), new i("", (function(e, t, n) {
+ for (var r = this.args[0], i = this.args[1], o = n; r--;) o = o.parent;
+ return t.push(o.get(i))
+ })), new i("", (function(e, t, n) {
+ for (var r = this.args[0], i = this.args[1], o = n; r--;) o = o.parent;
+ return t.push(o.set(i, t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ for (var i, o = this.args[0]; n instanceof l;) {
+ if (n.has(o)) return t.push(n.get(o));
+ n = n.parent
+ }
+ for (; n instanceof u;) {
+ if (0 <= (i = n.name(o))) return t.push(n.get(i));
+ n = n.parent
+ }
+ return s(r.global, o) || this.args[1] ? t.push(r.global[o]) : b(e, new Error(o + " is not defined"))
+ })), new i("", (function(e, t, n, r) {
+ for (var i, o = this.args[0], a = t.pop(); n instanceof l;) {
+ if (n.has(o)) return t.push(n.set(o, a));
+ n = n.parent
+ }
+ for (; n instanceof u;) {
+ if (0 <= (i = n.name(o))) return t.push(n.set(i, a));
+ n = n.parent
+ }
+ return t.push(r.global[o] = a)
+ })), new i("", (function(e, t, n, r) {
+ return s(r.global, this.args[0]) || this.args[1] ? t.push(r.global[this.args[0]]) : b(e, new Error(this.args[0] + " is not defined"))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.global[this.args[0]] = t.pop())
+ })), new i("", (function(e) {
+ return e.scope = new u(e.scope, e.script.localNames, e.script.localLength)
+ })), new i("", (function(e) {
+ return e.scope = e.scope.parent
+ })), new i("", (function(e, t) {
+ return e.scope = new l(e.scope, t.pop())
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.inv(t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.lnot(t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.not(t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.inc(t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.dec(t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.add(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.sub(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.mul(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.div(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.mod(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.shl(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.sar(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.shr(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.or(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.and(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.xor(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.ceq(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.cneq(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.cid(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.cnid(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.lt(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.lte(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.gt(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.gte(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.has(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, r) {
+ return t.push(r.instanceOf(t.pop(), t.pop()))
+ })), new i("", (function(e, t, n, i) {
+ return t.push(r(t.pop()))
+ })), new i("", (function(e, t) {
+ return t.pop(), t.push(void 0)
+ })), new i("", (function(e, t, n) {
+ return e.ip = this.args[0]
+ })), new i("", (function(e, t, n) {
+ if (t.pop()) return e.ip = this.args[0]
+ })), new i("", (function(e, t, n) {
+ if (!t.pop()) return e.ip = this.args[0]
+ })), new i("", (function(e, t) {
+ return t.push(void 0)
+ })), new i("", (function(e, t, n) {
+ return t.push(this.args[0])
+ })), new i("", (function(e, t, n) {
+ return t.push(e.script.strings[this.args[0]])
+ })), new i("", (function(e, t, n, r) {
+ return t.push(new RegExpProxy(e.script.regexps[this.args[0]], r))
+ })), new i("", (function(e, t, n, r) {
+ for (var i = this.args[0], o = {}; i--;) r.set(o, t.pop(), t.pop());
+ return t.push(o)
+ })), new i("", (function(e, t, n, r) {
+ for (var i = this.args[0], o = new Array(i); i--;) o[i] = t.pop();
+ return t.push(o)
+ })), new i("", (function(e, t, n, r) {
+ var i = this.args[0];
+ return t.push(h(e.script.scripts[i], n, r, this.args[1]))
+ })), new i("", (function(e) {
+ return e.setLine(this.args[0])
+ })), new i("", (function(e) {
+ return e.setColumn(this.args[0])
+ })), new i("", (function(e, t, n) {
+ return w()
+ }))], function(e, t, n, r, i) {
+ var o = e.evalStack,
+ a = e.realm;
+ if (null == r) return b(e, new Error("Cannot call method '" + n + "' of " + (void 0 === r ? "undefined" : "null")));
+ var s = r.constructor.name || "Object";
+ a = a.get(r, n);
+ return a instanceof Function ? p(e, t, a, r, i) : null == a ? (o.pop(), b(e, new Error("Object #<" + s + "> has no method '" + n + "'"))) : (o.pop(), b(e, new Error("Property '" + n + "' of object #<" + s + "> is not a function")))
+ }),
+ p = function(e, t, n, r, i, o) {
+ if ("function" != typeof n) return b(e, new Error("object is not a function"));
+ for (var a = e.evalStack, s = e.fiber, c = e.realm, u = {
+ length: t,
+ callee: n
+ }; t;) u[--t] = a.pop();
+ r = r || c.global, u = Array.prototype.slice.call(u);
+ try {
+ var l = o ? v(n, u) : n.apply(r, u);
+ if (!s.paused) return a.push(l)
+ } catch (f) {
+ b(e, f)
+ }
+ },
+ h = function(e, t, n, r) {
+ return function r() {
+ var i, o, a, s = !1;
+ if ((o = r.__fiber__) ? (o.callStack[o.depth].paused = !0, r.__fiber__ = null, i = r.__construct__, r.__construct__ = null) : (o = new c(n), s = !0), a = r.__callname__ || e.name, r.__callname__ = null, o.pushFrame(e, this, t, arguments, r, a, i), s) return o.run(), o.rv
+ }
+ },
+ m = function(e) {
+ return 1 === e.length && (0 | e[0]) === e[0] ? new Array(e[0]) : e.slice()
+ },
+ g = function(e) {
+ return 1 === e.length ? new RegExp(e[0]) : new RegExp(e[0], e[1])
+ },
+ v = function(e, t) {
+ var n;
+ return e === Array ? m(t) : e === Date ? new Date : e === RegExp ? g(t) : e === Number ? new Number(t[0]) : e === Boolean ? new Boolean(t[0]) : e === Uint8Array ? new Uint8Array(t[0]) : ((n = function() {
+ return e.apply(this, t)
+ }).prototype = e.prototype, new n)
+ },
+ y = function(e) {
+ return e.evalStack.clear(), e.exitIp = e.ip
+ },
+ b = function(e, t) {
+ return e.error = t, e.paused = !0
+ },
+ w = function() {};
+ e.exports = a
+ }).call(this)
+ }], e.c = n, e.d = function(t, n, r) {
+ e.o(t, n) || Object.defineProperty(t, n, {
+ enumerable: !0,
+ get: r
+ })
+ }, e.r = function(e) {
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
+ value: "Module"
+ }), Object.defineProperty(e, "__esModule", {
+ value: !0
+ })
+ }, e.t = function(t, n) {
+ if (1 & n && (t = e(t)), 8 & n) return t;
+ if (4 & n && "object" == typeof t && t && t.__esModule) return t;
+ var r = Object.create(null);
+ if (e.r(r), Object.defineProperty(r, "default", {
+ enumerable: !0,
+ value: t
+ }), 2 & n && "string" != typeof t)
+ for (var i in t) e.d(r, i, function(e) {
+ return t[e]
+ }.bind(null, i));
+ return r
+ }, e.n = function(t) {
+ var n = t && t.__esModule ? function() {
+ return t["default"]
+ } : function() {
+ return t
+ };
+ return e.d(n, "a", n), n
+ }, e.o = function(e, t) {
+ return Object.prototype.hasOwnProperty.call(e, t)
+ }, e.p = "", e(e.s = 3);
+
+ function e(r) {
+ if (n[r]) return n[r].exports;
+ var i = n[r] = {
+ i: r,
+ l: !1,
+ exports: {}
+ };
+ return t[r].call(i.exports, i, i.exports, e), i.l = !0, i.exports
+ }
+ var t, n
+ }))
+ },
+};
diff --git a/server/src/modules/tools/kwaiSign/kwaiSgin.service.ts b/server/src/modules/tools/kwaiSign/kwaiSgin.service.ts
new file mode 100644
index 00000000..893dc3c3
--- /dev/null
+++ b/server/src/modules/tools/kwaiSign/kwaiSgin.service.ts
@@ -0,0 +1,65 @@
+import { Injectable } from '@nestjs/common';
+// @ts-ignore
+import kuaiShosignCore from './kuaiShoSignCore.js';
+import qs from 'qs';
+import { createHash } from 'crypto';
+
+interface ISignParams {
+ json: Record<string, any>;
+ type: 'form-data' | 'json';
+}
+
+@Injectable()
+export class KwaiSginService {
+ exports: any = {};
+
+ constructor() {
+ const obj = {
+ exports: {},
+ id: 75407,
+ loaded: true,
+ };
+ kuaiShosignCore[75407](obj);
+ this.exports = obj.exports;
+ }
+
+ /**
+ * 输入:
+ * sign({
+ * url: '/rest/cp/creator/comment/report/menu',
+ * type: 'json',
+ * json: {
+ * 'kuaishou.web.cp.api_ph': '19af6d5b24cb170a03331ce9254b1204154c',
+ * },
+ * })
+ * 输出:
+ * /rest/cp/creator/comment/report/menu?__NS_sig3=4656112138efc7727e1b18193ee992f9c3278f63070705050a0b0812
+ * @param params
+ */
+ sign(params: ISignParams): Promise<string> {
+ return new Promise(async (resolve, reject) => {
+ const md5 = this.md5(params);
+ console.log('md5:', md5);
+
+ this.exports.realm.global['$encode'](md5, {
+ suc(s: string) {
+ resolve(`${s}`);
+ },
+ err(e: string) {
+ console.error('签名失败:', e);
+ reject(e);
+ },
+ });
+ });
+ }
+
+ private md5({ json, type }: ISignParams) {
+ let str = '';
+ if (type === 'form-data') {
+ str = qs.stringify(json);
+ } else {
+ str = JSON.stringify(json);
+ }
+ return createHash('md5').update(str).digest('hex');
+ }
+}
diff --git a/server/src/modules/tools/realAuth.service.ts b/server/src/modules/tools/realAuth.service.ts
new file mode 100644
index 00000000..82801cec
--- /dev/null
+++ b/server/src/modules/tools/realAuth.service.ts
@@ -0,0 +1,56 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2025-04-27 14:06:39
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { RealAuth, SceneType } from 'src/db/schema/realAuth.schema';
+import { AlicloudRealAuthService } from 'src/lib/realAuth/realAuth.service';
+
+@Injectable()
+export class RealAuthService {
+ constructor(
+ @InjectModel(RealAuth.name) private realAuthModel: Model<RealAuth>,
+ private readonly alicloudRealAuthService: AlicloudRealAuthService,
+ ) {}
+
+ /**
+ * 身份号认证
+ * @param identifyNum
+ * @param userName
+ */
+ async realNameAuth(
+ userId: string,
+ identifyNum: string,
+ userName: string,
+ sceneType?: SceneType,
+ ): Promise<boolean> {
+ const result = await this.realAuthModel.findOne({
+ identifyNum,
+ userName,
+ });
+ if (!!result) return true;
+
+ const res = await this.alicloudRealAuthService.realNameAuth(
+ identifyNum,
+ userName,
+ );
+
+ if (res) {
+ const realAuth = new this.realAuthModel({
+ userId: '1',
+ identifyNum,
+ userName,
+ sceneType,
+ });
+ realAuth.save();
+ }
+
+ console.log('-----', res);
+ return res;
+ }
+}
diff --git a/server/src/modules/tools/tools.controller.ts b/server/src/modules/tools/tools.controller.ts
new file mode 100644
index 00000000..8ae84153
--- /dev/null
+++ b/server/src/modules/tools/tools.controller.ts
@@ -0,0 +1,50 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2024-12-23 12:45:22
+ * @LastEditors: nevin
+ * @Description: 通用工具
+ */
+import { Body, Controller, Post } from '@nestjs/common';
+import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { TmsService } from 'src/lib/tms/tms.service';
+import { KwaiSignDto, TextModerationDto } from './dto/tools.dto';
+import { KwaiSginService } from './kwaiSign/kwaiSgin.service';
+import { Public } from '../../auth/auth.guard';
+
+@ApiTags('通用工具')
+@Controller('tools/common')
+export class ToolsController {
+ constructor(
+ private readonly tmsService: TmsService,
+ private readonly kwaiSginService: KwaiSginService,
+ ) {}
+
+ @ApiOperation({
+ summary: '内容安全检测',
+ description: '内容安全检测',
+ })
+ @ApiResponse({
+ description: '是否通过检测',
+ type: Boolean,
+ })
+ @Post('text/moderation')
+ async textModeration(
+ @Body(new ParamsValidationPipe()) body: TextModerationDto,
+ ) {
+ const res = await this.tmsService.textModeration(body.content);
+ return res;
+ }
+
+ @ApiOperation({
+ summary: '快手签名',
+ description:
+ '快手签名,注意,json中必须要有 ‘kuaishou.web.cp.api_ph’ 字段,此字段是从cookie获取的,type为 form-data 或 json',
+ })
+ @Public()
+ @Post('kwaiSign')
+ async kwaiSignCore(@Body(new ParamsValidationPipe()) body: KwaiSignDto) {
+ return await this.kwaiSginService.sign(body);
+ }
+}
diff --git a/server/src/modules/tools/tools.module.ts b/server/src/modules/tools/tools.module.ts
new file mode 100644
index 00000000..8d6f7b20
--- /dev/null
+++ b/server/src/modules/tools/tools.module.ts
@@ -0,0 +1,31 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:07
+ * @LastEditTime: 2024-09-05 15:18:26
+ * @LastEditors: nevin
+ * @Description: 工具箱模块
+ */
+import { Global, Module } from '@nestjs/common';
+import { AiToolsController } from './ai.controller';
+import { AiToolsService } from './ai.service';
+import { RealAuthModule } from 'src/lib/realAuth/realAuth.module';
+import { MongooseModule } from '@nestjs/mongoose';
+import { RealAuth, RealAuthSchema } from 'src/db/schema/realAuth.schema';
+import { RealAuthService } from './realAuth.service';
+import { ToolsController } from './tools.controller';
+import { AiToolsAdminController } from './aiAdmin.controller';
+import { KwaiSginService } from "./kwaiSign/kwaiSgin.service";
+
+@Global()
+@Module({
+ imports: [
+ MongooseModule.forFeature([
+ { name: RealAuth.name, schema: RealAuthSchema },
+ ]),
+ RealAuthModule,
+ ],
+ controllers: [AiToolsController, ToolsController, AiToolsAdminController],
+ providers: [AiToolsService, RealAuthService, KwaiSginService],
+ exports: [AiToolsService, RealAuthService],
+})
+export class ToolsModule {}
diff --git a/server/src/modules/tracing/dto/tracing.dto.ts b/server/src/modules/tracing/dto/tracing.dto.ts
new file mode 100644
index 00000000..562130fd
--- /dev/null
+++ b/server/src/modules/tracing/dto/tracing.dto.ts
@@ -0,0 +1,67 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-08-19 15:58:47
+ * @LastEditTime: 2025-05-06 14:10:37
+ * @LastEditors: nevin
+ * @Description: 跟踪
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import {
+ ArrayMaxSize,
+ ArrayMinSize,
+ IsArray,
+ IsDateString,
+ IsEnum,
+ IsNumber,
+ IsOptional,
+ IsString,
+} from 'class-validator';
+import { TracingType } from 'src/db/schema/tracing.schema';
+
+export class CreateTracingDto {
+ @ApiProperty({ title: '类型', required: true })
+ @IsEnum(TracingType, { message: '类型' })
+ @Expose()
+ readonly type: TracingType;
+
+ @ApiProperty({ title: 'Tag', required: true })
+ @IsString({ message: 'Tag' })
+ @Expose()
+ readonly tag: string;
+
+ @ApiProperty({ title: '平台账号ID', required: false })
+ @IsNumber({ allowNaN: false }, { message: '平台账号ID' })
+ @IsOptional()
+ @Expose()
+ readonly accountId?: number;
+
+ @ApiProperty({ title: '描述', required: false })
+ @IsString({ message: '描述' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+
+ @ApiProperty({ title: '关联数据ID', required: false })
+ @IsString({ message: '关联数据ID' })
+ @IsOptional()
+ @Expose()
+ readonly dataId?: string;
+
+ // 任意类型的数据
+ @ApiProperty({ title: '数据', required: false })
+ @IsOptional()
+ @Expose()
+ readonly data?: any;
+}
+
+export class TracingTimeDto {
+ @ApiProperty({ title: '创建时间区间', required: false })
+ @IsArray({ message: '创建时间区间必须是一个数组' })
+ @ArrayMinSize(2, { message: '创建时间区间必须包含两个日期' })
+ @ArrayMaxSize(2, { message: '创建时间区间必须包含两个日期' })
+ @IsDateString({}, { each: true })
+ @IsOptional()
+ @Expose()
+ readonly time?: [Date, Date];
+}
diff --git a/server/src/modules/tracing/tracing.controller.ts b/server/src/modules/tracing/tracing.controller.ts
new file mode 100644
index 00000000..bb8890b2
--- /dev/null
+++ b/server/src/modules/tracing/tracing.controller.ts
@@ -0,0 +1,33 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2024-12-23 12:45:22
+ * @LastEditors: nevin
+ * @Description: Tracing tracing
+ */
+import { Body, Controller, Post } from '@nestjs/common';
+import { ApiResponse, ApiTags } from '@nestjs/swagger';
+import { ParamsValidationPipe } from 'src/validation.pipe';
+import { CreateTracingDto } from './dto/tracing.dto';
+import { TracingService } from './tracing.service';
+import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
+import { GetToken } from 'src/auth/auth.guard';
+
+@ApiTags('跟踪模块')
+@Controller('tracing')
+export class TracingController {
+ constructor(private readonly tracingService: TracingService) {}
+
+ @ApiResponse({
+ description: '创建跟踪数据',
+ type: String,
+ })
+ @Post()
+ async createTracing(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: CreateTracingDto,
+ ) {
+ const res = await this.tracingService.create({ ...body, userId: token.id });
+ return res;
+ }
+}
diff --git a/server/src/modules/tracing/tracing.module.ts b/server/src/modules/tracing/tracing.module.ts
new file mode 100644
index 00000000..378ca876
--- /dev/null
+++ b/server/src/modules/tracing/tracing.module.ts
@@ -0,0 +1,23 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:07
+ * @LastEditTime: 2024-09-05 15:18:26
+ * @LastEditors: nevin
+ * @Description: 跟踪模块 tracing Tracing
+ */
+import { Global, Module } from '@nestjs/common';
+import { TracingController } from './tracing.controller';
+import { TracingService } from './tracing.service';
+import { MongooseModule } from '@nestjs/mongoose';
+import { Tracing, TracingSchema } from 'src/db/schema/tracing.schema';
+import { TracingAdminController } from './tracingAdmin.controller';
+
+@Global()
+@Module({
+ imports: [
+ MongooseModule.forFeature([{ name: Tracing.name, schema: TracingSchema }]),
+ ],
+ controllers: [TracingController, TracingAdminController],
+ providers: [TracingService],
+})
+export class TracingModule {}
diff --git a/server/src/modules/tracing/tracing.service.ts b/server/src/modules/tracing/tracing.service.ts
new file mode 100644
index 00000000..7d387f09
--- /dev/null
+++ b/server/src/modules/tracing/tracing.service.ts
@@ -0,0 +1,160 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2024-09-05 15:19:25
+ * @LastEditors: nevin
+ * @Description: Tracing tracing
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { Tracing } from 'src/db/schema/tracing.schema';
+
+export enum TracingTag {
+ AccountAdd = 'AccountAdd', // 账号添加
+ VideoPul = 'VideoPul', // 视频发布
+ OpenProjectUse = 'OpenProjectUse', // 开源项目调用
+}
+
+@Injectable()
+export class TracingService {
+ constructor(
+ @InjectModel(Tracing.name)
+ private readonly tracingModel: Model<Tracing>,
+ ) {}
+
+ async create(newData: Partial<Tracing>) {
+ return await this.tracingModel.create(newData);
+ }
+
+ /**
+ * 账号总数
+ * @param time
+ * @returns
+ */
+ async getTracingAccountCount() {
+ try {
+ const result = await this.tracingModel.aggregate([
+ {
+ $match: {
+ tag: TracingTag.AccountAdd,
+ },
+ },
+ {
+ $group: {
+ _id: '$accountId', // 按账号ID
+ },
+ },
+ {
+ $count: 'total', // 统计分组数量
+ },
+ ]);
+
+ return result.length > 0 ? result[0].total : 0;
+ } catch (error) {
+ console.error('Error counting documents:', error);
+ return 0;
+ }
+ }
+
+ /**
+ * 时间段内发视频的用户总数
+ * @param time
+ * @returns
+ */
+ async getTracingVideoUserCount(time?: [Date, Date]) {
+ try {
+ const startTime = time ? time[0] : new Date('2024-01-01');
+ const endTime = time ? time[1] : new Date();
+
+ const result = await this.tracingModel.aggregate([
+ {
+ $match: {
+ tag: TracingTag.VideoPul,
+ time: {
+ $gte: startTime,
+ $lte: endTime,
+ },
+ },
+ },
+ {
+ $group: {
+ _id: '$userId', // 按用户ID分组
+ },
+ },
+ {
+ $count: 'total', // 统计分组数量
+ },
+ ]);
+
+ return result.length > 0 ? result[0].total : 0;
+ } catch (error) {
+ console.error('Error counting documents:', error);
+ return 0;
+ }
+ }
+
+ /**
+ * 时间段内发视频的总数
+ * @param time
+ * @returns
+ */
+ async getTracingVideoCount(time?: [Date, Date]) {
+ try {
+ const startTime = time ? time[0] : new Date('2024-01-01');
+ const endTime = time ? time[1] : new Date();
+
+ const result = await this.tracingModel.aggregate([
+ {
+ $match: {
+ tag: TracingTag.VideoPul,
+ time: {
+ $gte: startTime,
+ $lte: endTime,
+ },
+ },
+ },
+ {
+ $count: 'total', // 统计文档数量
+ },
+ ]);
+
+ return result.length > 0 ? result[0].total : 0;
+ } catch (error) {
+ console.error('Error counting documents:', error);
+ return 0;
+ }
+ }
+
+ /**
+ * 时间段内开源项目调用总数
+ * @param time
+ * @returns
+ */
+ async getTracingOpenProjectCount(time?: [Date, Date]) {
+ try {
+ const startTime = time ? time[0] : new Date('2024-01-01');
+ const endTime = time ? time[1] : new Date();
+
+ const result = await this.tracingModel.aggregate([
+ {
+ $match: {
+ tag: TracingTag.OpenProjectUse,
+ time: {
+ $gte: startTime,
+ $lte: endTime,
+ },
+ },
+ },
+ {
+ $count: 'total', // 统计文档数量
+ },
+ ]);
+
+ return result.length > 0 ? result[0].total : 0;
+ } catch (error) {
+ console.error('Error counting documents:', error);
+ return 0;
+ }
+ }
+}
diff --git a/server/src/modules/tracing/tracingAdmin.controller.ts b/server/src/modules/tracing/tracingAdmin.controller.ts
new file mode 100644
index 00000000..4d7f62f5
--- /dev/null
+++ b/server/src/modules/tracing/tracingAdmin.controller.ts
@@ -0,0 +1,45 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-05-06 14:10:25
+ * @LastEditors: nevin
+ * @Description: Tracing tracing
+ */
+import { Body, Controller, Get, Post } from '@nestjs/common';
+import { TracingService } from './tracing.service';
+import { Manager } from 'src/auth/manager.guard';
+import { TracingTimeDto } from './dto/tracing.dto';
+
+@Manager()
+@Controller('admin/tracing')
+export class TracingAdminController {
+ constructor(private readonly tracingService: TracingService) {}
+
+ // 账号总数
+ @Get('count/account')
+ async getTracingAccountCount() {
+ const res = await this.tracingService.getTracingAccountCount();
+ return res;
+ }
+
+ // 时间段内发视频的用户总数
+ @Post('video/user/count')
+ async getTracingVideoUserCount(@Body() body: TracingTimeDto) {
+ const res = await this.tracingService.getTracingVideoUserCount(body.time);
+ return res;
+ }
+
+ // 时间段内发视频的总数
+ @Post('video/count')
+ async getTracingVideoCount(@Body() body: TracingTimeDto) {
+ const res = await this.tracingService.getTracingVideoCount(body.time);
+ return res;
+ }
+
+ // 时间段内开源项目调用总数
+ @Post('openProject/count')
+ async getTracingOpenProjectCount(@Body() body: TracingTimeDto) {
+ const res = await this.tracingService.getTracingOpenProjectCount(body.time);
+ return res;
+ }
+}
diff --git a/server/src/user/class/user.class.ts b/server/src/user/class/user.class.ts
new file mode 100644
index 00000000..03c95a42
--- /dev/null
+++ b/server/src/user/class/user.class.ts
@@ -0,0 +1,51 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-28 11:00:39
+ * @LastEditTime: 2025-02-26 09:37:18
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { User } from '../../db/schema/user.schema';
+import { getRandomString } from '../../util';
+import { encryptPassword } from '../../util/password.util';
+import { WxInfo } from '../interfaces/wx-info.interface';
+
+export class NewUserByPassword extends User {
+ constructor(phone: string, inPassword: string) {
+ super();
+
+ this.name = `用户_${Date.now()}`;
+ this.phone = phone;
+ const { password, salt } = encryptPassword(inPassword);
+ this.password = password;
+ this.salt = salt;
+ }
+}
+
+export class NewUserByPhone extends User {
+ constructor(phone: string) {
+ super();
+ this.phone = phone;
+ this.name = `用户_${getRandomString(8)}`;
+ }
+}
+
+export class NewUserByMail extends User {
+ constructor(mail: string, inPassword: string) {
+ super();
+ this.mail = mail;
+ this.name = `用户_${getRandomString(8)}`;
+ const { password, salt } = encryptPassword(inPassword);
+ this.password = password;
+ this.salt = salt;
+ }
+}
+
+export class NewUserByWx extends User {
+ constructor(wxInfo: WxInfo) {
+ super();
+ this.wxOpenid = wxInfo.openid;
+ this.wxUnionid = wxInfo.unionid;
+ this.name = `用户_${getRandomString(8)}`;
+ }
+}
diff --git a/server/src/user/dto/login.dto.ts b/server/src/user/dto/login.dto.ts
new file mode 100644
index 00000000..ed0201d5
--- /dev/null
+++ b/server/src/user/dto/login.dto.ts
@@ -0,0 +1,64 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 20:12:31
+ * @LastEditTime: 2025-05-06 15:49:03
+ * @LastEditors: nevin
+ * @Description: 用户
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsEmail, IsOptional, IsString } from 'class-validator';
+
+export class MailLoginDto {
+ @ApiProperty({ title: '邮箱', required: true })
+ @IsEmail({}, { message: '邮箱' })
+ @Expose()
+ readonly mail: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '密码' })
+ @Expose()
+ readonly password: string;
+}
+
+export class MailRegistUrlDto {
+ @ApiProperty({ title: '邮箱', required: true })
+ @IsEmail({}, { message: '邮箱' })
+ @Expose()
+ readonly mail: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '验证码' })
+ @Expose()
+ readonly code: string;
+}
+
+export class GetRegistByMailBackDto {
+ @ApiProperty({ required: true })
+ @IsString({ message: '验证码' })
+ @Expose()
+ readonly code: string;
+
+ @ApiProperty({ title: '邮箱', required: true })
+ @IsEmail({}, { message: '邮箱' })
+ @Expose()
+ readonly mail: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '密码' })
+ @Expose()
+ readonly password: string;
+
+ @ApiProperty({ required: false })
+ @IsString({ message: '邀请码' })
+ @IsOptional()
+ @Expose()
+ readonly inviteCode?: string;
+}
+
+export class MailRepasswordDto {
+ @ApiProperty({ title: '邮箱', required: true })
+ @IsEmail({}, { message: '邮箱' })
+ @Expose()
+ readonly mail: string;
+}
diff --git a/server/src/user/dto/user-admin.dto.ts b/server/src/user/dto/user-admin.dto.ts
new file mode 100644
index 00000000..30129e93
--- /dev/null
+++ b/server/src/user/dto/user-admin.dto.ts
@@ -0,0 +1,27 @@
+import { ApiProperty } from '@nestjs/swagger';
+import { IsEnum, IsOptional, IsString } from 'class-validator';
+import { UserStatus } from '../../db/schema/user.schema';
+import { PagerDto } from '../../common/dto/pager.dto';
+
+export class QueryUserListDto extends PagerDto {
+ @ApiProperty({ description: '用户名', required: false })
+ @IsOptional()
+ @IsString()
+ name?: string;
+
+ @ApiProperty({ description: '手机号', required: false })
+ @IsOptional()
+ @IsString()
+ phone?: string;
+
+ @ApiProperty({ description: '状态', required: false, enum: UserStatus })
+ @IsOptional()
+ @IsEnum(UserStatus)
+ status?: UserStatus;
+}
+
+export class UpdateUserStatusDto {
+ @ApiProperty({ description: '状态', enum: UserStatus })
+ @IsEnum(UserStatus)
+ status: UserStatus;
+}
diff --git a/server/src/user/dto/user.dto.ts b/server/src/user/dto/user.dto.ts
new file mode 100644
index 00000000..df7f8237
--- /dev/null
+++ b/server/src/user/dto/user.dto.ts
@@ -0,0 +1,196 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 20:12:31
+ * @LastEditTime: 2025-05-06 15:49:03
+ * @LastEditors: nevin
+ * @Description: 用户
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose } from 'class-transformer';
+import { IsEnum, IsOptional, IsPhoneNumber, IsString } from 'class-validator';
+import { User } from '../../db/schema/user.schema';
+import { GenderEnum } from '../../global/enum/all.enum';
+
+export class WxLoginDto {
+ @ApiProperty({ title: '微信登录的code', required: true })
+ @IsString({ message: 'code' })
+ @Expose()
+ code: string;
+}
+
+export class PhoneDto {
+ @ApiProperty({ title: '手机号', required: true })
+ @IsPhoneNumber('CN', { message: '手机号' })
+ @Expose()
+ readonly phone: string;
+}
+
+export class LoginByPhoneDto {
+ @ApiProperty({ title: '手机号', required: true })
+ @IsPhoneNumber('CN', { message: '手机号' })
+ @Expose()
+ readonly phone: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '短信验证码' })
+ @Expose()
+ readonly code: string;
+}
+
+export class GetRegisterCodeDto {
+ @ApiProperty({ required: true })
+ @IsPhoneNumber('CN', { message: '手机号' })
+ @Expose()
+ readonly phone: string;
+}
+
+// 手机号注册
+export class PhoneRegisterDto {
+ @ApiProperty({ required: true, title: '短信验证码' })
+ @IsString({ message: '短信验证码' })
+ @Expose()
+ readonly code: string;
+
+ @ApiProperty({ required: true, title: '手机号' })
+ @IsPhoneNumber('CN', { message: '手机号' })
+ @Expose()
+ readonly phone: string;
+
+ @ApiProperty({ required: true, title: '密码' })
+ @IsString({ message: '密码' })
+ @Expose()
+ readonly password: string;
+}
+
+// 手机号验证码登录
+export class PhoneLoginByCodeDto {
+ @ApiProperty({ required: true })
+ @IsPhoneNumber('CN', { message: '手机号' })
+ @Expose()
+ readonly phone: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '短信验证码' })
+ @Expose()
+ readonly code: string;
+
+ @ApiProperty({ required: false })
+ @IsOptional()
+ @Expose()
+ readonly inviteCode?: string;
+}
+
+export class PhoneLoginByAuthDto {
+ @ApiProperty({ required: true })
+ @IsString({ message: '授权码' })
+ @Expose()
+ readonly accessToken: string;
+
+ @ApiProperty({ required: false })
+ @IsOptional()
+ @Expose()
+ readonly inviteCode?: string;
+}
+
+export class LoginByPasswordDto {
+ @ApiProperty({ title: '手机号', required: true })
+ @IsPhoneNumber('CN', { message: '手机号' })
+ @Expose()
+ readonly phone: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '密码' })
+ @Expose()
+ readonly password: string;
+}
+
+export class ChangePasswordDto {
+ @ApiProperty({ required: true })
+ @IsString({ message: '密码' })
+ @Expose()
+ readonly password: string;
+}
+
+export class UpdateUserInfoDto {
+ @ApiProperty({ title: '昵称' })
+ @IsString({ message: '昵称' })
+ @IsOptional()
+ @Expose()
+ readonly name?: string;
+
+ @ApiProperty({ title: '头像' })
+ @IsString({ message: '头像' })
+ @IsOptional()
+ @Expose()
+ avatar?: string;
+
+ @ApiProperty({ required: false, title: '性别' })
+ @IsEnum(GenderEnum, { message: '性别' })
+ @IsOptional()
+ @Expose()
+ readonly gender?: GenderEnum;
+
+ @ApiProperty({ title: '简介' })
+ @IsString({ message: '简介' })
+ @IsOptional()
+ @Expose()
+ readonly desc?: string;
+}
+
+export class UserResDto implements Partial<User> {
+ @ApiProperty({ title: '用户ID', required: true })
+ id: string;
+
+ @ApiProperty({ title: '用户名', required: true })
+ name: string;
+
+ @ApiProperty({ title: '手机号', required: true })
+ phone: string;
+
+ @ApiProperty({ title: '性别', enum: GenderEnum, required: false })
+ gender?: GenderEnum;
+
+ @ApiProperty({ title: '头像图片链接', required: false })
+ avatar?: string;
+
+ @ApiProperty({ title: '简介', required: false })
+ desc?: string;
+}
+
+export class PhoneRegisterResDto {
+ @ApiProperty({ title: '用户信息', required: true })
+ userInfo: UserResDto;
+
+ @ApiProperty({ title: '登录的Ttoken信息', required: true })
+ token: string = 'Beare sss';
+}
+
+export class SetWxInfoDto {
+ @ApiProperty({ required: true })
+ @IsString({ message: '微信授权码' })
+ @Expose()
+ readonly code: string;
+}
+
+// 手机号验证码登录
+export class PhoneLoginByGzhDto {
+ @ApiProperty({ required: true })
+ @IsPhoneNumber('CN', { message: '手机号' })
+ @Expose()
+ readonly phone: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '短信验证码' })
+ @Expose()
+ readonly code: string;
+
+ @ApiProperty({ required: true })
+ @IsString({ message: '二维码票据' })
+ @Expose()
+ readonly openId: string;
+
+ @ApiProperty({ required: false })
+ @IsOptional()
+ @Expose()
+ readonly inviteCode?: string;
+}
diff --git a/server/src/user/dto/userConfig.dto.ts b/server/src/user/dto/userConfig.dto.ts
new file mode 100644
index 00000000..c8d98ef8
--- /dev/null
+++ b/server/src/user/dto/userConfig.dto.ts
@@ -0,0 +1,25 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 20:12:31
+ * @LastEditTime: 2025-05-06 15:49:03
+ * @LastEditors: nevin
+ * @Description: 用户
+ */
+import { ApiProperty } from '@nestjs/swagger';
+import { Expose, Type } from 'class-transformer';
+import { IsNumber, IsEnum } from 'class-validator';
+import { EarnInfoStatus } from 'src/db/schema/user.schema';
+
+export class SetUserEarnDto {
+ @ApiProperty({ required: true })
+ @IsEnum(EarnInfoStatus, { message: '状态' })
+ @Type(() => Number)
+ @Expose()
+ readonly status: EarnInfoStatus;
+
+ @ApiProperty({ title: '循环时间', required: true })
+ @IsNumber({}, { message: '循环时间' })
+ @Type(() => Number)
+ @Expose()
+ readonly cycleInterval: number;
+}
diff --git a/server/src/user/interfaces/wx-info.interface.ts b/server/src/user/interfaces/wx-info.interface.ts
new file mode 100644
index 00000000..611146a3
--- /dev/null
+++ b/server/src/user/interfaces/wx-info.interface.ts
@@ -0,0 +1,4 @@
+export interface WxInfo {
+ openid: string;
+ unionid?: string;
+}
diff --git a/server/src/user/login.service.ts b/server/src/user/login.service.ts
new file mode 100644
index 00000000..699a6159
--- /dev/null
+++ b/server/src/user/login.service.ts
@@ -0,0 +1,103 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2025-02-06 13:44:23
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import { AppHttpException } from '../filters/http-exception.filter';
+import { ErrHttpBack } from '../filters/http-exception.back-code';
+import { RedisService } from '../lib/redis/redis.service';
+import { AlicloudSmsService } from '../lib/sms/alicloud-sms.service';
+import { getRandomString } from '../util';
+
+export enum LoginTypeCacheKey {
+ Password = 'phone_register_code',
+ Code = 'phone_login_code',
+ PhoneAuth = 'phone_login_auth_token', // 手机号一键登录
+}
+@Injectable()
+export class LoginService {
+ constructor(
+ private readonly redisService: RedisService,
+ private readonly alicloudSmsService: AlicloudSmsService,
+ ) {}
+
+ /**
+ * 发送手机号注册的验证码
+ * @param phone
+ */
+ async postPhoneRegisterCode(phone: string) {
+ const cacheKey = `${LoginTypeCacheKey.Password}:${phone}`;
+ let code = await this.redisService.get(cacheKey);
+ if (code) throw new AppHttpException(ErrHttpBack.err_user_code_had);
+
+ code = getRandomString(6, true);
+ const res = await this.alicloudSmsService.sendLoginSms(phone, code);
+
+ if (process.env.NODE_ENV === 'production') {
+ if (!res) throw new AppHttpException(ErrHttpBack.err_user_code_send_fail);
+ }
+
+ this.redisService.setKey(cacheKey, code, 60 * 5);
+ console.log('发送短信成功', code);
+
+ return process.env.NODE_ENV === 'production' ? res : code;
+ }
+
+ /**
+ * 发送手机号登录的验证码
+ * @param phone
+ */
+ async postPhoneLoginCode(phone: string) {
+ const cacheKey = `${LoginTypeCacheKey.Code}:${phone}`;
+ let code = await this.redisService.get(cacheKey);
+ if (code) throw new AppHttpException(ErrHttpBack.err_user_code_had);
+
+ code = getRandomString(6, true);
+
+ let res = false;
+ if (process.env.NODE_ENV === 'production') {
+ res = await this.alicloudSmsService.sendLoginSms(phone, code);
+
+ if (!res) throw new AppHttpException(ErrHttpBack.err_user_code_send_fail);
+ }
+
+ this.redisService.setKey(cacheKey, code, 60 * 5);
+ console.log('发送短信成功', code);
+
+ return process.env.NODE_ENV === 'production' ? res : code;
+ }
+
+ /**
+ * 发送手机号注册的验证码
+ * @param phone
+ * @param code
+ */
+ async verifyPhoneCode(
+ phone: string,
+ code: string,
+ key: LoginTypeCacheKey = LoginTypeCacheKey.Password,
+ ): Promise<boolean> {
+ const cacheKey = `${key}:${phone}`;
+ const oldCode = await this.redisService.get(cacheKey);
+ if (!oldCode) return false;
+
+ if (code === oldCode) {
+ this.redisService.del(cacheKey);
+ return true;
+ }
+
+ return false;
+ }
+
+ // 微信用户信息
+ async setWxUserInfo(userInfo: any) {
+ console.log('userInfo', userInfo);
+ }
+ // 支付宝用户信息
+ async setZfbUserInfo(userInfo: any) {
+ console.log('userInfo', userInfo);
+ }
+}
diff --git a/server/src/user/realAuth.service.ts b/server/src/user/realAuth.service.ts
new file mode 100644
index 00000000..3f11f739
--- /dev/null
+++ b/server/src/user/realAuth.service.ts
@@ -0,0 +1,23 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2025-03-03 14:05:25
+ * @LastEditors: nevin
+ * @Description: realAuth RealAuth
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { RealAuth } from 'src/db/schema/realAuth.schema';
+
+@Injectable()
+export class RealAuthService {
+ constructor(
+ @InjectModel(RealAuth.name)
+ private readonly realAuthModel: Model<RealAuth>,
+ ) {}
+
+ async getRealAuthModelByUserId(userId: string) {
+ return await this.realAuthModel.findOne({ userId });
+ }
+}
diff --git a/server/src/user/user-admin.controller.ts b/server/src/user/user-admin.controller.ts
new file mode 100644
index 00000000..80b476ba
--- /dev/null
+++ b/server/src/user/user-admin.controller.ts
@@ -0,0 +1,61 @@
+import {
+ Body,
+ Controller,
+ Delete,
+ Get,
+ Param,
+ Put,
+ Query,
+} from '@nestjs/common';
+import { UserService } from './user.service';
+import { QueryUserListDto, UpdateUserStatusDto } from './dto/user-admin.dto';
+import { AppHttpException } from '../filters/http-exception.filter';
+import { ErrHttpBack } from '../filters/http-exception.back-code';
+import { Manager } from '../auth/manager.guard';
+
+@Manager()
+@Controller('admin/user')
+export class UserAdminController {
+ constructor(private readonly userService: UserService) {}
+
+ // @ApiOperation({ summary: '获取用户列表' })
+ @Get('list')
+ async getUserList(@Query() query: QueryUserListDto) {
+ return this.userService.getUserList(query);
+ }
+
+ // @ApiOperation({ summary: '获取用户详情' })
+ @Get('info/:id')
+ async getUserDetail(@Param('id') id: string) {
+ const userInfo = await this.userService.getUserInfoById(id);
+ if (!userInfo) throw new AppHttpException(ErrHttpBack.err_user_no_had);
+ return userInfo;
+ }
+
+ // @ApiOperation({ summary: '更新用户状态' })
+ @Put(':id/status')
+ async updateUserStatus(
+ @Param('id') id: string,
+ @Body() body: UpdateUserStatusDto,
+ ) {
+ const userInfo = await this.userService.getUserInfoById(id);
+ if (!userInfo) throw new AppHttpException(ErrHttpBack.err_user_no_had);
+
+ return this.userService.updateUserStatus(id, body.status);
+ }
+
+ // 删除用户
+ @Delete(':id')
+ async deleteUser(@Param('id') id: string) {
+ const userInfo = await this.userService.getUserInfoById(id);
+ if (!userInfo) throw new AppHttpException(ErrHttpBack.err_user_no_had);
+
+ return this.userService.deleteUser(userInfo);
+ }
+
+ // 用户总数
+ @Get('count')
+ async getUserCount() {
+ return this.userService.getUserCount();
+ }
+}
diff --git a/server/src/user/user.comment.ts b/server/src/user/user.comment.ts
new file mode 100644
index 00000000..622a0896
--- /dev/null
+++ b/server/src/user/user.comment.ts
@@ -0,0 +1,10 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-15 14:32:41
+ * @LastEditTime: 2025-02-26 00:34:45
+ * @LastEditors: nevin
+ * @Description:
+ */
+export function getGzhLoginKey(Ticket: string, key: string) {
+ return `wxGzh:qrcode:${Ticket}:${key}`;
+}
diff --git a/server/src/user/user.controller.ts b/server/src/user/user.controller.ts
new file mode 100644
index 00000000..a0cd6949
--- /dev/null
+++ b/server/src/user/user.controller.ts
@@ -0,0 +1,88 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-05-06 15:50:54
+ * @LastEditors: nevin
+ * @Description: 用户路由
+ */
+import { Body, Controller, Delete, Get, Put } from '@nestjs/common';
+import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
+import { TokenInfo } from '../auth/interfaces/auth.interfaces';
+import { UpdateUserInfoDto, UserResDto, LoginByPhoneDto } from './dto/user.dto';
+import { UserService } from './user.service';
+import { ErrHttpBack } from '../filters/http-exception.back-code';
+import { AppHttpException } from '../filters/http-exception.filter';
+import { LoginService, LoginTypeCacheKey } from './login.service';
+import { GetToken } from '../auth/auth.guard';
+import { ParamsValidationPipe } from '../validation.pipe';
+import { RedisService } from 'src/lib/redis/redis.service';
+
+@ApiTags('user - 用户')
+@Controller('user')
+export class UserController {
+ constructor(
+ private readonly userService: UserService,
+ private readonly loginService: LoginService,
+ private readonly redisService: RedisService,
+ ) {}
+
+ @ApiOperation({
+ description: '获取自己的用户信息',
+ summary: '获取自己的用户信息',
+ })
+ @ApiResponse({ status: 200, type: UserResDto })
+ @Get('mine')
+ getUserInfoById(@GetToken() token: TokenInfo) {
+ return this.userService.getUserInfoById(token.id);
+ }
+
+ @ApiOperation({ description: '更新用户信息', summary: '更新用户信息' })
+ @ApiResponse({ status: 200, type: UserResDto })
+ @Put('info/update')
+ async updateInfo(
+ @GetToken() token: TokenInfo,
+ @Body(new ParamsValidationPipe()) body: UpdateUserInfoDto,
+ ) {
+ const userInfo = await this.userService.getUserInfoById(token.id);
+
+ for (const key in body) {
+ if (Object.prototype.hasOwnProperty.call(body, key)) {
+ userInfo[key] = body[key];
+ }
+ }
+
+ this.userService.updateUser(token.id, userInfo);
+ return userInfo;
+ }
+
+ @ApiOperation({ description: '用户注销', summary: '用户注销' })
+ @ApiResponse({ status: 200, type: UserResDto })
+ @Delete('del')
+ async del(@GetToken() token: TokenInfo) {
+ const userInfo = await this.userService.getUserInfoById(token.id);
+ if (!userInfo) throw new AppHttpException(ErrHttpBack.err_user_no_had);
+
+ const res = await this.userService.deleteUser(userInfo);
+ return res;
+ }
+
+ @ApiOperation({
+ summary: '用户更新自己的电话号码',
+ description: '和手机验证码登录使用同一个验证码',
+ })
+ @Put('updatePhone')
+ async updatePhone(
+ @GetToken() token: TokenInfo,
+ @Body() body: LoginByPhoneDto,
+ ) {
+ const { phone, code } = body;
+
+ const res = await this.loginService.verifyPhoneCode(
+ phone,
+ code,
+ LoginTypeCacheKey.Code,
+ );
+ if (!res) throw new AppHttpException(ErrHttpBack.err_user_code_nohad);
+ return await this.userService.updateUserPhone(token.id, phone);
+ }
+}
diff --git a/server/src/user/user.module.ts b/server/src/user/user.module.ts
new file mode 100644
index 00000000..99bde7f0
--- /dev/null
+++ b/server/src/user/user.module.ts
@@ -0,0 +1,48 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:07
+ * @LastEditTime: 2024-12-07 22:21:47
+ * @LastEditors: nevin
+ * @Description: 用户模块
+ */
+import { Global, Module } from '@nestjs/common';
+import { UserService } from './user.service';
+import { UserController } from './user.controller';
+import { LoginService } from './login.service';
+import { MongooseModule } from '@nestjs/mongoose';
+import { User, UserSchema } from '../db/schema/user.schema';
+import { WxModule } from '../lib/wx/wx.module';
+import { UserAdminController } from './user-admin.controller';
+import { WxGzhController } from './wxGzh.controller';
+import { PlatAuthModule } from 'src/lib/platAuth/platAuth.module';
+import { UserWallet, UserWalletSchema } from 'src/db/schema/userWallet.shema';
+import { UserPopController } from './userPop.controller';
+import { RealAuth, RealAuthSchema } from 'src/db/schema/realAuth.schema';
+import { RealAuthService } from './realAuth.service';
+import { UserConfigController } from './userConfig.controller';
+import { UserConfigService } from './userConfig.service';
+import { UserLoginController } from './userLogin.controller';
+
+@Global()
+@Module({
+ imports: [
+ PlatAuthModule,
+ MongooseModule.forFeature([
+ { name: User.name, schema: UserSchema },
+ { name: UserWallet.name, schema: UserWalletSchema },
+ { name: RealAuth.name, schema: RealAuthSchema },
+ ]),
+ WxModule,
+ ],
+ providers: [UserService, LoginService, RealAuthService, UserConfigService],
+ controllers: [
+ UserLoginController,
+ UserController,
+ UserAdminController,
+ WxGzhController,
+ UserPopController,
+ UserConfigController,
+ ],
+ exports: [UserService, MongooseModule],
+})
+export class UserModule {}
diff --git a/server/src/user/user.service.ts b/server/src/user/user.service.ts
new file mode 100644
index 00000000..02147a48
--- /dev/null
+++ b/server/src/user/user.service.ts
@@ -0,0 +1,282 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2025-03-03 14:05:25
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { User, UserStatus } from '../db/schema/user.schema';
+import { RedisService } from '../lib/redis/redis.service';
+import { QueryUserListDto } from './dto/user-admin.dto';
+import { paginateModel } from '../common/paginate/create-pagination';
+import { UserWallet } from 'src/db/schema/userWallet.shema';
+import * as crypto from 'node:crypto';
+import { RealAuthService } from './realAuth.service';
+
+@Injectable()
+export class UserService {
+ constructor(
+ private readonly redisService: RedisService,
+ private readonly realAuthService: RealAuthService,
+
+ @InjectModel(User.name)
+ private readonly userModel: Model<User>,
+
+ @InjectModel(UserWallet.name)
+ private readonly userWalletModel: Model<UserWallet>,
+ ) {}
+
+ async getUserInfoById(id: string) {
+ const key = `UserInfo:${id}`;
+ let userInfo: User = await this.redisService.get(key);
+ if (!!userInfo) return userInfo;
+
+ userInfo = await this.userModel.findById(id);
+ this.redisService.setKey(key, userInfo);
+ return userInfo;
+ }
+
+ async getUserInfoByPhone(phone: string) {
+ const userInfo: User = await this.userModel.findOne({
+ phone,
+ status: UserStatus.OPEN,
+ });
+ return userInfo;
+ }
+
+ async getUserInfoByMail(mail: string) {
+ const userInfo: User = await this.userModel.findOne({
+ mail,
+ status: UserStatus.OPEN,
+ });
+ return userInfo;
+ }
+
+ async getUserInfoByWxOpenId(wxOpenId: string) {
+ const userInfo: User = await this.userModel.findOne({
+ wxOpenid: wxOpenId,
+ status: UserStatus.OPEN,
+ });
+ return userInfo;
+ }
+
+ /**
+ * 创建用户
+ * @param newData
+ * @returns
+ */
+ async createUser(newData: User): Promise<User> {
+ const res = await this.userModel.create(newData);
+ return res;
+ }
+
+ // 更新
+ async updateUser(id: string, newData: User): Promise<User> {
+ const res = await this.userModel.findByIdAndUpdate(id, newData);
+ this.redisService.del(`UserInfo:${id}`);
+ return res;
+ }
+
+ // 更新密码
+ async updateUserPassword(
+ id: string,
+ newData: {
+ password: string;
+ salt: string;
+ },
+ ): Promise<0 | 1> {
+ const res = await this.userModel.updateOne(
+ { _id: id },
+ {
+ $set: {
+ password: newData.password,
+ salt: newData.salt,
+ },
+ },
+ );
+
+ this.redisService.del(`UserInfo:${id}`);
+ return res.modifiedCount > 0 ? 1 : 0;
+ }
+
+ // 用户注销
+ async deleteUser(userInfo: User): Promise<0 | 1> {
+ const res = await this.userModel.updateOne(
+ {
+ _id: userInfo.id,
+ },
+ {
+ $set: {
+ status: UserStatus.DELETE,
+ wxOpenid: '',
+ wxUnionid: '',
+ phone: '',
+ backData: {
+ wxOpenid: userInfo.wxOpenid,
+ wxUnionid: userInfo.wxUnionid,
+ phone: userInfo.phone,
+ },
+ },
+ },
+ );
+ this.redisService.del(`UserInfo:${userInfo.id}`);
+ return res.modifiedCount > 0 ? 1 : 0;
+ }
+
+ private getUserWalletInfo(userId: string) {
+ return this.userWalletModel.findOne({ userId });
+ }
+
+ /**
+ * 获取用户列表
+ */
+ async getUserList(query: QueryUserListDto) {
+ const { name, phone, status, field, order } = query;
+
+ const filter: any = {};
+ if (name) filter.name = new RegExp(name, 'i');
+ if (phone) filter.phone = new RegExp(phone, 'i');
+ if (status !== undefined) filter.status = status;
+
+ const sort: any = {};
+ if (field) {
+ sort[field] = order === 'DESC' ? -1 : 1;
+ } else {
+ sort.createdAt = -1; // 默认按创建时间倒序
+ }
+
+ const res = await paginateModel(
+ this.userModel,
+ query,
+ filter,
+ undefined, // populate options
+ sort,
+ );
+
+ const items = [];
+
+ for (const element of res.items) {
+ const walletInfo = await this.getUserWalletInfo(element.id);
+ const realAuthInfo = await this.realAuthService.getRealAuthModelByUserId(
+ element.id,
+ );
+
+ items.push({
+ id: element.id,
+ name: element.name,
+ phone: element.phone,
+ status: element.status,
+ createTime: element.createTime,
+ updateTime: element.updateTime,
+ wxOpenid: element.wxOpenid,
+ wxUnionid: element.wxUnionid,
+ balance: walletInfo?.balance || 0,
+ identifyNum: realAuthInfo?.identifyNum || '',
+ realName: realAuthInfo?.userName || '',
+ });
+ }
+
+ return {
+ items,
+ meta: res.meta,
+ };
+ }
+
+ /**
+ * 更新用户状态
+ */
+ async updateUserStatus(id: string, status: UserStatus): Promise<User> {
+ const res = await this.userModel.findByIdAndUpdate(
+ id,
+ { status },
+ { new: true },
+ );
+ this.redisService.del(`UserInfo:${id}`);
+ return res;
+ }
+
+ // 更新用户的电话号码
+ async updateUserPhone(id: string, phone: string): Promise<boolean> {
+ const res = await this.userModel.updateOne(
+ { _id: id },
+ { $set: { phone } },
+ );
+ this.redisService.del(`UserInfo:${id}`);
+ return res.modifiedCount > 0;
+ }
+
+ // 获取用户总数
+ async getUserCount() {
+ const count = await this.userModel.countDocuments();
+ return count;
+ }
+
+ /**
+ * 更新微信openID
+ */
+ async updateUserWxOpenId(id: string, openId: string): Promise<User> {
+ const res = await this.userModel.findByIdAndUpdate(
+ id,
+ { wxOpenid: openId },
+ { new: false },
+ );
+ this.redisService.del(`UserInfo:${id}`);
+ return res;
+ }
+
+ /**
+ * 生成推广码
+ * @param userId
+ * @param phone
+ * @returns
+ */
+ async generateUsePopularizeCode(userId: string, phone: string) {
+ // 先对手机号进行哈希处理
+ const phoneHash = crypto
+ .createHash('sha256')
+ .update(phone)
+ .digest('hex')
+ .substring(0, 16);
+
+ const combinedSalt = 'aitoearn' + phoneHash;
+
+ const hash = crypto
+ .createHash('sha256')
+ .update(userId)
+ .update(combinedSalt)
+ .digest('hex');
+
+ // 取部分哈希值转换为5位代码
+ const numericValue = parseInt(hash.substring(0, 6), 16);
+ const code = numericValue
+ .toString(36)
+ .slice(-5)
+ .toUpperCase()
+ .padStart(5, '0');
+
+ // 更新用户的推广码
+ await this.userModel.updateOne(
+ { _id: userId },
+ { $set: { popularizeCode: code } },
+ );
+ this.redisService.del(`UserInfo:${userId}`);
+
+ return code;
+ }
+
+ /**
+ * 根据推广码获取用户信息
+ * @param popularizeCode
+ * @returns
+ */
+ async getUserByPopularizeCode(popularizeCode: string): Promise<User> {
+ const userInfo: User = await this.userModel.findOne({
+ popularizeCode,
+ status: UserStatus.OPEN,
+ });
+ return userInfo;
+ }
+}
diff --git a/server/src/user/userConfig.controller.ts b/server/src/user/userConfig.controller.ts
new file mode 100644
index 00000000..8126a82a
--- /dev/null
+++ b/server/src/user/userConfig.controller.ts
@@ -0,0 +1,38 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-05-06 15:50:54
+ * @LastEditors: nevin
+ * @Description: 用户设置信息路由 config Config
+ */
+import { Body, Controller, Put } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { TokenInfo } from '../auth/interfaces/auth.interfaces';
+import { ErrHttpBack } from '../filters/http-exception.back-code';
+import { AppHttpException } from '../filters/http-exception.filter';
+import { GetToken } from '../auth/auth.guard';
+import { UserStatus } from 'src/db/schema/user.schema';
+import { UserConfigService } from './userConfig.service';
+import { UserService } from './user.service';
+import { SetUserEarnDto } from './dto/userConfig.dto';
+
+@ApiTags('用户自定义配置')
+@Controller('user/config')
+export class UserConfigController {
+ constructor(
+ private readonly userService: UserService,
+ private readonly userConfigService: UserConfigService,
+ ) {}
+
+ @ApiOperation({
+ summary: '设置自动赚钱配置',
+ })
+ @Put('earn')
+ async setUserEarnInfo(
+ @GetToken() token: TokenInfo,
+ @Body() body: SetUserEarnDto,
+ ) {
+ const res = await this.userConfigService.setUserEarnInfo(token.id, body);
+ return res;
+ }
+}
diff --git a/server/src/user/userConfig.service.ts b/server/src/user/userConfig.service.ts
new file mode 100644
index 00000000..e72ed257
--- /dev/null
+++ b/server/src/user/userConfig.service.ts
@@ -0,0 +1,29 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:15
+ * @LastEditTime: 2025-03-03 14:05:25
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { Injectable } from '@nestjs/common';
+import { InjectModel } from '@nestjs/mongoose';
+import { Model } from 'mongoose';
+import { User, UserEarnInfo } from '../db/schema/user.schema';
+import { RedisService } from 'src/lib/redis/redis.service';
+
+@Injectable()
+export class UserConfigService {
+ constructor(
+ private readonly redisService: RedisService,
+
+ @InjectModel(User.name)
+ private readonly userModel: Model<User>,
+ ) { }
+
+ // 更新用户的赚钱配置
+ async setUserEarnInfo(id: string, newData: UserEarnInfo): Promise<User> {
+ const res = await this.userModel.findByIdAndUpdate(id, { $set: { earnInfo: newData } });
+ this.redisService.del(`UserInfo:${id}`);
+ return res;
+ }
+}
diff --git a/server/src/user/userLogin.controller.ts b/server/src/user/userLogin.controller.ts
new file mode 100644
index 00000000..6b6f720f
--- /dev/null
+++ b/server/src/user/userLogin.controller.ts
@@ -0,0 +1,649 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-05-06 15:50:54
+ * @LastEditors: nevin
+ * @Description: 用户路由
+ */
+import { Body, Controller, Get, Post, Query } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { AuthService } from '../auth/auth.service';
+import { TokenInfo } from '../auth/interfaces/auth.interfaces';
+import {
+ GetRegisterCodeDto,
+ PhoneLoginByCodeDto,
+ PhoneLoginByAuthDto,
+ PhoneLoginByGzhDto,
+} from './dto/user.dto';
+import { UserService } from './user.service';
+import { ErrHttpBack } from '../filters/http-exception.back-code';
+import { AppHttpException } from '../filters/http-exception.filter';
+import { LoginService, LoginTypeCacheKey } from './login.service';
+import { User, UserStatus } from '../db/schema/user.schema';
+import { GetToken, Public } from '../auth/auth.guard';
+import { NewUserByMail, NewUserByPhone } from './class/user.class';
+import { ParamsValidationPipe } from '../validation.pipe';
+import { RedisService } from 'src/lib/redis/redis.service';
+import { getGzhLoginKey } from './user.comment';
+import { AlicloudPnsService } from 'src/lib/sms/alicloud-pns.service';
+import { PlatAuthWxGzhService } from 'src/lib/platAuth/wxGzh.service';
+import {
+ GetRegistByMailBackDto,
+ MailLoginDto,
+ MailRegistUrlDto,
+ MailRepasswordDto,
+} from './dto/login.dto';
+import { validatePassWord } from 'src/util/password.util';
+import { getRandomString } from 'src/util';
+import { MailService } from 'src/lib/mail/mail.service';
+
+@ApiTags('userLogin - 用户登录')
+@Controller('user/login')
+export class UserLoginController {
+ constructor(
+ private readonly userService: UserService,
+ private readonly authService: AuthService,
+ private readonly loginService: LoginService,
+ private readonly platAuthWxGzhService: PlatAuthWxGzhService,
+ private readonly redisService: RedisService,
+ private readonly mailService: MailService,
+ private readonly alicloudPnsService: AlicloudPnsService,
+ ) {}
+
+ @ApiOperation({
+ summary: '发送手机号的code',
+ description: '有无用户都可以',
+ })
+ @Public()
+ @Post('code')
+ async getLoginMsmCode(
+ @Body(new ParamsValidationPipe()) body: GetRegisterCodeDto,
+ ) {
+ const { phone } = body;
+
+ const res = await this.loginService.postPhoneLoginCode(phone);
+ return res;
+ }
+
+ @ApiOperation({
+ description: '手机号验证码登录',
+ summary: '手机号验证码登录',
+ })
+ @Public()
+ @Post('login/code/phone')
+ async loginByPhoneCode(
+ @Body(new ParamsValidationPipe()) loginInfo: PhoneLoginByCodeDto,
+ ) {
+ const { phone, code, inviteCode } = loginInfo;
+
+ // 邀请码验证
+ if (!!inviteCode) {
+ const inviteUserInfo =
+ await this.userService.getUserByPopularizeCode(inviteCode);
+ if (!inviteUserInfo)
+ throw new AppHttpException(ErrHttpBack.err_user_pop_code_null);
+ }
+
+ // 验证短信验证码
+ if (process.env.NODE_ENV !== 'development' && code !== 'yika888666') {
+ const res = await this.loginService.verifyPhoneCode(
+ phone,
+ code,
+ LoginTypeCacheKey.Code,
+ );
+ if (!res) throw new AppHttpException(ErrHttpBack.err_user_code_nohad);
+ }
+
+ let userInfo: User = await this.userService.getUserInfoByPhone(phone);
+ if (!userInfo) {
+ const newUser = new NewUserByPhone(phone);
+ if (!!inviteCode) newUser.inviteCode = inviteCode;
+ userInfo = await this.userService.createUser(newUser);
+ }
+
+ if (userInfo.status === UserStatus.STOP)
+ throw new AppHttpException(ErrHttpBack.err_no_power_login);
+
+ const token = await this.authService.generateToken(userInfo);
+ const TokenInfo = await this.authService.decodeToken(token);
+
+ return {
+ token,
+ exp: TokenInfo.exp,
+ userInfo: await this.userService.getUserInfoById(TokenInfo.id),
+ };
+ }
+
+ @ApiOperation({
+ description: '手机号一键认证登录',
+ summary: '手机号一键认证登录',
+ })
+ @Public()
+ @Post('login/auth/phone')
+ async loginByPhoneAuth(
+ @Body(new ParamsValidationPipe()) loginInfo: PhoneLoginByAuthDto,
+ ) {
+ const { accessToken, inviteCode } = loginInfo;
+ // 邀请码验证
+ if (!!inviteCode) {
+ const inviteUserInfo =
+ await this.userService.getUserByPopularizeCode(inviteCode);
+ if (!inviteUserInfo)
+ throw new AppHttpException(ErrHttpBack.err_user_pop_code_null);
+ }
+
+ const phone =
+ await this.alicloudPnsService.getOneKeyLoginPhone(accessToken);
+
+ let userInfo: User = await this.userService.getUserInfoByPhone(phone);
+ if (!userInfo) {
+ const newUser = new NewUserByPhone(phone);
+ if (!!inviteCode) newUser.inviteCode = inviteCode;
+ userInfo = await this.userService.createUser(newUser);
+ }
+
+ if (userInfo.status === UserStatus.STOP)
+ throw new AppHttpException(ErrHttpBack.err_no_power_login);
+
+ const token = await this.authService.generateToken(userInfo);
+ const TokenInfo = await this.authService.decodeToken(token);
+
+ return {
+ token,
+ exp: TokenInfo.exp,
+ userInfo: await this.userService.getUserInfoById(TokenInfo.id),
+ };
+ }
+
+ @ApiOperation({
+ description: '手机号一键认证登录',
+ summary: '手机号一键认证登录',
+ })
+ @Public()
+ @Post('test/login/auth/phone')
+ async loginByPhoneAuthTest(
+ @Body(new ParamsValidationPipe()) loginInfo: PhoneLoginByAuthDto,
+ ) {
+ const { accessToken } = loginInfo;
+ const phone =
+ await this.alicloudPnsService.getOneKeyLoginPhone(accessToken);
+
+ return {
+ phone,
+ };
+ }
+
+ @ApiOperation({ description: 'token刷新', summary: 'token刷新' })
+ @Post('token/refresh')
+ async refreshToken(@GetToken() token: TokenInfo) {
+ const userInfo = await this.userService.getUserInfoById(token.id);
+ if (userInfo.status === UserStatus.STOP)
+ throw new AppHttpException(ErrHttpBack.err_no_power_login);
+
+ const newToken = await this.authService.resetToken(token);
+ return {
+ token: newToken,
+ };
+ }
+
+ // ----------------- 微信公众号登录 -----------------
+ private setGzhLoginInfo(
+ ticket: string,
+ key: string,
+ data: {
+ phone: string;
+ openId: string;
+ token: string;
+ exp: number;
+ userInfo: User;
+ status: number;
+ },
+ ) {
+ this.redisService.setKey(getGzhLoginKey(ticket, key), data, 60 * 5);
+ }
+ private getGzhLoginInfo(ticket: string, key: string) {
+ return this.redisService.get(getGzhLoginKey(ticket, key));
+ }
+
+ @ApiOperation({
+ description: '获取微信公众号登录的二维码',
+ summary: '公众号',
+ })
+ @Public()
+ @Get('gzh/qrcode/get')
+ async getWxLoginQrcode() {
+ // ---- 直接使用微信 弃用 STR ----
+ // const key = uuidv4();
+ // const ticket = await this.wxGzhService.createQrcode(key);
+ // if (!ticket) throw new AppHttpException(ErrHttpBack.fail);
+ // ---- 直接使用微信 弃用 END ----
+
+ // 使用艺咖三方平台授权服务
+ const { ticket, key } = await this.platAuthWxGzhService.getWxLoginQrcode();
+
+ this.setGzhLoginInfo(ticket, key, {
+ token: '',
+ phone: '',
+ openId: '',
+ exp: 0,
+ userInfo: null,
+ status: 0,
+ });
+
+ return {
+ key,
+ ticket,
+ };
+ }
+
+ @ApiOperation({
+ description: '使用的是艺咖三方平台授权服务转发',
+ summary: '接收微信公众号返回的消息',
+ })
+ @Public()
+ @Post('gzh/msg/back')
+ async acceptMsgBack(
+ @Body()
+ body: {
+ FromUserName: string;
+ MsgType: 'text' | 'event';
+ Event?: 'subscribe' | 'SCAN';
+ EventKey?: string;
+ Ticket?: string;
+ },
+ ) {
+ const { FromUserName, MsgType, Ticket, EventKey, Event } = body;
+ if (MsgType !== 'event') return -1;
+ if (!Ticket) return -1;
+
+ let key = '';
+ if (Event === 'subscribe') key = EventKey.replace('qrscene_', '');
+ if (Event === 'SCAN') key = EventKey;
+
+ const userInfo: User =
+ await this.userService.getUserInfoByWxOpenId(FromUserName);
+
+ // 不存在,等待下一步
+ if (!userInfo) {
+ this.setGzhLoginInfo(Ticket, key, {
+ phone: '',
+ openId: FromUserName,
+ token: '',
+ exp: 60 * 5,
+ userInfo: null,
+ status: 0,
+ });
+
+ return '';
+ }
+
+ // 存在
+ if (userInfo.status === UserStatus.STOP) return -1;
+
+ // 存在,但是没有手机号
+ if (!userInfo.phone) {
+ this.setGzhLoginInfo(Ticket, key, {
+ phone: '',
+ openId: FromUserName,
+ token: '',
+ exp: 60 * 5,
+ userInfo: userInfo,
+ status: 0,
+ });
+
+ return '';
+ }
+
+ // openId, 手机号都有,返回登录成功
+ const token = await this.authService.generateToken(userInfo);
+ const TokenInfo = await this.authService.decodeToken(token);
+
+ const loginData = {
+ phone: userInfo.phone,
+ openId: FromUserName,
+ token,
+ exp: TokenInfo.exp,
+ userInfo: await this.userService.getUserInfoById(TokenInfo.id),
+ status: 1,
+ };
+ this.setGzhLoginInfo(Ticket, key, loginData);
+ return '';
+ }
+
+ @ApiOperation({
+ description: '微信公众号二维码登录',
+ summary: '轮询获取',
+ })
+ @Public()
+ @Post('gzh/qrcode/login')
+ async loginByWxQrcode(@Body() body: { ticket: string; key: string }) {
+ const { ticket, key } = body;
+
+ const value = await this.getGzhLoginInfo(ticket, key);
+
+ if (!value)
+ return {
+ phone: '',
+ openId: '',
+ token: '',
+ exp: 0,
+ userInfo: null,
+ status: -1,
+ };
+
+ return value;
+ }
+
+ @ApiOperation({
+ description: '手机号验证码登录',
+ summary: '手机号验证码登录',
+ })
+ @Public()
+ @Post('login/gzh/code/phone')
+ async loginByPhoneGzhQrcode(
+ @Body(new ParamsValidationPipe()) loginInfo: PhoneLoginByGzhDto,
+ ) {
+ const { phone, code, openId, inviteCode } = loginInfo;
+
+ // 邀请码验证
+ if (!!inviteCode) {
+ const inviteUserInfo =
+ await this.userService.getUserByPopularizeCode(inviteCode);
+ if (!inviteUserInfo)
+ throw new AppHttpException(ErrHttpBack.err_user_pop_code_null);
+ }
+
+ // 验证短信验证码
+ if (process.env.NODE_ENV !== 'development') {
+ const res = await this.loginService.verifyPhoneCode(
+ phone,
+ code,
+ LoginTypeCacheKey.Code,
+ );
+ if (!res) throw new AppHttpException(ErrHttpBack.err_user_code_nohad);
+ }
+
+ let userInfo: User = await this.userService.getUserInfoByPhone(phone);
+
+ // 没有进行创建
+ if (!userInfo) {
+ const newUser = new NewUserByPhone(phone);
+ newUser.wxOpenid = openId;
+ if (!!inviteCode) newUser.inviteCode = inviteCode;
+
+ userInfo = await this.userService.createUser(newUser);
+ }
+
+ if (userInfo.status === UserStatus.STOP)
+ throw new AppHttpException(ErrHttpBack.err_no_power_login);
+
+ // 有进行更新
+ const token = await this.authService.generateToken(userInfo);
+ const TokenInfo = await this.authService.decodeToken(token);
+
+ this.userService.updateUserWxOpenId(userInfo.id, openId);
+
+ return {
+ token,
+ exp: TokenInfo.exp,
+ userInfo: await this.userService.getUserInfoById(TokenInfo.id),
+ };
+ }
+
+ // ----------- 邮箱登录 ----------
+ @ApiOperation({
+ summary: '邮箱注册',
+ description: '邮箱注册',
+ })
+ @Public()
+ @Post('mail')
+ async loginByMail(@Body(new ParamsValidationPipe()) loginInfo: MailLoginDto) {
+ const { mail, password } = loginInfo;
+
+ const userInfo: User = await this.userService.getUserInfoByMail(mail);
+
+ if (!!userInfo && userInfo.status !== UserStatus.DELETE) {
+ if (userInfo.status === UserStatus.STOP)
+ throw new AppHttpException(ErrHttpBack.err_no_power_login);
+
+ // 校验密码
+ const isOk = validatePassWord(userInfo.password, userInfo.salt, password);
+ if (!isOk) throw new AppHttpException(ErrHttpBack.err_no_power_login);
+
+ const token = await this.authService.generateToken(userInfo);
+ const TokenInfo = await this.authService.decodeToken(token);
+
+ return {
+ type: 'login',
+ token,
+ exp: TokenInfo.exp,
+ userInfo: await this.userService.getUserInfoById(TokenInfo.id),
+ };
+ }
+
+ // 没有进行创建逻辑
+ const code = getRandomString(6, true);
+
+ this.redisService.setKey(
+ `userMailLogin:${code}`,
+ { mail: mail, status: 0 },
+ 60 * 5,
+ );
+
+ // 发验证码邮件,邮箱号和code
+ const mailRes = await this.mailService.sendEmail({
+ to: mail,
+ subject: 'aitoearn regist',
+ html: `<a href="https://api.aitoearn.cn/api/user/login/mail/regist/url?mail=${mail}&code=${code}">点击此处进行注册</a>`,
+ });
+
+ if (!mailRes) throw new AppHttpException(ErrHttpBack.err_mail_send_fail);
+
+ return {
+ type: 'regist',
+ code: code,
+ };
+ }
+
+ // TODO: 后期改成返回页面
+ @ApiOperation({
+ summary: '邮箱注册',
+ description: '用户点击链接后,进行注册',
+ })
+ @Public()
+ @Get('mail/regist/url')
+ async registByMail(
+ @Query(new ParamsValidationPipe()) query: MailRegistUrlDto,
+ ) {
+ const { mail, code } = query;
+
+ const res = await this.redisService.get(`userMailLogin:${code}`);
+ if (!res) {
+ return {
+ status: 0,
+ };
+ }
+
+ if (res.mail !== mail) {
+ return {
+ status: 0,
+ };
+ }
+
+ this.redisService.setKey(
+ `userMailLogin:${code}`,
+ { mail: mail, status: 1 },
+ 60 * 5,
+ );
+
+ return {
+ status: 1,
+ };
+ }
+
+ @ApiOperation({
+ summary: '获取邮箱注册返回',
+ description: '轮询获取',
+ })
+ @Public()
+ @Post('mail/regist/back')
+ async getRegistByMailBack(
+ @Body(new ParamsValidationPipe()) body: GetRegistByMailBackDto,
+ ) {
+ const { mail, code, inviteCode, password } = body;
+
+ const rData = await this.redisService.get(`userMailLogin:${code}`);
+ if (!rData) throw new AppHttpException(ErrHttpBack.err_user_code_nohad);
+
+ if (!rData.status) {
+ return {
+ token: '',
+ };
+ }
+
+ if (rData.mail !== mail)
+ throw new AppHttpException(ErrHttpBack.err_user_code_nohad);
+
+ if (!!inviteCode) {
+ const inviteUserInfo =
+ await this.userService.getUserByPopularizeCode(inviteCode);
+ if (!inviteUserInfo)
+ throw new AppHttpException(ErrHttpBack.err_user_pop_code_null);
+ }
+
+ // 创建新用户
+ const newUser = new NewUserByMail(mail, password);
+ if (!!inviteCode) newUser.inviteCode = inviteCode;
+ const userInfo = await this.userService.createUser(newUser);
+
+ const token = await this.authService.generateToken(userInfo);
+ const TokenInfo = await this.authService.decodeToken(token);
+
+ return {
+ token,
+ exp: TokenInfo.exp,
+ userInfo: await this.userService.getUserInfoById(TokenInfo.id),
+ };
+ }
+
+ @ApiOperation({
+ summary: '邮箱重置密码',
+ description: '邮箱重置密码',
+ })
+ @Public()
+ @Post('repassword/mail')
+ async repasswordByMail(
+ @Body(new ParamsValidationPipe()) body: MailRepasswordDto,
+ ) {
+ const { mail } = body;
+
+ const userInfo: User = await this.userService.getUserInfoByMail(mail);
+
+ if (!userInfo || userInfo.status === UserStatus.DELETE)
+ throw new AppHttpException(ErrHttpBack.err_user_had);
+
+ // 没有进行创建逻辑
+ const code = getRandomString(6, true);
+
+ this.redisService.setKey(
+ `userMailrepassword:${code}`,
+ { mail: mail, status: 0 },
+ 60 * 5,
+ );
+
+ // 发验证码邮件,邮箱号和code
+ const mailRes = await this.mailService.sendEmail({
+ to: mail,
+ subject: 'aitoearn repassword',
+ html: `<a href="https://api.aitoearn.cn/api/user/login/repassword/mail/back/url?mail=${mail}&code=${code}">点击此处进行重设</a>`,
+ });
+
+ if (!mailRes) throw new AppHttpException(ErrHttpBack.err_mail_send_fail);
+
+ return code;
+ }
+
+ // TODO: 后期改成返回页面
+ @ApiOperation({
+ summary: '邮箱重设密码',
+ description: '用户点击链接后,进行重设',
+ })
+ @Public()
+ @Get('repassword/mail/back/url')
+ async repasswordUrlByMail(
+ @Query(new ParamsValidationPipe()) query: MailRegistUrlDto,
+ ) {
+ const { mail, code } = query;
+
+ const res = await this.redisService.get(`userMailrepassword:${code}`);
+ if (!res) {
+ return {
+ status: 0,
+ };
+ }
+
+ if (res.mail !== mail) {
+ return {
+ status: 0,
+ };
+ }
+
+ this.redisService.setKey(
+ `userMailrepassword:${code}`,
+ { mail: mail, status: 1 },
+ 60 * 5,
+ );
+
+ return {
+ status: 1,
+ };
+ }
+
+ @ApiOperation({
+ summary: '邮箱重设密码',
+ description: '轮询获取',
+ })
+ @Public()
+ @Post('repassword/mail/back')
+ async getRepasswordByMailBack(
+ @Body(new ParamsValidationPipe()) body: GetRegistByMailBackDto,
+ ) {
+ const { mail, code, password } = body;
+
+ const rData: {
+ status: number;
+ mail: string;
+ } = await this.redisService.get(`userMailrepassword:${code}`);
+ if (!rData) throw new AppHttpException(ErrHttpBack.err_user_code_nohad);
+
+ if (rData.mail !== mail)
+ throw new AppHttpException(ErrHttpBack.err_user_code_nohad);
+
+ if (!rData.status) {
+ return {
+ token: '',
+ };
+ }
+
+ const userInfo = await this.userService.getUserInfoByMail(mail);
+ if (!userInfo || userInfo.status === UserStatus.DELETE)
+ throw new AppHttpException(ErrHttpBack.err_user_had);
+
+ const newUser = new NewUserByMail(mail, password);
+ const res = await this.userService.updateUserPassword(userInfo.id, {
+ password: newUser.password,
+ salt: newUser.salt,
+ });
+
+ if (!res) throw new AppHttpException(ErrHttpBack.fail);
+
+ const token = await this.authService.generateToken(userInfo);
+ const TokenInfo = await this.authService.decodeToken(token);
+
+ return {
+ token,
+ exp: TokenInfo.exp,
+ userInfo: await this.userService.getUserInfoById(TokenInfo.id),
+ };
+ }
+}
diff --git a/server/src/user/userPop.controller.ts b/server/src/user/userPop.controller.ts
new file mode 100644
index 00000000..128032a0
--- /dev/null
+++ b/server/src/user/userPop.controller.ts
@@ -0,0 +1,42 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-05-06 15:50:54
+ * @LastEditors: nevin
+ * @Description: 用户推广路由
+ */
+import { Controller, Get } from '@nestjs/common';
+import { ApiOperation, ApiTags } from '@nestjs/swagger';
+import { TokenInfo } from '../auth/interfaces/auth.interfaces';
+import { UserService } from './user.service';
+import { ErrHttpBack } from '../filters/http-exception.back-code';
+import { AppHttpException } from '../filters/http-exception.filter';
+import { GetToken } from '../auth/auth.guard';
+import { UserStatus } from 'src/db/schema/user.schema';
+
+@ApiTags('用户推广')
+@Controller('user/pop')
+export class UserPopController {
+ constructor(private readonly userService: UserService) {}
+
+ @ApiOperation({
+ summary: '生成并获取自己的推广码',
+ })
+ @Get('code')
+ async generateUsePopularizeCode(@GetToken() token: TokenInfo) {
+ const userInfo = await this.userService.getUserInfoById(token.id);
+ if (!userInfo) throw new AppHttpException(ErrHttpBack.err_user_no_had);
+ if (userInfo.status === UserStatus.STOP)
+ throw new AppHttpException(ErrHttpBack.err_no_power_login);
+
+ if (!!userInfo.popularizeCode) return userInfo.popularizeCode;
+
+ if (!token.phone)
+ throw new AppHttpException(ErrHttpBack.err_user_phone_null);
+ const res = await this.userService.generateUsePopularizeCode(
+ token.id,
+ token.phone,
+ );
+ return res;
+ }
+}
diff --git a/server/src/user/wxGzh.controller.ts b/server/src/user/wxGzh.controller.ts
new file mode 100644
index 00000000..abcca09b
--- /dev/null
+++ b/server/src/user/wxGzh.controller.ts
@@ -0,0 +1,128 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-06-17 19:19:20
+ * @LastEditTime: 2025-02-26 09:58:29
+ * @LastEditors: nevin
+ * @Description: 微信公众号事件接受
+ */
+import { Body, Controller, Get, Post, Query, UseGuards } from '@nestjs/common';
+import { Public } from 'src/auth/auth.guard';
+import { OrgGuard } from 'src/interceptor/transform.interceptor';
+import { WxGzhService } from 'src/lib/wx/wxGzh.service';
+import { RedisService } from 'src/lib/redis/redis.service';
+import { User, UserStatus } from 'src/db/schema/user.schema';
+import { UserService } from './user.service';
+import { NewUserByWx } from './class/user.class';
+import { AuthService } from 'src/auth/auth.service';
+import { getGzhLoginKey } from './user.comment';
+
+@Controller('wxGzh')
+export class WxGzhController {
+ constructor(
+ private readonly wxGzhService: WxGzhService,
+ private readonly userService: UserService,
+ private readonly authService: AuthService,
+ private readonly redisService: RedisService,
+ ) {}
+
+ @Public()
+ @UseGuards(OrgGuard)
+ @Get('msg')
+ async checkMsg(
+ @Query()
+ query: {
+ signature: string;
+ echostr: string;
+ timestamp: string;
+ nonce: string;
+ },
+ ) {
+ const res = await this.wxGzhService.checkCallback(query);
+ return res;
+ }
+
+ // 接收微信公众号的消息
+ // 消息(暂不处理)
+ // {
+ // ToUserName: 'gh_6fd6e64e6e8f',
+ // FromUserName: 'oPgBP7GGjJIlm3d2xxoIuUOG1iEs',
+ // CreateTime: '1740498823',
+ // MsgType: 'text',
+ // Content: 'Nih',
+ // MsgId: '24917948940934036'
+ // }
+
+ // 进行关注
+ // {
+ // ToUserName: 'gh_6fd6e64e6e8f',
+ // FromUserName: 'oPgBP7GGjJIlm3d2xxoIuUOG1iEs',
+ // CreateTime: '1740498747',
+ // MsgType: 'event',
+ // Event: 'subscribe',
+ // EventKey: 'qrscene_1',
+ // Ticket: 'gQG18TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAydUhSdTFsLTBkZkkxLTJ5NmhEMTYAAgQCqL1nAwSAOgkA'
+ // }
+
+ // 扫码
+ // {
+ // ToUserName: 'gh_6fd6e64e6e8f',
+ // FromUserName: 'oPgBP7GGjJIlm3d2xxoIuUOG1iEs',
+ // CreateTime: '1740498973',
+ // MsgType: 'event',
+ // Event: 'SCAN',
+ // EventKey: '1',
+ // Ticket: 'gQG18TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAydUhSdTFsLTBkZkkxLTJ5NmhEMTYAAgQCqL1nAwSAOgkA'
+ // }
+ @Public()
+ @UseGuards(OrgGuard)
+ @Post('msg')
+ async acceptMsg(
+ @Query()
+ query: {
+ signature: string;
+ timestamp: string;
+ nonce: string;
+ },
+ @Body()
+ body: {
+ FromUserName: string;
+ MsgType: 'text' | 'event';
+ Event?: 'subscribe' | 'SCAN';
+ EventKey?: string;
+ Ticket?: string;
+ },
+ ) {
+ console.log('------------ body', body);
+
+ const { FromUserName, MsgType, Ticket, EventKey, Event } = body;
+ if (MsgType !== 'event') return '';
+ if (!Ticket) return '';
+
+ let key = '';
+ if (Event === 'subscribe') key = EventKey.replace('qrscene_', '');
+ if (Event === 'SCAN') key = EventKey;
+
+ let userInfo: User =
+ await this.userService.getUserInfoByWxOpenId(FromUserName);
+
+ if (!userInfo) {
+ const newUser = new NewUserByWx({
+ openid: FromUserName,
+ });
+ userInfo = await this.userService.createUser(newUser);
+ }
+
+ if (userInfo.status === UserStatus.STOP) return '';
+
+ const token = await this.authService.generateToken(userInfo);
+ const TokenInfo = await this.authService.decodeToken(token);
+ const loginData = {
+ token,
+ exp: TokenInfo.exp,
+ userInfo: await this.userService.getUserInfoById(TokenInfo.id),
+ };
+
+ this.redisService.setKey(getGzhLoginKey(Ticket, key), loginData, 60 * 5);
+ return '';
+ }
+}
diff --git a/server/src/util/file.util.ts b/server/src/util/file.util.ts
new file mode 100644
index 00000000..726668f0
--- /dev/null
+++ b/server/src/util/file.util.ts
@@ -0,0 +1,73 @@
+import path from 'node:path';
+import * as fs from 'node:fs';
+
+enum Type {
+ IMAGE = '图片',
+ TXT = '文档',
+ MUSIC = '音乐',
+ VIDEO = '视频',
+ OTHER = '其他',
+}
+
+export function getFileType(extName: string) {
+ const documents = 'txt doc pdf ppt pps xlsx xls docx';
+ const music = 'mp3 wav wma mpa ram ra aac aif m4a';
+ const video = 'avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg';
+ const image =
+ 'bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg';
+ if (image.includes(extName)) return Type.IMAGE;
+
+ if (documents.includes(extName)) return Type.TXT;
+
+ if (music.includes(extName)) return Type.MUSIC;
+
+ if (video.includes(extName)) return Type.VIDEO;
+
+ return Type.OTHER;
+}
+
+export function getName(fileName: string) {
+ if (fileName.includes('.')) return fileName.split('.')[0];
+
+ return fileName;
+}
+
+export function getExtname(fileName: string) {
+ return path.extname(fileName).replace('.', '');
+}
+
+export function getSize(bytes: number, decimals = 2) {
+ if (bytes === 0) return '0 Bytes';
+
+ const k = 1024;
+ const dm = decimals < 0 ? 0 : decimals;
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
+
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+
+ return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
+}
+
+/**
+ * nodejs存储文件到本地
+ * @param base64String
+ * @param path
+ * @param fileName
+ * @returns
+ */
+export function saveFile(base64String: string, path: string, fileName: string) {
+ // 文件不存在则创建文件
+ if (!fs.existsSync(path)) {
+ fs.mkdirSync(path, { recursive: true });
+ }
+
+ return new Promise((resolve, reject) => {
+ fs.writeFile(path + fileName, base64String, 'base64', (err) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(true);
+ }
+ });
+ });
+}
diff --git a/server/src/util/index.ts b/server/src/util/index.ts
new file mode 100644
index 00000000..3285a478
--- /dev/null
+++ b/server/src/util/index.ts
@@ -0,0 +1,30 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-07-04 15:15:28
+ * @LastEditTime: 2024-11-26 18:39:44
+ * @LastEditors: nevin
+ * @Description: 工具
+ */
+
+/**
+ * 封装一个非阻塞的sleep函数,返回一个Promise对象。
+ * @param {number} milliseconds - 指定延迟的毫秒数。
+ * @returns {Promise<void>} - 一个Promise,将在指定延迟后resolve。
+ */
+export function sleep(milliseconds: number): Promise<void> {
+ return new Promise((resolve) => {
+ setTimeout(resolve, milliseconds);
+ });
+}
+
+// 封装一个获取随机的任意个数字或字母的字符串的函数
+export function getRandomString(length: number, onlyNum = false): string {
+ const chars = onlyNum
+ ? '1234567890'
+ : 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789';
+ let result = '';
+ for (let i = 0; i < length; i++) {
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
+ }
+ return result;
+}
diff --git a/server/src/util/ip.util.ts b/server/src/util/ip.util.ts
new file mode 100644
index 00000000..8fd6c4a3
--- /dev/null
+++ b/server/src/util/ip.util.ts
@@ -0,0 +1,60 @@
+import type { IncomingMessage } from 'node:http';
+/**
+ * @module utils/ip
+ * @description IP utility functions
+ */
+import axios from 'axios';
+
+/* 判断IP是不是内网 */
+function isLAN(ip: string) {
+ ip.toLowerCase();
+ if (ip === 'localhost') return true;
+ let a_ip = 0;
+ if (ip === '') return false;
+ const aNum = ip.split('.');
+ if (aNum.length !== 4) return false;
+ a_ip += Number.parseInt(aNum[0]) << 24;
+ a_ip += Number.parseInt(aNum[1]) << 16;
+ a_ip += Number.parseInt(aNum[2]) << 8;
+ a_ip += Number.parseInt(aNum[3]) << 0;
+ a_ip = (a_ip >> 16) & 0xffff;
+ return (
+ a_ip >> 8 === 0x7f ||
+ a_ip >> 8 === 0xa ||
+ a_ip === 0xc0a8 ||
+ (a_ip >= 0xac10 && a_ip <= 0xac1f)
+ );
+}
+
+export function getIp(request: IncomingMessage) {
+ const req = request as any;
+
+ let ip: string =
+ request.headers['x-forwarded-for'] ||
+ request.headers['X-Forwarded-For'] ||
+ request.headers['X-Real-IP'] ||
+ request.headers['x-real-ip'] ||
+ req?.ip ||
+ req?.raw?.connection?.remoteAddress ||
+ req?.raw?.socket?.remoteAddress ||
+ undefined;
+ if (ip && ip.split(',').length > 0) ip = ip.split(',')[0];
+
+ return ip;
+}
+
+export async function getIpAddress(ip: string) {
+ if (isLAN(ip)) return '内网IP';
+ try {
+ let { data } = await axios.get(
+ `https://whois.pconline.com.cn/ipJson.jsp?ip=${ip}&json=true`,
+ { responseType: 'arraybuffer' },
+ );
+ data = new TextDecoder('gbk').decode(data);
+ data = JSON.parse(data);
+ return data.addr.trim().split(' ').at(0);
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ } catch (error) {
+ return '第三方接口请求失败';
+ }
+}
diff --git a/server/src/util/is.util.ts b/server/src/util/is.util.ts
new file mode 100644
index 00000000..55354fd3
--- /dev/null
+++ b/server/src/util/is.util.ts
@@ -0,0 +1,4 @@
+/** 判断是否外链 */
+export function isExternal(path: string): boolean {
+ return /^(?:https?:|mailto:|tel:)/.test(path);
+}
diff --git a/server/src/util/list2tree.util.ts b/server/src/util/list2tree.util.ts
new file mode 100644
index 00000000..68ed6ae0
--- /dev/null
+++ b/server/src/util/list2tree.util.ts
@@ -0,0 +1,79 @@
+export type TreeNode<T = any> = T & {
+ id: number;
+ parentId: number;
+ children?: TreeNode<T>[];
+};
+
+export type ListNode<T extends object = any> = T & {
+ id: number;
+ parentId: number;
+};
+
+export function list2Tree<T extends ListNode[]>(
+ items: T,
+ parentId: number | null = null,
+): TreeNode<T[number]>[] {
+ return items
+ .filter((item) => item.parentId === parentId)
+ .map((item) => {
+ const children = list2Tree(items, item.id);
+ return {
+ ...item,
+ ...(children.length ? { children } : null),
+ };
+ });
+}
+
+/**
+ * 过滤树,返回列表数据
+ * @param treeData
+ * @param key 用于过滤的字段
+ * @param value 用于过滤的值
+ */
+export function filterTree2List(treeData, key, value) {
+ const filterChildrenTree = (resTree, treeItem) => {
+ if (treeItem[key].includes(value)) {
+ resTree.push(treeItem);
+ return resTree;
+ }
+ if (Array.isArray(treeItem.children)) {
+ const children = treeItem.children.reduce(filterChildrenTree, []);
+
+ const data = { ...treeItem, children };
+
+ if (children.length) resTree.push({ ...data });
+ }
+ return resTree;
+ };
+ return treeData.reduce(filterChildrenTree, []);
+}
+
+/**
+ * 过滤树,并保留原有的结构
+ * @param treeData
+ * @param predicate
+ */
+export function filterTree<T extends TreeNode>(
+ treeData: TreeNode<T>[],
+ predicate: (data: T) => boolean,
+): TreeNode<T>[] {
+ function filter(treeData: TreeNode<T>[]): TreeNode<T>[] {
+ if (!treeData?.length) return treeData;
+
+ return treeData.filter((data) => {
+ if (!predicate(data)) return false;
+
+ data.children = filter(data.children);
+ return true;
+ });
+ }
+
+ return filter(treeData) || [];
+}
+
+export function deleteEmptyChildren(arr: any) {
+ arr?.forEach((node) => {
+ if (node.children?.length === 0) delete node.children;
+ else deleteEmptyChildren(node.children);
+ });
+}
diff --git a/server/src/util/map.ts b/server/src/util/map.ts
new file mode 100644
index 00000000..37edcadc
--- /dev/null
+++ b/server/src/util/map.ts
@@ -0,0 +1,34 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-07-29 11:14:20
+ * @LastEditTime: 2024-07-29 11:17:33
+ * @LastEditors: nevin
+ * @Description: 地图
+ */
+export function isWithinMeters(
+ locus1: number[],
+ locus2: number[],
+ distanceInMeters: number, // 千米
+) {
+ const [lat1, lon1] = locus1;
+ const [lat2, lon2] = locus2;
+
+ const R = 6371; // 地球平均半径,单位为公里
+ const dLat = deg2rad(lat2 - lat1);
+ const dLon = deg2rad(lon2 - lon1);
+ const a =
+ Math.sin(dLat / 2) * Math.sin(dLat / 2) +
+ Math.cos(deg2rad(lat1)) *
+ Math.cos(deg2rad(lat2)) *
+ Math.sin(dLon / 2) *
+ Math.sin(dLon / 2);
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
+ const distance = R * c; // 距离,单位为公里
+
+ return distance <= distanceInMeters; // 判断距离是否小于等于500米
+}
+
+// 辅助函数,将角度转换为弧度
+function deg2rad(deg: number) {
+ return deg * (Math.PI / 180);
+}
diff --git a/server/src/util/password.util.ts b/server/src/util/password.util.ts
new file mode 100644
index 00000000..f8ca3dd1
--- /dev/null
+++ b/server/src/util/password.util.ts
@@ -0,0 +1,59 @@
+/*
+ * @Author: nevin
+ * @Date: 2022-01-21 09:50:47
+ * @LastEditors: nevin
+ * @LastEditTime: 2024-07-08 15:38:55
+ * @Description: 认证模块-加密工具
+ */
+import * as crypto from 'crypto';
+export interface Password {
+ password: string; // 密码
+ salt: string; // 盐
+}
+
+/**
+ * 生成随机盐
+ */
+function makeSalt(): string {
+ return crypto.randomBytes(3).toString('base64');
+}
+
+/**
+ * Encrypt password
+ * @param password 密码
+ * @param salt 密码盐
+ * @returns {
+ * password, // 加密的密码
+ * salt
+ * }
+ */
+export function encryptPassword(password: string, salt?: string): Password {
+ if (!password) return null;
+ salt = salt || makeSalt();
+
+ // 10000 代表迭代次数 16代表长度
+ password = crypto
+ .pbkdf2Sync(password, Buffer.from(salt, 'base64'), 10000, 16, 'sha1')
+ .toString('base64');
+ return {
+ password,
+ salt,
+ };
+}
+
+/**
+ * 校验用户信息
+ * @param userPassword 用户密码
+ * @param userSalt 盐值
+ * @param password 密码
+ * @returns
+ */
+export function validatePassWord(
+ userPassword: string,
+ userSalt: string,
+ password: string,
+): boolean {
+ // 通过密码盐,加密传参,再与数据库里的比较,判断是否相等
+ const { password: hashPassword } = encryptPassword(password, userSalt);
+ return userPassword === hashPassword;
+}
diff --git a/server/src/util/time.util.ts b/server/src/util/time.util.ts
new file mode 100644
index 00000000..caf6fb1e
--- /dev/null
+++ b/server/src/util/time.util.ts
@@ -0,0 +1,27 @@
+/*
+ * @Author: nevin
+ * @Date: 2024-07-22 17:57:25
+ * @LastEditTime: 2024-07-22 17:59:08
+ * @LastEditors: nevin
+ * @Description:
+ */
+// 获取今天的0点(午夜)时间
+export function getTodayMidnight(): Date {
+ const todayMidnight = new Date();
+ todayMidnight.setHours(0, 0, 0, 0);
+
+ return todayMidnight;
+}
+
+// 获取今天的24点(实际上是明天的0点)
+export function getTodayEnd(): Date {
+ const todayEnd = new Date();
+ todayEnd.setDate(todayEnd.getDate() + 1);
+ todayEnd.setHours(0, 0, 0, 0);
+ return todayEnd;
+}
+
+// 获取当前的秒级时间戳
+export function getCurrentTimestamp(): number {
+ return Math.floor(new Date().getTime() / 1000);
+}
diff --git a/server/src/validation.pipe.ts b/server/src/validation.pipe.ts
new file mode 100644
index 00000000..47cd8aa9
--- /dev/null
+++ b/server/src/validation.pipe.ts
@@ -0,0 +1,44 @@
+/*
+ * @Author: niuwenzheng
+ * @Date: 2020-04-14 15:29:18
+ * @LastEditors: nevin
+ * @LastEditTime: 2025-01-15 14:29:42
+ * @Description: 参数验证管道
+ */
+import {
+ PipeTransform,
+ Injectable,
+ ArgumentMetadata,
+ BadRequestException,
+} from '@nestjs/common';
+import { validateSync } from 'class-validator';
+import { plainToClass } from 'class-transformer';
+import * as _ from 'lodash';
+
+@Injectable()
+export class ParamsValidationPipe implements PipeTransform<any> {
+ private toValidate(metatype): boolean {
+ const types = [String, Boolean, Number, Array, Object];
+ return !types.includes(metatype);
+ }
+
+ async transform(value: any, { metatype }: ArgumentMetadata) {
+ if (!metatype || !this.toValidate(metatype)) return value;
+
+ // 数据转换成类
+ const inData: any = plainToClass(metatype, value, {
+ excludeExtraneousValues: true,
+ });
+
+ const errors = validateSync(inData, {
+ whitelist: true,
+ });
+
+ if (errors.length <= 0) return inData;
+ console.log('------ 参数验证失败:', _.values(errors[0].constraints)[0]);
+
+ throw new BadRequestException(
+ '参数验证失败: ' + _.values(errors[0].constraints)[0],
+ );
+ }
+}
diff --git a/server/src/views/google/index.hbs b/server/src/views/google/index.hbs
new file mode 100644
index 00000000..a65d717d
--- /dev/null
+++ b/server/src/views/google/index.hbs
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title></title>
+ </head>
+ <body>
+ {{!-- {{ message }}
+ access_token : {{ tokenDatas.access_token }}
+ <br>
+ refresh_token: {{ tokenDatas.refresh_token }}
+ <br>
+ expires_in: {{ tokenDatas.expires_in }} --}}
+
+ {{!-- {{ userInfo.id }} --}}
+ {{ message }}
+ <br>
+ {{ datas.data.accountInfo }}
+ {{ datas.data.userInfo }}
+ {{ datas.msg }}
+ </body>
+</html>
+
diff --git a/server/src/views/google/login.html b/server/src/views/google/login.html
new file mode 100644
index 00000000..f2a1ec27
--- /dev/null
+++ b/server/src/views/google/login.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+ <title>Google Login</title>
+ <style>
+ .google-btn {
+ background-color: white;
+ color: #444;
+ border: 1px solid #ccc;
+ font-size: 16px;
+ padding: 10px 20px;
+ cursor: pointer;
+ border-radius: 4px;
+ }
+ .google-btn:hover {
+ background-color: #f7f7f7;
+ }
+ </style>
+</head>
+<body>
+ <h2>登录</h2>
+ <button class="google-btn" onclick="handleGoogleLogin()">使用 Google 登录</button>
+
+ <script>
+ async function handleGoogleLogin() {
+ try {
+ const platform = 'google'; // 或 'android' / 'ios'
+ const url = `http://localhost:3000/api/plat/google/auth/login?platform=${encodeURIComponent(platform)}`;
+
+ const response = await fetch(url, {
+ method: 'GET',
+ });
+
+ if (!response.ok) {
+ throw new Error('请求失败: ' + response.statusText);
+ }
+
+ const data = await response.json();
+ console.log(data);
+ if (data.data) {
+ window.location.href = data.url; // 跳转到 Google OAuth URL
+ } else {
+ alert('未收到跳转地址');
+ }
+ } catch (error) {
+ console.error('登录出错:', error);
+ alert('登录失败,请重试');
+ }
+ }
+ </script>
+</body>
+</html>
diff --git a/server/startDev.sh b/server/startDev.sh
new file mode 100644
index 00000000..f3394be6
--- /dev/null
+++ b/server/startDev.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# 赋予执行权限:chmod +x startDev.sh
+# 运行:./start.sh
+
+# git切换到master分支
+git checkout dev
+
+# git拉取最新代码
+git pull
+
+# 安装依赖(如需自动安装)
+pnpm install
+
+# 构建项目
+pnpm build
+
+# 使用PM2启动应用
+pm2 start pm2.json
+
+echo "PM2 $APP_NAME 启动完成!"
+pm2 list
diff --git a/server/startPro.sh b/server/startPro.sh
new file mode 100644
index 00000000..3bc86222
--- /dev/null
+++ b/server/startPro.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# 赋予执行权限:chmod +x startDev.sh
+# 运行:./start.sh
+
+# git切换到master分支
+git checkout master
+
+# git拉取最新代码
+git pull
+
+# 安装依赖(如需自动安装)
+pnpm install
+
+# 构建项目
+pnpm build
+
+# 使用PM2启动应用
+pm2 start pm2.json --env production
+
+echo "PM2 $APP_NAME 启动完成!"
+pm2 list
diff --git a/server/test/agent.ts b/server/test/agent.ts
new file mode 100644
index 00000000..10a74817
--- /dev/null
+++ b/server/test/agent.ts
@@ -0,0 +1,27 @@
+import * as supertest from 'supertest';
+import { INestApplication } from '@nestjs/common';
+
+export class Agent {
+ private static _app: INestApplication;
+
+ private static _agent: supertest.Agent;
+
+ public static app(): INestApplication {
+ return Agent._app;
+ }
+
+ public static async initialize(app: INestApplication): Promise<void> {
+ Agent._app = app;
+
+ const agent = supertest.agent(Agent._app.getHttpServer());
+ Agent._agent = agent;
+ }
+
+ public static get() {
+ return Agent._agent;
+ }
+
+ public static login(token: string) {
+ this._agent.set('Authorization', `Bearer ${token}`);
+ }
+}
diff --git a/server/test/app.ts b/server/test/app.ts
new file mode 100644
index 00000000..5050d5de
--- /dev/null
+++ b/server/test/app.ts
@@ -0,0 +1,23 @@
+import { Test, TestingModule } from '@nestjs/testing';
+import { AppModule } from '../src/app.module';
+import { INestApplication } from '@nestjs/common';
+import { setupTestData } from './setupTestData';
+import { WeChatPayModule } from 'nest-wechatpay-node-v3';
+import { mockWxPayModule } from './mocks/wx.mock';
+
+export async function initApp(): Promise<INestApplication> {
+ const moduleFixture: TestingModule = await Test.createTestingModule({
+ imports: [AppModule],
+ })
+ .overrideModule(WeChatPayModule)
+ .useModule(mockWxPayModule.module)
+ .compile();
+
+ const app = moduleFixture.createNestApplication();
+ await app.init();
+
+ // 初始化测试数据
+ await setupTestData(app);
+
+ return app;
+}
diff --git a/server/test/each-setup-env.ts b/server/test/each-setup-env.ts
new file mode 100644
index 00000000..f7525d6d
--- /dev/null
+++ b/server/test/each-setup-env.ts
@@ -0,0 +1,23 @@
+import { Agent } from './agent';
+import { AuthService } from '../src/auth/auth.service';
+import { user } from './mockData';
+import { initApp } from './app';
+
+beforeAll(async () => {
+ const app = await initApp();
+
+ await Agent.initialize(app);
+
+ const authService = app.get(AuthService);
+ const token = await authService.generateToken({
+ id: user._id.toString(),
+ name: user.name,
+ phone: user.phone,
+ });
+
+ Agent.login(token);
+});
+
+afterAll(async () => {
+ await Agent.app().close();
+});
diff --git a/server/test/hot-topic/hot-topic.e2e-spec.ts b/server/test/hot-topic/hot-topic.e2e-spec.ts
new file mode 100644
index 00000000..9136e9c1
--- /dev/null
+++ b/server/test/hot-topic/hot-topic.e2e-spec.ts
@@ -0,0 +1,41 @@
+import supertest from 'supertest';
+import { Agent } from '../agent';
+import { platform, platform2 } from '../mockData';
+
+describe('HotTopicController (e2e)', () => {
+ let agent: supertest.Agent;
+
+ beforeAll(async () => {
+ agent = Agent.get();
+ });
+
+ describe('findAll', () => {
+ it('should return top 10 hot topics for each platform', async () => {
+ const result = await agent.get('/hot-topics/all').expect(200);
+
+ expect(Array.isArray(result.body.data)).toBe(true);
+
+ // 验证返回的数据结构
+ result.body.data.forEach(group => {
+ expect(group).toHaveProperty('platform');
+ expect(group).toHaveProperty('topics');
+ expect(Array.isArray(group.topics)).toBe(true);
+ expect(group.topics.length).toBeLessThanOrEqual(10);
+
+ // 验证每个平台的话题都正确分组
+ group.topics.forEach(topic => {
+ expect(topic.platformId._id.toString()).toBe(group.platform._id.toString());
+ });
+
+ // 验证每个平台内的话题按rank升序排序
+ const ranks = group.topics.map(topic => topic.rank);
+ expect(ranks).toEqual([...ranks].sort((a, b) => a - b));
+ });
+
+ // 验证包含所有有话题的平台
+ const platformIds = result.body.data.map(group => group.platform._id.toString());
+ expect(platformIds).toContain(platform._id.toString());
+ expect(platformIds).toContain(platform2._id.toString());
+ });
+ });
+});
diff --git a/server/test/jest-e2e.json b/server/test/jest-e2e.json
new file mode 100644
index 00000000..cdc7edb5
--- /dev/null
+++ b/server/test/jest-e2e.json
@@ -0,0 +1,21 @@
+{
+ "moduleFileExtensions": [
+ "js",
+ "json",
+ "ts"
+ ],
+ "rootDir": ".",
+ "testEnvironment": "node",
+ "testRegex": ".e2e-spec.ts$",
+ "testTimeout": 100000,
+ "transform": {
+ "^.+\\.(t|j)s$": "ts-jest"
+ },
+ "globalSetup": "./setup.ts",
+ "globalTeardown": "./teardown.ts",
+ "setupFilesAfterEnv": [
+ "./each-setup-env.ts"
+ ],
+ "detectOpenHandles": true,
+ "forceExit": true
+}
\ No newline at end of file
diff --git a/server/test/manager/manager.e2e-spec.ts b/server/test/manager/manager.e2e-spec.ts
new file mode 100644
index 00000000..6b12ddb3
--- /dev/null
+++ b/server/test/manager/manager.e2e-spec.ts
@@ -0,0 +1,194 @@
+import { Agent } from '../agent';
+import supertest from 'supertest';
+import { Model } from 'mongoose';
+import { getModelToken } from '@nestjs/mongoose';
+import { Manager, ManagerStatus } from '../../src/db/schema/manager.schema';
+import { encryptPassword } from '../../src/util/password.util';
+import {
+ ErrHttpBack,
+ ErrHttpBackMap,
+} from '../../src/filters/http-exception.back-code';
+
+describe('ManagerController (e2e)', () => {
+ let agent: supertest.Agent;
+ let managerModel: Model<Manager>;
+ const testAccount = 'testadmin';
+ const testPassword = '123456';
+ const testName = '测试管理员';
+ let managerToken: string;
+
+ beforeAll(async () => {
+ agent = Agent.get();
+ managerModel = Agent.app().get(getModelToken(Manager.name));
+ });
+
+ beforeEach(async () => {
+ await managerModel.deleteMany({ account: testAccount });
+ });
+
+ describe('管理员认证', () => {
+ it('应该能创建管理员账号', async () => {
+ // 先创建一个管理员用于创建其他管理员
+ const { password, salt } = encryptPassword(
+ '123456',
+ '$2b$10$8n6z9rAh9rKfxoQkqxVqOe',
+ );
+ await managerModel.create({
+ account: 'admin',
+ password: password,
+ salt: salt,
+ name: '超级管理员',
+ status: ManagerStatus.OPEN,
+ });
+
+ // 登录获取token
+ const { body } = await agent.post('/manager/login').send({
+ account: 'admin',
+ password: '123456',
+ });
+
+ managerToken = body.data.token;
+
+ // 创建新管理员
+ const createRes = await agent
+ .post('/manager')
+ .set('Authorization', `Bearer ${managerToken}`)
+ .send({
+ account: testAccount,
+ password: testPassword,
+ name: testName,
+ });
+
+ expect(createRes.body.data).toMatchObject({
+ account: testAccount,
+ name: testName,
+ status: ManagerStatus.OPEN,
+ });
+
+ // 清理测试数据
+ await managerModel.deleteMany({ account: 'admin' });
+ });
+
+ it('应该能登录管理员账号', async () => {
+ // 先创建管理员
+ const { password, salt } = encryptPassword(
+ testPassword,
+ '$2b$10$8n6z9rAh9rKfxoQkqxVqOe',
+ );
+ await managerModel.create({
+ account: testAccount,
+ password: password,
+ salt: salt,
+ name: testName,
+ status: ManagerStatus.OPEN,
+ });
+
+ const { body } = await agent.post('/manager/login').send({
+ account: testAccount,
+ password: testPassword,
+ });
+
+ expect(body.data).toMatchObject({
+ token: expect.any(String),
+ managerInfo: expect.objectContaining({
+ account: testAccount,
+ name: testName,
+ status: ManagerStatus.OPEN,
+ }),
+ });
+
+ managerToken = body.data.token;
+ });
+
+ it('密码错误时不能登录', async () => {
+ const { password, salt } = encryptPassword(
+ testPassword,
+ '$2b$10$8n6z9rAh9rKfxoQkqxVqOe',
+ );
+ await managerModel.create({
+ account: testAccount,
+ password: password,
+ salt: salt,
+ name: testName,
+ status: ManagerStatus.OPEN,
+ });
+ const { body } = await agent
+ .post('/manager/login')
+ .send({
+ account: testAccount,
+ password: 'wrongpassword',
+ })
+ .expect(200);
+
+ expect(body.code).toBe(
+ ErrHttpBackMap.get(ErrHttpBack.err_no_power_login).errCode,
+ );
+ });
+ });
+
+ describe('管理员信息管理', () => {
+ beforeEach(async () => {
+ const { password, salt } = encryptPassword(
+ testPassword,
+ '$2b$10$8n6z9rAh9rKfxoQkqxVqOe',
+ );
+ // 创建测试管理员并登录
+ await managerModel.create({
+ account: testAccount,
+ password: password,
+ salt: salt,
+ name: testName,
+ status: ManagerStatus.OPEN,
+ });
+
+ const { body } = await agent.post('/manager/login').send({
+ account: testAccount,
+ password: testPassword,
+ });
+
+ managerToken = body.data.token;
+ });
+
+ it('应该能获取管理员信息', async () => {
+ const { body } = await agent
+ .get('/manager/info')
+ .set('Authorization', `Bearer ${managerToken}`)
+ .expect(200);
+
+ expect(body.data).toMatchObject({
+ account: testAccount,
+ name: testName,
+ status: ManagerStatus.OPEN,
+ });
+ });
+
+ it('应该能更新管理员信息', async () => {
+ const newName = '新名字';
+ const { body } = await agent
+ .put('/manager')
+ .set('Authorization', `Bearer ${managerToken}`)
+ .send({ name: newName })
+ .expect(200);
+
+ expect(body.data).toMatchObject({
+ account: testAccount,
+ name: newName,
+ status: ManagerStatus.OPEN,
+ });
+ });
+
+ it('应该能删除管理员', async () => {
+ await agent
+ .delete('/manager')
+ .set('Authorization', `Bearer ${managerToken}`)
+ .expect(200);
+
+ const manager = await managerModel.findOne({ account: testAccount });
+ expect(manager.status).toBe(ManagerStatus.DELETE);
+ });
+ });
+
+ afterEach(async () => {
+ await managerModel.deleteMany({ account: testAccount });
+ });
+});
diff --git a/server/test/mockData.ts b/server/test/mockData.ts
new file mode 100644
index 00000000..dd29aa02
--- /dev/null
+++ b/server/test/mockData.ts
@@ -0,0 +1,158 @@
+import { ObjectId } from 'mongodb';
+import { PlatformAccountGroupStatus } from '../src/db/schema/platform-account-group.schema';
+import { PlatformStatus, PlatformType } from '../src/db/schema/platform.schema';
+import { RankingStatus, RankingType } from '../src/db/schema/ranking.schema';
+import { TaskType } from '../src/db/schema/task.schema';
+
+export const user = {
+ _id: new ObjectId('6788f154c40f87952b9ed3bf'),
+ name: '测试用户',
+ phone: '13800138000',
+ status: 1,
+ createTime: new Date(),
+ updateTime: new Date(),
+};
+
+export const platform = {
+ _id: new ObjectId(),
+ name: 'Mock Platform',
+ type: PlatformType.DOUYIN,
+ description: 'Mock Platform Description',
+ status: PlatformStatus.OPEN,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+};
+
+export const platform2 = {
+ _id: new ObjectId(),
+ name: 'Mock Platform 2',
+ type: PlatformType.WECHAT,
+ description: 'Mock Platform 2 Description',
+ status: PlatformStatus.OPEN,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+};
+
+export const hotTopics = [
+ {
+ _id: new ObjectId(),
+ platformId: platform._id,
+ platform: PlatformType.DOUYIN,
+ title: 'Hot Topic 1',
+ hotValue: 100,
+ rank: 1,
+ url: 'http://example.com/1',
+ rankChange: 0,
+ isRising: true,
+ hotValueHistory: [],
+ fetchTime: new Date(),
+ },
+ {
+ _id: new ObjectId(),
+ platformId: platform._id,
+ platform: PlatformType.DOUYIN,
+ title: 'Hot Topic 2',
+ hotValue: 90,
+ rank: 2,
+ url: 'http://example.com/2',
+ rankChange: 1,
+ isRising: true,
+ hotValueHistory: [],
+ fetchTime: new Date(),
+ },
+ {
+ _id: new ObjectId(),
+ platformId: platform2._id,
+ platform: PlatformType.WECHAT,
+ title: 'Hot Topic 3',
+ hotValue: 95,
+ rank: 1,
+ url: 'http://example.com/3',
+ rankChange: 0,
+ isRising: false,
+ hotValueHistory: [],
+ fetchTime: new Date(),
+ },
+];
+
+export const ranking = {
+ _id: new ObjectId(),
+ name: 'Mock Ranking',
+ platformId: platform._id,
+ type: RankingType.DAILY,
+ description: 'Mock Ranking Description',
+ status: RankingStatus.OPEN,
+ updateFrequency: '每日12点',
+ createdAt: new Date(),
+ updatedAt: new Date(),
+};
+
+export const platformAccountGroup = {
+ _id: new ObjectId(),
+ name: '自有账号',
+ description: '自有账号分组',
+ status: PlatformAccountGroupStatus.OPEN,
+ sort: 1,
+ createTime: new Date(),
+ updateTime: new Date(),
+};
+
+export const viralTitles = [
+ {
+ _id: new ObjectId(),
+ platformId: platform._id,
+ category: '美食',
+ title: '这家藏在巷子里的面馆,凌晨三点都在排队',
+ url: 'https://example.com/title1',
+ rank: 1,
+ engagement: 156800,
+ publishTime: new Date('2025-02-15T06:30:00Z'),
+ },
+ {
+ _id: new ObjectId(),
+ platformId: platform._id,
+ category: '美食',
+ title: '自制冰淇淋只需要这3种材料,简单到哭',
+ url: 'https://example.com/title2',
+ rank: 2,
+ engagement: 143200,
+ publishTime: new Date('2025-02-15T07:00:00Z'),
+ },
+ {
+ _id: new ObjectId(),
+ platformId: platform._id,
+ category: '旅游',
+ title: '云南这个小众景点太惊艳了,门票只要10块',
+ url: 'https://example.com/title3',
+ rank: 1,
+ engagement: 198000,
+ publishTime: new Date('2025-02-15T05:45:00Z'),
+ },
+ {
+ _id: new ObjectId(),
+ platformId: platform._id,
+ category: '生活',
+ title: '一个人住也要好好生活,这些家居好物推荐给你',
+ url: 'https://example.com/title4',
+ rank: 1,
+ engagement: 134500,
+ publishTime: new Date('2025-02-15T07:45:00Z'),
+ },
+];
+export const task = {
+ title: '测试任务',
+ type: TaskType.PRODUCT,
+ price: 100,
+ commission: 10,
+ maxRecruits: 5,
+ currentRecruits: 0,
+ deadline: new Date('2025-12-31'),
+ firstTimeBonus: 50,
+ reward: 1000,
+ requiresShoppingCart: true,
+ description: '这是一个测试任务',
+ cooperationRequirements: {
+ batchMaterialPublishing: true,
+ requiresShoppingCart: true,
+ },
+};
diff --git a/server/test/mocks/sms.mock.ts b/server/test/mocks/sms.mock.ts
new file mode 100644
index 00000000..8d98872e
--- /dev/null
+++ b/server/test/mocks/sms.mock.ts
@@ -0,0 +1,24 @@
+import { LoginService } from '../../src/user/login.service';
+
+export function mockSmsService() {
+ const originalLoginService = jest.spyOn(
+ LoginService.prototype,
+ 'postPhoneLoginCode',
+ );
+ originalLoginService.mockImplementation(async () => true);
+
+ const originalVerifyCode = jest.spyOn(
+ LoginService.prototype,
+ 'verifyPhoneCode',
+ );
+ originalVerifyCode.mockImplementation(
+ async (phone, code) => code === '123456',
+ );
+
+ return {
+ restore: () => {
+ originalLoginService.mockRestore();
+ originalVerifyCode.mockRestore();
+ },
+ };
+}
diff --git a/server/test/mocks/wx.mock.ts b/server/test/mocks/wx.mock.ts
new file mode 100644
index 00000000..5f5f20db
--- /dev/null
+++ b/server/test/mocks/wx.mock.ts
@@ -0,0 +1,18 @@
+import { WeChatPayModule } from 'nest-wechatpay-node-v3';
+import { DynamicModule } from '@nestjs/common';
+
+const mockWxPayService = {
+ pay: () => Promise.resolve({}),
+ refund: () => Promise.resolve({}),
+};
+
+export const mockWxPayModule: DynamicModule = {
+ module: WeChatPayModule,
+ providers: [
+ {
+ provide: WeChatPayModule,
+ useValue: mockWxPayService,
+ },
+ ],
+ exports: [WeChatPayModule],
+};
diff --git a/server/test/ranking/ranking-contents.e2e-spec.ts b/server/test/ranking/ranking-contents.e2e-spec.ts
new file mode 100644
index 00000000..a9026a4a
--- /dev/null
+++ b/server/test/ranking/ranking-contents.e2e-spec.ts
@@ -0,0 +1,184 @@
+import { Agent } from '../agent';
+import { platform, ranking } from '../mockData';
+import { ContentStatus, ContentType } from '../../src/db/schema/content.schema';
+import { ObjectId } from 'mongodb';
+import { getModelToken } from '@nestjs/mongoose';
+import { Content } from '../../src/db/schema/content.schema';
+import { Model } from 'mongoose';
+import supertest from 'supertest';
+
+describe('RankingContents (e2e)', () => {
+ let agent: supertest.Agent;
+ let contentModel: Model<Content>;
+
+ beforeAll(async () => {
+ agent = Agent.get();
+ contentModel = Agent.app().get(getModelToken(Content.name));
+ });
+
+ beforeEach(async () => {
+ await contentModel.deleteMany({});
+
+ // 创建测试内容数据
+ await contentModel.create([
+ {
+ title: '内容1',
+ platformId: platform._id,
+ rankingId: ranking._id,
+ originalId: '1',
+ type: ContentType.ARTICLE,
+ category: '分类1',
+ url: 'http://test1.com',
+ status: ContentStatus.OPEN,
+ rankingPosition: 1,
+ },
+ {
+ title: '内容2',
+ platformId: platform._id,
+ rankingId: ranking._id,
+ originalId: '2',
+ type: ContentType.ARTICLE,
+ category: '分类1',
+ url: 'http://test2.com',
+ status: ContentStatus.OPEN,
+ rankingPosition: 2,
+ },
+ ]);
+ });
+
+ describe('GET /ranking/:id/contents', () => {
+ it('应该返回榜单内容列表', async () => {
+ const { body } = await agent
+ .get(`/ranking/${ranking._id}/contents`)
+ .expect(200);
+
+ expect(Array.isArray(body.data.items)).toBe(true);
+ expect(body.data.items.length).toBe(2);
+ expect(body.data.items[0]).toMatchObject({
+ title: '内容1',
+ originalId: '1',
+ rankingPosition: 1,
+ });
+ expect(body.data.items[1]).toMatchObject({
+ title: '内容2',
+ originalId: '2',
+ rankingPosition: 2,
+ });
+ expect(body.data.meta).toMatchObject({
+ itemCount: 2,
+ itemsPerPage: 20,
+ currentPage: 1,
+ });
+ });
+
+ it('使用分页参数应该正确返回数据', async () => {
+ const { body } = await agent
+ .get(`/ranking/${ranking._id}/contents`)
+ .query({ page: 1, pageSize: 1 })
+ .expect(200);
+
+ expect(Array.isArray(body.data.items)).toBe(true);
+ expect(body.data.items.length).toBe(1);
+ expect(body.data.items[0]).toMatchObject({
+ title: expect.any(String),
+ originalId: expect.any(String),
+ });
+ });
+
+ it('无效的ObjectId应该返回400错误', async () => {
+ await agent.get('/ranking/invalid-id/contents').expect(400);
+ });
+
+ it('不存在的榜单ID应该返回空数组', async () => {
+ const nonExistentId = new ObjectId().toString();
+ const { body } = await agent
+ .get(`/ranking/${nonExistentId}/contents`)
+ .expect(200);
+
+ expect(Array.isArray(body.data.items)).toBe(true);
+ expect(body.data.items.length).toBe(0);
+ expect(body.data.meta).toMatchObject({
+ itemCount: 0,
+ itemsPerPage: 20,
+ currentPage: 1,
+ });
+ });
+ });
+
+ describe('GET /ranking/:id/categories', () => {
+ beforeEach(async () => {
+ await contentModel.deleteMany({});
+
+ // 创建测试内容数据
+ await contentModel.create([
+ {
+ title: '内容1',
+ platformId: platform._id,
+ rankingId: ranking._id,
+ originalId: '1',
+ type: ContentType.ARTICLE,
+ category: '分类1',
+ url: 'http://test1.com',
+ status: ContentStatus.OPEN,
+ },
+ {
+ title: '内容2',
+ platformId: platform._id,
+ rankingId: ranking._id,
+ originalId: '2',
+ type: ContentType.ARTICLE,
+ category: '分类2',
+ url: 'http://test2.com',
+ status: ContentStatus.OPEN,
+ },
+ {
+ title: '内容3',
+ platformId: platform._id,
+ rankingId: ranking._id,
+ originalId: '3',
+ type: ContentType.ARTICLE,
+ category: '分类1', // 重复的分类
+ url: 'http://test3.com',
+ status: ContentStatus.STOP, // 停用状态
+ },
+ {
+ title: '内容4',
+ platformId: new ObjectId(), // 不同平台
+ rankingId: ranking._id,
+ originalId: '4',
+ type: ContentType.ARTICLE,
+ category: '分类3',
+ url: 'http://test4.com',
+ status: ContentStatus.OPEN,
+ },
+ ]);
+ });
+
+ it('应该返回榜单内容的唯一分类列表', async () => {
+ const { body } = await agent
+ .get(`/ranking/${ranking._id}/categories`)
+ .expect(200);
+
+ expect(Array.isArray(body.data)).toBe(true);
+ expect(body.data).toHaveLength(2);
+ expect(body.data).toContain('分类1');
+ expect(body.data).toContain('分类2');
+ // 不应该包含停用状态的内容分类和其他平台的分类
+ expect(body.data).not.toContain('分类3');
+ });
+
+ it('无效的ObjectId应该返回400错误', async () => {
+ await agent.get('/ranking/invalid-id/categories').expect(400);
+ });
+
+ it('不存在的榜单ID应该返回空数组', async () => {
+ const nonExistentId = new ObjectId().toString();
+ const { body } = await agent
+ .get(`/ranking/${nonExistentId}/categories`)
+ .expect(200);
+
+ expect(Array.isArray(body.data)).toBe(true);
+ expect(body.data).toHaveLength(0);
+ });
+ });
+});
diff --git a/server/test/ranking/ranking.e2e-spec.ts b/server/test/ranking/ranking.e2e-spec.ts
new file mode 100644
index 00000000..23232b2d
--- /dev/null
+++ b/server/test/ranking/ranking.e2e-spec.ts
@@ -0,0 +1,165 @@
+import { Agent } from '../agent';
+import { platform, ranking } from '../mockData';
+import supertest from 'supertest';
+import { RankingType, RankingStatus } from '../../src/db/schema/ranking.schema';
+
+describe('RankingController (e2e)', () => {
+ let agent: supertest.Agent;
+
+ beforeAll(async () => {
+ agent = Agent.get();
+ });
+
+ describe('getAllRankings', () => {
+ it('should return all rankings', async () => {
+ const result = await agent.get('/ranking').expect(200);
+
+ expect(Array.isArray(result.body.data)).toBe(true);
+ expect(result.body.data[0]).toMatchObject({
+ id: expect.any(String),
+ name: expect.any(String),
+ type: expect.any(String),
+ status: expect.any(Number),
+ platform: expect.any(Object),
+ });
+ });
+ });
+
+ describe('getRanking', () => {
+ it('should return ranking by id', async () => {
+ const result = await agent.get(`/ranking/${ranking._id}`).expect(200);
+
+ expect(result.body.data).toMatchObject({
+ id: ranking._id.toString(),
+ name: ranking.name,
+ type: ranking.type,
+ status: ranking.status,
+ platform: expect.objectContaining({
+ id: platform._id.toString(),
+ }),
+ });
+ });
+ });
+
+ describe('createRanking', () => {
+ it('should create new ranking', async () => {
+ const newRanking = {
+ name: 'Test Ranking',
+ platformId: platform._id.toString(),
+ type: RankingType.DAILY,
+ description: 'Test Description',
+ updateFrequency: '每日12点',
+ };
+
+ const result = await agent.post('/ranking').send(newRanking).expect(201);
+
+ expect(result.body.data).toMatchObject({
+ name: newRanking.name,
+ type: newRanking.type,
+ description: newRanking.description,
+ status: RankingStatus.OPEN,
+ updateFrequency: newRanking.updateFrequency,
+ });
+ });
+ });
+
+ describe('updateRanking', () => {
+ it('should update ranking', async () => {
+ const updateData = {
+ name: 'Updated Ranking',
+ description: 'Updated Description',
+ platformId: platform._id.toString(),
+ };
+
+ const result = await agent
+ .put(`/ranking/${ranking._id}`)
+ .send(updateData)
+ .expect(200);
+
+ expect(result.body.data).toMatchObject({
+ id: ranking._id.toString(),
+ name: updateData.name,
+ description: updateData.description,
+ });
+ });
+ });
+
+ describe('deleteRanking', () => {
+ it('should delete ranking', async () => {
+ await agent.delete(`/ranking/${ranking._id}`).expect(200);
+
+ const result = await agent.get(`/ranking/${ranking._id}`).expect(200);
+ expect(result.body.data.status).toBe(RankingStatus.DELETE);
+ });
+ });
+
+ describe('getRankingsByPlatform', () => {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ let testRanking;
+
+ beforeEach(async () => {
+ // 创建一个测试榜单
+ const newRanking = {
+ name: 'Test Platform Ranking',
+ platformId: platform._id.toString(),
+ type: RankingType.DAILY,
+ description: 'Test Description',
+ status: RankingStatus.OPEN,
+ };
+
+ const createResult = await agent
+ .post('/ranking')
+ .send(newRanking)
+ .expect(201);
+ testRanking = createResult.body;
+ });
+
+ it('should return rankings by platform', async () => {
+ const result = await agent
+ .get('/ranking/platform')
+ .query({
+ platformId: platform._id.toString(),
+ })
+ .expect(200);
+
+ expect(Array.isArray(result.body.data)).toBe(true);
+ expect(result.body.data[0]).toMatchObject({
+ id: expect.any(String),
+ name: expect.any(String),
+ type: expect.any(String),
+ status: RankingStatus.OPEN,
+ platform: expect.objectContaining({
+ id: platform._id.toString(),
+ }),
+ });
+ });
+
+ it('should return rankings by platform with specific status', async () => {
+ const result = await agent
+ .get('/ranking/platform')
+ .query({
+ platformId: platform._id.toString(),
+ status: RankingStatus.OPEN,
+ })
+ .expect(200);
+
+ expect(Array.isArray(result.body.data)).toBe(true);
+ result.body.data.forEach((ranking) => {
+ expect(ranking.status).toBe(RankingStatus.OPEN);
+ expect(ranking.platform.id).toBe(platform._id.toString());
+ });
+ });
+
+ it('should return empty array when no rankings found', async () => {
+ const nonExistentPlatformId = '507f1f77bcf86cd799439011';
+ const result = await agent
+ .get('/ranking/platform')
+ .query({
+ platformId: nonExistentPlatformId,
+ })
+ .expect(200);
+
+ expect(result.body.data).toEqual([]);
+ });
+ });
+});
diff --git a/server/test/setup.ts b/server/test/setup.ts
new file mode 100644
index 00000000..46afdf5e
--- /dev/null
+++ b/server/test/setup.ts
@@ -0,0 +1,22 @@
+import { RedisContainer } from '@testcontainers/redis';
+import { MongoDBContainer } from '@testcontainers/mongodb';
+import { initApp } from './app';
+
+export default async () => {
+ const redisContainer = await new RedisContainer().start();
+ const mongoDBContainer = await new MongoDBContainer().start();
+
+ global.mongo = mongoDBContainer;
+ global.redis = redisContainer;
+
+ process.env.MONGO_URI = `${mongoDBContainer.getConnectionString()}/test?directConnection=true`;
+ process.env.MONGO_DB = 'test';
+
+ console.info(mongoDBContainer.getConnectionString());
+
+ process.env.REDIS_HOST = redisContainer.getHost();
+ process.env.REDIS_PORT = redisContainer.getPort().toString();
+ process.env.REDIS_PASSWORD = redisContainer.getPassword();
+
+ await initApp();
+};
diff --git a/server/test/setupTestData.ts b/server/test/setupTestData.ts
new file mode 100644
index 00000000..6b7b17a1
--- /dev/null
+++ b/server/test/setupTestData.ts
@@ -0,0 +1,54 @@
+import { Model } from 'mongoose';
+import { getModelToken } from '@nestjs/mongoose';
+import { platform, platform2, ranking, user, hotTopics, viralTitles } from './mockData';
+import { Platform } from '../src/db/schema/platform.schema';
+import { Ranking } from '../src/db/schema/ranking.schema';
+import { INestApplication } from '@nestjs/common';
+import { User } from '../src/db/schema/user.schema';
+import { HotTopic } from '../src/db/schema/hot-topic.schema';
+import { ViralTitle } from '../src/db/schema/viral-title.schema';
+
+export async function setupTestData(app: INestApplication) {
+ // 获取模型
+ const platformModel = app.get<Model<Platform>>(getModelToken(Platform.name));
+ const rankingModel = app.get<Model<Ranking>>(getModelToken(Ranking.name));
+ const userModel = app.get<Model<User>>(getModelToken(User.name));
+ const hotTopicModel = app.get<Model<HotTopic>>(getModelToken(HotTopic.name));
+ const viralTitleModel = app.get<Model<ViralTitle>>(getModelToken(ViralTitle.name));
+
+ // 清理已有数据
+ await platformModel.deleteMany({});
+ await rankingModel.deleteMany({});
+ await userModel.deleteMany({});
+ await hotTopicModel.deleteMany({});
+ await viralTitleModel.deleteMany({});
+
+ // 创建用户数据
+ await userModel.create(user);
+
+ // 创建平台数据
+ const [createdPlatform, createdPlatform2] = await Promise.all([
+ platformModel.create({
+ ...platform,
+ _id: platform._id,
+ }),
+ platformModel.create({
+ ...platform2,
+ _id: platform2._id,
+ }),
+ ]);
+
+ // 创建排名数据
+ await rankingModel.create(ranking);
+
+ // 创建热门话题数据
+ await hotTopicModel.insertMany(hotTopics);
+
+ // 创建爆款标题数据
+ await viralTitleModel.insertMany(viralTitles);
+
+ return {
+ platform: createdPlatform,
+ platform2: createdPlatform2,
+ };
+}
diff --git a/server/test/task/task.e2e-spec.ts b/server/test/task/task.e2e-spec.ts
new file mode 100644
index 00000000..a7988ef7
--- /dev/null
+++ b/server/test/task/task.e2e-spec.ts
@@ -0,0 +1,125 @@
+import { Agent } from '../agent';
+import supertest from 'supertest';
+import { Model } from 'mongoose';
+import { getModelToken } from '@nestjs/mongoose';
+import { Task, TaskType } from '../../src/db/schema/task.schema';
+import { UserTask, UserTaskStatus } from '../../src/db/schema/user-task.schema';
+import { task, user } from '../mockData';
+
+describe('TaskController (e2e)', () => {
+ let agent: supertest.Agent;
+ let taskModel: Model<Task>;
+ let userTaskModel: Model<UserTask>;
+
+ beforeAll(async () => {
+ agent = Agent.get();
+
+ taskModel = Agent.app().get(getModelToken(Task.name));
+ userTaskModel = Agent.app().get(getModelToken(UserTask.name));
+ });
+
+ beforeEach(async () => {
+ // 清理测试数据
+ await taskModel.deleteMany({});
+ await userTaskModel.deleteMany({});
+ });
+
+ describe('任务相关接口', () => {
+ it('应该能获取任务列表', async () => {
+ // 创建两个测试任务
+ await taskModel.create([task, { ...task, title: '测试任务2' }]);
+
+ const response = await agent
+ .get('/tasks/list')
+ .query({ page: 1, pageSize: 10 })
+ .expect(200);
+
+ expect(response.body.data.items).toHaveLength(2);
+ expect(response.body.data.meta.totalItems).toBe(2);
+ expect(response.body.data.meta.currentPage).toBe(1);
+ expect(response.body.data.meta.itemsPerPage).toBe(10);
+ });
+
+ it('应该能按条件筛选任务列表', async () => {
+ // 创建两个测试任务,一个满足条件,一个不满足
+ await taskModel.create([
+ task,
+ {
+ ...task,
+ type: TaskType.ARTICLE,
+ requiresShoppingCart: false,
+ },
+ ]);
+
+ const response = await agent
+ .get('/tasks/list')
+ .query({
+ type: TaskType.PRODUCT,
+ requiresShoppingCart: true,
+ })
+ .expect(200);
+
+ expect(response.body.data.items).toHaveLength(1);
+ expect(response.body.data.items[0].type).toBe(TaskType.PRODUCT);
+ expect(response.body.data.items[0].requiresShoppingCart).toBe(true);
+ });
+
+ it('应该能获取任务详情', async () => {
+ const createdTask = await taskModel.create(task);
+
+ const response = await agent
+ .get(`/tasks/info/${createdTask._id}`)
+ .expect(200);
+
+ const { data } = response.body;
+ expect(data.title).toBe(task.title);
+ expect(data.type).toBe(task.type);
+ expect(data.price).toBe(task.price);
+ expect(data.commission).toBe(task.commission);
+ expect(data.maxRecruits).toBe(task.maxRecruits);
+ expect(data.deadline).toBe(task.deadline.toISOString());
+ expect(data.firstTimeBonus).toBe(task.firstTimeBonus);
+ expect(data.reward).toBe(task.reward);
+ });
+
+ it('应该能申请任务', async () => {
+ const createdTask = await taskModel.create(task);
+
+ // 申请任务
+ await agent.post(`/tasks/apply/${createdTask._id}`).expect(201);
+
+ // 验证用户任务记录
+ const userTask = await userTaskModel.findOne({
+ taskId: createdTask._id.toString(),
+ userId: user._id.toString(),
+ });
+ expect(userTask).toBeDefined();
+ expect(userTask.status).toBe(UserTaskStatus.PENDING);
+
+ // 验证任务申请人数更新
+ const updatedTask = await taskModel.findById(createdTask._id);
+ expect(updatedTask.currentRecruits).toBe(1);
+ });
+
+ it('不能重复申请同一个任务', async () => {
+ const createdTask = await taskModel.create(task);
+
+ // 第一次申请成功
+ await agent.post(`/tasks/apply/${createdTask._id}`).expect(201);
+
+ // 第二次申请应该失败
+ await agent.post(`/tasks/apply/${createdTask._id}`).expect(400);
+ });
+
+ it('任务招募人数达到上限时不能申请', async () => {
+ // 创建一个已达到招募上限的任务
+ const createdTask = await taskModel.create({
+ ...task,
+ currentRecruits: task.maxRecruits,
+ });
+
+ // 尝试申请任务,应该返回400错误
+ await agent.post(`/tasks/apply/${createdTask._id}`).expect(400);
+ });
+ });
+});
diff --git a/server/test/teardown.ts b/server/test/teardown.ts
new file mode 100644
index 00000000..0f220a4c
--- /dev/null
+++ b/server/test/teardown.ts
@@ -0,0 +1,4 @@
+export default async () => {
+ await global.mongo?.stop();
+ // await global.redis?.stop();
+};
diff --git a/server/test/topic/topic.e2e-spec.ts b/server/test/topic/topic.e2e-spec.ts
new file mode 100644
index 00000000..543ba7fc
--- /dev/null
+++ b/server/test/topic/topic.e2e-spec.ts
@@ -0,0 +1,128 @@
+import { Agent } from '../agent';
+import supertest from 'supertest';
+import { Model } from 'mongoose';
+import { getModelToken } from '@nestjs/mongoose';
+import { platform } from '../mockData';
+import { Topic } from '../../src/db/schema/topic.schema';
+
+describe('TopicController (e2e)', () => {
+ let agent: supertest.Agent;
+ let topicModel: Model<Topic>;
+
+ const mockTopics = [
+ {
+ platformId: platform._id,
+ title: 'Test Topic 1',
+ description: 'Test Description 1',
+ category: 'Entertainment',
+ subCategory: 'Movies',
+ url: 'http://example.com/topic1',
+ author: 'Author 1',
+ topics: ['movie', 'entertainment'],
+ rank: 1,
+ createTime: new Date(),
+ updateTime: new Date(),
+ },
+ {
+ platformId: platform._id,
+ title: 'Test Topic 2',
+ description: 'Test Description 2',
+ category: 'Technology',
+ subCategory: 'AI',
+ url: 'http://example.com/topic2',
+ author: 'Author 2',
+ topics: ['ai', 'tech'],
+ rank: 2,
+ createTime: new Date(),
+ updateTime: new Date(),
+ },
+ ];
+
+ beforeAll(async () => {
+ agent = Agent.get();
+ topicModel = Agent.app().get(getModelToken(Topic.name));
+ await topicModel.insertMany(mockTopics);
+ });
+
+ afterAll(async () => {
+ await topicModel.deleteMany({});
+ });
+
+ describe('/topics (GET)', () => {
+ it('should return all topics', () => {
+ return agent
+ .get('/topics')
+ .expect(200)
+ .expect((res) => {
+ expect(res.body.code).toBe(0);
+ expect(res.body.data.items).toHaveLength(2);
+ expect(res.body.data.items[0]).toHaveProperty('title');
+ expect(res.body.data.items[0]).toHaveProperty('category');
+ expect(res.body.data.meta).toMatchObject({
+ currentPage: 1,
+ itemsPerPage: 20,
+ totalItems: 2,
+ totalPages: 1
+ });
+ });
+ });
+
+ it('should filter topics by category', () => {
+ return agent
+ .get('/topics?category=Technology')
+ .expect(200)
+ .expect((res) => {
+ expect(res.body.code).toBe(0);
+ expect(res.body.data.items).toHaveLength(1);
+ expect(res.body.data.items[0].category).toBe('Technology');
+ expect(res.body.data.meta).toMatchObject({
+ currentPage: 1,
+ itemsPerPage: 20,
+ totalItems: 1,
+ totalPages: 1
+ });
+ });
+ });
+ });
+
+ describe('/topics/categories (GET)', () => {
+ it('should return all categories', () => {
+ return agent
+ .get('/topics/categories')
+ .expect(200)
+ .expect((res) => {
+ expect(res.body.code).toBe(0);
+ expect(Array.isArray(res.body.data)).toBe(true);
+ expect(res.body.data).toContain('Entertainment');
+ expect(res.body.data).toContain('Technology');
+ });
+ });
+ });
+
+ describe('/topics/sub-categories (GET)', () => {
+ it('should return all sub-categories for a category', () => {
+ return agent
+ .get('/topics/sub-categories?category=Technology')
+ .expect(200)
+ .expect((res) => {
+ expect(res.body.code).toBe(0);
+ expect(Array.isArray(res.body.data)).toBe(true);
+ expect(res.body.data).toContain('AI');
+ });
+ });
+ });
+
+ describe('/topics/topics (GET)', () => {
+ it('should return all topic tags', () => {
+ return agent
+ .get('/topics/topics')
+ .expect(200)
+ .expect((res) => {
+ expect(res.body.code).toBe(0);
+ expect(Array.isArray(res.body.data)).toBe(true);
+ expect(res.body.data).toContain('movie');
+ expect(res.body.data).toContain('ai');
+ });
+ });
+ });
+});
diff --git a/server/test/user/user-admin.e2e-spec.ts b/server/test/user/user-admin.e2e-spec.ts
new file mode 100644
index 00000000..04864d6f
--- /dev/null
+++ b/server/test/user/user-admin.e2e-spec.ts
@@ -0,0 +1,197 @@
+import { Agent } from '../agent';
+import supertest from 'supertest';
+import { UserStatus } from '../../src/db/schema/user.schema';
+import { Model } from 'mongoose';
+import { getModelToken } from '@nestjs/mongoose';
+import { User } from '../../src/db/schema/user.schema';
+import { Manager, ManagerStatus } from '../../src/db/schema/manager.schema';
+import { encryptPassword } from '../../src/util/password.util';
+
+describe('UserAdminController (e2e)', () => {
+ let agent: supertest.Agent;
+ let userModel: Model<User>;
+ let managerModel: Model<Manager>;
+ let managerToken: string;
+
+ const testManager = {
+ account: 'testadmin',
+ password: '123456',
+ name: '测试管理员',
+ };
+
+ const testUsers = [
+ { phone: '13800138001', name: '测试用户1', status: UserStatus.OPEN },
+ { phone: '13800138002', name: '测试用户2', status: UserStatus.OPEN },
+ { phone: '13800138003', name: '测试用户3', status: UserStatus.STOP },
+ ];
+
+ beforeAll(async () => {
+ agent = Agent.get();
+ userModel = Agent.app().get(getModelToken(User.name));
+ managerModel = Agent.app().get(getModelToken(Manager.name));
+ });
+
+ beforeEach(async () => {
+ // 清理测试数据
+ await userModel.deleteMany({
+ phone: { $in: testUsers.map((u) => u.phone) },
+ });
+ await managerModel.deleteMany({ account: testManager.account });
+
+ // 创建测试用户
+ await userModel.create(testUsers);
+
+ // 创建并登录测试管理员
+ const { password, salt } = encryptPassword(
+ testManager.password,
+ '$2b$10$8n6z9rAh9rKfxoQkqxVqOe',
+ );
+ await managerModel.create({
+ account: testManager.account,
+ password,
+ salt,
+ name: testManager.name,
+ status: ManagerStatus.OPEN,
+ });
+
+ const { body } = await agent.post('/manager/login').send({
+ account: testManager.account,
+ password: testManager.password,
+ });
+
+ managerToken = body.data.token;
+ });
+
+ describe('用户管理接口', () => {
+ it('应该能获取用户列表', async () => {
+ const { body } = await agent
+ .get('/admin/user/list')
+ .set('Authorization', `Bearer ${managerToken}`)
+ .query({
+ page: 1,
+ pageSize: 10,
+ })
+ .expect(200);
+
+ expect(body.data).toMatchObject({
+ items: expect.arrayContaining([
+ expect.objectContaining({
+ phone: testUsers[0].phone,
+ name: testUsers[0].name,
+ }),
+ ]),
+ meta: {
+ currentPage: 1,
+ itemsPerPage: 10,
+ totalItems: expect.any(Number),
+ totalPages: expect.any(Number),
+ itemCount: expect.any(Number),
+ },
+ });
+ });
+
+ it('应该能按条件搜索用户', async () => {
+ const { body } = await agent
+ .get('/admin/user/list')
+ .set('Authorization', `Bearer ${managerToken}`)
+ .query({
+ phone: testUsers[0].phone,
+ status: 1,
+ })
+ .expect(200);
+
+ expect(body.data.items).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({
+ phone: testUsers[0].phone,
+ status: UserStatus.OPEN,
+ }),
+ ]),
+ );
+ });
+
+ it('应该能获取用户详情', async () => {
+ const user = await userModel.findOne({ phone: testUsers[0].phone });
+
+ const { body } = await agent
+ .get(`/admin/user/${user.id}`)
+ .set('Authorization', `Bearer ${managerToken}`)
+ .expect(200);
+
+ expect(body.data).toMatchObject({
+ phone: testUsers[0].phone,
+ name: testUsers[0].name,
+ status: UserStatus.OPEN,
+ });
+ });
+
+ it('应该能更新用户状态', async () => {
+ const user = await userModel.findOne({ phone: testUsers[0].phone });
+
+ const { body } = await agent
+ .put(`/admin/user/${user.id}/status`)
+ .set('Authorization', `Bearer ${managerToken}`)
+ .send({ status: 0 })
+ .expect(200);
+
+ const updatedUser = await userModel.findById(user.id);
+ expect(updatedUser.status).toBe(UserStatus.STOP);
+ });
+
+ it('应该能删除用户', async () => {
+ const user = await userModel.findOne({ phone: testUsers[0].phone });
+
+ await agent
+ .delete(`/admin/user/${user.id}`)
+ .set('Authorization', `Bearer ${managerToken}`)
+ .expect(200);
+
+ const deletedUser = await userModel.findById(user.id);
+ expect(deletedUser.status).toBe(UserStatus.DELETE);
+ });
+
+ it('未登录时不能访问管理接口', async () => {
+ const { body } = await agent.get('/admin/user/list').expect(401);
+
+ expect(body.code).not.toBe(0);
+ });
+
+ it('应该能正确处理不存在的用户ID', async () => {
+ const fakeId = '507f1f77bcf86cd799439011';
+
+ const { body: getBody } = await agent
+ .get(`/admin/user/${fakeId}`)
+ .set('Authorization', `Bearer ${managerToken}`)
+ .expect(200);
+
+ if (getBody.data === null) {
+ expect(getBody.data).toBeNull();
+ } else {
+ expect(getBody.code).not.toBe(0);
+ }
+
+ const { body: updateBody } = await agent
+ .put(`/admin/user/${fakeId}/status`)
+ .set('Authorization', `Bearer ${managerToken}`)
+ .send({ status: 0 })
+ .expect(200);
+
+ expect(updateBody.code).not.toBe(0);
+
+ const { body: deleteBody } = await agent
+ .delete(`/admin/user/${fakeId}`)
+ .set('Authorization', `Bearer ${managerToken}`)
+ .expect(200);
+
+ expect(deleteBody.code).not.toBe(0);
+ });
+ });
+
+ afterAll(async () => {
+ // 清理测试数据
+ await userModel.deleteMany({
+ phone: { $in: testUsers.map((u) => u.phone) },
+ });
+ await managerModel.deleteMany({ account: testManager.account });
+ });
+});
diff --git a/server/test/user/user.e2e-spec.ts b/server/test/user/user.e2e-spec.ts
new file mode 100644
index 00000000..4eab595f
--- /dev/null
+++ b/server/test/user/user.e2e-spec.ts
@@ -0,0 +1,176 @@
+import { Agent } from '../agent';
+import supertest from 'supertest';
+import { UserStatus } from '../../src/db/schema/user.schema';
+import { Model } from 'mongoose';
+import { getModelToken } from '@nestjs/mongoose';
+import { User } from '../../src/db/schema/user.schema';
+import { mockSmsService } from '../mocks/sms.mock';
+
+describe('UserController (e2e)', () => {
+ let agent: supertest.Agent;
+ let userModel: Model<User>;
+ const testPhone = '13800138001';
+ const testPassword = '123456';
+ let smsServiceMock;
+
+ beforeAll(async () => {
+ agent = Agent.get();
+ userModel = Agent.app().get(getModelToken(User.name));
+ smsServiceMock = mockSmsService();
+ });
+
+ beforeEach(async () => {
+ await userModel.deleteMany({ phone: testPhone });
+ });
+
+ describe('用户注册登录', () => {
+ it('应该能发送验证码', async () => {
+ const { body } = await agent
+ .post('/user/code')
+ .send({ phone: testPhone })
+ .expect(201);
+
+ expect(body.data).toBe(true);
+ });
+
+ it('应该能注册新用户', async () => {
+ const { body } = await agent.post('/user/add').send({
+ phone: testPhone,
+ password: testPassword,
+ code: '123456',
+ });
+ expect(body.data).toMatchObject({
+ token: expect.any(String),
+ userInfo: expect.objectContaining({
+ phone: testPhone,
+ status: UserStatus.OPEN,
+ }),
+ });
+ });
+
+ it('应该能通过密码登录', async () => {
+ // 先创建用户
+ await agent.post('/user/add').send({
+ phone: testPhone,
+ password: testPassword,
+ code: '123456',
+ });
+
+ const { body } = await agent.post('/user/login/password').send({
+ phone: testPhone,
+ password: testPassword,
+ });
+
+ expect(body.data).toMatchObject({
+ token: expect.any(String),
+ userInfo: expect.objectContaining({
+ phone: testPhone,
+ status: UserStatus.OPEN,
+ }),
+ });
+ });
+
+ it('应该能通过验证码登录', async () => {
+ // 先发送验证码
+ await agent.post('/user/code').send({ phone: testPhone });
+
+ const { body } = await agent
+ .post('/user/login/code/phone')
+ .send({
+ phone: testPhone,
+ code: '123456', // 测试环境验证码固定为123456
+ })
+ .expect(201);
+
+ expect(body.data).toMatchObject({
+ token: expect.any(String),
+ exp: expect.any(Number),
+ userInfo: expect.objectContaining({
+ phone: testPhone,
+ status: UserStatus.OPEN,
+ }),
+ });
+ });
+ });
+
+ describe('用户信息管理', () => {
+ let token: string;
+
+ beforeEach(async () => {
+ // 创建测试用户并登录
+ const { body } = await agent.post('/user/add').send({
+ phone: testPhone,
+ password: testPassword,
+ code: '123456',
+ });
+ token = body.data.token;
+ agent.set('Authorization', `Bearer ${token}`);
+ });
+
+ it('应该能获取用户信息', async () => {
+ const { body } = await agent.get('/user/mine').expect(200);
+
+ expect(body.data).toMatchObject({
+ phone: testPhone,
+ status: UserStatus.OPEN,
+ });
+ });
+
+ it('应该能更新用户信息', async () => {
+ const newName = '测试用户';
+ const { body } = await agent
+ .put('/user/info/update')
+ .send({ name: newName })
+ .expect(200);
+
+ expect(body.data).toMatchObject({
+ name: newName,
+ phone: testPhone,
+ });
+ });
+
+ it('应该能修改密码', async () => {
+ const newPassword = '654321';
+ await agent
+ .post('/user/password/change')
+ .send({ password: newPassword })
+ .expect(201);
+
+ // 验证新密码是否生效
+ const { body } = await agent
+ .post('/user/login/password')
+ .send({
+ phone: testPhone,
+ password: newPassword,
+ })
+ .expect(201);
+
+ expect(body.data.userInfo).toMatchObject({
+ phone: testPhone,
+ status: UserStatus.OPEN,
+ });
+ });
+
+ it('应该能刷新token', async () => {
+ const { body } = await agent.post('/user/token/refresh').expect(201);
+
+ expect(body.data).toMatchObject({
+ token: expect.any(String),
+ });
+ });
+
+ it('应该能注销账号', async () => {
+ await agent.delete('/user/del');
+
+ // 验证用户状态是否更新
+ const userInfo = await userModel.findOne({ phone: testPhone });
+
+ expect(userInfo.status).toBe(UserStatus.DELETE);
+ });
+ });
+
+ afterAll(async () => {
+ await userModel.deleteMany({ phone: testPhone });
+ smsServiceMock.restore();
+ });
+});
diff --git a/server/test/viral-title/viral-title.e2e-spec.ts b/server/test/viral-title/viral-title.e2e-spec.ts
new file mode 100644
index 00000000..80bda134
--- /dev/null
+++ b/server/test/viral-title/viral-title.e2e-spec.ts
@@ -0,0 +1,151 @@
+import supertest from 'supertest';
+import { Agent } from '../agent';
+import { platform, platform2 } from '../mockData';
+
+describe('ViralTitleController (e2e)', () => {
+ let agent: supertest.Agent;
+
+ beforeAll(async () => {
+ agent = Agent.get();
+ });
+
+ describe('findPlatformsWithData', () => {
+ it('should return platforms that have viral title data', async () => {
+ const result = await agent.get('/viral-titles/platforms').expect(200);
+
+ expect(Array.isArray(result.body.data)).toBe(true);
+ result.body.data.forEach(platform => {
+ expect(platform).toHaveProperty('_id');
+ expect(platform).toHaveProperty('name');
+ expect(platform).toHaveProperty('description');
+ expect(platform).toHaveProperty('type');
+ expect(platform).toHaveProperty('status');
+ });
+ });
+ });
+
+ describe('findCategoriesByPlatform', () => {
+ it('should return categories for a specific platform', async () => {
+ const result = await agent
+ .get(`/viral-titles/platforms/${platform._id}/categories`)
+ .expect(200);
+
+ expect(Array.isArray(result.body.data)).toBe(true);
+ result.body.data.forEach(category => {
+ expect(typeof category).toBe('string');
+ });
+ });
+
+ it('should return empty array for platform without data', async () => {
+ const result = await agent
+ .get(`/viral-titles/platforms/${platform2._id}/categories`)
+ .expect(200);
+
+ expect(Array.isArray(result.body.data)).toBe(true);
+ expect(result.body.data.length).toBe(0);
+ });
+ });
+
+ describe('findTopByPlatformAndCategories', () => {
+ it('should return top 5 titles for each category in platform', async () => {
+ const result = await agent
+ .get(`/viral-titles/platforms/${platform._id}/top-by-categories`)
+ .expect(200);
+
+ expect(Array.isArray(result.body.data)).toBe(true);
+ result.body.data.forEach(categoryGroup => {
+ expect(categoryGroup).toHaveProperty('category');
+ expect(categoryGroup).toHaveProperty('titles');
+ expect(Array.isArray(categoryGroup.titles)).toBe(true);
+ expect(categoryGroup.titles.length).toBeLessThanOrEqual(5);
+
+ // Verify each title has required properties
+ categoryGroup.titles.forEach(title => {
+ expect(title).toHaveProperty('platformId');
+ expect(title).toHaveProperty('category');
+ expect(title).toHaveProperty('title');
+ expect(title).toHaveProperty('url');
+ expect(title).toHaveProperty('rank');
+ expect(title).toHaveProperty('engagement');
+ expect(title).toHaveProperty('publishTime');
+
+ // Verify titles belong to correct category and platform
+ expect(title.category).toBe(categoryGroup.category);
+ expect(title.platformId.toString()).toBe(platform._id.toString());
+ });
+
+ // Verify titles are sorted by engagement
+ const engagements = categoryGroup.titles.map(title => title.engagement);
+ expect(engagements).toEqual([...engagements].sort((a, b) => b - a));
+ });
+ });
+ });
+
+ describe('findByPlatformAndCategory', () => {
+ it('should return paginated titles for platform and category', async () => {
+ const result = await agent
+ .get(`/viral-titles/platforms/${platform._id}`)
+ .query({
+ category: '美食',
+ page: 1,
+ pageSize: 10
+ })
+ .expect(200);
+
+ expect(result.body.data).toHaveProperty('items');
+ expect(result.body.data).toHaveProperty('meta');
+
+ const { items, meta } = result.body.data;
+ expect(Array.isArray(items)).toBe(true);
+ expect(items.length).toBeLessThanOrEqual(10);
+
+ // Verify pagination meta
+ expect(meta).toHaveProperty('currentPage');
+ expect(meta).toHaveProperty('itemCount');
+ expect(meta).toHaveProperty('itemsPerPage');
+ expect(meta).toHaveProperty('totalItems');
+ expect(meta).toHaveProperty('totalPages');
+
+ // Verify each title has required properties
+ items.forEach(title => {
+ expect(title).toHaveProperty('platformId');
+ expect(title).toHaveProperty('category');
+ expect(title).toHaveProperty('title');
+ expect(title).toHaveProperty('url');
+ expect(title).toHaveProperty('rank');
+ expect(title).toHaveProperty('engagement');
+ expect(title).toHaveProperty('publishTime');
+
+ // Verify titles belong to correct category and platform
+ expect(title.category).toBe('美食');
+ expect(title.platformId.toString()).toBe(platform._id.toString());
+ });
+
+ // Verify titles are sorted by engagement and rank
+ const engagements = items.map(title => title.engagement);
+ expect(engagements).toEqual([...engagements].sort((a, b) => b - a));
+ });
+
+ it('should filter by date range', async () => {
+ const startTime = new Date('2025-02-15T00:00:00Z');
+ const endTime = new Date('2025-02-15T23:59:59Z');
+
+ const result = await agent
+ .get(`/viral-titles/platforms/${platform._id}`)
+ .query({
+ startTime: startTime.toISOString(),
+ endTime: endTime.toISOString(),
+ page: 1,
+ pageSize: 10
+ })
+ .expect(200);
+
+ const { items } = result.body.data;
+ items.forEach(title => {
+ const publishTime = new Date(title.publishTime);
+ expect(publishTime.getTime()).toBeGreaterThanOrEqual(startTime.getTime());
+ expect(publishTime.getTime()).toBeLessThanOrEqual(endTime.getTime());
+ });
+ });
+ });
+});
diff --git a/server/tsconfig.build.json b/server/tsconfig.build.json
new file mode 100644
index 00000000..1d7acd89
--- /dev/null
+++ b/server/tsconfig.build.json
@@ -0,0 +1,4 @@
+{
+ "extends": "./tsconfig.json",
+ "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
+}
diff --git a/server/tsconfig.json b/server/tsconfig.json
new file mode 100644
index 00000000..ddae93b0
--- /dev/null
+++ b/server/tsconfig.json
@@ -0,0 +1,22 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "declaration": true,
+ "removeComments": true,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "allowSyntheticDefaultImports": true,
+ "target": "ES2021",
+ "sourceMap": true,
+ "outDir": "./dist",
+ "baseUrl": "./",
+ "incremental": true,
+ "skipLibCheck": true,
+ "strictNullChecks": false,
+ "noImplicitAny": false,
+ "strictBindCallApply": false,
+ "forceConsistentCasingInFileNames": false,
+ "noFallthroughCasesInSwitch": false,
+ "paths": {}
+ }
+}