@sanity/client 7.15.0 → 7.17.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.
Files changed (46) hide show
  1. package/dist/_chunks-cjs/config.cjs.map +1 -1
  2. package/dist/_chunks-cjs/isRecord.cjs.map +1 -1
  3. package/dist/_chunks-cjs/resolveEditInfo.cjs +1 -1
  4. package/dist/_chunks-cjs/resolveEditInfo.cjs.map +1 -1
  5. package/dist/_chunks-cjs/stegaClean.cjs.map +1 -1
  6. package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +1 -1
  7. package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +1 -1
  8. package/dist/_chunks-es/config.js.map +1 -1
  9. package/dist/_chunks-es/isRecord.js.map +1 -1
  10. package/dist/_chunks-es/resolveEditInfo.js +1 -1
  11. package/dist/_chunks-es/resolveEditInfo.js.map +1 -1
  12. package/dist/_chunks-es/stegaClean.js.map +1 -1
  13. package/dist/_chunks-es/stegaEncodeSourceMap.js +1 -1
  14. package/dist/_chunks-es/stegaEncodeSourceMap.js.map +1 -1
  15. package/dist/csm.cjs.map +1 -1
  16. package/dist/csm.js.map +1 -1
  17. package/dist/index.browser.cjs +62 -4
  18. package/dist/index.browser.cjs.map +1 -1
  19. package/dist/index.browser.d.cts +73 -28
  20. package/dist/index.browser.d.ts +73 -28
  21. package/dist/index.browser.js +63 -5
  22. package/dist/index.browser.js.map +1 -1
  23. package/dist/index.cjs +63 -5
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +73 -28
  26. package/dist/index.d.ts +73 -28
  27. package/dist/index.js +64 -6
  28. package/dist/index.js.map +1 -1
  29. package/dist/media-library.cjs.map +1 -1
  30. package/dist/media-library.js.map +1 -1
  31. package/dist/stega.browser.cjs.map +1 -1
  32. package/dist/stega.browser.d.cts +73 -28
  33. package/dist/stega.browser.d.ts +73 -28
  34. package/dist/stega.browser.js +1 -1
  35. package/dist/stega.browser.js.map +1 -1
  36. package/dist/stega.cjs.map +1 -1
  37. package/dist/stega.d.cts +73 -28
  38. package/dist/stega.d.ts +73 -28
  39. package/dist/stega.js +1 -1
  40. package/dist/stega.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/datasets/DatasetsClient.ts +93 -8
  43. package/src/projects/ProjectsClient.ts +22 -2
  44. package/src/types.ts +27 -0
  45. package/umd/sanityClient.js +71 -13
  46. package/umd/sanityClient.min.js +2 -2
