mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2024-12-05 02:10:18 +00:00
Integrate Marine JS into Fluence peer (#149)
This commit is contained in:
parent
945c8f1bce
commit
954c20e2c0
13
aqua/tests/marine-js.aqua
Normal file
13
aqua/tests/marine-js.aqua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
data GreetingRecord:
|
||||||
|
str: string
|
||||||
|
num: i32
|
||||||
|
|
||||||
|
service Greeting("greeting"):
|
||||||
|
greeting(name: string) -> string
|
||||||
|
greeting_record() -> GreetingRecord
|
||||||
|
|
||||||
|
func call(arg: string) -> string:
|
||||||
|
res1 <- Greeting.greeting(arg)
|
||||||
|
res2 <- Greeting.greeting(res1)
|
||||||
|
res3 <- Greeting.greeting(res2)
|
||||||
|
<- res3
|
File diff suppressed because one or more lines are too long
@ -102,6 +102,8 @@
|
|||||||
<ul class="tsd-index-list">
|
<ul class="tsd-index-list">
|
||||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#getServices" class="tsd-kind-icon">get<wbr>Services</a></li>
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#getServices" class="tsd-kind-icon">get<wbr>Services</a></li>
|
||||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#getStatus" class="tsd-kind-icon">get<wbr>Status</a></li>
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#getStatus" class="tsd-kind-icon">get<wbr>Status</a></li>
|
||||||
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#registerMarineService" class="tsd-kind-icon">register<wbr>Marine<wbr>Service</a></li>
|
||||||
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#removeMarineService" class="tsd-kind-icon">remove<wbr>Marine<wbr>Service</a></li>
|
||||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#start" class="tsd-kind-icon">start</a></li>
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#start" class="tsd-kind-icon">start</a></li>
|
||||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#stop" class="tsd-kind-icon">stop</a></li>
|
<li class="tsd-kind-method tsd-parent-kind-class"><a href="FluencePeer.html#stop" class="tsd-kind-icon">stop</a></li>
|
||||||
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="FluencePeer.html#isInstance" class="tsd-kind-icon">is<wbr>Instance</a></li>
|
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="FluencePeer.html#isInstance" class="tsd-kind-icon">is<wbr>Instance</a></li>
|
||||||
@ -122,7 +124,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L150">internal/FluencePeer.ts:150</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L176">src/internal/FluencePeer.ts:176</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -147,7 +149,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L269">internal/FluencePeer.ts:269</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L330">src/internal/FluencePeer.ts:330</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -296,7 +298,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L242">internal/FluencePeer.ts:242</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L274">src/internal/FluencePeer.ts:274</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>sig<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Sig</span><span class="tsd-signature-symbol"> }</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>sig<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Sig</span><span class="tsd-signature-symbol"> }</span></h4>
|
||||||
@ -318,7 +320,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L168">internal/FluencePeer.ts:168</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L194">src/internal/FluencePeer.ts:194</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -330,6 +332,80 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
||||||
|
<a name="registerMarineService" class="tsd-anchor"></a>
|
||||||
|
<h3>register<wbr>Marine<wbr>Service</h3>
|
||||||
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||||
|
<li class="tsd-signature tsd-kind-icon">register<wbr>Marine<wbr>Service<span class="tsd-signature-symbol">(</span>wasm<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span>, serviceId<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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="tsd-descriptions">
|
||||||
|
<li class="tsd-description">
|
||||||
|
<aside class="tsd-sources">
|
||||||
|
<ul>
|
||||||
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L289">src/internal/FluencePeer.ts:289</a></li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Registers marine service within the Fluence peer from wasm file.
|
||||||
|
Following helper functions can be used to load wasm files:</p>
|
||||||
|
<ul>
|
||||||
|
<li>loadWasmFromFileSystem</li>
|
||||||
|
<li>loadWasmFromNpmPackage</li>
|
||||||
|
<li>loadWasmFromServer</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li>
|
||||||
|
<h5>wasm: <span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>buffer with the wasm file for service</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<h5>serviceId: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>the service id by which the service can be accessed in aqua</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
||||||
|
<a name="removeMarineService" class="tsd-anchor"></a>
|
||||||
|
<h3>remove<wbr>Marine<wbr>Service</h3>
|
||||||
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||||
|
<li class="tsd-signature tsd-kind-icon">remove<wbr>Marine<wbr>Service<span class="tsd-signature-symbol">(</span>serviceId<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">void</span></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="tsd-descriptions">
|
||||||
|
<li class="tsd-description">
|
||||||
|
<aside class="tsd-sources">
|
||||||
|
<ul>
|
||||||
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L302">src/internal/FluencePeer.ts:302</a></li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Removes the specified marine service from the Fluence peer</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li>
|
||||||
|
<h5>serviceId: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>the service id to remove</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
||||||
<a name="start" class="tsd-anchor"></a>
|
<a name="start" class="tsd-anchor"></a>
|
||||||
<h3>start</h3>
|
<h3>start</h3>
|
||||||
@ -340,7 +416,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L184">internal/FluencePeer.ts:184</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L210">src/internal/FluencePeer.ts:210</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -372,7 +448,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L252">internal/FluencePeer.ts:252</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L310">src/internal/FluencePeer.ts:310</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -395,7 +471,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L157">internal/FluencePeer.ts:157</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L183">src/internal/FluencePeer.ts:183</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -446,6 +522,12 @@
|
|||||||
<li class=" tsd-kind-method tsd-parent-kind-class">
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
||||||
<a href="FluencePeer.html#getStatus" class="tsd-kind-icon">get<wbr>Status</a>
|
<a href="FluencePeer.html#getStatus" class="tsd-kind-icon">get<wbr>Status</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
||||||
|
<a href="FluencePeer.html#registerMarineService" class="tsd-kind-icon">register<wbr>Marine<wbr>Service</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
||||||
|
<a href="FluencePeer.html#removeMarineService" class="tsd-kind-icon">remove<wbr>Marine<wbr>Service</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-method tsd-parent-kind-class">
|
<li class=" tsd-kind-method tsd-parent-kind-class">
|
||||||
<a href="FluencePeer.html#start" class="tsd-kind-icon">start</a>
|
<a href="FluencePeer.html#start" class="tsd-kind-icon">start</a>
|
||||||
</li>
|
</li>
|
||||||
@ -480,6 +562,15 @@
|
|||||||
<li class=" tsd-kind-variable">
|
<li class=" tsd-kind-variable">
|
||||||
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-function">
|
<li class=" tsd-kind-function">
|
||||||
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -115,7 +115,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/KeyPair.ts#L26">internal/KeyPair.ts:26</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/KeyPair.ts#L26">src/internal/KeyPair.ts:26</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
@ -137,7 +137,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">Libp2p<wbr>Peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">PeerId</span></div>
|
<div class="tsd-signature tsd-kind-icon">Libp2p<wbr>Peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">PeerId</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/KeyPair.ts#L24">internal/KeyPair.ts:24</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/KeyPair.ts#L24">src/internal/KeyPair.ts:24</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -159,7 +159,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/KeyPair.ts#L62">internal/KeyPair.ts:62</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/KeyPair.ts#L62">src/internal/KeyPair.ts:62</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
@ -182,7 +182,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/KeyPair.ts#L51">internal/KeyPair.ts:51</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/KeyPair.ts#L51">src/internal/KeyPair.ts:51</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
|
||||||
@ -199,7 +199,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/KeyPair.ts#L58">internal/KeyPair.ts:58</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/KeyPair.ts#L58">src/internal/KeyPair.ts:58</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Uint8Array</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Uint8Array</span></h4>
|
||||||
@ -217,7 +217,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/KeyPair.ts#L66">internal/KeyPair.ts:66</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/KeyPair.ts#L66">src/internal/KeyPair.ts:66</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
@ -243,7 +243,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/KeyPair.ts#L35">internal/KeyPair.ts:35</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/KeyPair.ts#L35">src/internal/KeyPair.ts:35</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -274,7 +274,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/KeyPair.ts#L46">internal/KeyPair.ts:46</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/KeyPair.ts#L46">src/internal/KeyPair.ts:46</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -355,6 +355,15 @@
|
|||||||
<li class=" tsd-kind-variable">
|
<li class=" tsd-kind-variable">
|
||||||
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-function">
|
<li class=" tsd-kind-function">
|
||||||
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -108,6 +108,15 @@
|
|||||||
<li class=" tsd-kind-variable">
|
<li class=" tsd-kind-variable">
|
||||||
<a href="modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
<a href="modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-function">
|
<li class=" tsd-kind-function">
|
||||||
<a href="modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
<a href="modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">init<wbr>Peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
<div class="tsd-signature tsd-kind-icon">init<wbr>Peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/commonTypes.ts#L37">internal/commonTypes.ts:37</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/commonTypes.ts#L37">src/internal/commonTypes.ts:37</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -133,7 +133,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">particle<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
<div class="tsd-signature tsd-kind-icon">particle<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/commonTypes.ts#L32">internal/commonTypes.ts:32</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/commonTypes.ts#L32">src/internal/commonTypes.ts:32</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -148,7 +148,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">signature<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
<div class="tsd-signature tsd-kind-icon">signature<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/commonTypes.ts#L52">internal/commonTypes.ts:52</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/commonTypes.ts#L52">src/internal/commonTypes.ts:52</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -163,7 +163,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">tetraplets<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><span class="tsd-signature-symbol">[ </span><span class="tsd-signature-type">key</span><span class="tsd-signature-symbol"> in </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">SecurityTetraplet</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span></div>
|
<div class="tsd-signature tsd-kind-icon">tetraplets<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><span class="tsd-signature-symbol">[ </span><span class="tsd-signature-type">key</span><span class="tsd-signature-symbol"> in </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">SecurityTetraplet</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/commonTypes.ts#L57">internal/commonTypes.ts:57</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/commonTypes.ts#L57">src/internal/commonTypes.ts:57</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -178,7 +178,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">timestamp<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
<div class="tsd-signature tsd-kind-icon">timestamp<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/commonTypes.ts#L42">internal/commonTypes.ts:42</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/commonTypes.ts#L42">src/internal/commonTypes.ts:42</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -193,7 +193,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">ttl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
<div class="tsd-signature tsd-kind-icon">ttl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/commonTypes.ts#L47">internal/commonTypes.ts:47</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/commonTypes.ts#L47">src/internal/commonTypes.ts:47</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -262,6 +262,15 @@
|
|||||||
<li class=" tsd-kind-variable">
|
<li class=" tsd-kind-variable">
|
||||||
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-function">
|
<li class=" tsd-kind-function">
|
||||||
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -95,6 +95,7 @@
|
|||||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#debug" class="tsd-kind-icon">debug</a></li>
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#debug" class="tsd-kind-icon">debug</a></li>
|
||||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#defaultTtlMs" class="tsd-kind-icon">default<wbr>Ttl<wbr>Ms</a></li>
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#defaultTtlMs" class="tsd-kind-icon">default<wbr>Ttl<wbr>Ms</a></li>
|
||||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#dialTimeoutMs" class="tsd-kind-icon">dial<wbr>Timeout<wbr>Ms</a></li>
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#dialTimeoutMs" class="tsd-kind-icon">dial<wbr>Timeout<wbr>Ms</a></li>
|
||||||
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#marineJS" class="tsd-kind-icon">marineJS</a></li>
|
||||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#skipCheckConnection" class="tsd-kind-icon">skip<wbr>Check<wbr>Connection</a></li>
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#skipCheckConnection" class="tsd-kind-icon">skip<wbr>Check<wbr>Connection</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@ -109,7 +110,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">Key<wbr>Pair<span class="tsd-signature-symbol">:</span> <a href="../classes/KeyPair.html" class="tsd-signature-type" data-tsd-kind="Class">KeyPair</a></div>
|
<div class="tsd-signature tsd-kind-icon">Key<wbr>Pair<span class="tsd-signature-symbol">:</span> <a href="../classes/KeyPair.html" class="tsd-signature-type" data-tsd-kind="Class">KeyPair</a></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L72">internal/FluencePeer.ts:72</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L74">src/internal/FluencePeer.ts:74</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -125,7 +126,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">avm<wbr>Log<wbr>Level<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">LogLevel</span></div>
|
<div class="tsd-signature tsd-kind-icon">avm<wbr>Log<wbr>Level<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">LogLevel</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L66">internal/FluencePeer.ts:66</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L68">src/internal/FluencePeer.ts:68</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -140,13 +141,18 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">avm<wbr>Runner<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AvmRunner</span></div>
|
<div class="tsd-signature tsd-kind-icon">avm<wbr>Runner<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AvmRunner</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L103">internal/FluencePeer.ts:103</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L106">src/internal/FluencePeer.ts:106</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
<div class="lead">
|
<dl class="tsd-comment-tags">
|
||||||
<p>Plugable AVM runner implementation. If not specified AvmBackgroundRunner will be used</p>
|
<dt>deprecated.</dt>
|
||||||
</div>
|
<dd><p>AVM run through marine-js infrastructure.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>see</dt>
|
||||||
|
<dd><p>marineJS option to configure AVM</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||||
@ -155,7 +161,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">check<wbr>Connection<wbr>Timeout<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
<div class="tsd-signature tsd-kind-icon">check<wbr>Connection<wbr>Timeout<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L79">internal/FluencePeer.ts:79</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L81">src/internal/FluencePeer.ts:81</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -172,7 +178,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">connect<wbr>To<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Multiaddr</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Node</span></div>
|
<div class="tsd-signature tsd-kind-icon">connect<wbr>To<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Multiaddr</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Node</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L61">internal/FluencePeer.ts:61</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L63">src/internal/FluencePeer.ts:63</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -194,7 +200,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>printParticleId<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span></div>
|
<div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>printParticleId<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L108">internal/FluencePeer.ts:108</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L134">src/internal/FluencePeer.ts:134</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -223,7 +229,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">default<wbr>Ttl<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
<div class="tsd-signature tsd-kind-icon">default<wbr>Ttl<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L98">internal/FluencePeer.ts:98</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L100">src/internal/FluencePeer.ts:100</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -240,7 +246,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">dial<wbr>Timeout<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
<div class="tsd-signature tsd-kind-icon">dial<wbr>Timeout<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L91">internal/FluencePeer.ts:91</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L93">src/internal/FluencePeer.ts:93</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -249,13 +255,60 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||||
|
<a name="marineJS" class="tsd-anchor"></a>
|
||||||
|
<h3><span class="tsd-flag ts-flagOptional">Optional</span> marineJS</h3>
|
||||||
|
<div class="tsd-signature tsd-kind-icon">marineJS<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>avmWasmPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>marineWasmPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>workerScriptPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></div>
|
||||||
|
<aside class="tsd-sources">
|
||||||
|
<ul>
|
||||||
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L114">src/internal/FluencePeer.ts:114</a></li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>This option allows to specify the location of various dependencies needed for marine-js.
|
||||||
|
Each key specifies the location of the corresponding dependency.
|
||||||
|
If Fluence peer is started inside browser the location is treated as the path to the file relative to origin.
|
||||||
|
IF Fluence peer is started in nodejs the location is treated as the full path to file on the file system.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tsd-type-declaration">
|
||||||
|
<h4>Type declaration</h4>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li class="tsd-parameter">
|
||||||
|
<h5>avm<wbr>Wasm<wbr>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Configures the path to AVM wasm module</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="tsd-parameter">
|
||||||
|
<h5>marine<wbr>Wasm<wbr>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Configures the path to marine-js control wasm module</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="tsd-parameter">
|
||||||
|
<h5>worker<wbr>Script<wbr>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Configures path to the marine-js worker script.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||||
<a name="skipCheckConnection" class="tsd-anchor"></a>
|
<a name="skipCheckConnection" class="tsd-anchor"></a>
|
||||||
<h3><span class="tsd-flag ts-flagOptional">Optional</span> skip<wbr>Check<wbr>Connection</h3>
|
<h3><span class="tsd-flag ts-flagOptional">Optional</span> skip<wbr>Check<wbr>Connection</h3>
|
||||||
<div class="tsd-signature tsd-kind-icon">skip<wbr>Check<wbr>Connection<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
|
<div class="tsd-signature tsd-kind-icon">skip<wbr>Check<wbr>Connection<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L86">internal/FluencePeer.ts:86</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L88">src/internal/FluencePeer.ts:88</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -316,6 +369,9 @@
|
|||||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||||
<a href="PeerConfig.html#dialTimeoutMs" class="tsd-kind-icon">dial<wbr>Timeout<wbr>Ms</a>
|
<a href="PeerConfig.html#dialTimeoutMs" class="tsd-kind-icon">dial<wbr>Timeout<wbr>Ms</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||||
|
<a href="PeerConfig.html#marineJS" class="tsd-kind-icon">marineJS</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||||
<a href="PeerConfig.html#skipCheckConnection" class="tsd-kind-icon">skip<wbr>Check<wbr>Connection</a>
|
<a href="PeerConfig.html#skipCheckConnection" class="tsd-kind-icon">skip<wbr>Check<wbr>Connection</a>
|
||||||
</li>
|
</li>
|
||||||
@ -335,6 +391,15 @@
|
|||||||
<li class=" tsd-kind-variable">
|
<li class=" tsd-kind-variable">
|
||||||
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-function">
|
<li class=" tsd-kind-function">
|
||||||
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -104,7 +104,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">is<wbr>Connected<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Boolean</span></div>
|
<div class="tsd-signature tsd-kind-icon">is<wbr>Connected<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Boolean</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L129">internal/FluencePeer.ts:129</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L155">src/internal/FluencePeer.ts:155</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -119,7 +119,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">is<wbr>Initialized<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Boolean</span></div>
|
<div class="tsd-signature tsd-kind-icon">is<wbr>Initialized<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Boolean</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L124">internal/FluencePeer.ts:124</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L150">src/internal/FluencePeer.ts:150</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -134,7 +134,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
<div class="tsd-signature tsd-kind-icon">peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L134">internal/FluencePeer.ts:134</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L160">src/internal/FluencePeer.ts:160</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -149,7 +149,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">relay<wbr>Peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
<div class="tsd-signature tsd-kind-icon">relay<wbr>Peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L139">internal/FluencePeer.ts:139</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L165">src/internal/FluencePeer.ts:165</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -212,6 +212,15 @@
|
|||||||
<li class=" tsd-kind-variable">
|
<li class=" tsd-kind-variable">
|
||||||
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="../modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-function">
|
<li class=" tsd-kind-function">
|
||||||
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -92,6 +92,9 @@
|
|||||||
<section class="tsd-index-section ">
|
<section class="tsd-index-section ">
|
||||||
<h3>Functions</h3>
|
<h3>Functions</h3>
|
||||||
<ul class="tsd-index-list">
|
<ul class="tsd-index-list">
|
||||||
|
<li class="tsd-kind-function tsd-is-external"><a href="modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a></li>
|
||||||
|
<li class="tsd-kind-function tsd-is-external"><a href="modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a></li>
|
||||||
|
<li class="tsd-kind-function tsd-is-external"><a href="modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a></li>
|
||||||
<li class="tsd-kind-function"><a href="modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a></li>
|
<li class="tsd-kind-function"><a href="modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@ -106,7 +109,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">Avm<wbr>Loglevel<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">LogLevel</span></div>
|
<div class="tsd-signature tsd-kind-icon">Avm<wbr>Loglevel<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">LogLevel</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/FluencePeer.ts#L45">internal/FluencePeer.ts:45</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/FluencePeer.ts#L47">src/internal/FluencePeer.ts:47</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -122,7 +125,7 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">Peer<wbr>IdB58<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
<div class="tsd-signature tsd-kind-icon">Peer<wbr>IdB58<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/internal/commonTypes.ts#L22">internal/commonTypes.ts:22</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/internal/commonTypes.ts#L22">src/internal/commonTypes.ts:22</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -137,10 +140,10 @@
|
|||||||
<section class="tsd-panel tsd-member tsd-kind-variable">
|
<section class="tsd-panel tsd-member tsd-kind-variable">
|
||||||
<a name="Fluence" class="tsd-anchor"></a>
|
<a name="Fluence" class="tsd-anchor"></a>
|
||||||
<h3><span class="tsd-flag ts-flagConst">Const</span> Fluence</h3>
|
<h3><span class="tsd-flag ts-flagConst">Const</span> Fluence</h3>
|
||||||
<div class="tsd-signature tsd-kind-icon">Fluence<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>getPeer<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><a href="classes/FluencePeer.html" class="tsd-signature-type" data-tsd-kind="Class">FluencePeer</a><span class="tsd-signature-symbol">; </span>getStatus<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><a href="interfaces/PeerStatus.html" class="tsd-signature-type" data-tsd-kind="Interface">PeerStatus</a><span class="tsd-signature-symbol">; </span>start<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>config<span class="tsd-signature-symbol">?: </span><a href="interfaces/PeerConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">PeerConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span>stop<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div>
|
<div class="tsd-signature tsd-kind-icon">Fluence<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>getPeer<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><a href="classes/FluencePeer.html" class="tsd-signature-type" data-tsd-kind="Class">FluencePeer</a><span class="tsd-signature-symbol">; </span>getStatus<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><a href="interfaces/PeerStatus.html" class="tsd-signature-type" data-tsd-kind="Interface">PeerStatus</a><span class="tsd-signature-symbol">; </span>registerMarineService<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>wasm<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span>, serviceId<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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span>removeMarineService<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>serviceId<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">void</span><span class="tsd-signature-symbol">; </span>start<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>config<span class="tsd-signature-symbol">?: </span><a href="interfaces/PeerConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">PeerConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span>stop<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/index.ts#L36">index.ts:36</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/index.ts#L37">src/index.ts:37</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography">
|
<div class="tsd-comment tsd-typography">
|
||||||
@ -193,6 +196,76 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="tsd-parameter">
|
||||||
|
<h5>register<wbr>Marine<wbr>Service<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>wasm<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span>, serviceId<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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h5>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li class="tsd-parameter-signature">
|
||||||
|
<ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-type-literal">
|
||||||
|
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>wasm<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span>, serviceId<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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="tsd-descriptions">
|
||||||
|
<li class="tsd-description">
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Registers marine service within the default Fluence peer from wasm file.
|
||||||
|
Following helper functions can be used to load wasm files:</p>
|
||||||
|
<ul>
|
||||||
|
<li>loadWasmFromFileSystem</li>
|
||||||
|
<li>loadWasmFromNpmPackage</li>
|
||||||
|
<li>loadWasmFromServer</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li>
|
||||||
|
<h5>wasm: <span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>buffer with the wasm file for service</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<h5>serviceId: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>the service id by which the service can be accessed in aqua</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="tsd-parameter">
|
||||||
|
<h5>remove<wbr>Marine<wbr>Service<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>serviceId<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">void</span></h5>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li class="tsd-parameter-signature">
|
||||||
|
<ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-type-literal">
|
||||||
|
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>serviceId<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">void</span></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="tsd-descriptions">
|
||||||
|
<li class="tsd-description">
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Removes the specified marine service from the default Fluence peer</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li>
|
||||||
|
<h5>serviceId: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>the service id to remove</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li class="tsd-parameter">
|
<li class="tsd-parameter">
|
||||||
<h5>start<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>config<span class="tsd-signature-symbol">?: </span><a href="interfaces/PeerConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">PeerConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h5>
|
<h5>start<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>config<span class="tsd-signature-symbol">?: </span><a href="interfaces/PeerConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">PeerConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h5>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
@ -250,6 +323,116 @@
|
|||||||
</section>
|
</section>
|
||||||
<section class="tsd-panel-group tsd-member-group ">
|
<section class="tsd-panel-group tsd-member-group ">
|
||||||
<h2>Functions</h2>
|
<h2>Functions</h2>
|
||||||
|
<section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
|
||||||
|
<a name="loadWasmFromFileSystem" class="tsd-anchor"></a>
|
||||||
|
<h3><span class="tsd-flag ts-flagConst">Const</span> load<wbr>Wasm<wbr>From<wbr>File<wbr>System</h3>
|
||||||
|
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
|
||||||
|
<li class="tsd-signature tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System<span class="tsd-signature-symbol">(</span>filePath<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"><</span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol">></span></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="tsd-descriptions">
|
||||||
|
<li class="tsd-description">
|
||||||
|
<aside class="tsd-sources">
|
||||||
|
<ul>
|
||||||
|
<li>Defined in node_modules/@fluencelabs/marine-js/dist/loadWasmHelpers.d.ts:28</li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Load wasm file from the file system. Only works in nodejs environment.
|
||||||
|
The functions returns SharedArrayBuffer compatible with FluenceAppService methods.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li>
|
||||||
|
<h5>filePath: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>path to the wasm file</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol">></span></h4>
|
||||||
|
<p>SharedArrayBuffer with the wasm file</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
<section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
|
||||||
|
<a name="loadWasmFromNpmPackage" class="tsd-anchor"></a>
|
||||||
|
<h3><span class="tsd-flag ts-flagConst">Const</span> load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</h3>
|
||||||
|
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
|
||||||
|
<li class="tsd-signature tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package<span class="tsd-signature-symbol">(</span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>file<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>package<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-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol">></span></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="tsd-descriptions">
|
||||||
|
<li class="tsd-description">
|
||||||
|
<aside class="tsd-sources">
|
||||||
|
<ul>
|
||||||
|
<li>Defined in node_modules/@fluencelabs/marine-js/dist/loadWasmHelpers.d.ts:18</li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Load wasm file from npm package. Only works in nodejs environment.
|
||||||
|
The function returns SharedArrayBuffer compatible with FluenceAppService methods.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li>
|
||||||
|
<h5>source: <span class="tsd-signature-symbol">{ </span>file<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>package<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>object specifying the source of the file. Consist two fields: package name and file path.</p>
|
||||||
|
</div>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li class="tsd-parameter">
|
||||||
|
<h5>file<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
|
||||||
|
</li>
|
||||||
|
<li class="tsd-parameter">
|
||||||
|
<h5>package<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol">></span></h4>
|
||||||
|
<p>SharedArrayBuffer with the wasm file</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
<section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
|
||||||
|
<a name="loadWasmFromServer" class="tsd-anchor"></a>
|
||||||
|
<h3><span class="tsd-flag ts-flagConst">Const</span> load<wbr>Wasm<wbr>From<wbr>Server</h3>
|
||||||
|
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
|
||||||
|
<li class="tsd-signature tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server<span class="tsd-signature-symbol">(</span>filePath<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"><</span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol">></span></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="tsd-descriptions">
|
||||||
|
<li class="tsd-description">
|
||||||
|
<aside class="tsd-sources">
|
||||||
|
<ul>
|
||||||
|
<li>Defined in node_modules/@fluencelabs/marine-js/dist/loadWasmHelpers.d.ts:11</li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Load wasm file from the server. Only works in browsers.
|
||||||
|
The function will try load file into SharedArrayBuffer if the site is cross-origin isolated.
|
||||||
|
Otherwise the return value fallbacks to Buffer which is less performant but is still compatible with FluenceAppService methods.
|
||||||
|
We strongly recommend to set-up cross-origin headers. For more details see: See <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements</a>
|
||||||
|
Filename is relative to current origin.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
|
<ul class="tsd-parameters">
|
||||||
|
<li>
|
||||||
|
<h5>filePath: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>path to the wasm file relative to current origin</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">SharedArrayBuffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol">></span></h4>
|
||||||
|
<p>Either SharedArrayBuffer or Buffer with the wasm file</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-member tsd-kind-function">
|
<section class="tsd-panel tsd-member tsd-kind-function">
|
||||||
<a name="setLogLevel" class="tsd-anchor"></a>
|
<a name="setLogLevel" class="tsd-anchor"></a>
|
||||||
<h3><span class="tsd-flag ts-flagConst">Const</span> set<wbr>Log<wbr>Level</h3>
|
<h3><span class="tsd-flag ts-flagConst">Const</span> set<wbr>Log<wbr>Level</h3>
|
||||||
@ -260,7 +443,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/0c32288/src/index.ts#L25">index.ts:25</a></li>
|
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/index.ts#L26">src/index.ts:26</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
@ -309,6 +492,15 @@
|
|||||||
<li class=" tsd-kind-variable">
|
<li class=" tsd-kind-variable">
|
||||||
<a href="modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
<a href="modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
|
||||||
|
</li>
|
||||||
|
<li class=" tsd-kind-function tsd-is-external">
|
||||||
|
<a href="modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
|
||||||
|
</li>
|
||||||
<li class=" tsd-kind-function">
|
<li class=" tsd-kind-function">
|
||||||
<a href="modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
<a href="modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
|
||||||
</li>
|
</li>
|
||||||
|
6219
package-lock.json
generated
6219
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,15 +19,14 @@
|
|||||||
"author": "Fluence Labs",
|
"author": "Fluence Labs",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"copy-avm-public": "dist/tools/copyAvmPublic.js"
|
"copy-marine": "dist/tools/copyMarine.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chainsafe/libp2p-noise": "^4.1.1",
|
"@chainsafe/libp2p-noise": "^4.1.1",
|
||||||
"@fluencelabs/avm": "^0.21.3",
|
"@fluencelabs/avm": "0.23.0",
|
||||||
"@fluencelabs/avm-runner-background": "0.2.0",
|
"@fluencelabs/marine-js": "0.2.3",
|
||||||
"@fluencelabs/avm-runner-interface": "^0.2.0",
|
|
||||||
"@fluencelabs/marine-js": "0.1.0",
|
|
||||||
"async": "3.2.0",
|
"async": "3.2.0",
|
||||||
|
"browser-or-node": "^2.0.0",
|
||||||
"bs58": "4.0.1",
|
"bs58": "4.0.1",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"cids": "0.8.1",
|
"cids": "0.8.1",
|
||||||
|
150
src/__test__/_aqua/marine-js.ts
Normal file
150
src/__test__/_aqua/marine-js.ts
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||||
|
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||||
|
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||||
|
* Aqua version: 0.7.0-285
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
import { Fluence, FluencePeer } from '../../index';
|
||||||
|
import { CallParams, callFunction, registerService } from '../../internal/compilerSupport/v3';
|
||||||
|
|
||||||
|
// Services
|
||||||
|
|
||||||
|
export interface GreetingDef {
|
||||||
|
greeting: (name: string, callParams: CallParams<'name'>) => string | Promise<string>;
|
||||||
|
greeting_record: (
|
||||||
|
callParams: CallParams<null>,
|
||||||
|
) => { num: number; str: string } | Promise<{ num: number; str: string }>;
|
||||||
|
}
|
||||||
|
export function registerGreeting(service: GreetingDef): void;
|
||||||
|
export function registerGreeting(serviceId: string, service: GreetingDef): void;
|
||||||
|
export function registerGreeting(peer: FluencePeer, service: GreetingDef): void;
|
||||||
|
export function registerGreeting(peer: FluencePeer, serviceId: string, service: GreetingDef): void;
|
||||||
|
|
||||||
|
export function registerGreeting(...args: any) {
|
||||||
|
registerService(args, {
|
||||||
|
defaultServiceId: 'greeting',
|
||||||
|
functions: {
|
||||||
|
tag: 'labeledProduct',
|
||||||
|
fields: {
|
||||||
|
greeting: {
|
||||||
|
tag: 'arrow',
|
||||||
|
domain: {
|
||||||
|
tag: 'labeledProduct',
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
tag: 'scalar',
|
||||||
|
name: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
codomain: {
|
||||||
|
tag: 'unlabeledProduct',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
tag: 'scalar',
|
||||||
|
name: 'string',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
greeting_record: {
|
||||||
|
tag: 'arrow',
|
||||||
|
domain: {
|
||||||
|
tag: 'nil',
|
||||||
|
},
|
||||||
|
codomain: {
|
||||||
|
tag: 'unlabeledProduct',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
tag: 'struct',
|
||||||
|
name: 'GreetingRecord',
|
||||||
|
fields: {
|
||||||
|
num: {
|
||||||
|
tag: 'scalar',
|
||||||
|
name: 'i32',
|
||||||
|
},
|
||||||
|
str: {
|
||||||
|
tag: 'scalar',
|
||||||
|
name: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
|
||||||
|
export function call(arg: string, config?: { ttl?: number }): Promise<string>;
|
||||||
|
|
||||||
|
export function call(peer: FluencePeer, arg: string, config?: { ttl?: number }): Promise<string>;
|
||||||
|
|
||||||
|
export function call(...args: any) {
|
||||||
|
let script = `
|
||||||
|
(xor
|
||||||
|
(seq
|
||||||
|
(seq
|
||||||
|
(seq
|
||||||
|
(seq
|
||||||
|
(seq
|
||||||
|
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||||
|
(call %init_peer_id% ("getDataSrv" "arg") [] arg)
|
||||||
|
)
|
||||||
|
(call %init_peer_id% ("greeting" "greeting") [arg] res1)
|
||||||
|
)
|
||||||
|
(call %init_peer_id% ("greeting" "greeting") [res1] res2)
|
||||||
|
)
|
||||||
|
(call %init_peer_id% ("greeting" "greeting") [res2] res3)
|
||||||
|
)
|
||||||
|
(xor
|
||||||
|
(call %init_peer_id% ("callbackSrv" "response") [res3])
|
||||||
|
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||||
|
)
|
||||||
|
`;
|
||||||
|
return callFunction(
|
||||||
|
args,
|
||||||
|
{
|
||||||
|
functionName: 'call',
|
||||||
|
arrow: {
|
||||||
|
tag: 'arrow',
|
||||||
|
domain: {
|
||||||
|
tag: 'labeledProduct',
|
||||||
|
fields: {
|
||||||
|
arg: {
|
||||||
|
tag: 'scalar',
|
||||||
|
name: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
codomain: {
|
||||||
|
tag: 'unlabeledProduct',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
tag: 'scalar',
|
||||||
|
name: 'string',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
names: {
|
||||||
|
relay: '-relay-',
|
||||||
|
getDataSrv: 'getDataSrv',
|
||||||
|
callbackSrv: 'callbackSrv',
|
||||||
|
responseSrv: 'callbackSrv',
|
||||||
|
responseFnName: 'response',
|
||||||
|
errorHandlingSrv: 'errorHandlingSrv',
|
||||||
|
errorFnName: 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
script,
|
||||||
|
);
|
||||||
|
}
|
BIN
src/__test__/integration/greeting.wasm
Executable file
BIN
src/__test__/integration/greeting.wasm
Executable file
Binary file not shown.
25
src/__test__/integration/marine-js.spec.ts
Normal file
25
src/__test__/integration/marine-js.spec.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { Fluence } from '../../index';
|
||||||
|
import fs from 'fs';
|
||||||
|
import { call } from '../_aqua/marine-js';
|
||||||
|
|
||||||
|
describe('Marine js tests', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await Fluence.start();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await Fluence.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call marine service correctly', async () => {
|
||||||
|
// arrange
|
||||||
|
const wasm = fs.readFileSync(__dirname + '/greeting.wasm');
|
||||||
|
await Fluence.registerMarineService(wasm, 'greeting');
|
||||||
|
|
||||||
|
// act
|
||||||
|
const res = await call('test');
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(res).toBe('Hi, Hi, Hi, test');
|
||||||
|
});
|
||||||
|
});
|
@ -1,264 +0,0 @@
|
|||||||
import { CallServiceData, ResultCodes } from '../../internal/commonTypes';
|
|
||||||
import { CallServiceHandler } from '../../internal/compilerSupport/LegacyCallServiceHandler';
|
|
||||||
|
|
||||||
const req = (): CallServiceData => ({
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'fn name',
|
|
||||||
args: [],
|
|
||||||
tetraplets: [],
|
|
||||||
particleContext: {
|
|
||||||
particleId: 'id',
|
|
||||||
initPeerId: 'init peer id',
|
|
||||||
timestamp: 595951200,
|
|
||||||
ttl: 595961200,
|
|
||||||
signature: 'sig',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const res = () => ({
|
|
||||||
res,
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Call service handler tests', () => {
|
|
||||||
it('Should work without middlewares', () => {
|
|
||||||
// arrange
|
|
||||||
const handler = new CallServiceHandler();
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res = handler.execute(req());
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res).not.toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should work with no-op middleware', () => {
|
|
||||||
// arrange
|
|
||||||
const handler = new CallServiceHandler();
|
|
||||||
handler.use((req, res, next) => {
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res = handler.execute(req());
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res).not.toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should work with two overlapping middlewares', () => {
|
|
||||||
// arrange
|
|
||||||
const handler = new CallServiceHandler();
|
|
||||||
handler
|
|
||||||
.use((req, res, next) => {
|
|
||||||
res.result = { hello: 'world' };
|
|
||||||
})
|
|
||||||
.use((req, res, next) => {
|
|
||||||
res.result = { hello: 'incorect' };
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res = handler.execute(req());
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res).toMatchObject({
|
|
||||||
result: { hello: 'world' },
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should work with two NON-overlapping middlewares', () => {
|
|
||||||
// arrange
|
|
||||||
const handler = new CallServiceHandler();
|
|
||||||
handler
|
|
||||||
.use((req, res, next) => {
|
|
||||||
res.result = {};
|
|
||||||
next();
|
|
||||||
})
|
|
||||||
.use((req, res, next) => {
|
|
||||||
(res.result as any).name = 'john';
|
|
||||||
next();
|
|
||||||
})
|
|
||||||
.use((req, res, next) => {
|
|
||||||
(res.result as any).color = 'red';
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res = handler.execute(req());
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res).toMatchObject({
|
|
||||||
result: { name: 'john', color: 'red' },
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Service handler tests', () => {
|
|
||||||
it('Should register service function', () => {
|
|
||||||
// arrange
|
|
||||||
const handler = new CallServiceHandler();
|
|
||||||
handler.on('service', 'function', (args) => {
|
|
||||||
return { called: args };
|
|
||||||
});
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res = handler.execute({
|
|
||||||
...req(),
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'function',
|
|
||||||
args: ['hello', 'world'],
|
|
||||||
});
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res).toMatchObject({
|
|
||||||
retCode: ResultCodes.success,
|
|
||||||
result: { called: ['hello', 'world'] },
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should register event', async () => {
|
|
||||||
// arrange
|
|
||||||
const handler = new CallServiceHandler();
|
|
||||||
const returnPromise = new Promise((resolve) => {
|
|
||||||
handler.onEvent('service', 'function', (args) => {
|
|
||||||
resolve({ called: args });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
handler.onEvent('service', 'function', (args) => {
|
|
||||||
return { called: args };
|
|
||||||
});
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res = handler.execute({
|
|
||||||
...req(),
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'function',
|
|
||||||
args: ['hello', 'world'],
|
|
||||||
});
|
|
||||||
|
|
||||||
// assert
|
|
||||||
await expect(returnPromise).resolves.toMatchObject({ called: ['hello', 'world'] });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should register multiple service functions', () => {
|
|
||||||
// arrange
|
|
||||||
const handler = new CallServiceHandler();
|
|
||||||
handler.on('service', 'function1', (args) => {
|
|
||||||
return 'called function1';
|
|
||||||
});
|
|
||||||
handler.on('service', 'function2', (args) => {
|
|
||||||
return 'called function2';
|
|
||||||
});
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res1 = handler.execute({
|
|
||||||
...req(),
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'function1',
|
|
||||||
});
|
|
||||||
const res2 = handler.execute({
|
|
||||||
...req(),
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'function2',
|
|
||||||
});
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res1).toMatchObject({
|
|
||||||
retCode: ResultCodes.success,
|
|
||||||
result: 'called function1',
|
|
||||||
});
|
|
||||||
expect(res2).toMatchObject({
|
|
||||||
retCode: ResultCodes.success,
|
|
||||||
result: 'called function2',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should override previous function registration', () => {
|
|
||||||
// arrange
|
|
||||||
const handler = new CallServiceHandler();
|
|
||||||
handler.on('service', 'function', (args) => {
|
|
||||||
return { called: args };
|
|
||||||
});
|
|
||||||
handler.on('service', 'function', (args) => {
|
|
||||||
return 'overridden';
|
|
||||||
});
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res = handler.execute({
|
|
||||||
...req(),
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'function',
|
|
||||||
});
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res).toMatchObject({
|
|
||||||
retCode: ResultCodes.success,
|
|
||||||
result: 'overridden',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Middleware combination tests', () => {
|
|
||||||
it('Should work with NON overlapping function registration', () => {
|
|
||||||
// arrange
|
|
||||||
const base = new CallServiceHandler();
|
|
||||||
base.on('service', 'function1', (args) => {
|
|
||||||
return 'called function1';
|
|
||||||
});
|
|
||||||
const another = new CallServiceHandler();
|
|
||||||
base.on('service', 'function2', (args) => {
|
|
||||||
return 'called function2';
|
|
||||||
});
|
|
||||||
|
|
||||||
base.combineWith(another);
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res1 = base.execute({
|
|
||||||
...req(),
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'function1',
|
|
||||||
});
|
|
||||||
const res2 = base.execute({
|
|
||||||
...req(),
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'function2',
|
|
||||||
});
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res1).toMatchObject({
|
|
||||||
retCode: ResultCodes.success,
|
|
||||||
result: 'called function1',
|
|
||||||
});
|
|
||||||
expect(res2).toMatchObject({
|
|
||||||
retCode: ResultCodes.success,
|
|
||||||
result: 'called function2',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should work with overlapping function registration', () => {
|
|
||||||
// arrange
|
|
||||||
const base = new CallServiceHandler();
|
|
||||||
base.on('service', 'function', (args) => {
|
|
||||||
return { called: args };
|
|
||||||
});
|
|
||||||
const another = new CallServiceHandler();
|
|
||||||
another.on('service', 'function', (args) => {
|
|
||||||
return 'overridden';
|
|
||||||
});
|
|
||||||
|
|
||||||
base.combineWith(another);
|
|
||||||
|
|
||||||
// act
|
|
||||||
const res = base.execute({
|
|
||||||
...req(),
|
|
||||||
serviceId: 'service',
|
|
||||||
fnName: 'function',
|
|
||||||
});
|
|
||||||
|
|
||||||
// assert
|
|
||||||
expect(res).toMatchObject({
|
|
||||||
retCode: ResultCodes.success,
|
|
||||||
result: 'overridden',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
22
src/index.ts
22
src/index.ts
@ -21,6 +21,7 @@ export { PeerStatus } from './internal/FluencePeer';
|
|||||||
export { KeyPair } from './internal/KeyPair';
|
export { KeyPair } from './internal/KeyPair';
|
||||||
export { FluencePeer, AvmLoglevel, PeerConfig } from './internal/FluencePeer';
|
export { FluencePeer, AvmLoglevel, PeerConfig } from './internal/FluencePeer';
|
||||||
export { PeerIdB58, CallParams } from './internal/commonTypes';
|
export { PeerIdB58, CallParams } from './internal/commonTypes';
|
||||||
|
export { loadWasmFromFileSystem, loadWasmFromNpmPackage, loadWasmFromServer } from '@fluencelabs/marine-js';
|
||||||
|
|
||||||
export const setLogLevel = (level: LogLevelDesc) => {
|
export const setLogLevel = (level: LogLevelDesc) => {
|
||||||
log.setLevel(level);
|
log.setLevel(level);
|
||||||
@ -66,4 +67,25 @@ export const Fluence = {
|
|||||||
getPeer: (): FluencePeer => {
|
getPeer: (): FluencePeer => {
|
||||||
return defaultPeer;
|
return defaultPeer;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers marine service within the default Fluence peer from wasm file.
|
||||||
|
* Following helper functions can be used to load wasm files:
|
||||||
|
* * loadWasmFromFileSystem
|
||||||
|
* * loadWasmFromNpmPackage
|
||||||
|
* * loadWasmFromServer
|
||||||
|
* @param wasm - buffer with the wasm file for service
|
||||||
|
* @param serviceId - the service id by which the service can be accessed in aqua
|
||||||
|
*/
|
||||||
|
registerMarineService: (wasm: SharedArrayBuffer | Buffer, serviceId: string): Promise<void> => {
|
||||||
|
return defaultPeer.registerMarineService(wasm, serviceId);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified marine service from the default Fluence peer
|
||||||
|
* @param serviceId - the service id to remove
|
||||||
|
*/
|
||||||
|
removeMarineService: (serviceId: string): void => {
|
||||||
|
defaultPeer.removeMarineService(serviceId);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 Fluence Labs Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
import { isBrowser } from 'browser-or-node';
|
import { isBrowser } from 'browser-or-node';
|
||||||
import { Buffer as BufferPolyfill } from 'buffer';
|
import { Buffer as BufferPolyfill } from 'buffer';
|
||||||
|
|
||||||
|
@ -24,11 +24,13 @@ import { throwIfNotSupported, dataToString, jsonify } from './utils';
|
|||||||
import { concatMap, filter, pipe, Subject, tap } from 'rxjs';
|
import { concatMap, filter, pipe, Subject, tap } from 'rxjs';
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import { builtInServices } from './builtins/common';
|
import { builtInServices } from './builtins/common';
|
||||||
import { AvmRunner, InterpreterResult, LogLevel } from '@fluencelabs/avm-runner-interface';
|
|
||||||
import { AvmRunnerBackground } from '@fluencelabs/avm-runner-background';
|
|
||||||
import { defaultSigGuard, Sig } from './builtins/Sig';
|
import { defaultSigGuard, Sig } from './builtins/Sig';
|
||||||
import { registerSig } from './_aqua/services';
|
import { registerSig } from './_aqua/services';
|
||||||
import Buffer from './Buffer';
|
import Buffer from './Buffer';
|
||||||
|
import { FluenceAppService, loadDefaults, loadWasmFromFileSystem, loadWasmFromServer } from '@fluencelabs/marine-js';
|
||||||
|
import { AVM, AvmRunner } from './avm';
|
||||||
|
import { isBrowser, isNode } from 'browser-or-node';
|
||||||
|
import { InterpreterResult, LogLevel } from '@fluencelabs/avm';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Node of the Fluence network specified as a pair of node's multiaddr and it's peer id
|
* Node of the Fluence network specified as a pair of node's multiaddr and it's peer id
|
||||||
@ -98,10 +100,34 @@ export interface PeerConfig {
|
|||||||
defaultTtlMs?: number;
|
defaultTtlMs?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugable AVM runner implementation. If not specified AvmBackgroundRunner will be used
|
* @deprecated. AVM run through marine-js infrastructure.
|
||||||
|
* @see marineJS option to configure AVM
|
||||||
*/
|
*/
|
||||||
avmRunner?: AvmRunner;
|
avmRunner?: AvmRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This option allows to specify the location of various dependencies needed for marine-js.
|
||||||
|
* Each key specifies the location of the corresponding dependency.
|
||||||
|
* If Fluence peer is started inside browser the location is treated as the path to the file relative to origin.
|
||||||
|
* IF Fluence peer is started in nodejs the location is treated as the full path to file on the file system.
|
||||||
|
*/
|
||||||
|
marineJS?: {
|
||||||
|
/**
|
||||||
|
* Configures path to the marine-js worker script.
|
||||||
|
*/
|
||||||
|
workerScriptPath: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the path to marine-js control wasm module
|
||||||
|
*/
|
||||||
|
marineWasmPath: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the path to AVM wasm module
|
||||||
|
*/
|
||||||
|
avmWasmPath: string;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables\disabled various debugging features
|
* Enables\disabled various debugging features
|
||||||
*/
|
*/
|
||||||
@ -199,7 +225,13 @@ export class FluencePeer {
|
|||||||
? config?.defaultTtlMs
|
? config?.defaultTtlMs
|
||||||
: DEFAULT_TTL;
|
: DEFAULT_TTL;
|
||||||
|
|
||||||
this._avmRunner = config?.avmRunner || new AvmRunnerBackground();
|
this._fluenceAppService = new FluenceAppService(config?.marineJS?.workerScriptPath);
|
||||||
|
const marineDeps = config?.marineJS
|
||||||
|
? await loadMarineAndAvm(config.marineJS.marineWasmPath, config.marineJS.avmWasmPath)
|
||||||
|
: await loadDefaults();
|
||||||
|
await this._fluenceAppService.init(marineDeps.marine);
|
||||||
|
await this._fluenceAppService.createService(marineDeps.avm, 'avm');
|
||||||
|
this._avmRunner = config?.avmRunner || new AVM(this._fluenceAppService);
|
||||||
await this._avmRunner.init(config?.avmLogLevel || 'off');
|
await this._avmRunner.init(config?.avmLogLevel || 'off');
|
||||||
|
|
||||||
if (config?.connectTo) {
|
if (config?.connectTo) {
|
||||||
@ -245,6 +277,32 @@ export class FluencePeer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers marine service within the Fluence peer from wasm file.
|
||||||
|
* Following helper functions can be used to load wasm files:
|
||||||
|
* * loadWasmFromFileSystem
|
||||||
|
* * loadWasmFromNpmPackage
|
||||||
|
* * loadWasmFromServer
|
||||||
|
* @param wasm - buffer with the wasm file for service
|
||||||
|
* @param serviceId - the service id by which the service can be accessed in aqua
|
||||||
|
*/
|
||||||
|
async registerMarineService(wasm: SharedArrayBuffer | Buffer, serviceId: string): Promise<void> {
|
||||||
|
if (this._containsService(serviceId)) {
|
||||||
|
throw new Error(`Service with '${serviceId}' id already exists`);
|
||||||
|
}
|
||||||
|
|
||||||
|
await this._fluenceAppService.createService(wasm, serviceId);
|
||||||
|
this._marineServices.add(serviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified marine service from the Fluence peer
|
||||||
|
* @param serviceId - the service id to remove
|
||||||
|
*/
|
||||||
|
removeMarineService(serviceId: string): void {
|
||||||
|
this._marineServices.delete(serviceId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Un-initializes the peer: stops all the underlying workflows, stops the Aqua VM
|
* Un-initializes the peer: stops all the underlying workflows, stops the Aqua VM
|
||||||
* and disconnects from the Fluence network
|
* and disconnects from the Fluence network
|
||||||
@ -255,10 +313,13 @@ export class FluencePeer {
|
|||||||
this._stopParticleProcessing();
|
this._stopParticleProcessing();
|
||||||
await this._disconnect();
|
await this._disconnect();
|
||||||
await this._avmRunner?.terminate();
|
await this._avmRunner?.terminate();
|
||||||
|
await this._fluenceAppService?.terminate();
|
||||||
this._avmRunner = undefined;
|
this._avmRunner = undefined;
|
||||||
|
this._fluenceAppService = undefined;
|
||||||
|
|
||||||
this._particleSpecificHandlers.clear();
|
this._particleSpecificHandlers.clear();
|
||||||
this._commonHandlers.clear();
|
this._commonHandlers.clear();
|
||||||
|
this._marineServices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// internal api
|
// internal api
|
||||||
@ -357,6 +418,7 @@ export class FluencePeer {
|
|||||||
|
|
||||||
// Call service handler
|
// Call service handler
|
||||||
|
|
||||||
|
private _marineServices = new Set<string>();
|
||||||
private _particleSpecificHandlers = new Map<string, Map<string, GenericCallServiceHandler>>();
|
private _particleSpecificHandlers = new Map<string, Map<string, GenericCallServiceHandler>>();
|
||||||
private _commonHandlers = new Map<string, GenericCallServiceHandler>();
|
private _commonHandlers = new Map<string, GenericCallServiceHandler>();
|
||||||
|
|
||||||
@ -364,6 +426,10 @@ export class FluencePeer {
|
|||||||
sig: Sig;
|
sig: Sig;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private _containsService(serviceId: string): boolean {
|
||||||
|
return this._marineServices.has(serviceId) || this._commonHandlers.has(serviceId);
|
||||||
|
}
|
||||||
|
|
||||||
// Internal peer state
|
// Internal peer state
|
||||||
|
|
||||||
private _printParticleId: boolean = false;
|
private _printParticleId: boolean = false;
|
||||||
@ -371,7 +437,12 @@ export class FluencePeer {
|
|||||||
private _relayPeerId: PeerIdB58 | null = null;
|
private _relayPeerId: PeerIdB58 | null = null;
|
||||||
private _keyPair: KeyPair;
|
private _keyPair: KeyPair;
|
||||||
private _connection: FluenceConnection;
|
private _connection: FluenceConnection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated. AVM run through marine-js infrastructure. This field is needed for backward compatibility with the previous API
|
||||||
|
*/
|
||||||
private _avmRunner: AvmRunner;
|
private _avmRunner: AvmRunner;
|
||||||
|
private _fluenceAppService: FluenceAppService;
|
||||||
private _timeouts: Array<NodeJS.Timeout> = [];
|
private _timeouts: Array<NodeJS.Timeout> = [];
|
||||||
private _particleQueues = new Map<string, Subject<ParticleQueueItem>>();
|
private _particleQueues = new Map<string, Subject<ParticleQueueItem>>();
|
||||||
|
|
||||||
@ -534,6 +605,32 @@ export class FluencePeer {
|
|||||||
log.debug('executing call service handler', jsonify(req));
|
log.debug('executing call service handler', jsonify(req));
|
||||||
const particleId = req.particleContext.particleId;
|
const particleId = req.particleContext.particleId;
|
||||||
|
|
||||||
|
if (this._marineServices.has(req.serviceId)) {
|
||||||
|
const args = JSON.stringify(req.args);
|
||||||
|
const rawResult = await this._fluenceAppService.callService(req.serviceId, req.fnName, args, undefined);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = JSON.parse(rawResult);
|
||||||
|
if (typeof result.error === 'string' && result.error.length > 0) {
|
||||||
|
return {
|
||||||
|
retCode: ResultCodes.error,
|
||||||
|
result: result.error,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result.result) {
|
||||||
|
throw 'Call to marine-js returned no error and empty result. Original request: ' + jsonify(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
retCode: ResultCodes.success,
|
||||||
|
result: result.result,
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
throw 'Call to marine-js. Result parsing error: ' + e + ', original text: ' + rawResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const key = serviceFnKey(req.serviceId, req.fnName);
|
const key = serviceFnKey(req.serviceId, req.fnName);
|
||||||
const psh = this._particleSpecificHandlers.get(particleId);
|
const psh = this._particleSpecificHandlers.get(particleId);
|
||||||
let handler: GenericCallServiceHandler;
|
let handler: GenericCallServiceHandler;
|
||||||
@ -637,3 +734,35 @@ function filterExpiredParticles(onParticleExpiration: (item: ParticleQueueItem)
|
|||||||
filter((x: ParticleQueueItem) => !x.particle.hasExpired()),
|
filter((x: ParticleQueueItem) => !x.particle.hasExpired()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadMarineAndAvm(
|
||||||
|
marinePath: string,
|
||||||
|
avmPath: string,
|
||||||
|
): Promise<{
|
||||||
|
marine: SharedArrayBuffer | Buffer;
|
||||||
|
avm: SharedArrayBuffer | Buffer;
|
||||||
|
}> {
|
||||||
|
let promises: [Promise<SharedArrayBuffer | Buffer>, Promise<SharedArrayBuffer | Buffer>];
|
||||||
|
// check if we are running inside the browser and instantiate worker with the corresponding script
|
||||||
|
if (isBrowser) {
|
||||||
|
promises = [
|
||||||
|
// force new line
|
||||||
|
loadWasmFromServer(marinePath),
|
||||||
|
loadWasmFromServer(avmPath),
|
||||||
|
];
|
||||||
|
} else if (isNode) {
|
||||||
|
promises = [
|
||||||
|
// force new line
|
||||||
|
loadWasmFromFileSystem(marinePath),
|
||||||
|
loadWasmFromFileSystem(avmPath),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
throw new Error('Unknown environment');
|
||||||
|
}
|
||||||
|
|
||||||
|
const [marine, avm] = await Promise.all(promises);
|
||||||
|
return {
|
||||||
|
marine,
|
||||||
|
avm,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
|
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { fromByteArray, toByteArray } from 'base64-js';
|
import { fromByteArray, toByteArray } from 'base64-js';
|
||||||
import { CallResultsArray, LogLevel } from '@fluencelabs/avm-runner-interface';
|
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import { ParticleContext } from './commonTypes';
|
import { ParticleContext } from './commonTypes';
|
||||||
import { dataToString, jsonify } from './utils';
|
import { dataToString, jsonify } from './utils';
|
||||||
import Buffer from './Buffer';
|
import Buffer from './Buffer';
|
||||||
|
import { CallResultsArray, LogLevel } from '@fluencelabs/avm';
|
||||||
|
|
||||||
export class Particle {
|
export class Particle {
|
||||||
id: string;
|
id: string;
|
||||||
|
69
src/internal/avm.ts
Normal file
69
src/internal/avm.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 Fluence Labs Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { callAvm, CallResultsArray, InterpreterResult, LogLevel } from '@fluencelabs/avm';
|
||||||
|
import { FluenceAppService } from '@fluencelabs/marine-js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated. AVM run through marine-js infrastructure. This type is needed for backward compatibility with the previous API
|
||||||
|
*/
|
||||||
|
export type AvmRunner = {
|
||||||
|
init: (logLevel: LogLevel) => Promise<void>;
|
||||||
|
terminate: () => Promise<void>;
|
||||||
|
run: (
|
||||||
|
air: string,
|
||||||
|
prevData: Uint8Array,
|
||||||
|
data: Uint8Array,
|
||||||
|
params: {
|
||||||
|
initPeerId: string;
|
||||||
|
currentPeerId: string;
|
||||||
|
},
|
||||||
|
callResults: CallResultsArray,
|
||||||
|
) => Promise<InterpreterResult>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated. AVM run through marine-js infrastructure. This type is needed for backward compatibility with the previous API
|
||||||
|
*/
|
||||||
|
export class AVM implements AvmRunner {
|
||||||
|
private _fluenceAppService: FluenceAppService;
|
||||||
|
|
||||||
|
constructor(fluenceAppService: FluenceAppService) {
|
||||||
|
this._fluenceAppService = fluenceAppService;
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(logLevel: LogLevel): Promise<void> {}
|
||||||
|
|
||||||
|
async terminate(): Promise<void> {}
|
||||||
|
|
||||||
|
async run(
|
||||||
|
air: string,
|
||||||
|
prevData: Uint8Array,
|
||||||
|
data: Uint8Array,
|
||||||
|
params: { initPeerId: string; currentPeerId: string },
|
||||||
|
callResults: CallResultsArray,
|
||||||
|
): Promise<InterpreterResult> {
|
||||||
|
return callAvm(
|
||||||
|
(args) => this._fluenceAppService.callService('avm', 'invoke', args, undefined),
|
||||||
|
params.initPeerId,
|
||||||
|
params.currentPeerId,
|
||||||
|
air,
|
||||||
|
prevData,
|
||||||
|
data,
|
||||||
|
callResults,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import { SecurityTetraplet } from '@fluencelabs/avm-runner-interface';
|
import { SecurityTetraplet } from '@fluencelabs/avm';
|
||||||
import { CallParams, PeerIdB58 } from '../commonTypes';
|
import { CallParams, PeerIdB58 } from '../commonTypes';
|
||||||
import { KeyPair } from '../KeyPair';
|
import { KeyPair } from '../KeyPair';
|
||||||
import { SigDef } from '../_aqua/services';
|
import { SigDef } from '../_aqua/services';
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CallServiceResult } from '@fluencelabs/avm-runner-interface';
|
|
||||||
import { encode, decode } from 'bs58';
|
import { encode, decode } from 'bs58';
|
||||||
import { sha256 } from 'multiformats/hashes/sha2';
|
import { sha256 } from 'multiformats/hashes/sha2';
|
||||||
import { ResultCodes } from '../commonTypes';
|
import { ResultCodes } from '../commonTypes';
|
||||||
import { jsonify } from '../utils';
|
import { jsonify } from '../utils';
|
||||||
import Buffer from '../Buffer';
|
import Buffer from '../Buffer';
|
||||||
|
import { CallServiceResult } from '@fluencelabs/avm';
|
||||||
|
|
||||||
const success = (result: any): CallServiceResult => {
|
const success = (result: any): CallServiceResult => {
|
||||||
return {
|
return {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SecurityTetraplet } from '@fluencelabs/avm-runner-interface';
|
import { SecurityTetraplet } from '@fluencelabs/avm';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Peer ID's id as a base58 string (multihash/CIDv0).
|
* Peer ID's id as a base58 string (multihash/CIDv0).
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2021 Fluence Labs Limited
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { CallServiceData, CallServiceResult, CallServiceResultType, ResultCodes } from '../commonTypes';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This class exists to glue legacy RequestFlowBuilder api with restructured async FluencePeer.
|
|
||||||
* v2 version of compiler support should be used instead
|
|
||||||
*/
|
|
||||||
export const callLegacyCallServiceHandler = (
|
|
||||||
req: CallServiceData,
|
|
||||||
commonHandler: CallServiceHandler,
|
|
||||||
particleSpecificHandler?: CallServiceHandler,
|
|
||||||
): CallServiceResult => {
|
|
||||||
// trying particle-specific handler
|
|
||||||
if (particleSpecificHandler !== undefined) {
|
|
||||||
var res = particleSpecificHandler.execute(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res?.result === undefined) {
|
|
||||||
// if it didn't return any result trying to run the common handler
|
|
||||||
res = commonHandler.execute(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res.retCode === undefined) {
|
|
||||||
res = {
|
|
||||||
retCode: ResultCodes.error,
|
|
||||||
result: `The handler did not set any result. Make sure you are calling the right peer and the handler has been registered. Original request data was: serviceId='${req.serviceId}' fnName='${req.fnName}' args='${req.args}'`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res.result === undefined) {
|
|
||||||
res.result = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Type for the middleware used in CallServiceHandler middleware chain.
|
|
||||||
* In a nutshell middleware is a function of request, response and function to trigger the next middleware in chain.
|
|
||||||
* Each middleware is free to write additional properties to either request or response object.
|
|
||||||
* When the chain finishes the response is passed back to AVM
|
|
||||||
* @param { CallServiceData } req - information about the air `call` instruction
|
|
||||||
* @param { CallServiceResult } resp - response to be passed to AVM
|
|
||||||
* @param { Function } next - function which invokes next middleware in chain
|
|
||||||
*/
|
|
||||||
export type Middleware = (req: CallServiceData, resp: CallServiceResult, next: Function) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
type CallParams = any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Convenience middleware factory. Registers a handler for a pair of 'serviceId/fnName'.
|
|
||||||
* The return value of the handler is passed back to AVM
|
|
||||||
* @param { string } serviceId - The identifier of service which would be used to make calls from AVM
|
|
||||||
* @param { string } fnName - The identifier of function which would be used to make calls from AVM
|
|
||||||
* @param { (args: any[], tetraplets: SecurityTetraplet[][]) => object } handler - The handler which should handle the call. The result is any object passed back to AVM
|
|
||||||
*/
|
|
||||||
export const fnHandler = (
|
|
||||||
serviceId: string,
|
|
||||||
fnName: string,
|
|
||||||
handler: (args: any[], callParams: CallParams) => CallServiceResultType,
|
|
||||||
) => {
|
|
||||||
return (req: CallServiceData, resp: CallServiceResult, next: Function): void => {
|
|
||||||
if (req.fnName === fnName && req.serviceId === serviceId) {
|
|
||||||
const res = handler(req.args, req.particleContext);
|
|
||||||
resp.retCode = ResultCodes.success;
|
|
||||||
resp.result = res;
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Convenience middleware factory. Registers a handler for a pair of 'serviceId/fnName'.
|
|
||||||
* Similar to @see { @link fnHandler } but instead returns and empty object immediately runs the handler asynchronously
|
|
||||||
* @param { string } serviceId - The identifier of service which would be used to make calls from AVM
|
|
||||||
* @param { string } fnName - The identifier of function which would be used to make calls from AVM
|
|
||||||
* @param { (args: any[], tetraplets: SecurityTetraplet[][]) => void } handler - The handler which should handle the call.
|
|
||||||
*/
|
|
||||||
export const fnAsEventHandler = (
|
|
||||||
serviceId: string, // force format
|
|
||||||
fnName: string,
|
|
||||||
handler: (args: any[], callParams: CallParams) => void,
|
|
||||||
) => {
|
|
||||||
return (req: CallServiceData, resp: CallServiceResult, next: Function): void => {
|
|
||||||
if (req.fnName === fnName && req.serviceId === serviceId) {
|
|
||||||
setTimeout(() => {
|
|
||||||
handler(req.args, req.particleContext);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
resp.retCode = ResultCodes.success;
|
|
||||||
resp.result = {};
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
type CallServiceFunction = (req: CallServiceData, resp: CallServiceResult) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Class defines the handling of a `call` air instruction executed by AVM on the local peer.
|
|
||||||
* All the execution process is defined by the chain of middlewares - architecture popular among backend web frameworks.
|
|
||||||
* Each middleware has the form of `(req: Call, resp: CallServiceResult, next: Function) => void;`
|
|
||||||
* A handler starts with an empty middleware chain and does nothing.
|
|
||||||
* To execute the handler use @see { @link execute } function
|
|
||||||
*/
|
|
||||||
export class CallServiceHandler {
|
|
||||||
private middlewares: Middleware[] = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Appends middleware to the chain of middlewares
|
|
||||||
* @param { Middleware } middleware
|
|
||||||
*/
|
|
||||||
use(middleware: Middleware): CallServiceHandler {
|
|
||||||
this.middlewares.push(middleware);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the middleware from the chain of middlewares
|
|
||||||
* @param { Middleware } middleware
|
|
||||||
*/
|
|
||||||
unUse(middleware: Middleware): CallServiceHandler {
|
|
||||||
const index = this.middlewares.indexOf(middleware);
|
|
||||||
if (index !== -1) {
|
|
||||||
this.middlewares.splice(index, 1);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Combine handler with another one. Combination is done by copying middleware chain from the argument's handler into current one.
|
|
||||||
* Please note, that current handler's middlewares take precedence over the ones from handler to be combined with
|
|
||||||
* @param { CallServiceHandler } other - CallServiceHandler to be combined with
|
|
||||||
*/
|
|
||||||
combineWith(other: CallServiceHandler): CallServiceHandler {
|
|
||||||
this.middlewares = [...this.middlewares, ...other.middlewares];
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience method for registering @see { @link fnHandler } middleware
|
|
||||||
*/
|
|
||||||
on(
|
|
||||||
serviceId: string, // force format
|
|
||||||
fnName: string,
|
|
||||||
handler: (args: any[], callParams: CallParams) => CallServiceResultType,
|
|
||||||
): Function {
|
|
||||||
const mw = fnHandler(serviceId, fnName, handler);
|
|
||||||
this.use(mw);
|
|
||||||
return () => {
|
|
||||||
this.unUse(mw);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience method for registering @see { @link fnAsEventHandler } middleware
|
|
||||||
*/
|
|
||||||
onEvent(
|
|
||||||
serviceId: string, // force format
|
|
||||||
fnName: string,
|
|
||||||
handler: (args: any[], callParams: CallParams) => void,
|
|
||||||
): Function {
|
|
||||||
const mw = fnAsEventHandler(serviceId, fnName, handler);
|
|
||||||
this.use(mw);
|
|
||||||
return () => {
|
|
||||||
this.unUse(mw);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collapses middleware chain into a single function.
|
|
||||||
*/
|
|
||||||
buildFunction(): CallServiceFunction {
|
|
||||||
const result = this.middlewares.reduceRight<CallServiceFunction>(
|
|
||||||
(agg, cur) => {
|
|
||||||
return (req, resp) => {
|
|
||||||
cur(req, resp, () => agg(req, resp));
|
|
||||||
};
|
|
||||||
},
|
|
||||||
(req, res) => {},
|
|
||||||
);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes the handler with the specified Call request. Return the result response
|
|
||||||
*/
|
|
||||||
execute(req: CallServiceData): CallServiceResult {
|
|
||||||
const res: CallServiceResult = {
|
|
||||||
retCode: undefined,
|
|
||||||
result: undefined,
|
|
||||||
};
|
|
||||||
this.buildFunction()(req, res);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SecurityTetraplet } from '@fluencelabs/avm-runner-interface';
|
import { SecurityTetraplet } from '@fluencelabs/avm';
|
||||||
import { match } from 'ts-pattern';
|
import { match } from 'ts-pattern';
|
||||||
import { CallParams, Fluence, FluencePeer } from '../../index';
|
import { CallParams, Fluence, FluencePeer } from '../../index';
|
||||||
import { CallServiceData, GenericCallServiceHandler, CallServiceResult, ResultCodes } from '../commonTypes';
|
import { CallServiceData, GenericCallServiceHandler, CallServiceResult, ResultCodes } from '../commonTypes';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { SecurityTetraplet } from '@fluencelabs/avm-runner-interface';
|
import { SecurityTetraplet } from '@fluencelabs/avm';
|
||||||
import { Particle } from 'src/internal/Particle';
|
import { Particle } from 'src/internal/Particle';
|
||||||
import { match } from 'ts-pattern';
|
import { match } from 'ts-pattern';
|
||||||
import {
|
import {
|
||||||
|
@ -151,7 +151,11 @@ export function throwIfNotSupported() {
|
|||||||
const version = platform.version.split('.').map(Number);
|
const version = platform.version.split('.').map(Number);
|
||||||
const major = version[0];
|
const major = version[0];
|
||||||
if (major < 16) {
|
if (major < 16) {
|
||||||
throw new Error('FluenceJS requires node.js version >= "16.x"; Detected ' + platform.description + ' Please update node.js to version 16 or higher.\nYou can use https://nvm.sh utility to update node.js version: "nvm install 17 && nvm use 17 && nvm alias default 17"');
|
throw new Error(
|
||||||
|
'FluenceJS requires node.js version >= "16.x"; Detected ' +
|
||||||
|
platform.description +
|
||||||
|
' Please update node.js to version 16 or higher.\nYou can use https://nvm.sh utility to update node.js version: "nvm install 17 && nvm use 17 && nvm alias default 17"',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#! /usr/bin/env node
|
|
||||||
|
|
||||||
require('@fluencelabs/avm/dist/copyAvm');
|
|
||||||
require('@fluencelabs/avm-runner-background/dist/copyRunnerScript');
|
|
||||||
require('@fluencelabs/marine-js/dist/copyMarine.js');
|
|
46
src/tools/copyMarine.ts
Normal file
46
src/tools/copyMarine.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#! /usr/bin/env node
|
||||||
|
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
const firstArgument = process.argv[2];
|
||||||
|
|
||||||
|
if (!firstArgument) {
|
||||||
|
console.log(`Expected exactly 1 argument, got 0. Usage: ${path.basename(process.argv[1])} <destination directory>`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
let destPath = firstArgument;
|
||||||
|
if (!path.isAbsolute(destPath)) {
|
||||||
|
destPath = path.join(process.cwd(), destPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyFile(packageName: string, fileName: string) {
|
||||||
|
const modulePath = require.resolve(packageName);
|
||||||
|
const source = path.join(path.dirname(modulePath), fileName);
|
||||||
|
const dest = path.join(destPath, fileName);
|
||||||
|
|
||||||
|
console.log(`copying ${fileName}`);
|
||||||
|
console.log('from: ', source);
|
||||||
|
console.log('to: ', dest);
|
||||||
|
await fs.promises.copyFile(source, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
console.log('ensure directory exists: ', destPath);
|
||||||
|
await fs.promises.mkdir(destPath, { recursive: true });
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
copyFile('@fluencelabs/marine-js', 'marine-js.web.js'),
|
||||||
|
copyFile('@fluencelabs/marine-js', 'marine-js.wasm'),
|
||||||
|
copyFile('@fluencelabs/avm', 'avm.wasm'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
.then(() => {
|
||||||
|
console.log('done!');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('Something went wrong!', err);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user