@sanity/sdk-react 2.14.1 → 2.15.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.ts CHANGED
@@ -1,62 +1,62 @@
1
- import {ActionsResult} from '@sanity/sdk'
2
- import {AgentGenerateOptions} from '@sanity/sdk'
3
- import {AgentPatchOptions} from '@sanity/sdk'
4
- import {AgentPatchResult} from '@sanity/sdk'
5
- import {AgentPromptOptions} from '@sanity/sdk'
6
- import {AgentPromptResult} from '@sanity/sdk'
7
- import {AgentTransformOptions} from '@sanity/sdk'
8
- import {AgentTranslateOptions} from '@sanity/sdk'
9
- import {AuthState} from '@sanity/sdk'
10
- import {CanvasResource} from '@sanity/message-protocol'
11
- import {ClientOptions} from '@sanity/sdk'
12
- import {Context} from 'react'
13
- import {CurrentUser} from '@sanity/sdk'
14
- import {DatasetHandle} from '@sanity/sdk'
15
- import {DatasetsResponse} from '@sanity/client'
16
- import {DocumentAction} from '@sanity/sdk'
17
- import {DocumentEvent} from '@sanity/sdk'
18
- import {DocumentHandle as DocumentHandle_2} from '@sanity/sdk'
19
- import {DocumentOptions} from '@sanity/sdk'
20
- import {DocumentPermissionsResult} from '@sanity/sdk'
21
- import {DocumentResource} from '@sanity/sdk'
22
- import {DocumentTypeHandle as DocumentTypeHandle_2} from '@sanity/sdk'
23
- import {FallbackProps} from 'react-error-boundary'
24
- import {FavoriteStatusResponse} from '@sanity/sdk'
25
- import {FrameMessage} from '@sanity/sdk'
26
- import {GetUserOptions} from '@sanity/sdk'
27
- import {GetUsersOptions} from '@sanity/sdk'
28
- import {JsonMatch} from '@sanity/sdk'
29
- import {MediaResource} from '@sanity/message-protocol'
30
- import {Organization} from '@sanity/sdk'
31
- import {OrganizationOptions} from '@sanity/sdk'
32
- import {Organizations} from '@sanity/sdk'
33
- import {OrganizationsOptions} from '@sanity/sdk'
34
- import {PathChangeMessage} from '@sanity/message-protocol'
35
- import {PreviewValue} from '@sanity/sdk'
36
- import {Project} from '@sanity/sdk'
37
- import {ProjectOptions} from '@sanity/sdk'
38
- import {ProjectsOptions} from '@sanity/sdk'
39
- import {PropsWithChildren} from 'react'
40
- import {QueryOptions} from '@sanity/sdk'
41
- import {default as React_2} from 'react'
42
- import {ReactElement} from 'react'
43
- import {ReactNode} from 'react'
44
- import {ReleaseAction} from '@sanity/sdk'
45
- import {ReleaseDocument} from '@sanity/sdk'
46
- import {SanityClient} from '@sanity/client'
47
- import {SanityConfig} from '@sanity/sdk'
48
- import {SanityDocument} from '@sanity/types'
49
- import {SanityDocument as SanityDocument_2} from 'groq'
50
- import {SanityInstance} from '@sanity/sdk'
51
- import {SanityProjectionResult} from 'groq'
52
- import {SanityProjectMember} from '@sanity/client'
53
- import {SanityQueryResult} from 'groq'
54
- import {SanityUser} from '@sanity/sdk'
55
- import {SortOrderingItem} from '@sanity/types'
56
- import {StudioResource} from '@sanity/message-protocol'
57
- import {TokenSource} from '@sanity/sdk'
58
- import {UserPresence} from '@sanity/sdk'
59
- import {WindowMessage} from '@sanity/sdk'
1
+ import { ActionsResult } from "@sanity/sdk";
2
+ import { AgentGenerateOptions } from "@sanity/sdk";
3
+ import { AgentPatchOptions } from "@sanity/sdk";
4
+ import { AgentPatchResult } from "@sanity/sdk";
5
+ import { AgentPromptOptions } from "@sanity/sdk";
6
+ import { AgentPromptResult } from "@sanity/sdk";
7
+ import { AgentTransformOptions } from "@sanity/sdk";
8
+ import { AgentTranslateOptions } from "@sanity/sdk";
9
+ import { AuthState } from "@sanity/sdk";
10
+ import { CanvasResource } from "@sanity/message-protocol";
11
+ import { ClientOptions } from "@sanity/sdk";
12
+ import { Context } from "react";
13
+ import { CurrentUser } from "@sanity/sdk";
14
+ import { DatasetHandle } from "@sanity/sdk";
15
+ import { DatasetsResponse } from "@sanity/client";
16
+ import { DocumentAction } from "@sanity/sdk";
17
+ import { DocumentEvent } from "@sanity/sdk";
18
+ import { DocumentHandle as DocumentHandle_2 } from "@sanity/sdk";
19
+ import { DocumentOptions } from "@sanity/sdk";
20
+ import { DocumentPermissionsResult } from "@sanity/sdk";
21
+ import { DocumentResource } from "@sanity/sdk";
22
+ import { DocumentTypeHandle as DocumentTypeHandle_2 } from "@sanity/sdk";
23
+ import { FallbackProps } from "react-error-boundary";
24
+ import { FavoriteStatusResponse } from "@sanity/sdk";
25
+ import { FrameMessage } from "@sanity/sdk";
26
+ import { GetUserOptions } from "@sanity/sdk";
27
+ import { GetUsersOptions } from "@sanity/sdk";
28
+ import { JsonMatch } from "@sanity/sdk";
29
+ import { MediaResource } from "@sanity/message-protocol";
30
+ import { Organization } from "@sanity/sdk";
31
+ import { OrganizationOptions } from "@sanity/sdk";
32
+ import { Organizations } from "@sanity/sdk";
33
+ import { OrganizationsOptions } from "@sanity/sdk";
34
+ import { PathChangeMessage } from "@sanity/message-protocol";
35
+ import { PreviewValue } from "@sanity/sdk";
36
+ import { Project } from "@sanity/sdk";
37
+ import { ProjectOptions } from "@sanity/sdk";
38
+ import { ProjectsOptions } from "@sanity/sdk";
39
+ import { PropsWithChildren } from "react";
40
+ import { QueryOptions } from "@sanity/sdk";
41
+ import { default as React_2 } from "react";
42
+ import { ReactElement } from "react";
43
+ import { ReactNode } from "react";
44
+ import { ReleaseAction } from "@sanity/sdk";
45
+ import { ReleaseDocument } from "@sanity/sdk";
46
+ import { SanityClient } from "@sanity/client";
47
+ import { SanityConfig } from "@sanity/sdk";
48
+ import { SanityDocument } from "@sanity/types";
49
+ import { SanityDocument as SanityDocument_2 } from "groq";
50
+ import { SanityInstance } from "@sanity/sdk";
51
+ import { SanityProjectionResult } from "groq";
52
+ import { SanityProjectMember } from "@sanity/client";
53
+ import { SanityQueryResult } from "groq";
54
+ import { SanityUser } from "@sanity/sdk";
55
+ import { SortOrderingItem } from "@sanity/types";
56
+ import { StudioResource } from "@sanity/message-protocol";
57
+ import { TokenSource } from "@sanity/sdk";
58
+ import { UserPresence } from "@sanity/sdk";
59
+ import { WindowMessage } from "@sanity/sdk";
60
60
 
61
61
  /**
62
62
  * @public
@@ -65,15 +65,15 @@ export declare interface AgentResourceContextOptions {
65
65
  /**
66
66
  * The project ID of the current context
67
67
  */
68
- projectId: string
68
+ projectId: string;
69
69
  /**
70
70
  * The dataset of the current context
71
71
  */
72
- dataset: string
72
+ dataset: string;
73
73
  /**
74
74
  * Optional document ID if the user is viewing/editing a specific document
75
75
  */
76
- documentId?: string
76
+ documentId?: string;
77
77
  }
78
78
 
79
79
  /**
@@ -100,7 +100,7 @@ export declare interface AgentResourceContextOptions {
100
100
  export declare function AuthBoundary({
101
101
  LoginErrorComponent,
102
102
  ...props
103
- }: AuthBoundaryProps): React.ReactNode
103
+ }: AuthBoundaryProps): React.ReactNode;
104
104
 
105
105
  /**
106
106
  * @internal
@@ -111,33 +111,33 @@ export declare interface AuthBoundaryProps {
111
111
  * Receives all props. Defaults to {@link Login}.
112
112
  */
113
113
  LoginComponent?: React.ComponentType<{
114
- header?: React.ReactNode
115
- footer?: React.ReactNode
116
- }>
114
+ header?: React.ReactNode;
115
+ footer?: React.ReactNode;
116
+ }>;
117
117
  /**
118
118
  * Custom component to render during OAuth callback processing.
119
119
  * Receives all props. Defaults to {@link LoginCallback}.
120
120
  */
121
121
  CallbackComponent?: React.ComponentType<{
122
- header?: React.ReactNode
123
- footer?: React.ReactNode
124
- }>
122
+ header?: React.ReactNode;
123
+ footer?: React.ReactNode;
124
+ }>;
125
125
  /**
126
126
  * Custom component to render when authentication errors occur.
127
127
  * Receives error boundary props and layout props. Defaults to
128
128
  * {@link LoginError}
129
129
  */
