@sanity/client 7.20.0 → 7.22.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
@@ -811,6 +811,32 @@ export declare interface ClientConfig {
811
811
  * Lineage token for recursion control
812
812
  */
813
813
  lineage?: string
814
+ /**
815
+ * A custom request handler that intercepts all HTTP requests made by the client.
816
+ *
817
+ * Useful for logging, adding custom headers, refreshing auth tokens, rate limiting, etc.
818
+ *
819
+ * When using `withConfig()`, the new handler **replaces** the previous one (it does not
820
+ * wrap it). To compose handlers, you can chain them manually:
821
+ *
822
+ * ```ts
823
+ * const parent = createClient({...config, _requestHandler: handlerA})
824
+ * const child = parent.withConfig({
825
+ * _requestHandler: (req, defaultRequester) =>
826
+ * handlerB(req, (opts) => handlerA(opts, defaultRequester)),
827
+ * })
828
+ * ```
829
+ *
830
+ * Setting `_requestHandler` to `undefined` via `withConfig()` removes the handler.
831
+ *
832
+ * Note: This only applies to HTTP requests. Real-time listener connections
833
+ * (`client.listen()`) use EventSource and are not intercepted by this handler.
834
+ *
835
+ * @internal
836
+ * @deprecated Don't use outside of Sanity internals
837
+ * @see {@link RequestHandler}
838
+ */
839
+ _requestHandler?: RequestHandler
814
840
  }
815
841
 
816
842
  declare type ClientConfigResource =
@@ -836,6 +862,7 @@ export declare class ClientError extends Error {
836
862
  response: ErrorProps['response']
837
863
  statusCode: ErrorProps['statusCode']
838
864
  responseBody: ErrorProps['responseBody']
865
+ traceId: ErrorProps['traceId']
839
866
  details: ErrorProps['details']
840
867
  constructor(res: Any, context?: HttpContext)
841
868
  }
@@ -1383,6 +1410,7 @@ export declare interface ErrorProps {
1383
1410
  response: Any
1384
1411
  statusCode: number
1385
1412
  responseBody: Any
1413
+ traceId?: string
1386
1414
  details: Any
1387
1415
  }
1388
1416
 
@@ -1533,7 +1561,11 @@ export declare type FitMode = 'preserve' | 'stretch' | 'crop' | 'smartcrop' | 'p
1533
1561
  * @returns A formatted error message string.
1534
1562
  * @public
1535
1563
  */
1536
- export declare function formatQueryParseError(error: QueryParseError, tag?: string | null): string
1564
+ export declare function formatQueryParseError(
1565
+ error: QueryParseError,
1566
+ tag?: string | null,
1567
+ traceId?: string,
1568
+ ): string
1537
1569
 
1538
1570
  /** @beta */
1539
1571
  declare type GenerateAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
@@ -2153,6 +2185,7 @@ export declare class LiveClient {
2153
2185
  events({
2154
2186
  includeDrafts,
2155
2187
  tag: _tag,
2188
+ waitFor,
2156
2189
  }?: {
2157
2190
  includeDrafts?: boolean
2158
2191
  /**
@@ -2161,6 +2194,11 @@ export declare class LiveClient {
2161
2194
  * @defaultValue `undefined`
2162
2195
  */
2163
2196
  tag?: string
2197
+ /**
2198
+ * Delays events until after a Sanity Function has processed them and called the callback endpoint.
2199
+ * When omitted, events are delivered immediately.
2200
+ */
2201
+ waitFor?: 'function'
2164
2202
  }): Observable<LiveEvent>
2165
2203
  }
2166
2204
 
