@sanity/client 7.2.2 → 7.3.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/README.md +4 -0
- package/dist/index.browser.cjs +3 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +12 -0
- package/dist/index.browser.d.ts +12 -0
- package/dist/index.browser.js +3 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +12 -0
- package/dist/stega.browser.d.ts +12 -0
- package/dist/stega.d.cts +12 -0
- package/dist/stega.d.ts +12 -0
- package/package.json +1 -1
- package/src/http/requestOptions.ts +4 -0
- package/src/types.ts +14 -0
- package/umd/sanityClient.js +3 -1
- package/umd/sanityClient.min.js +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -627,6 +627,12 @@ export declare interface ClientConfig {
|
|
|
627
627
|
* Optional request tag prefix for all request tags
|
|
628
628
|
*/
|
|
629
629
|
requestTagPrefix?: string
|
|
630
|
+
/**
|
|
631
|
+
* Optional default headers to include with all requests
|
|
632
|
+
*
|
|
633
|
+
* @remarks request-specific headers will override any default headers with the same name.
|
|
634
|
+
*/
|
|
635
|
+
headers?: Record<string, string>
|
|
630
636
|
ignoreBrowserTokenWarning?: boolean
|
|
631
637
|
withCredentials?: boolean
|
|
632
638
|
allowReconfigure?: boolean
|
|
@@ -1597,6 +1603,12 @@ export declare interface InitializedClientConfig extends ClientConfig {
|
|
|
1597
1603
|
* The fully initialized stega config, can be used to check if stega is enabled
|
|
1598
1604
|
*/
|
|
1599
1605
|
stega: InitializedStegaConfig
|
|
1606
|
+
/**
|
|
1607
|
+
* Default headers to include with all requests
|
|
1608
|
+
*
|
|
1609
|
+
* @remarks request-specific headers will override any default headers with the same name.
|
|
1610
|
+
*/
|
|
1611
|
+
headers?: Record<string, string>
|
|
1600
1612
|
}
|
|
1601
1613
|
|
|
1602
1614
|
/** @public */
|
package/dist/index.d.ts
CHANGED
|
@@ -627,6 +627,12 @@ export declare interface ClientConfig {
|
|
|
627
627
|
* Optional request tag prefix for all request tags
|
|
628
628
|
*/
|
|
629
629
|
requestTagPrefix?: string
|
|
630
|
+
/**
|
|
631
|
+
* Optional default headers to include with all requests
|
|
632
|
+
*
|
|
633
|
+
* @remarks request-specific headers will override any default headers with the same name.
|
|
634
|
+
*/
|
|
635
|
+
headers?: Record<string, string>
|
|
630
636
|
ignoreBrowserTokenWarning?: boolean
|
|
631
637
|
withCredentials?: boolean
|
|
632
638
|
allowReconfigure?: boolean
|
|
@@ -1597,6 +1603,12 @@ export declare interface InitializedClientConfig extends ClientConfig {
|
|
|
1597
1603
|
* The fully initialized stega config, can be used to check if stega is enabled
|
|
1598
1604
|
*/
|
|
1599
1605
|
stega: InitializedStegaConfig
|
|
1606
|
+
/**
|
|
1607
|
+
* Default headers to include with all requests
|
|
1608
|
+
*
|
|
1609
|
+
* @remarks request-specific headers will override any default headers with the same name.
|
|
1610
|
+
*/
|
|
1611
|
+
headers?: Record<string, string>
|
|
1600
1612
|
}
|
|
1601
1613
|
|
|
1602
1614
|
/** @public */
|
package/dist/index.js
CHANGED
|
@@ -555,7 +555,9 @@ class ObservableTransaction extends BaseTransaction {
|
|
|
555
555
|
}
|
|
556
556
|
const projectHeader = "X-Sanity-Project-ID";
|
|
557
557
|
function requestOptions(config, overrides = {}) {
|
|
558
|
-
const headers2 = {}
|
|
558
|
+
const headers2 = {};
|
|
559
|
+
config.headers && Object.assign(headers2, config.headers);
|
|
560
|
+
const token = overrides.token || config.token;
|
|
559
561
|
token && (headers2.Authorization = `Bearer ${token}`), !overrides.useGlobalApi && !config.useProjectHostname && config.projectId && (headers2[projectHeader] = config.projectId);
|
|
560
562
|
const withCredentials = !!(typeof overrides.withCredentials > "u" ? config.withCredentials : overrides.withCredentials), timeout = typeof overrides.timeout > "u" ? config.timeout : overrides.timeout;
|
|
561
563
|
return Object.assign({}, overrides, {
|
|
@@ -2386,7 +2388,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
2386
2388
|
return printNoDefaultExport(), createClient2(config);
|
|
2387
2389
|
};
|
|
2388
2390
|
}
|
|
2389
|
-
var name = "@sanity/client", version = "7.
|
|
2391
|
+
var name = "@sanity/client", version = "7.3.0";
|
|
2390
2392
|
const middleware = [
|
|
2391
2393
|
debug({ verbose: !0, namespace: "sanity:client" }),
|
|
2392
2394
|
headers({ "User-Agent": `${name} ${version}` }),
|