@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.d.cts CHANGED
@@ -2134,6 +2134,13 @@ export declare type ListenParams = {
2134
2134
  [key: string]: Any
2135
2135
  }
2136
2136
 
2137
+ declare type ListOptions = {
2138
+ includeMembers?: boolean
2139
+ includeFeatures?: boolean
2140
+ organizationId?: string
2141
+ onlyExplicitMembership?: boolean
2142
+ }
2143
+
2137
2144
  /**
2138
2145
  * @public
2139
2146
  */
@@ -2690,19 +2697,13 @@ export declare class ObservableProjectsClient {
2690
2697
  *
2691
2698
  * @param options - Options for the list request
2692
2699
  * - `includeMembers` - Whether to include members in the response (default: true)
2700
+ * - `includeFeatures` - Whether to include features in the response (default: true)
2693
2701
  * - `organizationId` - ID of the organization to fetch projects for
2694
- * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
2695
- */
2696
- list(options?: {
2697
- includeMembers?: true
2698
- organizationId?: string
2699
- onlyExplicitMembership?: boolean
2700
- }): Observable<SanityProject[]>
2701
- list(options?: {
2702
- includeMembers?: false
2703
- organizationId?: string
2704
- onlyExplicitMembership?: boolean
2705
- }): Observable<Omit<SanityProject, 'members'>[]>
2702
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
2703
+ */
2704
+ list<T extends ListOptions>(
2705
+ options?: T,
2706
+ ): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
2706
2707
  /**
2707
2708
  * Fetch a project by project ID
2708
2709
  *
@@ -3857,6 +3858,18 @@ export declare class ObservableUsersClient {
3857
3858
  ): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
3858
3859
  }
3859
3860
 
3861
+ declare type OmittedProjectFields<T extends ListOptions | undefined> =
3862
+ | (T extends {
3863
+ includeMembers: false
3864
+ }
3865
+ ? 'members'
3866
+ : never)
3867
+ | (T extends {
3868
+ includeFeatures: false
3869
+ }
3870
+ ? 'features'
3871
+ : never)
3872
+
3860
3873
  /**
3861
3874
  * The listener connection has been established
3862
3875
  * note: it's usually a better option to use the 'welcome' event
@@ -4073,19 +4086,11 @@ export declare class ProjectsClient {
4073
4086
  *
4074
4087
  * @param options - Options for the list request
4075
4088
  * - `includeMembers` - Whether to include members in the response (default: true)
4089
+ * - `includeFeatures` - Whether to include features in the response (default: true)
4076
4090
  * - `organizationId` - ID of the organization to fetch projects for
4077
- * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
4078
- */
4079
- list(options?: {
4080
- includeMembers?: true
4081
- organizationId?: string
4082
- onlyExplicitMembership?: boolean
4083
- }): Promise<SanityProject[]>
4084
- list(options?: {
4085
- includeMembers?: false
4086
- organizationId?: string
4087
- onlyExplicitMembership?: boolean
4088
- }): Promise<Omit<SanityProject, 'members'>[]>
4091
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
4092
+ */
4093
+ list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
4089
4094
  /**
4090
4095
  * Fetch a project by project ID
4091
4096
  *
@@ -5738,6 +5743,7 @@ export declare interface SanityProject {
5738
5743
  pendingInvites?: number
5739
5744
  maxRetentionDays?: number
5740
5745
  members: SanityProjectMember[]
5746
+ features: string[]
5741
5747
  metadata: {
5742
5748
  cliInitializedAt?: string
5743
5749
  color?: string
package/dist/index.d.ts CHANGED
@@ -2134,6 +2134,13 @@ export declare type ListenParams = {
2134
2134
  [key: string]: Any
2135
2135
  }
2136
2136
 
2137
+ declare type ListOptions = {
2138
+ includeMembers?: boolean
2139
+ includeFeatures?: boolean
2140
+ organizationId?: string
2141
+ onlyExplicitMembership?: boolean
2142
+ }
2143
+
2137
2144
  /**
2138
2145
  * @public
2139
2146
  */
@@ -2690,19 +2697,13 @@ export declare class ObservableProjectsClient {
2690
2697
  *
2691
2698
  * @param options - Options for the list request
2692
2699
  * - `includeMembers` - Whether to include members in the response (default: true)
2700
+ * - `includeFeatures` - Whether to include features in the response (default: true)
2693
2701
  * - `organizationId` - ID of the organization to fetch projects for
2694
- * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
2695
- */
2696
- list(options?: {
2697
- includeMembers?: true
2698
- organizationId?: string
2699
- onlyExplicitMembership?: boolean
2700
- }): Observable<SanityProject[]>
2701
- list(options?: {
2702
- includeMembers?: false
2703
- organizationId?: string
2704
- onlyExplicitMembership?: boolean
2705
- }): Observable<Omit<SanityProject, 'members'>[]>
2702
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
2703
+ */
2704
+ list<T extends ListOptions>(
2705
+ options?: T,
2706
+ ): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
2706
2707
  /**
2707
2708
  * Fetch a project by project ID
2708
2709
  *
@@ -3857,6 +3858,18 @@ export declare class ObservableUsersClient {
3857
3858
  ): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
3858
3859
  }
3859
3860
 
3861
+ declare type OmittedProjectFields<T extends ListOptions | undefined> =
3862
+ | (T extends {
3863
+ includeMembers: false
3864
+ }
3865
+ ? 'members'
3866
+ : never)
3867
+ | (T extends {
3868
+ includeFeatures: false
3869
+ }
3870
+ ? 'features'
3871
+ : never)
3872
+
3860
3873
  /**
3861
3874
  * The listener connection has been established
3862
3875
  * note: it's usually a better option to use the 'welcome' event
@@ -4073,19 +4086,11 @@ export declare class ProjectsClient {
4073
4086
  *
4074
4087
  * @param options - Options for the list request
4075
4088
  * - `includeMembers` - Whether to include members in the response (default: true)
4089
+ * - `includeFeatures` - Whether to include features in the response (default: true)
4076
4090
  * - `organizationId` - ID of the organization to fetch projects for
4077
- * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
4078
- */
4079
- list(options?: {
4080
- includeMembers?: true
4081
- organizationId?: string
4082
- onlyExplicitMembership?: boolean
4083
- }): Promise<SanityProject[]>
4084
- list(options?: {
4085
- includeMembers?: false
4086
- organizationId?: string
4087
- onlyExplicitMembership?: boolean
4088
- }): Promise<Omit<SanityProject, 'members'>[]>
4091
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
4092
+ */
4093
+ list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
4089
4094
  /**
4090
4095
  * Fetch a project by project ID
4091
4096
  *
@@ -5738,6 +5743,7 @@ export declare interface SanityProject {
5738
5743
  pendingInvites?: number
5739
5744
  maxRetentionDays?: number
5740
5745
  members: SanityProjectMember[]
5746
+ features: string[]
5741
5747
  metadata: {
5742
5748
  cliInitializedAt?: string
5743
5749
  color?: string
package/dist/index.js CHANGED
@@ -1589,9 +1589,18 @@ class ObservableProjectsClient {
1589
1589
  constructor(client, httpRequest) {
1590
1590
  this.#client = client, this.#httpRequest = httpRequest;
1591
1591
  }
1592
+ /**
1593
+ * Fetch a list of projects the authenticated user has access to.
1594
+ *
1595
+ * @param options - Options for the list request
1596
+ * - `includeMembers` - Whether to include members in the response (default: true)
1597
+ * - `includeFeatures` - Whether to include features in the response (default: true)
1598
+ * - `organizationId` - ID of the organization to fetch projects for
1599
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
1600
+ */
1592
1601
  list(options) {
1593
1602
  const query = {}, uri = "/projects";
1594
- 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 });
1603
+ 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 });
1595
1604
  }
