@sanity/client 7.11.2 → 7.12.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.browser.cjs +1 -0
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +4 -0
- package/dist/index.browser.d.ts +4 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +4 -0
- package/dist/stega.browser.d.ts +4 -0
- package/dist/stega.d.cts +4 -0
- package/dist/stega.d.ts +4 -0
- package/package.json +1 -1
- package/src/defineCreateClient.ts +1 -0
- package/src/http/nodeMiddleware.ts +18 -1
- package/src/http/request.ts +5 -1
- package/src/types.ts +4 -0
- package/umd/sanityClient.js +1 -0
- package/umd/sanityClient.min.js +1 -1
package/dist/stega.browser.d.cts
CHANGED
|
@@ -780,6 +780,10 @@ export declare interface ClientConfig {
|
|
|
780
780
|
* Options for how, if enabled, Content Source Maps are encoded into query results using steganography
|
|
781
781
|
*/
|
|
782
782
|
stega?: StegaConfig | boolean
|
|
783
|
+
/**
|
|
784
|
+
* Lineage token for recursion control
|
|
785
|
+
*/
|
|
786
|
+
lineage?: string
|
|
783
787
|
}
|
|
784
788
|
|
|
785
789
|
declare type ClientConfigResource =
|
package/dist/stega.browser.d.ts
CHANGED
|
@@ -780,6 +780,10 @@ export declare interface ClientConfig {
|
|
|
780
780
|
* Options for how, if enabled, Content Source Maps are encoded into query results using steganography
|
|
781
781
|
*/
|
|
782
782
|
stega?: StegaConfig | boolean
|
|
783
|
+
/**
|
|
784
|
+
* Lineage token for recursion control
|
|
785
|
+
*/
|
|
786
|
+
lineage?: string
|
|
783
787
|
}
|
|
784
788
|
|
|
785
789
|
declare type ClientConfigResource =
|
package/dist/stega.d.cts
CHANGED
|
@@ -780,6 +780,10 @@ export declare interface ClientConfig {
|
|
|
780
780
|
* Options for how, if enabled, Content Source Maps are encoded into query results using steganography
|
|
781
781
|
*/
|
|
782
782
|
stega?: StegaConfig | boolean
|
|
783
|
+
/**
|
|
784
|
+
* Lineage token for recursion control
|
|
785
|
+
*/
|
|
786
|
+
lineage?: string
|
|
783
787
|
}
|
|
784
788
|
|
|
785
789
|
declare type ClientConfigResource =
|
package/dist/stega.d.ts
CHANGED
|
@@ -780,6 +780,10 @@ export declare interface ClientConfig {
|
|
|
780
780
|
* Options for how, if enabled, Content Source Maps are encoded into query results using steganography
|
|
781
781
|
*/
|
|
782
782
|
stega?: StegaConfig | boolean
|
|
783
|
+
/**
|
|
784
|
+
* Lineage token for recursion control
|
|
785
|
+
*/
|
|
786
|
+
lineage?: string
|
|
783
787
|
}
|
|
784
788
|
|
|
785
789
|
declare type ClientConfigResource =
|
package/package.json
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
import type {Middleware, RequestOptions} from 'get-it'
|
|
1
2
|
import {agent, debug, headers} from 'get-it/middleware'
|
|
2
3
|
|
|
3
4
|
import {name, version} from '../../package.json'
|
|
4
5
|
|
|
5
|
-
const middleware = [
|
|
6
|
+
const middleware: Middleware[] = [
|
|
6
7
|
debug({verbose: true, namespace: 'sanity:client'}),
|
|
7
8
|
headers({'User-Agent': `${name} ${version}`}),
|
|
8
9
|
|
|
10
|
+
// Lineage is used for recursion control/tracing and can be passed either through
|
|
11
|
+
// client constructor or through environent variable.
|
|
12
|
+
// Not used in browser environments.
|
|
13
|
+
{
|
|
14
|
+
processOptions(opts: RequestOptions & {lineage?: string}) {
|
|
15
|
+
const lineage =
|
|
16
|
+
(typeof process !== 'undefined' && process.env.X_SANITY_LINEAGE) || opts.lineage
|
|
17
|
+
|
|
18
|
+
if (lineage) {
|
|
19
|
+
opts.headers = opts.headers || {}
|
|
20
|
+
opts.headers['x-sanity-lineage'] = lineage
|
|
21
|
+
}
|
|
22
|
+
return opts
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
|
|
9
26
|
// Enable keep-alive, and in addition limit the number of sockets that can be opened.
|
|
10
27
|
// This avoids opening too many connections to the server if someone tries to execute
|
|
11
28
|
// a bunch of requests in parallel. It's recommended to have a concurrency limit
|
package/src/http/request.ts
CHANGED
|
@@ -58,10 +58,14 @@ function printWarnings(config: {ignoreWarnings?: string | RegExp | Array<string
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
type HttpRequestConfig = {
|
|
62
|
+
ignoreWarnings?: string | RegExp | Array<string | RegExp>
|
|
63
|
+
}
|
|
64
|
+
|
|
61
65
|
/** @internal */
|
|
62
66
|
export function defineHttpRequest(
|
|
63
67
|
envMiddleware: Middlewares,
|
|
64
|
-
config:
|
|
68
|
+
config: HttpRequestConfig = {},
|
|
65
69
|
): Requester {
|
|
66
70
|
return getIt([
|
|
67
71
|
retry({shouldRetry}),
|
package/src/types.ts
CHANGED
|
@@ -179,6 +179,10 @@ export interface ClientConfig {
|
|
|
179
179
|
* Options for how, if enabled, Content Source Maps are encoded into query results using steganography
|
|
180
180
|
*/
|
|
181
181
|
stega?: StegaConfig | boolean
|
|
182
|
+
/**
|
|
183
|
+
* Lineage token for recursion control
|
|
184
|
+
*/
|
|
185
|
+
lineage?: string
|
|
182
186
|
}
|
|
183
187
|
|
|
184
188
|
/** @public */
|