130
- LoginErrorComponent?: React.ComponentType<LoginErrorProps>
130
+ LoginErrorComponent?: React.ComponentType<LoginErrorProps>;
131
131
  /** Header content to display */
132
- header?: React.ReactNode
132
+ header?: React.ReactNode;
133
133
  /**
134
134
  * The project IDs to use for organization verification.
135
135
  */
136
- projectIds?: string[]
136
+ projectIds?: string[];
137
137
  /** Footer content to display */
138
- footer?: React.ReactNode
138
+ footer?: React.ReactNode;
139
139
  /** Protected content to render when authenticated */
140
- children?: React.ReactNode
140
+ children?: React.ReactNode;
141
141
  /**
142
142
  * Whether to verify that the project belongs to the organization specified in the dashboard context.
143
143
  * By default, organization verification is enabled when running in a dashboard context.
@@ -145,41 +145,57 @@ export declare interface AuthBoundaryProps {
145
145
  * WARNING: Disabling organization verification is NOT RECOMMENDED and may cause your application
146
146
  * to break in the future. This should never be disabled in production environments.
147
147
  */
148
- verifyOrganization?: boolean
148
+ verifyOrganization?: boolean;
149
149
  }
150
150
 
151
151
  /**
152
152
  * @public
153
153
  */
154
- export declare type ComlinkStatus = 'idle' | 'handshaking' | 'connected' | 'disconnected'
154
+ export declare type ComlinkStatus =
155
+ | "idle"
156
+ | "handshaking"
157
+ | "connected"
158
+ | "disconnected";
155
159
 
156
160
  /**
157
161
  * This provider is used to provide the Comlink token refresh feature.
158
162
  * It is used to automatically request a new token on 401 error if enabled.
159
163
  * @public
160
164
  */
161
- export declare const ComlinkTokenRefreshProvider: React_2.FC<PropsWithChildren>
165
+ export declare const ComlinkTokenRefreshProvider: React_2.FC<PropsWithChildren>;
166
+
167
+ /**
168
+ * Optional per-call overrides for {@link useCreateDocument}'s create function.
169
+ * @public
170
+ */
171
+ export declare interface CreateDocumentOverrides {
172
+ /**
173
+ * Use this document ID instead of generating one. Overrides any `documentId`
174
+ * supplied on the handle passed to `useCreateDocument`.
175
+ */
176
+ documentId?: string;
177
+ }
162
178
 
163
179
  declare interface DashboardResource {
164
- id: string
165
- name: string
166
- title: string
167
- basePath: string
168
- projectId: string
169
- dataset: string
170
- type: string
171
- userApplicationId: string
172
- url: string
180
+ id: string;
181
+ name: string;
182
+ title: string;
183
+ basePath: string;
184
+ projectId: string;
185
+ dataset: string;
186
+ type: string;
187
+ userApplicationId: string;
188
+ url: string;
173
189
  }
174
190
 
175
- export {DatasetsResponse}
191
+ export { DatasetsResponse };
176
192
 
177
193
  /**
178
194
  * Return type for the useDispatchIntent hook
179
195
  * @beta
180
196
  */
181
197
  declare interface DispatchIntent {
182
- dispatchIntent: () => void
198
+ dispatchIntent: () => void;
183
199
  }
184
200
 
185
201
  /**
@@ -195,11 +211,11 @@ export declare interface DocumentHandle<
195
211
  TDataset extends string = string,
196
212
  TProjectId extends string = string,
197
213
  > extends DocumentHandle_2<TDocumentType, TDataset, TProjectId> {
198
- resourceName?: string
214
+ resourceName?: string;
199
215
  }
200
216
 
201
217
  declare interface DocumentInteractionHistory {
202
- recordEvent: (eventType: 'viewed' | 'edited' | 'created' | 'deleted') => void
218
+ recordEvent: (eventType: "viewed" | "edited" | "created" | "deleted") => void;
203
219
  }
204
220
 
205
221
  /**
@@ -213,28 +229,30 @@ export declare interface DocumentsOptions<
213
229
  TDataset extends string = string,
214
230
  TProjectId extends string = string,
215
231
  >
216
- extends ResourceHandle<TDataset, TProjectId>, Pick<QueryOptions, 'perspective' | 'params'> {
232
+ extends
233
+ ResourceHandle<TDataset, TProjectId>,
234
+ Pick<QueryOptions, "perspective" | "params"> {
217
235
  /**
218
236
  * Filter documents by their `_type`. Can be a single type or an array of types.
219
237
  */
220
- documentType?: TDocumentType | TDocumentType[]
238
+ documentType?: TDocumentType | TDocumentType[];
221
239
  /**
222
240
  * GROQ filter expression to apply to the query
223
241
  */
224
- filter?: string
242
+ filter?: string;
225
243
  /**
226
244
  * Number of items to load per batch (defaults to 25)
227
245
  */
228
- batchSize?: number
246
+ batchSize?: number;
229
247
  /**
230
248
  * Sorting configuration for the results
231
249
  * @beta
232
250
  */
233
- orderings?: SortOrderingItem[]
251
+ orderings?: SortOrderingItem[];
234
252
  /**
235
253
  * Text search query to filter results
236
254
  */
237
- search?: string
255
+ search?: string;
238
256
  }
239
257
 
240
258
  /**
@@ -251,23 +269,23 @@ export declare interface DocumentsResponse<
251
269
  /**
252
270
  * Array of document handles for the current batch
253
271
  */
254
- data: DocumentHandle_2<TDocumentType, TDataset, TProjectId>[]
272
+ data: DocumentHandle_2<TDocumentType, TDataset, TProjectId>[];
255
273
  /**
256
274
  * Whether there are more items available to load
257
275
  */
258
- hasMore: boolean
276
+ hasMore: boolean;
259
277
  /**
260
278
  * Total count of items matching the query
261
279
  */
262
- count: number
280
+ count: number;
263
281
  /**
264
282
  * Whether a query is currently in progress
265
283
  */
266
- isPending: boolean
284
+ isPending: boolean;
267
285
  /**
268
286
  * Function to load the next batch of results
269
287
  */
270
- loadMore: () => void
288
+ loadMore: () => void;
271
289
  }
272
290
 
273
291
  /**
@@ -279,62 +297,69 @@ export declare interface DocumentTypeHandle<
279
297
  TDataset extends string = string,
280
298
  TProjectId extends string = string,
281
299
  > extends DocumentTypeHandle_2<TDocumentType, TDataset, TProjectId> {
282
- resourceName?: string
300
+ resourceName?: string;
283
301
  }
284
302
 
285
303
  /**
286
304
  * @internal
287
305
  */
288
306
  export declare interface FrameConnection<TFrameMessage extends FrameMessage> {
289
- connect: (frameWindow: Window) => () => void
290
- sendMessage: <T extends TFrameMessage['type']>(
307
+ connect: (frameWindow: Window) => () => void;
308
+ sendMessage: <T extends TFrameMessage["type"]>(
291
309
  ...params: Extract<
292
310
  TFrameMessage,
293
311
  {
294
- type: T
312
+ type: T;
295
313
  }
296
- >['data'] extends undefined
314
+ >["data"] extends undefined
297
315
  ? [type: T]
298
316
  : [
299
317
  type: T,
300
318
  data: Extract<
301
319
  TFrameMessage,
302
320
  {
303
- type: T
321
+ type: T;
304
322
  }
305
- >['data'],
323
+ >["data"],
306
324
  ]
307
- ) => void
325
+ ) => void;
308
326
  }
309
327
 
328
+ declare type IgnoredKey =
329
+ | "_id"
330
+ | "_type"
331
+ | "_rev"
332
+ | "_createdAt"
333
+ | "_updatedAt";
334
+
310
335
  /**
311
336
  * @alpha
312
337
  */
313
- declare type LoginErrorProps = FallbackProps
338
+ declare type LoginErrorProps = FallbackProps;
314
339
 
315
340
  declare interface ManageFavorite extends FavoriteStatusResponse {
316
- favorite: () => Promise<void>
317
- unfavorite: () => Promise<void>
318
- isFavorited: boolean
341
+ favorite: () => Promise<void>;
342
+ unfavorite: () => Promise<void>;
343
+ isFavorited: boolean;
319
344
  }
320
345
 
321
346
  /**
322
347
  * @public
323
348
  */
324
- declare type MessageData = Record<string, unknown> | undefined
349
+ declare type MessageData = Record<string, unknown> | undefined;
325
350
 
326
351
  /**
327
352
  * @internal
328
353
  */
329
354
  export declare type MessageHandler<TWindowMessage extends WindowMessage> = (
330
- event: TWindowMessage['data'],
331
- ) => TWindowMessage['response'] | Promise<TWindowMessage['response']>
355
+ event: TWindowMessage["data"],
356
+ ) => TWindowMessage["response"] | Promise<TWindowMessage["response"]>;
332
357
 
333
358
  /** In-flight CLI PR is using named sources since it's aspirational.
334
359
  * We can transform the shape in this function until it's finalized.
335
360
  */
