@sanity/client
Advanced tools
Comparing version 6.20.2 to 6.21.0
{ | ||
"name": "@sanity/client", | ||
"version": "6.20.2", | ||
"version": "6.21.0", | ||
"description": "Client for retrieving, creating and patching data from Sanity.io", | ||
@@ -125,4 +125,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@edge-runtime/types": "^2.2.9", | ||
"@edge-runtime/vm": "^3.2.0", | ||
"@edge-runtime/types": "^3.0.0", | ||
"@edge-runtime/vm": "^4.0.0", | ||
"@rollup/plugin-commonjs": "^26.0.1", | ||
@@ -129,0 +129,0 @@ "@rollup/plugin-node-resolve": "^15.2.3", |
@@ -20,2 +20,3 @@ import {lastValueFrom, Observable} from 'rxjs' | ||
ClientConfig, | ||
ClientReturn, | ||
FilteredResponseQueryOptions, | ||
@@ -146,6 +147,7 @@ FirstDocumentIdMutationOptions, | ||
*/ | ||
fetch<R = Any, Q extends QueryWithoutParams = QueryWithoutParams>( | ||
query: string, | ||
params?: Q | QueryWithoutParams, | ||
): Observable<R> | ||
fetch< | ||
R = Any, | ||
Q extends QueryWithoutParams = QueryWithoutParams, | ||
const G extends string = string, | ||
>(query: G, params?: Q | QueryWithoutParams): Observable<ClientReturn<G, R>> | ||
/** | ||
@@ -158,7 +160,11 @@ * Perform a GROQ-query against the configured dataset. | ||
*/ | ||
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>( | ||
query: string, | ||
fetch< | ||
R = Any, | ||
Q extends QueryWithoutParams | QueryParams = QueryParams, | ||
const G extends string = string, | ||
>( | ||
query: G, | ||
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q, | ||
options?: FilteredResponseQueryOptions, | ||
): Observable<R> | ||
): Observable<ClientReturn<G, R>> | ||
/** | ||
@@ -171,7 +177,11 @@ * Perform a GROQ-query against the configured dataset. | ||
*/ | ||
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>( | ||
fetch< | ||
R = Any, | ||
Q extends QueryWithoutParams | QueryParams = QueryParams, | ||
const G extends string = string, | ||
>( | ||
query: string, | ||
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q, | ||
options: UnfilteredResponseQueryOptions, | ||
): Observable<RawQueryResponse<R>> | ||
): Observable<RawQueryResponse<ClientReturn<G, R>>> | ||
/** | ||
@@ -184,9 +194,13 @@ * Perform a GROQ-query against the configured dataset. | ||
*/ | ||
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>( | ||
query: string, | ||
fetch< | ||
R = Any, | ||
Q extends QueryWithoutParams | QueryParams = QueryParams, | ||
const G extends string = string, | ||
>( | ||
query: G, | ||
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q, | ||
options: UnfilteredResponseWithoutQuery, | ||
): Observable<RawQuerylessQueryResponse<R>> | ||
fetch<R, Q>( | ||
query: string, | ||
): Observable<RawQuerylessQueryResponse<ClientReturn<G, R>>> | ||
fetch<R, Q, const G extends string>( | ||
query: G, | ||
params?: Q, | ||
@@ -816,6 +830,7 @@ options?: QueryOptions, | ||
*/ | ||
fetch<R = Any, Q extends QueryWithoutParams = QueryWithoutParams>( | ||
query: string, | ||
params?: Q | QueryWithoutParams, | ||
): Promise<R> | ||
fetch< | ||
R = Any, | ||
Q extends QueryWithoutParams = QueryWithoutParams, | ||
const G extends string = string, | ||
>(query: G, params?: Q | QueryWithoutParams): Promise<ClientReturn<G, R>> | ||
/** | ||
@@ -828,7 +843,11 @@ * Perform a GROQ-query against the configured dataset. | ||
*/ | ||
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>( | ||
query: string, | ||
fetch< | ||
R = Any, | ||
Q extends QueryWithoutParams | QueryParams = QueryParams, | ||
const G extends string = string, | ||
>( | ||
query: G, | ||
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q, | ||
options?: FilteredResponseQueryOptions, | ||
): Promise<R> | ||
): Promise<ClientReturn<G, R>> | ||
/** | ||
@@ -841,7 +860,11 @@ * Perform a GROQ-query against the configured dataset. | ||
*/ | ||
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>( | ||
query: string, | ||
fetch< | ||
R = Any, | ||
Q extends QueryWithoutParams | QueryParams = QueryParams, | ||
const G extends string = string, | ||
>( | ||
query: G, | ||
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q, | ||
options: UnfilteredResponseQueryOptions, | ||
): Promise<RawQueryResponse<R>> | ||
): Promise<RawQueryResponse<ClientReturn<G, R>>> | ||
/** | ||
@@ -854,10 +877,18 @@ * Perform a GROQ-query against the configured dataset. | ||
*/ | ||
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>( | ||
query: string, | ||
fetch< | ||
R = Any, | ||
Q extends QueryWithoutParams | QueryParams = QueryParams, | ||
const G extends string = string, | ||
>( | ||
query: G, | ||
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q, | ||
options: UnfilteredResponseWithoutQuery, | ||
): Promise<RawQuerylessQueryResponse<R>> | ||
fetch<R, Q>(query: string, params?: Q, options?: QueryOptions): Promise<RawQueryResponse<R> | R> { | ||
): Promise<RawQuerylessQueryResponse<ClientReturn<G, R>>> | ||
fetch<R, Q, const G extends string>( | ||
query: G, | ||
params?: Q, | ||
options?: QueryOptions, | ||
): Promise<RawQueryResponse<ClientReturn<G, R>> | ClientReturn<G, R>> { | ||
return lastValueFrom( | ||
dataMethods._fetch<R, Q>( | ||
dataMethods._fetch<ClientReturn<G, R>, Q>( | ||
this, | ||
@@ -864,0 +895,0 @@ this.#httpRequest, |
@@ -1239,2 +1239,11 @@ // deno-lint-ignore-file no-empty-interface | ||
/** @public */ | ||
export interface SanityQueries {} | ||
/** @public */ | ||
export type ClientReturn< | ||
GroqString extends string, | ||
Fallback = Any, | ||
> = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback | ||
export type { | ||
@@ -1241,0 +1250,0 @@ ContentSourceMapParsedPath, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2252105
25447