Marine JS: add configuration for setting logging level in marine services (#151)

This commit is contained in:
Pavel 2022-04-24 10:49:57 +03:00 committed by GitHub
parent 6f16323c9c
commit c4122f63b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 297 additions and 61 deletions

View File

@ -0,0 +1,16 @@
data GreetingRecord:
str: string
num: i32
service GreetingRecord:
greeting_record() -> GreetingRecord
log_debug()
log_error()
log_info()
log_trace()
log_warn()
void_fn()
func call_info(srvId: string):
GreetingRecord srvId
GreetingRecord.log_info()

File diff suppressed because one or more lines are too long

View File

@ -124,7 +124,7 @@
<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#L176">src/internal/FluencePeer.ts:176</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L182">src/internal/FluencePeer.ts:182</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -149,7 +149,7 @@
<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#L330">src/internal/FluencePeer.ts:330</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L341">src/internal/FluencePeer.ts:341</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -298,7 +298,7 @@
<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#L274">src/internal/FluencePeer.ts:274</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L284">src/internal/FluencePeer.ts:284</a></li>
</ul>
</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>
@ -320,7 +320,7 @@
<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#L194">src/internal/FluencePeer.ts:194</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L200">src/internal/FluencePeer.ts:200</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -342,7 +342,7 @@
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L299">src/internal/FluencePeer.ts:299</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -385,7 +385,7 @@
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L313">src/internal/FluencePeer.ts:313</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -416,7 +416,7 @@
<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#L210">src/internal/FluencePeer.ts:210</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L216">src/internal/FluencePeer.ts:216</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -448,7 +448,7 @@
<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#L310">src/internal/FluencePeer.ts:310</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L321">src/internal/FluencePeer.ts:321</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -471,7 +471,7 @@
<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#L183">src/internal/FluencePeer.ts:183</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L189">src/internal/FluencePeer.ts:189</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View File

@ -115,7 +115,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/KeyPair.ts#L26">src/internal/KeyPair.ts:26</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/KeyPair.ts#L24">src/internal/KeyPair.ts:24</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -159,7 +159,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/KeyPair.ts#L62">src/internal/KeyPair.ts:62</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
@ -182,7 +182,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/KeyPair.ts#L51">src/internal/KeyPair.ts:51</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
@ -199,7 +199,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/KeyPair.ts#L58">src/internal/KeyPair.ts:58</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Uint8Array</span></h4>
@ -217,7 +217,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/KeyPair.ts#L66">src/internal/KeyPair.ts:66</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
@ -243,7 +243,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/KeyPair.ts#L35">src/internal/KeyPair.ts:35</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -274,7 +274,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/KeyPair.ts#L46">src/internal/KeyPair.ts:46</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View File

@ -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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L37">src/internal/commonTypes.ts:37</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L32">src/internal/commonTypes.ts:32</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L52">src/internal/commonTypes.ts:52</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L57">src/internal/commonTypes.ts:57</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L42">src/internal/commonTypes.ts:42</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L47">src/internal/commonTypes.ts:47</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View File

@ -110,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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L75">src/internal/FluencePeer.ts:75</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -126,13 +126,18 @@
<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">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L69">src/internal/FluencePeer.ts:69</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Specify log level for Aqua VM running on the peer</p>
</div>
<dl class="tsd-comment-tags">
<dt>deprecated.</dt>
<dd><p>AVM run through marine-js infrastructure.</p>
</dd>
<dt>see</dt>
<dd><p>debug.marineLogLevel option to configure logging level of AVM</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
@ -141,7 +146,7 @@
<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">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L107">src/internal/FluencePeer.ts:107</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -161,7 +166,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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L82">src/internal/FluencePeer.ts:82</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -178,7 +183,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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L63">src/internal/FluencePeer.ts:63</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -197,10 +202,10 @@
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="debug" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> debug</h3>
<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>marineLogLevel<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">LogLevel</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">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L135">src/internal/FluencePeer.ts:135</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -211,6 +216,14 @@
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> marine<wbr>Log<wbr>Level<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">LogLevel</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Log level for marine services. By default logging is turned off.</p>
</div>
</div>
</li>
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> print<wbr>Particle<wbr>Id<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5>
<div class="tsd-comment tsd-typography">
@ -229,7 +242,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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L101">src/internal/FluencePeer.ts:101</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -246,7 +259,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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L94">src/internal/FluencePeer.ts:94</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -261,7 +274,7 @@
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L115">src/internal/FluencePeer.ts:115</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -308,7 +321,7 @@
<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">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L89">src/internal/FluencePeer.ts:89</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View File

@ -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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L161">src/internal/FluencePeer.ts:161</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L156">src/internal/FluencePeer.ts:156</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L166">src/internal/FluencePeer.ts:166</a></li>
</ul>
</aside>
<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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L171">src/internal/FluencePeer.ts:171</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View File

@ -109,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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L47">src/internal/FluencePeer.ts:47</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -125,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>
<aside class="tsd-sources">
<ul>
<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>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L22">src/internal/commonTypes.ts:22</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -143,7 +143,7 @@
<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"> =&gt; </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"> =&gt; </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"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><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"> =&gt; </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"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><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"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> }</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/index.ts#L37">src/index.ts:37</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/index.ts#L37">src/index.ts:37</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -443,7 +443,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/9a26165/src/index.ts#L26">src/index.ts:26</a></li>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/index.ts#L26">src/index.ts:26</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>

