refactor: version 0.0.7

This commit is contained in:
wss-git 2021-06-09 11:15:08 +08:00
parent 9b74bd56c2
commit 2b7c19294d
45 changed files with 1024 additions and 729 deletions

View File

@ -1 +1 @@
window.searchData = {"kinds":{"128":"Class","512":"Constructor","1024":"Property","2048":"Method"},"rows":[{"id":0,"kind":128,"name":"default","url":"classes/default.html","classes":"tsd-kind-class"},{"id":1,"kind":512,"name":"constructor","url":"classes/default.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"default"},{"id":2,"kind":2048,"name":"report","url":"classes/default.html#report","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"},{"id":3,"kind":2048,"name":"startExpress","url":"classes/default.html#startexpress","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"},{"id":4,"kind":2048,"name":"handlerInputs","url":"classes/default.html#handlerinputs","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"},{"id":5,"kind":2048,"name":"start","url":"classes/default.html#start","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"},{"id":6,"kind":2048,"name":"invoke","url":"classes/default.html#invoke","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"},{"id":7,"kind":1024,"name":"client","url":"classes/default.html#client","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"default"},{"id":8,"kind":1024,"name":"inputs","url":"classes/default.html#inputs","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"default"},{"id":9,"kind":2048,"name":"__getBasePath","url":"classes/default.html#__getbasepath","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"default"},{"id":10,"kind":2048,"name":"__doc","url":"classes/default.html#__doc","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"default"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,0.426]],["parent/0",[]],["name/1",[1,20.794]],["parent/1",[0,0.041]],["name/2",[2,20.794]],["parent/2",[0,0.041]],["name/3",[3,20.794]],["parent/3",[0,0.041]],["name/4",[4,20.794]],["parent/4",[0,0.041]],["name/5",[5,20.794]],["parent/5",[0,0.041]],["name/6",[6,20.794]],["parent/6",[0,0.041]],["name/7",[7,20.794]],["parent/7",[0,0.041]],["name/8",[8,20.794]],["parent/8",[0,0.041]],["name/9",[9,20.794]],["parent/9",[0,0.041]],["name/10",[10,20.794]],["parent/10",[0,0.041]]],"invertedIndex":[["__doc",{"_index":10,"name":{"10":{}},"parent":{}}],["__getbasepath",{"_index":9,"name":{"9":{}},"parent":{}}],["client",{"_index":7,"name":{"7":{}},"parent":{}}],["constructor",{"_index":1,"name":{"1":{}},"parent":{}}],["default",{"_index":0,"name":{"0":{}},"parent":{"1":{},"2":{},"3":{},"4":{},"5":{},"6":{},"7":{},"8":{},"9":{},"10":{}}}],["handlerinputs",{"_index":4,"name":{"4":{}},"parent":{}}],["inputs",{"_index":8,"name":{"8":{}},"parent":{}}],["invoke",{"_index":6,"name":{"6":{}},"parent":{}}],["report",{"_index":2,"name":{"2":{}},"parent":{}}],["start",{"_index":5,"name":{"5":{}},"parent":{}}],["startexpress",{"_index":3,"name":{"3":{}},"parent":{}}]],"pipeline":[]}}
window.searchData = {"kinds":{"128":"Class","512":"Constructor","2048":"Method"},"rows":[{"id":0,"kind":128,"name":"default","url":"classes/default.html","classes":"tsd-kind-class"},{"id":1,"kind":512,"name":"constructor","url":"classes/default.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"default"},{"id":2,"kind":2048,"name":"report","url":"classes/default.html#report","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"},{"id":3,"kind":2048,"name":"handlerInputs","url":"classes/default.html#handlerinputs","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"},{"id":4,"kind":2048,"name":"invoke","url":"classes/default.html#invoke","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,0.87]],["parent/0",[]],["name/1",[1,13.863]],["parent/1",[0,0.079]],["name/2",[2,13.863]],["parent/2",[0,0.079]],["name/3",[3,13.863]],["parent/3",[0,0.079]],["name/4",[4,13.863]],["parent/4",[0,0.079]]],"invertedIndex":[["constructor",{"_index":1,"name":{"1":{}},"parent":{}}],["default",{"_index":0,"name":{"0":{}},"parent":{"1":{},"2":{},"3":{},"4":{}}}],["handlerinputs",{"_index":3,"name":{"3":{}},"parent":{}}],["invoke",{"_index":4,"name":{"4":{}},"parent":{}}],["report",{"_index":2,"name":{"2":{}},"parent":{}}]],"pipeline":[]}}

View File

@ -3,8 +3,8 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>default | fc-local-invoke</title>
<meta name="description" content="Documentation for fc-local-invoke">
<title>default | fc-remote-invoke</title>
<meta name="description" content="Documentation for fc-remote-invoke">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<script async src="../assets/js/search.js" id="search-script"></script>
@ -23,7 +23,7 @@
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">fc-local-invoke</a>
<a href="../index.html" class="title">fc-remote-invoke</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
@ -52,7 +52,7 @@
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../modules.html">fc-local-invoke</a>
<a href="../modules.html">fc-remote-invoke</a>
</li>
<li>
<a href="default.html">default</a>
@ -69,12 +69,7 @@
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="tsd-signature-type">BaseComponent</span>
<ul class="tsd-hierarchy">
<li>
<span class="target">default</span>
</li>
</ul>
<span class="target">default</span>
</li>
</ul>
</section>
@ -85,26 +80,15 @@
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="default.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-inherited tsd-is-private-protected">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="default.html#client" class="tsd-kind-icon">client</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="default.html#inputs" class="tsd-kind-icon">inputs</a></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="default.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="default.html#__doc" class="tsd-kind-icon">__doc</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="default.html#__getbasepath" class="tsd-kind-icon">__get<wbr>Base<wbr>Path</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="default.html#handlerinputs" class="tsd-kind-icon">handler<wbr>Inputs</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="default.html#invoke" class="tsd-kind-icon">invoke</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="default.html#report" class="tsd-kind-icon">report</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="default.html#start" class="tsd-kind-icon">start</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="default.html#startexpress" class="tsd-kind-icon">start<wbr>Express</a></li>
</ul>
</section>
</div>
@ -112,97 +96,23 @@
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
<li class="tsd-signature tsd-kind-icon">new default<span class="tsd-signature-symbol">(</span>props<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="default.html" class="tsd-signature-type" data-tsd-kind="Class">default</a></li>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new default<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="default.html" class="tsd-signature-type" data-tsd-kind="Class">default</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Overrides BaseComponent.constructor</p>
<ul>
<li>Defined in index.ts:28</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>props: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="default.html" class="tsd-signature-type" data-tsd-kind="Class">default</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-inherited tsd-is-private-protected">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
<a name="client" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagProtected">Protected</span> client</h3>
<div class="tsd-signature tsd-kind-icon">client<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<p>Inherited from BaseComponent.client</p>
<ul>
<li>Defined in common/base.ts:9</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
<a name="inputs" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagProtected">Protected</span> inputs</h3>
<div class="tsd-signature tsd-kind-icon">inputs<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<p>Inherited from BaseComponent.inputs</p>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="__doc" class="tsd-anchor"></a>
<h3>__doc</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">__doc<span class="tsd-signature-symbol">(</span>projectName<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from BaseComponent.__doc</p>
<ul>
<li>Defined in common/base.ts:34</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> projectName: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="__getbasepath" class="tsd-anchor"></a>
<h3>__get<wbr>Base<wbr>Path</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">__get<wbr>Base<wbr>Path<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from BaseComponent.__getBasePath</p>
<ul>
<li>Defined in common/base.ts:21</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="handlerinputs" class="tsd-anchor"></a>
<h3>handler<wbr>Inputs</h3>
@ -213,7 +123,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in index.ts:56</li>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/534180c/src/index.ts#L16">index.ts:16</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
@ -236,7 +146,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in index.ts:197</li>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/534180c/src/index.ts#L98">index.ts:98</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -258,13 +168,13 @@
<a name="report" class="tsd-anchor"></a>
<h3>report</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">report<span class="tsd-signature-symbol">(</span>componentName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, command<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, accountID<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, access<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li>
<li class="tsd-signature tsd-kind-icon">report<span class="tsd-signature-symbol">(</span>componentName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, command<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, accountID<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in index.ts:33</li>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/534180c/src/index.ts#L9">index.ts:9</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
@ -276,67 +186,13 @@
<h5>command: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> accountID: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> access: <span class="tsd-signature-type">string</span></h5>
<h5>accountID: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="start" class="tsd-anchor"></a>
<h3>start</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">start<span class="tsd-signature-symbol">(</span>inputs<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">InputProps</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in index.ts:109</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>http 函数本地调试</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>inputs: <span class="tsd-signature-type">InputProps</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="startexpress" class="tsd-anchor"></a>
<h3>start<wbr>Express</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">start<wbr>Express<span class="tsd-signature-symbol">(</span>app<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in index.ts:46</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>app: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
@ -354,21 +210,9 @@
<li class="current tsd-kind-class">
<a href="default.html" class="tsd-kind-icon">default</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="default.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
<a href="default.html#client" class="tsd-kind-icon">client</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
<a href="default.html#inputs" class="tsd-kind-icon">inputs</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="default.html#__doc" class="tsd-kind-icon">__doc</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="default.html#__getbasepath" class="tsd-kind-icon">__get<wbr>Base<wbr>Path</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="default.html#handlerinputs" class="tsd-kind-icon">handler<wbr>Inputs</a>
</li>
@ -378,12 +222,6 @@
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="default.html#report" class="tsd-kind-icon">report</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="default.html#start" class="tsd-kind-icon">start</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="default.html#startexpress" class="tsd-kind-icon">start<wbr>Express</a>
</li>
</ul>
</li>
</ul>
@ -401,9 +239,6 @@
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
</ul>
</div>
</div>
</footer>

View File

@ -1,6 +1,6 @@
{
"id": 0,
"name": "fc-local-invoke",
"name": "fc-remote-invoke",
"kind": 0,
"kindString": "Project",
"flags": {},
@ -26,163 +26,16 @@
"kind": 16384,
"kindString": "Constructor signature",
"flags": {},
"parameters": [
{
"id": 4,
"name": "props",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"type": {
"type": "intrinsic",
"name": "any"
}
}
],
"type": {
"type": "reference",
"id": 1,
"name": "default"
},
"overwrites": {
"type": "reference",
"name": "BaseComponent.constructor"
}
}
],
"overwrites": {
"type": "reference",
"name": "BaseComponent.constructor"
}
]
},
{
"id": 23,
"name": "client",
"kind": 1024,
"kindString": "Property",
"flags": {
"isProtected": true
},
"sources": [
{
"fileName": "common/base.ts",
"line": 9,
"character": 20
}
],
"type": {
"type": "intrinsic",
"name": "any"
},
"inheritedFrom": {
"type": "reference",
"name": "BaseComponent.client"
}
},
{
"id": 24,
"name": "inputs",
"kind": 1024,
"kindString": "Property",
"flags": {
"isProtected": true
},
"type": {
"type": "intrinsic",
"name": "any"
},
"inheritedFrom": {
"type": "reference",
"name": "BaseComponent.inputs"
}
},
{
"id": 27,
"name": "__doc",
"kind": 2048,
"kindString": "Method",
"flags": {},
"sources": [
{
"fileName": "common/base.ts",
"line": 34,
"character": 9
}
],
"signatures": [
{
"id": 28,
"name": "__doc",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"parameters": [
{
"id": 29,
"name": "projectName",
"kind": 32768,
"kindString": "Parameter",
"flags": {
"isOptional": true
},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "intrinsic",
"name": "string"
},
"inheritedFrom": {
"type": "reference",
"name": "BaseComponent.__doc"
}
}
],
"inheritedFrom": {
"type": "reference",
"name": "BaseComponent.__doc"
}
},
{
"id": 25,
"name": "__getBasePath",
"kind": 2048,
"kindString": "Method",
"flags": {},
"sources": [
{
"fileName": "common/base.ts",
"line": 21,
"character": 17
}
],
"signatures": [
{
"id": 26,
"name": "__getBasePath",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
},
"inheritedFrom": {
"type": "reference",
"name": "BaseComponent.__getBasePath"
}
}
],
"inheritedFrom": {
"type": "reference",
"name": "BaseComponent.__getBasePath"
}
},
{
"id": 14,
"id": 9,
"name": "handlerInputs",
"kind": 2048,
"kindString": "Method",
@ -190,20 +43,20 @@
"sources": [
{
"fileName": "index.ts",
"line": 56,
"line": 16,
"character": 21
}
],
"signatures": [
{
"id": 15,
"id": 10,
"name": "handlerInputs",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"parameters": [
{
"id": 16,
"id": 11,
"name": "inputs",
"kind": 32768,
"kindString": "Parameter",
@ -228,7 +81,7 @@
]
},
{
"id": 20,
"id": 12,
"name": "invoke",
"kind": 2048,
"kindString": "Method",
@ -238,13 +91,13 @@
"sources": [
{
"fileName": "index.ts",
"line": 197,
"line": 98,
"character": 21
}
],
"signatures": [
{
"id": 21,
"id": 13,
"name": "invoke",
"kind": 4096,
"kindString": "Call signature",
@ -255,7 +108,7 @@
},
"parameters": [
{
"id": 22,
"id": 14,
"name": "inputs",
"kind": 32768,
"kindString": "Parameter",
@ -281,7 +134,7 @@
]
},
{
"id": 5,
"id": 4,
"name": "report",
"kind": 2048,
"kindString": "Method",
@ -289,20 +142,20 @@
"sources": [
{
"fileName": "index.ts",
"line": 33,
"line": 9,
"character": 14
}
],
"signatures": [
{
"id": 6,
"id": 5,
"name": "report",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"parameters": [
{
"id": 7,
"id": 6,
"name": "componentName",
"kind": 32768,
"kindString": "Parameter",
@ -313,7 +166,7 @@
}
},
{
"id": 8,
"id": 7,
"name": "command",
"kind": 32768,
"kindString": "Parameter",
@ -324,26 +177,11 @@
}
},
{
"id": 9,
"id": 8,
"name": "accountID",
"kind": 32768,
"kindString": "Parameter",
"flags": {
"isOptional": true
},
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 10,
"name": "access",
"kind": 32768,
"kindString": "Parameter",
"flags": {
"isOptional": true
},
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
@ -362,99 +200,6 @@
}
}
]
},
{
"id": 17,
"name": "start",
"kind": 2048,
"kindString": "Method",
"flags": {
"isPublic": true
},
"sources": [
{
"fileName": "index.ts",
"line": 109,
"character": 20
}
],
"signatures": [
{
"id": 18,
"name": "start",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"comment": {
"shortText": "http 函数本地调试",
"returns": "\n"
},
"parameters": [
{
"id": 19,
"name": "inputs",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"comment": {},
"type": {
"type": "reference",
"name": "InputProps"
}
}
],
"type": {
"type": "reference",
"typeArguments": [
{
"type": "intrinsic",
"name": "any"
}
],
"name": "Promise"
}
}
]
},
{
"id": 11,
"name": "startExpress",
"kind": 2048,
"kindString": "Method",
"flags": {},
"sources": [
{
"fileName": "index.ts",
"line": 46,
"character": 14
}
],
"signatures": [
{
"id": 12,
"name": "startExpress",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"parameters": [
{
"id": 13,
"name": "app",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"type": {
"type": "intrinsic",
"name": "any"
}
}
],
"type": {
"type": "intrinsic",
"name": "void"
}
}
]
}
],
"groups": [
@ -465,39 +210,21 @@
2
]
},
{
"title": "Properties",
"kind": 1024,
"children": [
23,
24
]
},
{
"title": "Methods",
"kind": 2048,
"children": [
27,
25,
14,
20,
5,
17,
11
9,
12,
4
]
}
],
"sources": [
{
"fileName": "index.ts",
"line": 28,
"character": 43
}
],
"extendedTypes": [
{
"type": "reference",
"name": "BaseComponent"
"line": 8,
"character": 35
}
]
}

View File

@ -3,8 +3,8 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>fc-local-invoke</title>
<meta name="description" content="Documentation for fc-local-invoke">
<title>fc-remote-invoke</title>
<meta name="description" content="Documentation for fc-remote-invoke">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/main.css">
<script async src="assets/js/search.js" id="search-script"></script>
@ -23,7 +23,7 @@
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="index.html" class="title">fc-local-invoke</a>
<a href="index.html" class="title">fc-remote-invoke</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
@ -50,7 +50,7 @@
</div>
<div class="tsd-page-title">
<div class="container">
<h1>fc-local-invoke</h1>
<h1>fc-remote-invoke</h1>
</div>
</div>
</header>
@ -61,34 +61,44 @@
<a href="#组件说明" id="组件说明" style="color: inherit; text-decoration: none;">
<h2>组件说明</h2>
</a>
<p>fc-local-invoke 组件用于本地调试 FC 函数。</p>
<a href="#使用场景" id="使用场景" style="color: inherit; text-decoration: none;">
<h2>使用场景</h2>
<p>fc-remote-invoke 组件调用 FC 函数。</p>
<a href="#带有-yaml-文件用法" id="带有-yaml-文件用法" style="color: inherit; text-decoration: none;">
<h2>带有 YAML 文件用法</h2>
</a>
<p>本地调试。</p>
<a href="#具体用法" id="具体用法" style="color: inherit; text-decoration: none;">
<h2>具体用法</h2>
<a href="#yaml-配置" id="yaml-配置" style="color: inherit; text-decoration: none;">
<h3>yaml 配置</h3>
</a>
<a href="#http-函数" id="http-函数" style="color: inherit; text-decoration: none;">
<h3>http 函数</h3>
</a>
<pre><code><span style="color: #001080">$</span><span style="color: #000000"> </span><span style="color: #001080">s</span><span style="color: #000000"> </span><span style="color: #001080">start</span><span style="color: #000000"> &lt;[</span><span style="color: #001080">customDomainName</span><span style="color: #000000">/]</span><span style="color: #001080">path</span><span style="color: #000000">&gt;</span>
<pre><code><span style="color: #000000">edition: </span><span style="color: #098658">1.0</span><span style="color: #000000">.</span><span style="color: #098658">0</span><span style="color: #000000"> # </span><span style="color: #001080">命令行YAML规范版本</span><span style="color: #000000"></span><span style="color: #001080">遵循语义化版本</span><span style="color: #000000"></span><span style="color: #001080">Semantic</span><span style="color: #000000"> </span><span style="color: #001080">Versioning</span><span style="color: #000000"></span><span style="color: #001080">规范</span>
<span style="color: #000000">name: </span><span style="color: #001080">compoent</span><span style="color: #000000">-</span><span style="color: #001080">test</span><span style="color: #000000"> # </span><span style="color: #001080">项目名称</span>
<span style="color: #000000">services:</span>
<span style="color: #000000"> </span><span style="color: #001080">component</span><span style="color: #000000">-test:</span>
<span style="color: #000000"> component: </span><span style="color: #001080">devsapp</span><span style="color: #000000">/</span><span style="color: #001080">fc</span><span style="color: #000000">-</span><span style="color: #001080">remote</span><span style="color: #000000">-</span><span style="color: #001080">invoke</span><span style="color: #000000"> # </span><span style="color: #001080">这里引入的是相对路径</span><span style="color: #000000"></span><span style="color: #001080">正式配置替换成你自己的component名称即可</span><span style="color: #000000"> </span>
<span style="color: #000000"> props:</span>
<span style="color: #000000"> region: </span><span style="color: #001080">$</span><span style="color: #000000">{</span><span style="color: #001080">region</span><span style="color: #000000">}</span>
<span style="color: #000000"> serviceName: </span><span style="color: #001080">$</span><span style="color: #000000">{</span><span style="color: #001080">serviceName</span><span style="color: #000000">}</span>
<span style="color: #000000"> functionName: </span><span style="color: #001080">$</span><span style="color: #000000">{</span><span style="color: #001080">functionName</span><span style="color: #000000">}</span>
</code></pre>
<p>本地启动成功后访问返回的 url 即可访问服务。</p>
<a href="#event-函数" id="event-函数" style="color: inherit; text-decoration: none;">
<h3>event 函数</h3>
<a href="#函数调用" id="函数调用" style="color: inherit; text-decoration: none;">
<h3>函数调用</h3>
</a>
<pre><code><span style="color: #001080">$</span><span style="color: #000000"> </span><span style="color: #001080">s</span><span style="color: #000000"> </span><span style="color: #001080">invoke</span><span style="color: #000000"> --</span><span style="color: #001080">mode</span><span style="color: #000000"> [</span><span style="color: #001080">api</span><span style="color: #000000">/</span><span style="color: #001080">normal</span><span style="color: #000000">/</span><span style="color: #001080">server</span><span style="color: #000000">]</span>
<pre><code><span style="color: #001080">$</span><span style="color: #000000"> </span><span style="color: #001080">s</span><span style="color: #000000"> </span><span style="color: #001080">exec</span><span style="color: #000000"> -- </span><span style="color: #001080">invoke</span><span style="color: #000000"> --</span><span style="color: #001080">invocation</span><span style="color: #000000">-</span><span style="color: #0000FF">type</span><span style="color: #000000"> </span><span style="color: #267F99">sync</span><span style="color: #000000"> --event ${payload}</span>
<span style="color: #001080">$</span><span style="color: #000000"> </span><span style="color: #001080">s</span><span style="color: #000000"> </span><span style="color: #001080">exec</span><span style="color: #000000"> -- </span><span style="color: #001080">invoke</span><span style="color: #000000"> --</span><span style="color: #001080">invocation</span><span style="color: #000000">-</span><span style="color: #0000FF">type</span><span style="color: #000000"> </span><span style="color: #267F99">async</span><span style="color: #000000"> --event-file ${path}</span>
<span style="color: #001080">$</span><span style="color: #000000"> </span><span style="color: #001080">s</span><span style="color: #000000"> </span><span style="color: #001080">exec</span><span style="color: #000000"> -- </span><span style="color: #001080">invoke</span><span style="color: #000000"> --</span><span style="color: #001080">event</span><span style="color: #000000">-</span><span style="color: #001080">stdin</span>
</code></pre>
<p>上述指令能够本地调试 event 函数,有三种启动模式:</p>
<ul>
<li><p>api 模式: 启动服务供本地 InvokeFunction API 或者 SDK 进行调用,详情请参见 <a href="https://help.aliyun.com/document_detail/191156.htm?spm=a2c4g.11186623.2.23.965d559fCBpJrO#doc-api-58601-InvokeFunction">invokeFunction</a><a href="https://help.aliyun.com/document_detail/53277.htm?spm=a2c4g.11186623.2.7.393e2a26lkwxgo#concept-2260089">SDK 列表</a></p>
</li>
<li><p>normal 模式: 本地通过容器调用 event 函数返回结果后,立刻关闭容器,此模式为默认模式。</p>
</li>
<li><p>server 模式: 本地启动一个容器,然后在新开的 terminal 窗口执行 normal 模式的 invoke 指令,则会复用该容器。</p>
</li>
</ul>
<a href="#cli-用法" id="cli-用法" style="color: inherit; text-decoration: none;">
<h2>CLI 用法</h2>
</a>
<pre><code><span style="color: #001080">$</span><span style="color: #000000"> </span><span style="color: #001080">s</span><span style="color: #000000"> </span><span style="color: #001080">cli</span><span style="color: #000000"> </span><span style="color: #001080">fc</span><span style="color: #000000">-</span><span style="color: #001080">remote</span><span style="color: #000000">-</span><span style="color: #001080">invoke</span><span style="color: #000000"> </span><span style="color: #001080">invoke</span><span style="color: #000000"> --</span><span style="color: #001080">region</span><span style="color: #000000"> * --</span><span style="color: #001080">service</span><span style="color: #000000">-</span><span style="color: #001080">name</span><span style="color: #000000"> * --</span><span style="color: #0000FF">function</span><span style="color: #000000">-</span><span style="color: #795E26">name</span><span style="color: #000000"> </span><span style="color: #0000FF">*</span><span style="color: #000000"> --</span><span style="color: #795E26">invocation</span><span style="color: #000000">-</span><span style="color: #795E26">type</span><span style="color: #000000"> </span><span style="color: #795E26">sync</span><span style="color: #000000"> --</span><span style="color: #795E26">event</span><span style="color: #000000"> </span><span style="color: #795E26">$</span><span style="color: #000000">{</span><span style="color: #001080">payload</span><span style="color: #000000">}</span>
<span style="color: #001080">$</span><span style="color: #000000"> </span><span style="color: #001080">s</span><span style="color: #000000"> </span><span style="color: #001080">cli</span><span style="color: #000000"> </span><span style="color: #001080">fc</span><span style="color: #000000">-</span><span style="color: #001080">remote</span><span style="color: #000000">-</span><span style="color: #001080">invoke</span><span style="color: #000000"> </span><span style="color: #001080">invoke</span><span style="color: #000000"> --</span><span style="color: #001080">region</span><span style="color: #000000"> * --</span><span style="color: #001080">service</span><span style="color: #000000">-</span><span style="color: #001080">name</span><span style="color: #000000"> * --</span><span style="color: #0000FF">function</span><span style="color: #000000">-</span><span style="color: #795E26">name</span><span style="color: #000000"> </span><span style="color: #0000FF">*</span><span style="color: #000000"> --</span><span style="color: #795E26">invocation</span><span style="color: #000000">-</span><span style="color: #795E26">type</span><span style="color: #000000"> </span><span style="color: #795E26">async</span><span style="color: #000000"> --</span><span style="color: #795E26">event</span><span style="color: #000000">-</span><span style="color: #795E26">file</span><span style="color: #000000"> </span><span style="color: #795E26">$</span><span style="color: #000000">{</span><span style="color: #001080">path</span><span style="color: #000000">}</span>
<span style="color: #001080">$</span><span style="color: #000000"> </span><span style="color: #001080">s</span><span style="color: #000000"> </span><span style="color: #001080">cli</span><span style="color: #000000"> </span><span style="color: #001080">fc</span><span style="color: #000000">-</span><span style="color: #001080">remote</span><span style="color: #000000">-</span><span style="color: #001080">invoke</span><span style="color: #000000"> </span><span style="color: #001080">invoke</span><span style="color: #000000"> --</span><span style="color: #001080">region</span><span style="color: #000000"> * --</span><span style="color: #001080">service</span><span style="color: #000000">-</span><span style="color: #001080">name</span><span style="color: #000000"> * --</span><span style="color: #0000FF">function</span><span style="color: #000000">-</span><span style="color: #795E26">name</span><span style="color: #000000"> </span><span style="color: #0000FF">*</span><span style="color: #000000"> --</span><span style="color: #795E26">event</span><span style="color: #000000">-</span><span style="color: #795E26">stdin</span>
</code></pre>
<a href="#特别说明" id="特别说明" style="color: inherit; text-decoration: none;">
<h2>特别说明</h2>
</a>
<p>当函数是 http 函数时event最终获取值目前仅支持 json 字符串,<a href="https://github.com/devsapp/fc-remote-invoke/blob/master/example/http.json">示例参考</a></p>
<p>invocation-type 选填,默认 sync
event 选填event 函数默认为空字符串http 函数默认 GET 请求,其他参数为空</p>
</div>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
@ -117,9 +127,6 @@
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
</ul>
</div>
</div>
</footer>

View File

@ -3,8 +3,8 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>fc-local-invoke</title>
<meta name="description" content="Documentation for fc-local-invoke">
<title>fc-remote-invoke</title>
<meta name="description" content="Documentation for fc-remote-invoke">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/main.css">
<script async src="assets/js/search.js" id="search-script"></script>
@ -23,7 +23,7 @@
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="index.html" class="title">fc-local-invoke</a>
<a href="index.html" class="title">fc-remote-invoke</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
@ -50,7 +50,7 @@
</div>
<div class="tsd-page-title">
<div class="container">
<h1>fc-local-invoke</h1>
<h1>fc-remote-invoke</h1>
</div>
</div>
</header>
@ -97,9 +97,6 @@
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
</ul>
</div>
</div>
</footer>

View File

@ -1,29 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>event-java</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>event-java</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.aliyun.fc.runtime</groupId>
<artifactId>fc-java-core</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.test.skip>true</maven.test.skip>
</properties>
</project>

View File

@ -1,26 +0,0 @@
package example;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.aliyun.fc.runtime.Context;
import com.aliyun.fc.runtime.StreamRequestHandler;
import com.aliyun.fc.runtime.FunctionInitializer;
/**
* Hello world!
*
*/
public class App implements StreamRequestHandler, FunctionInitializer {
public void initialize(Context context) throws IOException {
//TODO
}
@Override
public void handleRequest(
InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
outputStream.write(new String("hello world\n").getBytes());
}
}

View File

@ -1,25 +0,0 @@
edition: 1.0.0 # 命令行YAML规范版本遵循语义化版本Semantic Versioning规范
name: fcDeployApp # 项目名称
access: default # 秘钥别名
services:
fc-deploy-test: # 服务名称
component: ${path(../..)}
props: # 组件的属性值
region: cn-shanghai
service:
name: demo
description: demo for fc-deploy component
internetAccess: true
function:
name: test-function
description: this is a test
runtime: java11
codeUri: ./code
handler: example.App::handleRequest
memorySize: 128
timeout: 60
instanceConcurrency: 1
instanceType: e1
environmentVariables:
testEnv: true

View File

@ -1,6 +0,0 @@
module.exports.handler = function(event, context, callback) {
console.log(event.toString());
// console.dir(context);
console.log('hello world11111');
callback(null, 'hello world');
};

View File

@ -1,4 +0,0 @@
{
"key": 123,
"mm": "gg"
}

View File

@ -1,25 +0,0 @@
edition: 1.0.0 # 命令行YAML规范版本遵循语义化版本Semantic Versioning规范
name: fcDeployApp # 项目名称
access: default # 秘钥别名
services:
fc-deploy-test: # 服务名称
component: ${path(../..)}
props: # 组件的属性值
region: cn-shanghai
service:
name: demo
description: demo for fc-deploy component
internetAccess: true
function:
name: test-function
description: this is a test
runtime: nodejs10
codeUri: ./code
handler: index.handler
memorySize: 128
timeout: 60
instanceConcurrency: 1
instanceType: e1
environmentVariables:
testEnv: true

View File

@ -1,34 +0,0 @@
const getRawBody = require('raw-body');
module.exports.handler = function (request, response, context) {
// get requset header
const reqHeader = request.headers;
let headerStr = ' ';
for (const key in reqHeader) {
headerStr += `${key }:${ reqHeader[key] } `;
}
// get request info
const { url } = request;
const { path } = request;
const { queries } = request;
let queryStr = '';
for (const param in queries) {
queryStr += `${param }=${ queries[param] } `;
}
const { method } = request;
const { clientIP } = request;
// get request body
getRawBody(request, (err, data) => {
const body = data;
// you can deal with your own logic here
// set response
const respBody = new Buffer(`requestHeader:${ headerStr }\n` + `url: ${ url }\n` + `path: ${ path }\n` + `queries: ${ queryStr }\n` + `method: ${ method }\n` + `clientIP: ${ clientIP }\n` + `body: ${ body }\n`);
response.setStatusCode(200);
response.setHeader('content-type', 'application/json');
response.send(respBody);
});
};

View File

@ -1,47 +0,0 @@
edition: 1.0.0 # 命令行YAML规范版本遵循语义化版本Semantic Versioning规范
name: fcDeployApp # 项目名称
access: default # 秘钥别名
services:
fc-deploy-test: # 服务名称
component: ${path(../..)}
props: # 组件的属性值
region: cn-shanghai
service:
name: qianfeng-fc-deploy-service
description: demo for fc-deploy component
internetAccess: true
function:
name: test-function
description: this is a test
runtime: nodejs10
codeUri: ./code
handler: index.handler
memorySize: 128
timeout: 60
instanceConcurrency: 1
instanceType: e1
environmentVariables:
testEnv: true
triggers:
- name: httpTrigger
type: http
config:
authType: anonymous
methods:
- GET
- POST
customDomains:
- domainName: auto
protocol: HTTP # HTTP 或 HTTP,HTTPS
routeConfigs:
- path: /*
serviceName: qianfeng-fc-deploy-service
functionName: test-function
methods:
- GET
- POST
# certConfig:
# certName: xxx
# certificate: xxx
# privateKey: xxx

11
example/http.json Normal file
View File

@ -0,0 +1,11 @@
{
"body": 123,
"method": "POST",
"headers": {
"key": "value"
},
"queries": {
"key": "value"
},
"path": "string"
}

View File

@ -1,8 +0,0 @@
const a = [
{a: 1, b:2},
{a: 2, b:3},
{a: 1, b:111},
]
const b = a.filter((aa) => aa.a === 1);
console.log(b);

View File

@ -1,13 +1,11 @@
edition: 1.0.0 # 命令行YAML规范版本遵循语义化版本Semantic Versioning规范
name: compoent-test # 项目名称
vars: # [全局变量,提供给各个服务使用]
logo: https://image.aliyun.com/xxxx.png
domain: xxxx.yyy.com
services:
component-test: # 服务名称
component: ${path(..)} # 这里引入的是相对路径正式配置替换成你自己的component名称即可
props:
name: ${component-test2.props.name}
otherInput: ${component-test2.output.hello}
envshow: ${env(USER)}
region: cn-shenzhen
serviceName: guide
# functionName: guide-hello_world-nodejs12
functionName: hhh

29
lib/common/help.d.ts vendored Normal file
View File

@ -0,0 +1,29 @@
declare const _default: ({
header: string;
content: string;
optionList?: undefined;
} | {
header: string;
optionList: ({
name: string;
description: string;
alias: string;
type: StringConstructor;
} | {
name: string;
description: string;
alias: string;
type: BooleanConstructor;
} | {
name: string;
description: string;
type: StringConstructor;
alias?: undefined;
})[];
content?: undefined;
} | {
header: string;
content: string[];
optionList?: undefined;
})[];
export default _default;

80
lib/common/help.js Normal file
View File

@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = [
{
header: 'Description',
content: 'Remote Invoke',
},
{
header: 'Usage',
content: '$ fc-remote-invoke invoke <options>',
},
{
header: 'Options',
optionList: [
{
name: 'invocation-type',
description: 'Invocation type: optional value "async"|"sync", default value "sync" (default: "sync")',
alias: '-t',
type: String,
},
{
name: 'event',
description: 'Event data (strings) passed to the function during invocation (default: "")',
alias: '-e',
type: String,
},
{
name: 'event-file',
description: 'A file containing event data passed to the function during invoke.',
alias: '-f',
type: String,
},
{
name: 'event-stdin',
description: 'Read from standard input, to support script pipeline.',
alias: '-s',
type: Boolean,
},
{
name: 'region',
description: 'Pass in region in cli mode',
type: String,
},
{
name: 'service-name',
description: 'Pass in service name in cli mode',
type: String,
},
{
name: 'function-name',
description: 'Pass in function name in cli mode',
type: String,
},
],
},
{
header: 'Global Options',
optionList: [
{
name: 'help',
description: 'fc-remote-invoke help for command',
alias: 'h',
type: Boolean,
},
],
},
{
header: 'Examples with Yaml',
content: [
'$ s exec -- invoke <options>',
],
},
{
header: 'Examples with Cli',
content: [
'$ s cli fc-remote-invoke invoke --region * --service-name * --function-name * <options>',
],
},
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tb24vaGVscC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGtCQUFlO0lBQ2I7UUFDRSxNQUFNLEVBQUUsYUFBYTtRQUNyQixPQUFPLEVBQUUsZUFBZTtLQUN6QjtJQUNEO1FBQ0UsTUFBTSxFQUFFLE9BQU87UUFDZixPQUFPLEVBQUUscUNBQXFDO0tBQy9DO0lBQ0Q7UUFDRSxNQUFNLEVBQUUsU0FBUztRQUNqQixVQUFVLEVBQUU7WUFDVjtnQkFDRSxJQUFJLEVBQUUsaUJBQWlCO2dCQUN2QixXQUFXLEVBQUUsd0ZBQXdGO2dCQUNyRyxLQUFLLEVBQUUsSUFBSTtnQkFDWCxJQUFJLEVBQUUsTUFBTTthQUNiO1lBQ0Q7Z0JBQ0UsSUFBSSxFQUFFLE9BQU87Z0JBQ2IsV0FBVyxFQUFFLDZFQUE2RTtnQkFDMUYsS0FBSyxFQUFFLElBQUk7Z0JBQ1gsSUFBSSxFQUFFLE1BQU07YUFDYjtZQUNEO2dCQUNFLElBQUksRUFBRSxZQUFZO2dCQUNsQixXQUFXLEVBQUUsb0VBQW9FO2dCQUNqRixLQUFLLEVBQUUsSUFBSTtnQkFDWCxJQUFJLEVBQUUsTUFBTTthQUNiO1lBQ0Q7Z0JBQ0UsSUFBSSxFQUFFLGFBQWE7Z0JBQ25CLFdBQVcsRUFBRSx1REFBdUQ7Z0JBQ3BFLEtBQUssRUFBRSxJQUFJO2dCQUNYLElBQUksRUFBRSxPQUFPO2FBQ2Q7WUFDRDtnQkFDRSxJQUFJLEVBQUUsUUFBUTtnQkFDZCxXQUFXLEVBQUUsNEJBQTRCO2dCQUN6QyxJQUFJLEVBQUUsTUFBTTthQUNiO1lBQ0Q7Z0JBQ0UsSUFBSSxFQUFFLGNBQWM7Z0JBQ3BCLFdBQVcsRUFBRSxrQ0FBa0M7Z0JBQy9DLElBQUksRUFBRSxNQUFNO2FBQ2I7WUFDRDtnQkFDRSxJQUFJLEVBQUUsZUFBZTtnQkFDckIsV0FBVyxFQUFFLG1DQUFtQztnQkFDaEQsSUFBSSxFQUFFLE1BQU07YUFDYjtTQUNGO0tBQ0Y7SUFDRDtRQUNFLE1BQU0sRUFBRSxnQkFBZ0I7UUFDeEIsVUFBVSxFQUFFO1lBQ1Y7Z0JBQ0UsSUFBSSxFQUFFLE1BQU07Z0JBQ1osV0FBVyxFQUFFLG1DQUFtQztnQkFDaEQsS0FBSyxFQUFFLEdBQUc7Z0JBQ1YsSUFBSSxFQUFFLE9BQU87YUFDZDtTQUNGO0tBQ0Y7SUFDRDtRQUNFLE1BQU0sRUFBRSxvQkFBb0I7UUFDNUIsT0FBTyxFQUFFO1lBQ1AsOEJBQThCO1NBQy9CO0tBQ0Y7SUFDRDtRQUNFLE1BQU0sRUFBRSxtQkFBbUI7UUFDM0IsT0FBTyxFQUFFO1lBQ1AseUZBQXlGO1NBQzFGO0tBQ0Y7Q0FDRixDQUFBIn0=

5
lib/common/i18n.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export declare function getConfig(key: string): any;
export declare function getProfileFile(): {};
export declare function getDefaultProfilePath(): string;
declare const i18n: any;
export default i18n;

45
lib/common/i18n.js Normal file
View File

@ -0,0 +1,45 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultProfilePath = exports.getProfileFile = exports.getConfig = void 0;
const os_1 = __importDefault(require("os"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const js_yaml_1 = __importDefault(require("js-yaml"));
const i18n_1 = require("i18n");
function getConfig(key) {
const profile = getProfileFile();
return profile[key];
}
exports.getConfig = getConfig;
function getProfileFile() {
let profileResult = {};
try {
const profileFilePath = getDefaultProfilePath();
profileResult = js_yaml_1.default.load(fs_1.default.readFileSync(profileFilePath, 'utf8')) || {};
}
catch (e) {
console.log(e);
}
return profileResult;
}
exports.getProfileFile = getProfileFile;
function getDefaultProfilePath() {
return path_1.default.join(os_1.default.homedir(), '.s', 'set-config.yml');
}
exports.getDefaultProfilePath = getDefaultProfilePath;
const i18n = new i18n_1.I18n({
locales: ['en', 'zh'],
directory: path_1.default.join(__dirname, '..', '..', 'locales'),
});
const locale = getConfig('locale');
if (locale) {
i18n.setLocale(locale);
}
else {
i18n.setLocale('en');
}
exports.default = i18n;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaTE4bi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tb24vaTE4bi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSw0Q0FBb0I7QUFDcEIsNENBQW9CO0FBQ3BCLGdEQUF3QjtBQUN4QixzREFBMkI7QUFDM0IsK0JBQTRCO0FBRTVCLFNBQWdCLFNBQVMsQ0FBQyxHQUFXO0lBQ2pDLE1BQU0sT0FBTyxHQUFHLGNBQWMsRUFBRSxDQUFDO0lBQ2pDLE9BQU8sT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ3hCLENBQUM7QUFIRCw4QkFHQztBQUdELF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d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export default class ComponentLogger {
static CONTENT: string;
static setContent(content: any): void;
static log(m: any, color?: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'whiteBright' | 'gray'): void;
static info(m: any): void;
static debug(m: any): void;
static error(m: any): void;
static warning(m: any): void;
static success(m: any): void;
}

33
lib/common/logger.js Normal file
View File

@ -0,0 +1,33 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const i18n_1 = __importDefault(require("./i18n"));
const core_1 = require("@serverless-devs/core");
class ComponentLogger {
static setContent(content) {
ComponentLogger.CONTENT = content;
}
static log(m, color) {
core_1.Logger.log(i18n_1.default.__(m) || m, color);
}
static info(m) {
core_1.Logger.info(ComponentLogger.CONTENT, i18n_1.default.__(m) || m);
}
static debug(m) {
core_1.Logger.debug(ComponentLogger.CONTENT, i18n_1.default.__(m) || m);
}
static error(m) {
core_1.Logger.error(ComponentLogger.CONTENT, i18n_1.default.__(m) || m);
}
static warning(m) {
core_1.Logger.warn(ComponentLogger.CONTENT, i18n_1.default.__(m) || m);
}
static success(m) {
core_1.Logger.log(i18n_1.default.__(m) || m, 'green');
}
}
exports.default = ComponentLogger;
ComponentLogger.CONTENT = 'FC-REMOTE-INVOKE';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbW1vbi9sb2dnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFDQSxrREFBMEI7QUFDMUIsZ0RBQStDO0FBRS9DLE1BQXFCLGVBQWU7SUFFbEMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxPQUFPO1FBQ3ZCLGVBQWUsQ0FBQyxPQUFPLEdBQUcs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UMsQ0FBQyxJQUFJLENBQUMsRUFBRSxPQUFPLENBQUMsQ0FBQztJQUN2QyxDQUFDOztBQTFCSCxrQ0EyQkM7QUExQlEsdUJBQU8sR0FBRyxrQkFBa0IsQ0FBQyJ9

11
lib/index.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import { InputProps } from './interface/entity';
export default class FcRemoteInvoke {
report(componentName: string, command: string, accountID: string): Promise<void>;
handlerInputs(inputs: InputProps): Promise<any>;
/**
* event
* @param inputs
* @returns
*/
invoke(inputs: InputProps): Promise<any>;
}

131
lib/index.js Normal file
View File

@ -0,0 +1,131 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = __importDefault(require("lodash"));
const core = __importStar(require("@serverless-devs/core"));
const logger_1 = __importDefault(require("./common/logger"));
const help_1 = __importDefault(require("./common/help"));
const entity_1 = require("./interface/entity");
const remote_invoke_1 = __importDefault(require("./lib/remote-invoke"));
class FcRemoteInvoke {
report(componentName, command, accountID) {
return __awaiter(this, void 0, void 0, function* () {
core.reportComponent(componentName, {
command,
uid: accountID,
});
});
}
handlerInputs(inputs) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
const credentials = yield core.getCredential((_a = inputs === null || inputs === void 0 ? void 0 : inputs.project) === null || _a === void 0 ? void 0 : _a.access);
// 去除 args 的行首以及行尾的空格
const args = ((inputs === null || inputs === void 0 ? void 0 : inputs.args) || '').replace(/(^\s*)|(\s*$)/g, '');
logger_1.default.debug(`input args: ${args}`);
const parsedArgs = core.commandParse({ args }, {
boolean: ['help', 'event-stdin'],
string: ['invocation-type', 'event', 'event-file', 'region', 'service-name', 'function-name', 'qualifier'],
alias: {
'help': 'h',
'event': 'e',
'invocation-type': 't',
'event-file': 'f',
'event-stdin': 's',
}
});
const argsData = (parsedArgs === null || parsedArgs === void 0 ? void 0 : parsedArgs.data) || {};
logger_1.default.debug(`command parse: ${JSON.stringify(argsData)}`);
if (argsData.help) {
return {
credentials,
isHelp: true,
};
}
const { e: event, f: eventFile, s: eventStdin, t: invocationType = 'sync', } = argsData;
const eventPayload = { event, eventFile, eventStdin };
// @ts-ignore: 判断三个值有几个真
const eventFlag = !!event + !!eventFile + !!eventStdin;
if (eventFlag > 1) {
throw new Error('event | event-file | event-stdin must choose one.');
}
else if (eventFlag === 0) {
eventPayload.event = '';
}
if (!['sync', 'async'].includes(invocationType)) {
throw new Error('invocation-type enum value sync, async.');
}
logger_1.default.debug(`input props: ${JSON.stringify(inputs.props)}`);
let props = {
region: argsData.region,
serviceName: argsData['service-name'],
functionName: argsData['function-name'],
};
logger_1.default.debug(`input args props: ${JSON.stringify(props)}`);
if (!entity_1.isProperties(props)) {
props = inputs.props;
}
logger_1.default.debug(`props: ${JSON.stringify(props)}`);
if (!entity_1.isProperties(props)) {
throw new Error('region/serviceName(service-name)/functionName(function-name) can not be empty.');
}
props.qualifier = argsData.qualifier || ((_b = inputs.props) === null || _b === void 0 ? void 0 : _b.qualifier);
return {
props,
credentials,
eventPayload,
isHelp: false,
invocationType: lodash_1.default.upperFirst(invocationType),
};
});
}
/**
* event 函数本地调试
* @param inputs
* @returns
*/
invoke(inputs) {
return __awaiter(this, void 0, void 0, function* () {
const { props, eventPayload, credentials, isHelp, invocationType, } = yield this.handlerInputs(inputs);
// await this.report('fc-remote-invoke', 'invoke', credentials?.AccountID);
if (isHelp) {
core.help(help_1.default);
return;
}
const remoteInvoke = new remote_invoke_1.default(props.region, credentials);
yield remoteInvoke.invoke(props, eventPayload, { invocationType });
});
}
}
exports.default = FcRemoteInvoke;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsb0RBQXVCO0FBQ3ZCLDREQUE4QztBQUM5Qyw2REFBcUM7QUFDckMseURBQWlDO0FBQ2pDLCtDQUF5RjtBQUN6Rix3RUFBK0M7QUFFL0MsTUFBcUIsY0FBYztJQUMzQixNQUFNLENBQUMsYUFBcUIsRUFBRSxPQUFlLEVBQUUsU0FBaUI7O1lBQ3BFLElBQUksQ0FBQyxlQUFlLENBQUMsYUFBYSxFQUFFO2dCQUNsQyxPQUFPO2dCQUNQLEdBQUcsRUFBRSxTQUFTO2FBQ2YsQ0FBQyxDQUFDO1FBQ0wsQ0FBQztLQUFBO0lBRUssYUFBYSxDQUFDLE1BQWtCOzs7WUFDcEMsTUFBTSxXQUFXLEdBQWlCLE1BQU0sSUFBSSxDQUFDLGFBQ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BQTJFO1lBRTNFLElBQUksTUFBTSxFQUFFO2dCQUNWLElBQUksQ0FBQyxJQUFJLENBQUMsY0FBSSxDQUFDLENBQUE7Z0JBQ2YsT0FBTzthQUNSO1lBRUQsTUFBTSxZQUFZLEdBQUcsSUFBSSx1QkFBWSxDQUFDLEtBQUssQ0FBQyxNQUFNLEVBQUUsV0FBVyxDQUFDLENBQUM7WUFDakUsTUFBTSxZQUFZLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUUsRUFBRSxjQUFjLEVBQUUsQ0FBQyxDQUFDO1FBQ3JFLENBQUM7S0FBQTtDQUNGO0FBNUdELGlDQTRHQyJ9

33
lib/interface/entity.d.ts vendored Normal file
View File

@ -0,0 +1,33 @@
export interface ICredentials {
AccountID?: string;
AccessKeyID?: string;
AccessKeySecret?: string;
SecurityToken?: string;
}
export interface InputProps {
props?: IProperties;
credentials: ICredentials;
appName: string;
project: {
component: string;
access: string;
projectName: string;
};
command: string;
args: string;
path: {
configPath: string;
};
}
export interface IProperties {
region: string;
serviceName: string;
functionName: string;
qualifier?: string;
}
export declare function isProperties(args: any): args is IProperties;
export interface IEventPayload {
event?: string;
eventFile?: string;
eventStdin?: boolean;
}

8
lib/interface/entity.js Normal file
View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isProperties = void 0;
function isProperties(args) {
return args && args.region && args.serviceName && args.functionName;
}
exports.isProperties = isProperties;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW50aXR5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ludGVyZmFjZS9lbnRpdHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBNkJBLFNBQWdCLFlBQVksQ0FBQyxJQUFTO0lBQ3BDLE9BQU8sSUFBSSxJQUFJLElBQUksQ0FBQyxNQUFNLElBQUksSUFBSSxDQUFDLFdBQVcsSUFBSSxJQUFJLENBQUMsWUFBWSxDQUFDO0FBQ3RFLENBQUM7QUFGRCxvQ0FFQyJ9

0
lib/interface/event.d.ts vendored Normal file
View File

1
lib/interface/event.js Normal file
View File

@ -0,0 +1 @@
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW50ZXJmYWNlL2V2ZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==

4
lib/interface/file.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export default class File {
static getEvent(eventFile: any): Promise<unknown>;
static eventPriority(eventPriority: any): Promise<any>;
}

68
lib/interface/file.js Normal file
View File

@ -0,0 +1,68 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const get_stdin_1 = __importDefault(require("get-stdin"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const readline_1 = __importDefault(require("readline"));
const logger_1 = __importDefault(require("../common/logger"));
class File {
static getEvent(eventFile) {
return __awaiter(this, void 0, void 0, function* () {
let event = yield get_stdin_1.default(); // read from pipes
if (!eventFile)
return event;
return yield new Promise((resolve, reject) => {
let input;
if (eventFile === '-') { // read from stdin
logger_1.default.log(`Reading event data from stdin, which can be ended with Enter then Ctrl+D
(you can also pass it from file with -e)`);
input = process.stdin;
}
else {
input = fs_extra_1.default.createReadStream(eventFile, {
encoding: 'utf-8'
});
}
const rl = readline_1.default.createInterface({
input,
output: process.stdout
});
event = '';
rl.on('line', (line) => {
event += line;
});
rl.on('close', () => resolve(event));
rl.on('SIGINT', () => reject(new Error('^C')));
});
});
}
static eventPriority(eventPriority) {
return __awaiter(this, void 0, void 0, function* () {
let eventFile;
if (eventPriority.event) {
return eventPriority.event;
}
else if (eventPriority.eventStdin) {
eventFile = '-';
}
else if (eventPriority.eventFile) {
eventFile = path_1.default.resolve(process.cwd(), eventPriority.eventFile);
}
return yield this.getEvent(eventFile);
});
}
}
exports.default = File;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbnRlcmZhY2UvZmlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7OztBQUFBLGdEQUF3QjtBQUN4QiwwREFBaUM7QUFDakMsd0RBQTBCO0FBQzFCLHdEQUFnQztBQUNoQyw4REFBc0M7QUFFdEMsTUFBcUIsSUFBSTtJQUV2QixNQUFNLENBQU8sUUFBUSxDQUFDLFNBQVM7O1lBQzdCLElBQUksS0FBSyxHQUFHLE1BQU0sbUJBQVEsRUFBRSxDQUFDLENBQUMsa0JBQWtCO1lBRWhELElBQUksQ0FBQyxTQUFTO2dCQUFFLE9BQU8sS0FBSyxDQUFDO1lBRTdCLE9BQU8sTUFBTSxJQUFJLE9BQU8sQ0FBQyxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFBRTtnQkFDM0MsSUFBSSxLQUFLLENBQUM7Z0JBRVYsSUFBSSxTQUFTLEtBQUssR0FBRyxFQUFFLEVBQUUsa0JBQWtCO29CQUN6QyxnQkFBTSxDQUFDLEdBQUcsQ0FBQzs2Q0FDMEI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BQzthQUNqQjtpQkFBTSxJQUFJLGFBQWEsQ0FBQyxTQUFTLEVBQUU7Z0JBQ2xDLFNBQVMsR0FBRyxjQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBRSxhQUFhLENBQUMsU0FBUyxDQUFDLENBQUM7YUFDbEU7WUFFRCxPQUFPLE1BQU0sSUFBSSxDQUFDLFFBQVEsQ0FBQyxTQUFTLENBQUMsQ0FBQTtRQUN2QyxDQUFDO0tBQUE7Q0FDRjtBQS9DRCx1QkErQ0MifQ==

0
lib/interface/inputs.d.ts vendored Normal file
View File

1
lib/interface/inputs.js Normal file
View File

@ -0,0 +1 @@
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ludGVyZmFjZS9pbnB1dHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9

4
lib/lib/client.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { ICredentials } from '../interface/entity';
export default class Client {
static buildFcClient(region: string, credentials: ICredentials): any;
}

19
lib/lib/client.js Normal file
View File

@ -0,0 +1,19 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fc2_1 = __importDefault(require("@alicloud/fc2"));
class Client {
static buildFcClient(region, credentials) {
return new fc2_1.default(credentials.AccountID, {
accessKeyID: credentials.AccessKeyID,
accessKeySecret: credentials.AccessKeySecret,
securityToken: credentials.SecurityToken,
region,
timeout: 6000000,
});
}
}
exports.default = Client;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi9jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSx3REFBK0I7QUFHL0IsTUFBcUIsTUFBTTtJQUN6QixNQUFNLENBQUMsYUFBYSxDQUFDLE1BQWMsRUFBRSxXQUF5QjtRQUM1RCxPQUFPLElBQUksYUFBRSxDQUFDLFdBQVcsQ0FBQyxTQUFTLEVBQUU7WUFDbkMsV0FBVyxFQUFFLFdBQVcsQ0FBQyxXQUFXO1lBQ3BDLGVBQWUsRUFBRSxXQUFXLENBQUMsZUFBZTtZQUM1QyxhQUFhLEVBQUUsV0FBVyxDQUFDLGFBQWE7WUFDeEMsTUFBTTtZQUNOLE9BQU8sRUFBRSxPQUFPO1NBQ2pCLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FDRjtBQVZELHlCQVVDIn0=

4
lib/lib/event.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export default class File {
static getEvent(eventFile: any): Promise<unknown>;
static eventPriority(eventPriority: any): Promise<any>;
}

68
lib/lib/event.js Normal file
View File

@ -0,0 +1,68 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const lodash_1 = require("lodash");
const readline_1 = __importDefault(require("readline"));
const logger_1 = __importDefault(require("../common/logger"));
const stdin_1 = require("./stdin");
class File {
static getEvent(eventFile) {
return __awaiter(this, void 0, void 0, function* () {
let event = yield stdin_1.getStdin(); // read from pipes
if (!eventFile)
return event;
return yield new Promise((resolve, reject) => {
let input;
if (eventFile === '-') { // read from stdin
logger_1.default.log('Reading event data from stdin, which can be ended with Enter then Ctrl+D');
input = process.stdin;
}
else {
input = fs_extra_1.default.createReadStream(eventFile, {
encoding: 'utf-8'
});
}
const rl = readline_1.default.createInterface({
input,
output: process.stdout
});
event = '';
rl.on('line', (line) => {
event += line;
});
rl.on('close', () => resolve(event));
rl.on('SIGINT', () => reject(new Error('^C')));
});
});
}
static eventPriority(eventPriority) {
return __awaiter(this, void 0, void 0, function* () {
let eventFile;
if (lodash_1.isString(eventPriority.event)) {
return eventPriority.event;
}
else if (eventPriority.eventStdin) {
eventFile = '-';
}
else if (eventPriority.eventFile) {
eventFile = path_1.default.resolve(process.cwd(), eventPriority.eventFile);
}
return yield this.getEvent(eventFile);
});
}
}
exports.default = File;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL2V2ZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O0FBQUEsZ0RBQXdCO0FBQ3hCLHdEQUEwQjtBQUMxQixtQ0FBa0M7QUFDbEMsd0RBQWdDO0FBQ2hDLDhEQUFzQztBQUN0QyxtQ0FBbUM7QUFFbkMsTUFBcUIsSUFBSTtJQUV2QixNQUFNLENBQU8sUUFBUSxDQUFDLFNBQVM7O1lBQzdCLElBQUksS0FBSyxHQUFHLE1BQU0sZ0JBQVEsRUFBRSxDQUFDLENBQUMsa0JBQWtCO1lBRWhELElBQUksQ0FBQyxTQUFTO2dCQUFFLE9BQU8sS0FBSyxDQUFDO1lBRTdCLE9BQU8sTUFBTSxJQUFJLE9BQU8sQ0FBQyxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFBRTtnQk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ENBQUMsS0FBSyxDQUFDLEVBQUU7Z0JBQ2pDLE9BQU8sYUFBYSxDQUFDLEtBQUssQ0FBQzthQUM1QjtpQkFBTSxJQUFJLGFBQWEsQ0FBQyxVQUFVLEVBQUU7Z0JBQ25DLFNBQVMsR0FBRyxHQUFHLENBQUM7YUFDakI7aUJBQU0sSUFBSSxhQUFhLENBQUMsU0FBUyxFQUFFO2dCQUNsQyxTQUFTLEdBQUcsY0FBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLEVBQUUsYUFBYSxDQUFDLFNBQVMsQ0FBQyxDQUFDO2FBQ2xFO1lBRUQsT0FBTyxNQUFNLElBQUksQ0FBQyxRQUFRLENBQUMsU0FBUyxDQUFDLENBQUE7UUFDdkMsQ0FBQztLQUFBO0NBQ0Y7QUE5Q0QsdUJBOENDIn0=

4
lib/lib/file.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export default class File {
static getEvent(eventFile: any): Promise<unknown>;
static eventPriority(eventPriority: any): Promise<any>;
}

68
lib/lib/file.js Normal file
View File

@ -0,0 +1,68 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const get_stdin_1 = __importDefault(require("get-stdin"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const readline_1 = __importDefault(require("readline"));
const logger_1 = __importDefault(require("../common/logger"));
class File {
static getEvent(eventFile) {
return __awaiter(this, void 0, void 0, function* () {
let event = yield get_stdin_1.default(); // read from pipes
if (!eventFile)
return event;
return yield new Promise((resolve, reject) => {
let input;
if (eventFile === '-') { // read from stdin
logger_1.default.log(`Reading event data from stdin, which can be ended with Enter then Ctrl+D
(you can also pass it from file with -e)`);
input = process.stdin;
}
else {
input = fs_extra_1.default.createReadStream(eventFile, {
encoding: 'utf-8'
});
}
const rl = readline_1.default.createInterface({
input,
output: process.stdout
});
event = '';
rl.on('line', (line) => {
event += line;
});
rl.on('close', () => resolve(event));
rl.on('SIGINT', () => reject(new Error('^C')));
});
});
}
static eventPriority(eventPriority) {
return __awaiter(this, void 0, void 0, function* () {
let eventFile;
if (eventPriority.event) {
return eventPriority.event;
}
else if (eventPriority.eventStdin) {
eventFile = '-';
}
else if (eventPriority.eventFile) {
eventFile = path_1.default.resolve(process.cwd(), eventPriority.eventFile);
}
return yield this.getEvent(eventFile);
});
}
}
exports.default = File;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvZmlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7OztBQUFBLGdEQUF3QjtBQUN4QiwwREFBaUM7QUFDakMsd0RBQTBCO0FBQzFCLHdEQUFnQztBQUNoQyw4REFBc0M7QUFFdEMsTUFBcUIsSUFBSTtJQUV2QixNQUFNLENBQU8sUUFBUSxDQUFDLFNBQVM7O1lBQzdCLElBQUksS0FBSyxHQUFHLE1BQU0sbUJBQVEsRUFBRSxDQUFDLENBQUMsa0JBQWtCO1lBRWhELElBQUksQ0FBQyxTQUFTO2dCQUFFLE9BQU8sS0FBSyxDQUFDO1lBRTdCLE9BQU8sTUFBTSxJQUFJLE9BQU8sQ0FBQyxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFBRT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BQUssRUFBRTtnQkFDdkIsT0FBTyxhQUFhLENBQUMsS0FBSyxDQUFDO2FBQzVCO2lCQUFNLElBQUksYUFBYSxDQUFDLFVBQVUsRUFBRTtnQkFDbkMsU0FBUyxHQUFHLEdBQUcsQ0FBQzthQUNqQjtpQkFBTSxJQUFJLGFBQWEsQ0FBQyxTQUFTLEVBQUU7Z0JBQ2xDLFNBQVMsR0FBRyxjQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBRSxhQUFhLENBQUMsU0FBUyxDQUFDLENBQUM7YUFDbEU7WUFFRCxPQUFPLE1BQU0sSUFBSSxDQUFDLFFBQVEsQ0FBQyxTQUFTLENBQUMsQ0FBQTtRQUN2QyxDQUFDO0tBQUE7Q0FDRjtBQS9DRCx1QkErQ0MifQ==

36
lib/lib/remote-invoke.d.ts vendored Normal file
View File

@ -0,0 +1,36 @@
import { IProperties, IEventPayload } from '../interface/entity';
export default class RemoteInvoke {
fcClient: any;
accountId: string;
constructor(region: string, credentials: any);
invoke(props: IProperties, eventPayload: IEventPayload, { invocationType }: {
invocationType: any;
}): Promise<void>;
getHttpTrigger(serviceName: any, functionName: any): Promise<any>;
eventInvoke({ serviceName, functionName, event, qualifier, invocationType }: {
serviceName: any;
functionName: any;
event: any;
qualifier?: string;
invocationType: any;
}): Promise<void>;
httpInvoke({ region, serviceName, functionName, event, qualifier }: {
region: any;
serviceName: any;
functionName: any;
event: any;
qualifier: any;
}): Promise<void>;
/**
* @param event: { body, headers, method, queries, path }
* path /proxy/serviceName/functionName/path ,
*/
request(event: any): Promise<void>;
handlerHttpParmase(event: any): {
headers: any;
queries: any;
method: any;
path: any;
body: any;
};
}

188
lib/lib/remote-invoke.js Normal file

File diff suppressed because one or more lines are too long

5
lib/lib/stdin.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/// <reference types="node" />
export declare function getStdin(): Promise<string>;
export declare namespace getStdin {
var buffer: () => Promise<Buffer>;
}

69
lib/lib/stdin.js Normal file
View File

@ -0,0 +1,69 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStdin = void 0;
const { stdin } = process;
function getStdin() {
var e_1, _a;
return __awaiter(this, void 0, void 0, function* () {
let result = '';
if (stdin.isTTY) {
return result;
}
stdin.setEncoding('utf8');
try {
for (var stdin_1 = __asyncValues(stdin), stdin_1_1; stdin_1_1 = yield stdin_1.next(), !stdin_1_1.done;) {
const chunk = stdin_1_1.value;
result += chunk;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (stdin_1_1 && !stdin_1_1.done && (_a = stdin_1.return)) yield _a.call(stdin_1);
}
finally { if (e_1) throw e_1.error; }
}
return result;
});
}
exports.getStdin = getStdin;
getStdin.buffer = () => __awaiter(void 0, void 0, void 0, function* () {
var e_2, _a;
const result = [];
let length = 0;
if (stdin.isTTY) {
return Buffer.concat([]);
}
try {
for (var stdin_2 = __asyncValues(stdin), stdin_2_1; stdin_2_1 = yield stdin_2.next(), !stdin_2_1.done;) {
const chunk = stdin_2_1.value;
result.push(chunk);
length += chunk.length;
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (stdin_2_1 && !stdin_2_1.done && (_a = stdin_2.return)) yield _a.call(stdin_2);
}
finally { if (e_2) throw e_2.error; }
}
return Buffer.concat(result, length);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RkaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL3N0ZGluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxNQUFNLEVBQUMsS0FBSyxFQUFDLEdBQUcsT0FBTyxDQUFDO0FBRXhCLFNBQXNCLFFBQVE7OztRQUM3QixJQUFJLE1BQU0sR0FBRyxFQUFFLENBQUM7UUFFaEIsSUFBSSxLQUFLLENBQUMsS0FBSyxFQUFFO1lBQ2hCLE9BQU8sTUFBTSxDQUFDO1NBQ2Q7UUFFRCxLQUFLLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FBQyxDQUFDOztZQUUxQixLQUEwQixJQUFBLFVBQUEsY0FBQSxLQUFLLENBQUEsV0FBQTtnQkFBcEIsTUFBTSxLQUFLLGtCQUFBLENBQUE7Z0JBQ3JCLE1BQU0sSUFBSSxLQUFLLENBQUM7YUFDaEI7Ozs7Ozs7OztRQUVELE9BQU8sTUFBTSxDQUFDOztDQUNkO0FBZEQsNEJBY0M7QUFFRCxRQUFRLENBQUMsTUFBTSxHQUFHLEdBQVMsRUFBRTs7SUFDNUIsTUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFDO0lBQ2xCLElBQUksTUFBTSxHQUFHLENBQUMsQ0FBQztJQUVmLElBQUksS0FBSyxDQUFDLEtBQUssRUFBRTtRQUNoQixPQUFPLE1BQU0sQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLENBQUM7S0FDekI7O1FBRUQsS0FBMEIsSUFBQSxVQUFBLGNBQUEsS0FBSyxDQUFBLFdBQUE7WUFBcEIsTUFBTSxLQUFLLGtCQUFBLENBQUE7WUFDckIsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQztZQUNuQixNQUFNLElBQUksS0FBSyxDQUFDLE1BQU0sQ0FBQztTQUN2Qjs7Ozs7Ozs7O0lBRUQsT0FBTyxNQUFNLENBQUMsTUFBTSxDQUFDLE1BQU0sRUFBRSxNQUFNLENBQUMsQ0FBQztBQUN0QyxDQUFDLENBQUEsQ0FBQyJ9

View File

@ -1,3 +1,3 @@
{
"deploy test": "deploy test"
"deploy test": "部署测试"
}

View File

@ -1,6 +1,6 @@
{
"name": "fc-remote-invoke",
"version": "0.0.6",
"version": "0.0.7",
"description": "This is a component demo for Serverless Devs Tool ",
"keywords": [
"Serverless",
@ -23,9 +23,9 @@
},
"scripts": {
"start": "npm run watch",
"watch": "npm run doc && tsc -w",
"watch": "tsc -w",
"publish": "npm run build && s cli platform publish",
"build": "tsc",
"build": "npm run doc && tsc",
"postbuild": "npm run doc",
"doc": "npx typedoc src/index.ts --json doc/doc.json --out doc"
},

View File

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