@cloudbase/manager-node 5.6.5 → 5.6.6

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## @cloudbase/manager-node v5.6.5 版本发布 🚀(2026-07-28)
2
+
3
+ - 新增 PostgreSQL 数据库迁移相关 API 与类型定义
4
+ - 新增 统一 SCF/TCBR Agent 日志查询走 CLS searchClsLog
5
+ - 新增 code 入参并完善相关文档与测试
6
+
7
+ ---
8
+
9
+ ## @cloudbase/manager-node v5.6.4 版本发布 🚀(2026-07-23)
10
+
11
+ - 新增 code 入参并完善相关文档与测试
12
+ - 重构 更新默认 Runtime 为 Nodejs20.19
13
+ - 修复 移除创建云函数时 Timeout 默认值,改为透传 SCF 默认值
14
+
15
+ ---
16
+
17
+ ## @cloudbase/manager-node v5.6.3 版本发布 🚀(2026-07-16)
18
+
19
+ - 重构 更新默认 Runtime 为 Nodejs20.19
20
+ - 修复 移除创建云函数时 Timeout 默认值,改为透传 SCF 默认值
21
+
22
+ ---
23
+
1
24
  ## @cloudbase/manager-node v5.6.2 版本发布 🚀(2026-07-09)
2
25
 
3
26
  - 新增 支持镜像部署模式
@@ -8,6 +8,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.AccessService = void 0;
10
10
  const utils_1 = require("../utils");