14
package-lock.json generated
View File

@ -11,7 +11,7 @@
"dependencies": {
"@chainsafe/libp2p-noise": "^4.1.1",
"@fluencelabs/avm": "0.23.0",
"@fluencelabs/marine-js": "0.2.3",
"@fluencelabs/marine-js": "0.2.5",
"async": "3.2.0",
"browser-or-node": "^2.0.0",
"bs58": "4.0.1",
@ -786,9 +786,9 @@
}
},
"node_modules/@fluencelabs/marine-js": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@fluencelabs/marine-js/-/marine-js-0.2.3.tgz",
"integrity": "sha512-cveky0ATIQGvZ3qSczXhQFBRZEiKgfuporIieqMyrN9PPkRjW3zDPG6LAkbUBS1YDQzeqLnRPTCOxhoVUS4Nsw==",
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@fluencelabs/marine-js/-/marine-js-0.2.5.tgz",
"integrity": "sha512-nGXuXdZd9gJX6dRyZcesnoRhZmSNCJFbHA25TKJ36x8KB+AKt+FCgRBht8M0+DlwBYow5mqOZlebz3XgSpRWVA==",
"dependencies": {
"@wasmer/wasi": "^0.12.0",
"@wasmer/wasmfs": "^0.12.0",
@ -12945,9 +12945,9 @@
"dev": true
},
"@fluencelabs/marine-js": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@fluencelabs/marine-js/-/marine-js-0.2.3.tgz",
"integrity": "sha512-cveky0ATIQGvZ3qSczXhQFBRZEiKgfuporIieqMyrN9PPkRjW3zDPG6LAkbUBS1YDQzeqLnRPTCOxhoVUS4Nsw==",
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@fluencelabs/marine-js/-/marine-js-0.2.5.tgz",
"integrity": "sha512-nGXuXdZd9gJX6dRyZcesnoRhZmSNCJFbHA25TKJ36x8KB+AKt+FCgRBht8M0+DlwBYow5mqOZlebz3XgSpRWVA==",
"requires": {
"@wasmer/wasi": "^0.12.0",
"@wasmer/wasmfs": "^0.12.0",

View File

@ -24,7 +24,7 @@
"dependencies": {
"@chainsafe/libp2p-noise": "^4.1.1",
"@fluencelabs/avm": "0.23.0",
"@fluencelabs/marine-js": "0.2.3",
"@fluencelabs/marine-js": "0.2.5",
"async": "3.2.0",
"browser-or-node": "^2.0.0",
"bs58": "4.0.1",

View File

@ -0,0 +1,167 @@
/**
*
* 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-287
*
*/
import { Fluence, FluencePeer } from '../../index';
import { CallParams, callFunction, registerService } from '../../internal/compilerSupport/v3';
// Services
export interface GreetingRecordDef {
greeting_record: (
callParams: CallParams<null>,
) => { num: number; str: string } | Promise<{ num: number; str: string }>;
log_debug: (callParams: CallParams<null>) => void | Promise<void>;
log_error: (callParams: CallParams<null>) => void | Promise<void>;
log_info: (callParams: CallParams<null>) => void | Promise<void>;
log_trace: (callParams: CallParams<null>) => void | Promise<void>;
log_warn: (callParams: CallParams<null>) => void | Promise<void>;
void_fn: (callParams: CallParams<null>) => void | Promise<void>;
}
export function registerGreetingRecord(serviceId: string, service: GreetingRecordDef): void;
export function registerGreetingRecord(peer: FluencePeer, serviceId: string, service: GreetingRecordDef): void;
export function registerGreetingRecord(...args: any) {
registerService(args, {
functions: {
tag: 'labeledProduct',
fields: {
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',
},
},
},
],
},
},
log_debug: {
tag: 'arrow',
domain: {
tag: 'nil',
},
codomain: {
tag: 'nil',
},
},
log_error: {
tag: 'arrow',
domain: {
tag: 'nil',
},
codomain: {
tag: 'nil',
},
},
log_info: {
tag: 'arrow',
domain: {
tag: 'nil',
},
codomain: {
tag: 'nil',
},
},
log_trace: {
tag: 'arrow',
domain: {
tag: 'nil',
},
codomain: {
tag: 'nil',
},
},
log_warn: {
tag: 'arrow',
domain: {
tag: 'nil',
},
codomain: {
tag: 'nil',
},
},
void_fn: {
tag: 'arrow',
domain: {
tag: 'nil',
},
codomain: {
tag: 'nil',
},
},
},
},
});
}
// Functions
export function call_info(srvId: string, config?: { ttl?: number }): Promise<void>;
export function call_info(peer: FluencePeer, srvId: string, config?: { ttl?: number }): Promise<void>;
export function call_info(...args: any) {
let script = `
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "srvId") [] srvId)
)
(call %init_peer_id% (srvId "log_info") [])
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
`;
return callFunction(
args,
{
functionName: 'call_info',
arrow: {
tag: 'arrow',
domain: {
tag: 'labeledProduct',
fields: {
srvId: {
tag: 'scalar',
name: 'string',
},
},
},
codomain: {
tag: 'nil',
},
},
names: {
relay: '-relay-',
getDataSrv: 'getDataSrv',
callbackSrv: 'callbackSrv',
responseSrv: 'callbackSrv',
responseFnName: 'response',
errorHandlingSrv: 'errorHandlingSrv',
errorFnName: 'error',
},
},
script,
);
}

