@sanity/client 6.27.3-canary.2 → 6.28.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 +85 -5
- package/dist/_chunks-cjs/config.cjs +4 -1
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +1 -1
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +1 -1
- package/dist/_chunks-es/config.js +4 -1
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/_chunks-es/stegaEncodeSourceMap.js +1 -1
- package/dist/_chunks-es/stegaEncodeSourceMap.js.map +1 -1
- package/dist/csm.d.cts +6 -1
- package/dist/csm.d.ts +6 -1
- package/dist/index.browser.cjs +6 -3
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +6 -1
- package/dist/index.browser.d.ts +6 -1
- package/dist/index.browser.js +7 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +6 -1
- package/dist/stega.browser.d.ts +6 -1
- package/dist/stega.browser.js +1 -1
- package/dist/stega.d.cts +6 -1
- package/dist/stega.d.ts +6 -1
- package/dist/stega.js +1 -1
- package/package.json +11 -12
- package/src/data/dataMethods.ts +12 -3
- package/src/types.ts +6 -1
- package/src/warnings.ts +5 -1
- package/umd/sanityClient.js +81 -84
- package/umd/sanityClient.min.js +2 -2
package/dist/index.browser.d.cts
CHANGED
|
@@ -401,7 +401,7 @@ export declare class ClientError extends Error {
|
|
|
401
401
|
|
|
402
402
|
/** @public */
|
|
403
403
|
export declare type ClientPerspective =
|
|
404
|
-
|
|
|
404
|
+
| DeprecatedPreviewDrafts
|
|
405
405
|
| 'published'
|
|
406
406
|
| 'drafts'
|
|
407
407
|
| 'raw'
|
|
@@ -667,6 +667,11 @@ export declare type DeleteAction = {
|
|
|
667
667
|
declare const deprecatedCreateClient: (config: ClientConfig) => SanityClient
|
|
668
668
|
export default deprecatedCreateClient
|
|
669
669
|
|
|
670
|
+
/**
|
|
671
|
+
* @deprecated use 'drafts' instead
|
|
672
|
+
*/
|
|
673
|
+
declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
674
|
+
|
|
670
675
|
/**
|
|
671
676
|
* Delete the draft version of a document.
|
|
672
677
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -401,7 +401,7 @@ export declare class ClientError extends Error {
|
|
|
401
401
|
|
|
402
402
|
/** @public */
|
|
403
403
|
export declare type ClientPerspective =
|
|
404
|
-
|
|
|
404
|
+
| DeprecatedPreviewDrafts
|
|
405
405
|
| 'published'
|
|
406
406
|
| 'drafts'
|
|
407
407
|
| 'raw'
|
|
@@ -667,6 +667,11 @@ export declare type DeleteAction = {
|
|
|
667
667
|
declare const deprecatedCreateClient: (config: ClientConfig) => SanityClient
|
|
668
668
|
export default deprecatedCreateClient
|
|
669
669
|
|
|
670
|
+
/**
|
|
671
|
+
* @deprecated use 'drafts' instead
|
|
672
|
+
*/
|
|
673
|
+
declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
674
|
+
|
|
670
675
|
/**
|
|
671
676
|
* Delete the draft version of a document.
|
|
672
677
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
package/dist/index.browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getIt } from "get-it";
|
|
2
2
|
import { adapter, environment } from "get-it";
|
|
3
3
|
import { retry, jsonRequest, jsonResponse, progress, observable } from "get-it/middleware";
|
|
4
|
-
import { Observable, defer,
|
|
4
|
+
import { Observable, defer, of, isObservable, mergeMap, from, lastValueFrom, shareReplay, catchError, concat, throwError, timer, tap, finalize, share, merge, EMPTY } from "rxjs";
|
|
5
5
|
import { stegaClean } from "./_chunks-es/stegaClean.js";
|
|
6
6
|
import { combineLatestWith, map, filter, finalize as finalize$1 } from "rxjs/operators";
|
|
7
7
|
class ClientError extends Error {
|
|
@@ -171,8 +171,10 @@ const createWarningPrinter = (message) => (
|
|
|
171
171
|
"global, edge-cached API-CDN. If you wish to have content delivered faster, set",
|
|
172
172
|
"`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."
|
|
173
173
|
]), printCdnPreviewDraftsWarning = createWarningPrinter([
|
|
174
|
-
"The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.",
|
|
174
|
+
"The Sanity client is configured with the `perspective` set to `drafts` or `previewDrafts`, which doesn't support the API-CDN.",
|
|
175
175
|
"The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."
|
|
176
|
+
]), printPreviewDraftsDeprecationWarning = createWarningPrinter([
|
|
177
|
+
"The `previewDrafts` perspective has been renamed to `drafts` and will be removed in a future API version"
|
|
176
178
|
]), printBrowserTokenWarning = createWarningPrinter([
|
|
177
179
|
"You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",
|
|
178
180
|
`See ${generateHelpUrl(
|
|
@@ -870,10 +872,11 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
870
872
|
const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
|
|
871
873
|
resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });
|
|
872
874
|
const perspectiveOption = options.perspective || config.perspective;
|
|
873
|
-
typeof perspectiveOption < "u" && (validateApiPerspective(perspectiveOption), options.query = {
|
|
875
|
+
typeof perspectiveOption < "u" && (perspectiveOption === "previewDrafts" && printPreviewDraftsDeprecationWarning(), validateApiPerspective(perspectiveOption), options.query = {
|
|
874
876
|
perspective: Array.isArray(perspectiveOption) ? perspectiveOption.join(",") : perspectiveOption,
|
|
875
877
|
...options.query
|
|
876
|
-
},
|
|
878
|
+
}, (Array.isArray(perspectiveOption) && perspectiveOption.length > 0 || // previewDrafts was renamed to drafts, but keep for backwards compat
|
|
879
|
+
perspectiveOption === "previewDrafts" || perspectiveOption === "drafts") && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query }), useCdn && options.cacheMode == "noStale" && (options.query = { cacheMode: "noStale", ...options.query });
|
|
877
880
|
}
|
|
878
881
|
const reqOptions = requestOptions(
|
|
879
882
|
config,
|