@sanity/client 8.4.0 → 8.5.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.
@@ -1043,7 +1043,10 @@ type TranslateDocumentSync<T extends Record<string, Any> = Record<string, Any>>
1043
1043
  type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync;
1044
1044
  /** @beta */
1045
1045
  type TranslateDocument<T extends Record<string, Any> = Record<string, Any>> = TranslateDocumentSync<T> | TranslateDocumentAsync;
1046
- /** @public */
1046
+ /**
1047
+ * @public
1048
+ * @inline
1049
+ */
1047
1050
  declare class ObservableAgentsActionClient {
1048
1051
  #private;
1049
1052
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -1069,7 +1072,10 @@ declare class ObservableAgentsActionClient {
1069
1072
  _id: string;
1070
1073
  } : IdentifiedSanityDocumentStub & DocumentShape>;
1071
1074
  }
1072
- /** @public */
1075
+ /**
1076
+ * @public
1077
+ * @inline
1078
+ */
1073
1079
  declare class AgentActionsClient {
1074
1080
  #private;
1075
1081
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -1108,7 +1114,10 @@ declare class AgentActionsClient {
1108
1114
  _id: string;
1109
1115
  } : IdentifiedSanityDocumentStub & DocumentShape>;
1110
1116
  }
1111
- /** @internal */
1117
+ /**
1118
+ * @internal
1119
+ * @inline
1120
+ */
1112
1121
  declare class ObservableAssetsClient {
1113
1122
  #private;
1114
1123
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -1143,7 +1152,10 @@ declare class ObservableAssetsClient {
1143
1152
  document: SanityAssetDocument | SanityImageAssetDocument;
1144
1153
  }>>;
1145
1154
  }