336
361
  declare interface NamedSources {
337
- [key: string]: SanityConfig
362
+ [key: string]: SanityConfig;
338
363
  }
339
364
 
340
365
  /**
@@ -342,13 +367,13 @@ declare interface NamedSources {
342
367
  * @category Types
343
368
  */
344
369
  export declare interface NavigateToStudioResult {
345
- navigateToStudioDocument: () => void
370
+ navigateToStudioDocument: () => void;
346
371
  }
347
372
 
348
373
  declare interface Observer<T> {
349
- next?: (value: T) => void
350
- error?: (err: unknown) => void
351
- complete?: () => void
374
+ next?: (value: T) => void;
375
+ error?: (err: unknown) => void;
376
+ complete?: () => void;
352
377
  }
353
378
 
354
379
  /**
@@ -362,26 +387,26 @@ export declare interface PaginatedDocumentsOptions<
362
387
  TDataset extends string = string,
363
388
  TProjectId extends string = string,
364
389
  > extends WithResourceNameSupport<
365
- Omit<QueryOptions<TDocumentType, TDataset, TProjectId>, 'query'>
390
+ Omit<QueryOptions<TDocumentType, TDataset, TProjectId>, "query">
366
391
  > {
367
- documentType?: TDocumentType | TDocumentType[]
392
+ documentType?: TDocumentType | TDocumentType[];
368
393
  /**
369
394
  * GROQ filter expression to apply to the query
370
395
  */
371
- filter?: string
396
+ filter?: string;
372
397
  /**
373
398
  * Number of items to display per page (defaults to 25)
374
399
  */
375
- pageSize?: number
400
+ pageSize?: number;
376
401
  /**
377
402
  * Sorting configuration for the results
378
403
  * @beta
379
404
  */
380
- orderings?: SortOrderingItem[]
405
+ orderings?: SortOrderingItem[];
381
406
  /**
382
407
  * Text search query to filter results
383
408
  */
384
- search?: string
409
+ search?: string;
385
410
  }
386
411
 
387
412
  /**
@@ -398,72 +423,72 @@ export declare interface PaginatedDocumentsResponse<
398
423
  /**
399
424
  * Array of document handles for the current page
400
425
  */
401
- data: DocumentHandle_2<TDocumentType, TDataset, TProjectId>[]
426
+ data: DocumentHandle_2<TDocumentType, TDataset, TProjectId>[];
402
427
  /**
403
428
  * Whether a query is currently in progress
404
429
  */
405
- isPending: boolean
430
+ isPending: boolean;
406
431
  /**
407
432
  * Number of items displayed per page
408
433
  */
409
- pageSize: number
434
+ pageSize: number;
410
435
  /**
411
436
  * Current page number (1-indexed)
412
437
  */
413
- currentPage: number
438
+ currentPage: number;
414
439
  /**
415
440
  * Total number of pages available
416
441
  */
417
- totalPages: number
442
+ totalPages: number;
418
443
  /**
419
444
  * Starting index of the current page (0-indexed)
420
445
  */
421
- startIndex: number
446
+ startIndex: number;
422
447
  /**
423
448
  * Ending index of the current page (exclusive, 0-indexed)
424
449
  */
425
- endIndex: number
450
+ endIndex: number;
426
451
  /**
427
452
  * Total count of items matching the query
428
453
  */
429
- count: number
454
+ count: number;
430
455
  /**
431
456
  * Navigate to the first page
432
457
  */
433
- firstPage: () => void
458
+ firstPage: () => void;
434
459
  /**
435
460
  * Whether there is a first page available to navigate to
436
461
  */
437
- hasFirstPage: boolean
462
+ hasFirstPage: boolean;
438
463
  /**
439
464
  * Navigate to the previous page
440
465
  */
441
- previousPage: () => void
466
+ previousPage: () => void;
442
467
  /**
443
468
  * Whether there is a previous page available to navigate to
444
469
  */
445
- hasPreviousPage: boolean
470
+ hasPreviousPage: boolean;
446
471
  /**
447
472
  * Navigate to the next page
448
473
  */
449
- nextPage: () => void
474
+ nextPage: () => void;
450
475
  /**
451
476
  * Whether there is a next page available to navigate to
452
477
  */
453
- hasNextPage: boolean
478
+ hasNextPage: boolean;
454
479
  /**
455
480
  * Navigate to the last page
456
481
  */
457
- lastPage: () => void
482
+ lastPage: () => void;
458
483
  /**
459
484
  * Whether there is a last page available to navigate to
460
485
  */
461
- hasLastPage: boolean
486
+ hasLastPage: boolean;
462
487
  /**
463
488
  * Navigate to a specific page number
464
489
  * @param pageNumber - The page number to navigate to (1-indexed)
465
490
  */
466
- goToPage: (pageNumber: number) => void
491
+ goToPage: (pageNumber: number) => void;
467
492
  }
468
493
 
469
494
  /**
@@ -472,13 +497,13 @@ export declare interface PaginatedDocumentsResponse<
472
497
  * @interface
473
498
  * @deprecated use the Project type directly.
474
499
  */
475
- export declare type ProjectWithoutMembers = Project
500
+ export declare type ProjectWithoutMembers = Project;
476
501
 
477
502
  /**
478
503
  * This version is provided by pkg-utils at build time
479
504
  * @internal
480
505
  */
481
- export declare const REACT_SDK_VERSION: {}
506
+ export declare const REACT_SDK_VERSION: {};
482
507
 
483
508
  /** @internal */
484
509
  export declare function renderSanityApp(
@@ -486,10 +511,10 @@ export declare function renderSanityApp(
486
511
  namedSources: NamedSources,
487
512
  options: RenderSanitySDKAppOptions,
488
513
  children: React.ReactNode,
489
- ): () => void
514
+ ): () => void;
490
515
 
491
516
  declare interface RenderSanitySDKAppOptions {
492
- reactStrictMode?: boolean
517
+ reactStrictMode?: boolean;
493
518
  }
494
519
 
495
520
  /**
@@ -511,7 +536,7 @@ export declare interface ResourceHandle<
511
536
  * Name of a resource registered via the `resources` prop on `<SanityApp>`.
512
537
  * Resolved to a `DocumentResource` at the React layer.
513
538
  */
514
- resourceName?: string
539
+ resourceName?: string;
515
540
  }
516
541
 
517
542
  /**
@@ -534,7 +559,7 @@ export declare function ResourceProvider({
534
559
  fallback,
535
560
  resource,
536
561
  ...config
537
- }: ResourceProviderProps): React.ReactNode
562
+ }: ResourceProviderProps): React.ReactNode;
538
563
 
539
564
  /**
540
565
  * Props for the ResourceProvider component
@@ -546,13 +571,13 @@ export declare interface ResourceProviderProps extends SanityConfig {
546
571
  * for this subtree. Hooks that don't specify an explicit resource will
547
572
  * use this value.
548
573
  */
549
- resource?: DocumentResource
574
+ resource?: DocumentResource;
550
575
  /**
551
576
  * React node to show while content is loading.
552
577
  * Used as the fallback for the internal Suspense boundary.
553
578
  */
554
- fallback: React.ReactNode
555
- children: React.ReactNode
579
+ fallback: React.ReactNode;
580
+ children: React.ReactNode;
556
581
  }
557
582
 
558
583
  /**
@@ -624,7 +649,7 @@ export declare function SanityApp({
624
649
  fallback,
625
650
  config: configProp,
626
651
  ...props
627
- }: SanityAppProps): ReactElement
652
+ }: SanityAppProps): ReactElement;
628
653
 
629
654
  /**
630
655
  * @public
@@ -637,15 +662,15 @@ export declare interface SanityAppProps {
637
662
  * (e.g. inside Sanity Studio) — the config is derived from the workspace
638
663
  * automatically.
639
664
  */
640
- config?: SanityConfig | SanityConfig[]
665
+ config?: SanityConfig | SanityConfig[];
641
666
  /** @deprecated use the `config` prop instead. */
642
- sanityConfigs?: SanityConfig[]
643
- resources?: Record<string, DocumentResource>
644
- children: React.ReactNode
645
- fallback: React.ReactNode
667
+ sanityConfigs?: SanityConfig[];
668
+ resources?: Record<string, DocumentResource>;
669
+ children: React.ReactNode;
670
+ fallback: React.ReactNode;
646
671
  }
647
672
 
648
- export {SanityDocument}
673
+ export { SanityDocument };
649
674
 
650
675
  /**
651
676
  * Provides an externally-created Sanity instance to child components through React Context.
@@ -687,7 +712,7 @@ export declare function SanityInstanceProvider({
687
712
  instance,
688
713
  fallback,
689
714
  children,
690
- }: SanityInstanceProviderProps): React.ReactNode
715
+ }: SanityInstanceProviderProps): React.ReactNode;
691
716
 
692
717
  /**
693
718
  * Props for the SanityInstanceProvider component
@@ -699,16 +724,16 @@ export declare interface SanityInstanceProviderProps {
699
724
  * The caller owns the instance lifecycle — SanityInstanceProvider
700
725
  * will not dispose it on unmount.
701
726
  */
