@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.
@@ -115,3 +115,27 @@ export declare interface VideoSubtitleInfoSigned extends VideoSubtitleInfoPublic
115
115
  }
116
116
 
117
117
  export {}
118
+
119
+ declare global {
120
+ interface File {}
121
+ }
122
+
123
+ declare global {
124
+ /**
125
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
126
+ * the queries it finds:
127
+ * ```ts
128
+ * declare global {
129
+ * interface SanityQueries {
130
+ * '*[_type == "post"]': PostsQueryResult
131
+ * }
132
+ * }
133
+ * ```
134
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
135
+ *
136
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
137
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
138
+ * direct dependency, how many copies of it are installed, and from every subpath export.
139
+ */
140
+ interface SanityQueries {}
141
+ }
@@ -115,3 +115,27 @@ export declare interface VideoSubtitleInfoSigned extends VideoSubtitleInfoPublic
115
115
  }
116
116
 
117
117
  export {}
118
+
119
+ declare global {
120
+ interface File {}
121
+ }
122
+
123
+ declare global {
124
+ /**
125
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
126
+ * the queries it finds:
127
+ * ```ts
128
+ * declare global {
129
+ * interface SanityQueries {
130
+ * '*[_type == "post"]': PostsQueryResult
131
+ * }
132
+ * }
133
+ * ```
134
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
135
+ *
136
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
137
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
138
+ * direct dependency, how many copies of it are installed, and from every subpath export.
139
+ */
140
+ interface SanityQueries {}
141
+ }
@@ -865,7 +865,7 @@ export declare type ClientPerspective =
865
865
  export declare type ClientReturn<
866
866
  GroqString extends string,
867
867
  Fallback = Any,
868
- > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
868
+ > = GroqString extends keyof SanityQueries_2 ? SanityQueries_2[GroqString] : Fallback
869
869
 
870
870
  /**
871
871
  * Drop-in replacement for `ClientReturn` that brands the result strings as `StegaString`, for use
@@ -6079,8 +6079,28 @@ export declare interface SanityProjectMember {
6079
6079
  isCurrentUser: boolean
6080
6080
  }
6081
6081
 
6082
- /** @public */
6083
- export declare interface SanityQueries {}
6082
+ /**
6083
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
6084
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
6085
+ * ```ts
6086
+ * declare module '@sanity/client' {
6087
+ * interface SanityQueries {
6088
+ * '*[_type == "post"]': PostsQueryResult
6089
+ * }
6090
+ * }
6091
+ * ```
6092
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
6093
+ * generated file that registers queries globally can bridge them with an augmentation that adds
6094
+ * the global as a base type. It is harmless on releases that already inherit it:
6095
+ * ```ts
6096
+ * declare module '@sanity/client' {
6097
+ * interface SanityQueries extends globalThis.SanityQueries {}
6098
+ * }
6099
+ * ```
6100
+ * @public
6101
+ */
6102
+ declare interface SanityQueries_2 extends globalThis.SanityQueries {}
6103
+ export {SanityQueries_2 as SanityQueries}
6084
6104
 
6085
6105
  /** @internal */
