@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.browser.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
|
|
@@ -1593,6 +1599,12 @@ export declare interface InitializedClientConfig extends ClientConfig {
|
|
|
1593
1599
|
* The fully initialized stega config, can be used to check if stega is enabled
|
|
1594
1600
|
*/
|
|
1595
1601
|
stega: InitializedStegaConfig
|
|
1602
|
+
/**
|
|
1603
|
+
* Default headers to include with all requests
|
|
1604
|
+
*
|
|
1605
|
+
* @remarks request-specific headers will override any default headers with the same name.
|
|
1606
|
+
*/
|
|
1607
|
+
headers?: Record<string, string>
|
|
1596
1608
|
}
|
|
1597
1609
|
|
|
1598
1610
|
/** @public */
|
package/dist/index.browser.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
|
|
@@ -1593,6 +1599,12 @@ export declare interface InitializedClientConfig extends ClientConfig {
|
|
|
1593
1599
|
* The fully initialized stega config, can be used to check if stega is enabled
|
|
1594
1600
|
*/
|
|
1595
1601
|
stega: InitializedStegaConfig
|
|
1602
|
+
/**
|
|
1603
|
+
* Default headers to include with all requests
|
|
1604
|
+
*
|
|
1605
|
+
* @remarks request-specific headers will override any default headers with the same name.
|
|
1606
|
+
*/
|
|
1607
|
+
headers?: Record<string, string>
|
|
1596
1608
|
}
|
|
1597
1609
|
|
|
1598
1610
|
/** @public */
|
package/dist/index.browser.js
CHANGED
|
@@ -724,7 +724,9 @@ class ObservableTransaction extends BaseTransaction {
|
|
|
724
724
|
}
|
|
725
725
|
const projectHeader = "X-Sanity-Project-ID";
|
|
726
726
|
function requestOptions(config, overrides = {}) {
|
|
727
|
-
const headers = {}
|
|
727
|
+
const headers = {};
|
|
728
|
+
config.headers && Object.assign(headers, config.headers);
|
|
729
|
+
const token = overrides.token || config.token;
|
|
728
730
|
token && (headers.Authorization = `Bearer ${token}`), !overrides.useGlobalApi && !config.useProjectHostname && config.projectId && (headers[projectHeader] = config.projectId);
|
|
729
731
|
const withCredentials = !!(typeof overrides.withCredentials > "u" ? config.withCredentials : overrides.withCredentials), timeout = typeof overrides.timeout > "u" ? config.timeout : overrides.timeout;
|
|
730
732
|
return Object.assign({}, overrides, {
|