702
- instance: SanityInstance
727
+ instance: SanityInstance;
703
728
  /**
704
729
  * React node to show while content is loading.
705
730
  * Used as the fallback for the internal Suspense boundary.
706
731
  */
707
- fallback: React.ReactNode
708
- children: React.ReactNode
732
+ fallback: React.ReactNode;
733
+ children: React.ReactNode;
709
734
  }
710
735
 
711
- export {SanityProjectMember}
736
+ export { SanityProjectMember };
712
737
 
713
738
  /**
714
739
  * @internal
@@ -720,16 +745,16 @@ export declare function SDKProvider({
720
745
  config,
721
746
  fallback,
722
747
  ...props
723
- }: SDKProviderProps): ReactElement
748
+ }: SDKProviderProps): ReactElement;
724
749
 
725
750
  /**
726
751
  * @internal
727
752
  */
728
753
  export declare interface SDKProviderProps extends AuthBoundaryProps {
729
- children: ReactNode
730
- config: SanityConfig | SanityConfig[]
731
- fallback: ReactNode
732
- resources?: Record<string, DocumentResource>
754
+ children: ReactNode;
755
+ config: SanityConfig | SanityConfig[];
756
+ fallback: ReactNode;
757
+ resources?: Record<string, DocumentResource>;
733
758
  }
734
759
 
735
760
  /**
@@ -766,9 +791,9 @@ export declare interface SDKProviderProps extends AuthBoundaryProps {
766
791
  *
767
792
  * @public
768
793
  */
769
- export declare const SDKStudioContext: Context<StudioWorkspaceHandle | null>
794
+ export declare const SDKStudioContext: Context<StudioWorkspaceHandle | null>;
770
795
 
771
- export {SortOrderingItem}
796
+ export { SortOrderingItem };
772
797
 
773
798
  /**
774
799
  * Minimal duck-typed interface representing a Sanity Studio workspace.
@@ -779,15 +804,15 @@ export {SortOrderingItem}
779
804
  */
780
805
  export declare interface StudioWorkspaceHandle {
781
806
  /** The Sanity project ID for this workspace. */
782
- projectId: string
807
+ projectId: string;
783
808
  /** The dataset name for this workspace. */
784
- dataset: string
809
+ dataset: string;
785
810
  /**
786
811
  * Whether the Studio has determined the user is authenticated.
787
812
  * When `true` and the token source emits `null`, the SDK infers
788
813
  * cookie-based auth is in use and skips the logged-out state.
789
814
  */
790
- authenticated?: boolean
815
+ authenticated?: boolean;
791
816
  /** Authentication state for this workspace. */
792
817
  auth: {
793
818
  /**
@@ -798,29 +823,29 @@ export declare interface StudioWorkspaceHandle {
798
823
  * Optional because Studios before Aug 2022 may not expose it. When
799
824
  * absent, the SDK falls back to localStorage/cookie discovery.
800
825
  */
801
- token?: TokenSource
802
- }
826
+ token?: TokenSource;
827
+ };
803
828
  }
804
829
 
805
830
  declare interface StudioWorkspacesResult {
806
- workspacesByProjectIdAndDataset: WorkspacesByProjectIdDataset
807
- error: string | null
831
+ workspacesByProjectIdAndDataset: WorkspacesByProjectIdDataset;
832
+ error: string | null;
808
833
  }
809
834
 
810
835
  declare interface Subscribable<T> {
811
- subscribe(observer: Observer<T>): Subscription
836
+ subscribe(observer: Observer<T>): Subscription;
812
837
  subscribe(
813
838
  next: (value: T) => void,
814
839
  error?: (err: unknown) => void,
815
840
  complete?: () => void,
816
- ): Subscription
841
+ ): Subscription;
817
842
  }
818
843
 
819
844
  declare interface Subscription {
820
- unsubscribe(): void
845
+ unsubscribe(): void;
821
846
  }
822
847
 
823
- declare type Updater<TValue> = TValue | ((currentValue: TValue) => TValue)
848
+ declare type Updater<TValue> = TValue | ((currentValue: TValue) => TValue);
824
849
 
825
850
  /**
826
851
  * @public
@@ -840,7 +865,7 @@ declare type Updater<TValue> = TValue | ((currentValue: TValue) => TValue)
840
865
  */
841
866
  export declare function useActiveReleases(
842
867
  options?: WithResourceNameSupport<SanityConfig> | undefined,
843
- ): ReleaseDocument[]
868
+ ): ReleaseDocument[];
844
869
 
845
870
  /**
846
871
  * @alpha
@@ -911,7 +936,7 @@ export declare function useActiveReleases(
911
936
  */
912
937
  export declare function useAgentGenerate(
913
938
  resourceHandle?: ResourceHandle,
914
- ): (options: AgentGenerateOptions) => Subscribable<unknown>
939
+ ): (options: AgentGenerateOptions) => Subscribable<unknown>;
915
940
 
916
941
  /**
917
942
  * @alpha
@@ -1064,7 +1089,7 @@ export declare function useAgentGenerate(
1064
1089
  */
1065
1090
  export declare function useAgentPatch(
1066
1091
  resourceHandle?: ResourceHandle,
1067
- ): (options: AgentPatchOptions) => Promise<AgentPatchResult>
1092
+ ): (options: AgentPatchOptions) => Promise<AgentPatchResult>;
1068
1093
 
1069
1094
  /**
1070
1095
  * @alpha
@@ -1162,7 +1187,7 @@ export declare function useAgentPatch(
1162
1187
  */
1163
1188
  export declare function useAgentPrompt(
1164
1189
  resourceHandle?: ResourceHandle,
1165
- ): (options: AgentPromptOptions) => Promise<AgentPromptResult>
1190
+ ): (options: AgentPromptOptions) => Promise<AgentPromptResult>;
1166
1191
 
1167
1192
  /**
1168
1193
  * @public
@@ -1194,7 +1219,9 @@ export declare function useAgentPrompt(
1194
1219
  * }
1195
1220
  * ```
1196
1221
  */
1197
- export declare function useAgentResourceContext(options: AgentResourceContextOptions): void
1222
+ export declare function useAgentResourceContext(
1223
+ options: AgentResourceContextOptions,
1224
+ ): void;
1198
1225
 
1199
1226
  /**
1200
1227
  * @alpha
@@ -1269,7 +1296,7 @@ export declare function useAgentResourceContext(options: AgentResourceContextOpt
1269
1296
  */
1270
1297
  export declare function useAgentTransform(
1271
1298
  resourceHandle?: ResourceHandle,
1272
- ): (options: AgentTransformOptions) => Subscribable<unknown>
1299
+ ): (options: AgentTransformOptions) => Subscribable<unknown>;
1273
1300
 
1274
1301
  /**
1275
1302
  * @alpha
@@ -1363,7 +1390,7 @@ export declare function useAgentTransform(
1363
1390
  */
1364
1391
  export declare function useAgentTranslate(
1365
1392
  resourceHandle?: ResourceHandle,
1366
- ): (options: AgentTranslateOptions) => Subscribable<unknown>
1393
+ ): (options: AgentTranslateOptions) => Subscribable<unknown>;
1367
1394
 
1368
1395
  /**
1369
1396
  * @public
@@ -1392,7 +1419,7 @@ export declare function useAgentTranslate(
1392
1419
  */
1393
1420
  export declare function useAllReleases(
1394
1421
  options?: WithResourceNameSupport<SanityConfig> | undefined,
1395
- ): ReleaseDocument[]
1422
+ ): ReleaseDocument[];
1396
1423
 
1397
1424
  /**
1398
1425
  * @public
@@ -1407,7 +1434,9 @@ declare interface UseApplyDocumentActions {
1407
1434
  | DocumentAction<TDocumentType, TDataset, TProjectId>
1408
1435
  | DocumentAction<TDocumentType, TDataset, TProjectId>[],
1409
1436
  options?: ResourceHandle,
1410
- ) => Promise<ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>>
1437
+ ) => Promise<
1438
+ ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>
1439
+ >;
1411
1440
  }
1412
1441
 
1413
1442
  /**
@@ -1593,13 +1622,16 @@ declare interface UseApplyDocumentActions {
1593
1622
  * }
1594
1623
  * ```
1595
1624
  */
1596
- export declare const useApplyDocumentActions: UseApplyDocumentActions
1625
+ export declare const useApplyDocumentActions: UseApplyDocumentActions;
1597
1626
 
1598
1627
  /**
1599
1628
  * @public
1600
1629
  */
1601
1630
  declare interface UseApplyReleaseActions {
1602
- (): (action: ReleaseAction | ReleaseAction[], options?: ResourceHandle) => Promise<ActionsResult>
1631
+ (): (
1632
+ action: ReleaseAction | ReleaseAction[],
1633
+ options?: ResourceHandle,
1634
+ ) => Promise<ActionsResult>;
1603
1635
  }
1604
1636
 
1605
1637
  /**
@@ -1669,7 +1701,7 @@ declare interface UseApplyReleaseActions {
1669
1701
  * }
1670
1702
  * ```
1671
1703
  */
1672
- export declare const useApplyReleaseActions: UseApplyReleaseActions
1704
+ export declare const useApplyReleaseActions: UseApplyReleaseActions;
1673
1705
 
