🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@sanity/client

Package Overview
Dependencies
Maintainers
112
Versions
1151
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
7.19.0
to
7.20.0
+1
-1
package.json
{
"name": "@sanity/client",
"version": "7.19.0",
"version": "7.20.0",
"description": "Client for retrieving, creating and patching data from Sanity.io",

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

@@ -7,2 +7,13 @@ import {lastValueFrom, type Observable} from 'rxjs'

type ListOptions = {
includeMembers?: boolean
includeFeatures?: boolean
organizationId?: string
onlyExplicitMembership?: boolean
}
type OmittedProjectFields<T extends ListOptions | undefined> =
| (T extends {includeMembers: false} ? 'members' : never)
| (T extends {includeFeatures: false} ? 'features' : never)
/** @internal */

@@ -22,20 +33,9 @@ export class ObservableProjectsClient {

* - `includeMembers` - Whether to include members in the response (default: true)
* - `includeFeatures` - Whether to include features in the response (default: true)
* - `organizationId` - ID of the organization to fetch projects for
* - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
*/
list(options?: {
includeMembers?: true
organizationId?: string
onlyExplicitMembership?: boolean
}): Observable<SanityProject[]>
list(options?: {
includeMembers?: false
organizationId?: string
onlyExplicitMembership?: boolean
}): Observable<Omit<SanityProject, 'members'>[]>
list(options?: {
includeMembers?: boolean
organizationId?: string
onlyExplicitMembership?: boolean
}): Observable<SanityProject[] | Omit<SanityProject, 'members'>[]> {
list<T extends ListOptions>(
options?: T,
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]> {
const query: Record<string, string> = {}

@@ -46,10 +46,15 @@ const uri = '/projects'

}
if (options?.includeFeatures === false) {
query.includeFeatures = 'false'
}
if (options?.organizationId) {
query.organizationId = options.organizationId
}
if (options?.onlyExplicitMembership === true) {
if (options?.onlyExplicitMembership) {
query.onlyExplicitMembership = 'true'
}
return _request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query})
return _request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query}) as Observable<
Omit<SanityProject, OmittedProjectFields<T>>[]
>
}

@@ -81,20 +86,9 @@

* - `includeMembers` - Whether to include members in the response (default: true)
* - `includeFeatures` - Whether to include features in the response (default: true)
* - `organizationId` - ID of the organization to fetch projects for
* - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
*/
list(options?: {
includeMembers?: true
organizationId?: string
onlyExplicitMembership?: boolean
}): Promise<SanityProject[]>
list(options?: {
includeMembers?: false
organizationId?: string
onlyExplicitMembership?: boolean
}): Promise<Omit<SanityProject, 'members'>[]>
list(options?: {
includeMembers?: boolean
organizationId?: string
onlyExplicitMembership?: boolean
}): Promise<SanityProject[] | Omit<SanityProject, 'members'>[]> {
list<T extends ListOptions>(
options?: T,
): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]> {
const query: Record<string, string> = {}

@@ -105,9 +99,16 @@ const uri = '/projects'

}
if (options?.includeFeatures === false) {
query.includeFeatures = 'false'
}
if (options?.organizationId) {
query.organizationId = options.organizationId
}
if (options?.onlyExplicitMembership === true) {
if (options?.onlyExplicitMembership) {
query.onlyExplicitMembership = 'true'
}
return lastValueFrom(_request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query}))
return lastValueFrom(
_request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query}) as Observable<
Omit<SanityProject, OmittedProjectFields<T>>[]
>,
)
}

@@ -114,0 +115,0 @@

@@ -532,2 +532,3 @@ // deno-lint-ignore-file no-empty-interface

members: SanityProjectMember[]
features: string[]
metadata: {

@@ -534,0 +535,0 @@ cliInitializedAt?: string

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 too big to display

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 too big to display

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 too big to display

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 too big to display

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 too big to display

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 too big to display