build: adapt to ncc build and remove unnecessary files

This commit is contained in:
千风 2021-08-09 17:07:15 +08:00 committed by git-qfzhang
parent dfb710158c
commit 6ea73bf213
20 changed files with 28 additions and 3780 deletions

View File

@ -21,9 +21,9 @@ jobs:
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install requests
- name: NPM install
run: |
npm install --production
# - name: NPM install
# run: |
# npm install --production
- name: Add publish file
run: |
wget https://serverless-registry.oss-cn-hangzhou.aliyuncs.com/publish-file/python3/hub-publish.py

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ node_modules
.DS_Store
package-lock.json
.idea
.vscode

View File

@ -5,3 +5,12 @@ LICENSE
package-lok.json
.prettierrc.js
.gitignore
.github
.idea
.vscode
.DS_Store
.git
README.md
./example

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
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":"invoke","url":"classes/default.html#invoke","classes":"tsd-kind-method tsd-parent-kind-class","parent":"default"},{"id":3,"kind":2048,"name":"report","url":"classes/default.html#report","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-private","parent":"default"},{"id":4,"kind":2048,"name":"handlerInputs","url":"classes/default.html#handlerinputs","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-private","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":4,"name":{"4":{}},"parent":{}}],["invoke",{"_index":2,"name":{"2":{}},"parent":{}}],["report",{"_index":3,"name":{"3":{}},"parent":{}}]],"pipeline":[]}}

View File

@ -1,254 +0,0 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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>
</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">
<ul class="tsd-breadcrumb">
<li>
<a href="../modules.html">fc-remote-invoke</a>
</li>
<li>
<a href="default.html">default</a>
</li>
</ul>
<h1>Class default</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">default</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<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-private"><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 tsd-is-private"><a href="default.html#report" class="tsd-kind-icon">report</a></li>
</ul>
</section>
</div>
</section>
</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">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<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">
</aside>
<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 ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a name="handlerinputs" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagPrivate">Private</span> handler<wbr>Inputs</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private">
<li class="tsd-signature tsd-kind-icon">handler<wbr>Inputs<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 <a href="https://github.com/devsapp/fc-remote-invoke/blob/3684d13/src/index.ts#L46">index.ts:46</a></li>
</ul>
</aside>
<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="invoke" class="tsd-anchor"></a>
<h3>invoke</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">invoke<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 <a href="https://github.com/devsapp/fc-remote-invoke/blob/3684d13/src/index.ts#L16">index.ts:16</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>event 函数本地调试</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 tsd-is-private">
<a name="report" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagPrivate">Private</span> report</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private">
<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 <a href="https://github.com/devsapp/fc-remote-invoke/blob/3684d13/src/index.ts#L39">index.ts:39</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>componentName: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>command: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<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>
</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">
</ul>
<ul class="current">
<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">
<a href="default.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-private">
<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 tsd-is-private">
<a href="default.html#report" class="tsd-kind-icon">report</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</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>

View File