1674
1706
  /**
1675
1707
  * @internal
@@ -1692,14 +1724,14 @@ export declare const useApplyReleaseActions: UseApplyReleaseActions
1692
1724
  * }
1693
1725
  * ```
1694
1726
  */
1695
- export declare const useAuthState: () => AuthState
1727
+ export declare const useAuthState: () => AuthState;
1696
1728
 
1697
1729
  /**
1698
1730
  * Hook to get the currently logged in user
1699
1731
  * @internal
1700
1732
  * @returns The current user or null if not authenticated
1701
1733
  */
1702
- export declare const useAuthToken: () => string | null
1734
+ export declare const useAuthToken: () => string | null;
1703
1735
 
1704
1736
  /**
1705
1737
  * A React hook that provides a client that subscribes to changes in your application,
@@ -1728,7 +1760,48 @@ export declare const useAuthToken: () => string | null
1728
1760
  * @public
1729
1761
  * @function
1730
1762
  */
1731
- export declare const useClient: (options: ClientOptions) => SanityClient
1763
+ export declare const useClient: (options: ClientOptions) => SanityClient;
1764
+
1765
+ /**
1766
+ * @public
1767
+ * Create a new document, relying on Typegen for the initial-value type.
1768
+ *
1769
+ * @param options - A document-type handle including `documentType`, an optional `documentId`, and optionally `projectId`/`dataset`/`perspective`.
1770
+ * @returns A function that creates the document. It accepts optional initial field values and an optional `{documentId}` override,
1771
+ * and resolves to the {@link DocumentHandle} of the created document (carrying the generated or supplied id).
1772
+ */
1773
+ export declare function useCreateDocument<
1774
+ TDocumentType extends string = string,
1775
+ TDataset extends string = string,
1776
+ TProjectId extends string = string,
1777
+ >(
1778
+ options: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>,
1779
+ ): (
1780
+ initialValue?: Partial<
1781
+ Omit<
1782
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>,
1783
+ IgnoredKey
1784
+ >
1785
+ >,
1786
+ overrides?: CreateDocumentOverrides,
1787
+ ) => Promise<DocumentHandle<TDocumentType, TDataset, TProjectId>>;
1788
+
1789
+ /**
1790
+ * @public
1791
+ * Create a new document with an explicit type `TData`.
1792
+ *
1793
+ * @param options - A document-type handle including `documentType` and optionally `projectId`/`dataset`/`perspective`.
1794
+ * @returns A function that creates the document. It accepts optional initial field values (typed against `TData`) and an
1795
+ * optional `{documentId}` override, and resolves to the {@link DocumentHandle} of the created document.
1796
+ */
1797
+ export declare function useCreateDocument<
1798
+ TData extends Record<string, unknown>,
1799
+ >(
1800
+ options: DocumentTypeHandle,
1801
+ ): (
1802
+ initialValue?: Partial<Omit<TData, IgnoredKey>>,
1803
+ overrides?: CreateDocumentOverrides,
1804
+ ) => Promise<DocumentHandle>;
1732
1805
 
1733
1806
  declare type UseCurrentUser = {
1734
1807
  /**
@@ -1751,15 +1824,15 @@ declare type UseCurrentUser = {
1751
1824
  * )
1752
1825
  * ```
1753
1826
  */
1754
- (): CurrentUser | null
1755
- }
1827
+ (): CurrentUser | null;
1828
+ };
1756
1829
 
1757
1830
  /**
1758
1831
  * @public
1759
1832
  * @function
1760
1833
  * @TODO This should not return null — users of a custom app will always be authenticated via Core
1761
1834
  */
1762
- export declare const useCurrentUser: UseCurrentUser
1835
+ export declare const useCurrentUser: UseCurrentUser;
1763
1836
 
1764
1837
  /**
1765
1838
  * @public
@@ -1805,8 +1878,8 @@ export declare const useCurrentUser: UseCurrentUser
1805
1878
  * ```
1806
1879
  */
1807
1880
  export declare function useDashboardNavigate(
1808
- navigateFn: (options: PathChangeMessage['data']) => void,
1809
- ): void
1881
+ navigateFn: (options: PathChangeMessage["data"]) => void,
1882
+ ): void;
1810
1883
 
1811
1884
  /**
1812
1885
  * @public
@@ -1827,7 +1900,7 @@ export declare function useDashboardNavigate(
1827
1900
  * @category Dashboard
1828
1901
  * @returns The dashboard organization ID (string | undefined)
1829
1902
  */
1830
- export declare function useDashboardOrganizationId(): string | undefined
1903
+ export declare function useDashboardOrganizationId(): string | undefined;
1831
1904
 
1832
1905
  declare type UseDatasets = {
1833
1906
  /**
@@ -1851,14 +1924,14 @@ declare type UseDatasets = {
1851
1924
  * ```
1852
1925
  *
1853
1926
  */
1854
- (): DatasetsResponse
1855
- }
1927
+ (): DatasetsResponse;
1928
+ };
1856
1929
 
1857
1930
  /**
1858
1931
  * @public
1859
1932
  * @function
1860
1933
  */
1861
- export declare const useDatasets: UseDatasets
1934
+ export declare const useDatasets: UseDatasets;
1862
1935
 
1863
1936
  /**
1864
1937
  * @beta
@@ -1911,26 +1984,32 @@ export declare const useDatasets: UseDatasets
1911
1984
  * }
1912
1985
  * ```
1913
1986
  */
1914
- export declare function useDispatchIntent(params: UseDispatchIntentParams): DispatchIntent
1987
+ export declare function useDispatchIntent(
1988
+ params: UseDispatchIntentParams,
1989
+ ): DispatchIntent;
1915
1990
 
1916
1991
  /**
1917
1992
  * Parameters for the useDispatchIntent hook
1918
1993
  * @beta
1919
1994
  */
1920
1995
  declare interface UseDispatchIntentParams {
1921
- action?: 'edit'
1922
- intentId?: string
1923
- documentHandle: DocumentHandle
1924
- parameters?: Record<string, unknown>
1996
+ action?: "edit";
1997
+ intentId?: string;
1998
+ documentHandle: DocumentHandle;
1999
+ parameters?: Record<string, unknown>;
1925
2000
  }
1926
2001
 
1927
2002
  declare interface UseDocument {
1928
2003
  /** @internal */
1929
- <TDocumentType extends string, TDataset extends string, TProjectId extends string = string>(
2004
+ <
2005
+ TDocumentType extends string,
2006
+ TDataset extends string,
2007
+ TProjectId extends string = string,
2008
+ >(
1930
2009
  options: UseDocumentOptions<undefined, TDocumentType, TDataset, TProjectId>,
1931
2010
  ): {
1932
- data: SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`> | null
1933
- }
2011
+ data: SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`> | null;
2012
+ };
1934
2013
  /** @internal */
1935
2014
  <
1936
2015
  TPath extends string,
@@ -1940,16 +2019,21 @@ declare interface UseDocument {
1940
2019
  >(
1941
2020
  options: UseDocumentOptions<TPath, TDocumentType>,
1942
2021
  ): {
1943
- data: JsonMatch<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>, TPath> | undefined
1944
- }
2022
+ data:
2023
+ | JsonMatch<
2024
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>,
2025
+ TPath
2026
+ >
2027
+ | undefined;
2028
+ };
1945
2029
  /** @internal */
1946
2030
  <TData>(options: DocumentOptions<undefined>): {
1947
- data: TData | null
1948
- }
2031
+ data: TData | null;
2032
+ };
1949
2033
  /** @internal */
1950
2034
  <TData>(options: DocumentOptions<string>): {
1951
- data: TData | undefined
1952
- }
2035
+ data: TData | undefined;
2036
+ };
1953
2037
  /**
1954
2038
  * ## useDocument via Type Inference (Recommended)
1955
2039
  *
@@ -2022,12 +2106,18 @@ declare interface UseDocument {
2022
2106
  ): TPath extends string
2023
2107
  ? {
2024
2108
  data:
2025
- | JsonMatch<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>, TPath>
2026
- | undefined
2109
+ | JsonMatch<
2110
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>,
2111
+ TPath
2112
+ >
2113
+ | undefined;
2027
2114
  }
2028
2115
  : {
2029
- data: SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`> | null
2030
- }
2116
+ data: SanityDocument_2<
2117
+ TDocumentType,
2118
+ `${TProjectId}.${TDataset}`
2119
+ > | null;
2120
+ };
2031
2121
  /**
2032
2122
  * @public
2033
2123
  *
@@ -2092,17 +2182,17 @@ declare interface UseDocument {
2092
2182
  options: UseDocumentOptions<TPath>,
2093
2183
  ): TPath extends string
2094
2184
  ? {
2095
- data: TData | undefined
2185
+ data: TData | undefined;
2096
2186
  }
2097
2187
  : {
2098
- data: TData | null
2099
- }
2188
+ data: TData | null;
2189
+ };
2100
2190
  /**
2101
2191
  * @internal
2102
2192
  */
2103
2193
  (options: UseDocumentOptions): {
2104
- data: unknown
2105
- }
2194
+ data: unknown;
2195
+ };
2106
2196
  }
2107
2197
 
