Skip to content

Commit

Permalink
chore: sync main with storage browser integrity branch (#13928)
Browse files Browse the repository at this point in the history
* chore(release): Set core metadata [skip release]

* chore(release): Publish [skip release]

 - @aws-amplify/adapter-nextjs@1.2.21
 - @aws-amplify/analytics@7.0.51
 - @aws-amplify/api@6.0.53
 - @aws-amplify/api-graphql@4.4.0
 - @aws-amplify/api-rest@4.0.51
 - @aws-amplify/auth@6.5.1
 - aws-amplify@6.6.4
 - @aws-amplify/core@6.4.4
 - @aws-amplify/datastore@5.0.53
 - @aws-amplify/datastore-storage-adapter@2.1.53
 - @aws-amplify/geo@3.0.51
 - @aws-amplify/interactions@6.0.50
 - @aws-amplify/notifications@2.0.51
 - @aws-amplify/predictions@6.1.26
 - @aws-amplify/pubsub@6.1.26
 - @aws-amplify/storage@6.6.9
 - tsc-compliance-test@0.1.56

* chore(release): Update API docs [skip release]

* chore: update contributing guide vite troubleshooting (#13826)

* docs: update contributing guide vite troubleshooting

* Update CONTRIBUTING.md

---------

Co-authored-by: AllanZhengYP <zheallan@amazon.com>

* chore(ai): add UpdateConversation enum (#13920)

* chore(release): Set core metadata [skip release]

* chore(release): Publish [skip release]

 - @aws-amplify/adapter-nextjs@1.2.22
 - @aws-amplify/analytics@7.0.52
 - @aws-amplify/api@6.0.54
 - @aws-amplify/api-graphql@4.4.1
 - @aws-amplify/api-rest@4.0.52
 - @aws-amplify/auth@6.5.2
 - aws-amplify@6.6.5
 - @aws-amplify/core@6.4.5
 - @aws-amplify/datastore@5.0.54
 - @aws-amplify/datastore-storage-adapter@2.1.54
 - @aws-amplify/geo@3.0.52
 - @aws-amplify/interactions@6.0.51
 - @aws-amplify/notifications@2.0.52
 - @aws-amplify/predictions@6.1.27
 - @aws-amplify/pubsub@6.1.27
 - @aws-amplify/storage@6.6.10
 - tsc-compliance-test@0.1.57

* chore(release): Update API docs [skip release]

* fix(storage): multipart upload is firing on 0 bytes data (#13927)

* chore: update bundle size

---------

Co-authored-by: erinleigh90 <106691284+erinleigh90@users.noreply.github.com>
Co-authored-by: aws-amplify-bot <aws@amazon.com>
Co-authored-by: Parker Scanlon <69879391+scanlonp@users.noreply.github.com>
Co-authored-by: AllanZhengYP <zheallan@amazon.com>
Co-authored-by: Danny Banks <djb@amazon.com>
Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com>
Co-authored-by: Hui Zhao <10602282+HuiSF@users.noreply.github.com>
  • Loading branch information
8 people authored Oct 16, 2024
1 parent 96c2dc7 commit 9563334
Show file tree
Hide file tree
Showing 126 changed files with 609 additions and 1,214 deletions.
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

0 comments on commit 9563334

Please sign in to comment.