@@ -4770,6 +4808,44 @@ export declare interface ReplaceVersionAction {
4770
4808
  /** @public */
4771
4809
  export declare const requester: Requester
4772
4810
 
4811
+ /**
4812
+ * A function that intercepts HTTP requests made by the client.
4813
+ *
4814
+ * Receives the resolved request options, a `defaultRequester` function that
4815
+ * executes the request through the normal pipeline, and a `client` instance
4816
+ * without a `_requestHandler` (to avoid recursive interception).
4817
+ *
4818
+ * The consumer can:
4819
+ * - Modify request options before calling `defaultRequester`
4820
+ * - Transform the response stream (e.g. via `pipe`)
4821
+ * - Skip `defaultRequester` entirely and return a custom Observable
4822
+ * - Use `client` to make additional requests (e.g. refresh an auth token on 401)
4823
+ *
4824
+ * When set via `withConfig()`, the new handler **replaces** (not wraps) the previous one.
4825
+ *
4826
+ * Note: This only applies to HTTP requests. Real-time listener connections
4827
+ * (`client.listen()`) use EventSource and are not intercepted by this handler.
4828
+ *
4829
+ * @param request - The resolved request options including `url`
4830
+ * @param defaultRequester - Executes the request through the normal pipeline
4831
+ * @param client - A client instance with the same configuration but without a `_requestHandler`,
4832
+ * useful for making side requests (e.g. token refresh) without triggering the handler recursively
4833
+ *
4834
+ * @internal
4835
+ * @deprecated Don't use outside of Sanity internals
4836
+ */
4837
+ export declare type RequestHandler = (
4838
+ request: RequestOptions & {
4839
+ url: string
4840
+ },
4841
+ defaultRequester: (
4842
+ options: RequestOptions & {
4843
+ url: string
4844
+ },
4845
+ ) => Observable<HttpRequestEvent>,
4846
+ client: SanityClient,
4847
+ ) => Observable<HttpRequestEvent>
4848
+
4773
4849
  /** @internal */
4774
4850
  export declare interface RequestObservableOptions extends Omit<RequestOptions, 'url'> {
4775
4851
  url?: string
@@ -5801,6 +5877,7 @@ export declare class ServerError extends Error {
5801
5877
  response: ErrorProps['response']
5802
5878
  statusCode: ErrorProps['statusCode']
5803
5879
  responseBody: ErrorProps['responseBody']
5880
+ traceId: ErrorProps['traceId']
5804
5881
  details: ErrorProps['details']
5805
5882
  constructor(res: Any)
5806
5883
  }
package/dist/index.d.ts CHANGED
@@ -811,6 +811,32 @@ export declare interface ClientConfig {
811
811
  * Lineage token for recursion control
812
812
  */
813
813
  lineage?: string
814
+ /**
815
+ * A custom request handler that intercepts all HTTP requests made by the client.
816
+ *
817
+ * Useful for logging, adding custom headers, refreshing auth tokens, rate limiting, etc.
818
+ *
819
+ * When using `withConfig()`, the new handler **replaces** the previous one (it does not
820
+ * wrap it). To compose handlers, you can chain them manually:
821
+ *
822
+ * ```ts
823
+ * const parent = createClient({...config, _requestHandler: handlerA})
824
+ * const child = parent.withConfig({
825
+ * _requestHandler: (req, defaultRequester) =>
826
+ * handlerB(req, (opts) => handlerA(opts, defaultRequester)),
827
+ * })
828
+ * ```
829
+ *
830
+ * Setting `_requestHandler` to `undefined` via `withConfig()` removes the handler.
831
+ *
832
+ * Note: This only applies to HTTP requests. Real-time listener connections
833
+ * (`client.listen()`) use EventSource and are not intercepted by this handler.
834
+ *
835
+ * @internal
836
+ * @deprecated Don't use outside of Sanity internals
837
+ * @see {@link RequestHandler}
838
+ */
839
+ _requestHandler?: RequestHandler
814
840
  }
815
841
 
816
842
  declare type ClientConfigResource =
@@ -836,6 +862,7 @@ export declare class ClientError extends Error {
836
862
  response: ErrorProps['response']
837
863
  statusCode: ErrorProps['statusCode']
838
864
  responseBody: ErrorProps['responseBody']
865
+ traceId: ErrorProps['traceId']
839
866
  details: ErrorProps['details']
840
867
  constructor(res: Any, context?: HttpContext)
841
868
  }
@@ -1383,6 +1410,7 @@ export declare interface ErrorProps {
1383
1410
  response: Any
1384
1411
  statusCode: number
1385
1412
  responseBody: Any
1413
+ traceId?: string
1386
1414
  details: Any
1387
1415
  }
1388
1416
 
@@ -1533,7 +1561,11 @@ export declare type FitMode = 'preserve' | 'stretch' | 'crop' | 'smartcrop' | 'p
1533
1561
  * @returns A formatted error message string.
1534
1562
  * @public
1535
1563
  */
1536
- export declare function formatQueryParseError(error: QueryParseError, tag?: string | null): string
1564
+ export declare function formatQueryParseError(
1565
+ error: QueryParseError,
1566
+ tag?: string | null,
1567
+ traceId?: string,
1568
+ ): string
1537
1569
 
1538
1570
  /** @beta */
1539
1571
  declare type GenerateAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
@@ -2153,6 +2185,7 @@ export declare class LiveClient {
2153
2185
  events({
2154
2186
  includeDrafts,
2155
2187
  tag: _tag,
2188
+ waitFor,
2156
2189
  }?: {
2157
2190
  includeDrafts?: boolean
2158
2191
  /**
@@ -2161,6 +2194,11 @@ export declare class LiveClient {
2161
2194
  * @defaultValue `undefined`
2162
2195
  */
2163
2196
  tag?: string
2197
+ /**
2198
+ * Delays events until after a Sanity Function has processed them and called the callback endpoint.
2199
+ * When omitted, events are delivered immediately.
2200
+ */
2201
+ waitFor?: 'function'
2164
2202
  }): Observable<LiveEvent>
2165
2203
  }
2166
2204
 
@@ -4770,6 +4808,44 @@ export declare interface ReplaceVersionAction {
4770
4808
  /** @public */
4771
4809
  export declare const requester: Requester
4772
4810
 
4811
+ /**
4812
+ * A function that intercepts HTTP requests made by the client.
4813
+ *
4814
+ * Receives the resolved request options, a `defaultRequester` function that
4815
+ * executes the request through the normal pipeline, and a `client` instance
4816
+ * without a `_requestHandler` (to avoid recursive interception).
4817
+ *
4818
+ * The consumer can:
4819
+ * - Modify request options before calling `defaultRequester`
4820
+ * - Transform the response stream (e.g. via `pipe`)
4821
+ * - Skip `defaultRequester` entirely and return a custom Observable
4822
+ * - Use `client` to make additional requests (e.g. refresh an auth token on 401)
4823
+ *
4824
+ * When set via `withConfig()`, the new handler **replaces** (not wraps) the previous one.
4825
+ *
4826
+ * Note: This only applies to HTTP requests. Real-time listener connections
4827
+ * (`client.listen()`) use EventSource and are not intercepted by this handler.
4828
+ *
4829
+ * @param request - The resolved request options including `url`
4830
+ * @param defaultRequester - Executes the request through the normal pipeline
4831
+ * @param client - A client instance with the same configuration but without a `_requestHandler`,
4832
+ * useful for making side requests (e.g. token refresh) without triggering the handler recursively
4833
+ *
4834
+ * @internal
4835
+ * @deprecated Don't use outside of Sanity internals
4836
+ */
4837
+ export declare type RequestHandler = (
4838
+ request: RequestOptions & {
4839
+ url: string
4840
+ },
4841
+ defaultRequester: (
4842
+ options: RequestOptions & {
4843
+ url: string
4844
+ },
4845
+ ) => Observable<HttpRequestEvent>,
4846
+ client: SanityClient,
4847
+ ) => Observable<HttpRequestEvent>
4848
+
4773
4849
  /** @internal */
4774
4850
  export declare interface RequestObservableOptions extends Omit<RequestOptions, 'url'> {
4775
4851
  url?: string
@@ -5801,6 +5877,7 @@ export declare class ServerError extends Error {
5801
5877
  response: ErrorProps['response']
5802
5878
  statusCode: ErrorProps['statusCode']
5803
5879
  responseBody: ErrorProps['responseBody']
5880
+ traceId: ErrorProps['traceId']
5804
5881
  details: ErrorProps['details']
5805
5882
  constructor(res: Any)
5806
5883
  }
package/dist/index.js CHANGED
@@ -87,6 +87,7 @@ class ClientError extends Error {
87
87
  response;
88
88
  statusCode = 400;
89
89
  responseBody;
90
+ traceId;
90
91
  details;
91
92
  constructor(res, context) {
92
93
  const props = extractErrorProps(res, context);
@@ -97,6 +98,7 @@ class ServerError extends Error {
97
98
  response;
98
99
  statusCode = 500;
99
100
  responseBody;
101
+ traceId;
100
102
  details;
101
103
  constructor(res) {
102
104
  const props = extractErrorProps(res);
@@ -108,29 +110,30 @@ function extractErrorProps(res, context) {
108
110
  response: res,
109
111
  statusCode: res.statusCode,
110
112
  responseBody: stringifyBody(body, res),
113
+ traceId: extractTraceId(res),
111
114
  message: "",
112
115
  details: void 0
113
116
  };
114
117
  if (!isRecord(body))
115
- return props.message = httpErrorMessage(res, body), props;
118
+ return props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`, props;
116
119
  const error = body.error;
117
120
  if (typeof error == "string" && typeof body.message == "string")
118
- return props.message = `${error} - ${body.message}`, props;
121
+ return props.message = `${error} - ${body.message}${formatTraceId(props.traceId)}`, props;
119
122
  if (typeof error != "object" || error === null)
120
- return typeof error == "string" ? props.message = error : typeof body.message == "string" ? props.message = body.message : props.message = httpErrorMessage(res, body), props;
123
+ return typeof error == "string" ? props.message = `${error}${formatTraceId(props.traceId)}` : typeof body.message == "string" ? props.message = `${body.message}${formatTraceId(props.traceId)}` : props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`, props;
121
124
  if (isMutationError(error) || isActionError(error)) {
122
125
  const allItems = error.items || [], items = allItems.slice(0, MAX_ITEMS_IN_ERROR_MESSAGE).map((item) => item.error?.description).filter(Boolean);
123
126
  let itemsStr = items.length ? `:
124
127
  - ${items.join(`
125
128
  - `)}` : "";
126
129
  return allItems.length > MAX_ITEMS_IN_ERROR_MESSAGE && (itemsStr += `
127
- ...and ${allItems.length - MAX_ITEMS_IN_ERROR_MESSAGE} more`), props.message = `${error.description}${itemsStr}`, props.details = body.error, props;
130
+ ...and ${allItems.length - MAX_ITEMS_IN_ERROR_MESSAGE} more`), props.message = `${error.description}${formatTraceId(props.traceId)}${itemsStr}`, props.details = body.error, props;
128
131
  }
129
132
  if (isQueryParseError(error)) {
130
133
  const tag = context?.options?.query?.tag;
131
- return props.message = formatQueryParseError(error, tag), props.details = body.error, props;
134
+ return props.message = formatQueryParseError(error, tag, props.traceId), props.details = body.error, props;
132
135
  }
133
- return "description" in error && typeof error.description == "string" ? (props.message = error.description, props.details = error, props) : (props.message = httpErrorMessage(res, body), props);
136
+ return "description" in error && typeof error.description == "string" ? (props.message = `${error.description}${formatTraceId(props.traceId)}`, props.details = error, props) : (props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`, props);
134
137
  }
135
138
  function isMutationError(error) {
136
139
  return "type" in error && error.type === "mutationError" && "description" in error && typeof error.description == "string";
@@ -141,23 +144,32 @@ function isActionError(error) {
141
144
  function isQueryParseError(error) {
142
145
  return isRecord(error) && error.type === "queryParseError" && typeof error.query == "string" && typeof error.start == "number" && typeof error.end == "number";
143
146
  }
144
- function formatQueryParseError(error, tag) {
145
- const { query, start, end, description } = error;
147
+ function formatQueryParseError(error, tag, traceId) {
148
+ const { query, start, end, description } = error, withTraceId = traceId ? `
149
+ (traceId: ${traceId})` : "";
146
150
  if (!query || typeof start > "u")
147
- return `GROQ query parse error: ${description}`;
151
+ return `GROQ query parse error: ${description}${withTraceId}`;
148
152
  const withTag = tag ? `
149
153
 
150
154
  Tag: ${tag}` : "";
151
155
  return `GROQ query parse error:
152
- ${codeFrame(query, { start, end }, description)}${withTag}`;
156
+ ${codeFrame(query, { start, end }, description)}${withTag}${withTraceId}`;
153
157
  }
154
158
  function httpErrorMessage(res, body) {
155
159
  const details = typeof body == "string" ? ` (${sliceWithEllipsis(body, 100)})` : "", statusMessage = res.statusMessage ? ` ${res.statusMessage}` : "";
156
160
  return `${res.method}-request to ${res.url} resulted in HTTP ${res.statusCode}${statusMessage}${details}`;
157
161
  }
162
+ function extractTraceId(res) {
163
+ const traceparent = res?.headers?.traceparent;
164
+ if (traceparent)
165
+ return traceparent.split("-")[1];
166
+ }
158
167
  function stringifyBody(body, res) {
159
168
  return (res.headers["content-type"] || "").toLowerCase().indexOf("application/json") !== -1 ? JSON.stringify(body, null, 2) : body;
160
169
  }
170
+ function formatTraceId(traceId) {
171
+ return traceId ? ` (traceId: ${traceId})` : "";
172
+ }
161
173
  function sliceWithEllipsis(str, max) {
162
174
  return str.length > max ? `${str.slice(0, max)}\u2026` : str;
163
175
  }
@@ -1269,7 +1281,8 @@ class LiveClient {
1269
1281
  */
1270
1282
  events({
1271
1283
  includeDrafts = !1,
1272
- tag: _tag
1284
+ tag: _tag,
1285
+ waitFor
1273
1286
  } = {}) {
1274
1287
  const {
1275
1288
  projectId,
@@ -1288,7 +1301,7 @@ class LiveClient {
1288
1301
  "The live events API requires a token or withCredentials when 'includeDrafts: true'. Please update your client configuration. The token should have the lowest possible access role."
1289
1302
  );
1290
1303
  const path = _getDataUrl(this.#client, "live/events"), url = new URL(this.#client.getUrl(path, !1)), tag = _tag && requestTagPrefix ? [requestTagPrefix, _tag].join(".") : _tag;
1291
- tag && url.searchParams.set("tag", tag), includeDrafts && url.searchParams.set("includeDrafts", "true");
1304
+ tag && url.searchParams.set("tag", tag), includeDrafts && url.searchParams.set("includeDrafts", "true"), waitFor && url.searchParams.set("waitFor", waitFor);
1292
1305
  const esOptions = {};
1293
1306
  includeDrafts && withCredentials && (esOptions.withCredentials = !0), (includeDrafts && token || configHeaders) && (esOptions.headers = {}, includeDrafts && token && (esOptions.headers.Authorization = `Bearer ${token}`), configHeaders && Object.assign(esOptions.headers, configHeaders));
1294
1307
  const key = `${url.href}::${JSON.stringify(esOptions)}`, existing = eventsCache.get(key);
@@ -2186,13 +2199,22 @@ class ObservableSanityClient {
2186
2199
  * Private properties
2187
2200
  */
2188
2201
  #clientConfig;
2202
+ #originalHttpRequest;
2189
2203
  #httpRequest;
2190
2204
  /**
2191
2205
  * Instance properties
2192
2206
  */
2193
2207
  listen = _listen;
2194
2208
  constructor(httpRequest, config = defaultConfig) {
2195
- this.config(config), this.#httpRequest = httpRequest, this.assets = new ObservableAssetsClient(this, this.#httpRequest), this.datasets = new ObservableDatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.mediaLibrary = {
2209
+ this.config(config), this.#originalHttpRequest = httpRequest;
2210
+ const requestHandler = config._requestHandler;
2211
+ this.#httpRequest = requestHandler ? /* @__PURE__ */ (() => {
2212
+ let bareClient;
2213
+ return (options, requester2) => {
2214
+ const opts = options;
2215
+ return bareClient || (bareClient = new SanityClient(httpRequest, { ...config, _requestHandler: void 0 })), requestHandler(opts, (o) => httpRequest(o, requester2), bareClient);
2216
+ };
2217
+ })() : httpRequest, this.assets = new ObservableAssetsClient(this, this.#httpRequest), this.datasets = new ObservableDatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.mediaLibrary = {
2196
2218
  video: new ObservableMediaLibraryVideoClient(this, this.#httpRequest)
2197
2219
  }, this.projects = new ObservableProjectsClient(this, this.#httpRequest), this.users = new ObservableUsersClient(this, this.#httpRequest), this.agent = {
2198
2220
  action: new ObservableAgentsActionClient(this, this.#httpRequest)
@@ -2202,7 +2224,7 @@ class ObservableSanityClient {
2202
2224
  * Clone the client - returns a new instance
2203
2225
  */
2204
2226
  clone() {
2205
- return new ObservableSanityClient(this.#httpRequest, this.config());
2227
+ return new ObservableSanityClient(this.#originalHttpRequest, this.config());
2206
2228
  }
2207
2229
  config(newConfig) {
2208
2230
  if (newConfig === void 0)
@@ -2220,7 +2242,7 @@ class ObservableSanityClient {
2220
2242
  */
2221
2243
  withConfig(newConfig) {
2222
2244
  const thisConfig = this.config();
2223
- return new ObservableSanityClient(this.#httpRequest, {
2245
+ return new ObservableSanityClient(this.#originalHttpRequest, {
2224
2246
  ...thisConfig,
2225
2247
  ...newConfig,
2226
2248
  stega: {
@@ -2450,13 +2472,22 @@ class SanityClient {
2450
2472
  * Private properties
2451
2473
  */
2452
2474
  #clientConfig;
2475
+ #originalHttpRequest;
2453
2476
  #httpRequest;
2454
2477
  /**
2455
2478
  * Instance properties
2456
2479
  */
2457
2480
  listen = _listen;
2458
2481
  constructor(httpRequest, config = defaultConfig) {
2459
- this.config(config), this.#httpRequest = httpRequest, this.assets = new AssetsClient(this, this.#httpRequest), this.datasets = new DatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.mediaLibrary = {
2482
+ this.config(config), this.#originalHttpRequest = httpRequest;
2483
+ const requestHandler = config._requestHandler;
2484
+ this.#httpRequest = requestHandler ? /* @__PURE__ */ (() => {
2485
+ let bareClient;
2486
+ return (options, requester2) => {
2487
+ const opts = options;
2488
+ return bareClient || (bareClient = new SanityClient(httpRequest, { ...config, _requestHandler: void 0 })), requestHandler(opts, (o) => httpRequest(o, requester2), bareClient);
2489
+ };
2490
+ })() : httpRequest, this.assets = new AssetsClient(this, this.#httpRequest), this.datasets = new DatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.mediaLibrary = {
2460
2491
  video: new MediaLibraryVideoClient(this, this.#httpRequest)
2461
2492
  }, this.projects = new ProjectsClient(this, this.#httpRequest), this.users = new UsersClient(this, this.#httpRequest), this.agent = {
2462
2493
  action: new AgentActionsClient(this, this.#httpRequest)
@@ -2466,7 +2497,7 @@ class SanityClient {
2466
2497
  * Clone the client - returns a new instance
2467
2498
  */
2468
2499
  clone() {
2469
- return new SanityClient(this.#httpRequest, this.config());
2500
+ return new SanityClient(this.#originalHttpRequest, this.config());
2470
2501
  }
2471
2502
  config(newConfig) {
2472
2503
  if (newConfig === void 0)
@@ -2484,7 +2515,7 @@ class SanityClient {
2484
2515
  */
2485
2516
  withConfig(newConfig) {
2486
2517
  const thisConfig = this.config();
2487
- return new SanityClient(this.#httpRequest, {
2518
+ return new SanityClient(this.#originalHttpRequest, {
2488
2519
  ...thisConfig,
2489
2520
  ...newConfig,
2490
2521
  stega: {
@@ -2755,7 +2786,7 @@ function defineDeprecatedCreateClient(createClient2) {
2755
2786
  return printNoDefaultExport(), createClient2(config);
2756
2787
  };
2757
2788
  }
2758
- var name = "@sanity/client", version = "7.20.0";
2789
+ var name = "@sanity/client", version = "7.22.0";
2759
2790
  const middleware = [
2760
2791
  debug({ verbose: !0, namespace: "sanity:client" }),
2761
2792
  headers({ "User-Agent": `${name} ${version}` }),