@sanity/client 8.4.0 → 8.6.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 (42) hide show
  1. package/README.md +80 -4
  2. package/dist/{browserUpload-C7PwCs-C.js → browserUpload-CXcfRh-z.js} +2 -2
  3. package/dist/{browserUpload-C7PwCs-C.js.map → browserUpload-CXcfRh-z.js.map} +1 -1
  4. package/dist/{browserUpload-D-2Rmfjo.js → browserUpload-D3ST_REr.js} +2 -2
  5. package/dist/{browserUpload-D-2Rmfjo.js.map → browserUpload-D3ST_REr.js.map} +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +204 -9
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.node.d.ts +325 -23
  10. package/dist/index.node.js +154 -16
  11. package/dist/index.node.js.map +1 -1
  12. package/dist/media-library.d.ts +1 -1
  13. package/dist/{request-SnMg7nUX.js → request-BzWeXkUo.js} +3 -2
  14. package/dist/request-BzWeXkUo.js.map +1 -0
  15. package/dist/{request-BhMuKj0D.js → request-SY_xwBuz.js} +3 -2
  16. package/dist/request-SY_xwBuz.js.map +1 -0
  17. package/dist/stega.js +2 -2
  18. package/dist/{dist-Z8cIRxoB.js → stegaClean-YZRATV86.js} +19 -2
  19. package/dist/stegaClean-YZRATV86.js.map +1 -0
  20. package/dist/{stegaEncodeSourceMap-YR3NQ3iz.js → stegaEncodeSourceMap-Dj29aWKG.js} +2 -2
  21. package/dist/{stegaEncodeSourceMap-YR3NQ3iz.js.map → stegaEncodeSourceMap-Dj29aWKG.js.map} +1 -1
  22. package/dist/{types-DiPF0ENT.d.ts → types-B1XLvey7.d.ts} +326 -24
  23. package/package.json +17 -14
  24. package/src/SanityClient.ts +176 -9
  25. package/src/agent/actions/AgentActionsClient.ts +8 -2
  26. package/src/assets/AssetsClient.ts +8 -2
  27. package/src/context/openapi.json +663 -2
  28. package/src/context/types.gen.ts +48 -1
  29. package/src/data/dataMethods.ts +2 -5
  30. package/src/data/live.ts +1 -0
  31. package/src/datasets/DatasetsClient.ts +8 -2
  32. package/src/http/request.ts +2 -10
  33. package/src/mediaLibrary/MediaLibraryVideoClient.ts +8 -2
  34. package/src/projects/ProjectsClient.ts +8 -2
  35. package/src/releases/ReleasesClient.ts +8 -2
  36. package/src/types.ts +49 -6
  37. package/src/users/UsersClient.ts +8 -2
  38. package/dist/dist-Z8cIRxoB.js.map +0 -1
  39. package/dist/request-BhMuKj0D.js.map +0 -1
  40. package/dist/request-SnMg7nUX.js.map +0 -1
  41. package/dist/stegaClean-C18wLWau.js +0 -21
  42. package/dist/stegaClean-C18wLWau.js.map +0 -1
