Skip to content

Commit dead0ba

Browse files
committed
1 parent 43d03cc commit dead0ba

9 files changed

Lines changed: 47 additions & 17 deletions

File tree

doc/dev/classes/FuncWarper.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,9 @@ <h5 id="tresult" tabindex="-1">TResult</h5>
113113
<p>Expected response type returned by the handler.</p>
114114
<h4 id="parameters-1" tabindex="-1">Parameters</h4>
115115
<h5 id="event%3F" tabindex="-1">event?</h5>
116-
<p><code>any</code> = <code>...</code></p>
117-
<p>Runtime event passed to the exported handler.</p>
116+
<p><code>Record</code>&lt;<code>string</code>, <code>unknown</code>&gt; = <code>...</code></p>
118117
<h5 id="context%3F" tabindex="-1">context?</h5>
119-
<p><code>any</code> = <code>...</code></p>
120-
<p>Runtime context passed to the exported handler.</p>
118+
<p><code>Record</code>&lt;<code>string</code>, <code>unknown</code>&gt; = <code>...</code></p>
121119
<h4 id="returns-1" tabindex="-1">Returns</h4>
122120
<p><code>Promise</code>&lt;<code>TResult</code>&gt;</p>
123121
<p>Handler result.</p>

doc/dev/functions/streamToObject.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h1 id="function%3A-streamtoobject()" tabindex="-1">Function: streamToObject()</
6767
<blockquote>
6868
<p><strong>streamToObject</strong>&lt;<code>T</code>&gt;(<code>stream</code>): <code>Promise</code>&lt;<code>T</code>&gt;</p>
6969
</blockquote>
70-
<p>Convert ReadableStream to object.</p>
70+
<p>Parse a JSON value from a byte stream.</p>
7171
<h2 id="type-parameters" tabindex="-1">Type Parameters</h2>
7272
<h3 id="t" tabindex="-1">T</h3>
7373
<p><code>T</code> = <code>any</code></p>
@@ -78,9 +78,11 @@ <h3 id="stream" tabindex="-1">stream</h3>
7878
<p>Readable stream to decode as JSON.</p>
7979
<h2 id="returns" tabindex="-1">Returns</h2>
8080
<p><code>Promise</code>&lt;<code>T</code>&gt;</p>
81-
<p>Parsed JSON object from the stream body.</p>
81+
<p>Parsed JSON value from the stream body.</p>
8282
<h2 id="throws" tabindex="-1">Throws</h2>
8383
<p>If stream is not a ReadableStream instance.</p>
84+
<h2 id="throws-1" tabindex="-1">Throws</h2>
85+
<p>If the stream body is not valid JSON.</p>
8486
<h2 id="example" tabindex="-1">Example</h2>
8587
<pre><code class="hljs language-ts"><span class="hljs-keyword">import</span> { streamToObject } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@faasjs/node-utils&#x27;</span>
8688

doc/dev/functions/streamToText.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h1 id="function%3A-streamtotext()" tabindex="-1">Function: streamToText()</h1>
6767
<blockquote>
6868
<p><strong>streamToText</strong>(<code>stream</code>): <code>Promise</code>&lt;<code>string</code>&gt;</p>
6969
</blockquote>
70-
<p>Convert ReadableStream to text.</p>
70+
<p>Read a byte stream into a UTF-8 string.</p>
7171
<h2 id="parameters" tabindex="-1">Parameters</h2>
7272
<h3 id="stream" tabindex="-1">stream</h3>
7373
<p><code>ReadableStream</code>&lt;<code>Uint8Array</code>&lt;<code>ArrayBufferLike</code>&gt;&gt;</p>

doc/dev/variables/streamToString.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ <h1 id="variable%3A-streamtostring" tabindex="-1">Variable: streamToString</h1>
6767
<blockquote>
6868
<p><code>const</code> <strong>streamToString</strong>: (<code>stream</code>) =&gt; <code>Promise</code>&lt;<code>string</code>&gt; = <code>streamToText</code></p>
6969
</blockquote>
70-
<p>Alias of <a href="/doc/dev/functions/streamToText.html">streamToText</a>.</p>
71-
<p>Convert ReadableStream to text.</p>
70+
<p>Alias of <a href="/doc/dev/functions/streamToText.html">streamToText</a> for string-oriented call sites.</p>
71+
<p>Read a byte stream into a UTF-8 string.</p>
7272
<h2 id="parameters" tabindex="-1">Parameters</h2>
7373
<h3 id="stream" tabindex="-1">stream</h3>
7474
<p><code>ReadableStream</code>&lt;<code>Uint8Array</code>&lt;<code>ArrayBufferLike</code>&gt;&gt;</p>
@@ -90,6 +90,18 @@ <h2 id="example" tabindex="-1">Example</h2>
9090

