@cloudbase/manager-node 5.5.6-beta.0 → 5.5.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/lib/env/index.js CHANGED
@@ -146,7 +146,7 @@ class EnvService {
146
146
  };
147
147
  const response = await this.describeEnvInfo(params);
148
148
  const envBaseInfo = (_a = response === null || response === void 0 ? void 0 : response.EnvInfo) === null || _a === void 0 ? void 0 : _a.EnvBaseInfo;
149
- // 成功获取环境信息,将 EnvBaseInfo 映射到 EnvInfo 类型
149
+ // EnvBaseInfo 完整映射到 EnvInfo 类型,避免新增字段被丢弃
150
150
  const envInfo = {
151
151
  EnvId: envBaseInfo.EnvId,
152
152
  Alias: envBaseInfo.Alias,
@@ -161,7 +161,22 @@ class EnvService {
161
161
  Region: envBaseInfo.Region || '',
162
162
  Source: envBaseInfo.Source,
163
163
  CreateTime: envBaseInfo.CreateTime,
164
- UpdateTime: envBaseInfo.UpdateTime
164
+ UpdateTime: envBaseInfo.UpdateTime,
165
+ StaticStorages: envBaseInfo.StaticStorages,
166
+ IsAutoDegrade: envBaseInfo.IsAutoDegrade,
167
+ EnvChannel: envBaseInfo.EnvChannel,
168
+ PayMode: envBaseInfo.PayMode,
169
+ IsDefault: envBaseInfo.IsDefault,
170
+ Tags: envBaseInfo.Tags,
171
+ EnvType: envBaseInfo.EnvType,
172
+ IsDauPackage: envBaseInfo.IsDauPackage,
173
+ PackageType: envBaseInfo.PackageType,
174
+ ArchitectureType: envBaseInfo.ArchitectureType,
175
+ Recycle: envBaseInfo.Recycle,
176
+ EnvPreferences: envBaseInfo.EnvPreferences,
177
+ Meta: envBaseInfo.Meta,
178
+ PostgreSQL: envBaseInfo.PostgreSQL,
179
+ EnvStatus: envBaseInfo.EnvStatus
165
180
  };
166
181
  return {
167
182
  EnvInfo: envInfo,
@@ -186,6 +201,18 @@ class EnvService {
186
201
  async describeEnvInfo(params) {
187
202
  return this.cloudService.request('DescribeEnvInfo', params);
188
203
  }
204
+ /**
205
+ * 判断当前环境是否为 PostgreSQL 环境
206
+ * PostgreSQL 字段为数组且长度 > 0 时视为 PG 环境
207
+ *
208
+ * @returns 是否为 PG 环境
209
+ */
210
+ async isPostgresqlEnv() {
211
+ var _a, _b;
212
+ const response = await this.describeEnvInfo({ EnvId: this.envId });
213
+ const postgresql = (_b = (_a = response === null || response === void 0 ? void 0 : response.EnvInfo) === null || _a === void 0 ? void 0 : _a.EnvBaseInfo) === null || _b === void 0 ? void 0 : _b.PostgreSQL;
214
+ return Array.isArray(postgresql) && postgresql.length > 0;
215
+ }
189
216
  /**
190
217
  * 修改环境名称
191
218
  * @param {string} alias 环境名称
@@ -374,11 +374,9 @@ class PermissionService {
374
374
  }
375
375
  /**
376
376
  * 判断当前环境是否为 PostgreSQL 环境
377
- * PostgreSQL 是数组且长度 > 0 时为 PG 环境
378
377
  */
379
378
  async isPostgresqlEnv() {
380
- const envBaseInfo = await this.getEnvBaseInfo();
381
- return Array.isArray(envBaseInfo.PostgreSQL) && envBaseInfo.PostgreSQL.length > 0;
379
+ return this.environment.getEnvService().isPostgresqlEnv();
382
380
  }
383
381
  /**
384
382
  * 判断当前环境的 authz_engine 是否为 opa
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "5.5.6-beta.0",
3
+ "version": "5.5.6",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -640,6 +640,13 @@ export declare class EnvService {
640
640
  * @returns 环境信息响应
641
641
  */
642
642
  describeEnvInfo(params: DescribeEnvInfoParams): Promise<DescribeEnvInfoResponse>;
643
+ /**
644
+ * 判断当前环境是否为 PostgreSQL 环境
645
+ * PostgreSQL 字段为数组且长度 > 0 时视为 PG 环境
646
+ *
647
+ * @returns 是否为 PG 环境
648
+ */
649
+ isPostgresqlEnv(): Promise<boolean>;
643
650
  /**
644
651
  * 修改环境名称
645
652
  * @param {string} alias 环境名称
@@ -120,12 +120,36 @@ export interface EnvInfo {
120
120
  PackageName: string;
121
121
  LogServices: LogServiceInfo[];
122
122
  CustomLogServices: {
123
- CreateTime: string;
124
- ClsLogsetId: string;
125
- ClsTopicId: string;
126
- ClsRegion: string;
123
+ CreateTime?: string;
124
+ ClsLogsetId?: string;
125
+ ClsTopicId?: string;
126
+ ClsRegion?: string;
127
127
  }[];
128
128
  Region: string;
129
+ StaticStorages?: StaticStorageInfo[];
130
+ IsAutoDegrade?: boolean;
131
+ EnvChannel?: string;
132
+ PayMode?: string;
133
+ IsDefault?: boolean;
134
+ Tags?: Array<{
135
+ Key: string;
136
+ Value: string;
137
+ }>;
138
+ EnvType?: string;
139
+ IsDauPackage?: boolean;
140
+ PackageType?: string;
141
+ ArchitectureType?: string;
142
+ Recycle?: string;
143
+ EnvPreferences?: Array<{
144
+ Key?: string;
145
+ Value?: string;
146
+ }> | Record<string, any>;
147
+ Meta?: Array<{
148
+ Key: string;
149
+ Value: string;
150
+ }>;
151
+ PostgreSQL?: PostgreSQLInfo[] | Record<string, any>;
152
+ EnvStatus?: string;
129
153
  }
130
154
  export interface FunctionInfo {
131
155
  Namespace?: string;
@@ -135,12 +159,38 @@ export interface DatabasesInfo {
135
159
  InstanceId?: string;
136
160
  Status?: string;
137
161
  Region?: string;
162
+ UpdateTime?: string;
163
+ }
164
+ export interface ExternalStorage {
165
+ BucketName?: string;
166
+ Region?: string;
167
+ BasePath?: string;
168
+ Enabled?: boolean;
169
+ Provider?: string;
138
170
  }
139
171
  export interface StorageInfo {
140
172
  Region?: string;
141
173
  Bucket?: string;
142
174
  CdnDomain?: string;
143
175
  AppId?: string;
176
+ DomainType?: string;
177
+ AccessAutoDisable?: boolean;
178
+ AccessExpire?: number;
179
+ ExternalStorage?: ExternalStorage;
180
+ CustomDomain?: string;
181
+ Status?: string;
182
+ }
183
+ export interface StaticStorageInfo {
184
+ StaticDomain?: string;
185
+ DefaultDirName?: string;
186
+ Status?: string;
187
+ Region?: string;
188
+ Bucket?: string;
189
+ EnvId?: string;
190
+ DomainType?: string;
191
+ AccessAutoDisable?: boolean;
192
+ AccessExpire?: number;
193
+ ExternalStorage?: ExternalStorage;
144
194
  }
145
195
  export interface LogServiceInfo {
146
196
  LogsetName?: string;
@@ -148,6 +198,15 @@ export interface LogServiceInfo {
148
198
  TopicName?: string;
149
199
  TopicId?: string;
150
200
  Region?: string;
201
+ Period?: number;
202
+ BillingMode?: string;
203
+ }
204
+ export interface PostgreSQLInfo {
205
+ Name?: string;
206
+ InstanceName?: string;
207
+ Status?: number;
208
+ Region?: string;
209
+ Version?: string;
151
210
  }
152
211
  export interface VoucherUseHistory {
153
212
  VoucherId?: string;
@@ -171,6 +230,27 @@ export interface PackageInfo {
171
230
  Desc?: string;
172
231
  Detail?: string;
173
232
  }
233
+ export interface CodeNumPair {
234
+ Code: string;
235
+ Num: number;
236
+ }
237
+ export interface QpsConfig {
238
+ QpsQuota?: number;
239
+ QpsCustomLimit?: number;
240
+ }
241
+ export interface OrderInfo {
242
+ TranId?: string;
243
+ PackageId?: string;
244
+ TranType?: string;
245
+ TranStatus?: string;
246
+ UpdateTime?: string;
247
+ CreateTime?: string;
248
+ PayMode?: string;
249
+ ExtensionId?: string;
250
+ ResourceReady?: string;
251
+ Flag?: string;
252
+ ReqBody?: string;
253
+ }
174
254
  export interface EnvBillingInfoItem {
175
255
  EnvId?: string;
176
256
  PackageId?: string;
@@ -183,11 +263,25 @@ export interface EnvBillingInfoItem {
183
263
  UpdateTime?: string;
184
264
  IsAlwaysFree?: boolean;
185
265
  PaymentChannel?: string;
266
+ OrderInfo?: OrderInfo;
267
+ FreeQuota?: string;
268
+ EnableOverrun?: boolean;
269
+ ExtPackageType?: string;
270
+ EnvCharged?: string;
271
+ EnvActivated?: string;
272
+ EnvPaid?: string;
273
+ EnvOrigin?: string;
274
+ ResourceId?: string;
275
+ BillTime?: string;
276
+ EnvAutoId?: number;
186
277
  PackageName?: string;
187
- ExtPackageCode?: {
188
- Code: string;
189
- Num: number;
190
- }[];
278
+ ExtPackageCode?: CodeNumPair[];
279
+ TipList?: string;
280
+ EnvDeductionMode?: string;
281
+ PointsTime?: string;
282
+ QpsQuota?: number;
283
+ QpsCustomLimit?: number;
284
+ EnvQps?: QpsConfig;
191
285
  }
192
286
  export interface InvoiceVATGeneral {
193
287
  TaxPayerType?: string;
@@ -469,62 +563,73 @@ export interface DescribeEnvInfoParams {
469
563
  }
470
564
  export interface EnvBaseInfo {
471
565
  EnvId?: string;
566
+ Source?: string;
472
567
  Alias?: string;
568
+ CreateTime?: string;
569
+ UpdateTime?: string;
473
570
  Status?: string;
474
- EnvType?: string;
475
- Region?: string;
476
- PackageId?: string;
477
- PackageName?: string;
478
571
  Databases?: DatabasesInfo[];
479
572
  Storages?: StorageInfo[];
480
573
  Functions?: FunctionInfo[];
574
+ PackageId?: string;
575
+ PackageName?: string;
576
+ LogServices?: LogServiceInfo[] | null;
577
+ StaticStorages?: StaticStorageInfo[];
578
+ IsAutoDegrade?: boolean;
579
+ EnvChannel?: string;
481
580
  PayMode?: string;
482
- Source?: string;
581
+ IsDefault?: boolean;
582
+ Region?: string;
483
583
  Tags?: Array<{
484
584
  Key: string;
485
585
  Value: string;
486
586
  }>;
587
+ CustomLogServices?: Array<{
588
+ ClsRegion?: string;
589
+ ClsLogsetId?: string;
590
+ ClsTopicId?: string;
591
+ CreateTime?: string;
592
+ }> | null;
593
+ EnvType?: string;
594
+ IsDauPackage?: boolean;
595
+ PackageType?: string;
596
+ ArchitectureType?: string;
597
+ Recycle?: string;
598
+ EnvPreferences?: Array<{
599
+ Key?: string;
600
+ Value?: string;
601
+ }> | Record<string, any>;
487
602
  Meta?: Array<{
488
603
  Key: string;
489
604
  Value: string;
490
605
  }>;
606
+ PostgreSQL?: PostgreSQLInfo[] | Record<string, any>;
607
+ EnvStatus?: string;
608
+ }
609
+ export interface AccountInfoInner {
610
+ Uin?: number | string;
611
+ AppId?: number | string;
612
+ WxAppId?: string;
613
+ OpenAppId?: string;
491
614
  CreateTime?: string;
492
615
  UpdateTime?: string;
493
- EnvPreferences?: Record<string, any>;
494
- IsAutoDegrade?: boolean;
495
- IsDauPackage?: boolean;
496
- PostgreSQL?: Record<string, any>;
497
- LogServices?: Array<{
498
- LogsetId?: string;
499
- TopicId?: string;
500
- TopicName?: string;
501
- Region?: string;
502
- }> | null;
503
- CustomLogServices?: Array<{
504
- CreateTime: string;
505
- ClsLogsetId: string;
506
- ClsTopicId: string;
507
- ClsRegion: string;
508
- }> | null;
509
616
  }
617
+ /**
618
+ * 计费信息(保留 BillingInfo 用于向后兼容;DescribeEnvInfo 接口的 BillingInfo 实际为 EnvBillingInfoItem)
619
+ */
510
620
  export interface BillingInfo {
511
621
  StartTime?: string;
512
622
  EndTime?: string;
513
623
  Status?: string;
514
624
  }
515
- export interface UserInfo {
516
- AppId?: string;
517
- Uin?: string;
518
- WxAppId?: string;
519
- }
520
625
  export interface DescribeEnvInfoResponse extends IResponseInfo {
521
626
  EnvInfo?: {
522
627
  EnvBaseInfo?: EnvBaseInfo;
523
- BillingInfo?: BillingInfo;
524
- UserInfo?: UserInfo;
628
+ BillingInfo?: EnvBillingInfoItem;
629
+ UserInfo?: AccountInfoInner;
525
630
  Eid?: number;
631
+ SiteFlag?: string;
526
632
  CircleStartTime?: string;
527
633
  CircleEndTime?: string;
528
- SiteFlag?: number;
529
634
  };
530
635
  }
@@ -66,7 +66,6 @@ export declare class PermissionService {
66
66
  private getEnvBaseInfo;
67
67
  /**
68
68
  * 判断当前环境是否为 PostgreSQL 环境
69
- * PostgreSQL 是数组且长度 > 0 时为 PG 环境
70
69
  */
71
70
  private isPostgresqlEnv;
72
71
  /**