6086
6106
  export declare interface SanityReference {
@@ -865,7 +865,7 @@ export declare type ClientPerspective =
865
865
  export declare type ClientReturn<
866
866
  GroqString extends string,
867
867
  Fallback = Any,
868
- > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
868
+ > = GroqString extends keyof SanityQueries_2 ? SanityQueries_2[GroqString] : Fallback
869
869
 
870
870
  /**
871
871
  * Drop-in replacement for `ClientReturn` that brands the result strings as `StegaString`, for use
@@ -6079,8 +6079,28 @@ export declare interface SanityProjectMember {
6079
6079
  isCurrentUser: boolean
6080
6080
  }
6081
6081
 
6082
- /** @public */
6083
- export declare interface SanityQueries {}
6082
+ /**
6083
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
6084
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
6085
+ * ```ts
6086
+ * declare module '@sanity/client' {
6087
+ * interface SanityQueries {
6088
+ * '*[_type == "post"]': PostsQueryResult
6089
+ * }
6090
+ * }
6091
+ * ```
6092
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
6093
+ * generated file that registers queries globally can bridge them with an augmentation that adds
6094
+ * the global as a base type. It is harmless on releases that already inherit it:
6095
+ * ```ts
6096
+ * declare module '@sanity/client' {
6097
+ * interface SanityQueries extends globalThis.SanityQueries {}
6098
+ * }
6099
+ * ```
6100
+ * @public
6101
+ */
6102
+ declare interface SanityQueries_2 extends globalThis.SanityQueries {}
6103
+ export {SanityQueries_2 as SanityQueries}
6084
6104
 
6085
6105
  /** @internal */
6086
6106
  export declare interface SanityReference {
@@ -7198,3 +7218,23 @@ export declare type WelcomeEvent = {
7198
7218
  }
7199
7219
 
7200
7220
  export {}
7221
+
7222
+ declare global {
7223
+ /**
7224
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
7225
+ * the queries it finds:
7226
+ * ```ts
7227
+ * declare global {
7228
+ * interface SanityQueries {
7229
+ * '*[_type == "post"]': PostsQueryResult
7230
+ * }
7231
+ * }
7232
+ * ```
7233
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
7234
+ *
7235
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
7236
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
7237
+ * direct dependency, how many copies of it are installed, and from every subpath export.
7238
+ */
7239
+ interface SanityQueries {}
7240
+ }
package/dist/stega.d.cts CHANGED
@@ -865,7 +865,7 @@ export declare type ClientPerspective =
865
865
  export declare type ClientReturn<
866
866
  GroqString extends string,
867
867
  Fallback = Any,
868
- > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
868
+ > = GroqString extends keyof SanityQueries_2 ? SanityQueries_2[GroqString] : Fallback
869
869
 
870
870
  /**
871
871
  * Drop-in replacement for `ClientReturn` that brands the result strings as `StegaString`, for use
@@ -6079,8 +6079,28 @@ export declare interface SanityProjectMember {
6079
6079
  isCurrentUser: boolean
6080
6080
  }
6081
6081
 
6082
- /** @public */
6083
- export declare interface SanityQueries {}
6082
+ /**
6083
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
6084
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
6085
+ * ```ts
6086
+ * declare module '@sanity/client' {
6087
+ * interface SanityQueries {
6088
+ * '*[_type == "post"]': PostsQueryResult
6089
+ * }
6090
+ * }
6091
+ * ```
6092
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
6093
+ * generated file that registers queries globally can bridge them with an augmentation that adds
6094
+ * the global as a base type. It is harmless on releases that already inherit it:
6095
+ * ```ts
6096
+ * declare module '@sanity/client' {
6097
+ * interface SanityQueries extends globalThis.SanityQueries {}
6098
+ * }
6099
+ * ```
6100
+ * @public
6101
+ */
6102
+ declare interface SanityQueries_2 extends globalThis.SanityQueries {}
6103
+ export {SanityQueries_2 as SanityQueries}
6084
6104
 
6085
6105
  /** @internal */
6086
6106
  export declare interface SanityReference {
package/dist/stega.d.ts CHANGED
@@ -865,7 +865,7 @@ export declare type ClientPerspective =
865
865
  export declare type ClientReturn<
866
866
  GroqString extends string,
867
867
  Fallback = Any,
868
- > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
868
+ > = GroqString extends keyof SanityQueries_2 ? SanityQueries_2[GroqString] : Fallback
869
869
 
870
870
  /**
871
871
  * Drop-in replacement for `ClientReturn` that brands the result strings as `StegaString`, for use
@@ -6079,8 +6079,28 @@ export declare interface SanityProjectMember {
6079
6079
  isCurrentUser: boolean
6080
6080
  }
6081
6081
 
6082
- /** @public */
6083
- export declare interface SanityQueries {}
6082
+ /**
6083
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
6084
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
6085
+ * ```ts
6086
+ * declare module '@sanity/client' {
6087
+ * interface SanityQueries {
6088
+ * '*[_type == "post"]': PostsQueryResult
6089
+ * }
6090
+ * }
6091
+ * ```
6092
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
6093
+ * generated file that registers queries globally can bridge them with an augmentation that adds
6094
+ * the global as a base type. It is harmless on releases that already inherit it:
6095
+ * ```ts
6096
+ * declare module '@sanity/client' {
6097
+ * interface SanityQueries extends globalThis.SanityQueries {}
6098
+ * }
6099
+ * ```
6100
+ * @public
6101
+ */
6102
+ declare interface SanityQueries_2 extends globalThis.SanityQueries {}
6103
+ export {SanityQueries_2 as SanityQueries}
6084
6104
 
6085
6105
  /** @internal */
6086
6106
  export declare interface SanityReference {
@@ -7198,3 +7218,23 @@ export declare type WelcomeEvent = {
7198
7218
  }
7199
7219
 
7200
7220
  export {}
7221
+
7222
+ declare global {
7223
+ /**
7224
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
7225
+ * the queries it finds:
7226
+ * ```ts
7227
+ * declare global {
7228
+ * interface SanityQueries {
7229
+ * '*[_type == "post"]': PostsQueryResult
7230
+ * }
7231
+ * }
7232
+ * ```
7233
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
7234
+ *
7235
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
7236
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
7237
+ * direct dependency, how many copies of it are installed, and from every subpath export.
7238
+ */
7239
+ interface SanityQueries {}
7240
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "7.26.2",
3
+ "version": "7.27.0",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -101,19 +101,21 @@
101
101
  "scripts": {
102
102
  "benchmark": "npm test -- bench",
103
103
  "prebuild": "npm run clean",
104
- "build": "pkg build --strict && pkg --strict && npm run rollup && npm run minify",
104
+ "build": "pkg build --strict && pkg --strict && node scripts/append-global-types.mjs && npm run rollup && npm run minify",
105
105
  "check-esm-compatibility": "node scripts/check-esm-compatibility.mjs",
106
106
  "clean": "npx rimraf dist coverage umd/*.js",
107
107
  "coverage": "vitest run --coverage",
108
108
  "lint": "eslint . --max-warnings 0",
109
109
  "minify": "terser -c -m -- umd/sanityClient.js > umd/sanityClient.min.js",
110
110
  "prepublishOnly": "npm run build",
111
+ "release": "changeset publish",
111
112
  "rollup": "NODE_ENV=production rollup -c rollup.config.cjs",
112
113
  "test": "vitest",
113
114
  "test:browser": "npm test -- --config ./vitest.browser.config.ts",
114
115
  "test:bun": "bun test runtimes/bun",
115
116
  "test:deno": "deno test --allow-read --allow-net --allow-env --fail-fast --import-map=runtimes/deno/import_map.json runtimes/deno",
116
117
  "test:deno:update_import_map": "deno run --allow-read --allow-write runtimes/deno/update_import_map.ts",
118
+ "test:dist": "npm test -- --config ./vitest.dist.config.ts",
117
119
  "test:edge-runtime": "npm test -- --config vitest.edge.config.ts",
118
120
  "test:next": "npm test -- --config ./vitest.next.config.ts",
119
121
  "test:node-runtimes": "(cd runtimes/node && node --test)"
@@ -135,6 +137,7 @@
135
137
  "rxjs": "^7.8.2"
136
138
  },
137
139
  "devDependencies": {
140
+ "@changesets/cli": "^2.31.1",
138
141
  "@edge-runtime/types": "^4.0.0",
139
142
  "@edge-runtime/vm": "^5.0.0",
140
143
  "@eslint/eslintrc": "^3.3.6",
@@ -174,7 +177,7 @@
174
177
  "typescript": "5.9.3",
175
178
  "vitest": "3.2.6"
176
179
  },
177
- "packageManager": "npm@11.4.1",
180
+ "packageManager": "npm@12.0.2",
178
181
  "engines": {
179
182
  "node": ">=20"
180
183
  }
package/src/types.ts CHANGED
@@ -1853,8 +1853,47 @@ export interface LiveEventGoAway {
1853
1853
  export type LiveEvent =
1854
1854
  LiveEventRestart | LiveEventReconnect | LiveEventMessage | LiveEventWelcome | LiveEventGoAway
1855
1855
 
1856
- /** @public */
1857
- export interface SanityQueries {}
1856
+ declare global {
1857
+ /**
1858
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
1859
+ * the queries it finds:
1860
+ * ```ts
1861
+ * declare global {
1862
+ * interface SanityQueries {
1863
+ * '*[_type == "post"]': PostsQueryResult
1864
+ * }
1865
+ * }
1866
+ * ```
1867
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
1868
+ *
1869
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
1870
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
1871
+ * direct dependency, how many copies of it are installed, and from every subpath export.
1872
+ */
1873
+ interface SanityQueries {}
1874
+ }
1875
+
1876
+ /**
1877
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
1878
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
1879
+ * ```ts
1880
+ * declare module '@sanity/client' {
1881
+ * interface SanityQueries {
1882
+ * '*[_type == "post"]': PostsQueryResult
1883
+ * }
1884
+ * }
1885
+ * ```
1886
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
1887
+ * generated file that registers queries globally can bridge them with an augmentation that adds
1888
+ * the global as a base type. It is harmless on releases that already inherit it:
1889
+ * ```ts
1890
+ * declare module '@sanity/client' {
1891
+ * interface SanityQueries extends globalThis.SanityQueries {}
1892
+ * }
1893
+ * ```
1894
+ * @public
1895
+ */
1896
+ export interface SanityQueries extends globalThis.SanityQueries {}
1858
1897
 
1859
1898
  /** @public */
1860
1899
  export type ClientReturn<