@sanity/client 7.6.0 → 7.7.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.
@@ -692,6 +692,30 @@ export declare interface ClientConfig {
692
692
  */
693
693
  headers?: Record<string, string>
694
694
  ignoreBrowserTokenWarning?: boolean
695
+ /**
696
+ * Ignore specific warning messages from the client.
697
+ *
698
+ * @remarks
699
+ * - String values perform substring matching (not exact matching) against warning messages
700
+ * - RegExp values are tested against the full warning message
701
+ * - Array values allow multiple patterns to be specified
702
+ *
703
+ * @example
704
+ * ```typescript
705
+ * // Ignore warnings containing "experimental"
706
+ * ignoreWarnings: 'experimental'
707
+ *
708
+ * // Ignore multiple warning types
709
+ * ignoreWarnings: ['experimental', 'deprecated']
710
+ *
711
+ * // Use regex for exact matching
712
+ * ignoreWarnings: /^This is an experimental API version$/
713
+ *
714
+ * // Mix strings and regex patterns
715
+ * ignoreWarnings: ['rate limit', /^deprecated/i]
716
+ * ```
717
+ */
718
+ ignoreWarnings?: string | RegExp | Array<string | RegExp>
695
719
  withCredentials?: boolean
696
720
  allowReconfigure?: boolean
697
721
  timeout?: number
@@ -1385,6 +1409,26 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
1385
1409
  */
1386
1410
  export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
1387
1411
 
1412
+ /**
1413
+ * A string constant containing the experimental API version warning message.
1414
+ * Use this with the `ignoreWarnings` option to suppress warnings when using experimental API versions.
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * import { createClient, EXPERIMENTAL_API_WARNING } from '@sanity/client'
1419
+ *
1420
+ * const client = createClient({
1421
+ * projectId: 'your-project-id',
1422
+ * dataset: 'production',
1423
+ * apiVersion: 'vX', // experimental version
1424
+ * ignoreWarnings: EXPERIMENTAL_API_WARNING
1425
+ * })
1426
+ * ```
1427
+ *
1428
+ * @public
1429
+ */
1430
+ export declare const EXPERIMENTAL_API_WARNING = 'This is an experimental API version'
1431
+
1388
1432
  /**
1389
1433
  *
1390
1434
  *
@@ -1849,6 +1893,25 @@ export declare interface GroqAgentActionParam {
1849
1893
  params?: Record<string, string>
1850
1894
  }
1851
1895
 
1896
+ /**
1897
+ * Shared properties for HTTP errors (eg both ClientError and ServerError)
1898
+ * Use `isHttpError` for type narrowing and accessing response properties.
1899
+ *
1900
+ * @public
1901
+ */
1902
+ export declare interface HttpError {
1903
+ statusCode: number
1904
+ message: string
1905
+ response: {
1906
+ body: unknown
1907
+ url: string
1908
+ method: string
1909
+ headers: Record<string, string>
1910
+ statusCode: number
1911
+ statusMessage: string | null
1912
+ }
1913
+ }
1914
+
1852
1915
  /** @public */
1853
1916
  export declare type HttpRequest = {
1854
1917
  (options: RequestOptions, requester: Requester): ReturnType<Requester>
@@ -1968,6 +2031,15 @@ export declare type InsertPatch =
1968
2031
  items: Any[]
1969
2032
  }
1970
2033
 
2034
+ /**
2035
+ * Checks if the provided error is an HTTP error.
2036
+ *
2037
+ * @param error - The error to check.
2038
+ * @returns `true` if the error is an HTTP error, `false` otherwise.
2039
+ * @public
2040
+ */
2041
+ export declare function isHttpError(error: unknown): error is HttpError
2042
+
1971
2043
  /** @internal */
1972
2044
  export declare function isQueryParseError(error: object): error is QueryParseError
1973
2045
 
@@ -692,6 +692,30 @@ export declare interface ClientConfig {
692
692
  */
693
693
  headers?: Record<string, string>
694
694
  ignoreBrowserTokenWarning?: boolean
695
+ /**
696
+ * Ignore specific warning messages from the client.
697
+ *
698
+ * @remarks
699
+ * - String values perform substring matching (not exact matching) against warning messages
700
+ * - RegExp values are tested against the full warning message
701
+ * - Array values allow multiple patterns to be specified
702
+ *
703
+ * @example
704
+ * ```typescript
705
+ * // Ignore warnings containing "experimental"
706
+ * ignoreWarnings: 'experimental'
707
+ *
708
+ * // Ignore multiple warning types
709
+ * ignoreWarnings: ['experimental', 'deprecated']
710
+ *
711
+ * // Use regex for exact matching
712
+ * ignoreWarnings: /^This is an experimental API version$/
713
+ *
714
+ * // Mix strings and regex patterns
715
+ * ignoreWarnings: ['rate limit', /^deprecated/i]
716
+ * ```
717
+ */
718
+ ignoreWarnings?: string | RegExp | Array<string | RegExp>
695
719
  withCredentials?: boolean
696
720
  allowReconfigure?: boolean
697
721
  timeout?: number
@@ -1385,6 +1409,26 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
1385
1409
  */
1386
1410
  export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
1387
1411
 
1412
+ /**
1413
+ * A string constant containing the experimental API version warning message.
1414
+ * Use this with the `ignoreWarnings` option to suppress warnings when using experimental API versions.
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * import { createClient, EXPERIMENTAL_API_WARNING } from '@sanity/client'
1419
+ *
1420
+ * const client = createClient({
1421
+ * projectId: 'your-project-id',
1422
+ * dataset: 'production',
1423
+ * apiVersion: 'vX', // experimental version
1424
+ * ignoreWarnings: EXPERIMENTAL_API_WARNING
1425
+ * })
1426
+ * ```
1427
+ *
1428
+ * @public
1429
+ */
1430
+ export declare const EXPERIMENTAL_API_WARNING = 'This is an experimental API version'
1431
+
1388
1432
  /**
1389
1433
  *
1390
1434
  *
@@ -1849,6 +1893,25 @@ export declare interface GroqAgentActionParam {
1849
1893
  params?: Record<string, string>
1850
1894
  }
1851
1895
 
1896
+ /**
1897
+ * Shared properties for HTTP errors (eg both ClientError and ServerError)
1898
+ * Use `isHttpError` for type narrowing and accessing response properties.
1899
+ *
1900
+ * @public
1901
+ */
1902
+ export declare interface HttpError {
1903
+ statusCode: number
1904
+ message: string
1905
+ response: {
1906
+ body: unknown
1907
+ url: string
1908
+ method: string
1909
+ headers: Record<string, string>
1910
+ statusCode: number
1911
+ statusMessage: string | null
1912
+ }
1913
+ }
1914
+
1852
1915
  /** @public */
1853
1916
  export declare type HttpRequest = {
1854
1917
  (options: RequestOptions, requester: Requester): ReturnType<Requester>
@@ -1968,6 +2031,15 @@ export declare type InsertPatch =
1968
2031
  items: Any[]
1969
2032
  }
1970
2033
 
2034
+ /**
2035
+ * Checks if the provided error is an HTTP error.
2036
+ *
2037
+ * @param error - The error to check.
2038
+ * @returns `true` if the error is an HTTP error, `false` otherwise.
2039
+ * @public
2040
+ */
2041
+ export declare function isHttpError(error: unknown): error is HttpError
2042
+
1971
2043
  /** @internal */
1972
2044
  export declare function isQueryParseError(error: object): error is QueryParseError
1973
2045
 
package/dist/stega.d.cts CHANGED
@@ -692,6 +692,30 @@ export declare interface ClientConfig {
692
692
  */
693
693
  headers?: Record<string, string>
694
694
  ignoreBrowserTokenWarning?: boolean
695
+ /**
696
+ * Ignore specific warning messages from the client.
697
+ *
698
+ * @remarks
699
+ * - String values perform substring matching (not exact matching) against warning messages
700
+ * - RegExp values are tested against the full warning message
701
+ * - Array values allow multiple patterns to be specified
702
+ *
703
+ * @example
704
+ * ```typescript
705
+ * // Ignore warnings containing "experimental"
706
+ * ignoreWarnings: 'experimental'
707
+ *
708
+ * // Ignore multiple warning types
709
+ * ignoreWarnings: ['experimental', 'deprecated']
710
+ *
711
+ * // Use regex for exact matching
712
+ * ignoreWarnings: /^This is an experimental API version$/
713
+ *
714
+ * // Mix strings and regex patterns
715
+ * ignoreWarnings: ['rate limit', /^deprecated/i]
716
+ * ```
717
+ */
718
+ ignoreWarnings?: string | RegExp | Array<string | RegExp>
695
719
  withCredentials?: boolean
696
720
  allowReconfigure?: boolean
697
721
  timeout?: number
@@ -1385,6 +1409,26 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
1385
1409
  */
1386
1410
  export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
1387
1411
 
1412
+ /**
1413
+ * A string constant containing the experimental API version warning message.
1414
+ * Use this with the `ignoreWarnings` option to suppress warnings when using experimental API versions.
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * import { createClient, EXPERIMENTAL_API_WARNING } from '@sanity/client'
1419
+ *
1420
+ * const client = createClient({
1421
+ * projectId: 'your-project-id',
1422
+ * dataset: 'production',
1423
+ * apiVersion: 'vX', // experimental version
1424
+ * ignoreWarnings: EXPERIMENTAL_API_WARNING
1425
+ * })
1426
+ * ```
1427
+ *
1428
+ * @public
1429
+ */
1430
+ export declare const EXPERIMENTAL_API_WARNING = 'This is an experimental API version'
1431
+
1388
1432
  /**
1389
1433
  *
1390
1434
  *
@@ -1849,6 +1893,25 @@ export declare interface GroqAgentActionParam {
1849
1893
  params?: Record<string, string>
1850
1894
  }
1851
1895
 
1896
+ /**
1897
+ * Shared properties for HTTP errors (eg both ClientError and ServerError)
1898
+ * Use `isHttpError` for type narrowing and accessing response properties.
1899
+ *
1900
+ * @public
1901
+ */
1902
+ export declare interface HttpError {
1903
+ statusCode: number
1904
+ message: string
1905
+ response: {
1906
+ body: unknown
1907
+ url: string
1908
+ method: string
1909
+ headers: Record<string, string>
1910
+ statusCode: number
1911
+ statusMessage: string | null
1912
+ }
1913
+ }
1914
+
1852
1915
  /** @public */
1853
1916
  export declare type HttpRequest = {
1854
1917
  (options: RequestOptions, requester: Requester): ReturnType<Requester>
@@ -1968,6 +2031,15 @@ export declare type InsertPatch =
1968
2031
  items: Any[]
1969
2032
  }
1970
2033
 
2034
+ /**
2035
+ * Checks if the provided error is an HTTP error.
2036
+ *
2037
+ * @param error - The error to check.
2038
+ * @returns `true` if the error is an HTTP error, `false` otherwise.
2039
+ * @public
2040
+ */
2041
+ export declare function isHttpError(error: unknown): error is HttpError
2042
+
1971
2043
  /** @internal */
1972
2044
  export declare function isQueryParseError(error: object): error is QueryParseError
1973
2045
 
package/dist/stega.d.ts CHANGED
@@ -692,6 +692,30 @@ export declare interface ClientConfig {
692
692
  */
693
693
  headers?: Record<string, string>
694
694
  ignoreBrowserTokenWarning?: boolean
695
+ /**
696
+ * Ignore specific warning messages from the client.
697
+ *
698
+ * @remarks
699
+ * - String values perform substring matching (not exact matching) against warning messages
700
+ * - RegExp values are tested against the full warning message
701
+ * - Array values allow multiple patterns to be specified
702
+ *
703
+ * @example
704
+ * ```typescript
705
+ * // Ignore warnings containing "experimental"
706
+ * ignoreWarnings: 'experimental'
707
+ *
708
+ * // Ignore multiple warning types
709
+ * ignoreWarnings: ['experimental', 'deprecated']
710
+ *
711
+ * // Use regex for exact matching
712
+ * ignoreWarnings: /^This is an experimental API version$/
713
+ *
714
+ * // Mix strings and regex patterns
715
+ * ignoreWarnings: ['rate limit', /^deprecated/i]
716
+ * ```
717
+ */
718
+ ignoreWarnings?: string | RegExp | Array<string | RegExp>
695
719
  withCredentials?: boolean
696
720
  allowReconfigure?: boolean
697
721
  timeout?: number
@@ -1385,6 +1409,26 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
1385
1409
  */
1386
1410
  export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
1387
1411
 
1412
+ /**
1413
+ * A string constant containing the experimental API version warning message.
1414
+ * Use this with the `ignoreWarnings` option to suppress warnings when using experimental API versions.
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * import { createClient, EXPERIMENTAL_API_WARNING } from '@sanity/client'
1419
+ *
1420
+ * const client = createClient({
1421
+ * projectId: 'your-project-id',
1422
+ * dataset: 'production',
1423
+ * apiVersion: 'vX', // experimental version
1424
+ * ignoreWarnings: EXPERIMENTAL_API_WARNING
1425
+ * })
1426
+ * ```
1427
+ *
1428
+ * @public
1429
+ */
1430
+ export declare const EXPERIMENTAL_API_WARNING = 'This is an experimental API version'
1431
+
1388
1432
  /**
1389
1433
  *
1390
1434
  *
@@ -1849,6 +1893,25 @@ export declare interface GroqAgentActionParam {
1849
1893
  params?: Record<string, string>
1850
1894
  }
1851
1895
 
1896
+ /**
1897
+ * Shared properties for HTTP errors (eg both ClientError and ServerError)
1898
+ * Use `isHttpError` for type narrowing and accessing response properties.
1899
+ *
1900
+ * @public
1901
+ */
1902
+ export declare interface HttpError {
1903
+ statusCode: number
1904
+ message: string
1905
+ response: {
1906
+ body: unknown
1907
+ url: string
1908
+ method: string
1909
+ headers: Record<string, string>
1910
+ statusCode: number
1911
+ statusMessage: string | null
1912
+ }
1913
+ }
1914
+
1852
1915
  /** @public */
1853
1916
  export declare type HttpRequest = {
1854
1917
  (options: RequestOptions, requester: Requester): ReturnType<Requester>
@@ -1968,6 +2031,15 @@ export declare type InsertPatch =
1968
2031
  items: Any[]
1969
2032
  }
1970
2033
 
2034
+ /**
2035
+ * Checks if the provided error is an HTTP error.
2036
+ *
2037
+ * @param error - The error to check.
2038
+ * @returns `true` if the error is an HTTP error, `false` otherwise.
2039
+ * @public
2040
+ */
2041
+ export declare function isHttpError(error: unknown): error is HttpError
2042
+
1971
2043
  /** @internal */
1972
2044
  export declare function isQueryParseError(error: object): error is QueryParseError
1973
2045
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "7.6.0",
3
+ "version": "7.7.0",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -21,6 +21,8 @@ export {
21
21
  ClientError,
22
22
  CorsOriginError,
23
23
  formatQueryParseError,
24
+ type HttpError,
25
+ isHttpError,
24
26
  isQueryParseError,
25
27
  ServerError,
26
28
  } from './http/errors'
@@ -45,7 +47,9 @@ export default function defineCreateClientExports<
45
47
  const defaultRequester = defineHttpRequest(envMiddleware)
46
48
 
47
49
  const createClient = (config: ClientConfigType) => {
48
- const clientRequester = defineHttpRequest(envMiddleware)
50
+ const clientRequester = defineHttpRequest(envMiddleware, {
51
+ ignoreWarnings: config.ignoreWarnings,
52
+ })
49
53
  return new ClassConstructor(
50
54
  (options, requester) =>
51
55
  (requester || clientRequester)({
@@ -6,6 +6,59 @@ import {isRecord} from '../util/isRecord'
6
6
 
7
7
  const MAX_ITEMS_IN_ERROR_MESSAGE = 5
8
8
 
9
+ /**
10
+ * Shared properties for HTTP errors (eg both ClientError and ServerError)
11
+ * Use `isHttpError` for type narrowing and accessing response properties.
12
+ *
13
+ * @public
14
+ */
15
+ export interface HttpError {
16
+ statusCode: number
17
+ message: string
18
+ response: {
19
+ body: unknown
20
+ url: string
21
+ method: string
22
+ headers: Record<string, string>
23
+ statusCode: number
24
+ statusMessage: string | null
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Checks if the provided error is an HTTP error.
30
+ *
31
+ * @param error - The error to check.
32
+ * @returns `true` if the error is an HTTP error, `false` otherwise.
33
+ * @public
34
+ */
35
+ export function isHttpError(error: unknown): error is HttpError {
36
+ if (!isRecord(error)) {
37
+ return false
38
+ }
39
+
40
+ const response = error.response
41
+ if (
42
+ typeof error.statusCode !== 'number' ||
43
+ typeof error.message !== 'string' ||
44
+ !isRecord(response)
45
+ ) {
46
+ return false
47
+ }
48
+
49
+ if (
50
+ typeof response.body === 'undefined' ||
51
+ typeof response.url !== 'string' ||
52
+ typeof response.method !== 'string' ||
53
+ typeof response.headers !== 'object' ||
54
+ typeof response.statusCode !== 'number'
55
+ ) {
56
+ return false
57
+ }
58
+
59
+ return true
60
+ }
61
+
9
62
  /** @public */
10
63
  export class ClientError extends Error {
11
64
  response: ErrorProps['response']
@@ -17,14 +17,39 @@ const httpError = {
17
17
  },
18
18
  }
19
19
 
20
- function printWarnings() {
20
+ function printWarnings(config: {ignoreWarnings?: string | RegExp | Array<string | RegExp>} = {}) {
21
21
  const seen: Record<string, boolean> = {}
22
+
23
+ // Helper function to check if a warning should be ignored
24
+ const shouldIgnoreWarning = (message: string): boolean => {
25
+ if (config.ignoreWarnings === undefined) return false
26
+
27
+ const patterns = Array.isArray(config.ignoreWarnings)
28
+ ? config.ignoreWarnings
29
+ : [config.ignoreWarnings]
30
+
31
+ return patterns.some((pattern) => {
32
+ if (typeof pattern === 'string') {
33
+ return message.includes(pattern)
34
+ } else if (pattern instanceof RegExp) {
35
+ return pattern.test(message)
36
+ }
37
+ return false
38
+ })
39
+ }
40
+
22
41
  return {
23
42
  onResponse: (res: Any) => {
24
43
  const warn = res.headers['x-sanity-warning']
25
44
  const warnings = Array.isArray(warn) ? warn : [warn]
26
45
  for (const msg of warnings) {
27
46
  if (!msg || seen[msg]) continue
47
+
48
+ // Skip warnings that match ignore patterns
49
+ if (shouldIgnoreWarning(msg)) {
50
+ continue
51
+ }
52
+
28
53
  seen[msg] = true
29
54
  console.warn(msg) // eslint-disable-line no-console
30
55
  }
@@ -34,11 +59,14 @@ function printWarnings() {
34
59
  }
35
60
 
36
61
  /** @internal */
37
- export function defineHttpRequest(envMiddleware: Middlewares): Requester {
62
+ export function defineHttpRequest(
63
+ envMiddleware: Middlewares,
64
+ config: {ignoreWarnings?: string | RegExp | Array<string | RegExp>} = {},
65
+ ): Requester {
38
66
  return getIt([
39
67
  retry({shouldRetry}),
40
68
  ...envMiddleware,
41
- printWarnings(),
69
+ printWarnings(config),
42
70
  jsonRequest(),
43
71
  jsonResponse(),
44
72
  progress(),
package/src/types.ts CHANGED
@@ -111,6 +111,30 @@ export interface ClientConfig {
111
111
  headers?: Record<string, string>
112
112
 
113
113
  ignoreBrowserTokenWarning?: boolean
114
+ /**
115
+ * Ignore specific warning messages from the client.
116
+ *
117
+ * @remarks
118
+ * - String values perform substring matching (not exact matching) against warning messages
119
+ * - RegExp values are tested against the full warning message
120
+ * - Array values allow multiple patterns to be specified
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * // Ignore warnings containing "experimental"
125
+ * ignoreWarnings: 'experimental'
126
+ *
127
+ * // Ignore multiple warning types
128
+ * ignoreWarnings: ['experimental', 'deprecated']
129
+ *
130
+ * // Use regex for exact matching
131
+ * ignoreWarnings: /^This is an experimental API version$/
132
+ *
133
+ * // Mix strings and regex patterns
134
+ * ignoreWarnings: ['rate limit', /^deprecated/i]
135
+ * ```
136
+ */
137
+ ignoreWarnings?: string | RegExp | Array<string | RegExp>
114
138
  withCredentials?: boolean
115
139
  allowReconfigure?: boolean
116
140
  timeout?: number
@@ -1660,3 +1684,23 @@ export type {
1660
1684
  StudioBaseUrl,
1661
1685
  StudioUrl,
1662
1686
  } from './stega/types'
1687
+
1688
+ /**
1689
+ * A string constant containing the experimental API version warning message.
1690
+ * Use this with the `ignoreWarnings` option to suppress warnings when using experimental API versions.
1691
+ *
1692
+ * @example
1693
+ * ```typescript
1694
+ * import { createClient, EXPERIMENTAL_API_WARNING } from '@sanity/client'
1695
+ *
1696
+ * const client = createClient({
1697
+ * projectId: 'your-project-id',
1698
+ * dataset: 'production',
1699
+ * apiVersion: 'vX', // experimental version
1700
+ * ignoreWarnings: EXPERIMENTAL_API_WARNING
1701
+ * })
1702
+ * ```
1703
+ *
1704
+ * @public
1705
+ */
1706
+ export const EXPERIMENTAL_API_WARNING = 'This is an experimental API version'
@@ -2049,6 +2049,12 @@
2049
2049
  };
2050
2050
  }
2051
2051
  const MAX_ITEMS_IN_ERROR_MESSAGE = 5;
2052
+ function isHttpError(error) {
2053
+ if (!isRecord(error))
2054
+ return false;
2055
+ const response = error.response;
2056
+ return !(typeof error.statusCode != "number" || typeof error.message != "string" || !isRecord(response) || typeof response.body > "u" || typeof response.url != "string" || typeof response.method != "string" || typeof response.headers != "object" || typeof response.statusCode != "number");
2057
+ }
2052
2058
  class ClientError extends Error {
2053
2059
  response;
2054
2060
  statusCode = 400;
@@ -2149,22 +2155,22 @@ ${codeFrame(query, { start, end }, description)}${withTag}`;
2149
2155
  return res;
2150
2156
  }
2151
2157
  };
2152
- function printWarnings() {
2153
- const seen = {};
2158
+ function printWarnings(config = {}) {
2159
+ const seen = {}, shouldIgnoreWarning = (message) => config.ignoreWarnings === void 0 ? false : (Array.isArray(config.ignoreWarnings) ? config.ignoreWarnings : [config.ignoreWarnings]).some((pattern) => typeof pattern == "string" ? message.includes(pattern) : pattern instanceof RegExp ? pattern.test(message) : false);
2154
2160
  return {
2155
2161
  onResponse: (res) => {
2156
2162
  const warn = res.headers["x-sanity-warning"], warnings = Array.isArray(warn) ? warn : [warn];
2157
2163
  for (const msg of warnings)
2158
- !msg || seen[msg] || (seen[msg] = true, console.warn(msg));
2164
+ !msg || seen[msg] || shouldIgnoreWarning(msg) || (seen[msg] = true, console.warn(msg));
2159
2165
  return res;
2160
2166
  }
2161
2167
  };
2162
2168
  }
2163
- function defineHttpRequest(envMiddleware2) {
2169
+ function defineHttpRequest(envMiddleware2, config = {}) {
2164
2170
  return p$1([
2165
2171
  P({ shouldRetry }),
2166
2172
  ...envMiddleware2,
2167
- printWarnings(),
2173
+ printWarnings(config),
2168
2174
  x(),
2169
2175
  E$1(),
2170
2176
  S$1(),
@@ -2254,7 +2260,7 @@ ${codeFrame(query, { start, end }, description)}${withTag}`;
2254
2260
  }, resourceGuard = (service, config) => {
2255
2261
  if (config["~experimental_resource"])
2256
2262
  throw new Error(`\`${service}\` does not support resource-based operations`);
2257
- };
2263
+ }, EXPERIMENTAL_API_WARNING = "This is an experimental API version";
2258
2264
  function once(fn) {
2259
2265
  let didCall = false, returnValue;
2260
2266
  return (...args) => (didCall || (returnValue = fn(...args), didCall = true), returnValue);
@@ -4635,7 +4641,9 @@ ${selectionOpts}`);
4635
4641
  }
4636
4642
  function defineCreateClientExports(envMiddleware2, ClassConstructor) {
4637
4643
  return { requester: defineHttpRequest(envMiddleware2), createClient: (config) => {
4638
- const clientRequester = defineHttpRequest(envMiddleware2);
4644
+ const clientRequester = defineHttpRequest(envMiddleware2, {
4645
+ ignoreWarnings: config.ignoreWarnings
4646
+ });
4639
4647
  return new ClassConstructor(
4640
4648
  (options, requester2) => (requester2 || clientRequester)({
4641
4649
  maxRedirects: 0,
@@ -6095,6 +6103,7 @@ ${selectionOpts}`);
6095
6103
  exports.ConnectionFailedError = ConnectionFailedError;
6096
6104
  exports.CorsOriginError = CorsOriginError;
6097
6105
  exports.DisconnectError = DisconnectError;
6106
+ exports.EXPERIMENTAL_API_WARNING = EXPERIMENTAL_API_WARNING;
6098
6107
  exports.MessageError = MessageError;
6099
6108
  exports.MessageParseError = MessageParseError;
6100
6109
  exports.ObservablePatch = ObservablePatch;
@@ -6108,6 +6117,7 @@ ${selectionOpts}`);
6108
6117
  exports.createClient = createClient;
6109
6118
  exports.default = deprecatedCreateClient;
6110
6119
  exports.formatQueryParseError = formatQueryParseError;
6120
+ exports.isHttpError = isHttpError;
6111
6121
  exports.isQueryParseError = isQueryParseError;
6112
6122
  exports.requester = requester;
6113
6123
  exports.unstable__adapter = c$2;