1146
- /** @internal */
1155
+ /**
1156
+ * @internal
1157
+ * @inline
1158
+ */
1147
1159
  declare class AssetsClient {
1148
1160
  #private;
1149
1161
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -4957,6 +4969,7 @@ declare class ObservableContextClient {
4957
4969
  }
4958
4970
  /**
4959
4971
  * @public
4972
+ * @inline
4960
4973
  */
4961
4974
  declare class LiveClient {
4962
4975
  #private;
@@ -5334,7 +5347,10 @@ declare class ObservableTransaction extends BaseTransaction {
5334
5347
  */
5335
5348
  patch(patch: ObservablePatch): this;
5336
5349
  }
5337
- /** @internal */
5350
+ /**
5351
+ * @internal
5352
+ * @inline
5353
+ */
5338
5354
  declare class ObservableDatasetsClient {
5339
5355
  #private;
5340
5356
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -5378,7 +5394,10 @@ declare class ObservableDatasetsClient {
5378
5394
  */
5379
5395
  editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void>;
5380
5396
  }
5381
- /** @internal */
5397
+ /**
5398
+ * @internal
5399
+ * @inline
5400
+ */
5382
5401
  declare class DatasetsClient {
5383
5402
  #private;
5384
5403
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -5518,7 +5537,10 @@ declare class FunctionsClient {
5518
5537
  }): Promise<R>;
5519
5538
  invoke<R = unknown>(functionName: string, request?: InvokeFunctionRequest, options?: InvokeFunctionOptions): Promise<R | undefined>;
5520
5539
  }
5521
- /** @internal */
5540
+ /**
5541
+ * @internal
5542
+ * @inline
5543
+ */
5522
5544
  declare class ObservableMediaLibraryVideoClient {
5523
5545
  #private;
5524
5546
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -5530,7 +5552,10 @@ declare class ObservableMediaLibraryVideoClient {
5530
5552
  */
5531
5553
  getPlaybackInfo(assetIdentifier: MediaLibraryAssetInstanceIdentifier, options?: MediaLibraryPlaybackInfoOptions): Observable<VideoPlaybackInfo>;
5532
5554
  }
5533
- /** @internal */
5555
+ /**
5556
+ * @internal
5557
+ * @inline
5558
+ */
5534
5559
  declare class MediaLibraryVideoClient {
5535
5560
  #private;
5536
5561
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -5553,7 +5578,10 @@ type OmittedProjectFields<T extends ListOptions | undefined> = (T extends {
5553
5578
  } ? 'members' : never) | (T extends {
5554
5579
  includeFeatures: false;
5555
5580
  } ? 'features' : never);
5556
- /** @internal */
5581
+ /**
5582
+ * @internal
5583
+ * @inline
5584
+ */
5557
5585
  declare class ObservableProjectsClient {
5558
5586
  #private;
5559
5587
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -5574,7 +5602,10 @@ declare class ObservableProjectsClient {
5574
5602
  */
5575
5603
  getById(projectId: string): Observable<SanityProject>;
5576
5604
  }
5577
- /** @internal */
5605
+ /**
5606
+ * @internal
5607
+ * @inline
5608
+ */
5578
5609
  declare class ProjectsClient {
5579
5610
  #private;
5580
5611
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -5595,7 +5626,10 @@ declare class ProjectsClient {
5595
5626
  */
5596
5627
  getById(projectId: string): Promise<SanityProject>;
5597
5628
  }
5598
- /** @public */
5629
+ /**
5630
+ * @public
5631
+ * @inline
5632
+ */
5599
5633
  declare class ObservableReleasesClient {
5600
5634
  #private;
5601
5635
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -5840,7 +5874,10 @@ declare class ObservableReleasesClient {
5840
5874
  releaseId: string;
5841
5875
  }, options?: BaseMutationOptions): Observable<RawQueryResponse<SanityDocument[]>>;
5842
5876
  }
5843
- /** @public */
5877
+ /**
5878
+ * @public
5879
+ * @inline
5880
+ */
5844
5881
  declare class ReleasesClient {
5845
5882
  #private;
5846
5883
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -6076,7 +6113,10 @@ declare class ReleasesClient {
6076
6113
  releaseId: string;
6077
6114
  }, options?: BaseMutationOptions): Promise<RawQueryResponse<SanityDocument[]>>;
6078
6115
  }
6079
- /** @public */
6116
+ /**
6117
+ * @public
6118
+ * @inline
6119
+ */
6080
6120
  declare class ObservableUsersClient {
6081
6121
  #private;
6082
6122
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -6087,7 +6127,10 @@ declare class ObservableUsersClient {
6087
6127
  */
6088
6128
  getById<T extends string>(id: T): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>;
6089
6129
  }
6090
- /** @public */
6130
+ /**
6131
+ * @public
6132
+ * @inline
6133
+ */
6091
6134
  declare class UsersClient {
6092
6135
  #private;
6093
6136
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -6101,15 +6144,52 @@ declare class UsersClient {
6101
6144
  /** @public */
6102
6145
  declare class ObservableSanityClient {
6103
6146
  #private;
6147
+ /**
6148
+ * Upload, fetch and delete assets (images and files) in the configured dataset
6149
+ *
6150
+ * @category Assets
6151
+ */
6104
6152
  assets: ObservableAssetsClient;
6153
+ /**
6154
+ * Create, list, edit and delete datasets in the configured project
6155
+ *
6156
+ * @category Projects & Datasets
6157
+ */
6105
6158
  datasets: ObservableDatasetsClient;
6159
+ /**
6160
+ * Subscribe to live content updates through the Live Content API
6161
+ *
6162
+ * @category Real-time
6163
+ */
6106
6164
  live: LiveClient;
6165
+ /**
6166
+ * Interact with Media Library assets
6167
+ *
6168
+ * @category Assets
6169
+ */
6107
6170
  mediaLibrary: {
6171
+ /** Upload and manage Media Library video assets */
6108
6172
  video: ObservableMediaLibraryVideoClient;
6109
6173
  };
6174
+ /**
6175
+ * Fetch information about the projects the authenticated user has access to
6176
+ *
6177
+ * @category Projects & Datasets
6178
+ */
6110
6179
  projects: ObservableProjectsClient;
6180
+ /**
6181
+ * Fetch information about users in the configured project
6182
+ *
6183
+ * @category Projects & Datasets
6184
+ */
6111
6185
  users: ObservableUsersClient;
6186
+ /**
6187
+ * Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
6188
+ *
6189
+ * @category Agent Actions
6190
+ */
6112
6191
  agent: {
6192
+ /** Run individual Agent Action operations */
6113
6193
  action: ObservableAgentsActionClient;
6114
6194
  };
6115
6195
  collaboration: {
@@ -6117,20 +6197,31 @@ declare class ObservableSanityClient {
6117
6197
  comments: ObservableCollaborationCommentsClient;
6118
6198
  };
6119
6199
  functions: ObservableFunctionsClient;
6200
+ /**
6201
+ * Create and manage content releases and their scheduled publishing
6202
+ *
6203
+ * @category Releases
6204
+ */
6120
6205
  releases: ObservableReleasesClient;
6121
6206
  /** @beta */
6122
6207
  context: ObservableContextClient;
6123
6208
  /**
6124
- * Instance properties
6209
+ * Listen to document changes matching a GROQ query, delivered as server-sent events
6210
+ *
6211
+ * @category Real-time
6125
6212
  */
6126
6213
  listen: typeof _listen;
6127
6214
  constructor(httpRequest: HttpRequest, config?: ClientConfig);
6128
6215
  /**
6129
6216
  * Clone the client - returns a new instance
6217
+ *
6218
+ * @category Configuration
6130
6219
  */
6131
6220
  clone(): ObservableSanityClient;
6132
6221
  /**
6133
6222
  * Returns the current client configuration
6223
+ *
6224
+ * @category Configuration
6134
6225
  */
6135
6226
  config(): InitializedClientConfig;
6136
6227
  /**
@@ -6140,12 +6231,16 @@ declare class ObservableSanityClient {
6140
6231
  /**
6141
6232
  * Clone the client with a new (partial) configuration.
6142
6233
  *
6234
+ * @category Configuration
6235
+ *
6143
6236
  * @param newConfig - New client configuration properties, shallowly merged with existing configuration
6144
6237
  */
6145
6238
  withConfig(newConfig?: Partial<ClientConfig>): ObservableSanityClient;
6146
6239
  /**
6147
6240
  * Perform a GROQ-query against the configured dataset.
6148
6241
  *
6242
+ * @category Querying
6243
+ *
6149
6244
  * @param query - GROQ-query to perform
6150
6245
  */
6151
6246
  fetch<R = Any, Q extends QueryWithoutParams = QueryWithoutParams, const G extends string = string>(query: G, params?: Q | QueryWithoutParams): Observable<ClientReturn<G, R>>;
@@ -6176,6 +6271,8 @@ declare class ObservableSanityClient {
6176
6271
  /**
6177
6272
  * Fetch a single document with the given ID.
6178
6273
  *
6274
+ * @category Querying
6275
+ *
6179
6276
  * @param id - Document ID to fetch
6180
6277
  * @param options - Request options
6181
6278
  */
@@ -6203,6 +6300,8 @@ declare class ObservableSanityClient {
6203
6300
  * The order/position of documents is preserved based on the original array of IDs.
6204
6301
  * If any of the documents are missing, they will be replaced by a `null` entry in the returned array
6205
6302
  *
6303
+ * @category Querying
6304
+ *
6206
6305
  * @param ids - Document IDs to fetch
6207
6306
  * @param options - Request options
6208
6307
  */
@@ -6213,6 +6312,8 @@ declare class ObservableSanityClient {
6213
6312
  * Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
6214
6313
  * Returns a set of the IDs that exist.
6215
6314
  *
6315
+ * @category Querying
6316
+ *
6216
6317
  * @param ids - Document IDs to check
6217
6318
  * @param options - Request options
6218
6319
  */
@@ -6224,6 +6325,8 @@ declare class ObservableSanityClient {
6224
6325
  * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
6225
6326
  * Returns an observable that resolves to the created document.
6226
6327
  *
6328
+ * @category Mutations
6329
+ *
6227
6330
  * @param document - Document to create
6228
6331
  * @param options - Mutation options
6229
6332
  */
@@ -6264,6 +6367,8 @@ declare class ObservableSanityClient {
6264
6367
  * Create a document if no document with the same ID already exists.
6265
6368
  * Returns an observable that resolves to the created document.
6266
6369
  *
6370
+ * @category Mutations
6371
+ *
6267
6372
  * @param document - Document to create
6268
6373
  * @param options - Mutation options
6269
6374
  */
@@ -6304,6 +6409,8 @@ declare class ObservableSanityClient {
6304
6409
  * Create a document if it does not exist, or replace a document with the same document ID
6305
6410
  * Returns an observable that resolves to the created document.
6306
6411
  *
6412
+ * @category Mutations
6413
+ *
6307
6414
  * @param document - Document to either create or replace
6308
6415
  * @param options - Mutation options
6309
6416
  */
@@ -6428,6 +6535,8 @@ declare class ObservableSanityClient {
6428
6535
  * Deletes a document with the given document ID.
6429
6536
  * Returns an observable that resolves to the deleted document.
6430
6537
  *
6538
+ * @category Mutations
6539
+ *
6431
6540
  * @param id - Document ID to delete
6432
6541
  * @param options - Options for the mutation
6433
6542
  */
@@ -6513,6 +6622,8 @@ declare class ObservableSanityClient {
6513
6622
  * * Discarding a version with no `releaseId` will discard the draft version of the published document.
6514
6623
  * * If the draft or release version does not exist, any error will throw.
6515
6624
  *
6625
+ * @category Versions
6626
+ *
6516
6627
  * @param params - Version action parameters:
6517
6628
  * - `releaseId` - The ID of the release to discard the document from.
6518
6629
  * - `publishedId` - The published ID of the document to discard.
@@ -6548,6 +6659,8 @@ declare class ObservableSanityClient {
6548
6659
  * * Replacing a version with no `releaseId` will replace the draft version of the published document.
6549
6660
  * * At least one of the **version** or **published** documents must exist.
6550
6661
  *
6662
+ * @category Versions
6663
+ *
6551
6664
  * @param params - Version action parameters:
6552
6665
  * - `document` - The new document to replace the version with.
6553
6666
  * - `releaseId` - The ID of the release where the document version is replaced.
@@ -6620,6 +6733,8 @@ declare class ObservableSanityClient {
6620
6733
  * @remarks
6621
6734
  * * If the published document does not exist, an error will be thrown.
6622
6735
  *
6736
+ * @category Versions
6737
+ *
6623
6738
  * @param params - Version action parameters:
6624
6739
  * - `releaseId` - The ID of the release to unpublish the document from.
6625
6740
  * - `publishedId` - The published ID of the document to unpublish.
@@ -6640,6 +6755,8 @@ declare class ObservableSanityClient {
6640
6755
  * Perform mutation operations against the configured dataset
6641
6756
  * Returns an observable that resolves to the first mutated document.
6642
6757
  *
6758
+ * @category Mutations
6759
+ *
6643
6760
  * @param operations - Mutation operations to execute
6644
6761
  * @param options - Mutation options
6645
6762
  */
@@ -6679,6 +6796,8 @@ declare class ObservableSanityClient {
6679
6796
  /**
6680
6797
  * Create a new buildable patch of operations to perform
6681
6798
  *
6799
+ * @category Mutations
6800
+ *
6682
6801
  * @param documentId - Document ID to patch
6683
6802
  * @param operations - Optional object of patch operations to initialize the patch instance with
6684
6803
  * @returns Patch instance - call `.commit()` to perform the operations defined
@@ -6703,12 +6822,16 @@ declare class ObservableSanityClient {
6703
6822
  /**
6704
6823
  * Create a new transaction of mutations
6705
6824
  *
6825
+ * @category Mutations
6826
+ *
6706
6827
  * @param operations - Optional array of mutation operations to initialize the transaction instance with
6707
6828
  */
6708
6829
  transaction<R extends Record<string, Any> = Record<string, Any>>(operations?: Mutation<R>[]): ObservableTransaction;
6709
6830
  /**
6710
6831
  * Perform action operations against the configured dataset
6711
6832
  *
6833
+ * @category Mutations
6834
+ *
6712
6835
  * @param operations - Action operation(s) to execute
6713
6836
  * @param options - Action options
6714
6837
  */
@@ -6716,12 +6839,16 @@ declare class ObservableSanityClient {
6716
6839
  /**
6717
6840
  * Perform an HTTP request against the Sanity API
6718
6841
  *
6842
+ * @category HTTP
6843
+ *
6719
6844
  * @param options - Request options
6720
6845
  */
6721
6846
  request<R = Any>(options: RawRequestOptions): Observable<R>;
6722
6847
  /**
6723
6848
  * Get a Sanity API URL for the URI provided
6724
6849
  *
6850
+ * @category HTTP
6851
+ *
6725
6852
  * @param uri - URI/path to build URL for
6726
6853
  * @param canUseCdn - Whether or not to allow using the API CDN for this route
6727
6854
  */
@@ -6729,6 +6856,8 @@ declare class ObservableSanityClient {
6729
6856
  /**
6730
6857
  * Get a Sanity API URL for the data operation and path provided
6731
6858
  *
6859
+ * @category HTTP
6860
+ *
6732
6861
  * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
6733
6862
  * @param path - Path to append after the operation
6734
6863
  */
@@ -6737,15 +6866,52 @@ declare class ObservableSanityClient {
6737
6866
  /** @public */
6738
6867
  declare class SanityClient {
6739
6868
  #private;
6869
+ /**
6870
+ * Upload, fetch and delete assets (images and files) in the configured dataset
6871
+ *
6872
+ * @category Assets
6873
+ */
6740
6874
  assets: AssetsClient;
6875
+ /**
6876
+ * Create, list, edit and delete datasets in the configured project
6877
+ *
6878
+ * @category Projects & Datasets
6879
+ */
6741
6880
  datasets: DatasetsClient;
6881
+ /**
6882
+ * Subscribe to live content updates through the Live Content API
6883
+ *
6884
+ * @category Real-time
6885
+ */
6742
6886
  live: LiveClient;
6887
+ /**
6888
+ * Interact with Media Library assets
6889
+ *
6890
+ * @category Assets
6891
+ */
6743
6892
  mediaLibrary: {
6893
+ /** Upload and manage Media Library video assets */
6744
6894
  video: MediaLibraryVideoClient;
6745
6895
  };
6896
+ /**
6897
+ * Fetch information about the projects the authenticated user has access to
6898
+ *
6899
+ * @category Projects & Datasets
6900
+ */
6746
6901
  projects: ProjectsClient;
6902
+ /**
6903
+ * Fetch information about users in the configured project
6904
+ *
6905
+ * @category Projects & Datasets
6906
+ */
6747
6907
  users: UsersClient;
6908
+ /**
6909
+ * Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
6910
+ *
6911
+ * @category Agent Actions
6912
+ */
6748
6913
  agent: {
6914
+ /** Run individual Agent Action operations */
6749
6915
  action: AgentActionsClient;
6750
6916
  };
6751
6917
  collaboration: {
@@ -6753,24 +6919,37 @@ declare class SanityClient {
6753
6919
  comments: CollaborationCommentsClient;
6754
6920
  };
6755
6921
  functions: FunctionsClient;
6922
+ /**
6923
+ * Create and manage content releases and their scheduled publishing
6924
+ *
6925
+ * @category Releases
6926
+ */
6756
6927
  releases: ReleasesClient;
6757
6928
  /** @beta */
6758
6929
  context: ContextClient;
6759
6930
  /**
6760
6931
  * Observable version of the Sanity client, with the same configuration as the promise-based one
6932
+ *
6933
+ * @category Configuration
6761
6934
  */
6762
6935
  observable: ObservableSanityClient;
6763
6936
  /**
6764
- * Instance properties
6937
+ * Listen to document changes matching a GROQ query, delivered as server-sent events
6938
+ *
6939
+ * @category Real-time
6765
6940
  */
6766
6941
  listen: typeof _listen;
6767
6942
  constructor(httpRequest: HttpRequest, config?: ClientConfig);
6768
6943
  /**
6769
6944
  * Clone the client - returns a new instance
6945
+ *
6946
+ * @category Configuration
6770
6947
  */
6771
6948
  clone(): SanityClient;
6772
6949
  /**
6773
6950
  * Returns the current client configuration
6951
+ *
6952
+ * @category Configuration
6774
6953
  */
6775
6954
  config(): InitializedClientConfig;
6776
6955
  /**
@@ -6780,12 +6959,16 @@ declare class SanityClient {
6780
6959
  /**
6781
6960
  * Clone the client with a new (partial) configuration.
6782
6961
  *
6962
+ * @category Configuration
6963
+ *
6783
6964
  * @param newConfig - New client configuration properties, shallowly merged with existing configuration
6784
6965
  */
6785
6966
  withConfig(newConfig?: Partial<ClientConfig>): SanityClient;
6786
6967
  /**
6787
6968
  * Perform a GROQ-query against the configured dataset.
6788
6969
  *
6970
+ * @category Querying
6971
+ *
6789
6972
  * @param query - GROQ-query to perform
6790
6973
  */
6791
6974
  fetch<R = Any, Q extends QueryWithoutParams = QueryWithoutParams, const G extends string = string>(query: G, params?: Q | QueryWithoutParams): Promise<ClientReturn<G, R>>;
@@ -6816,6 +6999,8 @@ declare class SanityClient {
6816
6999
  /**
6817
7000
  * Fetch a single document with the given ID.
6818
7001
  *
7002
+ * @category Querying
7003
+ *
6819
7004
  * @param id - Document ID to fetch
6820
7005
  * @param options - Request options
6821
7006
  */
@@ -6843,6 +7028,8 @@ declare class SanityClient {
6843
7028
  * The order/position of documents is preserved based on the original array of IDs.
6844
7029
  * If any of the documents are missing, they will be replaced by a `null` entry in the returned array
6845
7030
  *
7031
+ * @category Querying
7032
+ *
6846
7033
  * @param ids - Document IDs to fetch
6847
7034
  * @param options - Request options
6848
7035
  */
@@ -6854,6 +7041,8 @@ declare class SanityClient {
6854
7041
  * Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
6855
7042
  * Returns a set of the IDs that exist.
6856
7043
  *
7044
+ * @category Querying
7045
+ *
6857
7046
  * @param ids - Document IDs to check
6858
7047
  * @param options - Request options
6859
7048
  */
@@ -6865,6 +7054,8 @@ declare class SanityClient {
6865
7054
  * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
6866
7055
  * Returns a promise that resolves to the created document.
6867
7056
  *
7057
+ * @category Mutations
7058
+ *
6868
7059
  * @param document - Document to create
6869
7060
  * @param options - Mutation options
6870
7061
  */
@@ -6905,6 +7096,8 @@ declare class SanityClient {
6905
7096
  * Create a document if no document with the same ID already exists.
6906
7097
  * Returns a promise that resolves to the created document.
6907
7098
  *
7099
+ * @category Mutations
7100
+ *
6908
7101
  * @param document - Document to create
6909
7102
  * @param options - Mutation options
6910
7103
  */
@@ -6945,6 +7138,8 @@ declare class SanityClient {
6945
7138
  * Create a document if it does not exist, or replace a document with the same document ID
6946
7139
  * Returns a promise that resolves to the created document.
6947
7140
  *
7141
+ * @category Mutations
7142
+ *
6948
7143
  * @param document - Document to either create or replace
6949
7144
  * @param options - Mutation options
6950
7145
  */
@@ -7057,6 +7252,8 @@ declare class SanityClient {
7057
7252
  * Deletes a document with the given document ID.
7058
7253
  * Returns a promise that resolves to the deleted document.
7059
7254
  *
7255
+ * @category Mutations
7256
+ *
7060
7257
  * @param id - Document ID to delete
7061
7258
  * @param options - Options for the mutation
7062
7259
  */
@@ -7142,6 +7339,8 @@ declare class SanityClient {
7142
7339
  * * Discarding a version with no `releaseId` will discard the draft version of the published document.
7143
7340
  * * If the draft or release version does not exist, any error will throw.
7144
7341
  *
7342
+ * @category Versions
7343
+ *
7145
7344
  * @param params - Version action parameters:
7146
7345
  * - `releaseId` - The ID of the release to discard the document from.
7147
7346
  * - `publishedId` - The published ID of the document to discard.
@@ -7177,6 +7376,8 @@ declare class SanityClient {
7177
7376
  * * Replacing a version with no `releaseId` will replace the draft version of the published document.
7178
7377
  * * At least one of the **version** or **published** documents must exist.
7179
7378
  *
7379
+ * @category Versions
7380
+ *
7180
7381
  * @param params - Version action parameters:
7181
7382
  * - `document` - The new document to replace the version with.
7182
7383
  * - `releaseId` - The ID of the release where the document version is replaced.
@@ -7249,6 +7450,8 @@ declare class SanityClient {
7249
7450
  * @remarks
7250
7451
  * * If the published document does not exist, an error will be thrown.
7251
7452
  *
7453
+ * @category Versions
7454
+ *
7252
7455
  * @param params - Version action parameters:
7253
7456
  * - `releaseId` - The ID of the release to unpublish the document from.
7254
7457
  * - `publishedId` - The published ID of the document to unpublish.
@@ -7269,6 +7472,8 @@ declare class SanityClient {
7269
7472
  * Perform mutation operations against the configured dataset
7270
7473
  * Returns a promise that resolves to the first mutated document.
7271
7474
  *
7475
+ * @category Mutations
7476
+ *
7272
7477
  * @param operations - Mutation operations to execute
7273
7478
  * @param options - Mutation options
7274
7479
  */
@@ -7308,6 +7513,8 @@ declare class SanityClient {
7308
7513
  /**
7309
7514
  * Create a new buildable patch of operations to perform
7310
7515
  *
7516
+ * @category Mutations
7517
+ *
7311
7518
  * @param documentId - Document ID to patch
7312
7519
  * @param operations - Optional object of patch operations to initialize the patch instance with
7313
7520
  * @returns Patch instance - call `.commit()` to perform the operations defined
@@ -7332,6 +7539,8 @@ declare class SanityClient {
7332
7539
  /**
7333
7540
  * Create a new transaction of mutations
7334
7541
  *
7542
+ * @category Mutations
7543
+ *
7335
7544
  * @param operations - Optional array of mutation operations to initialize the transaction instance with
7336
7545
  */
7337
7546
  transaction<R extends Record<string, Any> = Record<string, Any>>(operations?: Mutation<R>[]): Transaction;
@@ -7339,6 +7548,8 @@ declare class SanityClient {
7339
7548
  * Perform action operations against the configured dataset
7340
7549
  * Returns a promise that resolves to the transaction result
7341
7550
  *
7551
+ * @category Mutations
7552
+ *
7342
7553
  * @param operations - Action operation(s) to execute
7343
7554
  * @param options - Action options
7344
7555
  */
@@ -7347,6 +7558,8 @@ declare class SanityClient {
7347
7558
  * Perform a request against the Sanity API
7348
7559
  * NOTE: Only use this for Sanity API endpoints, not for your own APIs!
7349
7560
  *
7561
+ * @category HTTP
7562
+ *
7350
7563
  * @param options - Request options
7351
7564
  * @returns Promise resolving to the response body
7352
7565
  */
@@ -7365,6 +7578,8 @@ declare class SanityClient {
7365
7578
  /**
7366
7579
  * Get a Sanity API URL for the URI provided
7367
7580
  *
7581
+ * @category HTTP
7582
+ *
7368
7583
  * @param uri - URI/path to build URL for
7369
7584
  * @param canUseCdn - Whether or not to allow using the API CDN for this route
7370
7585
  */
@@ -7372,6 +7587,8 @@ declare class SanityClient {
7372
7587
  /**
7373
7588
  * Get a Sanity API URL for the data operation and path provided
7374
7589
  *
7590
+ * @category HTTP
7591
+ *
7375
7592
  * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
7376
7593
  * @param path - Path to append after the operation
7377
7594
  */
@@ -8170,7 +8387,7 @@ type DatasetAclMode = 'public' | 'private' | 'custom';
8170
8387
  /** @public */
8171
8388
  type DatasetCreateOptions = {
8172
8389
  aclMode?: DatasetAclMode;
8173
- description?: string;
8390
+ description?: string | null;
8174
8391
  embeddings?: {
8175
8392
  enabled: boolean;
8176
8393
  projection?: string;
@@ -8179,7 +8396,7 @@ type DatasetCreateOptions = {
8179
8396
  /** @public */
8180
8397
  type DatasetEditOptions = {
8181
8398
  aclMode?: DatasetAclMode;
8182
- description?: string;
8399
+ description?: string | null;
8183
8400
  };
8184
8401
  /** @public */
8185
8402
  type EmbeddingsSettings = {
@@ -8196,13 +8413,13 @@ type EmbeddingsSettingsBody = {
8196
8413
  type DatasetResponse = {
8197
8414
  datasetName: string;
8198
8415
  aclMode: DatasetAclMode;
8199
- description: string;
8416
+ description: string | null;
8200
8417
  };
8201
8418
  /** @public */
8202
8419
  type DatasetsResponse = {
8203
8420
  name: string;
8204
8421
  aclMode: DatasetAclMode;
8205
- description: string;
8422
+ description?: string;
8206
8423
  createdAt: string;
8207
8424
  createdByUserId: string;
8208
8425
  addonFor: string | null;
@@ -9578,8 +9795,46 @@ interface LiveEventGoAway {
9578
9795
  }
9579
9796
  /** @public */
9580
9797
  type LiveEvent = LiveEventRestart | LiveEventReconnect | LiveEventMessage | LiveEventWelcome | LiveEventGoAway;
9581
- /** @public */
9582
- interface SanityQueries {}
9798
+ declare global {
9799
+ /**
9800
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
9801
+ * the queries it finds:
9802
+ * ```ts
9803
+ * declare global {
9804
+ * interface SanityQueries {
9805
+ * '*[_type == "post"]': PostsQueryResult
9806
+ * }
9807
+ * }
9808
+ * ```
9809
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
9810
+ *
9811
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
9812
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
9813
+ * direct dependency, how many copies of it are installed, and from every subpath export.
9814
+ */
9815
+ interface SanityQueries {}
9816
+ }
9817
+ /**
9818
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
9819
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
9820
+ * ```ts
9821
+ * declare module '@sanity/client' {
9822
+ * interface SanityQueries {
9823
+ * '*[_type == "post"]': PostsQueryResult
9824
+ * }
9825
+ * }
9826
+ * ```
9827
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
9828
+ * generated file that registers queries globally can bridge them with an augmentation that adds
9829
+ * the global as a base type. It is harmless on releases that already inherit it:
9830
+ * ```ts
9831
+ * declare module '@sanity/client' {
9832
+ * interface SanityQueries extends globalThis.SanityQueries {}
9833
+ * }
9834
+ * ```
9835
+ * @public
9836
+ */
9837
+ interface SanityQueries extends globalThis.SanityQueries {}
9583
9838
  /** @public */
9584
9839
  type ClientReturn<GroqString extends string, Fallback = Any> = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback;
9585
9840
  /**