2108
2198
  /**
@@ -2128,7 +2218,7 @@ declare interface UseDocument {
2128
2218
  *
2129
2219
  * @function
2130
2220
  */
2131
- export declare const useDocument: UseDocument
2221
+ export declare const useDocument: UseDocument;
2132
2222
 
2133
2223
  /**
2134
2224
  *
@@ -2188,7 +2278,7 @@ export declare const useDocument: UseDocument
2188
2278
  export declare function useDocumentEvent<
2189
2279
  TDataset extends string = string,
2190
2280
  TProjectId extends string = string,
2191
- >(options: UseDocumentEventOptions<TDataset, TProjectId>): void
2281
+ >(options: UseDocumentEventOptions<TDataset, TProjectId>): void;
2192
2282
 
2193
2283
  /**
2194
2284
  * @public
@@ -2197,7 +2287,7 @@ declare interface UseDocumentEventOptions<
2197
2287
  TDataset extends string = string,
2198
2288
  TProjectId extends string = string,
2199
2289
  > extends ResourceHandle<TDataset, TProjectId> {
2200
- onEvent: (documentEvent: DocumentEvent) => void
2290
+ onEvent: (documentEvent: DocumentEvent) => void;
2201
2291
  }
2202
2292
 
2203
2293
  declare type UseDocumentOptions<
@@ -2206,8 +2296,8 @@ declare type UseDocumentOptions<
2206
2296
  TDataset extends string = string,
2207
2297
  TProjectId extends string = string,
2208
2298
  > = DocumentHandle<TDocumentType, TDataset, TProjectId> & {
2209
- path?: TPath
2210
- }
2299
+ path?: TPath;
2300
+ };
2211
2301
 
2212
2302
  /**
2213
2303
  *
@@ -2290,7 +2380,7 @@ export declare function useDocumentPermissions(
2290
2380
  actionOrActions:
2291
2381
  | WithResourceNameSupport<DocumentAction>
2292
2382
  | WithResourceNameSupport<DocumentAction>[],
2293
- ): DocumentPermissionsResult
2383
+ ): DocumentPermissionsResult;
2294
2384
 
2295
2385
  /**
2296
2386
  * @public
@@ -2351,7 +2441,7 @@ export declare function useDocumentPermissions(
2351
2441
  export declare function useDocumentPreview({
2352
2442
  ref,
2353
2443
  ...docHandle
2354
- }: useDocumentPreviewOptions): useDocumentPreviewResults
2444
+ }: useDocumentPreviewOptions): useDocumentPreviewResults;
2355
2445
 
2356
2446
  /**
2357
2447
  * @public
@@ -2362,7 +2452,7 @@ export declare interface useDocumentPreviewOptions extends DocumentHandle {
2362
2452
  * Optional ref object to track visibility. When provided, preview resolution
2363
2453
  * only occurs when the referenced element is visible in the viewport.
2364
2454
  */
2365
- ref?: React.RefObject<unknown>
2455
+ ref?: React.RefObject<unknown>;
2366
2456
  }
2367
2457
 
2368
2458
  /**
@@ -2371,9 +2461,9 @@ export declare interface useDocumentPreviewOptions extends DocumentHandle {
2371
2461
  */
2372
2462
  export declare interface useDocumentPreviewResults {
2373
2463
  /** The results of inferring the document's preview values */
2374
- data: PreviewValue
2464
+ data: PreviewValue;
2375
2465
  /** True when inferred preview values are being refreshed */
2376
- isPending: boolean
2466
+ isPending: boolean;
2377
2467
  }
2378
2468
 
2379
2469
  /**
@@ -2455,10 +2545,19 @@ export declare function useDocumentProjection<
2455
2545
  TDataset extends string = string,
2456
2546
  TProjectId extends string = string,
2457
2547
  >(
2458
- options: useDocumentProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>,
2548
+ options: useDocumentProjectionOptions<
2549
+ TProjection,
2550
+ TDocumentType,
2551
+ TDataset,
2552
+ TProjectId
2553
+ >,
2459
2554
  ): useDocumentProjectionResults<
2460
- SanityProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>
2461
- >
2555
+ SanityProjectionResult<
2556
+ TProjection,
2557
+ TDocumentType,
2558
+ `${TProjectId}.${TDataset}`
2559
+ >
2560
+ >;
2462
2561
 
2463
2562
  /**
2464
2563
  * @public
@@ -2507,7 +2606,7 @@ export declare function useDocumentProjection<
2507
2606
  */
2508
2607
  export declare function useDocumentProjection<TData extends object>(
2509
2608
  options: useDocumentProjectionOptions,
2510
- ): useDocumentProjectionResults<TData>
2609
+ ): useDocumentProjectionResults<TData>;
2511
2610
 
2512
2611
  /**
2513
2612
  * @public
@@ -2520,11 +2619,11 @@ export declare interface useDocumentProjectionOptions<
2520
2619
  TProjectId extends string = string,
2521
2620
  > extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
2522
2621
  /** The GROQ projection string */
2523
- projection: TProjection
2622
+ projection: TProjection;
2524
2623
  /** Optional parameters for the projection query */
2525
- params?: Record<string, unknown>
2624
+ params?: Record<string, unknown>;
2526
2625
  /** Optional ref to track viewport intersection for lazy loading */
2527
- ref?: React.RefObject<unknown>
2626
+ ref?: React.RefObject<unknown>;
2528
2627
  }
2529
2628
 
2530
2629
  /**
@@ -2533,9 +2632,9 @@ export declare interface useDocumentProjectionOptions<
2533
2632
  */
2534
2633
  export declare interface useDocumentProjectionResults<TData> {
2535
2634
  /** The projected data */
2536
- data: TData
2635
+ data: TData;
2537
2636
  /** True if the projection is currently being resolved */
2538
- isPending: boolean
2637
+ isPending: boolean;
2539
2638
  }
2540
2639
 
2541
2640
  /**
@@ -2663,7 +2762,7 @@ export declare function useDocuments<
2663
2762
  TDocumentType,
2664
2763
  TDataset,
2665
2764
  TProjectId
2666
- >
2765
+ >;
2667
2766
 
2668
2767
  declare type UseDocumentSyncStatus = {
2669
2768
  /**
@@ -2698,14 +2797,14 @@ declare type UseDocumentSyncStatus = {
2698
2797
  * // <SyncIndicator doc={doc} />
2699
2798
  * ```
2700
2799
  */
2701
- (doc: DocumentHandle_2): boolean
2702
- }
2800
+ (doc: DocumentHandle_2): boolean;
2801
+ };
2703
2802
 
2704
2803
  /**
2705
2804
  * @public
2706
2805
  * @function
2707
2806
  */
2708
- export declare const useDocumentSyncStatus: UseDocumentSyncStatus
2807
+ export declare const useDocumentSyncStatus: UseDocumentSyncStatus;
2709
2808
 
2710
2809
  /**
2711
2810
  * @public
@@ -2722,8 +2821,12 @@ export declare function useEditDocument<
2722
2821
  >(
2723
2822
  options: DocumentOptions<undefined, TDocumentType, TDataset, TProjectId>,
2724
2823
  ): (
2725
- nextValue: Updater<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>,
2726
- ) => Promise<ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>>
2824
+ nextValue: Updater<
2825
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>
2826
+ >,
2827
+ ) => Promise<
2828
+ ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>
2829
+ >;
2727
2830
 
2728
2831
  /**
2729
2832
  * @public
@@ -2742,9 +2845,14 @@ export declare function useEditDocument<
2742
2845
  options: DocumentOptions<TPath, TDocumentType, TDataset, TProjectId>,
2743
2846
  ): (
2744
2847
  nextValue: Updater<
2745
- JsonMatch<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>, TPath>
2848
+ JsonMatch<
2849
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>,
2850
+ TPath
2851
+ >
2746
2852
  >,
2747
- ) => Promise<ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>>
2853
+ ) => Promise<
2854
+ ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>
2855
+ >;
2748
2856
 
2749
2857
  /**
2750
2858
  * @public
@@ -2756,7 +2864,7 @@ export declare function useEditDocument<
2756
2864
  */
2757
2865
  export declare function useEditDocument<TData>(
2758
2866
  options: DocumentOptions<undefined>,
2759
- ): (nextValue: Updater<TData>) => Promise<ActionsResult>
2867
+ ): (nextValue: Updater<TData>) => Promise<ActionsResult>;
2760
2868
 
2761
2869
  /**
2762
2870
  * @public
@@ -2768,7 +2876,7 @@ export declare function useEditDocument<TData>(
2768
2876
  */
2769
2877
  export declare function useEditDocument<TData>(
2770
2878
  options: DocumentOptions<string>,
2771
- ): (nextValue: Updater<TData>) => Promise<ActionsResult>
2879
+ ): (nextValue: Updater<TData>) => Promise<ActionsResult>;
2772
2880
 
2773
2881
  /**
2774
2882
  * @internal
@@ -2776,27 +2884,31 @@ export declare function useEditDocument<TData>(
2776
2884
  export declare function useFrameConnection<
2777
2885
  TFrameMessage extends FrameMessage,
2778
2886
  TWindowMessage extends WindowMessage,
2779
- >(options: UseFrameConnectionOptions<TWindowMessage>): FrameConnection<TFrameMessage>
2887
+ >(
2888
+ options: UseFrameConnectionOptions<TWindowMessage>,
2889
+ ): FrameConnection<TFrameMessage>;
2780
2890
 
2781
2891
  /**
2782
2892
  * @internal
2783
2893
  */
