@sanity/client 7.26.2 → 7.27.0

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.d.cts CHANGED
@@ -872,7 +872,7 @@ export declare type ClientPerspective =
872
872
  export declare type ClientReturn<
873
873
  GroqString extends string,
874
874
  Fallback = Any,
875
- > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
875
+ > = GroqString extends keyof SanityQueries_2 ? SanityQueries_2[GroqString] : Fallback
876
876
 
877
877
  /**
878
878
  * @public
@@ -5879,8 +5879,28 @@ export declare interface SanityProjectMember {
5879
5879
  isCurrentUser: boolean
5880
5880
  }
5881
5881
 
5882
- /** @public */
5883
- export declare interface SanityQueries {}
5882
+ /**
5883
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
5884
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
5885
+ * ```ts
5886
+ * declare module '@sanity/client' {
5887
+ * interface SanityQueries {
5888
+ * '*[_type == "post"]': PostsQueryResult
5889
+ * }
5890
+ * }
5891
+ * ```
5892
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
5893
+ * generated file that registers queries globally can bridge them with an augmentation that adds
5894
+ * the global as a base type. It is harmless on releases that already inherit it:
5895
+ * ```ts
5896
+ * declare module '@sanity/client' {
5897
+ * interface SanityQueries extends globalThis.SanityQueries {}
5898
+ * }
5899
+ * ```
5900
+ * @public
5901
+ */
5902
+ declare interface SanityQueries_2 extends globalThis.SanityQueries {}
5903
+ export {SanityQueries_2 as SanityQueries}
5884
5904
 
5885
5905
  /** @internal */
5886
5906
  export declare interface SanityReference {
@@ -6793,3 +6813,27 @@ export declare type WelcomeEvent = {
6793
6813
  }
6794
6814
 
6795
6815
  export {}
6816
+
6817
+ declare global {
6818
+ interface File {}
6819
+ }
6820
+
6821
+ declare global {
6822
+ /**
6823
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
6824
+ * the queries it finds:
6825
+ * ```ts
6826
+ * declare global {
6827
+ * interface SanityQueries {
6828
+ * '*[_type == "post"]': PostsQueryResult
6829
+ * }
6830
+ * }
6831
+ * ```
6832
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
6833
+ *
6834
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
6835
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
6836
+ * direct dependency, how many copies of it are installed, and from every subpath export.
6837
+ */
6838
+ interface SanityQueries {}
6839
+ }
package/dist/index.d.ts CHANGED
@@ -872,7 +872,7 @@ export declare type ClientPerspective =
872
872
  export declare type ClientReturn<
873
873
  GroqString extends string,
874
874
  Fallback = Any,
875
- > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
875
+ > = GroqString extends keyof SanityQueries_2 ? SanityQueries_2[GroqString] : Fallback
876
876
 
877
877
  /**
878
878
  * @public
@@ -5879,8 +5879,28 @@ export declare interface SanityProjectMember {
5879
5879
  isCurrentUser: boolean
5880
5880
  }
5881
5881
 
5882
- /** @public */
5883
- export declare interface SanityQueries {}
5882
+ /**
5883
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
5884
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
5885
+ * ```ts
5886
+ * declare module '@sanity/client' {
5887
+ * interface SanityQueries {
5888
+ * '*[_type == "post"]': PostsQueryResult
5889
+ * }
5890
+ * }
5891
+ * ```
5892
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
5893
+ * generated file that registers queries globally can bridge them with an augmentation that adds
5894
+ * the global as a base type. It is harmless on releases that already inherit it:
5895
+ * ```ts
5896
+ * declare module '@sanity/client' {
5897
+ * interface SanityQueries extends globalThis.SanityQueries {}
5898
+ * }
5899
+ * ```
5900
+ * @public
5901
+ */
5902
+ declare interface SanityQueries_2 extends globalThis.SanityQueries {}
5903
+ export {SanityQueries_2 as SanityQueries}
5884
5904
 
5885
5905
  /** @internal */
5886
5906
  export declare interface SanityReference {
@@ -6793,3 +6813,27 @@ export declare type WelcomeEvent = {
6793
6813
  }
6794
6814
 
6795
6815
  export {}
6816
+
6817
+ declare global {
6818
+ interface File {}
6819
+ }
6820
+
6821
+ declare global {
6822
+ /**
6823
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
6824
+ * the queries it finds:
6825
+ * ```ts
6826
+ * declare global {
6827
+ * interface SanityQueries {
6828
+ * '*[_type == "post"]': PostsQueryResult
6829
+ * }
6830
+ * }
6831
+ * ```
6832
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
6833
+ *
6834
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
6835
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
6836
+ * direct dependency, how many copies of it are installed, and from every subpath export.
6837
+ */
6838
+ interface SanityQueries {}
6839
+ }
package/dist/index.js CHANGED
@@ -2865,7 +2865,7 @@ function defineDeprecatedCreateClient(createClient2) {
2865
2865
  return printNoDefaultExport(), createClient2(config);
2866
2866
  };
2867
2867
  }
2868
- var name = "@sanity/client", version = "7.26.2";
2868
+ var name = "@sanity/client", version = "7.27.0";
2869
2869
  const middleware = [
2870
2870
  debug({ verbose: !0, namespace: "sanity:client" }),
2871
2871
  headers({ "User-Agent": `${name} ${version}` }),