@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.
package/dist/index.d.cts CHANGED
@@ -1096,6 +1096,20 @@ export declare interface CurrentSanityUser {
1096
1096
  /** @public */
1097
1097
  export declare type DatasetAclMode = 'public' | 'private' | 'custom'
1098
1098
 
1099
+ /** @public */
1100
+ export declare type DatasetCreateOptions = {
1101
+ aclMode?: DatasetAclMode
1102
+ embeddings?: {
1103
+ enabled: boolean
1104
+ projection?: string
1105
+ }
1106
+ }
1107
+
1108
+ /** @public */
1109
+ export declare type DatasetEditOptions = {
1110
+ aclMode?: DatasetAclMode
1111
+ }
1112
+
1099
1113
  /** @public */
1100
1114
  export declare type DatasetResponse = {
1101
1115
  datasetName: string
@@ -1110,26 +1124,16 @@ export declare class DatasetsClient {
1110
1124
  * Create a new dataset with the given name
1111
1125
  *
1112
1126
  * @param name - Name of the dataset to create
1113
- * @param options - Options for the dataset
1127
+ * @param options - Options for the dataset, including optional embeddings configuration
1114
1128
  */
1115
- create(
1116
- name: string,
1117
- options?: {
1118
- aclMode?: DatasetAclMode
1119
- },
1120
- ): Promise<DatasetResponse>
1129
+ create(name: string, options?: DatasetCreateOptions): Promise<DatasetResponse>
1121
1130
  /**
1122
1131
  * Edit a dataset with the given name
1123
1132
  *
1124
1133
  * @param name - Name of the dataset to edit
1125
1134
  * @param options - New options for the dataset
1126
1135
  */
1127
- edit(
1128
- name: string,
1129
- options?: {
1130
- aclMode?: DatasetAclMode
1131
- },
1132
- ): Promise<DatasetResponse>
1136
+ edit(name: string, options?: DatasetEditOptions): Promise<DatasetResponse>
1133
1137
  /**
1134
1138
  * Delete a dataset with the given name
1135
1139
  *
@@ -1142,6 +1146,19 @@ export declare class DatasetsClient {
1142
1146
  * Fetch a list of datasets for the configured project
1143
1147
  */
1144
1148
  list(): Promise<DatasetsResponse>
1149
+ /**
1150
+ * Get embeddings settings for a dataset
1151
+ *
1152
+ * @param name - Name of the dataset
1153
+ */
1154
+ getEmbeddingsSettings(name: string): Promise<EmbeddingsSettings>
1155
+ /**
1156
+ * Edit embeddings settings for a dataset
1157
+ *
1158
+ * @param name - Name of the dataset
1159
+ * @param settings - Embeddings settings to apply
1160
+ */
1161
+ editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Promise<void>
1145
1162
  }
1146
1163
 
1147
1164
  /** @public */
@@ -1347,6 +1364,19 @@ export declare interface EditReleaseAction {
1347
1364
  patch: PatchOperations
1348
1365
  }
1349
1366
 
1367
+ /** @public */
1368
+ export declare type EmbeddingsSettings = {
1369
+ enabled: boolean
1370
+ projection?: string
1371
+ status: string
1372
+ }
1373
+
1374
+ /** @public */
1375
+ export declare type EmbeddingsSettingsBody = {
1376
+ enabled: boolean
1377
+ projection?: string
1378
+ }
1379
+
1350
1380
  /** @public */
1351
1381
  export declare interface ErrorProps {
1352
1382
  message: string
@@ -2545,26 +2575,16 @@ export declare class ObservableDatasetsClient {
2545
2575
  * Create a new dataset with the given name
2546
2576
  *
2547
2577
  * @param name - Name of the dataset to create
2548
- * @param options - Options for the dataset
2578
+ * @param options - Options for the dataset, including optional embeddings configuration
2549
2579
  */
2550
- create(
2551
- name: string,
2552
- options?: {
2553
- aclMode?: DatasetAclMode
2554
- },
2555
- ): Observable<DatasetResponse>
2580
+ create(name: string, options?: DatasetCreateOptions): Observable<DatasetResponse>
2556
2581
  /**
2557
2582
  * Edit a dataset with the given name
2558
2583
  *
2559
2584
  * @param name - Name of the dataset to edit
2560
2585
  * @param options - New options for the dataset
2561
2586
  */
2562
- edit(
2563
- name: string,
2564
- options?: {
2565
- aclMode?: DatasetAclMode
2566
- },
2567
- ): Observable<DatasetResponse>
2587
+ edit(name: string, options?: DatasetEditOptions): Observable<DatasetResponse>
2568
2588
  /**
2569
2589
  * Delete a dataset with the given name
2570
2590
  *
@@ -2577,6 +2597,19 @@ export declare class ObservableDatasetsClient {
2577
2597
  * Fetch a list of datasets for the configured project
2578
2598
  */
2579
2599
  list(): Observable<DatasetsResponse>
2600
+ /**
2601
+ * Get embeddings settings for a dataset
2602
+ *
2603
+ * @param name - Name of the dataset
2604
+ */
2605
+ getEmbeddingsSettings(name: string): Observable<EmbeddingsSettings>
2606
+ /**
2607
+ * Edit embeddings settings for a dataset
2608
+ *
2609
+ * @param name - Name of the dataset
2610
+ * @param settings - Embeddings settings to apply
2611
+ */
2612
+ editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void>
2580
2613
  }
2581
2614
 
2582
2615
  /** @internal */
package/dist/index.d.ts CHANGED
@@ -1096,6 +1096,20 @@ export declare interface CurrentSanityUser {
1096
1096
  /** @public */
1097
1097
  export declare type DatasetAclMode = 'public' | 'private' | 'custom'
1098
1098
 
1099
+ /** @public */
1100
+ export declare type DatasetCreateOptions = {
1101
+ aclMode?: DatasetAclMode
1102
+ embeddings?: {
1103
+ enabled: boolean
1104
+ projection?: string
1105
+ }
1106
+ }
1107
+
1108
+ /** @public */
1109
+ export declare type DatasetEditOptions = {
1110
+ aclMode?: DatasetAclMode
1111
+ }
1112
+
1099
1113
  /** @public */
1100
1114
  export declare type DatasetResponse = {
1101
1115
  datasetName: string
@@ -1110,26 +1124,16 @@ export declare class DatasetsClient {
1110
1124
  * Create a new dataset with the given name
1111
1125
  *
1112
1126
  * @param name - Name of the dataset to create
1113
- * @param options - Options for the dataset
1127
+ * @param options - Options for the dataset, including optional embeddings configuration
1114
1128
  */
1115
- create(
1116
- name: string,
1117
- options?: {
1118
- aclMode?: DatasetAclMode
1119
- },
1120
- ): Promise<DatasetResponse>
1129
+ create(name: string, options?: DatasetCreateOptions): Promise<DatasetResponse>
1121
1130
  /**
1122
1131
  * Edit a dataset with the given name
1123
1132
  *
1124
1133
  * @param name - Name of the dataset to edit
1125
1134
  * @param options - New options for the dataset
1126
1135
  */
1127
- edit(
1128
- name: string,
1129
- options?: {
1130
- aclMode?: DatasetAclMode
1131
- },
1132
- ): Promise<DatasetResponse>
1136
+ edit(name: string, options?: DatasetEditOptions): Promise<DatasetResponse>
1133
1137
  /**
1134
1138
  * Delete a dataset with the given name
1135
1139
  *
@@ -1142,6 +1146,19 @@ export declare class DatasetsClient {
1142
1146
  * Fetch a list of datasets for the configured project
1143
1147
  */
1144
1148
  list(): Promise<DatasetsResponse>
1149
+ /**
1150
+ * Get embeddings settings for a dataset
1151
+ *
1152
+ * @param name - Name of the dataset
1153
+ */
1154
+ getEmbeddingsSettings(name: string): Promise<EmbeddingsSettings>
1155
+ /**
1156
+ * Edit embeddings settings for a dataset
1157
+ *
1158
+ * @param name - Name of the dataset
1159
+ * @param settings - Embeddings settings to apply
1160
+ */
1161
+ editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Promise<void>
1145
1162
  }
1146
1163
 
1147
1164
  /** @public */
@@ -1347,6 +1364,19 @@ export declare interface EditReleaseAction {
1347
1364
  patch: PatchOperations
1348
1365
  }
1349
1366
 
1367
+ /** @public */
1368
+ export declare type EmbeddingsSettings = {
1369
+ enabled: boolean
1370
+ projection?: string
1371
+ status: string
1372
+ }
1373
+
1374
+ /** @public */
1375
+ export declare type EmbeddingsSettingsBody = {
1376
+ enabled: boolean
1377
+ projection?: string
1378
+ }
1379
+
1350
1380
  /** @public */
1351
1381
  export declare interface ErrorProps {
1352
1382
  message: string
@@ -2545,26 +2575,16 @@ export declare class ObservableDatasetsClient {
2545
2575
  * Create a new dataset with the given name
2546
2576
  *
2547
2577
  * @param name - Name of the dataset to create
2548
- * @param options - Options for the dataset
2578
+ * @param options - Options for the dataset, including optional embeddings configuration
2549
2579
  */
2550
- create(
2551
- name: string,
2552
- options?: {
2553
- aclMode?: DatasetAclMode
2554
- },
2555
- ): Observable<DatasetResponse>
2580
+ create(name: string, options?: DatasetCreateOptions): Observable<DatasetResponse>
2556
2581
  /**
2557
2582
  * Edit a dataset with the given name
2558
2583
  *
2559
2584
  * @param name - Name of the dataset to edit
2560
2585
  * @param options - New options for the dataset
2561
2586
  */
2562
- edit(
2563
- name: string,
2564
- options?: {
2565
- aclMode?: DatasetAclMode
2566
- },
2567
- ): Observable<DatasetResponse>
2587
+ edit(name: string, options?: DatasetEditOptions): Observable<DatasetResponse>
2568
2588
  /**
2569
2589
  * Delete a dataset with the given name
2570
2590
  *
@@ -2577,6 +2597,19 @@ export declare class ObservableDatasetsClient {
2577
2597
  * Fetch a list of datasets for the configured project
2578
2598
  */
2579
2599
  list(): Observable<DatasetsResponse>
2600
+ /**
2601
+ * Get embeddings settings for a dataset
2602
+ *
2603
+ * @param name - Name of the dataset
2604
+ */
2605
+ getEmbeddingsSettings(name: string): Observable<EmbeddingsSettings>
2606
+ /**
2607
+ * Edit embeddings settings for a dataset
2608
+ *
2609
+ * @param name - Name of the dataset
2610
+ * @param settings - Embeddings settings to apply
2611
+ */
2612
+ editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void>
2580
2613
  }
2581
2614
 
2582
2615
  /** @internal */
package/dist/index.js CHANGED
@@ -1360,7 +1360,7 @@ class ObservableDatasetsClient {
1360
1360
  * Create a new dataset with the given name
1361
1361
  *
1362
1362
  * @param name - Name of the dataset to create
1363
- * @param options - Options for the dataset
1363
+ * @param options - Options for the dataset, including optional embeddings configuration
1364
1364
  */
1365
1365
  create(name2, options) {
1366
1366
  return _modify(this.#client, this.#httpRequest, "PUT", name2, options);
@@ -1394,6 +1394,31 @@ class ObservableDatasetsClient {
1394
1394
  tag: null
1395
1395
  });
1396
1396
  }
1397
+ /**
1398
+ * Get embeddings settings for a dataset
1399
+ *
1400
+ * @param name - Name of the dataset
1401
+ */
1402
+ getEmbeddingsSettings(name2) {
1403
+ return resourceGuard("dataset", this.#client.config()), dataset(name2), _request(this.#client, this.#httpRequest, {
1404
+ uri: _embeddingsSettingsUri(this.#client, name2),
1405
+ tag: null
1406
+ });
1407
+ }
1408
+ /**
1409
+ * Edit embeddings settings for a dataset
1410
+ *
1411
+ * @param name - Name of the dataset
1412
+ * @param settings - Embeddings settings to apply
1413
+ */
1414
+ editEmbeddingsSettings(name2, settings) {
1415
+ return resourceGuard("dataset", this.#client.config()), dataset(name2), _request(this.#client, this.#httpRequest, {
1416
+ method: "PUT",
1417
+ uri: _embeddingsSettingsUri(this.#client, name2),
1418
+ body: settings,
1419
+ tag: null
1420
+ });
1421
+ }
1397
1422
  }
1398
1423
  class DatasetsClient {
1399
1424
  #client;
@@ -1405,7 +1430,7 @@ class DatasetsClient {
1405
1430
  * Create a new dataset with the given name
1406
1431
  *
1407
1432
  * @param name - Name of the dataset to create
1408
- * @param options - Options for the dataset
1433
+ * @param options - Options for the dataset, including optional embeddings configuration
1409
1434
  */
1410
1435
  create(name2, options) {
1411
1436
  return resourceGuard("dataset", this.#client.config()), lastValueFrom(
@@ -1442,6 +1467,39 @@ class DatasetsClient {
1442
1467
  _request(this.#client, this.#httpRequest, { uri, tag: null })
1443
1468
  );
1444
1469
  }
1470
+ /**
1471
+ * Get embeddings settings for a dataset
1472
+ *
1473
+ * @param name - Name of the dataset
1474
+ */
1475
+ getEmbeddingsSettings(name2) {
1476
+ return resourceGuard("dataset", this.#client.config()), dataset(name2), lastValueFrom(
1477
+ _request(this.#client, this.#httpRequest, {
1478
+ uri: _embeddingsSettingsUri(this.#client, name2),
1479
+ tag: null
1480
+ })
1481
+ );
1482
+ }
1483
+ /**
1484
+ * Edit embeddings settings for a dataset
1485
+ *
1486
+ * @param name - Name of the dataset
1487
+ * @param settings - Embeddings settings to apply
1488
+ */
1489
+ editEmbeddingsSettings(name2, settings) {
1490
+ return resourceGuard("dataset", this.#client.config()), dataset(name2), lastValueFrom(
1491
+ _request(this.#client, this.#httpRequest, {
1492
+ method: "PUT",
1493
+ uri: _embeddingsSettingsUri(this.#client, name2),
1494
+ body: settings,
1495
+ tag: null
1496
+ })
1497
+ );
1498
+ }
1499
+ }
1500
+ function _embeddingsSettingsUri(client, name2) {
1501
+ const config = client.config();
1502
+ return config.useProjectHostname === !1 ? `/projects/${config.projectId}/datasets/${name2}/settings/embeddings` : `/datasets/${name2}/settings/embeddings`;
1445
1503
  }
1446
1504
  function _modify(client, httpRequest, method, name2, options) {
1447
1505
  return resourceGuard("dataset", client.config()), dataset(name2), _request(client, httpRequest, {
@@ -2677,7 +2735,7 @@ function defineDeprecatedCreateClient(createClient2) {
2677
2735
  return printNoDefaultExport(), createClient2(config);
2678
2736
  };
2679
2737
  }
2680
- var name = "@sanity/client", version = "7.15.0";
2738
+ var name = "@sanity/client", version = "7.16.0";
2681
2739
  const middleware = [
2682
2740
  debug({ verbose: !0, namespace: "sanity:client" }),
2683
2741
  headers({ "User-Agent": `${name} ${version}` }),