fc-remote-invoke/doc/index.html

154 lines
14 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base=".">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<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-remote-invoke</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<h1>fc-remote-invoke</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<div class="tsd-panel tsd-typography">
<a href="#组件说明" id="组件说明" style="color: inherit; text-decoration: none;">
<h2>组件说明</h2>
</a>
<p>fc-remote-invoke 组件调用 FC 函数。</p>
<a href="#带有-yaml-文件用法" id="带有-yaml-文件用法" style="color: inherit; text-decoration: none;">
<h2>带有 YAML 文件用法</h2>
</a>
<a href="#yaml-配置" id="yaml-配置" style="color: inherit; text-decoration: none;">
<h3>yaml 配置</h3>
</a>
<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>
<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">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>
<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>
<pre><code><span style="color: #000000">{</span>
<span style="color: #000000"> </span><span style="color: #A31515">&quot;body&quot;</span><span style="color: #000000">: </span><span style="color: #A31515">&quot;body&quot;</span><span style="color: #000000">,</span>
<span style="color: #000000"> </span><span style="color: #A31515">&quot;method&quot;</span><span style="color: #000000">: </span><span style="color: #A31515">&quot;POST&quot;</span><span style="color: #000000">,</span>
<span style="color: #000000"> </span><span style="color: #A31515">&quot;headers&quot;</span><span style="color: #000000">: {</span>
<span style="color: #000000"> </span><span style="color: #A31515">&quot;key&quot;</span><span style="color: #001080">:</span><span style="color: #000000"> </span><span style="color: #A31515">&quot;value&quot;</span>
<span style="color: #000000"> },</span>
<span style="color: #000000"> </span><span style="color: #A31515">&quot;queries&quot;</span><span style="color: #000000">: {</span>
<span style="color: #000000"> </span><span style="color: #A31515">&quot;key&quot;</span><span style="color: #001080">:</span><span style="color: #000000"> </span><span style="color: #A31515">&quot;value&quot;</span>
<span style="color: #000000"> },</span>
<span style="color: #000000"> </span><span style="color: #A31515">&quot;path&quot;</span><span style="color: #000000">: </span><span style="color: #A31515">&quot;string&quot;</span>
<span style="color: #000000">}</span>
</code></pre>
<p>invocation-type 选填,默认 sync
event 选填event 函数默认为空字符串http 函数默认 GET 请求,其他参数为空</p>
</div>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=" ">
<a href="modules.html">Exports</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class">
<a href="classes/default.html" class="tsd-kind-icon">default</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<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-private"><span class="tsd-kind-icon">Private method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="assets/js/main.js"></script>
</body>
</html>