refactor: 降级抖音SDK版本并优化项目配置
- 降级@open-dy/open_api_sdk从1.1.3到1.1.2解决兼容性问题 - 优化import顺序,移动HttpModule和JwtModule到顶部 - 移除未使用的TemplateController导入 - 修复TypeScript配置,改用commonjs模块系统 - 添加DouyinAuthClient文件到版本控制
This commit is contained in:
parent
39f2ecc4f5
commit
3d7370d73a
|
|
@ -39,7 +39,7 @@
|
|||
"@nestjs/swagger": "^11.2.0",
|
||||
"@nestjs/typeorm": "^11.0.0",
|
||||
"@open-dy/open_api_credential": "^1.0.0",
|
||||
"@open-dy/open_api_sdk": "^1.1.3",
|
||||
"@open-dy/open_api_sdk": "1.1.2",
|
||||
"axios": "^1.11.0",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.14.2",
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ importers:
|
|||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
'@open-dy/open_api_sdk':
|
||||
specifier: ^1.1.3
|
||||
version: 1.1.3
|
||||
specifier: 1.1.2
|
||||
version: 1.1.2
|
||||
axios:
|
||||
specifier: ^1.11.0
|
||||
version: 1.11.0
|
||||
|
|
@ -819,8 +819,8 @@ packages:
|
|||
'@open-dy/open_api_credential@1.0.0':
|
||||
resolution: {integrity: sha512-MmLrJL2QFYHV3RNJ2/hQEXcjzBCa6mtklW+AJXG+xS/x8cJ7/AgW3wQjvNwJ0oMRyxch1nQ10h9EnOGr1kew0g==}
|
||||
|
||||
'@open-dy/open_api_sdk@1.1.3':
|
||||
resolution: {integrity: sha512-N04K4zkfa5tadbo+iz0ZCdHvNq+9sdzwWZzP4OX0rEmba0VXVlYstzjFpvYsTp+nQcJqab2DvyaXhShJfO1/rg==}
|
||||
'@open-dy/open_api_sdk@1.1.2':
|
||||
resolution: {integrity: sha512-Z+TzDxzFf+25Hw6E3crKLNRrFrN45I+BrfmnxPHm0QpGHO284FmvbEaug1lXq480jD32kPZMjJQR+r5d8LYW9g==}
|
||||
|
||||
'@open-dy/open_api_util@1.0.1':
|
||||
resolution: {integrity: sha512-vgUTsyNqB0mtn0LclEr7J2E0eoXTHym1Xh4hO5gXXGYS4MoZGpu9IbYlkR4LMVUSOmJs5ZhRxmNqvEt4D/5fLg==}
|
||||
|
|
@ -4263,7 +4263,7 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
'@open-dy/open_api_sdk@1.1.3':
|
||||
'@open-dy/open_api_sdk@1.1.2':
|
||||
dependencies:
|
||||
'@alicloud/tea-typescript': 1.8.0
|
||||
'@open-dy/open_api_credential': 1.0.0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { HttpModule } from '@nestjs/axios';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { AppController } from './app.controller';
|
||||
import { TemplateService } from './templates/index';
|
||||
import { TemplateManager } from './templates/types';
|
||||
|
|
@ -17,8 +19,6 @@ import { N8nTemplateFactoryService } from './services/n8n-template-factory.servi
|
|||
import { TemplateController } from './controllers/template.controller';
|
||||
import { PlatformModule } from './platform/platform.module';
|
||||
import { ContentModerationModule } from './content-moderation/content-moderation.module';
|
||||
import { HttpModule } from '@nestjs/axios';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
import { Injectable } from "@nestjs/common";
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
import Client from '@open-dy/open_api_credential';
|
||||
|
||||
/**
|
||||
|
||||
名称 描述
|
||||
HTTP URL https://open.douyin.com/oauth/access_token/
|
||||
HTTP Method POST
|
||||
|
||||
content-type: application/x-www-form-urlencoded"
|
||||
body:
|
||||
- client_key
|
||||
- client_secret
|
||||
*/
|
||||
|
||||
@Injectable()
|
||||
export class DouyinAuthClient {
|
||||
private readonly client: Client;
|
||||
constructor(private config: ConfigService) {
|
||||
this.client = new Client({
|
||||
clientKey: this.config.get('BYTEDANCE_APP_ID') || '',
|
||||
clientSecret: this.config.get('BYTEDANCE_APP_SECRET') || '',
|
||||
})
|
||||
}
|
||||
|
||||
getAccessToken() {
|
||||
return this.client.getAccessToken()
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ import { NestFactory } from '@nestjs/core';
|
|||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { AppModule } from './app.module';
|
||||
import { setupSwagger } from './config/swagger.config';
|
||||
import { TemplateController } from './controllers/template.controller';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "nodenext",
|
||||
"moduleResolution": "nodenext",
|
||||
"resolvePackageJsonExports": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"declaration": true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue