File tree Expand file tree Collapse file tree 4 files changed +44
-7
lines changed Expand file tree Collapse file tree 4 files changed +44
-7
lines changed Original file line number Diff line number Diff line change @@ -440,7 +440,8 @@ export default class ApiEntity {
440
440
const authType = endpoint ?. auth ? 'SECRET' : endpoint ?. authType ?? 'NONE' ;
441
441
442
442
const apiInputs : { [ key : string ] : any } = {
443
- protocol : endpoint ?. protocol ?? 'HTTP' ,
443
+ // protocol: endpoint?.protocol ?? 'HTTP',
444
+ protocol : endpoint ?. protocolType ?? 'HTTP' ,
444
445
serviceId : serviceId ,
445
446
apiName : endpoint ?. apiName ?? 'index' ,
446
447
apiDesc : endpoint ?. description ,
@@ -450,7 +451,7 @@ export default class ApiEntity {
450
451
serviceType : endpoint ?. serviceType ?? 'SCF' ,
451
452
requestConfig : {
452
453
path : endpoint ?. path ,
453
- method : endpoint ?. method ,
454
+ method : endpoint ?. protocolType === 'WEBSOCKET' ? 'GET' : endpoint ?. method ,
454
455
} ,
455
456
serviceTimeout : endpoint ?. serviceTimeout ?? 15 ,
456
457
responseType : endpoint ?. responseType ?? 'HTML' ,
Original file line number Diff line number Diff line change @@ -263,8 +263,8 @@ export default class ServiceEntity {
263
263
serviceId,
264
264
protocols,
265
265
netTypes,
266
- serviceName = 'serverless ' ,
267
- serviceDesc = 'Created By Serverless' ,
266
+ serviceName = '' ,
267
+ serviceDesc,
268
268
} = serviceConf ;
269
269
270
270
let detail : Detail | null ;
@@ -284,6 +284,7 @@ export default class ServiceEntity {
284
284
if ( detail ) {
285
285
detail . InnerSubDomain = detail . InternalSubDomain ;
286
286
exist = true ;
287
+ serviceName ? ( outputs . serviceName = detail . ServiceName ) : '' ;
287
288
outputs . serviceId = detail ! . ServiceId ;
288
289
outputs . subDomain =
289
290
detail ! . OuterSubDomain && detail ! . InnerSubDomain
@@ -312,11 +313,18 @@ export default class ServiceEntity {
312
313
const apiInputs = {
313
314
Action : 'ModifyService' as const ,
314
315
serviceId,
315
- serviceDesc : serviceDesc || detail . ServiceDesc ,
316
- serviceName : serviceName || detail . ServiceName ,
316
+ serviceDesc : serviceDesc || detail . ServiceDesc || undefined ,
317
+ serviceName : serviceName || detail . ServiceName || undefined ,
317
318
protocol : protocols ,
318
319
netTypes : netTypes ,
319
320
} ;
321
+ if ( ! serviceName ) {
322
+ delete apiInputs . serviceName ;
323
+ }
324
+ if ( ! serviceDesc ) {
325
+ delete apiInputs . serviceDesc ;
326
+ }
327
+
320
328
await this . request ( apiInputs ) ;
321
329
}
322
330
}
Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ export interface FunctionCode {
14
14
Args ?: string ;
15
15
} ;
16
16
}
17
+
18
+ export interface WSParams {
19
+ idleTimeOut ?: number ;
20
+ IdleTimeOut ?: number ;
21
+ }
22
+ export interface ProtocolParams {
23
+ wsParams ?: WSParams ;
24
+ WSParams ?: WSParams ;
25
+ }
26
+
17
27
export interface BaseFunctionConfig {
18
28
FunctionName : string ;
19
29
Code ?: FunctionCode ;
@@ -53,6 +63,8 @@ export interface BaseFunctionConfig {
53
63
AsyncRunEnable ?: 'TRUE' | 'FALSE' ;
54
64
TraceEnable ?: 'TRUE' | 'FALSE' ;
55
65
InstallDependency ?: 'TRUE' | 'FALSE' ;
66
+ ProtocolType ?: string ;
67
+ ProtocolParams ?: ProtocolParams ;
56
68
}
57
69
58
70
export interface TriggerType {
@@ -215,6 +227,9 @@ export interface ScfCreateFunctionInputs {
215
227
// 异步调用重试配置
216
228
msgTTL ?: number ; // 消息保留时间,单位秒
217
229
retryNum ?: number ; // 重试次数
230
+
231
+ protocolType ?: string ;
232
+ protocolParams ?: ProtocolParams ;
218
233
}
219
234
220
235
export interface ScfUpdateAliasTrafficInputs {
@@ -257,6 +272,8 @@ export interface ScfDeployInputs extends ScfCreateFunctionInputs {
257
272
258
273
// 是否忽略触发器操作流程
259
274
ignoreTriggers ?: boolean ;
275
+ protocolType ?: string ;
276
+ protocolParams ?: ProtocolParams ;
260
277
}
261
278
262
279
export interface ScfDeployOutputs {
Original file line number Diff line number Diff line change 1
- import { ScfCreateFunctionInputs , BaseFunctionConfig } from './interface' ;
1
+ import { ScfCreateFunctionInputs , BaseFunctionConfig , ProtocolParams } from './interface' ;
2
2
const CONFIGS = require ( './config' ) . default ;
3
3
4
4
// get function basement configure
@@ -66,6 +66,17 @@ export const formatInputs = (inputs: ScfCreateFunctionInputs) => {
66
66
}
67
67
68
68
// 非必须参数
69
+ if ( inputs . type === 'web' ) {
70
+ if ( inputs . protocolType ) {
71
+ functionInputs . ProtocolType = inputs . protocolType ;
72
+ if ( inputs . protocolParams ?. wsParams ?. idleTimeOut ) {
73
+ const protocolParams : ProtocolParams = { } ;
74
+ protocolParams . WSParams = { IdleTimeOut : inputs . protocolParams ?. wsParams ?. idleTimeOut } ;
75
+ functionInputs . ProtocolParams = protocolParams ;
76
+ }
77
+ }
78
+ }
79
+
69
80
if ( inputs . role ) {
70
81
functionInputs . Role = inputs . role ;
71
82
}
You can’t perform that action at this time.
0 commit comments