@sanity/client 7.11.0 → 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.
@@ -1,7 +1,7 @@
1
1
  import { getIt } from "get-it";
2
2
  import { adapter, environment } from "get-it";
3
3
  import { retry, jsonRequest, jsonResponse, progress, observable } from "get-it/middleware";
4
- import { Observable, defer, of, isObservable, mergeMap, from, lastValueFrom, shareReplay, catchError, concat, throwError, timer, tap, finalize, share, merge, EMPTY, map as map$1, firstValueFrom } from "rxjs";
4
+ import { Observable, defer, of, isObservable, mergeMap, from, lastValueFrom, shareReplay, catchError, concat, throwError, timer, tap, finalize, share, merge, map as map$1, firstValueFrom } from "rxjs";
5
5
  import { isRecord, stegaClean } from "./_chunks-es/stegaClean.js";
6
6
  import { combineLatestWith, map, filter, finalize as finalize$1 } from "rxjs/operators";
7
7
  import { getVersionFromId, isDraftId, getVersionId, getDraftId, isVersionId, getPublishedId } from "@sanity/client/csm";
@@ -1465,26 +1465,31 @@ class LiveClient {
1465
1465
  "welcome",
1466
1466
  "reconnect",
1467
1467
  "goaway"
1468
- ]).pipe(
1469
- reconnectOnConnectionFailure(),
1470
- map((event) => {
1471
- if (event.type === "message") {
1472
- const { data, ...rest } = event;
1473
- return { ...rest, tags: data.tags };
1474
- }
1475
- return event;
1476
- })
1477
- ), checkCors = fetchObservable(url, {
1468
+ ]), checkCors = fetchObservable(url, {
1478
1469
  method: "OPTIONS",
1479
1470
  mode: "cors",
1480
1471
  credentials: esOptions.withCredentials ? "include" : "omit",
1481
1472
  headers: esOptions.headers
1482
1473
  }).pipe(
1483
- mergeMap(() => EMPTY),
1484
1474
  catchError(() => {
1485
1475
  throw new CorsOriginError({ projectId: projectId2 });
1486
1476
  })
1487
- ), observable2 = concat(checkCors, events).pipe(
1477
+ ), observable2 = events.pipe(
1478
+ reconnectOnConnectionFailure(),
1479
+ mergeMap((event) => event.type === "reconnect" ? checkCors.pipe(mergeMap(() => of(event))) : of(event)),
1480
+ catchError((err) => checkCors.pipe(
1481
+ mergeMap(() => {
1482
+ throw err;
1483
+ })
1484
+ )),
1485
+ map((event) => {
1486
+ if (event.type === "message") {
1487
+ const { data, ...rest } = event;
1488
+ return { ...rest, tags: data.tags };
1489
+ }
1490
+ return event;
1491
+ })
1492
+ ).pipe(
1488
1493
  finalize$1(() => eventsCache.delete(key)),
1489
1494
  shareReplayLatest({
1490
1495
  predicate: (event) => event.type === "welcome"