Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@sanity/client

Package Overview
Dependencies
Maintainers
44
Versions
986
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/client - npm Package Compare versions

Comparing version 6.12.2 to 6.12.3

dist/_chunks/nodeMiddleware-Gh18jsRe.cjs

4

dist/index.js

@@ -1,3 +0,3 @@

import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-itgO-mht.js';
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-itgO-mht.js';
import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-OX5-R8Hk.js';
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-OX5-R8Hk.js';
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';

@@ -4,0 +4,0 @@

@@ -1,5 +0,5 @@

import { SanityClient, ObservableSanityClient, defineCreateClientExports, middleware } from './_chunks/nodeMiddleware-itgO-mht.js';
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from './_chunks/nodeMiddleware-itgO-mht.js';
import { SanityClient, ObservableSanityClient, defineCreateClientExports, middleware } from './_chunks/nodeMiddleware-OX5-R8Hk.js';
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from './_chunks/nodeMiddleware-OX5-R8Hk.js';
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
export { encodeIntoResult, stegaEncodeSourceMap } from './_chunks/stegaEncodeSourceMap-6b6FFhTO.js';
export { encodeIntoResult, stegaEncodeSourceMap } from './_chunks/stegaEncodeSourceMap-OKnT3zAM.js';

@@ -6,0 +6,0 @@ class SanityStegaClient extends SanityClient {

{
"name": "@sanity/client",
"version": "6.12.2",
"version": "6.12.3",
"description": "Client for retrieving, creating and patching data from Sanity.io",

@@ -5,0 +5,0 @@ "keywords": [

@@ -1,2 +0,2 @@

import type {Any, QueryParams} from '../types'
import type {Any, ListenParams, QueryParams} from '../types'

@@ -9,3 +9,3 @@ export const encodeQueryString = ({

query: string
params?: QueryParams
params?: ListenParams | QueryParams
options?: Any

@@ -12,0 +12,0 @@ }) => {

import {Observable} from 'rxjs'
import type {ObservableSanityClient, SanityClient} from '../SanityClient'
import type {Any, ListenEvent, ListenOptions, MutationEvent, QueryParams} from '../types'
import type {Any, ListenEvent, ListenOptions, ListenParams, MutationEvent} from '../types'
import defaults from '../util/defaults'

@@ -38,3 +38,3 @@ import {pick} from '../util/pick'

query: string,
params?: QueryParams,
params?: ListenParams,
): Observable<MutationEvent<R>>

@@ -52,3 +52,3 @@ /**

query: string,
params?: QueryParams,
params?: ListenParams,
options?: ListenOptions,

@@ -60,3 +60,3 @@ ): Observable<ListenEvent<R>>

query: string,
params?: QueryParams,
params?: ListenParams,
opts: ListenOptions = {},

@@ -63,0 +63,0 @@ ): Observable<MutationEvent<R> | ListenEvent<R>> {

@@ -30,4 +30,3 @@ import {lastValueFrom, Observable} from 'rxjs'

QueryParams,
QueryParamsLikelyByMistake,
QueryParamsWithoutQueryOptions,
QueryWithoutParams,
RawQueryResponse,

@@ -137,3 +136,6 @@ RawRequestOptions,

*/
fetch<R = Any>(query: string): Observable<R>
fetch<R = Any, Q extends QueryWithoutParams = QueryWithoutParams>(
query: string,
params?: Q | QueryWithoutParams,
): Observable<R>
/**

@@ -143,16 +145,9 @@ * Perform a GROQ-query against the configured dataset.

* @param query - GROQ-query to perform
* @param params - Query parameters
* @param params - Optional query parameters
* @param options - Optional request options
*/
fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(query: string, params: Q): Observable<R>
/**
* Perform a GROQ-query against the configured dataset.
*
* @param query - GROQ-query to perform
* @param params - Query parameters
* @param options - Request options
*/
fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>(
query: string,
params: Q | undefined,
options: FilteredResponseQueryOptions,
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
options?: FilteredResponseQueryOptions,
): Observable<R>

@@ -163,31 +158,12 @@ /**

* @param query - GROQ-query to perform
* @param params - Query parameters
* @param params - Optional query parameters
* @param options - Request options
*/
fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>(
query: string,
params: Q | undefined,
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
options: UnfilteredResponseQueryOptions,
): Observable<RawQueryResponse<R>>
/**
* You're passing in query parameters to a GROQ query that looks like query options.
* This is likely a mistake, you can either:
* a) replace the second argument with an empty object, and move the options to the third argument
* ```diff
* -client.fetch(query, {cache: 'no-store'})
* +client.fetch(query, {}, {cache: 'no-store'})
* ```
* b) add a generic type parameter that allows the query parameters to be passed in to silence the error
* @deprecated not actually deprecated, marking it as deprecated makes this error easier to spot
*/
fetch<
// eslint-disable-next-line @typescript-eslint/no-unused-vars
R = Any,
>(
fetch<R, Q>(
query: string,
params: QueryParamsLikelyByMistake & QueryParams,
options?: QueryOptions,
): unknown
fetch<R, Q extends QueryParams>(
query: string,
params?: Q,

@@ -802,3 +778,6 @@ options?: QueryOptions,

*/
fetch<R = Any>(query: string): Promise<R>
fetch<R = Any, Q extends QueryWithoutParams = QueryWithoutParams>(
query: string,
params?: Q | QueryWithoutParams,
): Promise<R>
/**

@@ -809,15 +788,8 @@ * Perform a GROQ-query against the configured dataset.

* @param params - Optional query parameters
* @param options - Optional request options
*/
fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(query: string, params: Q): Promise<R>
/**
* Perform a GROQ-query against the configured dataset.
*
* @param query - GROQ-query to perform
* @param params - Optional query parameters
* @param options - Request options
*/
fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>(
query: string,
params: Q | undefined,
options: FilteredResponseQueryOptions,
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
options?: FilteredResponseQueryOptions,
): Promise<R>

@@ -831,31 +803,8 @@ /**

*/
fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(
fetch<R = Any, Q extends QueryWithoutParams | QueryParams = QueryParams>(
query: string,
params: Q | undefined,
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
options: UnfilteredResponseQueryOptions,
): Promise<RawQueryResponse<R>>
/**
* You're passing in query parameters to a GROQ query that looks like query options.
* This is likely a mistake, you can either:
* a) replace the second argument with an empty object, and move the options to the third argument
* ```diff
* -client.fetch(query, {cache: 'no-store'})
* +client.fetch(query, {}, {cache: 'no-store'})
* ```
* b) add a generic type parameter that allows the query parameters to be passed in to silence the error
* @deprecated not actually deprecated, marking it as deprecated makes this error easier to spot
*/
fetch<
// eslint-disable-next-line @typescript-eslint/no-unused-vars
R = Any,
>(
query: string,
params: QueryParamsLikelyByMistake & QueryParams,
options?: QueryOptions,
): unknown
fetch<R, Q extends QueryParams>(
query: string,
params?: Q,
options?: QueryOptions,
): Promise<RawQueryResponse<R> | R> {
fetch<R, Q>(query: string, params?: Q, options?: QueryOptions): Promise<RawQueryResponse<R> | R> {
return lastValueFrom(

@@ -862,0 +811,0 @@ dataMethods._fetch<R, Q>(

@@ -33,11 +33,2 @@ // deno-lint-ignore-file no-empty-interface

/**
* Options for the native `fetch` feature, used by the Next.js app-router
* @public
*/
export interface RequestFetchOptions<T = 'next'> {
cache?: RequestInit['cache']
next?: T extends keyof RequestInit ? RequestInit[T] : never
}
/** @public */

@@ -94,3 +85,8 @@ export type ClientPerspective = 'previewDrafts' | 'published' | 'raw'

*/
fetch?: RequestFetchOptions | boolean
fetch?:
| {
cache?: ResponseQueryOptions['cache']
next?: ResponseQueryOptions['next']
}
| boolean
/**

@@ -439,66 +435,51 @@ * Options for how, if enabled, Content Source Maps are encoded into query results using steganography

/** @public */
export type QueryParams = {[key: string]: Any}
/**
* Verify this type has all the same keys as QueryOptions before exporting
* @internal
*/
export type _QueryParamsLikelyByMistake = {
export interface QueryParams {
/* eslint-disable @typescript-eslint/no-explicit-any */
[key: string]: any
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
body?: Any
body?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
cache?: Any
cache?: 'next' extends keyof RequestInit ? never : any
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
filterResponse?: Any
filterResponse?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
headers?: Any
headers?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
method?: Any
method?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
next?: Any
next?: 'next' extends keyof RequestInit ? never : any
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
perspective?: Any
perspective?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
query?: Any
query?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
resultSourceMap?: Any
resultSourceMap?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
signal?: Any
signal?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
stega?: Any
stega?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
tag?: Any
tag?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
timeout?: Any
timeout?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
token?: Any
token?: never
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
useCdn?: Any
useCdn?: never
/* eslint-enable @typescript-eslint/no-explicit-any */
}
/**
* It's easy to accidentally set query options such as `filterResponse`, `cache` and `next` as the second parameter in `client.fetch`,
* as that is a wide type used to set GROQ query paramaters and it accepts anything that can serialize to JSON.
* This type is used to prevent that, and will cause a type error if you try to pass a query option as the second parameter.
* If this type is `never`, it means `_QueryParamsLikelyByMistake` is missing keys from `QueryOptions`.
* @internal
* This type can be used with `client.fetch` to indicate that the query has no GROQ parameters.
* @public
*/
export type QueryParamsLikelyByMistake =
Required<_QueryParamsLikelyByMistake> extends Record<keyof QueryOptions, Any>
? _QueryParamsLikelyByMistake
: never
export type QueryWithoutParams = Record<string, never> | undefined
/**
* It's easy to accidentally set query options such as `filterResponse`, `cache` and `next` as the second parameter in `client.fetch`,
* as that is a wide type used to set GROQ query paramaters and it accepts anything that can serialize to JSON.
* This type is used to prevent that, and will cause a type error if you try to pass a query option as the second parameter.
* @internal
*/
export type QueryParamsWithoutQueryOptions = {
[K in keyof _QueryParamsLikelyByMistake]: never
} & QueryParams
/** @internal */
export type MutationSelection = {query: string; params?: QueryParams} | {id: string | string[]}
export type MutationSelectionQueryParams = {[key: string]: Any}
/** @internal */
export type MutationSelection =
| {query: string; params?: MutationSelectionQueryParams}
| {id: string | string[]}
/** @internal */
export type PatchSelection = string | string[] | MutationSelection

@@ -686,2 +667,5 @@ /** @internal */

/** @public */
export type ListenParams = {[key: string]: Any}
/** @public */
export interface ListenOptions {

@@ -688,0 +672,0 @@ /**

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 not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc