@sanity/client 6.21.2 → 6.21.3-bundle-perspective
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/dist/_chunks-cjs/resolveEditInfo.cjs +1 -2
- package/dist/_chunks-cjs/resolveEditInfo.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaClean.cjs +1 -2
- package/dist/_chunks-cjs/stegaClean.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +1 -2
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +1 -1
- package/dist/_chunks-es/resolveEditInfo.js +1 -2
- package/dist/_chunks-es/resolveEditInfo.js.map +1 -1
- package/dist/_chunks-es/stegaClean.js +1 -2
- package/dist/_chunks-es/stegaClean.js.map +1 -1
- package/dist/_chunks-es/stegaEncodeSourceMap.js +1 -2
- package/dist/_chunks-es/stegaEncodeSourceMap.js.map +1 -1
- package/dist/csm.cjs +1 -2
- package/dist/csm.cjs.map +1 -1
- package/dist/csm.js +1 -2
- package/dist/csm.js.map +1 -1
- package/dist/index.browser.cjs +16 -6
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +16 -1
- package/dist/index.browser.d.ts +16 -1
- package/dist/index.browser.js +16 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +17 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/SanityClient.ts +2 -2
- package/src/data/dataMethods.ts +23 -4
- package/src/types.ts +14 -1
- package/umd/sanityClient.js +21 -12
- package/umd/sanityClient.min.js +2 -2
package/dist/index.browser.d.cts
CHANGED
|
@@ -331,6 +331,7 @@ export declare interface ClientConfig {
|
|
|
331
331
|
token?: string
|
|
332
332
|
/** @defaultValue 'raw' */
|
|
333
333
|
perspective?: ClientPerspective
|
|
334
|
+
bundlePerspective?: string
|
|
334
335
|
apiHost?: string
|
|
335
336
|
apiVersion?: string
|
|
336
337
|
proxy?: string
|
|
@@ -2012,6 +2013,8 @@ export declare interface QueryParams {
|
|
|
2012
2013
|
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2013
2014
|
perspective?: never
|
|
2014
2015
|
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2016
|
+
bundlePerspective?: never
|
|
2017
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2015
2018
|
query?: never
|
|
2016
2019
|
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2017
2020
|
resultSourceMap?: never
|
|
@@ -2114,6 +2117,7 @@ export declare interface RequestObservableOptions extends Omit<RequestOptions, '
|
|
|
2114
2117
|
returnQuery?: boolean
|
|
2115
2118
|
resultSourceMap?: boolean | 'withKeyArraySelector'
|
|
2116
2119
|
perspective?: ClientPerspective
|
|
2120
|
+
bundlePerspective?: string
|
|
2117
2121
|
lastLiveEventId?: string
|
|
2118
2122
|
}
|
|
2119
2123
|
|
|
@@ -2145,6 +2149,7 @@ export declare interface ResponseEvent<T = unknown> {
|
|
|
2145
2149
|
/** @public */
|
|
2146
2150
|
export declare interface ResponseQueryOptions extends RequestOptions {
|
|
2147
2151
|
perspective?: ClientPerspective
|
|
2152
|
+
bundlePerspective?: string
|
|
2148
2153
|
resultSourceMap?: boolean | 'withKeyArraySelector'
|
|
2149
2154
|
returnQuery?: boolean
|
|
2150
2155
|
useCdn?: boolean
|
|
@@ -2269,6 +2274,7 @@ export declare class SanityClient {
|
|
|
2269
2274
|
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
2270
2275
|
id: string,
|
|
2271
2276
|
options?: {
|
|
2277
|
+
signal?: AbortSignal
|
|
2272
2278
|
tag?: string
|
|
2273
2279
|
},
|
|
2274
2280
|
): Promise<SanityDocument<R> | undefined>
|
|
@@ -2284,6 +2290,7 @@ export declare class SanityClient {
|
|
|
2284
2290
|
getDocuments<R extends Record<string, Any> = Record<string, Any>>(
|
|
2285
2291
|
ids: string[],
|
|
2286
2292
|
options?: {
|
|
2293
|
+
signal?: AbortSignal
|
|
2287
2294
|
tag?: string
|
|
2288
2295
|
},
|
|
2289
2296
|
): Promise<(SanityDocument<R> | null)[]>
|
|
@@ -2699,7 +2706,7 @@ export declare type SanityDocument<T extends Record<string, Any> = Record<string
|
|
|
2699
2706
|
_createdAt: string
|
|
2700
2707
|
_updatedAt: string
|
|
2701
2708
|
/**
|
|
2702
|
-
* Present when `perspective` is set to `previewDrafts`
|
|
2709
|
+
* Present when `perspective` is set to `previewDrafts` or `bundlePerspective` is specified
|
|
2703
2710
|
*/
|
|
2704
2711
|
_originalId?: string
|
|
2705
2712
|
}
|
|
@@ -2758,6 +2765,10 @@ export declare interface SanityImagePalette {
|
|
|
2758
2765
|
export declare interface SanityProject {
|
|
2759
2766
|
id: string
|
|
2760
2767
|
displayName: string
|
|
2768
|
+
/**
|
|
2769
|
+
* @deprecated Use the `/user-applications` endpoint instead, which lists all deployed studios/applications
|
|
2770
|
+
* @see https://www.sanity.io/help/studio-host-user-applications
|
|
2771
|
+
*/
|
|
2761
2772
|
studioHost: string | null
|
|
2762
2773
|
organizationId: string | null
|
|
2763
2774
|
isBlocked: boolean
|
|
@@ -2770,6 +2781,10 @@ export declare interface SanityProject {
|
|
|
2770
2781
|
metadata: {
|
|
2771
2782
|
cliInitializedAt?: string
|
|
2772
2783
|
color?: string
|
|
2784
|
+
/**
|
|
2785
|
+
* @deprecated Use the `/user-applications` endpoint instead, which lists all deployed studios/applications
|
|
2786
|
+
* @see https://www.sanity.io/help/studio-host-user-applications
|
|
2787
|
+
*/
|
|
2773
2788
|
externalStudioHost?: string
|
|
2774
2789
|
}
|
|
2775
2790
|
}
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -331,6 +331,7 @@ export declare interface ClientConfig {
|
|
|
331
331
|
token?: string
|
|
332
332
|
/** @defaultValue 'raw' */
|
|
333
333
|
perspective?: ClientPerspective
|
|
334
|
+
bundlePerspective?: string
|
|
334
335
|
apiHost?: string
|
|
335
336
|
apiVersion?: string
|
|
336
337
|
proxy?: string
|
|
@@ -2012,6 +2013,8 @@ export declare interface QueryParams {
|
|
|
2012
2013
|
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2013
2014
|
perspective?: never
|
|
2014
2015
|
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2016
|
+
bundlePerspective?: never
|
|
2017
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2015
2018
|
query?: never
|
|
2016
2019
|
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2017
2020
|
resultSourceMap?: never
|
|
@@ -2114,6 +2117,7 @@ export declare interface RequestObservableOptions extends Omit<RequestOptions, '
|
|
|
2114
2117
|
returnQuery?: boolean
|
|
2115
2118
|
resultSourceMap?: boolean | 'withKeyArraySelector'
|
|
2116
2119
|
perspective?: ClientPerspective
|
|
2120
|
+
bundlePerspective?: string
|
|
2117
2121
|
lastLiveEventId?: string
|
|
2118
2122
|
}
|
|
2119
2123
|
|
|
@@ -2145,6 +2149,7 @@ export declare interface ResponseEvent<T = unknown> {
|
|
|
2145
2149
|
/** @public */
|
|
2146
2150
|
export declare interface ResponseQueryOptions extends RequestOptions {
|
|
2147
2151
|
perspective?: ClientPerspective
|
|
2152
|
+
bundlePerspective?: string
|
|
2148
2153
|
resultSourceMap?: boolean | 'withKeyArraySelector'
|
|
2149
2154
|
returnQuery?: boolean
|
|
2150
2155
|
useCdn?: boolean
|
|
@@ -2269,6 +2274,7 @@ export declare class SanityClient {
|
|
|
2269
2274
|
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
2270
2275
|
id: string,
|
|
2271
2276
|
options?: {
|
|
2277
|
+
signal?: AbortSignal
|
|
2272
2278
|
tag?: string
|
|
2273
2279
|
},
|
|
2274
2280
|
): Promise<SanityDocument<R> | undefined>
|
|
@@ -2284,6 +2290,7 @@ export declare class SanityClient {
|
|
|
2284
2290
|
getDocuments<R extends Record<string, Any> = Record<string, Any>>(
|
|
2285
2291
|
ids: string[],
|
|
2286
2292
|
options?: {
|
|
2293
|
+
signal?: AbortSignal
|
|
2287
2294
|
tag?: string
|
|
2288
2295
|
},
|
|
2289
2296
|
): Promise<(SanityDocument<R> | null)[]>
|
|
@@ -2699,7 +2706,7 @@ export declare type SanityDocument<T extends Record<string, Any> = Record<string
|
|
|
2699
2706
|
_createdAt: string
|
|
2700
2707
|
_updatedAt: string
|
|
2701
2708
|
/**
|
|
2702
|
-
* Present when `perspective` is set to `previewDrafts`
|
|
2709
|
+
* Present when `perspective` is set to `previewDrafts` or `bundlePerspective` is specified
|
|
2703
2710
|
*/
|
|
2704
2711
|
_originalId?: string
|
|
2705
2712
|
}
|
|
@@ -2758,6 +2765,10 @@ export declare interface SanityImagePalette {
|
|
|
2758
2765
|
export declare interface SanityProject {
|
|
2759
2766
|
id: string
|
|
2760
2767
|
displayName: string
|
|
2768
|
+
/**
|
|
2769
|
+
* @deprecated Use the `/user-applications` endpoint instead, which lists all deployed studios/applications
|
|
2770
|
+
* @see https://www.sanity.io/help/studio-host-user-applications
|
|
2771
|
+
*/
|
|
2761
2772
|
studioHost: string | null
|
|
2762
2773
|
organizationId: string | null
|
|
2763
2774
|
isBlocked: boolean
|
|
@@ -2770,6 +2781,10 @@ export declare interface SanityProject {
|
|
|
2770
2781
|
metadata: {
|
|
2771
2782
|
cliInitializedAt?: string
|
|
2772
2783
|
color?: string
|
|
2784
|
+
/**
|
|
2785
|
+
* @deprecated Use the `/user-applications` endpoint instead, which lists all deployed studios/applications
|
|
2786
|
+
* @see https://www.sanity.io/help/studio-host-user-applications
|
|
2787
|
+
*/
|
|
2773
2788
|
externalStudioHost?: string
|
|
2774
2789
|
}
|
|
2775
2790
|
}
|
package/dist/index.browser.js
CHANGED
|
@@ -87,8 +87,7 @@ function defineHttpRequest(envMiddleware2) {
|
|
|
87
87
|
]);
|
|
88
88
|
}
|
|
89
89
|
function shouldRetry(err, attempt, options) {
|
|
90
|
-
if (options.maxRetries === 0)
|
|
91
|
-
return !1;
|
|
90
|
+
if (options.maxRetries === 0) return !1;
|
|
92
91
|
const isSafe = options.method === "GET" || options.method === "HEAD", isQuery = (options.uri || options.url).startsWith("/data/query"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503);
|
|
93
92
|
return (isSafe || isQuery) && isRetriableResponse ? !0 : retry.shouldRetry(err, attempt, options);
|
|
94
93
|
}
|
|
@@ -627,14 +626,24 @@ function _fetch(client, httpRequest, _stega, query, _params = {}, options = {})
|
|
|
627
626
|
) : $request.pipe(map(mapResponse));
|
|
628
627
|
}
|
|
629
628
|
function _getDocument(client, httpRequest, id, opts = {}) {
|
|
630
|
-
const options = {
|
|
629
|
+
const options = {
|
|
630
|
+
uri: _getDataUrl(client, "doc", id),
|
|
631
|
+
json: !0,
|
|
632
|
+
tag: opts.tag,
|
|
633
|
+
signal: opts.signal
|
|
634
|
+
};
|
|
631
635
|
return _requestObservable(client, httpRequest, options).pipe(
|
|
632
636
|
filter(isResponse),
|
|
633
637
|
map((event) => event.body.documents && event.body.documents[0])
|
|
634
638
|
);
|
|
635
639
|
}
|
|
636
640
|
function _getDocuments(client, httpRequest, ids, opts = {}) {
|
|
637
|
-
const options = {
|
|
641
|
+
const options = {
|
|
642
|
+
uri: _getDataUrl(client, "doc", ids.join(",")),
|
|
643
|
+
json: !0,
|
|
644
|
+
tag: opts.tag,
|
|
645
|
+
signal: opts.signal
|
|
646
|
+
};
|
|
638
647
|
return _requestObservable(client, httpRequest, options).pipe(
|
|
639
648
|
filter(isResponse),
|
|
640
649
|
map((event) => {
|
|
@@ -687,6 +696,7 @@ function _dataRequest(client, httpRequest, endpoint, body, options = {}) {
|
|
|
687
696
|
tag,
|
|
688
697
|
returnQuery,
|
|
689
698
|
perspective: options.perspective,
|
|
699
|
+
bundlePerspective: options.bundlePerspective,
|
|
690
700
|
resultSourceMap: options.resultSourceMap,
|
|
691
701
|
lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId,
|
|
692
702
|
canUseCdn: isQuery,
|
|
@@ -724,8 +734,8 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
724
734
|
if (tag && options.tag !== null && (options.query = { tag: requestTag(tag), ...options.query }), ["GET", "HEAD", "POST"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
|
|
725
735
|
const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
|
|
726
736
|
resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });
|
|
727
|
-
const perspective = options.perspective || config.perspective;
|
|
728
|
-
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query });
|
|
737
|
+
const perspective = options.perspective || config.perspective, bundlePerspective = options.bundlePerspective || config.bundlePerspective;
|
|
738
|
+
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), typeof bundlePerspective == "string" && (options.query = { perspective: void 0, bundlePerspective, ...options.query }), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query });
|
|
729
739
|
}
|
|
730
740
|
const reqOptions = requestOptions(
|
|
731
741
|
config,
|