@cloudbase/manager-node 4.7.5 → 4.9.0

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.
@@ -205,10 +205,11 @@ class CloudRunService {
205
205
  */
206
206
  async detail(params) {
207
207
  const envConfig = this.environment.lazyEnvironmentConfig;
208
- return this.tcbrService.request('DescribeCloudRunServerDetail', {
208
+ const res = await this.tcbrService.request('DescribeCloudRunServerDetail', {
209
209
  EnvId: envConfig.EnvId,
210
210
  ServerName: params.serverName
211
211
  });
212
+ return res;
212
213
  }
213
214
  /**
214
215
  * 删除指定的云托管服务
@@ -248,7 +249,8 @@ class CloudRunService {
248
249
  * @returns {Promise<IResponseInfo>} 返回部署操作的响应信息
249
250
  */
250
251
  async deploy(params) {
251
- const { serverName, targetPath = process.cwd(), serverConfig, deployInfo: { ReleaseType = "FULL" } } = params;
252
+ var _a;
253
+ const { serverName, targetPath = process.cwd(), serverConfig } = params;
252
254
  /**
253
255
  * 参数校验和默认值设置
254
256
  */
@@ -296,7 +298,7 @@ class CloudRunService {
296
298
  RepoLanguage: 'Node.js'
297
299
  };
298
300
  }
299
- deployInfo.ReleaseType = ReleaseType;
301
+ deployInfo.ReleaseType = ((_a = params.deployInfo) === null || _a === void 0 ? void 0 : _a.ReleaseType) || "FULL";
300
302
  return this._upsertFunction(false, {
301
303
  name: serverName,
302
304
  deployInfo,
@@ -372,6 +374,33 @@ class CloudRunService {
372
374
  Items,
373
375
  });
374
376
  }
377
+ /**
378
+ * 获取部署记录列表,按部署时间倒序(最新在前)
379
+ */
380
+ async getDeployRecords(params) {
381
+ const envConfig = this.environment.lazyEnvironmentConfig;
382
+ const res = await this.tcbrService.request('DescribeCloudRunDeployRecord', {
383
+ EnvId: envConfig.EnvId,
384
+ ServerName: params.serverName,
385
+ });
386
+ res.DeployRecords.sort((a, b) => new Date(b.DeployTime).getTime() - new Date(a.DeployTime).getTime());
387
+ return res;
388
+ }
389
+ async getBuildLog(params) {
390
+ const envConfig = this.environment.lazyEnvironmentConfig;
391
+ let buildId = params.buildId;
392
+ if (!buildId) {
393
+ const sortedRes = await this.getDeployRecords({ serverName: params.serverName });
394
+ buildId = sortedRes.DeployRecords[0].BuildId;
395
+ }
396
+ return this.tcbrService.request('DescribeCloudRunBuildLog', {
397
+ EnvId: envConfig.EnvId,
398
+ ServerName: params.serverName,
399
+ ServerVersion: '',
400
+ BuildId: buildId,
401
+ Offset: 0,
402
+ });
403
+ }
375
404
  }
376
405
  exports.CloudRunService = CloudRunService;
377
406
  __decorate([
@@ -401,6 +430,12 @@ __decorate([
401
430
  __decorate([
402
431
  (0, utils_1.preLazy)()
403
432
  ], CloudRunService.prototype, "deploy", null);
433
+ __decorate([
434
+ (0, utils_1.preLazy)()
435
+ ], CloudRunService.prototype, "getDeployRecords", null);
436
+ __decorate([
437
+ (0, utils_1.preLazy)()
438
+ ], CloudRunService.prototype, "getBuildLog", null);
404
439
  async function codeToZip(cwd, options) {
405
440
  const archive = (0, archiver_1.default)('zip', {
406
441
  zlib: { level: 1 } // 保持与之前相同的压缩级别
@@ -131,7 +131,7 @@ class HostingService {
131
131
  * @param options
132
132
  */
133
133
  async uploadFiles(options) {
134
- const { localPath, cloudPath, files = [], onProgress, onFileFinish, parallel = 20, ignore, retryCount, retryInterval } = options;
134
+ const { localPath, cloudPath, files = [], onProgress, onFileFinish, parallel = 20, ignore = ['.DS_Store'], retryCount, retryInterval } = options;
135
135
  const hosting = await this.checkStatus();
136
136
  const { Bucket, Regoin } = hosting;
137
137
  const storageService = await this.environment.getStorageService();
package/lib/index.js CHANGED
@@ -24,8 +24,8 @@ class CloudBase {
24
24
  throw new Error('secretId and secretKey must be a pair');
25
25
  }
26
26
  this.cloudBaseConfig = {
27
- secretId,
28
- secretKey,
27
+ secretId: secretId ? secretId.trim() : secretId,
28
+ secretKey: secretKey ? secretKey.trim() : secretKey,
29
29
  token,
30
30
  envId,
31
31
  envType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "4.7.5",
3
+ "version": "4.9.0",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  import { Environment } from '../environment';
2
2
  import { IResponseInfo } from '../interfaces';
3
- import { CloudrunServerType, ICloudrunDetailResponse, ICloudrunListResponse, ICloudrunServerBaseConfig, ICloudrunServerBaseInfo, IDiffConfigItem, ITemplate, ReleaseTypeEnum } from './type';
3
+ import { CloudrunServerType, ICloudrunDetailResponse, ICloudrunListResponse, ICloudrunServerBaseConfig, ICloudrunServerBaseInfo, IBuildLogResponse, IDiffConfigItem, ITemplate, ReleaseTypeEnum, IDescribeCloudRunDeployRecordResponse } from './type';
4
4
  /**
5
5
  * 云托管服务管理类
6
6
  * 提供云托管服务的初始化、下载、列表查询和删除等功能
@@ -137,6 +137,16 @@ export declare class CloudRunService {
137
137
  getTemplates(): Promise<ITemplate[]>;
138
138
  private _checkFunctionExist;
139
139
  private _upsertFunction;
140
+ /**
141
+ * 获取部署记录列表,按部署时间倒序(最新在前)
142
+ */
143
+ getDeployRecords(params: {
144
+ serverName: string;
145
+ }): Promise<IDescribeCloudRunDeployRecordResponse>;
146
+ getBuildLog(params: {
147
+ serverName: string;
148
+ buildId?: number;
149
+ }): Promise<IBuildLogResponse>;
140
150
  }
141
151
  export declare function codeToZip(cwd: string, options?: {
142
152
  installDependency?: boolean;
@@ -405,3 +405,58 @@ export interface IReleaseOrderInfo {
405
405
  CreateTime?: string;
406
406
  IsReleasing?: boolean;
407
407
  }
408
+ /**
409
+ * DescribeCloudRunDeployRecord 单条部署记录
410
+ */
411
+ export interface ICloudRunDeployRecordInfo {
412
+ /** 部署 ID */
413
+ DeployId: string;
414
+ /** 部署时间,如 "2026-01-29 19:17:31" */
415
+ DeployTime: string;
416
+ /** 状态,如 "build_failed" | "running" 等 */
417
+ Status: string;
418
+ /** 运行版本 ID */
419
+ RunId: string;
420
+ /** 构建 ID */
421
+ BuildId: number;
422
+ /** 流量比例 0-100 */
423
+ FlowRatio: number;
424
+ /** 镜像地址 */
425
+ ImageUrl: string;
426
+ /** 扩缩容状态 */
427
+ ScaleStatus: string;
428
+ /** 是否已有流量 */
429
+ HasTraffic: boolean;
430
+ /** 流量类型 */
431
+ TrafficType: string;
432
+ /** 是否正在发布 */
433
+ IsReleasing: boolean;
434
+ }
435
+ export interface IDescribeCloudRunDeployRecordResponse {
436
+ DeployRecords: ICloudRunDeployRecordInfo[];
437
+ RequestId: string;
438
+ }
439
+ /**
440
+ * DescribeCloudRunBuildLog 返回的日志对象
441
+ */
442
+ export interface IBuildLog {
443
+ /** 日志总条数 */
444
+ Total: number;
445
+ /** 已返回条数 */
446
+ Delivered: number;
447
+ /** 日志内容 */
448
+ Text: string;
449
+ /** 是否还有更多 */
450
+ More: boolean;
451
+ /** 失败类型 */
452
+ FailType: string;
453
+ /** 失败原因 */
454
+ FailReason: string;
455
+ }
456
+ /**
457
+ * DescribeCloudRunBuildLog 响应
458
+ */
459
+ export interface IBuildLogResponse {
460
+ Log: IBuildLog;
461
+ RequestId: string;
462
+ }