9191
<span class="hljs-keyword">await</span> <span class="hljs-title function_">streamToText</span>(stream) <span class="hljs-comment">// &#x27;hello&#x27;</span>
9292
</code></pre>
93+
<h2 id="example-1" tabindex="-1">Example</h2>
94+
<pre><code class="hljs language-ts"><span class="hljs-keyword">import</span> { streamToString } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@faasjs/node-utils&#x27;</span>
95+
96+
<span class="hljs-keyword">const</span> stream = <span class="hljs-keyword">new</span> <span class="hljs-title class_">ReadableStream</span>&lt;<span class="hljs-title class_">Uint8Array</span>&gt;({
97+
<span class="hljs-title function_">start</span>(<span class="hljs-params">controller</span>) {
98+
controller.<span class="hljs-title function_">enqueue</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>().<span class="hljs-title function_">encode</span>(<span class="hljs-string">&#x27;hello&#x27;</span>))
99+
controller.<span class="hljs-title function_">close</span>()
100+
},
101+
})
102+
103+
<span class="hljs-keyword">await</span> <span class="hljs-title function_">streamToString</span>(stream) <span class="hljs-comment">// &#x27;hello&#x27;</span>
104+
</code></pre>
93105
</div></div>
94106
</div>
95107

doc/node-utils/classes/Logger.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ <h5 id="level%3F" tabindex="-1">level?</h5>
170170
<h4 id="returns-5" tabindex="-1">Returns</h4>
171171
<p><code>Logger</code></p>
172172
<p>The current logger for chaining.</p>
173+
<h4 id="default" tabindex="-1">Default</h4>
174+
<pre><code class="hljs language-ts"><span class="hljs-string">&#x27;debug&#x27;</span>
175+
</code></pre>
173176
<h3 id="timeend()" tabindex="-1">timeEnd()</h3>
174177
<blockquote>
175178
<p><strong>timeEnd</strong>(<code>key</code>, <code>message</code>, ...<code>args</code>): <code>Logger</code></p>
@@ -210,15 +213,15 @@ <h3 id="colorfyoutput" tabindex="-1">colorfyOutput</h3>
210213
<p><strong>colorfyOutput</strong>: <code>boolean</code> = <code>true</code></p>
211214
</blockquote>
212215
<p>Whether terminal output should use ANSI colors.</p>
213-
<h4 id="default" tabindex="-1">Default</h4>
216+
<h4 id="default-1" tabindex="-1">Default</h4>
214217
<pre><code class="hljs language-ts"><span class="hljs-literal">true</span>
215218
</code></pre>
216219
<h3 id="disabletransport" tabindex="-1">disableTransport</h3>
217220
<blockquote>
218221
<p><strong>disableTransport</strong>: <code>boolean</code> = <code>false</code></p>
219222
</blockquote>
220223
<p>Disable forwarding log messages to the shared transport.</p>
221-
<h4 id="default-1" tabindex="-1">Default</h4>
224+
<h4 id="default-2" tabindex="-1">Default</h4>
222225
<pre><code class="hljs language-ts"><span class="hljs-literal">false</span>
223226
</code></pre>
224227
<h3 id="label%3F-1" tabindex="-1">label?</h3>
@@ -231,23 +234,23 @@ <h3 id="level" tabindex="-1">level</h3>
231234
<p><strong>level</strong>: <a href="/doc/node-utils/type-aliases/Level.html"><code>Level</code></a> = <code>'debug'</code></p>
232235
</blockquote>
233236
<p>Minimum level that will be emitted.</p>
234-
<h4 id="default-2" tabindex="-1">Default</h4>
237+
<h4 id="default-3" tabindex="-1">Default</h4>
235238
<pre><code class="hljs language-ts"><span class="hljs-string">&#x27;debug&#x27;</span>
236239
</code></pre>
237240
<h3 id="silent" tabindex="-1">silent</h3>
238241
<blockquote>
239242
<p><strong>silent</strong>: <code>boolean</code> = <code>false</code></p>
240243
</blockquote>
241244
<p>When true, suppresses all output and transport forwarding.</p>
242-
<h4 id="default-3" tabindex="-1">Default</h4>
245+
<h4 id="default-4" tabindex="-1">Default</h4>
243246
<pre><code class="hljs language-ts"><span class="hljs-literal">false</span>
244247
</code></pre>
245248
<h3 id="size" tabindex="-1">size</h3>
246249
<blockquote>
247250
<p><strong>size</strong>: <code>number</code> = <code>1000</code></p>
248251
</blockquote>
249252
<p>Maximum plain-text payload length before non-error logs are truncated.</p>
250-
<h4 id="default-4" tabindex="-1">Default</h4>
253+
<h4 id="default-5" tabindex="-1">Default</h4>
251254
<pre><code class="hljs language-ts"><span class="hljs-number">1000</span>
252255
</code></pre>
253256
<h3 id="stderr" tabindex="-1">stderr</h3>
@@ -260,7 +263,7 @@ <h5 id="text" tabindex="-1">text</h5>
260263
<p><code>string</code></p>
261264
<h4 id="returns-8" tabindex="-1">Returns</h4>
262265
<p><code>void</code></p>
263-
<h4 id="default-5" tabindex="-1">Default</h4>
266+
<h4 id="default-6" tabindex="-1">Default</h4>
264267
<pre><code class="hljs language-ts"><span class="hljs-variable language_">console</span>.<span class="hljs-property">error</span>
265268
</code></pre>
266269
<h3 id="stdout" tabindex="-1">stdout</h3>
@@ -273,7 +276,7 @@ <h5 id="text-1" tabindex="-1">text</h5>
273276
<p><code>string</code></p>
274277
<h4 id="returns-9" tabindex="-1">Returns</h4>
275278
<p><code>void</code></p>
276-
<h4 id="default-6" tabindex="-1">Default</h4>
279+
<h4 id="default-7" tabindex="-1">Default</h4>
277280
<pre><code class="hljs language-ts"><span class="hljs-variable language_">console</span>.<span class="hljs-property">log</span>
278281
</code></pre>
279282
</div></div>

doc/node-utils/functions/loadEnvFileIfExists.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ <h3 id="options%3F" tabindex="-1">options?</h3>
7676
<h2 id="returns" tabindex="-1">Returns</h2>
7777
<p><code>string</code> | <code>null</code></p>
7878
<p>Resolved env file path, or <code>null</code> when the file does not exist.</p>
79+
<h2 id="default" tabindex="-1">Default</h2>
80+
<pre><code class="hljs language-ts">{
81+
}
82+
</code></pre>
7983
<h2 id="throws" tabindex="-1">Throws</h2>
8084
<p>If the resolved path exists but cannot be read as a file.</p>
8185
<h2 id="example" tabindex="-1">Example</h2>

doc/node-utils/functions/loadPackage.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ <h3 id="options%3F" tabindex="-1">options?</h3>
8787
<h2 id="returns" tabindex="-1">Returns</h2>
8888
<p><code>Promise</code>&lt;<code>T</code>&gt;</p>
8989
<p>Loaded export value or the full module namespace when no preferred key exists.</p>
90+
<h2 id="default" tabindex="-1">Default</h2>
91+
<pre><code class="hljs language-ts"><span class="hljs-string">&#x27;default&#x27;</span>
92+
</code></pre>
93+
<h2 id="default-1" tabindex="-1">Default</h2>
94+
<pre><code class="hljs language-ts">{
95+
}
96+
</code></pre>
9097
<h2 id="throws" tabindex="-1">Throws</h2>
9198
<p>If the runtime cannot be detected or the requested module fails to load.</p>
9299
<h2 id="example" tabindex="-1">Example</h2>

doc/node-utils/functions/registerNodeModuleHooks.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ <h3 id="options%3F" tabindex="-1">options?</h3>
7676
<p>Hook registration options such as entry file, root, tsconfig path, and cache-busting version.</p>
7777
<h2 id="returns" tabindex="-1">Returns</h2>
7878
<p><code>void</code></p>
79+
<h2 id="default" tabindex="-1">Default</h2>
80+
<pre><code class="hljs language-ts">{
81+
}
82+
</code></pre>
7983
<h2 id="example" tabindex="-1">Example</h2>
8084
<pre><code class="hljs language-ts"><span class="hljs-keyword">import</span> { registerNodeModuleHooks } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@faasjs/node-utils&#x27;</span>
8185

sitemap.xml

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)