@sanity/client 6.2.0 → 6.4.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.ts CHANGED
@@ -855,9 +855,13 @@ export declare class ObservableProjectsClient {
855
855
  #private
856
856
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
857
857
  /**
858
- * Fetch a list of projects the authenticated user has access to
858
+ * Fetch a list of projects the authenticated user has access to.
859
+ *
860
+ * @param options - Options for the list request
861
+ * @param options.includeMembers - Whether to include members in the response (default: true)
859
862
  */
860
- list(): Observable<SanityProject[]>
863
+ list(options?: {includeMembers?: true}): Observable<SanityProject[]>
864
+ list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
861
865
  /**
862
866
  * Fetch a project by project ID
863
867
  *
@@ -1488,9 +1492,13 @@ export declare class ProjectsClient {
1488
1492
  #private
1489
1493
  constructor(client: SanityClient, httpRequest: HttpRequest)
1490
1494
  /**
1491
- * Fetch a list of projects the authenticated user has access to
1495
+ * Fetch a list of projects the authenticated user has access to.
1496
+ *
1497
+ * @param options - Options for the list request
1498
+ * @param options.includeMembers - Whether to include members in the response (default: true)
1492
1499
  */
1493
- list(): Promise<SanityProject[]>
1500
+ list(options?: {includeMembers?: true}): Promise<SanityProject[]>
1501
+ list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
1494
1502
  /**
1495
1503
  * Fetch a project by project ID
1496
1504
  *
package/dist/index.js CHANGED
@@ -1,15 +1,28 @@
1
- import { debug, headers, retry, jsonRequest, jsonResponse, progress, observable } from 'get-it/middleware';
1
+ import { debug, headers, agent, retry, jsonRequest, jsonResponse, progress, observable } from 'get-it/middleware';
2
2
  import { getIt } from 'get-it';
3
3
  export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
4
4
  import { Observable, lastValueFrom } from 'rxjs';
5
5
  import { map, filter } from 'rxjs/operators';
6
6
  var name = "@sanity/client";
7
- var version = "6.2.0";
7
+ var version = "6.4.0";
8
8
  const middleware = [debug({
9
9
  verbose: true,
10
10
  namespace: "sanity:client"
11
11
  }), headers({
12
12
  "User-Agent": "".concat(name, " ").concat(version)
13
+ }),
14
+ // Enable keep-alive, and in addition limit the number of sockets that can be opened.
15
+ // This avoids opening too many connections to the server if someone tries to execute
16
+ // a bunch of requests in parallel. It's recommended to have a concurrency limit
17
+ // at a "higher limit" (i.e. you shouldn't actually execute hundreds of requests in parallel),
18
+ // and this is mainly to minimize the impact for the network and server.
19
+ //
20
+ // We're currently matching the same defaults as browsers:
21
+ // https://stackoverflow.com/questions/26003756/is-there-a-limit-practical-or-otherwise-to-the-number-of-web-sockets-a-page-op
22
+ agent({
23
+ keepAlive: true,
24
+ maxSockets: 30,
25
+ maxTotalSockets: 256
13
26
  })];
14
27
  var __defProp$3 = Object.defineProperty;
15
28
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
@@ -1464,12 +1477,10 @@ class ObservableProjectsClient {
1464
1477
  __privateSet$2(this, _client$1, client);
1465
1478
  __privateSet$2(this, _httpRequest$2, httpRequest);
1466
1479
  }
1467
- /**
1468
- * Fetch a list of projects the authenticated user has access to
1469
- */
1470
- list() {
1480
+ list(options) {
1481
+ const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects";
1471
1482
  return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), {
1472
- uri: "/projects"
1483
+ uri
1473
1484
  });
1474
1485
  }
1475
1486
  /**
@@ -1492,12 +1503,10 @@ class ProjectsClient {
1492
1503
  __privateSet$2(this, _client2$1, client);
1493
1504
  __privateSet$2(this, _httpRequest2$2, httpRequest);
1494
1505
  }
1495
- /**
1496
- * Fetch a list of projects the authenticated user has access to
1497
- */
1498
- list() {
1506
+ list(options) {
1507
+ const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects";
1499
1508
  return lastValueFrom(_request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), {
1500
- uri: "/projects"
1509
+ uri
1501
1510
  }));
1502
1511
  }
1503
1512
  /**