@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/stega.browser.d.cts
CHANGED
|
@@ -395,7 +395,7 @@ export declare class ClientError extends Error {
|
|
|
395
395
|
|
|
396
396
|
/** @public */
|
|
397
397
|
export declare type ClientPerspective =
|
|
398
|
-
|
|
|
398
|
+
| DeprecatedPreviewDrafts
|
|
399
399
|
| 'published'
|
|
400
400
|
| 'drafts'
|
|
401
401
|
| 'raw'
|
|
@@ -759,6 +759,11 @@ export declare type DeleteAction = {
|
|
|
759
759
|
purge?: boolean
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
/**
|
|
763
|
+
* @deprecated use 'drafts' instead
|
|
764
|
+
*/
|
|
765
|
+
declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
766
|
+
|
|
762
767
|
/**
|
|
763
768
|
* Delete the draft version of a document.
|
|
764
769
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
package/dist/stega.browser.d.ts
CHANGED
|
@@ -395,7 +395,7 @@ export declare class ClientError extends Error {
|
|
|
395
395
|
|
|
396
396
|
/** @public */
|
|
397
397
|
export declare type ClientPerspective =
|
|
398
|
-
|
|
|
398
|
+
| DeprecatedPreviewDrafts
|
|
399
399
|
| 'published'
|
|
400
400
|
| 'drafts'
|
|
401
401
|
| 'raw'
|
|
@@ -759,6 +759,11 @@ export declare type DeleteAction = {
|
|
|
759
759
|
purge?: boolean
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
/**
|
|
763
|
+
* @deprecated use 'drafts' instead
|
|
764
|
+
*/
|
|
765
|
+
declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
766
|
+
|
|
762
767
|
/**
|
|
763
768
|
* Delete the draft version of a document.
|
|
764
769
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
package/dist/stega.browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requester as requester$1, createClient as createClient$1, SanityClient, ObservableSanityClient } from "@sanity/client";
|
|
2
2
|
export * from "@sanity/client";
|
|
3
3
|
import { encodeIntoResult, stegaEncodeSourceMap } from "./_chunks-es/stegaEncodeSourceMap.js";
|
|
4
4
|
import { stegaClean, vercelStegaCleanAll } from "./_chunks-es/stegaClean.js";
|
package/dist/stega.d.cts
CHANGED
|
@@ -395,7 +395,7 @@ export declare class ClientError extends Error {
|
|
|
395
395
|
|
|
396
396
|
/** @public */
|
|
397
397
|
export declare type ClientPerspective =
|
|
398
|
-
|
|
|
398
|
+
| DeprecatedPreviewDrafts
|
|
399
399
|
| 'published'
|
|
400
400
|
| 'drafts'
|
|
401
401
|
| 'raw'
|
|
@@ -759,6 +759,11 @@ export declare type DeleteAction = {
|
|
|
759
759
|
purge?: boolean
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
/**
|
|
763
|
+
* @deprecated use 'drafts' instead
|
|
764
|
+
*/
|
|
765
|
+
declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
766
|
+
|
|
762
767
|
/**
|
|
763
768
|
* Delete the draft version of a document.
|
|
764
769
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
package/dist/stega.d.ts
CHANGED
|
@@ -395,7 +395,7 @@ export declare class ClientError extends Error {
|
|
|
395
395
|
|
|
396
396
|
/** @public */
|
|
397
397
|
export declare type ClientPerspective =
|
|
398
|
-
|
|
|
398
|
+
| DeprecatedPreviewDrafts
|
|
399
399
|
| 'published'
|
|
400
400
|
| 'drafts'
|
|
401
401
|
| 'raw'
|
|
@@ -759,6 +759,11 @@ export declare type DeleteAction = {
|
|
|
759
759
|
purge?: boolean
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
/**
|
|
763
|
+
* @deprecated use 'drafts' instead
|
|
764
|
+
*/
|
|
765
|
+
declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
766
|
+
|
|
762
767
|
/**
|
|
763
768
|
* Delete the draft version of a document.
|
|
764
769
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
package/dist/stega.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requester as requester$1, createClient as createClient$1, SanityClient, ObservableSanityClient } from "@sanity/client";
|
|
2
2
|
export * from "@sanity/client";
|
|
3
3
|
import { encodeIntoResult, stegaEncodeSourceMap } from "./_chunks-es/stegaEncodeSourceMap.js";
|
|
4
4
|
import { stegaClean, vercelStegaCleanAll } from "./_chunks-es/stegaClean.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/client",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.28.0",
|
|
4
4
|
"description": "Client for retrieving, creating and patching data from Sanity.io",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -126,18 +126,18 @@
|
|
|
126
126
|
"@edge-runtime/types": "^4.0.0",
|
|
127
127
|
"@edge-runtime/vm": "^5.0.0",
|
|
128
128
|
"@eslint/eslintrc": "^3.2.0",
|
|
129
|
-
"@eslint/js": "^9.
|
|
129
|
+
"@eslint/js": "^9.20.0",
|
|
130
130
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
131
131
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
132
132
|
"@sanity/client-latest": "npm:@sanity/client@latest",
|
|
133
133
|
"@sanity/pkg-utils": "^7.0.4",
|
|
134
134
|
"@types/json-diff": "^1.0.3",
|
|
135
135
|
"@types/node": "^22.9.0",
|
|
136
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
137
|
-
"@typescript-eslint/parser": "^8.
|
|
136
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
137
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
138
138
|
"@vercel/stega": "0.1.2",
|
|
139
|
-
"@vitest/coverage-v8": "3.0.
|
|
140
|
-
"eslint": "^9.
|
|
139
|
+
"@vitest/coverage-v8": "3.0.5",
|
|
140
|
+
"eslint": "^9.20.0",
|
|
141
141
|
"eslint-config-prettier": "^10.0.1",
|
|
142
142
|
"eslint-formatter-compact": "^8.40.0",
|
|
143
143
|
"eslint-plugin-prettier": "^5.2.3",
|
|
@@ -148,17 +148,16 @@
|
|
|
148
148
|
"json-diff": "^1.0.6",
|
|
149
149
|
"ls-engines": "^0.9.3",
|
|
150
150
|
"msw": "^2.7.0",
|
|
151
|
-
"next": "^15.1.
|
|
151
|
+
"next": "^15.1.7",
|
|
152
152
|
"nock": "^13.5.6",
|
|
153
|
-
"prettier": "^3.
|
|
153
|
+
"prettier": "^3.5.0",
|
|
154
154
|
"prettier-plugin-packagejson": "^2.5.8",
|
|
155
155
|
"rimraf": "^5.0.7",
|
|
156
|
-
"rollup": "^4.
|
|
156
|
+
"rollup": "^4.34.6",
|
|
157
157
|
"sse-channel": "^4.0.0",
|
|
158
|
-
"terser": "^5.
|
|
158
|
+
"terser": "^5.38.2",
|
|
159
159
|
"typescript": "5.7.3",
|
|
160
|
-
"vitest": "3.0.
|
|
161
|
-
"vitest-github-actions-reporter": "0.11.1"
|
|
160
|
+
"vitest": "3.0.5"
|
|
162
161
|
},
|
|
163
162
|
"packageManager": "npm@11.0.0",
|
|
164
163
|
"engines": {
|
package/src/data/dataMethods.ts
CHANGED
|
@@ -33,7 +33,7 @@ import type {
|
|
|
33
33
|
import {getSelection} from '../util/getSelection'
|
|
34
34
|
import * as validate from '../validators'
|
|
35
35
|
import * as validators from '../validators'
|
|
36
|
-
import {printCdnPreviewDraftsWarning} from '../warnings'
|
|
36
|
+
import {printCdnPreviewDraftsWarning, printPreviewDraftsDeprecationWarning} from '../warnings'
|
|
37
37
|
import {encodeQueryString} from './encodeQueryString'
|
|
38
38
|
import {ObservablePatch, Patch} from './patch'
|
|
39
39
|
import {ObservableTransaction, Transaction} from './transaction'
|
|
@@ -407,6 +407,9 @@ export function _requestObservable<R>(
|
|
|
407
407
|
}
|
|
408
408
|
const perspectiveOption = options.perspective || config.perspective
|
|
409
409
|
if (typeof perspectiveOption !== 'undefined') {
|
|
410
|
+
if (perspectiveOption === 'previewDrafts') {
|
|
411
|
+
printPreviewDraftsDeprecationWarning()
|
|
412
|
+
}
|
|
410
413
|
validateApiPerspective(perspectiveOption)
|
|
411
414
|
options.query = {
|
|
412
415
|
perspective: Array.isArray(perspectiveOption)
|
|
@@ -414,8 +417,14 @@ export function _requestObservable<R>(
|
|
|
414
417
|
: perspectiveOption,
|
|
415
418
|
...options.query,
|
|
416
419
|
}
|
|
417
|
-
// If the perspective is set to `
|
|
418
|
-
if (
|
|
420
|
+
// If the perspective is set to `drafts` or multiple perspectives we can't use the CDN, the API will throw
|
|
421
|
+
if (
|
|
422
|
+
((Array.isArray(perspectiveOption) && perspectiveOption.length > 0) ||
|
|
423
|
+
// previewDrafts was renamed to drafts, but keep for backwards compat
|
|
424
|
+
perspectiveOption === 'previewDrafts' ||
|
|
425
|
+
perspectiveOption === 'drafts') &&
|
|
426
|
+
useCdn
|
|
427
|
+
) {
|
|
419
428
|
useCdn = false
|
|
420
429
|
printCdnPreviewDraftsWarning()
|
|
421
430
|
}
|
package/src/types.ts
CHANGED
|
@@ -37,12 +37,17 @@ export interface RequestOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
export type ReleaseId = `r${string}`
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated use 'drafts' instead
|
|
42
|
+
*/
|
|
43
|
+
type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
44
|
+
|
|
40
45
|
/** @public */
|
|
41
46
|
export type StackablePerspective = ('published' | 'drafts' | string) & {}
|
|
42
47
|
|
|
43
48
|
/** @public */
|
|
44
49
|
export type ClientPerspective =
|
|
45
|
-
|
|
|
50
|
+
| DeprecatedPreviewDrafts
|
|
46
51
|
| 'published'
|
|
47
52
|
| 'drafts'
|
|
48
53
|
| 'raw'
|
package/src/warnings.ts
CHANGED
|
@@ -18,10 +18,14 @@ export const printCdnWarning = createWarningPrinter([
|
|
|
18
18
|
])
|
|
19
19
|
|
|
20
20
|
export const printCdnPreviewDraftsWarning = createWarningPrinter([
|
|
21
|
-
`The Sanity client is configured with the \`perspective\` set to \`previewDrafts\`, which doesn't support the API-CDN.`,
|
|
21
|
+
`The Sanity client is configured with the \`perspective\` set to \`drafts\` or \`previewDrafts\`, which doesn't support the API-CDN.`,
|
|
22
22
|
`The Live API will be used instead. Set \`useCdn: false\` in your configuration to hide this warning.`,
|
|
23
23
|
])
|
|
24
24
|
|
|
25
|
+
export const printPreviewDraftsDeprecationWarning = createWarningPrinter([
|
|
26
|
+
`The \`previewDrafts\` perspective has been renamed to \`drafts\` and will be removed in a future API version`,
|
|
27
|
+
])
|
|
28
|
+
|
|
25
29
|
export const printBrowserTokenWarning = createWarningPrinter([
|
|
26
30
|
'You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.',
|
|
27
31
|
`See ${generateHelpUrl(
|