@sanity/client 7.8.2 → 7.9.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.cjs CHANGED
@@ -1380,8 +1380,11 @@ class ObservableDatasetsClient {
1380
1380
  * Fetch a list of datasets for the configured project
1381
1381
  */
1382
1382
  list() {
1383
- return _request(this.#client, this.#httpRequest, {
1384
- uri: "/datasets",
1383
+ config.resourceGuard("dataset", this.#client.config());
1384
+ const config$1 = this.#client.config(), projectId = config$1.projectId;
1385
+ let uri = "/datasets";
1386
+ return config$1.useProjectHostname === !1 && (uri = `/projects/${projectId}/datasets`), _request(this.#client, this.#httpRequest, {
1387
+ uri,
1385
1388
  tag: null
1386
1389
  });
1387
1390
  }
@@ -1426,8 +1429,11 @@ class DatasetsClient {
1426
1429
  * Fetch a list of datasets for the configured project
1427
1430
  */
1428
1431
  list() {
1429
- return config.resourceGuard("dataset", this.#client.config()), rxjs.lastValueFrom(
1430
- _request(this.#client, this.#httpRequest, { uri: "/datasets", tag: null })
1432
+ config.resourceGuard("dataset", this.#client.config());
1433
+ const config$1 = this.#client.config(), projectId = config$1.projectId;
1434
+ let uri = "/datasets";
1435
+ return config$1.useProjectHostname === !1 && (uri = `/projects/${projectId}/datasets`), rxjs.lastValueFrom(
1436
+ _request(this.#client, this.#httpRequest, { uri, tag: null })
1431
1437
  );
1432
1438
  }
1433
1439
  }
@@ -1446,7 +1452,6 @@ class ObservableProjectsClient {
1446
1452
  this.#client = client, this.#httpRequest = httpRequest;
1447
1453
  }
1448
1454
  list(options) {
1449
- config.resourceGuard("projects", this.#client.config());
1450
1455
  const uri = options?.includeMembers === !1 ? "/projects?includeMembers=false" : "/projects";
1451
1456
  return _request(this.#client, this.#httpRequest, { uri });
1452
1457
  }
@@ -1456,7 +1461,7 @@ class ObservableProjectsClient {
1456
1461
  * @param projectId - ID of the project to fetch
1457
1462
  */
1458
1463
  getById(projectId) {
1459
- return config.resourceGuard("projects", this.#client.config()), _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId}` });
1464
+ return _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId}` });
1460
1465
  }
1461
1466
  }
1462
1467
  class ProjectsClient {
@@ -1466,7 +1471,6 @@ class ProjectsClient {
1466
1471
  this.#client = client, this.#httpRequest = httpRequest;
1467
1472
  }
1468
1473
  list(options) {
1469
- config.resourceGuard("projects", this.#client.config());
1470
1474
  const uri = options?.includeMembers === !1 ? "/projects?includeMembers=false" : "/projects";
1471
1475
  return rxjs.lastValueFrom(_request(this.#client, this.#httpRequest, { uri }));
1472
1476
  }
@@ -1476,7 +1480,7 @@ class ProjectsClient {
1476
1480
  * @param projectId - ID of the project to fetch
1477
1481
  */
1478
1482
  getById(projectId) {
1479
- return config.resourceGuard("projects", this.#client.config()), rxjs.lastValueFrom(
1483
+ return rxjs.lastValueFrom(
1480
1484
  _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId}` })
1481
1485
  );
1482
1486
  }
@@ -2574,7 +2578,7 @@ function defineDeprecatedCreateClient(createClient2) {
2574
2578
  return config.printNoDefaultExport(), createClient2(config$1);
2575
2579
  };
2576
2580
  }
2577
- var name = "@sanity/client", version = "7.8.2";
2581
+ var name = "@sanity/client", version = "7.9.0";
2578
2582
  const middleware = [
2579
2583
  middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
2580
2584
  middleware$1.headers({ "User-Agent": `${name} ${version}` }),