@sanity/client 7.15.0 → 7.16.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.
@@ -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 */
@@ -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 */
@@ -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, {