@sanity/client 7.19.0 → 7.20.0
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/index.browser.cjs +22 -2
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +30 -24
- package/dist/index.browser.d.ts +30 -24
- package/dist/index.browser.js +22 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -24
- package/dist/index.d.ts +30 -24
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +30 -24
- package/dist/stega.browser.d.ts +30 -24
- package/dist/stega.d.cts +30 -24
- package/dist/stega.d.ts +30 -24
- package/package.json +1 -1
- package/src/projects/ProjectsClient.ts +37 -36
- package/src/types.ts +1 -0
- package/umd/sanityClient.js +22 -2
- package/umd/sanityClient.min.js +2 -2
package/dist/stega.browser.d.cts
CHANGED
|
@@ -2299,6 +2299,13 @@ export declare type ListenParams = {
|
|
|
2299
2299
|
[key: string]: Any
|
|
2300
2300
|
}
|
|
2301
2301
|
|
|
2302
|
+
declare type ListOptions = {
|
|
2303
|
+
includeMembers?: boolean
|
|
2304
|
+
includeFeatures?: boolean
|
|
2305
|
+
organizationId?: string
|
|
2306
|
+
onlyExplicitMembership?: boolean
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2302
2309
|
/**
|
|
2303
2310
|
* @public
|
|
2304
2311
|
*/
|
|
@@ -2862,19 +2869,13 @@ export declare class ObservableProjectsClient {
|
|
|
2862
2869
|
*
|
|
2863
2870
|
* @param options - Options for the list request
|
|
2864
2871
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2872
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
2865
2873
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
2866
|
-
* - `onlyExplicitMembership` -
|
|
2867
|
-
*/
|
|
2868
|
-
list(
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
onlyExplicitMembership?: boolean
|
|
2872
|
-
}): Observable<SanityProject[]>
|
|
2873
|
-
list(options?: {
|
|
2874
|
-
includeMembers?: false
|
|
2875
|
-
organizationId?: string
|
|
2876
|
-
onlyExplicitMembership?: boolean
|
|
2877
|
-
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
2874
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
2875
|
+
*/
|
|
2876
|
+
list<T extends ListOptions>(
|
|
2877
|
+
options?: T,
|
|
2878
|
+
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
2878
2879
|
/**
|
|
2879
2880
|
* Fetch a project by project ID
|
|
2880
2881
|
*
|
|
@@ -4035,6 +4036,18 @@ export declare class ObservableUsersClient {
|
|
|
4035
4036
|
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4036
4037
|
}
|
|
4037
4038
|
|
|
4039
|
+
declare type OmittedProjectFields<T extends ListOptions | undefined> =
|
|
4040
|
+
| (T extends {
|
|
4041
|
+
includeMembers: false
|
|
4042
|
+
}
|
|
4043
|
+
? 'members'
|
|
4044
|
+
: never)
|
|
4045
|
+
| (T extends {
|
|
4046
|
+
includeFeatures: false
|
|
4047
|
+
}
|
|
4048
|
+
? 'features'
|
|
4049
|
+
: never)
|
|
4050
|
+
|
|
4038
4051
|
/**
|
|
4039
4052
|
* The listener connection has been established
|
|
4040
4053
|
* note: it's usually a better option to use the 'welcome' event
|
|
@@ -4251,19 +4264,11 @@ export declare class ProjectsClient {
|
|
|
4251
4264
|
*
|
|
4252
4265
|
* @param options - Options for the list request
|
|
4253
4266
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
4267
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
4254
4268
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
4255
|
-
* - `onlyExplicitMembership` -
|
|
4256
|
-
*/
|
|
4257
|
-
list(options?:
|
|
4258
|
-
includeMembers?: true
|
|
4259
|
-
organizationId?: string
|
|
4260
|
-
onlyExplicitMembership?: boolean
|
|
4261
|
-
}): Promise<SanityProject[]>
|
|
4262
|
-
list(options?: {
|
|
4263
|
-
includeMembers?: false
|
|
4264
|
-
organizationId?: string
|
|
4265
|
-
onlyExplicitMembership?: boolean
|
|
4266
|
-
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
4269
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
4270
|
+
*/
|
|
4271
|
+
list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
4267
4272
|
/**
|
|
4268
4273
|
* Fetch a project by project ID
|
|
4269
4274
|
*
|
|
@@ -5922,6 +5927,7 @@ export declare interface SanityProject {
|
|
|
5922
5927
|
pendingInvites?: number
|
|
5923
5928
|
maxRetentionDays?: number
|
|
5924
5929
|
members: SanityProjectMember[]
|
|
5930
|
+
features: string[]
|
|
5925
5931
|
metadata: {
|
|
5926
5932
|
cliInitializedAt?: string
|
|
5927
5933
|
color?: string
|
package/dist/stega.browser.d.ts
CHANGED
|
@@ -2299,6 +2299,13 @@ export declare type ListenParams = {
|
|
|
2299
2299
|
[key: string]: Any
|
|
2300
2300
|
}
|
|
2301
2301
|
|
|
2302
|
+
declare type ListOptions = {
|
|
2303
|
+
includeMembers?: boolean
|
|
2304
|
+
includeFeatures?: boolean
|
|
2305
|
+
organizationId?: string
|
|
2306
|
+
onlyExplicitMembership?: boolean
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2302
2309
|
/**
|
|
2303
2310
|
* @public
|
|
2304
2311
|
*/
|
|
@@ -2862,19 +2869,13 @@ export declare class ObservableProjectsClient {
|
|
|
2862
2869
|
*
|
|
2863
2870
|
* @param options - Options for the list request
|
|
2864
2871
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2872
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
2865
2873
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
2866
|
-
* - `onlyExplicitMembership` -
|
|
2867
|
-
*/
|
|
2868
|
-
list(
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
onlyExplicitMembership?: boolean
|
|
2872
|
-
}): Observable<SanityProject[]>
|
|
2873
|
-
list(options?: {
|
|
2874
|
-
includeMembers?: false
|
|
2875
|
-
organizationId?: string
|
|
2876
|
-
onlyExplicitMembership?: boolean
|
|
2877
|
-
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
2874
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
2875
|
+
*/
|
|
2876
|
+
list<T extends ListOptions>(
|
|
2877
|
+
options?: T,
|
|
2878
|
+
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
2878
2879
|
/**
|
|
2879
2880
|
* Fetch a project by project ID
|
|
2880
2881
|
*
|
|
@@ -4035,6 +4036,18 @@ export declare class ObservableUsersClient {
|
|
|
4035
4036
|
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4036
4037
|
}
|
|
4037
4038
|
|
|
4039
|
+
declare type OmittedProjectFields<T extends ListOptions | undefined> =
|
|
4040
|
+
| (T extends {
|
|
4041
|
+
includeMembers: false
|
|
4042
|
+
}
|
|
4043
|
+
? 'members'
|
|
4044
|
+
: never)
|
|
4045
|
+
| (T extends {
|
|
4046
|
+
includeFeatures: false
|
|
4047
|
+
}
|
|
4048
|
+
? 'features'
|
|
4049
|
+
: never)
|
|
4050
|
+
|
|
4038
4051
|
/**
|
|
4039
4052
|
* The listener connection has been established
|
|
4040
4053
|
* note: it's usually a better option to use the 'welcome' event
|
|
@@ -4251,19 +4264,11 @@ export declare class ProjectsClient {
|
|
|
4251
4264
|
*
|
|
4252
4265
|
* @param options - Options for the list request
|
|
4253
4266
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
4267
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
4254
4268
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
4255
|
-
* - `onlyExplicitMembership` -
|
|
4256
|
-
*/
|
|
4257
|
-
list(options?:
|
|
4258
|
-
includeMembers?: true
|
|
4259
|
-
organizationId?: string
|
|
4260
|
-
onlyExplicitMembership?: boolean
|
|
4261
|
-
}): Promise<SanityProject[]>
|
|
4262
|
-
list(options?: {
|
|
4263
|
-
includeMembers?: false
|
|
4264
|
-
organizationId?: string
|
|
4265
|
-
onlyExplicitMembership?: boolean
|
|
4266
|
-
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
4269
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
4270
|
+
*/
|
|
4271
|
+
list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
4267
4272
|
/**
|
|
4268
4273
|
* Fetch a project by project ID
|
|
4269
4274
|
*
|
|
@@ -5922,6 +5927,7 @@ export declare interface SanityProject {
|
|
|
5922
5927
|
pendingInvites?: number
|
|
5923
5928
|
maxRetentionDays?: number
|
|
5924
5929
|
members: SanityProjectMember[]
|
|
5930
|
+
features: string[]
|
|
5925
5931
|
metadata: {
|
|
5926
5932
|
cliInitializedAt?: string
|
|
5927
5933
|
color?: string
|
package/dist/stega.d.cts
CHANGED
|
@@ -2299,6 +2299,13 @@ export declare type ListenParams = {
|
|
|
2299
2299
|
[key: string]: Any
|
|
2300
2300
|
}
|
|
2301
2301
|
|
|
2302
|
+
declare type ListOptions = {
|
|
2303
|
+
includeMembers?: boolean
|
|
2304
|
+
includeFeatures?: boolean
|
|
2305
|
+
organizationId?: string
|
|
2306
|
+
onlyExplicitMembership?: boolean
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2302
2309
|
/**
|
|
2303
2310
|
* @public
|
|
2304
2311
|
*/
|
|
@@ -2862,19 +2869,13 @@ export declare class ObservableProjectsClient {
|
|
|
2862
2869
|
*
|
|
2863
2870
|
* @param options - Options for the list request
|
|
2864
2871
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2872
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
2865
2873
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
2866
|
-
* - `onlyExplicitMembership` -
|
|
2867
|
-
*/
|
|
2868
|
-
list(
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
onlyExplicitMembership?: boolean
|
|
2872
|
-
}): Observable<SanityProject[]>
|
|
2873
|
-
list(options?: {
|
|
2874
|
-
includeMembers?: false
|
|
2875
|
-
organizationId?: string
|
|
2876
|
-
onlyExplicitMembership?: boolean
|
|
2877
|
-
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
2874
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
2875
|
+
*/
|
|
2876
|
+
list<T extends ListOptions>(
|
|
2877
|
+
options?: T,
|
|
2878
|
+
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
2878
2879
|
/**
|
|
2879
2880
|
* Fetch a project by project ID
|
|
2880
2881
|
*
|
|
@@ -4035,6 +4036,18 @@ export declare class ObservableUsersClient {
|
|
|
4035
4036
|
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4036
4037
|
}
|
|
4037
4038
|
|
|
4039
|
+
declare type OmittedProjectFields<T extends ListOptions | undefined> =
|
|
4040
|
+
| (T extends {
|
|
4041
|
+
includeMembers: false
|
|
4042
|
+
}
|
|
4043
|
+
? 'members'
|
|
4044
|
+
: never)
|
|
4045
|
+
| (T extends {
|
|
4046
|
+
includeFeatures: false
|
|
4047
|
+
}
|
|
4048
|
+
? 'features'
|
|
4049
|
+
: never)
|
|
4050
|
+
|
|
4038
4051
|
/**
|
|
4039
4052
|
* The listener connection has been established
|
|
4040
4053
|
* note: it's usually a better option to use the 'welcome' event
|
|
@@ -4251,19 +4264,11 @@ export declare class ProjectsClient {
|
|
|
4251
4264
|
*
|
|
4252
4265
|
* @param options - Options for the list request
|
|
4253
4266
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
4267
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
4254
4268
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
4255
|
-
* - `onlyExplicitMembership` -
|
|
4256
|
-
*/
|
|
4257
|
-
list(options?:
|
|
4258
|
-
includeMembers?: true
|
|
4259
|
-
organizationId?: string
|
|
4260
|
-
onlyExplicitMembership?: boolean
|
|
4261
|
-
}): Promise<SanityProject[]>
|
|
4262
|
-
list(options?: {
|
|
4263
|
-
includeMembers?: false
|
|
4264
|
-
organizationId?: string
|
|
4265
|
-
onlyExplicitMembership?: boolean
|
|
4266
|
-
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
4269
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
4270
|
+
*/
|
|
4271
|
+
list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
4267
4272
|
/**
|
|
4268
4273
|
* Fetch a project by project ID
|
|
4269
4274
|
*
|
|
@@ -5922,6 +5927,7 @@ export declare interface SanityProject {
|
|
|
5922
5927
|
pendingInvites?: number
|
|
5923
5928
|
maxRetentionDays?: number
|
|
5924
5929
|
members: SanityProjectMember[]
|
|
5930
|
+
features: string[]
|
|
5925
5931
|
metadata: {
|
|
5926
5932
|
cliInitializedAt?: string
|
|
5927
5933
|
color?: string
|
package/dist/stega.d.ts
CHANGED
|
@@ -2299,6 +2299,13 @@ export declare type ListenParams = {
|
|
|
2299
2299
|
[key: string]: Any
|
|
2300
2300
|
}
|
|
2301
2301
|
|
|
2302
|
+
declare type ListOptions = {
|
|
2303
|
+
includeMembers?: boolean
|
|
2304
|
+
includeFeatures?: boolean
|
|
2305
|
+
organizationId?: string
|
|
2306
|
+
onlyExplicitMembership?: boolean
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2302
2309
|
/**
|
|
2303
2310
|
* @public
|
|
2304
2311
|
*/
|
|
@@ -2862,19 +2869,13 @@ export declare class ObservableProjectsClient {
|
|
|
2862
2869
|
*
|
|
2863
2870
|
* @param options - Options for the list request
|
|
2864
2871
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2872
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
2865
2873
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
2866
|
-
* - `onlyExplicitMembership` -
|
|
2867
|
-
*/
|
|
2868
|
-
list(
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
onlyExplicitMembership?: boolean
|
|
2872
|
-
}): Observable<SanityProject[]>
|
|
2873
|
-
list(options?: {
|
|
2874
|
-
includeMembers?: false
|
|
2875
|
-
organizationId?: string
|
|
2876
|
-
onlyExplicitMembership?: boolean
|
|
2877
|
-
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
2874
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
2875
|
+
*/
|
|
2876
|
+
list<T extends ListOptions>(
|
|
2877
|
+
options?: T,
|
|
2878
|
+
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
2878
2879
|
/**
|
|
2879
2880
|
* Fetch a project by project ID
|
|
2880
2881
|
*
|
|
@@ -4035,6 +4036,18 @@ export declare class ObservableUsersClient {
|
|
|
4035
4036
|
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4036
4037
|
}
|
|
4037
4038
|
|
|
4039
|
+
declare type OmittedProjectFields<T extends ListOptions | undefined> =
|
|
4040
|
+
| (T extends {
|
|
4041
|
+
includeMembers: false
|
|
4042
|
+
}
|
|
4043
|
+
? 'members'
|
|
4044
|
+
: never)
|
|
4045
|
+
| (T extends {
|
|
4046
|
+
includeFeatures: false
|
|
4047
|
+
}
|
|
4048
|
+
? 'features'
|
|
4049
|
+
: never)
|
|
4050
|
+
|
|
4038
4051
|
/**
|
|
4039
4052
|
* The listener connection has been established
|
|
4040
4053
|
* note: it's usually a better option to use the 'welcome' event
|
|
@@ -4251,19 +4264,11 @@ export declare class ProjectsClient {
|
|
|
4251
4264
|
*
|
|
4252
4265
|
* @param options - Options for the list request
|
|
4253
4266
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
4267
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
4254
4268
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
4255
|
-
* - `onlyExplicitMembership` -
|
|
4256
|
-
*/
|
|
4257
|
-
list(options?:
|
|
4258
|
-
includeMembers?: true
|
|
4259
|
-
organizationId?: string
|
|
4260
|
-
onlyExplicitMembership?: boolean
|
|
4261
|
-
}): Promise<SanityProject[]>
|
|
4262
|
-
list(options?: {
|
|
4263
|
-
includeMembers?: false
|
|
4264
|
-
organizationId?: string
|
|
4265
|
-
onlyExplicitMembership?: boolean
|
|
4266
|
-
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
4269
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
4270
|
+
*/
|
|
4271
|
+
list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
4267
4272
|
/**
|
|
4268
4273
|
* Fetch a project by project ID
|
|
4269
4274
|
*
|
|
@@ -5922,6 +5927,7 @@ export declare interface SanityProject {
|
|
|
5922
5927
|
pendingInvites?: number
|
|
5923
5928
|
maxRetentionDays?: number
|
|
5924
5929
|
members: SanityProjectMember[]
|
|
5930
|
+
features: string[]
|
|
5925
5931
|
metadata: {
|
|
5926
5932
|
cliInitializedAt?: string
|
|
5927
5933
|
color?: string
|
package/package.json
CHANGED
|
@@ -4,6 +4,17 @@ import {_request} from '../data/dataMethods'
|
|
|
4
4
|
import type {ObservableSanityClient, SanityClient} from '../SanityClient'
|
|
5
5
|
import type {HttpRequest, SanityProject} from '../types'
|
|
6
6
|
|
|
7
|
+
type ListOptions = {
|
|
8
|
+
includeMembers?: boolean
|
|
9
|
+
includeFeatures?: boolean
|
|
10
|
+
organizationId?: string
|
|
11
|
+
onlyExplicitMembership?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type OmittedProjectFields<T extends ListOptions | undefined> =
|
|
15
|
+
| (T extends {includeMembers: false} ? 'members' : never)
|
|
16
|
+
| (T extends {includeFeatures: false} ? 'features' : never)
|
|
17
|
+
|
|
7
18
|
/** @internal */
|
|
8
19
|
export class ObservableProjectsClient {
|
|
9
20
|
#client: ObservableSanityClient
|
|
@@ -18,37 +29,31 @@ export class ObservableProjectsClient {
|
|
|
18
29
|
*
|
|
19
30
|
* @param options - Options for the list request
|
|
20
31
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
32
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
21
33
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
22
|
-
* - `onlyExplicitMembership` -
|
|
34
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
23
35
|
*/
|
|
24
|
-
list(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
onlyExplicitMembership?: boolean
|
|
28
|
-
}): Observable<SanityProject[]>
|
|
29
|
-
list(options?: {
|
|
30
|
-
includeMembers?: false
|
|
31
|
-
organizationId?: string
|
|
32
|
-
onlyExplicitMembership?: boolean
|
|
33
|
-
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
34
|
-
list(options?: {
|
|
35
|
-
includeMembers?: boolean
|
|
36
|
-
organizationId?: string
|
|
37
|
-
onlyExplicitMembership?: boolean
|
|
38
|
-
}): Observable<SanityProject[] | Omit<SanityProject, 'members'>[]> {
|
|
36
|
+
list<T extends ListOptions>(
|
|
37
|
+
options?: T,
|
|
38
|
+
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]> {
|
|
39
39
|
const query: Record<string, string> = {}
|
|
40
40
|
const uri = '/projects'
|
|
41
41
|
if (options?.includeMembers === false) {
|
|
42
42
|
query.includeMembers = 'false'
|
|
43
43
|
}
|
|
44
|
+
if (options?.includeFeatures === false) {
|
|
45
|
+
query.includeFeatures = 'false'
|
|
46
|
+
}
|
|
44
47
|
if (options?.organizationId) {
|
|
45
48
|
query.organizationId = options.organizationId
|
|
46
49
|
}
|
|
47
|
-
if (options?.onlyExplicitMembership
|
|
50
|
+
if (options?.onlyExplicitMembership) {
|
|
48
51
|
query.onlyExplicitMembership = 'true'
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
return _request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query})
|
|
54
|
+
return _request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query}) as Observable<
|
|
55
|
+
Omit<SanityProject, OmittedProjectFields<T>>[]
|
|
56
|
+
>
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
/**
|
|
@@ -75,36 +80,32 @@ export class ProjectsClient {
|
|
|
75
80
|
*
|
|
76
81
|
* @param options - Options for the list request
|
|
77
82
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
83
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
78
84
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
79
|
-
* - `onlyExplicitMembership` -
|
|
85
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
80
86
|
*/
|
|
81
|
-
list(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
onlyExplicitMembership?: boolean
|
|
85
|
-
}): Promise<SanityProject[]>
|
|
86
|
-
list(options?: {
|
|
87
|
-
includeMembers?: false
|
|
88
|
-
organizationId?: string
|
|
89
|
-
onlyExplicitMembership?: boolean
|
|
90
|
-
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
91
|
-
list(options?: {
|
|
92
|
-
includeMembers?: boolean
|
|
93
|
-
organizationId?: string
|
|
94
|
-
onlyExplicitMembership?: boolean
|
|
95
|
-
}): Promise<SanityProject[] | Omit<SanityProject, 'members'>[]> {
|
|
87
|
+
list<T extends ListOptions>(
|
|
88
|
+
options?: T,
|
|
89
|
+
): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]> {
|
|
96
90
|
const query: Record<string, string> = {}
|
|
97
91
|
const uri = '/projects'
|
|
98
92
|
if (options?.includeMembers === false) {
|
|
99
93
|
query.includeMembers = 'false'
|
|
100
94
|
}
|
|
95
|
+
if (options?.includeFeatures === false) {
|
|
96
|
+
query.includeFeatures = 'false'
|
|
97
|
+
}
|
|
101
98
|
if (options?.organizationId) {
|
|
102
99
|
query.organizationId = options.organizationId
|
|
103
100
|
}
|
|
104
|
-
if (options?.onlyExplicitMembership
|
|
101
|
+
if (options?.onlyExplicitMembership) {
|
|
105
102
|
query.onlyExplicitMembership = 'true'
|
|
106
103
|
}
|
|
107
|
-
return lastValueFrom(
|
|
104
|
+
return lastValueFrom(
|
|
105
|
+
_request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query}) as Observable<
|
|
106
|
+
Omit<SanityProject, OmittedProjectFields<T>>[]
|
|
107
|
+
>,
|
|
108
|
+
)
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
/**
|
package/src/types.ts
CHANGED
package/umd/sanityClient.js
CHANGED
|
@@ -3745,9 +3745,18 @@ ${selectionOpts}`);
|
|
|
3745
3745
|
constructor(client, httpRequest) {
|
|
3746
3746
|
this.#client = client, this.#httpRequest = httpRequest;
|
|
3747
3747
|
}
|
|
3748
|
+
/**
|
|
3749
|
+
* Fetch a list of projects the authenticated user has access to.
|
|
3750
|
+
*
|
|
3751
|
+
* @param options - Options for the list request
|
|
3752
|
+
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
3753
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
3754
|
+
* - `organizationId` - ID of the organization to fetch projects for
|
|
3755
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
3756
|
+
*/
|
|
3748
3757
|
list(options) {
|
|
3749
3758
|
const query = {}, uri = "/projects";
|
|
3750
|
-
return options?.includeMembers === false && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership
|
|
3759
|
+
return options?.includeMembers === false && (query.includeMembers = "false"), options?.includeFeatures === false && (query.includeFeatures = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership && (query.onlyExplicitMembership = "true"), _request(this.#client, this.#httpRequest, { uri, query });
|
|
3751
3760
|
}
|
|
3752
3761
|
/**
|
|
3753
3762
|
* Fetch a project by project ID
|
|
@@ -3764,9 +3773,20 @@ ${selectionOpts}`);
|
|
|
3764
3773
|
constructor(client, httpRequest) {
|
|
3765
3774
|
this.#client = client, this.#httpRequest = httpRequest;
|
|
3766
3775
|
}
|
|
3776
|
+
/**
|
|
3777
|
+
* Fetch a list of projects the authenticated user has access to.
|
|
3778
|
+
*
|
|
3779
|
+
* @param options - Options for the list request
|
|
3780
|
+
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
3781
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
3782
|
+
* - `organizationId` - ID of the organization to fetch projects for
|
|
3783
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
3784
|
+
*/
|
|
3767
3785
|
list(options) {
|
|
3768
3786
|
const query = {}, uri = "/projects";
|
|
3769
|
-
return options?.includeMembers === false && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership
|
|
3787
|
+
return options?.includeMembers === false && (query.includeMembers = "false"), options?.includeFeatures === false && (query.includeFeatures = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership && (query.onlyExplicitMembership = "true"), lastValueFrom(
|
|
3788
|
+
_request(this.#client, this.#httpRequest, { uri, query })
|
|
3789
|
+
);
|
|
3770
3790
|
}
|
|
3771
3791
|
/**
|
|
3772
3792
|
* Fetch a project by project ID
|