@ -1,250 +0,0 @@
{
"id": 0,
"name": "fc-remote-invoke",
"kind": 0,
"kindString": "Project",
"flags": {},
"originalName": "",
"children": [
{
"id": 1,
"name": "default",
"kind": 128,
"kindString": "Class",
"flags": {},
"children": [
{
"id": 2,
"name": "constructor",
"kind": 512,
"kindString": "Constructor",
"flags": {},
"signatures": [
{
"id": 3,
"name": "new default",
"kind": 16384,
"kindString": "Constructor signature",
"flags": {},
"type": {
"type": "reference",
"id": 1,
"name": "default"
}
}
]
},
{
"id": 12,
"name": "handlerInputs",
"kind": 2048,
"kindString": "Method",
"flags": {
"isPrivate": true
},
"sources": [
{
"fileName": "index.ts",
"line": 46,
"character": 29
}
],
"signatures": [
{
"id": 13,
"name": "handlerInputs",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"parameters": [
{
"id": 14,
"name": "inputs",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"type": {
"type": "reference",
"name": "InputProps"
}
}
],
"type": {
"type": "reference",
"typeArguments": [
{
"type": "intrinsic",
"name": "any"
}
],
"name": "Promise"
}
}
]
},
{
"id": 4,
"name": "invoke",
"kind": 2048,
"kindString": "Method",
"flags": {},
"sources": [
{
"fileName": "index.ts",
"line": 16,
"character": 14
}
],
"signatures": [
{
"id": 5,
"name": "invoke",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"comment": {
"shortText": "event 函数本地调试",
"returns": "\n"
},
"parameters": [
{
"id": 6,
"name": "inputs",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"comment": {},
"type": {
"type": "reference",
"name": "InputProps"
}
}
],
"type": {
"type": "reference",
"typeArguments": [
{
"type": "intrinsic",
"name": "any"
}
],
"name": "Promise"
}
}
]
},
{
"id": 7,
"name": "report",
"kind": 2048,
"kindString": "Method",
"flags": {
"isPrivate": true
},
"sources": [
{
"fileName": "index.ts",
"line": 39,
"character": 22
}
],
"signatures": [
{
"id": 8,
"name": "report",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"parameters": [
{
"id": 9,
"name": "componentName",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 10,
"name": "command",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 11,
"name": "accountID",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "reference",
"typeArguments": [
{
"type": "intrinsic",
"name": "void"
}
],
"name": "Promise"
}
}
]
}
],
"groups": [
{
"title": "Constructors",
"kind": 512,
"children": [
2
]
},
{
"title": "Methods",
"kind": 2048,
"children": [
12,
4,
7
]
}
],
"sources": [
{
"fileName": "index.ts",
"line": 10,
"character": 35
}
]
}
],
"groups": [
{
"title": "Classes",
"kind": 128,
"children": [
1
]
}
],
"sources": [
{
"fileName": "index.ts",
"line": 1,
"character": 0
}
]
}

View File

@ -1,154 +0,0 @@
<!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>

View File

@ -1,112 +0,0 @@
<!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">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Classes</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-class"><a href="classes/default.html" class="tsd-kind-icon">default</a></li>
</ul>
</section>
</div>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="current ">
<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>

View File

@ -1,35 +0,0 @@
{
"deploy test": "部署测试",
"input args: -h -h": "input args: -h -h",
"command parse: {\"_\":[],\"help\":true,\"h\":true,\"event-stdin\":false,\"s\":false}": "command parse: {\"_\":[],\"help\":true,\"h\":true,\"event-stdin\":false,\"s\":false}",
"input args: -h --debug -h": "input args: -h --debug -h",
"command parse: {\"_\":[],\"help\":true,\"h\":true,\"event-stdin\":false,\"s\":false,\"debug\":true}": "command parse: {\"_\":[],\"help\":true,\"h\":true,\"event-stdin\":false,\"s\":false,\"debug\":true}",
"input args: --help": "input args: --help",
"input args: --invocation-type async": "input args: --invocation-type async",
"command parse: {\"_\":[],\"help\":false,\"h\":false,\"event-stdin\":false,\"s\":false,\"invocation-type\":\"async\",\"t\":\"async\"}": "command parse: {\"_\":[],\"help\":false,\"h\":false,\"event-stdin\":false,\"s\":false,\"invocation-type\":\"async\",\"t\":\"async\"}",
"input props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"guide-hello_world-nodejs12\"}": "input props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"guide-hello_world-nodejs12\"}",
"input args props: {}": "input args props: {}",
"props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"guide-hello_world-nodejs12\"}": "props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"guide-hello_world-nodejs12\"}",
"event: ": "event: ",
"get listTriggers: {\"triggers\":[]}": "get listTriggers: {\"triggers\":[]}",
"guide/guide-hello_world-nodejs12 async invoke success.\n": "guide/guide-hello_world-nodejs12 async invoke success.\n",
"guide/guide-hello_world-nodejs12 async invoke success.\n request id: c30c8868-333e-4bd1-ab33-8ed5ef74873f": "guide/guide-hello_world-nodejs12 async invoke success.\n request id: c30c8868-333e-4bd1-ab33-8ed5ef74873f",
"guide/guide-hello_world-nodejs12 async invoke success.\nrequest id: d4dde5e2-236f-4572-9f15-58adac0d5ed1": "guide/guide-hello_world-nodejs12 async invoke success.\nrequest id: d4dde5e2-236f-4572-9f15-58adac0d5ed1",
"guide/guide-hello_world-nodejs12 async invoke success.\nrequest id: 27872d4f-44aa-4b4c-8deb-3a1295965791\n": "guide/guide-hello_world-nodejs12 async invoke success.\nrequest id: 27872d4f-44aa-4b4c-8deb-3a1295965791\n",
"\nguide/guide-hello_world-nodejs12 async invoke success.\nrequest id: f1798899-985a-4d02-9556-d0882d0d6ccf\n": "\nguide/guide-hello_world-nodejs12 async invoke success.\nrequest id: f1798899-985a-4d02-9556-d0882d0d6ccf\n",
"input args: ": "input args: ",
"command parse: {}": "command parse: {}",
"input props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"hhh\"}": "input props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"hhh\"}",
"input args props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"hhh\"}": "input args props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"hhh\"}",
"get listTriggers: {\"triggers\":[{\"triggerName\":\"defaultTrigger\",\"description\":\"\",\"triggerId\":\"0c824580-2f4f-4c88-b45c-f953bc71181a\",\"sourceArn\":null,\"triggerType\":\"http\",\"invocationRole\":null,\"qualifier\":null,\"triggerConfig\":{\"methods\":[\"GET\",\"POST\"],\"authType\":\"anonymous\"},\"createdTime\":\"2021-04-02T07:34:07Z\",\"lastModifiedTime\":\"2021-07-16T08:47:37Z\"}]}": "get listTriggers: {\"triggers\":[{\"triggerName\":\"defaultTrigger\",\"description\":\"\",\"triggerId\":\"0c824580-2f4f-4c88-b45c-f953bc71181a\",\"sourceArn\":null,\"triggerType\":\"http\",\"invocationRole\":null,\"qualifier\":null,\"triggerConfig\":{\"methods\":[\"GET\",\"POST\"],\"authType\":\"anonymous\"},\"createdTime\":\"2021-04-02T07:34:07Z\",\"lastModifiedTime\":\"2021-07-16T08:47:37Z\"}]}",
"https://1899690531354629.cn-shenzhen.fc.aliyuncs.com/2016-08-15/proxy/guide/hhh/": "https://1899690531354629.cn-shenzhen.fc.aliyuncs.com/2016-08-15/proxy/guide/hhh/",
"method is GET.": "method is GET.",
"start invoke.": "start invoke.",
"end invoke.": "end invoke.",
"========= FC invoke Logs begin =========": "========= FC invoke Logs begin =========",
"FC Invoke Start RequestId: 56c854f8-b34c-4a2a-a578-64ea26ea022b\r\nload code for handler:index.handler\r\nFC Invoke End RequestId: 56c854f8-b34c-4a2a-a578-64ea26ea022b\r\n\nDuration: 24.77 ms, Billed Duration: 25 ms, Memory Size: 128 MB, Max Memory Used: 49.52 MB": "FC Invoke Start RequestId: 56c854f8-b34c-4a2a-a578-64ea26ea022b\r\nload code for handler:index.handler\r\nFC Invoke End RequestId: 56c854f8-b34c-4a2a-a578-64ea26ea022b\r\n\nDuration: 24.77 ms, Billed Duration: 25 ms, Memory Size: 128 MB, Max Memory Used: 49.52 MB",
"========= FC invoke Logs end =========": "========= FC invoke Logs end =========",
"\nFC Invoke Result:": "\nFC Invoke Result:",
"input args props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"guide-hello_world-nodejs12\"}": "input args props: {\"region\":\"cn-shenzhen\",\"serviceName\":\"guide\",\"functionName\":\"guide-hello_world-nodejs12\"}",
"FC Invoke Start RequestId: 59635ac4-38ab-48e2-a7fe-c56e435e46ee\r\nload code for handler:index.handler\r\n2021-07-29T01:40:22.922Z 59635ac4-38ab-48e2-a7fe-c56e435e46ee [verbose] \r\nFC Invoke End RequestId: 59635ac4-38ab-48e2-a7fe-c56e435e46ee\r\n\nDuration: 14.06 ms, Billed Duration: 15 ms, Memory Size: 128 MB, Max Memory Used: 49.02 MB": "FC Invoke Start RequestId: 59635ac4-38ab-48e2-a7fe-c56e435e46ee\r\nload code for handler:index.handler\r\n2021-07-29T01:40:22.922Z 59635ac4-38ab-48e2-a7fe-c56e435e46ee [verbose] \r\nFC Invoke End RequestId: 59635ac4-38ab-48e2-a7fe-c56e435e46ee\r\n\nDuration: 14.06 ms, Billed Duration: 15 ms, Memory Size: 128 MB, Max Memory Used: 49.02 MB"
}

View File

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

View File

@ -24,20 +24,18 @@
"scripts": {
"start": "npm run watch",
"watch": "tsc -w",
"publish": "npm run build && s cli platform publish",
"build": "npm run doc && tsc",
"postbuild": "npm run doc",
"doc": "npx typedoc src/index.ts --json doc/doc.json --out doc"
"prebuild": "rm -rf node_modules && rm -rf package-lock.json && npm i && rimraf lib",
"build": "ncc build src/index.ts -m -o lib"
},
"dependencies": {
"@alicloud/fc2": "^2.2.2",
"@serverless-devs/core": "^0.0.*",
"fs-extra": "^10.0.0",
"got": "^11.8.2",
"i18n": "^0.13.2",
"lodash": "^4.17.21",
"readline": "^1.3.0"
},
"autoInstall": false,
"devDependencies": {
"@types/lodash": "^4.14.168",
"@types/node": "^14.0.23",
@ -46,6 +44,7 @@
"eslint": "^7.7.0",
"ts-node": "^8.10.2",
"typedoc": "^0.20.35",
"typescript": "^3.9.7"
"typescript": "^3.9.7",
"@vercel/ncc": "^0.24.0"
}
}

