@cloudbase/manager-node 4.2.1 → 4.2.2

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.
@@ -146,6 +146,9 @@ class FunctionService {
146
146
  functionPath,
147
147
  functionRootPath
148
148
  }, params.InstallDependency);
149
+ const { TopicId, LogsetId } = this.getClsServiceConfig();
150
+ params.ClsTopicId = TopicId;
151
+ params.ClsLogsetId = LogsetId;
149
152
  try {
150
153
  // 创建云函数
151
154
  const res = await this.scfService.request('CreateFunction', params);
@@ -854,6 +857,19 @@ class FunctionService {
854
857
  env: envConfig.EnvId
855
858
  };
856
859
  }
860
+ /**
861
+ * 获取日志cls配置信息
862
+ */
863
+ getClsServiceConfig() {
864
+ var _a, _b;
865
+ const currentEnv = this.environment.lazyEnvironmentConfig;
866
+ const customLogServices = (_a = currentEnv === null || currentEnv === void 0 ? void 0 : currentEnv.CustomLogServices) === null || _a === void 0 ? void 0 : _a[0];
867
+ const logServices = (_b = currentEnv === null || currentEnv === void 0 ? void 0 : currentEnv.LogServices) === null || _b === void 0 ? void 0 : _b[0];
868
+ return {
869
+ TopicId: (customLogServices === null || customLogServices === void 0 ? void 0 : customLogServices.ClsTopicId) || (logServices === null || logServices === void 0 ? void 0 : logServices.TopicId),
870
+ LogsetId: (customLogServices === null || customLogServices === void 0 ? void 0 : customLogServices.ClsLogsetId) || (logServices === null || logServices === void 0 ? void 0 : logServices.LogsetId)
871
+ };
872
+ }
857
873
  /**
858
874
  * 获取 vpc 信息
859
875
  * @returns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -165,7 +165,6 @@ export interface IPublishVersionRes extends IResponseInfo {
165
165
  Namespace: string
166
166
  }
167
167
 
168
-
169
168
  export interface IListFunctionVersionParams {
170
169
  functionName: string
171
170
  offset?: number
@@ -398,6 +397,10 @@ export class FunctionService {
398
397
  params.InstallDependency
399
398
  )
400
399
 
400
+ const { TopicId, LogsetId } = this.getClsServiceConfig()
401
+ params.ClsTopicId = TopicId
402
+ params.ClsLogsetId = LogsetId
403
+
401
404
  try {
402
405
  // 创建云函数
403
406
  const res = await this.scfService.request<IResponseInfo | ICreateFunctionRes>(
@@ -1296,6 +1299,19 @@ export class FunctionService {
1296
1299
  }
1297
1300
  }
1298
1301
 
1302
+ /**
1303
+ * 获取日志cls配置信息
1304
+ */
1305
+ private getClsServiceConfig() {
1306
+ const currentEnv = this.environment.lazyEnvironmentConfig
1307
+ const customLogServices = currentEnv?.CustomLogServices?.[0]
1308
+ const logServices = currentEnv?.LogServices?.[0]
1309
+ return {
1310
+ TopicId: customLogServices?.ClsTopicId || logServices?.TopicId,
1311
+ LogsetId: customLogServices?.ClsLogsetId || logServices?.LogsetId
1312
+ }
1313
+ }
1314
+
1299
1315
  /**
1300
1316
  * 获取 vpc 信息
1301
1317
  * @returns
@@ -139,7 +139,6 @@ export interface IFunctionCode {
139
139
  ZipFile: string
140
140
  }
141
141
 
142
-
143
142
  export interface ILayerVersionItem {
144
143
  LayerName: string
145
144
  LayerVersion: number
@@ -161,4 +160,6 @@ export interface IFunctionUpdateAttribute {
161
160
  EipConfig: { EipStatus: string; EipAddress: string[] }
162
161
  }
163
162
  Layers?: ILayerVersionItem[]
163
+ ClsLogsetId?: string
164
+ ClsTopicId?: string
164
165
  }
@@ -248,6 +248,12 @@ export interface EnvInfo {
248
248
  PackageName: string
249
249
  // 云日志服务列表
250
250
  LogServices: LogServiceInfo[]
251
+ CustomLogServices: {
252
+ CreateTime: string
253
+ ClsLogsetId: string
254
+ ClsTopicId: string
255
+ ClsRegion: string
256
+ }[]
251
257
  }
252
258
  export interface FunctionInfo {
253
259
  // 命名空间
@@ -360,6 +360,10 @@ export declare class FunctionService {
360
360
  * @memberof FunctionService
361
361
  */
362
362
  private getFunctionConfig;
363
+ /**
364
+ * 获取日志cls配置信息
365
+ */
366
+ private getClsServiceConfig;
363
367
  /**
364
368
  * 获取 vpc 信息
365
369
  * @returns
@@ -151,4 +151,6 @@ export interface IFunctionUpdateAttribute {
151
151
  };
152
152
  };
153
153
  Layers?: ILayerVersionItem[];
154
+ ClsLogsetId?: string;
155
+ ClsTopicId?: string;
154
156
  }
@@ -119,6 +119,12 @@ export interface EnvInfo {
119
119
  PackageId: string;
120
120
  PackageName: string;
121
121
  LogServices: LogServiceInfo[];
122
+ CustomLogServices: {
123
+ CreateTime: string;
124
+ ClsLogsetId: string;
125
+ ClsTopicId: string;
126
+ ClsRegion: string;
127
+ }[];
122
128
  }
123
129
  export interface FunctionInfo {
124
130
  Namespace?: string;