@cloudbase/manager-node 4.7.4-beta.1 → 4.7.4-beta.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.
@@ -25,7 +25,7 @@ function isNodeFunction(runtime) {
25
25
  }
26
26
  // 解析函数配置,换成请求参数
27
27
  function configToParams(options) {
28
- var _a, _b, _c, _d, _e;
28
+ var _a, _b, _c, _d, _e, _f, _g;
29
29
  const { func, codeSecret, baseParams } = options;
30
30
  let installDependency;
31
31
  // Node 函数默认安装依赖
@@ -81,6 +81,26 @@ function configToParams(options) {
81
81
  // HTTP 云函数类型
82
82
  if ((func === null || func === void 0 ? void 0 : func.type) === 'HTTP') {
83
83
  params.Type = 'HTTP';
84
+ // WebSocket 协议支持
85
+ if ((func === null || func === void 0 ? void 0 : func.protocolType) === 'WS') {
86
+ params.ProtocolType = 'WS';
87
+ // 协议参数,直接透传或使用默认值
88
+ // 参考文档:https://cloud.tencent.com/document/api/583/17244#ProtocolParams
89
+ const idleTimeOut = (_g = (_f = func === null || func === void 0 ? void 0 : func.protocolParams) === null || _f === void 0 ? void 0 : _f.wsParams) === null || _g === void 0 ? void 0 : _g.idleTimeOut;
90
+ params.ProtocolParams = {
91
+ WSParams: {
92
+ IdleTimeOut: typeof idleTimeOut === 'number' ? idleTimeOut : 15
93
+ }
94
+ };
95
+ }
96
+ // 多并发配置
97
+ // 参考文档:https://cloud.tencent.com/document/api/583/17244#InstanceConcurrencyConfig
98
+ if (func === null || func === void 0 ? void 0 : func.instanceConcurrencyConfig) {
99
+ params.InstanceConcurrencyConfig = {
100
+ DynamicEnabled: func.instanceConcurrencyConfig.dynamicEnabled || 'FALSE',
101
+ MaxConcurrency: func.instanceConcurrencyConfig.maxConcurrency || 10
102
+ };
103
+ }
84
104
  }
85
105
  // 云函数描述
86
106
  if (func === null || func === void 0 ? void 0 : func.description) {
@@ -1341,11 +1361,13 @@ class FunctionService {
1341
1361
  if (!(base64 === null || base64 === void 0 ? void 0 : base64.length)) {
1342
1362
  throw new error_1.CloudBaseError('文件不能为空');
1343
1363
  }
1364
+ console.log(`[${func.name}] 部署方式: ZIP base64 上传`);
1344
1365
  return {
1345
1366
  ZipFile: base64
1346
1367
  };
1347
1368
  }
1348
1369
  // 默认走 COS 上传
1370
+ console.log(`[${func.name}] 部署方式: COS 上传`);
1349
1371
  const legacyResult = await this.uploadFunctionZipToCosLegacy(options, installDependency);
1350
1372
  return {
1351
1373
  CosBucketRegion: constant_1.SCF_TEMP_COS.REGION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "4.7.4-beta.1",
3
+ "version": "4.7.4-beta.2",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -25,6 +25,16 @@ export interface ICloudFunction extends ICloudFunctionConfig {
25
25
  name: string;
26
26
  description?: string;
27
27
  type?: 'Event' | 'HTTP';
28
+ protocolType?: 'WS';
29
+ protocolParams?: {
30
+ wsParams?: {
31
+ idleTimeOut?: number;
32
+ };
33
+ };
34
+ instanceConcurrencyConfig?: {
35
+ dynamicEnabled?: 'FALSE';
36
+ maxConcurrency?: number;
37
+ };
28
38
  handler?: string;
29
39
  codeSecret?: string;
30
40
  isWaitInstall?: boolean;