View File

@ -1,43 +0,0 @@
import os from 'os';
import fs from 'fs';
import path from 'path';
import yaml from 'js-yaml';
import { I18n } from 'i18n';
export function getConfig(key: string): any {
const profile = getProfileFile();
return profile[key];
}
export function getProfileFile() {
let profileResult = {}
try {
const profileFilePath = getDefaultProfilePath();
profileResult = yaml.load(fs.readFileSync(profileFilePath, 'utf8')) || {};
} catch (e) {
console.log(e);
}
return profileResult;
}
export function getDefaultProfilePath(): string {
return path.join(os.homedir(), '.s', 'set-config.yml');
}
const i18n = new I18n({
locales: ['en', 'zh'],
directory: path.join(__dirname, '..', '..', 'locales'),
});
const locale = getConfig('locale');
if (locale) {
i18n.setLocale(locale);
} else {
i18n.setLocale('en');
}
export default i18n;

View File

@ -1,5 +1,4 @@
import i18n from './i18n';
import { Logger } from '@serverless-devs/core';
export default class ComponentLogger {
@ -8,26 +7,26 @@ export default class ComponentLogger {
ComponentLogger.CONTENT = content;
}
static log(m, color?: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'whiteBright' | 'gray') {
Logger.log(i18n.__(m) || m, color);
Logger.log(m, color);
}
static info(m) {
Logger.info(ComponentLogger.CONTENT, i18n.__(m) || m);
Logger.info(ComponentLogger.CONTENT, m);
}
static debug(m) {
Logger.debug(ComponentLogger.CONTENT, i18n.__(m) || m);
Logger.debug(ComponentLogger.CONTENT, m);
}
static error(m) {
Logger.error(ComponentLogger.CONTENT, i18n.__(m) || m);
Logger.error(ComponentLogger.CONTENT, m);
}
static warning(m) {
Logger.warn(ComponentLogger.CONTENT, i18n.__(m) || m);
Logger.warn(ComponentLogger.CONTENT, m);
}
static success(m) {
Logger.log(i18n.__(m) || m, 'green');
Logger.log(m, 'green');
}
}