@sanity/client 6.28.0 → 6.28.2
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 +5 -3
- package/dist/index.browser.d.cts +23 -9
- package/dist/index.browser.d.ts +23 -9
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -10
- package/dist/index.d.ts +28 -10
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +23 -9
- package/dist/stega.browser.d.ts +23 -9
- package/dist/stega.d.cts +23 -9
- package/dist/stega.d.ts +23 -9
- package/package.json +1 -1
- package/src/index.ts +5 -1
- package/src/types.ts +25 -9
package/README.md
CHANGED
|
@@ -501,7 +501,9 @@ Perform a query using the given parameters (if any).
|
|
|
501
501
|
|
|
502
502
|
### Using perspectives
|
|
503
503
|
|
|
504
|
-
|
|
504
|
+
Use the `perspective` option to filter queries from a specific viewpoint. The default value is [`published`](#published) if API version >= v2025-02-19, (if API version is < v2025-02-19, [`raw`](#raw) is the default). Using the [`published`](#published) perspective will exclude drafts, versions, and potential future document variants. Using the [`raw`](#raw) perspective returns all document variants, so it's recommended to apply additional client side filtering to limit the variants you want to process.
|
|
505
|
+
|
|
506
|
+
Learn more about using perspectives with Content Releases in the [perspective documentation](https://www.sanity.io/docs/perspectives).
|
|
505
507
|
|
|
506
508
|
#### `published`
|
|
507
509
|
|
|
@@ -537,13 +539,13 @@ import {createClient} from '@sanity/client'
|
|
|
537
539
|
const client = createClient({
|
|
538
540
|
...config,
|
|
539
541
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
540
|
-
perspective: 'published',
|
|
542
|
+
perspective: 'published', // default starting from API version v2025-02-19
|
|
541
543
|
})
|
|
542
544
|
|
|
543
545
|
const authors = await client.fetch('*[_type == "author"]')
|
|
544
546
|
```
|
|
545
547
|
|
|
546
|
-
Then `authors` will only contain documents
|
|
548
|
+
Then `authors` will only contain published documents, and not include documents with `drafts.`, `versions.` or other prefixes in their `_id`, in this case just "George Martin":
|
|
547
549
|
|
|
548
550
|
```json
|
|
549
551
|
[
|
package/dist/index.browser.d.cts
CHANGED
|
@@ -339,9 +339,18 @@ export declare interface ClientConfig {
|
|
|
339
339
|
/** @defaultValue true */
|
|
340
340
|
useCdn?: boolean
|
|
341
341
|
token?: string
|
|
342
|
-
/**
|
|
342
|
+
/**
|
|
343
|
+
* What perspective to use for the client. See {@link https://www.sanity.io/docs/perspectives|perspective documentation}
|
|
344
|
+
* @remarks
|
|
345
|
+
* As of API version `v2025-02-19`, the default perspective has changed from `raw` to `published`. {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog}
|
|
346
|
+
* @defaultValue 'published'
|
|
347
|
+
*/
|
|
343
348
|
perspective?: ClientPerspective
|
|
344
349
|
apiHost?: string
|
|
350
|
+
/**
|
|
351
|
+
@remarks
|
|
352
|
+
* As of API version `v2025-02-19`, the default perspective has changed from `raw` to `published`. {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog}
|
|
353
|
+
*/
|
|
345
354
|
apiVersion?: string
|
|
346
355
|
proxy?: string
|
|
347
356
|
/**
|
|
@@ -565,7 +574,7 @@ export declare type CreateAction = {
|
|
|
565
574
|
/** @public */
|
|
566
575
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
567
576
|
|
|
568
|
-
/** @
|
|
577
|
+
/** @public */
|
|
569
578
|
export declare interface CurrentSanityUser {
|
|
570
579
|
id: string
|
|
571
580
|
name: string
|
|
@@ -574,10 +583,10 @@ export declare interface CurrentSanityUser {
|
|
|
574
583
|
role: string
|
|
575
584
|
}
|
|
576
585
|
|
|
577
|
-
/** @
|
|
586
|
+
/** @public */
|
|
578
587
|
export declare type DatasetAclMode = 'public' | 'private' | 'custom'
|
|
579
588
|
|
|
580
|
-
/** @
|
|
589
|
+
/** @public */
|
|
581
590
|
export declare type DatasetResponse = {
|
|
582
591
|
datasetName: string
|
|
583
592
|
aclMode: DatasetAclMode
|
|
@@ -625,7 +634,7 @@ export declare class DatasetsClient {
|
|
|
625
634
|
list(): Promise<DatasetsResponse>
|
|
626
635
|
}
|
|
627
636
|
|
|
628
|
-
/** @
|
|
637
|
+
/** @public */
|
|
629
638
|
export declare type DatasetsResponse = {
|
|
630
639
|
name: string
|
|
631
640
|
aclMode: DatasetAclMode
|
|
@@ -954,7 +963,12 @@ export declare interface ListenOptions {
|
|
|
954
963
|
*/
|
|
955
964
|
includePreviousRevision?: boolean
|
|
956
965
|
/**
|
|
957
|
-
*
|
|
966
|
+
* Whether to include events for drafts and versions. As of API Version >= v2025-02-19, only events
|
|
967
|
+
* for published documents will be included by default (see {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog})
|
|
968
|
+
* If you need events from drafts and versions, set this to `true`.
|
|
969
|
+
* Note: Keep in mind that additional document variants may be introduced in the future, so it's
|
|
970
|
+
* recommended to respond to events in a way that's tolerant of potential future variants, e.g. by
|
|
971
|
+
* explicitly checking whether the event is for a draft or a version.
|
|
958
972
|
* @defaultValue `false`
|
|
959
973
|
*/
|
|
960
974
|
includeAllVersions?: boolean
|
|
@@ -2916,7 +2930,7 @@ export declare interface SanityImagePalette {
|
|
|
2916
2930
|
title: string
|
|
2917
2931
|
}
|
|
2918
2932
|
|
|
2919
|
-
/** @
|
|
2933
|
+
/** @public */
|
|
2920
2934
|
export declare interface SanityProject {
|
|
2921
2935
|
id: string
|
|
2922
2936
|
displayName: string
|
|
@@ -2944,7 +2958,7 @@ export declare interface SanityProject {
|
|
|
2944
2958
|
}
|
|
2945
2959
|
}
|
|
2946
2960
|
|
|
2947
|
-
/** @
|
|
2961
|
+
/** @public */
|
|
2948
2962
|
export declare interface SanityProjectMember {
|
|
2949
2963
|
id: string
|
|
2950
2964
|
role: string
|
|
@@ -2960,7 +2974,7 @@ export declare interface SanityReference {
|
|
|
2960
2974
|
_ref: string
|
|
2961
2975
|
}
|
|
2962
2976
|
|
|
2963
|
-
/** @
|
|
2977
|
+
/** @public */
|
|
2964
2978
|
export declare interface SanityUser {
|
|
2965
2979
|
id: string
|
|
2966
2980
|
projectId: string
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -339,9 +339,18 @@ export declare interface ClientConfig {
|
|
|
339
339
|
/** @defaultValue true */
|
|
340
340
|
useCdn?: boolean
|
|
341
341
|
token?: string
|
|
342
|
-
/**
|
|
342
|
+
/**
|
|
343
|
+
* What perspective to use for the client. See {@link https://www.sanity.io/docs/perspectives|perspective documentation}
|
|
344
|
+
* @remarks
|
|
345
|
+
* As of API version `v2025-02-19`, the default perspective has changed from `raw` to `published`. {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog}
|
|
346
|
+
* @defaultValue 'published'
|
|
347
|
+
*/
|
|
343
348
|
perspective?: ClientPerspective
|
|
344
349
|
apiHost?: string
|
|
350
|
+
/**
|
|
351
|
+
@remarks
|
|
352
|
+
* As of API version `v2025-02-19`, the default perspective has changed from `raw` to `published`. {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog}
|
|
353
|
+
*/
|
|
345
354
|
apiVersion?: string
|
|
346
355
|
proxy?: string
|
|
347
356
|
/**
|
|
@@ -565,7 +574,7 @@ export declare type CreateAction = {
|
|
|
565
574
|
/** @public */
|
|
566
575
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
567
576
|
|
|
568
|
-
/** @
|
|
577
|
+
/** @public */
|
|
569
578
|
export declare interface CurrentSanityUser {
|
|
570
579
|
id: string
|
|
571
580
|
name: string
|
|
@@ -574,10 +583,10 @@ export declare interface CurrentSanityUser {
|
|
|
574
583
|
role: string
|
|
575
584
|
}
|
|
576
585
|
|
|
577
|
-
/** @
|
|
586
|
+
/** @public */
|
|
578
587
|
export declare type DatasetAclMode = 'public' | 'private' | 'custom'
|
|
579
588
|
|
|
580
|
-
/** @
|
|
589
|
+
/** @public */
|
|
581
590
|
export declare type DatasetResponse = {
|
|
582
591
|
datasetName: string
|
|
583
592
|
aclMode: DatasetAclMode
|
|
@@ -625,7 +634,7 @@ export declare class DatasetsClient {
|
|
|
625
634
|
list(): Promise<DatasetsResponse>
|
|
626
635
|
}
|
|
627
636
|
|
|
628
|
-
/** @
|
|
637
|
+
/** @public */
|
|
629
638
|
export declare type DatasetsResponse = {
|
|
630
639
|
name: string
|
|
631
640
|
aclMode: DatasetAclMode
|
|
@@ -954,7 +963,12 @@ export declare interface ListenOptions {
|
|
|
954
963
|
*/
|
|
955
964
|
includePreviousRevision?: boolean
|
|
956
965
|
/**
|
|
957
|
-
*
|
|
966
|
+
* Whether to include events for drafts and versions. As of API Version >= v2025-02-19, only events
|
|
967
|
+
* for published documents will be included by default (see {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog})
|
|
968
|
+
* If you need events from drafts and versions, set this to `true`.
|
|
969
|
+
* Note: Keep in mind that additional document variants may be introduced in the future, so it's
|
|
970
|
+
* recommended to respond to events in a way that's tolerant of potential future variants, e.g. by
|
|
971
|
+
* explicitly checking whether the event is for a draft or a version.
|
|
958
972
|
* @defaultValue `false`
|
|
959
973
|
*/
|
|
960
974
|
includeAllVersions?: boolean
|
|
@@ -2916,7 +2930,7 @@ export declare interface SanityImagePalette {
|
|
|
2916
2930
|
title: string
|
|
2917
2931
|
}
|
|
2918
2932
|
|
|
2919
|
-
/** @
|
|
2933
|
+
/** @public */
|
|
2920
2934
|
export declare interface SanityProject {
|
|
2921
2935
|
id: string
|
|
2922
2936
|
displayName: string
|
|
@@ -2944,7 +2958,7 @@ export declare interface SanityProject {
|
|
|
2944
2958
|
}
|
|
2945
2959
|
}
|
|
2946
2960
|
|
|
2947
|
-
/** @
|
|
2961
|
+
/** @public */
|
|
2948
2962
|
export declare interface SanityProjectMember {
|
|
2949
2963
|
id: string
|
|
2950
2964
|
role: string
|
|
@@ -2960,7 +2974,7 @@ export declare interface SanityReference {
|
|
|
2960
2974
|
_ref: string
|
|
2961
2975
|
}
|
|
2962
2976
|
|
|
2963
|
-
/** @
|
|
2977
|
+
/** @public */
|
|
2964
2978
|
export declare interface SanityUser {
|
|
2965
2979
|
id: string
|
|
2966
2980
|
projectId: string
|
package/dist/index.cjs
CHANGED
|
@@ -1525,7 +1525,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1525
1525
|
return config.printNoDefaultExport(), createClient2(config$1);
|
|
1526
1526
|
};
|
|
1527
1527
|
}
|
|
1528
|
-
var name = "@sanity/client", version = "6.28.
|
|
1528
|
+
var name = "@sanity/client", version = "6.28.2";
|
|
1529
1529
|
const middleware = [
|
|
1530
1530
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1531
1531
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|