@@ -1099,6 +1099,20 @@ export declare interface CurrentSanityUser {
1099
1099
  /** @public */
1100
1100
  export declare type DatasetAclMode = 'public' | 'private' | 'custom'
1101
1101
 
1102
+ /** @public */
1103
+ export declare type DatasetCreateOptions = {
1104
+ aclMode?: DatasetAclMode
1105
+ embeddings?: {
1106
+ enabled: boolean
1107
+ projection?: string
1108
+ }
1109
+ }
1110
+
1111
+ /** @public */
1112
+ export declare type DatasetEditOptions = {
1113
+ aclMode?: DatasetAclMode
1114
+ }
1115
+
1102
1116
  /** @public */
1103
1117
  export declare type DatasetResponse = {
1104
1118
  datasetName: string
@@ -1113,26 +1127,16 @@ export declare class DatasetsClient {
1113
1127
  * Create a new dataset with the given name
1114
1128
  *
1115
1129
  * @param name - Name of the dataset to create
1116
- * @param options - Options for the dataset
1130
+ * @param options - Options for the dataset, including optional embeddings configuration
1117
1131
  */
1118
- create(
1119
- name: string,
1120
- options?: {
1121
- aclMode?: DatasetAclMode
1122
- },
1123
- ): Promise<DatasetResponse>
1132
+ create(name: string, options?: DatasetCreateOptions): Promise<DatasetResponse>
1124
1133
  /**
1125
1134
  * Edit a dataset with the given name
1126
1135
  *
1127
1136
  * @param name - Name of the dataset to edit
1128
1137
  * @param options - New options for the dataset
1129
1138
  */
1130
- edit(
1131
- name: string,
1132
- options?: {
1133
- aclMode?: DatasetAclMode
1134
- },
1135
- ): Promise<DatasetResponse>
1139
+ edit(name: string, options?: DatasetEditOptions): Promise<DatasetResponse>
1136
1140
  /**
1137
1141
  * Delete a dataset with the given name
1138
1142
  *
@@ -1145,6 +1149,19 @@ export declare class DatasetsClient {
1145
1149
  * Fetch a list of datasets for the configured project
1146
1150
  */
1147
1151
  list(): Promise<DatasetsResponse>
1152
+ /**
1153
+ * Get embeddings settings for a dataset
1154
+ *
1155
+ * @param name - Name of the dataset
1156
+ */
1157
+ getEmbeddingsSettings(name: string): Promise<EmbeddingsSettings>
1158
+ /**
1159
+ * Edit embeddings settings for a dataset
1160
+ *
1161
+ * @param name - Name of the dataset
1162
+ * @param settings - Embeddings settings to apply
1163
+ */
1164
+ editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Promise<void>
1148
1165
  }
1149
1166
 
1150
1167
  /** @public */
@@ -1355,6 +1372,19 @@ export declare interface EditReleaseAction {
1355
1372
  patch: PatchOperations
1356
1373
  }
1357
1374
 
1375
+ /** @public */
1376
+ export declare type EmbeddingsSettings = {
1377
+ enabled: boolean
1378
+ projection?: string
1379
+ status: string
1380
+ }
1381
+
1382
+ /** @public */
1383
+ export declare type EmbeddingsSettingsBody = {
1384
+ enabled: boolean
1385
+ projection?: string
1386
+ }
1387
+
1358
1388
  /** @public */
1359
1389
  export declare interface ErrorProps {
1360
1390
  message: string
@@ -2553,26 +2583,16 @@ export declare class ObservableDatasetsClient {
2553
2583
  * Create a new dataset with the given name
2554
2584
  *
2555
2585
  * @param name - Name of the dataset to create
2556
- * @param options - Options for the dataset
2586
+ * @param options - Options for the dataset, including optional embeddings configuration
2557
2587
  */
2558
- create(
2559
- name: string,
2560
- options?: {
2561
- aclMode?: DatasetAclMode
2562
- },
2563
- ): Observable<DatasetResponse>
2588
+ create(name: string, options?: DatasetCreateOptions): Observable<DatasetResponse>
2564
2589
  /**
2565
2590
  * Edit a dataset with the given name
2566
2591
  *
2567
2592
  * @param name - Name of the dataset to edit
2568
2593
  * @param options - New options for the dataset
2569
2594
  */
2570
- edit(
2571
- name: string,
2572
- options?: {
2573
- aclMode?: DatasetAclMode
2574
- },
2575
- ): Observable<DatasetResponse>
2595
+ edit(name: string, options?: DatasetEditOptions): Observable<DatasetResponse>
2576
2596
  /**
2577
2597
  * Delete a dataset with the given name
2578
2598
  *
@@ -2585,6 +2605,19 @@ export declare class ObservableDatasetsClient {
2585
2605
  * Fetch a list of datasets for the configured project
2586
2606
  */
2587
2607
  list(): Observable<DatasetsResponse>
2608
+ /**
2609
+ * Get embeddings settings for a dataset
2610
+ *
2611
+ * @param name - Name of the dataset
2612
+ */
2613
+ getEmbeddingsSettings(name: string): Observable<EmbeddingsSettings>
2614
+ /**
2615
+ * Edit embeddings settings for a dataset
2616
+ *
2617
+ * @param name - Name of the dataset
2618
+ * @param settings - Embeddings settings to apply
2619
+ */
2620
+ editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void>
2588
2621
  }
2589
2622
 
2590
2623
  /** @internal */
@@ -2666,11 +2699,17 @@ export declare class ObservableProjectsClient {
2666
2699
  * @param options - Options for the list request
2667
2700
  * - `includeMembers` - Whether to include members in the response (default: true)
2668
2701
  * - `organizationId` - ID of the organization to fetch projects for
2702
+ * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
2669
2703
  */
2670
- list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
2704
+ list(options?: {
2705
+ includeMembers?: true
2706
+ organizationId?: string
2707
+ onlyExplicitMembership?: boolean
2708
+ }): Observable<SanityProject[]>
2671
2709
  list(options?: {
2672
2710
  includeMembers?: false
2673
2711
  organizationId?: string
2712
+ onlyExplicitMembership?: boolean
2674
2713
  }): Observable<Omit<SanityProject, 'members'>[]>
2675
2714
  /**
2676
2715
  * Fetch a project by project ID
@@ -4043,11 +4082,17 @@ export declare class ProjectsClient {
4043
4082
  * @param options - Options for the list request
4044
4083
  * - `includeMembers` - Whether to include members in the response (default: true)
4045
4084
  * - `organizationId` - ID of the organization to fetch projects for
4085
+ * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
4046
4086
  */
4047
- list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
4087
+ list(options?: {
4088
+ includeMembers?: true
4089
+ organizationId?: string
4090
+ onlyExplicitMembership?: boolean
4091
+ }): Promise<SanityProject[]>
4048
4092
  list(options?: {
4049
4093
  includeMembers?: false
4050
4094
  organizationId?: string
4095
+ onlyExplicitMembership?: boolean
4051
4096
  }): Promise<Omit<SanityProject, 'members'>[]>
4052
4097
  /**
4053
4098
  * Fetch a project by project ID
@@ -1099,6 +1099,20 @@ export declare interface CurrentSanityUser {
1099
1099
  /** @public */
1100
1100
  export declare type DatasetAclMode = 'public' | 'private' | 'custom'
1101
1101
 
1102
+ /** @public */
1103
+ export declare type DatasetCreateOptions = {
1104
+ aclMode?: DatasetAclMode
1105
+ embeddings?: {
1106
+ enabled: boolean
1107
+ projection?: string
1108
+ }
1109
+ }
1110
+
1111
+ /** @public */
1112
+ export declare type DatasetEditOptions = {
1113
+ aclMode?: DatasetAclMode
1114
+ }
1115
+
1102
1116
  /** @public */
1103
1117
  export declare type DatasetResponse = {
1104
1118
  datasetName: string
@@ -1113,26 +1127,16 @@ export declare class DatasetsClient {
1113
1127
  * Create a new dataset with the given name
1114
1128
  *
1115
1129
  * @param name - Name of the dataset to create
1116
- * @param options - Options for the dataset
1130
+ * @param options - Options for the dataset, including optional embeddings configuration
1117
1131
  */
1118
- create(
1119
- name: string,
1120
- options?: {
1121
- aclMode?: DatasetAclMode
1122
- },
1123
- ): Promise<DatasetResponse>
1132
+ create(name: string, options?: DatasetCreateOptions): Promise<DatasetResponse>
1124
1133
  /**
1125
1134
  * Edit a dataset with the given name
1126
1135
  *
1127
1136
  * @param name - Name of the dataset to edit
1128
1137
  * @param options - New options for the dataset
1129
1138
  */
1130
- edit(
1131
- name: string,
1132
- options?: {
1133
- aclMode?: DatasetAclMode
1134
- },
1135
- ): Promise<DatasetResponse>
1139
+ edit(name: string, options?: DatasetEditOptions): Promise<DatasetResponse>
1136
1140
  /**
1137
1141
  * Delete a dataset with the given name
1138
1142
  *
@@ -1145,6 +1149,19 @@ export declare class DatasetsClient {
1145
1149
  * Fetch a list of datasets for the configured project
1146
1150
  */
1147
1151
  list(): Promise<DatasetsResponse>
1152
+ /**
1153
+ * Get embeddings settings for a dataset
1154
+ *
1155
+ * @param name - Name of the dataset
1156
+ */
1157
+ getEmbeddingsSettings(name: string): Promise<EmbeddingsSettings>
1158
+ /**
1159
+ * Edit embeddings settings for a dataset
1160
+ *
1161
+ * @param name - Name of the dataset
1162
+ * @param settings - Embeddings settings to apply
1163
+ */
1164
+ editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Promise<void>
1148
1165
  }
1149
1166
 
1150
1167
  /** @public */
@@ -1355,6 +1372,19 @@ export declare interface EditReleaseAction {
1355
1372
  patch: PatchOperations
1356
1373
  }
1357
1374
 
1375
+ /** @public */
1376
+ export declare type EmbeddingsSettings = {
1377
+ enabled: boolean
1378
+ projection?: string
1379
+ status: string
1380
+ }
1381
+
1382
+ /** @public */
1383
+ export declare type EmbeddingsSettingsBody = {
1384
+ enabled: boolean
1385
+ projection?: string
1386
+ }
1387
+
1358
1388
  /** @public */
1359
1389
  export declare interface ErrorProps {
1360
1390
  message: string
@@ -2553,26 +2583,16 @@ export declare class ObservableDatasetsClient {
2553
2583
  * Create a new dataset with the given name
2554
2584
  *
2555
2585
  * @param name - Name of the dataset to create
2556
- * @param options - Options for the dataset
2586
+ * @param options - Options for the dataset, including optional embeddings configuration
2557
2587
  */
2558
- create(
2559
- name: string,
2560
- options?: {
2561
- aclMode?: DatasetAclMode
2562
- },
2563
- ): Observable<DatasetResponse>
2588
+ create(name: string, options?: DatasetCreateOptions): Observable<DatasetResponse>
2564
2589
  /**
2565
2590
  * Edit a dataset with the given name
2566
2591
  *
2567
2592
  * @param name - Name of the dataset to edit
2568
2593
  * @param options - New options for the dataset
2569
2594
  */
2570
- edit(
2571
- name: string,
2572
- options?: {
2573
- aclMode?: DatasetAclMode
2574
- },
2575
- ): Observable<DatasetResponse>
2595
+ edit(name: string, options?: DatasetEditOptions): Observable<DatasetResponse>
2576
2596
  /**
2577
2597
  * Delete a dataset with the given name
2578
2598
  *
@@ -2585,6 +2605,19 @@ export declare class ObservableDatasetsClient {
2585
2605
  * Fetch a list of datasets for the configured project
2586
2606
  */
2587
2607
  list(): Observable<DatasetsResponse>
2608
+ /**
2609
+ * Get embeddings settings for a dataset
2610
+ *
2611
+ * @param name - Name of the dataset
2612
+ */
2613
+ getEmbeddingsSettings(name: string): Observable<EmbeddingsSettings>
2614
+ /**
2615
+ * Edit embeddings settings for a dataset
2616
+ *
2617
+ * @param name - Name of the dataset
2618
+ * @param settings - Embeddings settings to apply
2619
+ */
2620
+ editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void>
2588
2621
  }
2589
2622
 
2590
2623
  /** @internal */
@@ -2666,11 +2699,17 @@ export declare class ObservableProjectsClient {
2666
2699
  * @param options - Options for the list request
2667
2700
  * - `includeMembers` - Whether to include members in the response (default: true)
2668
2701
  * - `organizationId` - ID of the organization to fetch projects for
2702
+ * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
2669
2703
  */
2670
- list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
2704
+ list(options?: {
2705
+ includeMembers?: true
2706
+ organizationId?: string
2707
+ onlyExplicitMembership?: boolean
2708
+ }): Observable<SanityProject[]>
2671
2709
  list(options?: {
2672
2710
  includeMembers?: false
2673
2711
  organizationId?: string
2712
+ onlyExplicitMembership?: boolean
2674
2713
  }): Observable<Omit<SanityProject, 'members'>[]>
2675
2714
  /**
2676
2715
  * Fetch a project by project ID
@@ -4043,11 +4082,17 @@ export declare class ProjectsClient {
4043
4082
  * @param options - Options for the list request
4044
4083
  * - `includeMembers` - Whether to include members in the response (default: true)
4045
4084
  * - `organizationId` - ID of the organization to fetch projects for
4085
+ * - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
4046
4086
  */
4047
- list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
4087
+ list(options?: {
4088
+ includeMembers?: true
4089
+ organizationId?: string
4090
+ onlyExplicitMembership?: boolean
4091
+ }): Promise<SanityProject[]>
4048
4092
  list(options?: {
4049
4093
  includeMembers?: false
4050
4094
  organizationId?: string
4095
+ onlyExplicitMembership?: boolean
4051
4096
  }): Promise<Omit<SanityProject, 'members'>[]>
4052
4097
  /**
4053
4098
  * Fetch a project by project ID
@@ -1,7 +1,7 @@
1
1
  import { getIt } from "get-it";
2
2
  import { adapter, environment } from "get-it";
3
3
  import { retry, jsonRequest, jsonResponse, progress, observable } from "get-it/middleware";
4
- import { Observable, defer, of, isObservable, mergeMap, from, lastValueFrom, shareReplay, catchError, concat, throwError, timer, tap, finalize, share, merge, map as map$1, firstValueFrom } from "rxjs";
4
+ import { Observable, defer, isObservable, of, mergeMap, from, lastValueFrom, shareReplay, catchError, concat, timer, throwError, tap, finalize, share, merge, map as map$1, firstValueFrom } from "rxjs";
5
5
  import { isRecord, stegaClean } from "./_chunks-es/stegaClean.js";
6
6
  import { combineLatestWith, map, filter, finalize as finalize$1 } from "rxjs/operators";
7
7
  import { getVersionFromId, isDraftId, getVersionId, getDraftId, isVersionId, getPublishedId } from "@sanity/client/csm";
@@ -1542,7 +1542,7 @@ class ObservableDatasetsClient {
1542
1542
  * Create a new dataset with the given name
1543
1543
  *
1544
1544
  * @param name - Name of the dataset to create
1545
- * @param options - Options for the dataset
1545
+ * @param options - Options for the dataset, including optional embeddings configuration
1546
1546
  */
1547
1547
  create(name, options) {
1548
1548
  return _modify(this.#client, this.#httpRequest, "PUT", name, options);
@@ -1576,6 +1576,31 @@ class ObservableDatasetsClient {
1576
1576
  tag: null
1577
1577
  });
1578
1578
  }
1579
+ /**
1580
+ * Get embeddings settings for a dataset
1581
+ *
1582
+ * @param name - Name of the dataset
1583
+ */
1584
+ getEmbeddingsSettings(name) {
1585
+ return resourceGuard("dataset", this.#client.config()), dataset(name), _request(this.#client, this.#httpRequest, {
1586
+ uri: _embeddingsSettingsUri(this.#client, name),
1587
+ tag: null
1588
+ });
1589
+ }
1590
+ /**
1591
+ * Edit embeddings settings for a dataset
1592
+ *
1593
+ * @param name - Name of the dataset
1594
+ * @param settings - Embeddings settings to apply
1595
+ */
1596
+ editEmbeddingsSettings(name, settings) {
1597
+ return resourceGuard("dataset", this.#client.config()), dataset(name), _request(this.#client, this.#httpRequest, {
1598
+ method: "PUT",
1599
+ uri: _embeddingsSettingsUri(this.#client, name),
1600
+ body: settings,
1601
+ tag: null
1602
+ });
1603
+ }
1579
1604
  }
1580
1605
  class DatasetsClient {
1581
1606
  #client;
@@ -1587,7 +1612,7 @@ class DatasetsClient {
1587
1612
  * Create a new dataset with the given name
1588
1613
  *
1589
1614
  * @param name - Name of the dataset to create
1590
- * @param options - Options for the dataset
1615
+ * @param options - Options for the dataset, including optional embeddings configuration
1591
1616
  */
1592
1617
  create(name, options) {
1593
1618
  return resourceGuard("dataset", this.#client.config()), lastValueFrom(
@@ -1624,6 +1649,39 @@ class DatasetsClient {
1624
1649
  _request(this.#client, this.#httpRequest, { uri, tag: null })
1625
1650
  );
1626
1651
  }
1652
+ /**
1653
+ * Get embeddings settings for a dataset
1654
+ *
1655
+ * @param name - Name of the dataset
1656
+ */
1657
+ getEmbeddingsSettings(name) {
1658
+ return resourceGuard("dataset", this.#client.config()), dataset(name), lastValueFrom(
1659
+ _request(this.#client, this.#httpRequest, {
1660
+ uri: _embeddingsSettingsUri(this.#client, name),
1661
+ tag: null
1662
+ })
1663
+ );
1664
+ }
1665
+ /**
1666
+ * Edit embeddings settings for a dataset
1667
+ *
1668
+ * @param name - Name of the dataset
1669
+ * @param settings - Embeddings settings to apply
1670
+ */
1671
+ editEmbeddingsSettings(name, settings) {
1672
+ return resourceGuard("dataset", this.#client.config()), dataset(name), lastValueFrom(
1673
+ _request(this.#client, this.#httpRequest, {
1674
+ method: "PUT",
1675
+ uri: _embeddingsSettingsUri(this.#client, name),
1676
+ body: settings,
1677
+ tag: null
1678
+ })
1679
+ );
1680
+ }
1681
+ }
1682
+ function _embeddingsSettingsUri(client, name) {
1683
+ const config = client.config();
1684
+ return config.useProjectHostname === !1 ? `/projects/${config.projectId}/datasets/${name}/settings/embeddings` : `/datasets/${name}/settings/embeddings`;
1627
1685
  }
1628
1686
  function _modify(client, httpRequest, method, name, options) {
1629
1687
  return resourceGuard("dataset", client.config()), dataset(name), _request(client, httpRequest, {
@@ -1715,7 +1773,7 @@ class ObservableProjectsClient {
1715
1773
  }
1716
1774
  list(options) {
1717
1775
  const query = {}, uri = "/projects";
1718
- return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), _request(this.#client, this.#httpRequest, { uri, query });
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 });
1719
1777
  }
1720
1778
  /**
1721
1779
  * Fetch a project by project ID
@@ -1734,7 +1792,7 @@ class ProjectsClient {
1734
1792
  }
1735
1793
  list(options) {
1736
1794
  const query = {}, uri = "/projects";
1737
- return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), lastValueFrom(_request(this.#client, this.#httpRequest, { uri, query }));
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 }));
1738
1796
  }
1739
1797
  /**
1740
1798
  * Fetch a project by project ID