befly 3.5.5 → 3.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,7 @@ import { Logger } from '../lib/logger.js';
16
16
  import { Database } from '../lib/database.js';
17
17
  import { RedisHelper } from '../lib/redisHelper.js';
18
18
  import { scanAddons, getAddonDir, addonDirExists } from '../util.js';
19
+ import { coreApiDir, projectApiDir } from '../paths.js';
19
20
  import { readdirSync, statSync } from 'node:fs';
20
21
  import { join, dirname, relative, basename } from 'pathe';
21
22
 
@@ -118,23 +119,21 @@ async function scanAllApis(projectRoot: string): Promise<ApiInfo[]> {
118
119
  const apis: ApiInfo[] = [];
119
120
 
120
121
  // 1. 扫描 Core 框架 API
121
- const coreApisDir = join(dirname(projectRoot), 'core', 'apis');
122
122
  try {
123
- const coreApiFiles = scanTsFiles(coreApisDir);
123
+ const coreApiFiles = scanTsFiles(coreApiDir);
124
124
 
125
125
  for (const filePath of coreApiFiles) {
126
- const apiInfo = await extractApiInfo(filePath, coreApisDir, 'core', '', '核心接口');
126
+ const apiInfo = await extractApiInfo(filePath, coreApiDir, 'core', '', '核心接口');
127
127
  if (apiInfo) {
128
128
  apis.push(apiInfo);
129
129
  }
130
130
  }
131
131
 
132
132
  // 2. 扫描项目 API
133
- const projectApisDir = join(projectRoot, 'apis');
134
- const projectApiFiles = scanTsFiles(projectApisDir);
133
+ const projectApiFiles = scanTsFiles(projectApiDir);
135
134
 
136
135
  for (const filePath of projectApiFiles) {
137
- const apiInfo = await extractApiInfo(filePath, projectApisDir, 'app', '', '项目接口');
136
+ const apiInfo = await extractApiInfo(filePath, projectApiDir, 'app', '', '项目接口');
138
137
  if (apiInfo) {
139
138
  apis.push(apiInfo);
140
139
  }
package/lib/database.ts CHANGED
@@ -62,7 +62,7 @@ export class Database {
62
62
  }
63
63
 
64
64
  try {
65
- const timeout = options.connectionTimeout ?? 5000;
65
+ const timeout = options.connectionTimeout ?? 30000;
66
66
 
67
67
  const healthCheckPromise = (async () => {
68
68
  let version = '';
@@ -174,7 +174,7 @@ export class Database {
174
174
  const url = `redis://${auth}${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB}`;
175
175
 
176
176
  const redis = new RedisClient(url, {
177
- connectionTimeout: 10000,
177
+ connectionTimeout: 30000,
178
178
  idleTimeout: 0,
179
179
  autoReconnect: true,
180
180
  maxRetries: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly",
3
- "version": "3.5.5",
3
+ "version": "3.5.7",
4
4
  "description": "Befly - 为 Bun 专属打造的 TypeScript API 接口框架核心引擎",
5
5
  "type": "module",
6
6
  "private": false,
@@ -80,5 +80,5 @@
80
80
  "es-toolkit": "^1.41.0",
81
81
  "pathe": "^2.0.3"
82
82
  },
83
- "gitHead": "e43c66bd47cc2279e314119a6a8508879a591c6b"
83
+ "gitHead": "00363a4b337d54d88822e284dcd555b3f678a630"
84
84
  }
package/plugins/db.ts CHANGED
@@ -24,7 +24,7 @@ const dbPlugin: Plugin = {
24
24
  if (Env.DB_ENABLE === 1) {
25
25
  // 创建 Bun SQL 客户端(内置连接池),并确保连接验证成功后再继续
26
26
  // 从环境变量读取连接超时配置
27
- const connectionTimeout = Env.DB_CONNECTION_TIMEOUT ? parseInt(Env.DB_CONNECTION_TIMEOUT) : 5000;
27
+ const connectionTimeout = Env.DB_CONNECTION_TIMEOUT ? parseInt(Env.DB_CONNECTION_TIMEOUT) : 30000;
28
28
 
29
29
  sql = await Database.connectSql({
30
30
  connectionTimeout
@@ -168,7 +168,7 @@ export interface SqlClientOptions {
168
168
  max?: number;
169
169
  /** 是否使用 BigInt */
170
170
  bigint?: boolean;
171
- /** 连接超时时间(毫秒),默认 5000ms */
171
+ /** 连接超时时间(毫秒),默认 30000ms */
172
172
  connectionTimeout?: number;
173
173
  /** 其他自定义选项 */
174
174
  [key: string]: any;