@sanity/client 7.11.0-live-cors → 7.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs +8 -10
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +9 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +9 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/data/live.ts +35 -34
- package/umd/sanityClient.js +8 -10
- package/umd/sanityClient.min.js +2 -2
package/dist/index.browser.cjs
CHANGED
|
@@ -1481,7 +1481,7 @@ class LiveClient {
|
|
|
1481
1481
|
"welcome",
|
|
1482
1482
|
"reconnect",
|
|
1483
1483
|
"goaway"
|
|
1484
|
-
]), checkCors
|
|
1484
|
+
]), checkCors = fetchObservable(url, {
|
|
1485
1485
|
method: "OPTIONS",
|
|
1486
1486
|
mode: "cors",
|
|
1487
1487
|
credentials: esOptions.withCredentials ? "include" : "omit",
|
|
@@ -1489,19 +1489,17 @@ class LiveClient {
|
|
|
1489
1489
|
}).pipe(
|
|
1490
1490
|
rxjs.catchError(() => {
|
|
1491
1491
|
throw new CorsOriginError({ projectId: projectId2 });
|
|
1492
|
-
})
|
|
1493
|
-
operators.shareReplay(1)
|
|
1494
|
-
// run only once
|
|
1492
|
+
})
|
|
1495
1493
|
), observable = events.pipe(
|
|
1496
|
-
|
|
1497
|
-
|
|
1494
|
+
reconnectOnConnectionFailure(),
|
|
1495
|
+
rxjs.mergeMap((event) => event.type === "reconnect" ? checkCors.pipe(rxjs.mergeMap(() => rxjs.of(event))) : rxjs.of(event)),
|
|
1496
|
+
rxjs.catchError((err) => checkCors.pipe(
|
|
1498
1497
|
rxjs.mergeMap(() => {
|
|
1499
|
-
throw
|
|
1498
|
+
throw err;
|
|
1500
1499
|
})
|
|
1501
|
-
))
|
|
1502
|
-
reconnectOnConnectionFailure(),
|
|
1500
|
+
)),
|
|
1503
1501
|
operators.map((event) => {
|
|
1504
|
-
if (
|
|
1502
|
+
if (event.type === "message") {
|
|
1505
1503
|
const { data, ...rest } = event;
|
|
1506
1504
|
return { ...rest, tags: data.tags };
|
|
1507
1505
|
}
|