@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.
- package/lib/function/index.js +16 -0
- package/package.json +1 -1
- package/src/function/index.ts +17 -1
- package/src/function/types.ts +2 -1
- package/src/interfaces/tcb.interface.ts +6 -0
- package/types/function/index.d.ts +4 -0
- package/types/function/types.d.ts +2 -0
- package/types/interfaces/tcb.interface.d.ts +6 -0
package/lib/function/index.js
CHANGED
|
@@ -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
package/src/function/index.ts
CHANGED
|
@@ -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
|
package/src/function/types.ts
CHANGED
|
@@ -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
|
// 命名空间
|
|
@@ -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;
|