1596
1605
  /**
1597
1606
  * Fetch a project by project ID
@@ -1608,9 +1617,20 @@ class ProjectsClient {
1608
1617
  constructor(client, httpRequest) {
1609
1618
  this.#client = client, this.#httpRequest = httpRequest;
1610
1619
  }
1620
+ /**
1621
+ * Fetch a list of projects the authenticated user has access to.
1622
+ *
1623
+ * @param options - Options for the list request
1624
+ * - `includeMembers` - Whether to include members in the response (default: true)
1625
+ * - `includeFeatures` - Whether to include features in the response (default: true)
1626
+ * - `organizationId` - ID of the organization to fetch projects for
1627
+ * - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
1628
+ */
1611
1629
  list(options) {
1612
1630
  const query = {}, uri = "/projects";
1613
- 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 }));
1631
+ 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(
1632
+ _request(this.#client, this.#httpRequest, { uri, query })
1633
+ );
1614
1634
  }
1615
1635
  /**
1616
1636
  * Fetch a project by project ID
@@ -2735,7 +2755,7 @@ function defineDeprecatedCreateClient(createClient2) {
2735
2755
  return printNoDefaultExport(), createClient2(config);
2736
2756
  };
2737
2757
  }
2738
- var name = "@sanity/client", version = "7.19.0";
2758
+ var name = "@sanity/client", version = "7.20.0";
2739
2759
  const middleware = [
2740
2760
  debug({ verbose: !0, namespace: "sanity:client" }),
2741
2761
  headers({ "User-Agent": `${name} ${version}` }),