@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.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.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.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getIt } from "get-it";
|
|
2
2
|
import { adapter, environment } from "get-it";
|
|
3
3
|
import { retry, jsonRequest, jsonResponse, progress, observable, debug, headers, agent } 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
|
-
import { validateObject, validateInsert, requireDocumentId, validateDocumentId, requestTag, validateApiPerspective, printCdnPreviewDraftsWarning,
|
|
7
|
+
import { validateObject, validateInsert, requireDocumentId, validateDocumentId, hasDataset, requestTag, printPreviewDraftsDeprecationWarning, validateApiPerspective, printCdnPreviewDraftsWarning, validateAssetType, dataset, defaultConfig, initConfig, printNoDefaultExport } from "./_chunks-es/config.js";
|
|
8
8
|
class ClientError extends Error {
|
|
9
9
|
response;
|
|
10
10
|
statusCode = 400;
|
|
@@ -728,10 +728,11 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
728
728
|
const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
|
|
729
729
|
resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });
|
|
730
730
|
const perspectiveOption = options.perspective || config.perspective;
|
|
731
|
-
typeof perspectiveOption < "u" && (validateApiPerspective(perspectiveOption), options.query = {
|
|
731
|
+
typeof perspectiveOption < "u" && (perspectiveOption === "previewDrafts" && printPreviewDraftsDeprecationWarning(), validateApiPerspective(perspectiveOption), options.query = {
|
|
732
732
|
perspective: Array.isArray(perspectiveOption) ? perspectiveOption.join(",") : perspectiveOption,
|
|
733
733
|
...options.query
|
|
734
|
-
},
|
|
734
|
+
}, (Array.isArray(perspectiveOption) && perspectiveOption.length > 0 || // previewDrafts was renamed to drafts, but keep for backwards compat
|
|
735
|
+
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 });
|
|
735
736
|
}
|
|
736
737
|
const reqOptions = requestOptions(
|
|
737
738
|
config,
|
|
@@ -1507,7 +1508,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1507
1508
|
return printNoDefaultExport(), createClient2(config);
|
|
1508
1509
|
};
|
|
1509
1510
|
}
|
|
1510
|
-
var name = "@sanity/client", version = "6.
|
|
1511
|
+
var name = "@sanity/client", version = "6.28.0";
|
|
1511
1512
|
const middleware = [
|
|
1512
1513
|
debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1513
1514
|
headers({ "User-Agent": `${name} ${version}` }),
|