sanity 5.24.1-next.4 → 5.24.1-next.6

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,4 +1,4 @@
1
- var version = "5.24.1-next.4+1880a07ce4";
1
+ var version = "5.24.1-next.6+902b99b29c";
2
2
  let buildVersion;
3
3
  try {
4
4
  buildVersion = process.env.PKG_BUILD_VERSION;
@@ -7,7 +7,7 @@ try {
7
7
  try {
8
8
  buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
9
9
  // and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
10
- "5.24.1-next.4+1880a07ce4";
10
+ "5.24.1-next.6+902b99b29c";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.js CHANGED
@@ -4728,8 +4728,17 @@ function createMemoryStorage$1() {
4728
4728
  store
4729
4729
  };
4730
4730
  }
4731
+ function createChannel(key) {
4732
+ return typeof BroadcastChannel > "u" ? {
4733
+ postMessage: () => {
4734
+ },
4735
+ close: () => {
4736
+ },
4737
+ onmessage: null
4738
+ } : new BroadcastChannel(key);
4739
+ }
4731
4740
  function createBroadcastState(key, initial2, storage = createMemoryStorage$1()) {
4732
- const channel = new BroadcastChannel(key), subject = new BehaviorSubject(initial2?.(storage.load()));
4741
+ const channel = createChannel(key), subject = new BehaviorSubject(initial2?.(storage.load()));
4733
4742
  return storage.store(subject.getValue()), channel.onmessage = (e) => {
4734
4743
  const parsed = JSON.parse(e.data);
4735
4744
  subject.next(parsed === null ? void 0 : parsed);
@@ -5119,7 +5128,7 @@ function _createAuthStore({
5119
5128
  authenticated,
5120
5129
  currentUser: currentUser || null
5121
5130
  };
5122
- })), hashTokenChange = fromEvent(window, "hashchange").pipe(tap(() => {
5131
+ })), hashTokenChange = typeof window > "u" ? EMPTY$5 : fromEvent(window, "hashchange").pipe(tap(() => {
5123
5132
  const hashToken = consumeHashToken2();
5124
5133
  hashToken && tokenStorage.update({
5125
5134
  token: hashToken
@@ -6105,8 +6114,9 @@ const snapshotPair = memoize((client, idPair, typeName, serverActionsEnabled, pa
6105
6114
  }), publishReplay(1), refCount());
6106
6115
  }, (ctx, idPair, typeName) => memoizeKeyGen(ctx.client, idPair, typeName)), consistencyStatus = memoize((client, idPair, typeName, serverActionsEnabled, extraOptions) => memoizedPair(client, idPair, typeName, serverActionsEnabled, extraOptions).pipe(switchMap(({
6107
6116
  draft,
6108
- published
6109
- }) => combineLatest([draft.consistency$, published.consistency$])), map(([draftIsConsistent, publishedIsConsistent]) => draftIsConsistent && publishedIsConsistent), distinctUntilChanged(), publishReplay(1), refCount()), memoizeKeyGen);
6117
+ published,
6118
+ version: version2
6119
+ }) => combineLatest([draft.consistency$, published.consistency$, version2?.consistency$ ?? of(!0)])), map(([draftIsConsistent, publishedIsConsistent, versionIsConsistent]) => draftIsConsistent && publishedIsConsistent && versionIsConsistent), distinctUntilChanged(), publishReplay(1), refCount()), memoizeKeyGen);
6110
6120
  function getOperationStoreKey(client) {
6111
6121
  const config = client.config(), {
6112
6122
  projectId,
@@ -6520,7 +6530,7 @@ const REQUIRES_CONSISTENCY = ["publish", "unpublish", "discardChanges", "delete"
6520
6530
  // should be cancelled
6521
6531
  switchMap((args) => operationArgs(ctx, args.idPair, args.typeName).pipe(take$1(1), switchMap((operationArguments) => {
6522
6532
  const requiresConsistency = REQUIRES_CONSISTENCY.includes(args.operationName);
6523
- requiresConsistency && (operationArguments.published.commit(), operationArguments.draft.commit());
6533
+ requiresConsistency && (operationArguments.published.commit(), operationArguments.draft.commit(), operationArguments.version?.commit());
6524
6534
  const isConsistent$ = consistencyStatus(ctx.client, args.idPair, args.typeName, ctx.serverActionsEnabled, ctx.extraOptions).pipe(filter(Boolean));
6525
6535
  return (requiresConsistency ? isConsistent$.pipe(take$1(1)) : of(!0)).pipe(switchMap(() => execute(args.operationName, operationArguments, args.extraArgs, operationArguments.serverActionsEnabled)));
6526
6536
  }), map(() => ({