Binary file not shown.

View File

@ -1,6 +1,7 @@
import { Fluence } from '../../index';
import { Fluence, FluencePeer } from '../../index';
import fs from 'fs';
import { call } from '../_aqua/marine-js';
import { call_info } from '../_aqua/marine-js-logging';
describe('Marine js tests', () => {
beforeEach(async () => {
@ -13,7 +14,7 @@ describe('Marine js tests', () => {
it('should call marine service correctly', async () => {
// arrange
const wasm = fs.readFileSync(__dirname + '/greeting.wasm');
const wasm = await fs.promises.readFile(__dirname + '/greeting.wasm');
await Fluence.registerMarineService(wasm, 'greeting');
// act
@ -22,4 +23,31 @@ describe('Marine js tests', () => {
// assert
expect(res).toBe('Hi, Hi, Hi, test');
});
// TODO: console printouts are happening inside web-worker\worker threads.
// Find a way to mock functions in background thread
it.skip('logging should work', async () => {
// arrange
const peer = new FluencePeer();
try {
jest.spyOn(global.console, 'info').mockImplementation(() => {});
await peer.start({
debug: {
marineLogLevel: 'debug',
},
});
const wasm = await fs.promises.readFile(__dirname + '/greeting-record.wasm');
await peer.registerMarineService(wasm, 'greeting');
// act
await call_info(peer, 'greeting');
// assert
expect(console.info).toBeCalledTimes(1);
expect(console.info).toHaveBeenNthCalledWith(1, '[marine service "greeting"]: info');
} finally {
await peer.stop();
}
});
});

View File

@ -19,7 +19,7 @@ import { FluencePeer, PeerConfig } from './internal/FluencePeer';
export { PeerStatus } from './internal/FluencePeer';
export { KeyPair } from './internal/KeyPair';
export { FluencePeer, AvmLoglevel, PeerConfig } from './internal/FluencePeer';
export { FluencePeer, MarineLoglevel as AvmLoglevel, PeerConfig } from './internal/FluencePeer';
export { PeerIdB58, CallParams } from './internal/commonTypes';
export { loadWasmFromFileSystem, loadWasmFromNpmPackage, loadWasmFromServer } from '@fluencelabs/marine-js';

View File

@ -44,7 +44,7 @@ type Node = {
* Enum representing the log level used in Aqua VM.
* Possible values: 'info', 'trace', 'debug', 'info', 'warn', 'error', 'off';
*/
export type AvmLoglevel = LogLevel;
export type MarineLoglevel = LogLevel;
const DEFAULT_TTL = 7000;
@ -63,9 +63,10 @@ export interface PeerConfig {
connectTo?: string | Multiaddr | Node;
/**
* Specify log level for Aqua VM running on the peer
* @deprecated. AVM run through marine-js infrastructure.
* @see debug.marineLogLevel option to configure logging level of AVM
*/
avmLogLevel?: AvmLoglevel;
avmLogLevel?: MarineLoglevel;
/**
* Specify the KeyPair to be used to identify the Fluence Peer.
@ -137,6 +138,11 @@ export interface PeerConfig {
* Useful to see what particle id is responsible for aqua function
*/
printParticleId?: boolean;
/**
* Log level for marine services. By default logging is turned off.
*/
marineLogLevel?: LogLevel;
};
}
@ -225,6 +231,10 @@ export class FluencePeer {
? config?.defaultTtlMs
: DEFAULT_TTL;
if (config?.debug?.marineLogLevel) {
this._marineLogLevel = config.debug.marineLogLevel;
}
this._fluenceAppService = new FluenceAppService(config?.marineJS?.workerScriptPath);
const marineDeps = config?.marineJS
? await loadMarineAndAvm(config.marineJS.marineWasmPath, config.marineJS.avmWasmPath)
@ -291,7 +301,8 @@ export class FluencePeer {
throw new Error(`Service with '${serviceId}' id already exists`);
}
await this._fluenceAppService.createService(wasm, serviceId);
const envs = this._marineLogLevel ? { WASM_LOG: this._marineLogLevel } : undefined;
await this._fluenceAppService.createService(wasm, serviceId, undefined, envs);
this._marineServices.add(serviceId);
}
@ -419,6 +430,7 @@ export class FluencePeer {
// Call service handler
private _marineServices = new Set<string>();
private _marineLogLevel?: MarineLoglevel;
private _particleSpecificHandlers = new Map<string, Map<string, GenericCallServiceHandler>>();
private _commonHandlers = new Map<string, GenericCallServiceHandler>();