@@ -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);
@@ -2189,7 +2201,7 @@ interface paths {
2189
2201
  get?: never;
2190
2202
  /**
2191
2203
  * Record a conversation
2192
- * @description Upserts the conversation telemetry for one thread. `threadId` identifies the conversation within your organization — reuse means the same conversation. Messages replace the stored transcript wholesale; `metadata` and model fields only overwrite when present. Last write per thread wins — retries are safe.
2204
+ * @description Upserts the conversation telemetry for one thread. `threadId` identifies the conversation within your organization — reuse means the same conversation. Messages replace the stored transcript wholesale; `metadata`, `sharing`, and model fields only overwrite when present. Last write per thread wins — retries are safe. `sharing` records your opt-in to share telemetry with Sanity: metadata-only metrics, or full transcripts.
2193
2205
  */
2194
2206
  put: operations['saveConversation'];
2195
2207
  post?: never;
@@ -2259,6 +2271,15 @@ interface components {
2259
2271
  /** Format: date-time */
2260
2272
  classifiedAt: string | null;
2261
2273
  classificationError: string | null;
2274
+ /**
2275
+ * @description ConversationSharing
2276
+ * @default null
2277
+ */
2278
+ sharing: {
2279
+ metrics?: boolean;
2280
+ conversations?: boolean;
2281
+ contact?: string;
2282
+ } | null;
2262
2283
  };
2263
2284
  /** @description A `sanity.context.entry` document, one outline node stored in the bound dataset. Not returned by any endpoint; published so GROQ reads against the dataset can be typed. The entries endpoints serve the validated wire view. */
2264
2285
  EntryDoc: {
@@ -2614,6 +2635,11 @@ interface operations {
2614
2635
  refreshInFlight: boolean;
2615
2636
  openIssueCount: number;
2616
2637
  instructionCount: number;
2638
+ /** @description Actor */
2639
+ createdBy: {
2640
+ id: string | null;
2641
+ displayName: string | null;
2642
+ } | null;
2617
2643
  /** Format: date-time */
2618
2644
  createdAt: string;
2619
2645
  /** Format: date-time */
@@ -2706,6 +2732,11 @@ interface operations {
2706
2732
  refreshInFlight: boolean;
2707
2733
  openIssueCount: number;
2708
2734
  instructionCount: number;
2735
+ /** @description Actor */
2736
+ createdBy: {
2737
+ id: string | null;
2738
+ displayName: string | null;
2739
+ } | null;
2709
2740
  /** Format: date-time */
2710
2741
  createdAt: string;
2711
2742
  /** Format: date-time */
@@ -2788,6 +2819,11 @@ interface operations {
2788
2819
  refreshInFlight: boolean;
2789
2820
  openIssueCount: number;
2790
2821
  instructionCount: number;
2822
+ /** @description Actor */
2823
+ createdBy: {
2824
+ id: string | null;
2825
+ displayName: string | null;
2826
+ } | null;
2791
2827
  /** Format: date-time */
2792
2828
  createdAt: string;
2793
2829
  /** Format: date-time */
@@ -2902,6 +2938,11 @@ interface operations {
2902
2938
  refreshInFlight: boolean;
2903
2939
  openIssueCount: number;
2904
2940
  instructionCount: number;
2941
+ /** @description Actor */
2942
+ createdBy: {
2943
+ id: string | null;
2944
+ displayName: string | null;
2945
+ } | null;
2905
2946
  /** Format: date-time */
2906
2947
  createdAt: string;
2907
2948
  /** Format: date-time */
@@ -3915,6 +3956,12 @@ interface operations {
3915
3956
  metadata?: {
3916
3957
  [key: string]: string | string[];
3917
3958
  };
3959
+ /** @description ConversationSharing */
3960
+ sharing?: {
3961
+ metrics?: boolean;
3962
+ conversations?: boolean;
3963
+ contact?: string;
3964
+ };
3918
3965
  };
3919
3966
  };
3920
3967
  };
@@ -3967,6 +4014,12 @@ interface operations {
3967
4014
  /** Format: date-time */
3968
4015
  classifiedAt: string | null;
3969
4016
  classificationError: string | null;
4017
+ /** @description ConversationSharing */
4018
+ sharing: {
4019
+ metrics?: boolean;
4020
+ conversations?: boolean;
4021
+ contact?: string;
4022
+ } | null;
3970
4023
  /** Format: date-time */
3971
4024
  createdAt: string;
3972
4025
  /** Format: date-time */
@@ -4048,6 +4101,12 @@ interface operations {
4048
4101
  /** Format: date-time */
4049
4102
  classifiedAt: string | null;
4050
4103
  classificationError: string | null;
4104
+ /** @description ConversationSharing */
4105
+ sharing: {
4106
+ metrics?: boolean;
4107
+ conversations?: boolean;
4108
+ contact?: string;
4109
+ } | null;
4051
4110
  /** Format: date-time */
4052
4111
  createdAt: string;
4053
4112
  /** Format: date-time */
@@ -4957,6 +5016,7 @@ declare class ObservableContextClient {
4957
5016
  }
4958
5017
  /**
4959
5018
  * @public
5019
+ * @inline
4960
5020
  */
4961
5021
  declare class LiveClient {
4962
5022
  #private;
@@ -5334,7 +5394,10 @@ declare class ObservableTransaction extends BaseTransaction {
5334
5394
  */
5335
5395
  patch(patch: ObservablePatch): this;
5336
5396
  }
5337
- /** @internal */
5397
+ /**
5398
+ * @internal
5399
+ * @inline
5400
+ */
5338
5401
  declare class ObservableDatasetsClient {
5339
5402
  #private;
5340
5403
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -5378,7 +5441,10 @@ declare class ObservableDatasetsClient {
5378
5441
  */
5379
5442
  editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void>;
5380
5443
  }
5381
- /** @internal */
5444
+ /**
5445
+ * @internal
5446
+ * @inline
5447
+ */
5382
5448
  declare class DatasetsClient {
5383
5449
  #private;
5384
5450
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -5518,7 +5584,10 @@ declare class FunctionsClient {
5518
5584
  }): Promise<R>;
5519
5585
  invoke<R = unknown>(functionName: string, request?: InvokeFunctionRequest, options?: InvokeFunctionOptions): Promise<R | undefined>;
5520
5586
  }
5521
- /** @internal */
5587
+ /**
5588
+ * @internal
5589
+ * @inline
5590
+ */
5522
5591
  declare class ObservableMediaLibraryVideoClient {
5523
5592
  #private;
5524
5593
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -5530,7 +5599,10 @@ declare class ObservableMediaLibraryVideoClient {
5530
5599
  */
5531
5600
  getPlaybackInfo(assetIdentifier: MediaLibraryAssetInstanceIdentifier, options?: MediaLibraryPlaybackInfoOptions): Observable<VideoPlaybackInfo>;
5532
5601
  }
5533
- /** @internal */
5602
+ /**
5603
+ * @internal
5604
+ * @inline
5605
+ */
5534
5606
  declare class MediaLibraryVideoClient {
5535
5607
  #private;
5536
5608
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -5553,7 +5625,10 @@ type OmittedProjectFields<T extends ListOptions | undefined> = (T extends {
5553
5625
  } ? 'members' : never) | (T extends {
5554
5626
  includeFeatures: false;
5555
5627
  } ? 'features' : never);
5556
- /** @internal */
5628
+ /**
5629
+ * @internal
5630
+ * @inline
5631
+ */
5557
5632
  declare class ObservableProjectsClient {
5558
5633
  #private;
5559
5634
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -5574,7 +5649,10 @@ declare class ObservableProjectsClient {
5574
5649
  */
5575
5650
  getById(projectId: string): Observable<SanityProject>;
5576
5651
  }
5577
- /** @internal */
5652
+ /**
5653
+ * @internal
5654
+ * @inline
5655
+ */
5578
5656
  declare class ProjectsClient {
5579
5657
  #private;
5580
5658
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -5595,7 +5673,10 @@ declare class ProjectsClient {
5595
5673
  */
5596
5674
  getById(projectId: string): Promise<SanityProject>;
5597
5675
  }
5598
- /** @public */
5676
+ /**
5677
+ * @public
5678
+ * @inline
5679
+ */
5599
5680
  declare class ObservableReleasesClient {
5600
5681
  #private;
5601
5682
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -5840,7 +5921,10 @@ declare class ObservableReleasesClient {
5840
5921
  releaseId: string;
5841
5922
  }, options?: BaseMutationOptions): Observable<RawQueryResponse<SanityDocument[]>>;
5842
5923
  }
5843
- /** @public */
5924
+ /**
5925
+ * @public
5926
+ * @inline
5927
+ */
5844
5928
  declare class ReleasesClient {
5845
5929
  #private;
5846
5930
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -6076,7 +6160,10 @@ declare class ReleasesClient {
6076
6160
  releaseId: string;
6077
6161
  }, options?: BaseMutationOptions): Promise<RawQueryResponse<SanityDocument[]>>;
6078
6162
  }
6079
- /** @public */
6163
+ /**
6164
+ * @public
6165
+ * @inline
6166
+ */
6080
6167
  declare class ObservableUsersClient {
6081
6168
  #private;
6082
6169
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
@@ -6087,7 +6174,10 @@ declare class ObservableUsersClient {
6087
6174
  */
6088
6175
  getById<T extends string>(id: T): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>;
6089
6176
  }
6090
- /** @public */
6177
+ /**
6178
+ * @public
6179
+ * @inline
6180
+ */
6091
6181
  declare class UsersClient {
6092
6182
  #private;
6093
6183
  constructor(client: SanityClient, httpRequest: HttpRequest);
@@ -6101,15 +6191,52 @@ declare class UsersClient {
6101
6191
  /** @public */
6102
6192
  declare class ObservableSanityClient {
6103
6193
  #private;
6194
+ /**
6195
+ * Upload, fetch and delete assets (images and files) in the configured dataset
6196
+ *
6197
+ * @category Assets
6198
+ */
6104
6199
  assets: ObservableAssetsClient;
6200
+ /**
6201
+ * Create, list, edit and delete datasets in the configured project
6202
+ *
6203
+ * @category Projects & Datasets
6204
+ */
6105
6205
  datasets: ObservableDatasetsClient;
6206
+ /**
6207
+ * Subscribe to live content updates through the Live Content API
6208
+ *
6209
+ * @category Real-time
6210
+ */
6106
6211
  live: LiveClient;
6212
+ /**
6213
+ * Interact with Media Library assets
6214
+ *
6215
+ * @category Assets
6216
+ */
6107
6217
  mediaLibrary: {
6218
+ /** Upload and manage Media Library video assets */
6108
6219
  video: ObservableMediaLibraryVideoClient;
6109
6220
  };
6221
+ /**
6222
+ * Fetch information about the projects the authenticated user has access to
6223
+ *
6224
+ * @category Projects & Datasets
6225
+ */
6110
6226
  projects: ObservableProjectsClient;
6227
+ /**
6228
+ * Fetch information about users in the configured project
6229
+ *
6230
+ * @category Projects & Datasets
6231
+ */
6111
6232
  users: ObservableUsersClient;
6233
+ /**
6234
+ * Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
6235
+ *
6236
+ * @category Agent Actions
6237
+ */
6112
6238
  agent: {
6239
+ /** Run individual Agent Action operations */
6113
6240
  action: ObservableAgentsActionClient;
6114
6241
  };
6115
6242
  collaboration: {
@@ -6117,20 +6244,31 @@ declare class ObservableSanityClient {
6117
6244
  comments: ObservableCollaborationCommentsClient;
6118
6245
  };
6119
6246
  functions: ObservableFunctionsClient;
6247
+ /**
6248
+ * Create and manage content releases and their scheduled publishing
6249
+ *
6250
+ * @category Releases
6251
+ */
6120
6252
  releases: ObservableReleasesClient;
6121
6253
  /** @beta */
6122
6254
  context: ObservableContextClient;
6123
6255
  /**
6124
- * Instance properties
6256
+ * Listen to document changes matching a GROQ query, delivered as server-sent events
6257
+ *
6258
+ * @category Real-time
6125
6259
  */
6126
6260
  listen: typeof _listen;
6127
6261
  constructor(httpRequest: HttpRequest, config?: ClientConfig);
6128
6262
  /**
6129
6263
  * Clone the client - returns a new instance
6264
+ *
6265
+ * @category Configuration
6130
6266
  */
6131
6267
  clone(): ObservableSanityClient;
6132
6268
  /**
6133
6269
  * Returns the current client configuration
6270
+ *
6271
+ * @category Configuration
6134
6272
  */
6135
6273
  config(): InitializedClientConfig;
6136
6274
  /**
@@ -6140,12 +6278,16 @@ declare class ObservableSanityClient {
6140
6278
  /**
6141
6279
  * Clone the client with a new (partial) configuration.
6142
6280
  *
6281
+ * @category Configuration
6282
+ *
6143
6283
  * @param newConfig - New client configuration properties, shallowly merged with existing configuration
6144
6284
  */
6145
6285
  withConfig(newConfig?: Partial<ClientConfig>): ObservableSanityClient;
6146
6286
  /**
6147
6287
  * Perform a GROQ-query against the configured dataset.
6148
6288
  *
6289
+ * @category Querying
6290
+ *
6149
6291
  * @param query - GROQ-query to perform
6150
6292
  */
6151
6293
  fetch<R = Any, Q extends QueryWithoutParams = QueryWithoutParams, const G extends string = string>(query: G, params?: Q | QueryWithoutParams): Observable<ClientReturn<G, R>>;
@@ -6176,6 +6318,8 @@ declare class ObservableSanityClient {
6176
6318
  /**
6177
6319
  * Fetch a single document with the given ID.
6178
6320
  *
6321
+ * @category Querying
6322
+ *
6179
6323
  * @param id - Document ID to fetch
6180
6324
  * @param options - Request options
6181
6325
  */
@@ -6203,6 +6347,8 @@ declare class ObservableSanityClient {
6203
6347
  * The order/position of documents is preserved based on the original array of IDs.
6204
6348
  * If any of the documents are missing, they will be replaced by a `null` entry in the returned array
6205
6349
  *
6350
+ * @category Querying
6351
+ *
6206
6352
  * @param ids - Document IDs to fetch
6207
6353
  * @param options - Request options
6208
6354
  */
@@ -6213,6 +6359,8 @@ declare class ObservableSanityClient {
6213
6359
  * Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
6214
6360
  * Returns a set of the IDs that exist.
6215
6361
  *
6362
+ * @category Querying
6363
+ *
6216
6364
  * @param ids - Document IDs to check
6217
6365
  * @param options - Request options
6218
6366
  */
@@ -6224,6 +6372,8 @@ declare class ObservableSanityClient {
6224
6372
  * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
6225
6373
  * Returns an observable that resolves to the created document.
6226
6374
  *
6375
+ * @category Mutations
6376
+ *
6227
6377
  * @param document - Document to create
6228
6378
  * @param options - Mutation options
6229
6379
  */
@@ -6264,6 +6414,8 @@ declare class ObservableSanityClient {
6264
6414
  * Create a document if no document with the same ID already exists.
6265
6415
  * Returns an observable that resolves to the created document.
6266
6416
  *
6417
+ * @category Mutations
6418
+ *
6267
6419
  * @param document - Document to create
6268
6420
  * @param options - Mutation options
6269
6421
  */
@@ -6304,6 +6456,8 @@ declare class ObservableSanityClient {
6304
6456
  * Create a document if it does not exist, or replace a document with the same document ID
6305
6457
  * Returns an observable that resolves to the created document.
6306
6458
  *
6459
+ * @category Mutations
6460
+ *
6307
6461
  * @param document - Document to either create or replace
6308
6462
  * @param options - Mutation options
6309
6463
  */
@@ -6428,6 +6582,8 @@ declare class ObservableSanityClient {
6428
6582
  * Deletes a document with the given document ID.
6429
6583
  * Returns an observable that resolves to the deleted document.
6430
6584
  *
6585
+ * @category Mutations
6586
+ *
6431
6587
  * @param id - Document ID to delete
6432
6588
  * @param options - Options for the mutation
6433
6589
  */
@@ -6513,6 +6669,8 @@ declare class ObservableSanityClient {
6513
6669
  * * Discarding a version with no `releaseId` will discard the draft version of the published document.
6514
6670
  * * If the draft or release version does not exist, any error will throw.
6515
6671
  *
6672
+ * @category Versions
6673
+ *
6516
6674
  * @param params - Version action parameters:
6517
6675
  * - `releaseId` - The ID of the release to discard the document from.
6518
6676
  * - `publishedId` - The published ID of the document to discard.
@@ -6548,6 +6706,8 @@ declare class ObservableSanityClient {
6548
6706
  * * Replacing a version with no `releaseId` will replace the draft version of the published document.
6549
6707
  * * At least one of the **version** or **published** documents must exist.
6550
6708
  *
6709
+ * @category Versions
6710
+ *
6551
6711
  * @param params - Version action parameters:
6552
6712
  * - `document` - The new document to replace the version with.
6553
6713
  * - `releaseId` - The ID of the release where the document version is replaced.
@@ -6620,6 +6780,8 @@ declare class ObservableSanityClient {
6620
6780
  * @remarks
6621
6781
  * * If the published document does not exist, an error will be thrown.
6622
6782
  *
6783
+ * @category Versions
6784
+ *
6623
6785
  * @param params - Version action parameters:
6624
6786
  * - `releaseId` - The ID of the release to unpublish the document from.
6625
6787
  * - `publishedId` - The published ID of the document to unpublish.
@@ -6640,6 +6802,8 @@ declare class ObservableSanityClient {
6640
6802
  * Perform mutation operations against the configured dataset
6641
6803
  * Returns an observable that resolves to the first mutated document.
6642
6804
  *
6805
+ * @category Mutations
6806
+ *
6643
6807
  * @param operations - Mutation operations to execute
6644
6808
  * @param options - Mutation options
6645
6809
  */
@@ -6679,6 +6843,8 @@ declare class ObservableSanityClient {
6679
6843
  /**
6680
6844
  * Create a new buildable patch of operations to perform
6681
6845
  *
6846
+ * @category Mutations
6847
+ *
6682
6848
  * @param documentId - Document ID to patch
6683
6849
  * @param operations - Optional object of patch operations to initialize the patch instance with
6684
6850
  * @returns Patch instance - call `.commit()` to perform the operations defined
@@ -6703,12 +6869,16 @@ declare class ObservableSanityClient {
6703
6869
  /**
6704
6870
  * Create a new transaction of mutations
6705
6871
  *
6872
+ * @category Mutations
6873
+ *
6706
6874
  * @param operations - Optional array of mutation operations to initialize the transaction instance with
6707
6875
  */
6708
6876
  transaction<R extends Record<string, Any> = Record<string, Any>>(operations?: Mutation<R>[]): ObservableTransaction;
6709
6877
  /**
6710
6878
  * Perform action operations against the configured dataset
6711
6879
  *
6880
+ * @category Mutations
6881
+ *
6712
6882
  * @param operations - Action operation(s) to execute
6713
6883
  * @param options - Action options
6714
6884
  */
@@ -6716,12 +6886,16 @@ declare class ObservableSanityClient {
6716
6886
  /**
6717
6887
  * Perform an HTTP request against the Sanity API
6718
6888
  *
6889
+ * @category HTTP
6890
+ *
6719
6891
  * @param options - Request options
6720
6892
  */
6721
6893
  request<R = Any>(options: RawRequestOptions): Observable<R>;
6722
6894
  /**
6723
6895
  * Get a Sanity API URL for the URI provided
6724
6896
  *
6897
+ * @category HTTP
6898
+ *
6725
6899
  * @param uri - URI/path to build URL for
6726
6900
  * @param canUseCdn - Whether or not to allow using the API CDN for this route
6727
6901
  */
@@ -6729,6 +6903,8 @@ declare class ObservableSanityClient {
6729
6903
  /**
6730
6904
  * Get a Sanity API URL for the data operation and path provided
6731
6905
  *
6906
+ * @category HTTP
6907
+ *
6732
6908
  * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
6733
6909
  * @param path - Path to append after the operation
6734
6910
  */
@@ -6737,15 +6913,52 @@ declare class ObservableSanityClient {
6737
6913
  /** @public */
6738
6914
  declare class SanityClient {
6739
6915
  #private;
6916
+ /**
6917
+ * Upload, fetch and delete assets (images and files) in the configured dataset
6918
+ *
6919
+ * @category Assets
6920
+ */
6740
6921
  assets: AssetsClient;
6922
+ /**
6923
+ * Create, list, edit and delete datasets in the configured project
6924
+ *
6925
+ * @category Projects & Datasets
6926
+ */
6741
6927
  datasets: DatasetsClient;
6928
+ /**
6929
+ * Subscribe to live content updates through the Live Content API
6930
+ *
6931
+ * @category Real-time
6932
+ */
6742
6933
  live: LiveClient;
6934
+ /**
6935
+ * Interact with Media Library assets
6936
+ *
6937
+ * @category Assets
6938
+ */
6743
6939
  mediaLibrary: {
6940
+ /** Upload and manage Media Library video assets */
6744
6941
  video: MediaLibraryVideoClient;
6745
6942
  };
6943
+ /**
6944
+ * Fetch information about the projects the authenticated user has access to
6945
+ *
6946
+ * @category Projects & Datasets
6947
+ */
6746
6948
  projects: ProjectsClient;
6949
+ /**
6950
+ * Fetch information about users in the configured project
6951
+ *
6952
+ * @category Projects & Datasets
6953
+ */
6747
6954
  users: UsersClient;
6955
+ /**
6956
+ * Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
6957
+ *
6958
+ * @category Agent Actions
6959
+ */
6748
6960
  agent: {
6961
+ /** Run individual Agent Action operations */
6749
6962
  action: AgentActionsClient;
6750
6963
  };
6751
6964
  collaboration: {
@@ -6753,24 +6966,37 @@ declare class SanityClient {
6753
6966
  comments: CollaborationCommentsClient;
6754
6967
  };
6755
6968
  functions: FunctionsClient;
6969
+ /**
6970
+ * Create and manage content releases and their scheduled publishing
6971
+ *
6972
+ * @category Releases
6973
+ */
6756
6974
  releases: ReleasesClient;
6757
6975
  /** @beta */
6758
6976
  context: ContextClient;
6759
6977
  /**
6760
6978
  * Observable version of the Sanity client, with the same configuration as the promise-based one
6979
+ *
6980
+ * @category Configuration
6761
6981
  */
6762
6982
  observable: ObservableSanityClient;
6763
6983
  /**
6764
- * Instance properties
6984
+ * Listen to document changes matching a GROQ query, delivered as server-sent events
6985
+ *
6986
+ * @category Real-time
6765
6987
  */
6766
6988
  listen: typeof _listen;
6767
6989
  constructor(httpRequest: HttpRequest, config?: ClientConfig);
6768
6990
  /**
6769
6991
  * Clone the client - returns a new instance
6992
+ *
6993
+ * @category Configuration
6770
6994
  */
6771
6995
  clone(): SanityClient;
6772
6996
  /**
6773
6997
  * Returns the current client configuration
6998
+ *
6999
+ * @category Configuration
6774
7000
  */
6775
7001
  config(): InitializedClientConfig;
6776
7002
  /**
@@ -6780,12 +7006,16 @@ declare class SanityClient {
6780
7006
  /**
6781
7007
  * Clone the client with a new (partial) configuration.
6782
7008
  *
7009
+ * @category Configuration
7010
+ *
6783
7011
  * @param newConfig - New client configuration properties, shallowly merged with existing configuration
6784
7012
  */
6785
7013
  withConfig(newConfig?: Partial<ClientConfig>): SanityClient;
6786
7014
  /**
6787
7015
  * Perform a GROQ-query against the configured dataset.
6788
7016
  *
7017
+ * @category Querying
7018
+ *
6789
7019
  * @param query - GROQ-query to perform
6790
7020
  */
6791
7021
  fetch<R = Any, Q extends QueryWithoutParams = QueryWithoutParams, const G extends string = string>(query: G, params?: Q | QueryWithoutParams): Promise<ClientReturn<G, R>>;
@@ -6816,6 +7046,8 @@ declare class SanityClient {
6816
7046
  /**
6817
7047
  * Fetch a single document with the given ID.
6818
7048
  *
7049
+ * @category Querying
7050
+ *
6819
7051
  * @param id - Document ID to fetch
6820
7052
  * @param options - Request options
6821
7053
  */
@@ -6843,6 +7075,8 @@ declare class SanityClient {
6843
7075
  * The order/position of documents is preserved based on the original array of IDs.
6844
7076
  * If any of the documents are missing, they will be replaced by a `null` entry in the returned array
6845
7077
  *
7078
+ * @category Querying
7079
+ *
6846
7080
  * @param ids - Document IDs to fetch
6847
7081
  * @param options - Request options
6848
7082
  */
@@ -6854,6 +7088,8 @@ declare class SanityClient {
6854
7088
  * Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
6855
7089
  * Returns a set of the IDs that exist.
6856
7090
  *
7091
+ * @category Querying
7092
+ *
6857
7093
  * @param ids - Document IDs to check
6858
7094
  * @param options - Request options
6859
7095
  */
@@ -6865,6 +7101,8 @@ declare class SanityClient {
6865
7101
  * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
6866
7102
  * Returns a promise that resolves to the created document.
6867
7103
  *
7104
+ * @category Mutations
7105
+ *
6868
7106
  * @param document - Document to create
6869
7107
  * @param options - Mutation options
6870
7108
  */
@@ -6905,6 +7143,8 @@ declare class SanityClient {
6905
7143
  * Create a document if no document with the same ID already exists.
6906
7144
  * Returns a promise that resolves to the created document.
6907
7145
  *
7146
+ * @category Mutations
7147
+ *
6908
7148
  * @param document - Document to create
6909
7149
  * @param options - Mutation options
6910
7150
  */
@@ -6945,6 +7185,8 @@ declare class SanityClient {
6945
7185
  * Create a document if it does not exist, or replace a document with the same document ID
6946
7186
  * Returns a promise that resolves to the created document.
6947
7187
  *
7188
+ * @category Mutations
7189
+ *
6948
7190
  * @param document - Document to either create or replace
6949
7191
  * @param options - Mutation options
6950
7192
  */
@@ -7057,6 +7299,8 @@ declare class SanityClient {
7057
7299
  * Deletes a document with the given document ID.
7058
7300
  * Returns a promise that resolves to the deleted document.
7059
7301
  *
7302
+ * @category Mutations
7303
+ *
7060
7304
  * @param id - Document ID to delete
7061
7305
  * @param options - Options for the mutation
7062
7306
  */
@@ -7142,6 +7386,8 @@ declare class SanityClient {
7142
7386
  * * Discarding a version with no `releaseId` will discard the draft version of the published document.
7143
7387
  * * If the draft or release version does not exist, any error will throw.
7144
7388
  *
7389
+ * @category Versions
7390
+ *
7145
7391
  * @param params - Version action parameters:
7146
7392
  * - `releaseId` - The ID of the release to discard the document from.
7147
7393
  * - `publishedId` - The published ID of the document to discard.
@@ -7177,6 +7423,8 @@ declare class SanityClient {
7177
7423
  * * Replacing a version with no `releaseId` will replace the draft version of the published document.
7178
7424
  * * At least one of the **version** or **published** documents must exist.
7179
7425
  *
7426
+ * @category Versions
7427
+ *
7180
7428
  * @param params - Version action parameters:
7181
7429
  * - `document` - The new document to replace the version with.
7182
7430
  * - `releaseId` - The ID of the release where the document version is replaced.
@@ -7249,6 +7497,8 @@ declare class SanityClient {
7249
7497
  * @remarks
7250
7498
  * * If the published document does not exist, an error will be thrown.
7251
7499
  *
7500
+ * @category Versions
7501
+ *
7252
7502
  * @param params - Version action parameters:
7253
7503
  * - `releaseId` - The ID of the release to unpublish the document from.
7254
7504
  * - `publishedId` - The published ID of the document to unpublish.
@@ -7269,6 +7519,8 @@ declare class SanityClient {
7269
7519
  * Perform mutation operations against the configured dataset
7270
7520
  * Returns a promise that resolves to the first mutated document.
7271
7521
  *
7522
+ * @category Mutations
7523
+ *
7272
7524
  * @param operations - Mutation operations to execute
7273
7525
  * @param options - Mutation options
7274
7526
  */
@@ -7308,6 +7560,8 @@ declare class SanityClient {
7308
7560
  /**
7309
7561
  * Create a new buildable patch of operations to perform
7310
7562
  *
7563
+ * @category Mutations
7564
+ *
7311
7565
  * @param documentId - Document ID to patch
7312
7566
  * @param operations - Optional object of patch operations to initialize the patch instance with
7313
7567
  * @returns Patch instance - call `.commit()` to perform the operations defined
@@ -7332,6 +7586,8 @@ declare class SanityClient {
7332
7586
  /**
7333
7587
  * Create a new transaction of mutations
7334
7588
  *
7589
+ * @category Mutations
7590
+ *
7335
7591
  * @param operations - Optional array of mutation operations to initialize the transaction instance with
7336
7592
  */
7337
7593
  transaction<R extends Record<string, Any> = Record<string, Any>>(operations?: Mutation<R>[]): Transaction;
@@ -7339,6 +7595,8 @@ declare class SanityClient {
7339
7595
  * Perform action operations against the configured dataset
7340
7596
  * Returns a promise that resolves to the transaction result
7341
7597
  *
7598
+ * @category Mutations
7599
+ *
7342
7600
  * @param operations - Action operation(s) to execute
7343
7601
  * @param options - Action options
7344
7602
  */
@@ -7347,6 +7605,8 @@ declare class SanityClient {
7347
7605
  * Perform a request against the Sanity API
7348
7606
  * NOTE: Only use this for Sanity API endpoints, not for your own APIs!
7349
7607
  *
7608
+ * @category HTTP
7609
+ *
7350
7610
  * @param options - Request options
7351
7611
  * @returns Promise resolving to the response body
7352
7612
  */
@@ -7365,6 +7625,8 @@ declare class SanityClient {
7365
7625
  /**
7366
7626
  * Get a Sanity API URL for the URI provided
7367
7627
  *
7628
+ * @category HTTP
7629
+ *
7368
7630
  * @param uri - URI/path to build URL for
7369
7631
  * @param canUseCdn - Whether or not to allow using the API CDN for this route
7370
7632
  */
@@ -7372,6 +7634,8 @@ declare class SanityClient {
7372
7634
  /**
7373
7635
  * Get a Sanity API URL for the data operation and path provided
7374
7636
  *
7637
+ * @category HTTP
7638
+ *
7375
7639
  * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
7376
7640
  * @param path - Path to append after the operation
7377
7641
  */
@@ -8170,7 +8434,7 @@ type DatasetAclMode = 'public' | 'private' | 'custom';
8170
8434
  /** @public */
8171
8435
  type DatasetCreateOptions = {
8172
8436
  aclMode?: DatasetAclMode;
8173
- description?: string;
8437
+ description?: string | null;
8174
8438
  embeddings?: {
8175
8439
  enabled: boolean;
8176
8440
  projection?: string;
@@ -8179,7 +8443,7 @@ type DatasetCreateOptions = {
8179
8443
  /** @public */
8180
8444
  type DatasetEditOptions = {
8181
8445
  aclMode?: DatasetAclMode;
8182
- description?: string;
8446
+ description?: string | null;
8183
8447
  };
8184
8448
  /** @public */
8185
8449
  type EmbeddingsSettings = {
@@ -8196,13 +8460,13 @@ type EmbeddingsSettingsBody = {
8196
8460
  type DatasetResponse = {
8197
8461
  datasetName: string;
8198
8462
  aclMode: DatasetAclMode;
8199
- description: string;
8463
+ description: string | null;
8200
8464
  };
8201
8465
  /** @public */
8202
8466
  type DatasetsResponse = {
8203
8467
  name: string;
8204
8468
  aclMode: DatasetAclMode;
8205
- description: string;
8469
+ description?: string;
8206
8470
  createdAt: string;
8207
8471
  createdByUserId: string;
8208
8472
  addonFor: string | null;
@@ -9578,8 +9842,46 @@ interface LiveEventGoAway {
9578
9842
  }
9579
9843
  /** @public */
9580
9844
  type LiveEvent = LiveEventRestart | LiveEventReconnect | LiveEventMessage | LiveEventWelcome | LiveEventGoAway;
9581
- /** @public */
9582
- interface SanityQueries {}
9845
+ declare global {
9846
+ /**
9847
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
9848
+ * the queries it finds:
9849
+ * ```ts
9850
+ * declare global {
9851
+ * interface SanityQueries {
9852
+ * '*[_type == "post"]': PostsQueryResult
9853
+ * }
9854
+ * }
9855
+ * ```
9856
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
9857
+ *
9858
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
9859
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
9860
+ * direct dependency, how many copies of it are installed, and from every subpath export.
9861
+ */
9862
+ interface SanityQueries {}
9863
+ }
9864
+ /**
9865
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
9866
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
9867
+ * ```ts
9868
+ * declare module '@sanity/client' {
9869
+ * interface SanityQueries {
9870
+ * '*[_type == "post"]': PostsQueryResult
9871
+ * }
9872
+ * }
9873
+ * ```
9874
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
9875
+ * generated file that registers queries globally can bridge them with an augmentation that adds
9876
+ * the global as a base type. It is harmless on releases that already inherit it:
9877
+ * ```ts
9878
+ * declare module '@sanity/client' {
9879
+ * interface SanityQueries extends globalThis.SanityQueries {}
9880
+ * }
9881
+ * ```
9882
+ * @public
9883
+ */
9884
+ interface SanityQueries extends globalThis.SanityQueries {}
9583
9885
  /** @public */
9584
9886
  type ClientReturn<GroqString extends string, Fallback = Any> = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback;
9585
9887
  /**