@sanity/client 7.8.2 → 7.10.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
@@ -2457,9 +2457,13 @@ export declare class ObservableProjectsClient {
2457
2457
  *
2458
2458
  * @param options - Options for the list request
2459
2459
  * - `includeMembers` - Whether to include members in the response (default: true)
2460
+ * - `organizationId` - ID of the organization to fetch projects for
2460
2461
  */
2461
- list(options?: {includeMembers?: true}): Observable<SanityProject[]>
2462
- list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
2462
+ list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
2463
+ list(options?: {
2464
+ includeMembers?: false
2465
+ organizationId?: string
2466
+ }): Observable<Omit<SanityProject, 'members'>[]>
2463
2467
  /**
2464
2468
  * Fetch a project by project ID
2465
2469
  *
@@ -3811,9 +3815,13 @@ export declare class ProjectsClient {
3811
3815
  *
3812
3816
  * @param options - Options for the list request
3813
3817
  * - `includeMembers` - Whether to include members in the response (default: true)
3818
+ * - `organizationId` - ID of the organization to fetch projects for
3814
3819
  */
3815
- list(options?: {includeMembers?: true}): Promise<SanityProject[]>
3816
- list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
3820
+ list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
3821
+ list(options?: {
3822
+ includeMembers?: false
3823
+ organizationId?: string
3824
+ }): Promise<Omit<SanityProject, 'members'>[]>
3817
3825
  /**
3818
3826
  * Fetch a project by project ID
3819
3827
  *
@@ -4106,6 +4114,9 @@ export declare type ReleaseAction =
4106
4114
  | UnscheduleReleaseAction
4107
4115
  | DeleteReleaseAction
4108
4116
 
4117
+ /** @public */
4118
+ export declare type ReleaseCardinality = 'many' | 'one' | undefined
4119
+
4109
4120
  /** @internal */
4110
4121
  export declare interface ReleaseDocument extends SanityDocument {
4111
4122
  /**
@@ -4142,6 +4153,7 @@ export declare interface ReleaseDocument extends SanityDocument {
4142
4153
  description?: string
4143
4154
  intendedPublishAt?: string
4144
4155
  releaseType: ReleaseType
4156
+ cardinality?: ReleaseCardinality
4145
4157
  }
4146
4158
  }
4147
4159
 
package/dist/index.d.ts CHANGED
@@ -2457,9 +2457,13 @@ export declare class ObservableProjectsClient {
2457
2457
  *
2458
2458
  * @param options - Options for the list request
2459
2459
  * - `includeMembers` - Whether to include members in the response (default: true)
2460
+ * - `organizationId` - ID of the organization to fetch projects for
2460
2461
  */
2461
- list(options?: {includeMembers?: true}): Observable<SanityProject[]>
2462
- list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
2462
+ list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
2463
+ list(options?: {
2464
+ includeMembers?: false
2465
+ organizationId?: string
2466
+ }): Observable<Omit<SanityProject, 'members'>[]>
2463
2467
  /**
2464
2468
  * Fetch a project by project ID
2465
2469
  *
@@ -3811,9 +3815,13 @@ export declare class ProjectsClient {
3811
3815
  *
3812
3816
  * @param options - Options for the list request
3813
3817
  * - `includeMembers` - Whether to include members in the response (default: true)
3818
+ * - `organizationId` - ID of the organization to fetch projects for
3814
3819
  */
3815
- list(options?: {includeMembers?: true}): Promise<SanityProject[]>
3816
- list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
3820
+ list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
3821
+ list(options?: {
3822
+ includeMembers?: false
3823
+ organizationId?: string
3824
+ }): Promise<Omit<SanityProject, 'members'>[]>
3817
3825
  /**
3818
3826
  * Fetch a project by project ID
3819
3827
  *
@@ -4106,6 +4114,9 @@ export declare type ReleaseAction =
4106
4114
  | UnscheduleReleaseAction
4107
4115
  | DeleteReleaseAction
4108
4116
 
4117
+ /** @public */
4118
+ export declare type ReleaseCardinality = 'many' | 'one' | undefined
4119
+
4109
4120
  /** @internal */
4110
4121
  export declare interface ReleaseDocument extends SanityDocument {
4111
4122
  /**
@@ -4142,6 +4153,7 @@ export declare interface ReleaseDocument extends SanityDocument {
4142
4153
  description?: string
4143
4154
  intendedPublishAt?: string
4144
4155
  releaseType: ReleaseType
4156
+ cardinality?: ReleaseCardinality
4145
4157
  }
4146
4158
  }
4147
4159
 
package/dist/index.js CHANGED
@@ -1366,8 +1366,11 @@ class ObservableDatasetsClient {
1366
1366
  * Fetch a list of datasets for the configured project
1367
1367
  */
1368
1368
  list() {
1369
- return _request(this.#client, this.#httpRequest, {
1370
- uri: "/datasets",
1369
+ resourceGuard("dataset", this.#client.config());
1370
+ const config = this.#client.config(), projectId = config.projectId;
1371
+ let uri = "/datasets";
1372
+ return config.useProjectHostname === !1 && (uri = `/projects/${projectId}/datasets`), _request(this.#client, this.#httpRequest, {
1373
+ uri,
1371
1374
  tag: null
1372
1375
  });
1373
1376
  }
@@ -1412,8 +1415,11 @@ class DatasetsClient {
1412
1415
  * Fetch a list of datasets for the configured project
1413
1416
  */
1414
1417
  list() {
1415
- return resourceGuard("dataset", this.#client.config()), lastValueFrom(
1416
- _request(this.#client, this.#httpRequest, { uri: "/datasets", tag: null })
1418
+ resourceGuard("dataset", this.#client.config());
1419
+ const config = this.#client.config(), projectId = config.projectId;
1420
+ let uri = "/datasets";
1421
+ return config.useProjectHostname === !1 && (uri = `/projects/${projectId}/datasets`), lastValueFrom(
1422
+ _request(this.#client, this.#httpRequest, { uri, tag: null })
1417
1423
  );
1418
1424
  }
1419
1425
  }
@@ -1432,9 +1438,8 @@ class ObservableProjectsClient {
1432
1438
  this.#client = client, this.#httpRequest = httpRequest;
1433
1439
  }
1434
1440
  list(options) {
1435
- resourceGuard("projects", this.#client.config());
1436
- const uri = options?.includeMembers === !1 ? "/projects?includeMembers=false" : "/projects";
1437
- return _request(this.#client, this.#httpRequest, { uri });
1441
+ const query = {}, uri = "/projects";
1442
+ return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), _request(this.#client, this.#httpRequest, { uri, query });
1438
1443
  }
1439
1444
  /**
1440
1445
  * Fetch a project by project ID
@@ -1442,7 +1447,7 @@ class ObservableProjectsClient {
1442
1447
  * @param projectId - ID of the project to fetch
1443
1448
  */
1444
1449
  getById(projectId) {
1445
- return resourceGuard("projects", this.#client.config()), _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId}` });
1450
+ return _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId}` });
1446
1451
  }
1447
1452
  }
1448
1453
  class ProjectsClient {
@@ -1452,9 +1457,8 @@ class ProjectsClient {
1452
1457
  this.#client = client, this.#httpRequest = httpRequest;
1453
1458
  }
1454
1459
  list(options) {
1455
- resourceGuard("projects", this.#client.config());
1456
- const uri = options?.includeMembers === !1 ? "/projects?includeMembers=false" : "/projects";
1457
- return lastValueFrom(_request(this.#client, this.#httpRequest, { uri }));
1460
+ const query = {}, uri = "/projects";
1461
+ return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), lastValueFrom(_request(this.#client, this.#httpRequest, { uri, query }));
1458
1462
  }
1459
1463
  /**
1460
1464
  * Fetch a project by project ID
@@ -1462,7 +1466,7 @@ class ProjectsClient {
1462
1466
  * @param projectId - ID of the project to fetch
1463
1467
  */
1464
1468
  getById(projectId) {
1465
- return resourceGuard("projects", this.#client.config()), lastValueFrom(
1469
+ return lastValueFrom(
1466
1470
  _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId}` })
1467
1471
  );
1468
1472
  }
@@ -2560,7 +2564,7 @@ function defineDeprecatedCreateClient(createClient2) {
2560
2564
  return printNoDefaultExport(), createClient2(config);
2561
2565
  };
2562
2566
  }
2563
- var name = "@sanity/client", version = "7.8.2";
2567
+ var name = "@sanity/client", version = "7.10.0";
2564
2568
  const middleware = [
2565
2569
  debug({ verbose: !0, namespace: "sanity:client" }),
2566
2570
  headers({ "User-Agent": `${name} ${version}` }),