build: 0.0.22

This commit is contained in:
wss-git 2021-12-31 09:59:32 +08:00
parent 545b575b2e
commit 53524ca5a0
3 changed files with 3 additions and 3 deletions

2
dist/index.js vendored
View File

@ -33,7 +33,7 @@ You also can refer to the usage of fc-api and execute [s cli fc-api -h] for help
FC Invoke Result:`,"green"),console.log(a),se.log(`
`)}async getHttpTrigger(r,i){let{data:o}=await this.fcClient.listTriggers(r,i);if(se.debug(`get listTriggers: ${JSON.stringify(o)}`),ri.default.isEmpty(o.triggers))return[];let a=o.triggers.filter(c=>c.triggerType==="http"||c.triggerType==="https");return ri.default.isEmpty(a)?[]:a}async eventInvoke({serviceName:r,functionName:i,event:o,qualifier:a="LATEST",invocationType:c,statefulAsyncInvocationId:f}){if(c==="Sync"){let d=await this.fcClient.invokeFunction(r,i,o,{"X-Fc-Log-Type":"Tail","X-Fc-Invocation-Code-Version":"Latest","X-Fc-Invocation-Type":c},a);this.showLog(d.headers["x-fc-log-result"]),se.log(`
FC Invoke Result:`,"green"),console.log(d.data),console.log(`
`)}else{se.debug(`Stateful async invocation id: ${f}`);let{headers:d}=await this.fcClient.invokeFunction(r,i,o,{"X-Fc-Invocation-Code-Version":"Latest","X-Fc-Invocation-Type":c,"X-Fc-Stateful-Async-Invocation-Id":f},a),g=d["x-fc-request-id"];se.log(`
`)}else{se.debug(`Stateful async invocation id: ${f}`);let{headers:d}=await this.fcClient.invokeFunction(r,i,o,{"X-Fc-Invocation-Code-Version":"Latest","X-Fc-Invocation-Type":c,"X-Fc-Stateful-Async-Invocation-Id":f||""},a),g=d["x-fc-request-id"];se.log(`
${r}/${i} async invoke success.
${g?`request id: ${g}
`:""}`,"green")}}async httpInvoke({region:r,serviceName:i,functionName:o,event:a,qualifier:c}){let f=c?`.${c}`:"";a.path=`/proxy/${i}${f}/${o}/${a.path||""}`,se.log(`Request url: https://${this.accountId}.${r}.fc.aliyuncs.com/2016-08-15/proxy/${i}${f}/${o}/`),await this.request(a)}async request(r){let{headers:i={},queries:o,method:a="GET",path:c,body:f}=r;i["X-Fc-Log-Type"]||(i["X-Fc-Log-Type"]="Tail"),i["X-Fc-Invocation-Code-Version"]||(i["X-Fc-Invocation-Code-Version"]="Latest");let d;try{let g=a.toLocaleUpperCase();se.debug(`method is ${g}.`),se.debug("start invoke."),g==="GET"?d=await this.fcClient.costom_request("GET",c,o,null,i):g==="POST"?d=await this.fcClient.costom_request("POST",c,o,f,i):g==="PUT"?d=await this.fcClient.costom_request("PUT",c,null,f,i):g==="DELETE"?d=await this.fcClient.costom_request("DELETE",c,o,null,i):a.toLocaleUpperCase()==="PATCH"?d=await this.fcClient.costom_request("PATCH",c,o,f,i):a.toLocaleUpperCase()==="HEAD"?d=await this.fcClient.costom_request("HEAD",c,o,f,i):se.error(`Does not support ${a} requests temporarily.`)}catch(g){throw se.debug(g),g.message==="Unexpected token r in JSON at position 0"&&g.stack.includes("/fc2/lib/client.js")&&g.stack.includes("at Client.request")?new Error("The body in http responss is not in json format, but the content-type in response header is application/json. We recommend that you make the format of the response body be consistent with the content-type in response header."):g}se.debug("end invoke."),(d==null?void 0:d.err)?(this.showLog(d.headers["x-fc-log-result"]),se.log(`

View File

@ -1,6 +1,6 @@
{
"name": "fc-remote-invoke",
"version": "0.0.20",
"version": "0.0.22",
"description": "This is a component demo for Serverless Devs Tool ",
"keywords": [
"Serverless",

View File

@ -2,7 +2,7 @@ Type: Component
Name: fc-remote-invoke
Provider:
- 其它
Version: 0.0.21
Version: 0.0.22
Description: 初始化component模板
HomePage: https://www.serverless-devs.com
Tags: #标签详情