@cloudbase/manager-node 4.2.1 → 4.2.3
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/lib/storage/index.js +10 -8
- 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/src/storage/index.ts +11 -2
- 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/lib/storage/index.js
CHANGED
|
@@ -839,13 +839,14 @@ class StorageService {
|
|
|
839
839
|
getCos(parallel = 20) {
|
|
840
840
|
const { secretId, secretKey, token, proxy } = this.environment.getAuthConfig();
|
|
841
841
|
const cosProxy = process.env.TCB_COS_PROXY;
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
842
|
+
const useCosInternalDomain = !!process.env.USE_COS_INTERNAL_DOMAIN;
|
|
843
|
+
return new cos_nodejs_sdk_v5_1.default(Object.assign({ FileParallelLimit: parallel, SecretId: secretId, SecretKey: secretKey, Proxy: cosProxy || proxy, SecurityToken: token }, (useCosInternalDomain
|
|
844
|
+
? {
|
|
845
|
+
Domain: '{Bucket}.cos-internal.{Region}.tencentcos.cn',
|
|
846
|
+
ServiceDomain: 'service.cos.tencentcos.cn',
|
|
847
|
+
Protocol: 'http:'
|
|
848
|
+
}
|
|
849
|
+
: {})));
|
|
849
850
|
}
|
|
850
851
|
/**
|
|
851
852
|
* 将 cloudPath 转换成 cloudPath/ 形式
|
|
@@ -919,7 +920,8 @@ class StorageService {
|
|
|
919
920
|
times: times - 1,
|
|
920
921
|
interval,
|
|
921
922
|
failedFiles: tempFailedFiles
|
|
922
|
-
})
|
|
923
|
+
})
|
|
924
|
+
.then(res => resolve(res))
|
|
923
925
|
.catch(err => reject(err)), interval);
|
|
924
926
|
});
|
|
925
927
|
}
|
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
|
// 命名空间
|
package/src/storage/index.ts
CHANGED
|
@@ -1137,13 +1137,21 @@ export class StorageService {
|
|
|
1137
1137
|
private getCos(parallel = 20) {
|
|
1138
1138
|
const { secretId, secretKey, token, proxy } = this.environment.getAuthConfig()
|
|
1139
1139
|
const cosProxy = process.env.TCB_COS_PROXY
|
|
1140
|
+
const useCosInternalDomain = !!process.env.USE_COS_INTERNAL_DOMAIN
|
|
1140
1141
|
|
|
1141
1142
|
return new COS({
|
|
1142
1143
|
FileParallelLimit: parallel,
|
|
1143
1144
|
SecretId: secretId,
|
|
1144
1145
|
SecretKey: secretKey,
|
|
1145
1146
|
Proxy: cosProxy || proxy,
|
|
1146
|
-
SecurityToken: token
|
|
1147
|
+
SecurityToken: token,
|
|
1148
|
+
...(useCosInternalDomain
|
|
1149
|
+
? {
|
|
1150
|
+
Domain: '{Bucket}.cos-internal.{Region}.tencentcos.cn',
|
|
1151
|
+
ServiceDomain: 'service.cos.tencentcos.cn',
|
|
1152
|
+
Protocol: 'http:'
|
|
1153
|
+
}
|
|
1154
|
+
: {})
|
|
1147
1155
|
})
|
|
1148
1156
|
}
|
|
1149
1157
|
|
|
@@ -1229,7 +1237,8 @@ export class StorageService {
|
|
|
1229
1237
|
times: times - 1,
|
|
1230
1238
|
interval,
|
|
1231
1239
|
failedFiles: tempFailedFiles
|
|
1232
|
-
})
|
|
1240
|
+
})
|
|
1241
|
+
.then(res => resolve(res))
|
|
1233
1242
|
.catch(err => reject(err)),
|
|
1234
1243
|
interval
|
|
1235
1244
|
)
|
|
@@ -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;
|