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 {
440440 const authType = endpoint ?. auth ? 'SECRET' : endpoint ?. authType ?? 'NONE' ;
441441
442442 const apiInputs : { [ key : string ] : any } = {
443- protocol : endpoint ?. protocol ?? 'HTTP' ,
443+ // protocol: endpoint?.protocol ?? 'HTTP',
444+ protocol : endpoint ?. protocolType ?? 'HTTP' ,
444445 serviceId : serviceId ,
445446 apiName : endpoint ?. apiName ?? 'index' ,
446447 apiDesc : endpoint ?. description ,
@@ -450,7 +451,7 @@ export default class ApiEntity {
450451 serviceType : endpoint ?. serviceType ?? 'SCF' ,
451452 requestConfig : {
452453 path : endpoint ?. path ,
453- method : endpoint ?. method ,
454+ method : endpoint ?. protocolType === 'WEBSOCKET' ? 'GET' : endpoint ?. method ,
454455 } ,
455456 serviceTimeout : endpoint ?. serviceTimeout ?? 15 ,
456457 responseType : endpoint ?. responseType ?? 'HTML' ,
Original file line number Diff line number Diff line change @@ -263,8 +263,8 @@ export default class ServiceEntity {
263263 serviceId,
264264 protocols,
265265 netTypes,
266- serviceName = 'serverless ' ,
267- serviceDesc = 'Created By Serverless' ,
266+ serviceName = '' ,
267+ serviceDesc,
268268 } = serviceConf ;
269269
270270 let detail : Detail | null ;
@@ -284,6 +284,7 @@ export default class ServiceEntity {
284284 if ( detail ) {
285285 detail . InnerSubDomain = detail . InternalSubDomain ;
286286 exist = true ;
287+ serviceName ? ( outputs . serviceName = detail . ServiceName ) : '' ;
287288 outputs . serviceId = detail ! . ServiceId ;
288289 outputs . subDomain =
289290 detail ! . OuterSubDomain && detail ! . InnerSubDomain
@@ -312,11 +313,18 @@ export default class ServiceEntity {
312313 const apiInputs = {
313314 Action : 'ModifyService' as const ,
314315 serviceId,
315- serviceDesc : serviceDesc || detail . ServiceDesc ,
316- serviceName : serviceName || detail . ServiceName ,
316+ serviceDesc : serviceDesc || detail . ServiceDesc || undefined ,
317+ serviceName : serviceName || detail . ServiceName || undefined ,
317318 protocol : protocols ,
318319 netTypes : netTypes ,
319320 } ;
321+ if ( ! serviceName ) {
322+ delete apiInputs . serviceName ;
323+ }
324+ if ( ! serviceDesc ) {
325+ delete apiInputs . serviceDesc ;
326+ }
327+
320328 await this . request ( apiInputs ) ;
321329 }
322330 }
Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ export interface FunctionCode {
1414 Args ?: string ;
1515 } ;
1616}
17+
18+ export interface WSParams {
19+ idleTimeOut ?: number ;
20+ IdleTimeOut ?: number ;
21+ }
22+ export interface ProtocolParams {
23+ wsParams ?: WSParams ;
24+ WSParams ?: WSParams ;
25+ }
26+
1727export interface BaseFunctionConfig {
1828 FunctionName : string ;
1929 Code ?: FunctionCode ;
@@ -53,6 +63,8 @@ export interface BaseFunctionConfig {
5363 AsyncRunEnable ?: 'TRUE' | 'FALSE' ;
5464 TraceEnable ?: 'TRUE' | 'FALSE' ;
5565 InstallDependency ?: 'TRUE' | 'FALSE' ;
66+ ProtocolType ?: string ;
67+ ProtocolParams ?: ProtocolParams ;
5668}
5769
5870export interface TriggerType {
@@ -215,6 +227,9 @@ export interface ScfCreateFunctionInputs {
215227 // 异步调用重试配置
216228 msgTTL ?: number ; // 消息保留时间,单位秒
217229 retryNum ?: number ; // 重试次数
230+
231+ protocolType ?: string ;
232+ protocolParams ?: ProtocolParams ;
218233}
219234
220235export interface ScfUpdateAliasTrafficInputs {
@@ -257,6 +272,8 @@ export interface ScfDeployInputs extends ScfCreateFunctionInputs {
257272
258273 // 是否忽略触发器操作流程
259274 ignoreTriggers ?: boolean ;
275+ protocolType ?: string ;
276+ protocolParams ?: ProtocolParams ;
260277}
261278
262279export 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' ;
22const CONFIGS = require ( './config' ) . default ;
33
44// get function basement configure
@@ -66,6 +66,17 @@ export const formatInputs = (inputs: ScfCreateFunctionInputs) => {
6666 }
6767
6868 // 非必须参数
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+
6980 if ( inputs . role ) {
7081 functionInputs . Role = inputs . role ;
7182 }
You can’t perform that action at this time.
0 commit comments