Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync main with storage browser integrity branch #13928

Merged
merged 17 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ In your sample project, you can now link specific packages
yarn link @aws-amplify/auth
```

If you are testing with a Vite sample project, such as from the quickstart guide, and your changes to the library are not showing up in your local app when running `yarn run dev`, Vite caching may be the culprit. Try editing this line in your sample project's `package.json`.

```diff
"scripts": {
- "dev": "vite",
+ "dev": "vite --force",
...
}
```

Passing unit tests are only necessary if you’re looking to contribute a pull request. If you’re just playing locally, you don’t need them. However, if you’re contributing a pull request for anything other than making a change to the documentation, fixing a formatting issue in the code (i.e., white space, missing semi-colons) or another task that does not impact the functionality of the code, you will need to validate your proposed changes with passing unit tests.

#### Verdaccio
Expand Down
2 changes: 1 addition & 1 deletion docs/api/assets/navigation.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/assets/search.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
control stream destruction using an <code>AbortController</code>.</p>
<p>Calling <code>abort</code> on the <code>AbortController</code> corresponding to the passed <code>AbortSignal</code> will behave the same way as calling <code>.destroy(new AbortError())</code> on the
stream, and <code>controller.error(new AbortError())</code> for webstreams.</p>
<pre><code class="language-js"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">fs</span><span class="hl-2"> = </span><span class="hl-3">require</span><span class="hl-2">(</span><span class="hl-5">&#39;node:fs&#39;</span><span class="hl-2">);</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">controller</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-3">AbortController</span><span class="hl-2">();</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">read</span><span class="hl-2"> = </span><span class="hl-3">addAbortSignal</span><span class="hl-2">(</span><br/><span class="hl-2"> </span><span class="hl-4">controller</span><span class="hl-2">.</span><span class="hl-4">signal</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">fs</span><span class="hl-2">.</span><span class="hl-3">createReadStream</span><span class="hl-2">((</span><span class="hl-5">&#39;object.json&#39;</span><span class="hl-2">)),</span><br/><span class="hl-2">);</span><br/><span class="hl-0">// Later, abort the operation closing the stream</span><br/><span class="hl-4">controller</span><span class="hl-2">.</span><span class="hl-3">abort</span><span class="hl-2">();</span>
<pre><code class="language-js"><span class="hl-1">import</span><span class="hl-2"> </span><span class="hl-4">fs</span><span class="hl-2"> </span><span class="hl-1">from</span><span class="hl-2"> </span><span class="hl-5">&#39;node:fs&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">controller</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-3">AbortController</span><span class="hl-2">();</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">read</span><span class="hl-2"> = </span><span class="hl-3">addAbortSignal</span><span class="hl-2">(</span><br/><span class="hl-2"> </span><span class="hl-4">controller</span><span class="hl-2">.</span><span class="hl-4">signal</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">fs</span><span class="hl-2">.</span><span class="hl-3">createReadStream</span><span class="hl-2">((</span><span class="hl-5">&#39;object.json&#39;</span><span class="hl-2">)),</span><br/><span class="hl-2">);</span><br/><span class="hl-0">// Later, abort the operation closing the stream</span><br/><span class="hl-4">controller</span><span class="hl-2">.</span><span class="hl-3">abort</span><span class="hl-2">();</span>
</code><button>Copy</button></pre>
<p>Or using an <code>AbortSignal</code> with a readable stream as an async iterable:</p>
<pre><code class="language-js"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">controller</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-3">AbortController</span><span class="hl-2">();</span><br/><span class="hl-3">setTimeout</span><span class="hl-2">(() </span><span class="hl-6">=&gt;</span><span class="hl-2"> </span><span class="hl-4">controller</span><span class="hl-2">.</span><span class="hl-3">abort</span><span class="hl-2">(), </span><span class="hl-8">10_000</span><span class="hl-2">); </span><span class="hl-0">// set a timeout</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">stream</span><span class="hl-2"> = </span><span class="hl-3">addAbortSignal</span><span class="hl-2">(</span><br/><span class="hl-2"> </span><span class="hl-4">controller</span><span class="hl-2">.</span><span class="hl-4">signal</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">fs</span><span class="hl-2">.</span><span class="hl-3">createReadStream</span><span class="hl-2">((</span><span class="hl-5">&#39;object.json&#39;</span><span class="hl-2">)),</span><br/><span class="hl-2">);</span><br/><span class="hl-2">(</span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-1">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-1">for</span><span class="hl-2"> </span><span class="hl-1">await</span><span class="hl-2"> (</span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">chunk</span><span class="hl-2"> </span><span class="hl-6">of</span><span class="hl-2"> </span><span class="hl-4">stream</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-1">await</span><span class="hl-2"> </span><span class="hl-3">process</span><span class="hl-2">(</span><span class="hl-4">chunk</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> } </span><span class="hl-1">catch</span><span class="hl-2"> (</span><span class="hl-4">e</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-1">if</span><span class="hl-2"> (</span><span class="hl-4">e</span><span class="hl-2">.</span><span class="hl-4">name</span><span class="hl-2"> === </span><span class="hl-5">&#39;AbortError&#39;</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-0">// The operation was cancelled</span><br/><span class="hl-2"> } </span><span class="hl-1">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-1">throw</span><span class="hl-2"> </span><span class="hl-4">e</span><span class="hl-2">;</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">})();</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
</head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"><a href="https://docs.amplify.aws/">Library Documentation</a><a href="https://www.npmjs.com/package/aws-amplify">NPM</a><a href="https://github.com/aws-amplify/amplify-js">GitHub</a></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">Amplify JS API Documentation</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">Amplify JS API Documentation</a></li><li><a href="../modules/_aws_amplify_adapter_nextjs.html">@aws-amplify/adapter-nextjs</a></li><li><a href="../modules/_aws_amplify_adapter_nextjs.index.html">index</a></li><li><a href="../modules/_aws_amplify_adapter_nextjs.index._Reference_Types_.html">&lt;Reference Types&gt;</a></li><li><a href="../modules/_aws_amplify_adapter_nextjs.index._Reference_Types_.internal.html">internal</a></li><li><a href="_aws_amplify_adapter_nextjs.index._Reference_Types_.internal.finished-1.html">finished</a></li></ul><h1>Function finished</h1></div><section class="tsd-panel"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="finished" class="tsd-anchor"></a><span class="tsd-kind-call-signature">finished</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">stream</span>, <span class="tsd-kind-parameter">options</span>, <span class="tsd-kind-parameter">callback</span><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-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><a href="#finished" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>A readable and/or writable stream/webstream.</p>
<p>A function to get notified when a stream is no longer readable, writable
or has experienced an error or a premature close event.</p>
<pre><code class="language-js"><span class="hl-6">const</span><span class="hl-2"> { </span><span class="hl-7">finished</span><span class="hl-2"> } = </span><span class="hl-3">require</span><span class="hl-2">(</span><span class="hl-5">&#39;node:stream&#39;</span><span class="hl-2">);</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">fs</span><span class="hl-2"> = </span><span class="hl-3">require</span><span class="hl-2">(</span><span class="hl-5">&#39;node:fs&#39;</span><span class="hl-2">);</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">rs</span><span class="hl-2"> = </span><span class="hl-4">fs</span><span class="hl-2">.</span><span class="hl-3">createReadStream</span><span class="hl-2">(</span><span class="hl-5">&#39;archive.tar&#39;</span><span class="hl-2">);</span><br/><br/><span class="hl-3">finished</span><span class="hl-2">(</span><span class="hl-4">rs</span><span class="hl-2">, (</span><span class="hl-4">err</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-1">if</span><span class="hl-2"> (</span><span class="hl-4">err</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">console</span><span class="hl-2">.</span><span class="hl-3">error</span><span class="hl-2">(</span><span class="hl-5">&#39;Stream failed.&#39;</span><span class="hl-2">, </span><span class="hl-4">err</span><span class="hl-2">);</span><br/><span class="hl-2"> } </span><span class="hl-1">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">console</span><span class="hl-2">.</span><span class="hl-3">log</span><span class="hl-2">(</span><span class="hl-5">&#39;Stream is done reading.&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-4">rs</span><span class="hl-2">.</span><span class="hl-3">resume</span><span class="hl-2">(); </span><span class="hl-0">// Drain the stream.</span>
<pre><code class="language-js"><span class="hl-1">import</span><span class="hl-2"> { </span><span class="hl-4">finished</span><span class="hl-2"> } </span><span class="hl-1">from</span><span class="hl-2"> </span><span class="hl-5">&#39;node:stream&#39;</span><span class="hl-2">;</span><br/><span class="hl-1">import</span><span class="hl-2"> </span><span class="hl-4">fs</span><span class="hl-2"> </span><span class="hl-1">from</span><span class="hl-2"> </span><span class="hl-5">&#39;node:fs&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">rs</span><span class="hl-2"> = </span><span class="hl-4">fs</span><span class="hl-2">.</span><span class="hl-3">createReadStream</span><span class="hl-2">(</span><span class="hl-5">&#39;archive.tar&#39;</span><span class="hl-2">);</span><br/><br/><span class="hl-3">finished</span><span class="hl-2">(</span><span class="hl-4">rs</span><span class="hl-2">, (</span><span class="hl-4">err</span><span class="hl-2">) </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-1">if</span><span class="hl-2"> (</span><span class="hl-4">err</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">console</span><span class="hl-2">.</span><span class="hl-3">error</span><span class="hl-2">(</span><span class="hl-5">&#39;Stream failed.&#39;</span><span class="hl-2">, </span><span class="hl-4">err</span><span class="hl-2">);</span><br/><span class="hl-2"> } </span><span class="hl-1">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">console</span><span class="hl-2">.</span><span class="hl-3">log</span><span class="hl-2">(</span><span class="hl-5">&#39;Stream is done reading.&#39;</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-4">rs</span><span class="hl-2">.</span><span class="hl-3">resume</span><span class="hl-2">(); </span><span class="hl-0">// Drain the stream.</span>
</code><button>Copy</button></pre>
<p>Especially useful in error handling scenarios where a stream is destroyed
prematurely (like an aborted HTTP request), and will not emit <code>&#39;end&#39;</code> or <code>&#39;finish&#39;</code>.</p>
Expand Down
Loading
Loading