11
+ /**
12
+ * HTTP Service(CloudBaseGW)访问服务。
13
+ * 注意:HTTP Service 模块自 v5.0.0 起已废弃,建议迁移到 EnvService 的域名与路由能力
14
+ * (如 createHttpServiceRoute / modifyHttpServiceRoute / deleteHttpServiceRoute)。
15
+ */
11
16
  class AccessService {
12
17
  constructor(environment) {
13
18
  this.environment = environment;
@@ -126,7 +126,7 @@ class CloudAppService {
126
126
  * @param params 上传参数
127
127
  */
128
128
  async uploadCode(params) {
129
- const { serviceName, localPath, ignore = [] } = params;
129
+ const { serviceName, localPath, ignore = [], onPhase } = params;
130
130
  // 1. 验证本地路径
131
131
  if (!fs_1.default.existsSync(localPath)) {
132
132
  throw new error_1.CloudBaseError(`本地路径不存在: ${localPath}`);
@@ -138,20 +138,27 @@ class CloudAppService {
138
138
  // 2. 打包本地文件为 ZIP
139
139
  const tmpZipPath = path_1.default.join(os_1.default.tmpdir(), `cloudapp-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`);
140
140
  const defaultIgnore = ['node_modules/**', '.git/**', '.DS_Store', '**/.DS_Store'];
141
+ const packStart = Date.now();
141
142
  await (0, utils_1.compressToZip)({
142
143
  dirPath: localPath,
143
144
  outputPath: tmpZipPath,
144
145
  ignore: [...defaultIgnore, ...ignore]
145
146
  });
147
+ const zipSize = fs_1.default.statSync(tmpZipPath).size;
148
+ onPhase === null || onPhase === void 0 ? void 0 : onPhase({ phase: 'pack', durationMs: Date.now() - packStart, bytes: zipSize });
146
149
  try {
147
150
  // 3. 获取上传凭证
151
+ const credStart = Date.now();
148
152
  const cosInfo = await this.describeCosInfo({
149
153
  deployType: params.deployType,
150
154
  serviceName,
151
155
  suffix: '.zip'
152
156
  });
157
+ onPhase === null || onPhase === void 0 ? void 0 : onPhase({ phase: 'credential', durationMs: Date.now() - credStart });
153
158
  // 4. 读取 ZIP 文件
159
+ const readStart = Date.now();
154
160
  const zipBuffer = fs_1.default.readFileSync(tmpZipPath);
161
+ onPhase === null || onPhase === void 0 ? void 0 : onPhase({ phase: 'read', durationMs: Date.now() - readStart, bytes: zipBuffer.length });
155
162
  // 5. 构建请求头
156
163
  const headers = {
157
164
  'Content-Type': 'application/zip'
@@ -162,6 +169,7 @@ class CloudAppService {
162
169
  }
163
170
  }
164
171
  // 6. 使用预签名 URL 上传
172
+ const putStart = Date.now();
165
173
  const response = await (0, http_request_1.fetchStream)(cosInfo.UploadUrl, {
166
174
  method: 'PUT',
167
175
  body: zipBuffer,
@@ -178,6 +186,7 @@ class CloudAppService {
178
186
  }
179
187
  throw new error_1.CloudBaseError(`上传失败: ${response.status} ${response.statusText}${errorDetail}`);
180
188
  }
189
+ onPhase === null || onPhase === void 0 ? void 0 : onPhase({ phase: 'upload', durationMs: Date.now() - putStart, bytes: zipBuffer.length });
181
190
  // 7. 返回结果(返回 cosTimestamp,用于创建应用)
182
191
  return {
183
192
  cosTimestamp: cosInfo.UnixTimestamp,
package/lib/index.js CHANGED
@@ -64,6 +64,10 @@ class CloudBase {
64
64
  get hosting() {
65
65
  return this.currentEnvironment().getHostingService();
66
66
  }
67
+ /**
68
+ * HTTP Service(CloudBaseGW)访问服务
69
+ * @deprecated 自 v5.0.0 起 HTTP Service 模块已废弃,请改用 env 下的域名与路由相关 API。
70
+ */
67
71
  get access() {
68
72
  return this.currentEnvironment().getAccessService();
69
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "5.6.5",
3
+ "version": "5.6.6",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -1,6 +1,11 @@
1
1
  import { Environment } from '../environment';
2
2
  import { ICreateAccessOptions, IApi, IUpdateOptions, IService, IDeleteOptions, IGetOptions, IDomainOptions } from './types';
3
3
  import { IResponseInfo } from '../interfaces';
4
+ /**
5
+ * HTTP Service(CloudBaseGW)访问服务。
6
+ * 注意:HTTP Service 模块自 v5.0.0 起已废弃,建议迁移到 EnvService 的域名与路由能力
7
+ * (如 createHttpServiceRoute / modifyHttpServiceRoute / deleteHttpServiceRoute)。
8
+ */
4
9
  export declare class AccessService {
5
10
  private tcbService;
6
11
  private environment;
@@ -299,6 +299,21 @@ export interface IProgressData {
299
299
  total: number;
300
300
  percent: number;
301
301
  }
302
+ /**
303
+ * 代码上传的分步阶段
304
+ */
305
+ export type UploadPhase = 'pack' | 'credential' | 'read' | 'upload';
306
+ /**
307
+ * 单个阶段计时信息(由 uploadCode 的 onPhase 回调触发)
308
+ */
309
+ export interface IUploadPhaseTiming {
310
+ /** 阶段名 */
311
+ phase: UploadPhase;
312
+ /** 耗时(ms) */
313
+ durationMs: number;
314
+ /** 字节数(pack: zip 大小; read/upload: buffer 大小) */
315
+ bytes?: number;
316
+ }
302
317
  /**
303
318
  * 上传代码参数
304
319
  */
@@ -313,6 +328,8 @@ export interface IUploadCloudAppCodeParams {
313
328
  ignore?: string[];
314
329
  /** 进度回调 */
315
330
  onProgress?: (progress: IProgressData) => void;
331
+ /** 分步计时回调(各阶段完成时触发,用于 verbose 模式输出耗时) */
332
+ onPhase?: (timing: IUploadPhaseTiming) => void;
316
333
  }
317
334
  /**
318
335
  * 上传代码结果
package/types/index.d.ts CHANGED
@@ -56,6 +56,10 @@ declare class CloudBase {
56
56
  get storage(): StorageService;
57
57
  get database(): DatabaseService;
58
58
  get hosting(): HostingService;
59
+ /**
60
+ * HTTP Service(CloudBaseGW)访问服务
61
+ * @deprecated 自 v5.0.0 起 HTTP Service 模块已废弃,请改用 env 下的域名与路由相关 API。
62
+ */
59
63
  get access(): AccessService;
60
64
  get mysql(): MysqlService;
61
65
  /**