2784
- export declare interface UseFrameConnectionOptions<TWindowMessage extends WindowMessage> {
2785
- name: string
2786
- connectTo: string
2787
- targetOrigin: string
2894
+ export declare interface UseFrameConnectionOptions<
2895
+ TWindowMessage extends WindowMessage,
2896
+ > {
2897
+ name: string;
2898
+ connectTo: string;
2899
+ targetOrigin: string;
2788
2900
  onMessage?: {
2789
- [K in TWindowMessage['type']]: (
2901
+ [K in TWindowMessage["type"]]: (
2790
2902
  data: Extract<
2791
2903
  TWindowMessage,
2792
2904
  {
2793
- type: K
2905
+ type: K;
2794
2906
  }
2795
- >['data'],
2796
- ) => void
2797
- }
2798
- heartbeat?: boolean
2799
- onStatus?: (status: ComlinkStatus) => void
2907
+ >["data"],
2908
+ ) => void;
2909
+ };
2910
+ heartbeat?: boolean;
2911
+ onStatus?: (status: ComlinkStatus) => void;
2800
2912
  }
2801
2913
 
2802
2914
  /**
@@ -2841,19 +2953,19 @@ export declare interface UseFrameConnectionOptions<TWindowMessage extends Window
2841
2953
  */
2842
2954
  export declare const useHandleAuthCallback: () => (
2843
2955
  locationHref?: string | undefined,
2844
- ) => Promise<string | false>
2956
+ ) => Promise<string | false>;
2845
2957
 
2846
2958
  /**
2847
2959
  * @internal
2848
2960
  */
2849
- export declare function useLoginUrl(): string
2961
+ export declare function useLoginUrl(): string;
2850
2962
 
2851
2963
  /**
2852
2964
  * Hook to log out of the current session
2853
2965
  * @internal
2854
2966
  * @returns A function to log out of the current session
2855
2967
  */
2856
- export declare const useLogOut: () => () => Promise<void>
2968
+ export declare const useLogOut: () => () => Promise<void>;
2857
2969
 
2858
2970
  /**
2859
2971
  * @internal
@@ -2908,16 +3020,19 @@ export declare function useManageFavorite({
2908
3020
  resourceId: paramResourceId,
2909
3021
  resourceType,
2910
3022
  schemaName,
2911
- }: UseManageFavoriteProps): ManageFavorite
3023
+ }: UseManageFavoriteProps): ManageFavorite;
2912
3024
 
2913
3025
  declare interface UseManageFavoriteProps extends DocumentHandle_2 {
2914
- resourceId?: string
2915
- resourceType: StudioResource['type'] | MediaResource['type'] | CanvasResource['type']
3026
+ resourceId?: string;
3027
+ resourceType:
3028
+ | StudioResource["type"]
3029
+ | MediaResource["type"]
3030
+ | CanvasResource["type"];
2916
3031
  /**
2917
3032
  * The name of the schema collection this document belongs to.
2918
3033
  * Typically is the name of the workspace when used in the context of a studio.
2919
3034
  */
2920
- schemaName?: string
3035
+ schemaName?: string;
2921
3036
  }
2922
3037
 
2923
3038
  /**
@@ -2967,7 +3082,7 @@ declare interface UseManageFavoriteProps extends DocumentHandle_2 {
2967
3082
  export declare function useNavigateToStudioDocument(
2968
3083
  documentHandle: DocumentHandle_2,
2969
3084
  preferredStudioUrl?: string,
2970
- ): NavigateToStudioResult
3085
+ ): NavigateToStudioResult;
2971
3086
 
2972
3087
  /**
2973
3088
  * Returns metadata for a given organisation.
@@ -2997,7 +3112,7 @@ export declare const useOrganization: <
2997
3112
  IncludeFeatures extends boolean = false,
2998
3113
  >(
2999
3114
  options: OrganizationOptions<IncludeMembers, IncludeFeatures>,
3000
- ) => Organization<IncludeMembers, IncludeFeatures>
3115
+ ) => Organization<IncludeMembers, IncludeFeatures>;
3001
3116
 
3002
3117
  /**
3003
3118
  * Returns metadata for each organisation the current user has access to.
@@ -3032,7 +3147,7 @@ export declare const useOrganizations: <
3032
3147
  IncludeFeatures extends boolean = false,
3033
3148
  >(
3034
3149
  options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>,
3035
- ) => Organizations<IncludeMembers, IncludeFeatures>
3150
+ ) => Organizations<IncludeMembers, IncludeFeatures>;
3036
3151
 
3037
3152
  /**
3038
3153
  * Retrieves pages of {@link DocumentHandle}s, narrowed by optional filters, text searches, and custom ordering,
@@ -3141,25 +3256,27 @@ export declare function usePaginatedDocuments<
3141
3256
  orderings,
3142
3257
  search,
3143
3258
  ...rawOptions
3144
- }: PaginatedDocumentsOptions<TDocumentType, TDataset, TProjectId>): PaginatedDocumentsResponse<
3259
+ }: PaginatedDocumentsOptions<
3145
3260
  TDocumentType,
3146
3261
  TDataset,
3147
3262
  TProjectId
3148
- >
3263
+ >): PaginatedDocumentsResponse<TDocumentType, TDataset, TProjectId>;
3149
3264
 
3150
3265
  /**
3151
3266
  * @public
3152
3267
  * @function
3153
3268
  */
3154
- export declare function usePerspective(perspectiveHandle?: ResourceHandle): string | string[]
3269
+ export declare function usePerspective(
3270
+ perspectiveHandle?: ResourceHandle,
3271
+ ): string | string[];
3155
3272
 
3156
3273
  /**
3157
3274
  * A hook for subscribing to presence information for the current project or Canvas.
3158
3275
  * @public
3159
3276
  */
3160
3277
  export declare function usePresence(options?: ResourceHandle): {
3161
- locations: UserPresence[]
3162
- }
3278
+ locations: UserPresence[];
3279
+ };
3163
3280
 
3164
3281
  /**
3165
3282
  * Returns metadata for a given project.
@@ -3195,7 +3312,7 @@ export declare const useProject: <
3195
3312
  IncludeFeatures extends boolean = true,
3196
3313
  >(
3197
3314
  options?: ProjectOptions<IncludeMembers, IncludeFeatures>,
3198
- ) => Project<IncludeMembers, IncludeFeatures>
3315
+ ) => Project<IncludeMembers, IncludeFeatures>;
3199
3316
 
3200
3317
  /**
3201
3318
  * Returns metadata for each project you have access to.
@@ -3232,7 +3349,7 @@ export declare const useProjects: <
3232
3349
  IncludeFeatures extends boolean = true,
3233
3350
  >(
3234
3351
  options?: ProjectsOptions<IncludeMembers, IncludeFeatures>,
3235
- ) => Project<IncludeMembers, IncludeFeatures>[]
3352
+ ) => Project<IncludeMembers, IncludeFeatures>[];
3236
3353
 
3237
3354
  /**
3238
3355
  * @public
@@ -3297,10 +3414,10 @@ export declare function useQuery<
3297
3414
  options: UseQueryOptions<TQuery, TDataset, TProjectId>,
3298
3415
  ): {
3299
3416
  /** The query result, typed based on the GROQ query string */
3300
- data: SanityQueryResult<TQuery, `${TProjectId}.${TDataset}`>
3417
+ data: SanityQueryResult<TQuery, `${TProjectId}.${TDataset}`>;
3301
3418
  /** True if a query transition is in progress */
3302
- isPending: boolean
3303
- }
3419
+ isPending: boolean;
3420
+ };
3304
3421
 
3305
3422
  /**
3306
3423
  * @public
@@ -3330,12 +3447,14 @@ export declare function useQuery<
3330
3447
  * }
3331
3448
  * ```
3332
3449
  */
3333
- export declare function useQuery<TData>(options: WithResourceNameSupport<QueryOptions>): {
3450
+ export declare function useQuery<TData>(
3451
+ options: WithResourceNameSupport<QueryOptions>,
3452
+ ): {
3334
3453
  /** The query result, cast to the provided type TData */
3335
- data: TData
3454
+ data: TData;
3336
3455
  /** True if another query is resolving in the background (suspense handles the initial loading state) */
3337
- isPending: boolean
3338
- }
3456
+ isPending: boolean;
3457
+ };
3339
3458
 
3340
3459
  /**
3341
3460
  * Hook options for useQuery, supporting both direct resource and resourceName.
@@ -3345,7 +3464,7 @@ declare type UseQueryOptions<
3345
3464
  TQuery extends string = string,
3346
3465
  TDataset extends string = string,
3347
3466
  TProjectId extends string = string,
3348
- > = WithResourceNameSupport<QueryOptions<TQuery, TDataset, TProjectId>>
3467
+ > = WithResourceNameSupport<QueryOptions<TQuery, TDataset, TProjectId>>;
3349
3468
 
3350
3469
  /**
3351
3470
  * @internal
@@ -3394,19 +3513,22 @@ export declare function useRecordDocumentHistoryEvent({
3394
3513
  resourceType,
3395
3514
  resourceId,
3396
3515
  schemaName,
3397
- }: UseRecordDocumentHistoryEventProps): DocumentInteractionHistory
3516
+ }: UseRecordDocumentHistoryEventProps): DocumentInteractionHistory;
3398
3517
 
3399
3518
  /**
3400
3519
  * @internal
3401
3520
  */
