@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.
@@ -2142,6 +2142,13 @@ export declare type ListenParams = {
2142
2142
  [key: string]: Any
2143
2143
  }
2144
2144
 
2145
+ declare type ListOptions = {
2146
+ includeMembers?: boolean
2147
+ includeFeatures?: boolean
2148
+ organizationId?: string
2149
+ onlyExplicitMembership?: boolean
2150
+ }
2151
+
2145
2152
  /**
2146
2153
  * @public
2147
2154
  */
@@ -2698,19 +2705,13 @@ export declare class ObservableProjectsClient {
2698
2705
  *
2699
2706
  * @param options - Options for the list request
2700
2707
  * - `includeMembers` - Whether to include members in the response (default: true)
2708
+ * - `includeFeatures` - Whether to include features in the response (default: true)
2701
2709
  * - `organizationId` - ID of the organization to fetch projects for
2702
- * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
2703
- */
2704
- list(options?: {
2705
- includeMembers?: true
2706
- organizationId?: string
2707
- onlyExplicitMembership?: boolean
2708
- }): Observable<SanityProject[]>
2709
- list(options?: {
2710
- includeMembers?: false
2711
- organizationId?: string
2712
- onlyExplicitMembership?: boolean
2713
- }): Observable<Omit<SanityProject, 'members'>[]>
2710
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
2711
+ */
2712
+ list<T extends ListOptions>(
2713
+ options?: T,
2714
+ ): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
2714
2715
  /**
2715
2716
  * Fetch a project by project ID
2716
2717
  *
@@ -3865,6 +3866,18 @@ export declare class ObservableUsersClient {
3865
3866
  ): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
3866
3867
  }
3867
3868
 
3869
+ declare type OmittedProjectFields<T extends ListOptions | undefined> =
3870
+ | (T extends {
3871
+ includeMembers: false
3872
+ }
3873
+ ? 'members'
3874
+ : never)
3875
+ | (T extends {
3876
+ includeFeatures: false
3877
+ }
3878
+ ? 'features'
3879
+ : never)
3880
+
3868
3881
  /**
3869
3882
  * The listener connection has been established
3870
3883
  * note: it's usually a better option to use the 'welcome' event
@@ -4081,19 +4094,11 @@ export declare class ProjectsClient {
4081
4094
  *
4082
4095
  * @param options - Options for the list request
4083
4096
  * - `includeMembers` - Whether to include members in the response (default: true)
4097
+ * - `includeFeatures` - Whether to include features in the response (default: true)
4084
4098
  * - `organizationId` - ID of the organization to fetch projects for
4085
- * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
4086
- */
4087
- list(options?: {
4088
- includeMembers?: true
4089
- organizationId?: string
4090
- onlyExplicitMembership?: boolean
4091
- }): Promise<SanityProject[]>
4092
- list(options?: {
4093
- includeMembers?: false
4094
- organizationId?: string
4095
- onlyExplicitMembership?: boolean
4096
- }): Promise<Omit<SanityProject, 'members'>[]>
4099
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
4100
+ */
4101
+ list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
4097
4102
  /**
4098
4103
  * Fetch a project by project ID
4099
4104
  *
@@ -5746,6 +5751,7 @@ export declare interface SanityProject {
5746
5751
  pendingInvites?: number
5747
5752
  maxRetentionDays?: number
5748
5753
  members: SanityProjectMember[]
5754
+ features: string[]
5749
5755
  metadata: {
5750
5756
  cliInitializedAt?: string
5751
5757
  color?: string
@@ -2142,6 +2142,13 @@ export declare type ListenParams = {
2142
2142
  [key: string]: Any
2143
2143
  }
2144
2144
 
2145
+ declare type ListOptions = {
2146
+ includeMembers?: boolean
2147
+ includeFeatures?: boolean
2148
+ organizationId?: string
2149
+ onlyExplicitMembership?: boolean
2150
+ }
2151
+
2145
2152
  /**
2146
2153
  * @public
2147
2154
  */
@@ -2698,19 +2705,13 @@ export declare class ObservableProjectsClient {
2698
2705
  *
2699
2706
  * @param options - Options for the list request
2700
2707
  * - `includeMembers` - Whether to include members in the response (default: true)
2708
+ * - `includeFeatures` - Whether to include features in the response (default: true)
2701
2709
  * - `organizationId` - ID of the organization to fetch projects for
2702
- * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
2703
- */
2704
- list(options?: {
2705
- includeMembers?: true
2706
- organizationId?: string
2707
- onlyExplicitMembership?: boolean
2708
- }): Observable<SanityProject[]>
2709
- list(options?: {
2710
- includeMembers?: false
2711
- organizationId?: string
2712
- onlyExplicitMembership?: boolean
2713
- }): Observable<Omit<SanityProject, 'members'>[]>
2710
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
2711
+ */
2712
+ list<T extends ListOptions>(
2713
+ options?: T,
2714
+ ): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
2714
2715
  /**
2715
2716
  * Fetch a project by project ID
2716
2717
  *
@@ -3865,6 +3866,18 @@ export declare class ObservableUsersClient {
3865
3866
  ): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
3866
3867
  }
3867
3868
 
3869
+ declare type OmittedProjectFields<T extends ListOptions | undefined> =
3870
+ | (T extends {
3871
+ includeMembers: false
3872
+ }
3873
+ ? 'members'
3874
+ : never)
3875
+ | (T extends {
3876
+ includeFeatures: false
3877
+ }
3878
+ ? 'features'
3879
+ : never)
3880
+
3868
3881
  /**
3869
3882
  * The listener connection has been established
3870
3883
  * note: it's usually a better option to use the 'welcome' event
@@ -4081,19 +4094,11 @@ export declare class ProjectsClient {
4081
4094
  *
4082
4095
  * @param options - Options for the list request
4083
4096
  * - `includeMembers` - Whether to include members in the response (default: true)
4097
+ * - `includeFeatures` - Whether to include features in the response (default: true)
4084
4098
  * - `organizationId` - ID of the organization to fetch projects for
4085
- * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
4086
- */
4087
- list(options?: {
4088
- includeMembers?: true
4089
- organizationId?: string
4090
- onlyExplicitMembership?: boolean
4091
- }): Promise<SanityProject[]>
4092
- list(options?: {
4093
- includeMembers?: false
4094
- organizationId?: string
4095
- onlyExplicitMembership?: boolean
4096
- }): Promise<Omit<SanityProject, 'members'>[]>
4099
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
4100
+ */
4101
+ list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
4097
4102
  /**
4098
4103
  * Fetch a project by project ID
4099
4104
  *
@@ -5746,6 +5751,7 @@ export declare interface SanityProject {
5746
5751
  pendingInvites?: number
5747
5752
  maxRetentionDays?: number
5748
5753
  members: SanityProjectMember[]
5754
+ features: string[]
5749
5755
  metadata: {
5750
5756
  cliInitializedAt?: string
5751
5757
  color?: string
@@ -1771,9 +1771,18 @@ class ObservableProjectsClient {
1771
1771
  constructor(client, httpRequest) {
1772
1772
  this.#client = client, this.#httpRequest = httpRequest;
1773
1773
  }
1774
+ /**
1775
+ * Fetch a list of projects the authenticated user has access to.
1776
+ *
1777
+ * @param options - Options for the list request
1778
+ * - `includeMembers` - Whether to include members in the response (default: true)
1779
+ * - `includeFeatures` - Whether to include features in the response (default: true)
1780
+ * - `organizationId` - ID of the organization to fetch projects for
1781
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
1782
+ */
1774
1783
  list(options) {
1775
1784
  const query = {}, uri = "/projects";
1776
- return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership === !0 && (query.onlyExplicitMembership = "true"), _request(this.#client, this.#httpRequest, { uri, query });
1785
+ return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.includeFeatures === !1 && (query.includeFeatures = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership && (query.onlyExplicitMembership = "true"), _request(this.#client, this.#httpRequest, { uri, query });
1777
1786
  }
1778
1787
  /**
1779
1788
  * Fetch a project by project ID
@@ -1790,9 +1799,20 @@ class ProjectsClient {
1790
1799
  constructor(client, httpRequest) {
1791
1800
  this.#client = client, this.#httpRequest = httpRequest;
1792
1801
  }
1802
+ /**
1803
+ * Fetch a list of projects the authenticated user has access to.
1804
+ *
1805
+ * @param options - Options for the list request
1806
+ * - `includeMembers` - Whether to include members in the response (default: true)
1807
+ * - `includeFeatures` - Whether to include features in the response (default: true)
1808
+ * - `organizationId` - ID of the organization to fetch projects for
1809
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
1810
+ */
1793
1811
  list(options) {
1794
1812
  const query = {}, uri = "/projects";
1795
- return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership === !0 && (query.onlyExplicitMembership = "true"), lastValueFrom(_request(this.#client, this.#httpRequest, { uri, query }));
1813
+ return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.includeFeatures === !1 && (query.includeFeatures = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership && (query.onlyExplicitMembership = "true"), lastValueFrom(
1814
+ _request(this.#client, this.#httpRequest, { uri, query })
1815
+ );
1796
1816
  }
1797
1817
  /**
1798
1818
  * Fetch a project by project ID