@sanity/client 6.28.0 → 6.28.1
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 +16 -2
- package/dist/index.browser.d.ts +16 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +16 -2
- package/dist/stega.browser.d.ts +16 -2
- package/dist/stega.d.cts +16 -2
- package/dist/stega.d.ts +16 -2
- package/package.json +1 -1
- package/src/index.ts +5 -1
- package/src/types.ts +18 -2
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
|
/**
|
|
@@ -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
|
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
|
/**
|
|
@@ -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
|
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.1";
|
|
1529
1529
|
const middleware = [
|
|
1530
1530
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1531
1531
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|