3402
3521
  declare interface UseRecordDocumentHistoryEventProps extends DocumentHandle_2 {
3403
- resourceType: StudioResource['type'] | MediaResource['type'] | CanvasResource['type']
3404
- resourceId?: string
3522
+ resourceType:
3523
+ | StudioResource["type"]
3524
+ | MediaResource["type"]
3525
+ | CanvasResource["type"];
3526
+ resourceId?: string;
3405
3527
  /**
3406
3528
  * The name of the schema collection this document belongs to.
3407
3529
  * Typically is the name of the workspace when used in the context of a studio.
3408
3530
  */
3409
- schemaName?: string
3531
+ schemaName?: string;
3410
3532
  }
3411
3533
 
3412
3534
  /**
@@ -3426,7 +3548,7 @@ declare interface UseRecordDocumentHistoryEventProps extends DocumentHandle_2 {
3426
3548
  * console.log(resource?.projectId, resource?.dataset)
3427
3549
  * ```
3428
3550
  */
3429
- export declare function useResource(): DocumentResource | undefined
3551
+ export declare function useResource(): DocumentResource | undefined;
3430
3552
 
3431
3553
  /**
3432
3554
  * @public
@@ -3436,11 +3558,11 @@ export declare interface UserResult {
3436
3558
  /**
3437
3559
  * The user data fetched, or undefined if not found.
3438
3560
  */
3439
- data: SanityUser | undefined
3561
+ data: SanityUser | undefined;
3440
3562
  /**
3441
3563
  * Whether a user request is currently in progress
3442
3564
  */
3443
- isPending: boolean
3565
+ isPending: boolean;
3444
3566
  }
3445
3567
 
3446
3568
  /**
@@ -3451,19 +3573,19 @@ export declare interface UsersResult {
3451
3573
  /**
3452
3574
  * The users fetched.
3453
3575
  */
3454
- data: SanityUser[]
3576
+ data: SanityUser[];
3455
3577
  /**
3456
3578
  * Whether there are more users to fetch.
3457
3579
  */
3458
- hasMore: boolean
3580
+ hasMore: boolean;
3459
3581
  /**
3460
3582
  * Whether a users request is currently in progress
3461
3583
  */
3462
- isPending: boolean
3584
+ isPending: boolean;
3463
3585
  /**
3464
3586
  * Load more users.
3465
3587
  */
3466
- loadMore: () => void
3588
+ loadMore: () => void;
3467
3589
  }
3468
3590
 
3469
3591
  /**
@@ -3493,7 +3615,7 @@ export declare const useSanityInstance: (
3493
3615
  * Use `useSanityInstance()` without arguments instead.
3494
3616
  */
3495
3617
  config?: SanityConfig,
3496
- ) => SanityInstance
3618
+ ) => SanityInstance;
3497
3619
 
3498
3620
  /**
3499
3621
  * Hook that fetches studio workspaces and organizes them by projectId:dataset
@@ -3529,7 +3651,7 @@ export declare const useSanityInstance: (
3529
3651
  * }
3530
3652
  * ```
3531
3653
  */
3532
- export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspacesResult
3654
+ export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspacesResult;
3533
3655
 
3534
3656
  /**
3535
3657
  *
@@ -3563,7 +3685,7 @@ export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspace
3563
3685
  * )
3564
3686
  * ```
3565
3687
  */
3566
- export declare function useUser(options: GetUserOptions): UserResult
3688
+ export declare function useUser(options: GetUserOptions): UserResult;
3567
3689
 
3568
3690
  /**
3569
3691
  *
@@ -3597,7 +3719,7 @@ export declare function useUser(options: GetUserOptions): UserResult
3597
3719
  * )
3598
3720
  * ```
3599
3721
  */
3600
- export declare function useUsers(options?: GetUsersOptions): UsersResult
3722
+ export declare function useUsers(options?: GetUsersOptions): UsersResult;
3601
3723
 
3602
3724
  /**
3603
3725
  * Hook that verifies the current projects belongs to the organization ID specified in the dashboard context.
@@ -3622,7 +3744,7 @@ export declare function useUsers(options?: GetUsersOptions): UsersResult
3622
3744
  export declare function useVerifyOrgProjects(
3623
3745
  disabled?: boolean,
3624
3746
  projectIds?: string[],
3625
- ): string | null
3747
+ ): string | null;
3626
3748
 
3627
3749
  /**
3628
3750
  * @internal
@@ -3640,15 +3762,17 @@ export declare function useWindowConnection<
3640
3762
  name,
3641
3763
  connectTo,
3642
3764
  onMessage,
3643
- }: UseWindowConnectionOptions<TFrameMessage>): WindowConnection<TWindowMessage>
3765
+ }: UseWindowConnectionOptions<TFrameMessage>): WindowConnection<TWindowMessage>;
3644
3766
 
3645
3767
  /**
3646
3768
  * @internal
3647
3769
  */
3648
- export declare interface UseWindowConnectionOptions<TMessage extends FrameMessage> {
3649
- name: string
3650
- connectTo: string
3651
- onMessage?: Record<TMessage['type'], WindowMessageHandler<TMessage>>
3770
+ export declare interface UseWindowConnectionOptions<
3771
+ TMessage extends FrameMessage,
3772
+ > {
3773
+ name: string;
3774
+ connectTo: string;
3775
+ onMessage?: Record<TMessage["type"], WindowMessageHandler<TMessage>>;
3652
3776
  }
3653
3777
 
3654
3778
  /**
@@ -3690,38 +3814,38 @@ export declare interface UseWindowConnectionOptions<TMessage extends FrameMessag
3690
3814
  *
3691
3815
  * @public
3692
3816
  */
3693
- export declare function useWindowTitle(viewTitle?: string): void
3817
+ export declare function useWindowTitle(viewTitle?: string): void;
3694
3818
 
3695
3819
  /**
3696
3820
  * @internal
3697
3821
  */
3698
3822
  export declare interface WindowConnection<TMessage extends WindowMessage> {
3699
- sendMessage: <TType extends TMessage['type']>(
3823
+ sendMessage: <TType extends TMessage["type"]>(
3700
3824
  type: TType,
3701
3825
  data?: Extract<
3702
3826
  TMessage,
3703
3827
  {
3704
- type: TType
3828
+ type: TType;
3705
3829
  }
3706
- >['data'],
3707
- ) => void
3830
+ >["data"],
3831
+ ) => void;
3708
3832
  fetch: <TResponse>(
3709
3833
  type: string,
3710
3834
  data?: MessageData,
3711
3835
  options?: {
3712
- signal?: AbortSignal
3713
- suppressWarnings?: boolean
3714
- responseTimeout?: number
3836
+ signal?: AbortSignal;
3837
+ suppressWarnings?: boolean;
3838
+ responseTimeout?: number;
3715
3839
  },
3716
- ) => Promise<TResponse>
3840
+ ) => Promise<TResponse>;
3717
3841
  }
3718
3842
 
3719
3843
  /**
3720
3844
  * @internal
3721
3845
  */
3722
3846
  export declare type WindowMessageHandler<TFrameMessage extends FrameMessage> = (
3723
- event: TFrameMessage['data'],
3724
- ) => TFrameMessage['response']
3847
+ event: TFrameMessage["data"],
3848
+ ) => TFrameMessage["response"];
3725
3849
 
3726
3850
  /**
3727
3851
  * Adds React hook support (resourceName resolution) to core types.
@@ -3734,7 +3858,7 @@ export declare type WindowMessageHandler<TFrameMessage extends FrameMessage> = (
3734
3858
  */
3735
3859
  declare type WithResourceNameSupport<
3736
3860
  T extends {
3737
- resource?: DocumentResource
3861
+ resource?: DocumentResource;
3738
3862
  },
3739
3863
  > = T & {
3740
3864
  /**
@@ -3742,18 +3866,18 @@ declare type WithResourceNameSupport<
3742
3866
  * If provided, will be resolved to a `DocumentResource` via `ResourcesContext`.
3743
3867
  * @beta
3744
3868
  */
3745
- resourceName?: string
3869
+ resourceName?: string;
3746
3870
  /**
3747
3871
  * @deprecated Use `resourceName` instead.
3748
3872
  * @beta
3749
3873
  */
3750
- sourceName?: string
3751
- }
3874
+ sourceName?: string;
3875
+ };
3752
3876
 
3753
3877
  declare interface WorkspacesByProjectIdDataset {
3754
- [key: `${string}:${string}`]: DashboardResource[]
3878
+ [key: `${string}:${string}`]: DashboardResource[];
3755
3879
  }
3756
3880
 
3757
- export * from '@sanity/sdk'
3881
+ export * from "@sanity/sdk";
3758
3882
 
3759
- export {}
3883
+ export {};