@sanity/sdk-react 2.14.1 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +40 -30
  2. package/dist/index.d.ts +512 -335
  3. package/dist/index.js +540 -332
  4. package/dist/index.js.map +1 -1
  5. package/package.json +37 -39
  6. package/src/_exports/sdk-react.ts +1 -0
  7. package/src/components/SDKProvider.test.tsx +135 -22
  8. package/src/components/SDKProvider.tsx +54 -17
  9. package/src/components/SanityApp.tsx +29 -0
  10. package/src/components/auth/AuthBoundary.recovery.test.tsx +86 -0
  11. package/src/components/auth/AuthBoundary.tsx +11 -1
  12. package/src/context/OrganizationResourcesProvider.test.tsx +189 -0
  13. package/src/context/OrganizationResourcesProvider.tsx +111 -0
  14. package/src/context/ProjectContext.ts +15 -0
  15. package/src/context/ResourceProvider.test.tsx +57 -1
  16. package/src/context/ResourceProvider.tsx +30 -9
  17. package/src/hooks/datasets/useDatasets.test.tsx +116 -0
  18. package/src/hooks/datasets/useDatasets.ts +20 -8
  19. package/src/hooks/document/useApplyDocumentActions.ts +1 -1
  20. package/src/hooks/document/useCreateDocument.test.tsx +83 -0
  21. package/src/hooks/document/useCreateDocument.ts +117 -0
  22. package/src/hooks/document/useDocument.ts +2 -2
  23. package/src/hooks/helpers/useResolvedProjectId.test.tsx +59 -0
  24. package/src/hooks/helpers/useResolvedProjectId.ts +35 -0
  25. package/src/hooks/projects/useProject.test.tsx +114 -0
  26. package/src/hooks/projects/useProject.ts +17 -7
  27. package/src/hooks/users/useUsers.test.tsx +101 -2
  28. package/src/hooks/users/useUsers.ts +35 -3
  29. package/src/utils/resolveOrgResources.test.ts +111 -0
  30. package/src/utils/resolveOrgResources.ts +69 -0
  31. package/src/hooks/datasets/useDatasets.test.ts +0 -80
  32. package/src/hooks/projects/useProject.test.ts +0 -80
package/dist/index.d.ts CHANGED
@@ -1,62 +1,63 @@
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 { ProjectHandle } from "@sanity/sdk";
38
+ import { ProjectOptions } from "@sanity/sdk";
39
+ import { ProjectsOptions } from "@sanity/sdk";
40
+ import { PropsWithChildren } from "react";
41
+ import { QueryOptions } from "@sanity/sdk";
42
+ import { default as React_2 } from "react";
43
+ import { ReactElement } from "react";
44
+ import { ReactNode } from "react";
45
+ import { ReleaseAction } from "@sanity/sdk";
46
+ import { ReleaseDocument } from "@sanity/sdk";
47
+ import { SanityClient } from "@sanity/client";
48
+ import { SanityConfig } from "@sanity/sdk";
49
+ import { SanityDocument } from "@sanity/types";
50
+ import { SanityDocument as SanityDocument_2 } from "groq";
51
+ import { SanityInstance } from "@sanity/sdk";
52
+ import { SanityProjectionResult } from "groq";
53
+ import { SanityProjectMember } from "@sanity/client";
54
+ import { SanityQueryResult } from "groq";
55
+ import { SanityUser } from "@sanity/sdk";
56
+ import { SortOrderingItem } from "@sanity/types";
57
+ import { StudioResource } from "@sanity/message-protocol";
58
+ import { TokenSource } from "@sanity/sdk";
59
+ import { UserPresence } from "@sanity/sdk";
60
+ import { WindowMessage } from "@sanity/sdk";
60
61
 
61
62
  /**
62
63
  * @public
@@ -65,15 +66,15 @@ export declare interface AgentResourceContextOptions {
65
66
  /**
66
67
  * The project ID of the current context
67
68
  */
68
- projectId: string
69
+ projectId: string;
69
70
  /**
70
71
  * The dataset of the current context
71
72
  */
72
- dataset: string
73
+ dataset: string;
73
74
  /**
74
75
  * Optional document ID if the user is viewing/editing a specific document
75
76
  */
76
- documentId?: string
77
+ documentId?: string;
77
78
  }
78
79
 
79
80
  /**
@@ -100,7 +101,7 @@ export declare interface AgentResourceContextOptions {
100
101
  export declare function AuthBoundary({
101
102
  LoginErrorComponent,
102
103
  ...props
103
- }: AuthBoundaryProps): React.ReactNode
104
+ }: AuthBoundaryProps): React.ReactNode;
104
105
 
105
106
  /**
106
107
  * @internal
@@ -111,33 +112,33 @@ export declare interface AuthBoundaryProps {
111
112
  * Receives all props. Defaults to {@link Login}.
112
113
  */
113
114
  LoginComponent?: React.ComponentType<{
114
- header?: React.ReactNode
115
- footer?: React.ReactNode
116
- }>
115
+ header?: React.ReactNode;
116
+ footer?: React.ReactNode;
117
+ }>;
117
118
  /**
118
119
  * Custom component to render during OAuth callback processing.
119
120
  * Receives all props. Defaults to {@link LoginCallback}.
120
121
  */
121
122
  CallbackComponent?: React.ComponentType<{
122
- header?: React.ReactNode
123
- footer?: React.ReactNode
124
- }>
123
+ header?: React.ReactNode;
124
+ footer?: React.ReactNode;
125
+ }>;
125
126
  /**
126
127
  * Custom component to render when authentication errors occur.
127
128
  * Receives error boundary props and layout props. Defaults to
128
129
  * {@link LoginError}
129
130
  */
130
- LoginErrorComponent?: React.ComponentType<LoginErrorProps>
131
+ LoginErrorComponent?: React.ComponentType<LoginErrorProps>;
131
132
  /** Header content to display */
132
- header?: React.ReactNode
133
+ header?: React.ReactNode;
133
134
  /**
134
135
  * The project IDs to use for organization verification.
135
136
  */
136
- projectIds?: string[]
137
+ projectIds?: string[];
137
138
  /** Footer content to display */
138
- footer?: React.ReactNode
139
+ footer?: React.ReactNode;
139
140
  /** Protected content to render when authenticated */
140
- children?: React.ReactNode
141
+ children?: React.ReactNode;
141
142
  /**
142
143
  * Whether to verify that the project belongs to the organization specified in the dashboard context.
143
144
  * By default, organization verification is enabled when running in a dashboard context.
@@ -145,41 +146,57 @@ export declare interface AuthBoundaryProps {
145
146
  * WARNING: Disabling organization verification is NOT RECOMMENDED and may cause your application
146
147
  * to break in the future. This should never be disabled in production environments.
147
148
  */
148
- verifyOrganization?: boolean
149
+ verifyOrganization?: boolean;
149
150
  }
150
151
 
151
152
  /**
152
153
  * @public
153
154
  */
154
- export declare type ComlinkStatus = 'idle' | 'handshaking' | 'connected' | 'disconnected'
155
+ export declare type ComlinkStatus =
156
+ | "idle"
157
+ | "handshaking"
158
+ | "connected"
159
+ | "disconnected";
155
160
 
156
161
  /**
157
162
  * This provider is used to provide the Comlink token refresh feature.
158
163
  * It is used to automatically request a new token on 401 error if enabled.
159
164
  * @public
160
165
  */
161
- export declare const ComlinkTokenRefreshProvider: React_2.FC<PropsWithChildren>
166
+ export declare const ComlinkTokenRefreshProvider: React_2.FC<PropsWithChildren>;
167
+
168
+ /**
169
+ * Optional per-call overrides for {@link useCreateDocument}'s create function.
170
+ * @public
171
+ */
172
+ export declare interface CreateDocumentOverrides {
173
+ /**
174
+ * Use this document ID instead of generating one. Overrides any `documentId`
175
+ * supplied on the handle passed to `useCreateDocument`.
176
+ */
177
+ documentId?: string;
178
+ }
162
179
 
163
180
  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
181
+ id: string;
182
+ name: string;
183
+ title: string;
184
+ basePath: string;
185
+ projectId: string;
186
+ dataset: string;
187
+ type: string;
188
+ userApplicationId: string;
189
+ url: string;
173
190
  }
174
191
 
175
- export {DatasetsResponse}
192
+ export { DatasetsResponse };
176
193
 
177
194
  /**
178
195
  * Return type for the useDispatchIntent hook
179
196
  * @beta
180
197
  */
181
198
  declare interface DispatchIntent {
182
- dispatchIntent: () => void
199
+ dispatchIntent: () => void;
183
200
  }
184
201
 
185
202
  /**
@@ -195,11 +212,11 @@ export declare interface DocumentHandle<
195
212
  TDataset extends string = string,
196
213
  TProjectId extends string = string,
197
214
  > extends DocumentHandle_2<TDocumentType, TDataset, TProjectId> {
198
- resourceName?: string
215
+ resourceName?: string;
199
216
  }
200
217
 
201
218
  declare interface DocumentInteractionHistory {
202
- recordEvent: (eventType: 'viewed' | 'edited' | 'created' | 'deleted') => void
219
+ recordEvent: (eventType: "viewed" | "edited" | "created" | "deleted") => void;
203
220
  }
204
221
 
205
222
  /**
@@ -213,28 +230,30 @@ export declare interface DocumentsOptions<
213
230
  TDataset extends string = string,
214
231
  TProjectId extends string = string,
215
232
  >
216
- extends ResourceHandle<TDataset, TProjectId>, Pick<QueryOptions, 'perspective' | 'params'> {
233
+ extends
234
+ ResourceHandle<TDataset, TProjectId>,
235
+ Pick<QueryOptions, "perspective" | "params"> {
217
236
  /**
218
237
  * Filter documents by their `_type`. Can be a single type or an array of types.
219
238
  */
220
- documentType?: TDocumentType | TDocumentType[]
239
+ documentType?: TDocumentType | TDocumentType[];
221
240
  /**
222
241
  * GROQ filter expression to apply to the query
223
242
  */
224
- filter?: string
243
+ filter?: string;
225
244
  /**
226
245
  * Number of items to load per batch (defaults to 25)
227
246
  */
228
- batchSize?: number
247
+ batchSize?: number;
229
248
  /**
230
249
  * Sorting configuration for the results
231
250
  * @beta
232
251
  */
233
- orderings?: SortOrderingItem[]
252
+ orderings?: SortOrderingItem[];
234
253
  /**
235
254
  * Text search query to filter results
236
255
  */
237
- search?: string
256
+ search?: string;
238
257
  }
239
258
 
240
259
  /**
@@ -251,23 +270,23 @@ export declare interface DocumentsResponse<
251
270
  /**
252
271
  * Array of document handles for the current batch
253
272
  */
254
- data: DocumentHandle_2<TDocumentType, TDataset, TProjectId>[]
273
+ data: DocumentHandle_2<TDocumentType, TDataset, TProjectId>[];
255
274
  /**
256
275
  * Whether there are more items available to load
257
276
  */
258
- hasMore: boolean
277
+ hasMore: boolean;
259
278
  /**
260
279
  * Total count of items matching the query
261
280
  */
262
- count: number
281
+ count: number;
263
282
  /**
264
283
  * Whether a query is currently in progress
265
284
  */
266
- isPending: boolean
285
+ isPending: boolean;
267
286
  /**
268
287
  * Function to load the next batch of results
269
288
  */
270
- loadMore: () => void
289
+ loadMore: () => void;
271
290
  }
272
291
 
273
292
  /**
@@ -279,62 +298,69 @@ export declare interface DocumentTypeHandle<
279
298
  TDataset extends string = string,
280
299
  TProjectId extends string = string,
281
300
  > extends DocumentTypeHandle_2<TDocumentType, TDataset, TProjectId> {
282
- resourceName?: string
301
+ resourceName?: string;
283
302
  }
284
303
 
285
304
  /**
286
305
  * @internal
287
306
  */
288
307
  export declare interface FrameConnection<TFrameMessage extends FrameMessage> {
289
- connect: (frameWindow: Window) => () => void
290
- sendMessage: <T extends TFrameMessage['type']>(
308
+ connect: (frameWindow: Window) => () => void;
309
+ sendMessage: <T extends TFrameMessage["type"]>(
291
310
  ...params: Extract<
292
311
  TFrameMessage,
293
312
  {
294
- type: T
313
+ type: T;
295
314
  }
296
- >['data'] extends undefined
315
+ >["data"] extends undefined
297
316
  ? [type: T]
298
317
  : [
299
318
  type: T,
300
319
  data: Extract<
301
320
  TFrameMessage,
302
321
  {
303
- type: T
322
+ type: T;
304
323
  }
305
- >['data'],
324
+ >["data"],
306
325
  ]
307
- ) => void
326
+ ) => void;
308
327
  }
309
328
 
329
+ declare type IgnoredKey =
330
+ | "_id"
331
+ | "_type"
332
+ | "_rev"
333
+ | "_createdAt"
334
+ | "_updatedAt";
335
+
310
336
  /**
311
337
  * @alpha
312
338
  */
313
- declare type LoginErrorProps = FallbackProps
339
+ declare type LoginErrorProps = FallbackProps;
314
340
 
315
341
  declare interface ManageFavorite extends FavoriteStatusResponse {
316
- favorite: () => Promise<void>
317
- unfavorite: () => Promise<void>
318
- isFavorited: boolean
342
+ favorite: () => Promise<void>;
343
+ unfavorite: () => Promise<void>;
344
+ isFavorited: boolean;
319
345
  }
320
346
 
321
347
  /**
322
348
  * @public
323
349
  */
324
- declare type MessageData = Record<string, unknown> | undefined
350
+ declare type MessageData = Record<string, unknown> | undefined;
325
351
 
326
352
  /**
327
353
  * @internal
328
354
  */
329
355
  export declare type MessageHandler<TWindowMessage extends WindowMessage> = (
330
- event: TWindowMessage['data'],
331
- ) => TWindowMessage['response'] | Promise<TWindowMessage['response']>
356
+ event: TWindowMessage["data"],
357
+ ) => TWindowMessage["response"] | Promise<TWindowMessage["response"]>;
332
358
 
333
359
  /** In-flight CLI PR is using named sources since it's aspirational.
334
360
  * We can transform the shape in this function until it's finalized.
335
361
  */
336
362
  declare interface NamedSources {
337
- [key: string]: SanityConfig
363
+ [key: string]: SanityConfig;
338
364
  }
339
365
 
340
366
  /**
@@ -342,13 +368,13 @@ declare interface NamedSources {
342
368
  * @category Types
343
369
  */
344
370
  export declare interface NavigateToStudioResult {
345
- navigateToStudioDocument: () => void
371
+ navigateToStudioDocument: () => void;
346
372
  }
347
373
 
348
374
  declare interface Observer<T> {
349
- next?: (value: T) => void
350
- error?: (err: unknown) => void
351
- complete?: () => void
375
+ next?: (value: T) => void;
376
+ error?: (err: unknown) => void;
377
+ complete?: () => void;
352
378
  }
353
379
 
354
380
  /**
@@ -362,26 +388,26 @@ export declare interface PaginatedDocumentsOptions<
362
388
  TDataset extends string = string,
363
389
  TProjectId extends string = string,
364
390
  > extends WithResourceNameSupport<
365
- Omit<QueryOptions<TDocumentType, TDataset, TProjectId>, 'query'>
391
+ Omit<QueryOptions<TDocumentType, TDataset, TProjectId>, "query">
366
392
  > {
367
- documentType?: TDocumentType | TDocumentType[]
393
+ documentType?: TDocumentType | TDocumentType[];
368
394
  /**
369
395
  * GROQ filter expression to apply to the query
370
396
  */
371
- filter?: string
397
+ filter?: string;
372
398
  /**
373
399
  * Number of items to display per page (defaults to 25)
374
400
  */
375
- pageSize?: number
401
+ pageSize?: number;
376
402
  /**
377
403
  * Sorting configuration for the results
378
404
  * @beta
379
405
  */
380
- orderings?: SortOrderingItem[]
406
+ orderings?: SortOrderingItem[];
381
407
  /**
382
408
  * Text search query to filter results
383
409
  */
384
- search?: string
410
+ search?: string;
385
411
  }
386
412
 
387
413
  /**
@@ -398,72 +424,72 @@ export declare interface PaginatedDocumentsResponse<
398
424
  /**
399
425
  * Array of document handles for the current page
400
426
  */
401
- data: DocumentHandle_2<TDocumentType, TDataset, TProjectId>[]
427
+ data: DocumentHandle_2<TDocumentType, TDataset, TProjectId>[];
402
428
  /**
403
429
  * Whether a query is currently in progress
404
430
  */
405
- isPending: boolean
431
+ isPending: boolean;
406
432
  /**
407
433
  * Number of items displayed per page
408
434
  */
409
- pageSize: number
435
+ pageSize: number;
410
436
  /**
411
437
  * Current page number (1-indexed)
412
438
  */
413
- currentPage: number
439
+ currentPage: number;
414
440
  /**
415
441
  * Total number of pages available
416
442
  */
417
- totalPages: number
443
+ totalPages: number;
418
444
  /**
419
445
  * Starting index of the current page (0-indexed)
420
446
  */
421
- startIndex: number
447
+ startIndex: number;
422
448
  /**
423
449
  * Ending index of the current page (exclusive, 0-indexed)
424
450
  */
425
- endIndex: number
451
+ endIndex: number;
426
452
  /**
427
453
  * Total count of items matching the query
428
454
  */
429
- count: number
455
+ count: number;
430
456
  /**
431
457
  * Navigate to the first page
432
458
  */
433
- firstPage: () => void
459
+ firstPage: () => void;
434
460
  /**
435
461
  * Whether there is a first page available to navigate to
436
462
  */
437
- hasFirstPage: boolean
463
+ hasFirstPage: boolean;
438
464
  /**
439
465
  * Navigate to the previous page
440
466
  */
441
- previousPage: () => void
467
+ previousPage: () => void;
442
468
  /**
443
469
  * Whether there is a previous page available to navigate to
444
470
  */
445
- hasPreviousPage: boolean
471
+ hasPreviousPage: boolean;
446
472
  /**
447
473
  * Navigate to the next page
448
474
  */
449
- nextPage: () => void
475
+ nextPage: () => void;
450
476
  /**
451
477
  * Whether there is a next page available to navigate to
452
478
  */
453
- hasNextPage: boolean
479
+ hasNextPage: boolean;
454
480
  /**
455
481
  * Navigate to the last page
456
482
  */
457
- lastPage: () => void
483
+ lastPage: () => void;
458
484
  /**
459
485
  * Whether there is a last page available to navigate to
460
486
  */
461
- hasLastPage: boolean
487
+ hasLastPage: boolean;
462
488
  /**
463
489
  * Navigate to a specific page number
464
490
  * @param pageNumber - The page number to navigate to (1-indexed)
465
491
  */
466
- goToPage: (pageNumber: number) => void
492
+ goToPage: (pageNumber: number) => void;
467
493
  }
468
494
 
469
495
  /**
@@ -472,13 +498,13 @@ export declare interface PaginatedDocumentsResponse<
472
498
  * @interface
473
499
  * @deprecated use the Project type directly.
474
500
  */
475
- export declare type ProjectWithoutMembers = Project
501
+ export declare type ProjectWithoutMembers = Project;
476
502
 
477
503
  /**
478
504
  * This version is provided by pkg-utils at build time
479
505
  * @internal
480
506
  */
481
- export declare const REACT_SDK_VERSION: {}
507
+ export declare const REACT_SDK_VERSION: {};
482
508
 
483
509
  /** @internal */
484
510
  export declare function renderSanityApp(
@@ -486,10 +512,10 @@ export declare function renderSanityApp(
486
512
  namedSources: NamedSources,
487
513
  options: RenderSanitySDKAppOptions,
488
514
  children: React.ReactNode,
489
- ): () => void
515
+ ): () => void;
490
516
 
491
517
  declare interface RenderSanitySDKAppOptions {
492
- reactStrictMode?: boolean
518
+ reactStrictMode?: boolean;
493
519
  }
494
520
 
495
521
  /**
@@ -511,7 +537,7 @@ export declare interface ResourceHandle<
511
537
  * Name of a resource registered via the `resources` prop on `<SanityApp>`.
512
538
  * Resolved to a `DocumentResource` at the React layer.
513
539
  */
514
- resourceName?: string
540
+ resourceName?: string;
515
541
  }
516
542
 
517
543
  /**
@@ -534,7 +560,7 @@ export declare function ResourceProvider({
534
560
  fallback,
535
561
  resource,
536
562
  ...config
537
- }: ResourceProviderProps): React.ReactNode
563
+ }: ResourceProviderProps): React.ReactNode;
538
564
 
539
565
  /**
540
566
  * Props for the ResourceProvider component
@@ -546,13 +572,13 @@ export declare interface ResourceProviderProps extends SanityConfig {
546
572
  * for this subtree. Hooks that don't specify an explicit resource will
547
573
  * use this value.
548
574
  */
549
- resource?: DocumentResource
575
+ resource?: DocumentResource;
550
576
  /**
551
577
  * React node to show while content is loading.
552
578
  * Used as the fallback for the internal Suspense boundary.
553
579
  */
554
- fallback: React.ReactNode
555
- children: React.ReactNode
580
+ fallback: React.ReactNode;
581
+ children: React.ReactNode;
556
582
  }
557
583
 
558
584
  /**
@@ -624,7 +650,7 @@ export declare function SanityApp({
624
650
  fallback,
625
651
  config: configProp,
626
652
  ...props
627
- }: SanityAppProps): ReactElement
653
+ }: SanityAppProps): ReactElement;
628
654
 
629
655
  /**
630
656
  * @public
@@ -637,15 +663,44 @@ export declare interface SanityAppProps {
637
663
  * (e.g. inside Sanity Studio) — the config is derived from the workspace
638
664
  * automatically.
639
665
  */
640
- config?: SanityConfig | SanityConfig[]
666
+ config?: SanityConfig | SanityConfig[];
641
667
  /** @deprecated use the `config` prop instead. */
642
- sanityConfigs?: SanityConfig[]
643
- resources?: Record<string, DocumentResource>
644
- children: React.ReactNode
645
- fallback: React.ReactNode
668
+ sanityConfigs?: SanityConfig[];
669
+ resources?: Record<string, DocumentResource>;
670
+ children: React.ReactNode;
671
+ fallback: React.ReactNode;
672
+ /**
673
+ * Set this to automatically fetch and register the organization's media library and canvas as named resources.
674
+ * These resources will be available to hooks as `media-library` and `canvas`.
675
+ *
676
+ * The SDK App must be running in the organization's Dashboard to use this feature.
677
+ *
678
+ * @example
679
+ * ```tsx
680
+ *
681
+ * const MyApp = () => {
682
+ * // should "just work" because of inferMediaLibraryAndCanvas.
683
+ * const {data: assets} = useDocuments({
684
+ * documentType: 'sanity.asset',
685
+ * resourceName: 'media-library',
686
+ * })
687
+ * return (
688
+ * <div>
689
+ * {assets.map((asset) => (
690
+ * <div key={asset._id}>{asset.originalFilename}</div>
691
+ * ))}
692
+ * </div>
693
+ * )
694
+ * }
695
+ * <SanityApp inferMediaLibraryAndCanvas>
696
+ * <MyApp />
697
+ * </SanityApp>
698
+ * ```
699
+ */
700
+ inferMediaLibraryAndCanvas?: boolean;
646
701
  }
647
702
 
648
- export {SanityDocument}
703
+ export { SanityDocument };
649
704
 
650
705
  /**
651
706
  * Provides an externally-created Sanity instance to child components through React Context.
@@ -687,7 +742,7 @@ export declare function SanityInstanceProvider({
687
742
  instance,
688
743
  fallback,
689
744
  children,
690
- }: SanityInstanceProviderProps): React.ReactNode
745
+ }: SanityInstanceProviderProps): React.ReactNode;
691
746
 
692
747
  /**
693
748
  * Props for the SanityInstanceProvider component
@@ -699,16 +754,16 @@ export declare interface SanityInstanceProviderProps {
699
754
  * The caller owns the instance lifecycle — SanityInstanceProvider
700
755
  * will not dispose it on unmount.
701
756
  */
702
- instance: SanityInstance
757
+ instance: SanityInstance;
703
758
  /**
704
759
  * React node to show while content is loading.
705
760
  * Used as the fallback for the internal Suspense boundary.
706
761
  */
707
- fallback: React.ReactNode
708
- children: React.ReactNode
762
+ fallback: React.ReactNode;
763
+ children: React.ReactNode;
709
764
  }
710
765
 
711
- export {SanityProjectMember}
766
+ export { SanityProjectMember };
712
767
 
713
768
  /**
714
769
  * @internal
@@ -719,17 +774,20 @@ export declare function SDKProvider({
719
774
  children,
720
775
  config,
721
776
  fallback,
777
+ inferMediaLibraryAndCanvas,
722
778
  ...props
723
- }: SDKProviderProps): ReactElement
779
+ }: SDKProviderProps): ReactElement;
724
780
 
725
781
  /**
726
782
  * @internal
727
783
  */
728
784
  export declare interface SDKProviderProps extends AuthBoundaryProps {
729
- children: ReactNode
730
- config: SanityConfig | SanityConfig[]
731
- fallback: ReactNode
732
- resources?: Record<string, DocumentResource>
785
+ children: ReactNode;
786
+ config: SanityConfig | SanityConfig[];
787
+ fallback: ReactNode;
788
+ resources?: Record<string, DocumentResource>;
789
+ /** When set, automatically fetches and registers the organization's media library and canvas as named resources. */
790
+ inferMediaLibraryAndCanvas?: boolean;
733
791
  }
734
792
 
735
793
  /**
@@ -766,9 +824,9 @@ export declare interface SDKProviderProps extends AuthBoundaryProps {
766
824
  *
767
825
  * @public
768
826
  */
769
- export declare const SDKStudioContext: Context<StudioWorkspaceHandle | null>
827
+ export declare const SDKStudioContext: Context<StudioWorkspaceHandle | null>;
770
828
 
771
- export {SortOrderingItem}
829
+ export { SortOrderingItem };
772
830
 
773
831
  /**
774
832
  * Minimal duck-typed interface representing a Sanity Studio workspace.
@@ -779,15 +837,15 @@ export {SortOrderingItem}
779
837
  */
780
838
  export declare interface StudioWorkspaceHandle {
781
839
  /** The Sanity project ID for this workspace. */
782
- projectId: string
840
+ projectId: string;
783
841
  /** The dataset name for this workspace. */
784
- dataset: string
842
+ dataset: string;
785
843
  /**
786
844
  * Whether the Studio has determined the user is authenticated.
787
845
  * When `true` and the token source emits `null`, the SDK infers
788
846
  * cookie-based auth is in use and skips the logged-out state.
789
847
  */
790
- authenticated?: boolean
848
+ authenticated?: boolean;
791
849
  /** Authentication state for this workspace. */
792
850
  auth: {
793
851
  /**
@@ -798,29 +856,29 @@ export declare interface StudioWorkspaceHandle {
798
856
  * Optional because Studios before Aug 2022 may not expose it. When
799
857
  * absent, the SDK falls back to localStorage/cookie discovery.
800
858
  */
801
- token?: TokenSource
802
- }
859
+ token?: TokenSource;
860
+ };
803
861
  }
804
862
 
805
863
  declare interface StudioWorkspacesResult {
806
- workspacesByProjectIdAndDataset: WorkspacesByProjectIdDataset
807
- error: string | null
864
+ workspacesByProjectIdAndDataset: WorkspacesByProjectIdDataset;
865
+ error: string | null;
808
866
  }
809
867
 
810
868
  declare interface Subscribable<T> {
811
- subscribe(observer: Observer<T>): Subscription
869
+ subscribe(observer: Observer<T>): Subscription;
812
870
  subscribe(
813
871
  next: (value: T) => void,
814
872
  error?: (err: unknown) => void,
815
873
  complete?: () => void,
816
- ): Subscription
874
+ ): Subscription;
817
875
  }
818
876
 
819
877
  declare interface Subscription {
820
- unsubscribe(): void
878
+ unsubscribe(): void;
821
879
  }
822
880
 
823
- declare type Updater<TValue> = TValue | ((currentValue: TValue) => TValue)
881
+ declare type Updater<TValue> = TValue | ((currentValue: TValue) => TValue);
824
882
 
825
883
  /**
826
884
  * @public
@@ -840,7 +898,7 @@ declare type Updater<TValue> = TValue | ((currentValue: TValue) => TValue)
840
898
  */
841
899
  export declare function useActiveReleases(
842
900
  options?: WithResourceNameSupport<SanityConfig> | undefined,
843
- ): ReleaseDocument[]
901
+ ): ReleaseDocument[];
844
902
 
845
903
  /**
846
904
  * @alpha
@@ -911,7 +969,7 @@ export declare function useActiveReleases(
911
969
  */
912
970
  export declare function useAgentGenerate(
913
971
  resourceHandle?: ResourceHandle,
914
- ): (options: AgentGenerateOptions) => Subscribable<unknown>
972
+ ): (options: AgentGenerateOptions) => Subscribable<unknown>;
915
973
 
916
974
  /**
917
975
  * @alpha
@@ -1064,7 +1122,7 @@ export declare function useAgentGenerate(
1064
1122
  */
1065
1123
  export declare function useAgentPatch(
1066
1124
  resourceHandle?: ResourceHandle,
1067
- ): (options: AgentPatchOptions) => Promise<AgentPatchResult>
1125
+ ): (options: AgentPatchOptions) => Promise<AgentPatchResult>;
1068
1126
 
1069
1127
  /**
1070
1128
  * @alpha
@@ -1162,7 +1220,7 @@ export declare function useAgentPatch(
1162
1220
  */
1163
1221
  export declare function useAgentPrompt(
1164
1222
  resourceHandle?: ResourceHandle,
1165
- ): (options: AgentPromptOptions) => Promise<AgentPromptResult>
1223
+ ): (options: AgentPromptOptions) => Promise<AgentPromptResult>;
1166
1224
 
1167
1225
  /**
1168
1226
  * @public
@@ -1194,7 +1252,9 @@ export declare function useAgentPrompt(
1194
1252
  * }
1195
1253
  * ```
1196
1254
  */
1197
- export declare function useAgentResourceContext(options: AgentResourceContextOptions): void
1255
+ export declare function useAgentResourceContext(
1256
+ options: AgentResourceContextOptions,
1257
+ ): void;
1198
1258
 
1199
1259
  /**
1200
1260
  * @alpha
@@ -1269,7 +1329,7 @@ export declare function useAgentResourceContext(options: AgentResourceContextOpt
1269
1329
  */
1270
1330
  export declare function useAgentTransform(
1271
1331
  resourceHandle?: ResourceHandle,
1272
- ): (options: AgentTransformOptions) => Subscribable<unknown>
1332
+ ): (options: AgentTransformOptions) => Subscribable<unknown>;
1273
1333
 
1274
1334
  /**
1275
1335
  * @alpha
@@ -1363,7 +1423,7 @@ export declare function useAgentTransform(
1363
1423
  */
1364
1424
  export declare function useAgentTranslate(
1365
1425
  resourceHandle?: ResourceHandle,
1366
- ): (options: AgentTranslateOptions) => Subscribable<unknown>
1426
+ ): (options: AgentTranslateOptions) => Subscribable<unknown>;
1367
1427
 
1368
1428
  /**
1369
1429
  * @public
@@ -1392,7 +1452,7 @@ export declare function useAgentTranslate(
1392
1452
  */
1393
1453
  export declare function useAllReleases(
1394
1454
  options?: WithResourceNameSupport<SanityConfig> | undefined,
1395
- ): ReleaseDocument[]
1455
+ ): ReleaseDocument[];
1396
1456
 
1397
1457
  /**
1398
1458
  * @public
@@ -1407,7 +1467,9 @@ declare interface UseApplyDocumentActions {
1407
1467
  | DocumentAction<TDocumentType, TDataset, TProjectId>
1408
1468
  | DocumentAction<TDocumentType, TDataset, TProjectId>[],
1409
1469
  options?: ResourceHandle,
1410
- ) => Promise<ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>>
1470
+ ) => Promise<
1471
+ ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>
1472
+ >;
1411
1473
  }
1412
1474
 
1413
1475
  /**
@@ -1593,13 +1655,16 @@ declare interface UseApplyDocumentActions {
1593
1655
  * }
1594
1656
  * ```
1595
1657
  */
1596
- export declare const useApplyDocumentActions: UseApplyDocumentActions
1658
+ export declare const useApplyDocumentActions: UseApplyDocumentActions;
1597
1659
 
1598
1660
  /**
1599
1661
  * @public
1600
1662
  */
1601
1663
  declare interface UseApplyReleaseActions {
1602
- (): (action: ReleaseAction | ReleaseAction[], options?: ResourceHandle) => Promise<ActionsResult>
1664
+ (): (
1665
+ action: ReleaseAction | ReleaseAction[],
1666
+ options?: ResourceHandle,
1667
+ ) => Promise<ActionsResult>;
1603
1668
  }
1604
1669
 
1605
1670
  /**
@@ -1669,7 +1734,7 @@ declare interface UseApplyReleaseActions {
1669
1734
  * }
1670
1735
  * ```
1671
1736
  */
1672
- export declare const useApplyReleaseActions: UseApplyReleaseActions
1737
+ export declare const useApplyReleaseActions: UseApplyReleaseActions;
1673
1738
 
1674
1739
  /**
1675
1740
  * @internal
@@ -1692,14 +1757,14 @@ export declare const useApplyReleaseActions: UseApplyReleaseActions
1692
1757
  * }
1693
1758
  * ```
1694
1759
  */
1695
- export declare const useAuthState: () => AuthState
1760
+ export declare const useAuthState: () => AuthState;
1696
1761
 
1697
1762
  /**
1698
1763
  * Hook to get the currently logged in user
1699
1764
  * @internal
1700
1765
  * @returns The current user or null if not authenticated
1701
1766
  */
1702
- export declare const useAuthToken: () => string | null
1767
+ export declare const useAuthToken: () => string | null;
1703
1768
 
1704
1769
  /**
1705
1770
  * A React hook that provides a client that subscribes to changes in your application,
@@ -1728,7 +1793,48 @@ export declare const useAuthToken: () => string | null
1728
1793
  * @public
1729
1794
  * @function
1730
1795
  */
1731
- export declare const useClient: (options: ClientOptions) => SanityClient
1796
+ export declare const useClient: (options: ClientOptions) => SanityClient;
1797
+
1798
+ /**
1799
+ * @public
1800
+ * Create a new document, relying on Typegen for the initial-value type.
1801
+ *
1802
+ * @param options - A document-type handle including `documentType`, an optional `documentId`, and optionally `projectId`/`dataset`/`perspective`.
1803
+ * @returns A function that creates the document. It accepts optional initial field values and an optional `{documentId}` override,
1804
+ * and resolves to the {@link DocumentHandle} of the created document (carrying the generated or supplied id).
1805
+ */
1806
+ export declare function useCreateDocument<
1807
+ TDocumentType extends string = string,
1808
+ TDataset extends string = string,
1809
+ TProjectId extends string = string,
1810
+ >(
1811
+ options: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>,
1812
+ ): (
1813
+ initialValue?: Partial<
1814
+ Omit<
1815
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>,
1816
+ IgnoredKey
1817
+ >
1818
+ >,
1819
+ overrides?: CreateDocumentOverrides,
1820
+ ) => Promise<DocumentHandle<TDocumentType, TDataset, TProjectId>>;
1821
+
1822
+ /**
1823
+ * @public
1824
+ * Create a new document with an explicit type `TData`.
1825
+ *
1826
+ * @param options - A document-type handle including `documentType` and optionally `projectId`/`dataset`/`perspective`.
1827
+ * @returns A function that creates the document. It accepts optional initial field values (typed against `TData`) and an
1828
+ * optional `{documentId}` override, and resolves to the {@link DocumentHandle} of the created document.
1829
+ */
1830
+ export declare function useCreateDocument<
1831
+ TData extends Record<string, unknown>,
1832
+ >(
1833
+ options: DocumentTypeHandle,
1834
+ ): (
1835
+ initialValue?: Partial<Omit<TData, IgnoredKey>>,
1836
+ overrides?: CreateDocumentOverrides,
1837
+ ) => Promise<DocumentHandle>;
1732
1838
 
1733
1839
  declare type UseCurrentUser = {
1734
1840
  /**
@@ -1751,15 +1857,15 @@ declare type UseCurrentUser = {
1751
1857
  * )
1752
1858
  * ```
1753
1859
  */
1754
- (): CurrentUser | null
1755
- }
1860
+ (): CurrentUser | null;
1861
+ };
1756
1862
 
1757
1863
  /**
1758
1864
  * @public
1759
1865
  * @function
1760
1866
  * @TODO This should not return null — users of a custom app will always be authenticated via Core
1761
1867
  */
1762
- export declare const useCurrentUser: UseCurrentUser
1868
+ export declare const useCurrentUser: UseCurrentUser;
1763
1869
 
1764
1870
  /**
1765
1871
  * @public
@@ -1805,8 +1911,8 @@ export declare const useCurrentUser: UseCurrentUser
1805
1911
  * ```
1806
1912
  */
1807
1913
  export declare function useDashboardNavigate(
1808
- navigateFn: (options: PathChangeMessage['data']) => void,
1809
- ): void
1914
+ navigateFn: (options: PathChangeMessage["data"]) => void,
1915
+ ): void;
1810
1916
 
1811
1917
  /**
1812
1918
  * @public
@@ -1827,7 +1933,7 @@ export declare function useDashboardNavigate(
1827
1933
  * @category Dashboard
1828
1934
  * @returns The dashboard organization ID (string | undefined)
1829
1935
  */
1830
- export declare function useDashboardOrganizationId(): string | undefined
1936
+ export declare function useDashboardOrganizationId(): string | undefined;
1831
1937
 
1832
1938
  declare type UseDatasets = {
1833
1939
  /**
@@ -1835,6 +1941,8 @@ declare type UseDatasets = {
1835
1941
  * Returns metadata for each dataset the current user has access to.
1836
1942
  *
1837
1943
  * @category Datasets
1944
+ * @param options - Optional project/resource to read datasets for. Defaults to
1945
+ * the resource named in `ResourceProvider`/`SDKProvider`.
1838
1946
  * @returns The metadata for your the datasets
1839
1947
  *
1840
1948
  * @example
@@ -1850,15 +1958,21 @@ declare type UseDatasets = {
1850
1958
  * )
1851
1959
  * ```
1852
1960
  *
1961
+ * @remarks
1962
+ * The `projectId` is resolved in order from:
1963
+ * 1. an explicit `projectId` option
1964
+ * 2. A legacy ProjectContext (e.g. a `<ResourceProvider projectId="…">` with no dataset), then
1965
+ * 3. The active resource (`ResourceProvider`/`SDKProvider`)
1966
+ * 4. `instance.config`.
1853
1967
  */
1854
- (): DatasetsResponse
1855
- }
1968
+ (options?: ProjectHandle): DatasetsResponse;
1969
+ };
1856
1970
 
1857
1971
  /**
1858
1972
  * @public
1859
1973
  * @function
1860
1974
  */
1861
- export declare const useDatasets: UseDatasets
1975
+ export declare const useDatasets: UseDatasets;
1862
1976
 
1863
1977
  /**
1864
1978
  * @beta
@@ -1911,26 +2025,32 @@ export declare const useDatasets: UseDatasets
1911
2025
  * }
1912
2026
  * ```
1913
2027
  */
1914
- export declare function useDispatchIntent(params: UseDispatchIntentParams): DispatchIntent
2028
+ export declare function useDispatchIntent(
2029
+ params: UseDispatchIntentParams,
2030
+ ): DispatchIntent;
1915
2031
 
1916
2032
  /**
1917
2033
  * Parameters for the useDispatchIntent hook
1918
2034
  * @beta
1919
2035
  */
1920
2036
  declare interface UseDispatchIntentParams {
1921
- action?: 'edit'
1922
- intentId?: string
1923
- documentHandle: DocumentHandle
1924
- parameters?: Record<string, unknown>
2037
+ action?: "edit";
2038
+ intentId?: string;
2039
+ documentHandle: DocumentHandle;
2040
+ parameters?: Record<string, unknown>;
1925
2041
  }
1926
2042
 
1927
2043
  declare interface UseDocument {
1928
2044
  /** @internal */
1929
- <TDocumentType extends string, TDataset extends string, TProjectId extends string = string>(
2045
+ <
2046
+ TDocumentType extends string,
2047
+ TDataset extends string,
2048
+ TProjectId extends string = string,
2049
+ >(
1930
2050
  options: UseDocumentOptions<undefined, TDocumentType, TDataset, TProjectId>,
1931
2051
  ): {
1932
- data: SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`> | null
1933
- }
2052
+ data: SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`> | null;
2053
+ };
1934
2054
  /** @internal */
1935
2055
  <
1936
2056
  TPath extends string,
@@ -1940,16 +2060,21 @@ declare interface UseDocument {
1940
2060
  >(
1941
2061
  options: UseDocumentOptions<TPath, TDocumentType>,
1942
2062
  ): {
1943
- data: JsonMatch<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>, TPath> | undefined
1944
- }
2063
+ data:
2064
+ | JsonMatch<
2065
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>,
2066
+ TPath
2067
+ >
2068
+ | undefined;
2069
+ };
1945
2070
  /** @internal */
1946
2071
  <TData>(options: DocumentOptions<undefined>): {
1947
- data: TData | null
1948
- }
2072
+ data: TData | null;
2073
+ };
1949
2074
  /** @internal */
1950
2075
  <TData>(options: DocumentOptions<string>): {
1951
- data: TData | undefined
1952
- }
2076
+ data: TData | undefined;
2077
+ };
1953
2078
  /**
1954
2079
  * ## useDocument via Type Inference (Recommended)
1955
2080
  *
@@ -2022,12 +2147,18 @@ declare interface UseDocument {
2022
2147
  ): TPath extends string
2023
2148
  ? {
2024
2149
  data:
2025
- | JsonMatch<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>, TPath>
2026
- | undefined
2150
+ | JsonMatch<
2151
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>,
2152
+ TPath
2153
+ >
2154
+ | undefined;
2027
2155
  }
2028
2156
  : {
2029
- data: SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`> | null
2030
- }
2157
+ data: SanityDocument_2<
2158
+ TDocumentType,
2159
+ `${TProjectId}.${TDataset}`
2160
+ > | null;
2161
+ };
2031
2162
  /**
2032
2163
  * @public
2033
2164
  *
@@ -2092,17 +2223,17 @@ declare interface UseDocument {
2092
2223
  options: UseDocumentOptions<TPath>,
2093
2224
  ): TPath extends string
2094
2225
  ? {
2095
- data: TData | undefined
2226
+ data: TData | undefined;
2096
2227
  }
2097
2228
  : {
2098
- data: TData | null
2099
- }
2229
+ data: TData | null;
2230
+ };
2100
2231
  /**
2101
2232
  * @internal
2102
2233
  */
2103
2234
  (options: UseDocumentOptions): {
2104
- data: unknown
2105
- }
2235
+ data: unknown;
2236
+ };
2106
2237
  }
2107
2238
 
2108
2239
  /**
@@ -2128,7 +2259,7 @@ declare interface UseDocument {
2128
2259
  *
2129
2260
  * @function
2130
2261
  */
2131
- export declare const useDocument: UseDocument
2262
+ export declare const useDocument: UseDocument;
2132
2263
 
2133
2264
  /**
2134
2265
  *
@@ -2188,7 +2319,7 @@ export declare const useDocument: UseDocument
2188
2319
  export declare function useDocumentEvent<
2189
2320
  TDataset extends string = string,
2190
2321
  TProjectId extends string = string,
2191
- >(options: UseDocumentEventOptions<TDataset, TProjectId>): void
2322
+ >(options: UseDocumentEventOptions<TDataset, TProjectId>): void;
2192
2323
 
2193
2324
  /**
2194
2325
  * @public
@@ -2197,7 +2328,7 @@ declare interface UseDocumentEventOptions<
2197
2328
  TDataset extends string = string,
2198
2329
  TProjectId extends string = string,
2199
2330
  > extends ResourceHandle<TDataset, TProjectId> {
2200
- onEvent: (documentEvent: DocumentEvent) => void
2331
+ onEvent: (documentEvent: DocumentEvent) => void;
2201
2332
  }
2202
2333
 
2203
2334
  declare type UseDocumentOptions<
@@ -2206,8 +2337,8 @@ declare type UseDocumentOptions<
2206
2337
  TDataset extends string = string,
2207
2338
  TProjectId extends string = string,
2208
2339
  > = DocumentHandle<TDocumentType, TDataset, TProjectId> & {
2209
- path?: TPath
2210
- }
2340
+ path?: TPath;
2341
+ };
2211
2342
 
2212
2343
  /**
2213
2344
  *
@@ -2290,7 +2421,7 @@ export declare function useDocumentPermissions(
2290
2421
  actionOrActions:
2291
2422
  | WithResourceNameSupport<DocumentAction>
2292
2423
  | WithResourceNameSupport<DocumentAction>[],
2293
- ): DocumentPermissionsResult
2424
+ ): DocumentPermissionsResult;
2294
2425
 
2295
2426
  /**
2296
2427
  * @public
@@ -2351,7 +2482,7 @@ export declare function useDocumentPermissions(
2351
2482
  export declare function useDocumentPreview({
2352
2483
  ref,
2353
2484
  ...docHandle
2354
- }: useDocumentPreviewOptions): useDocumentPreviewResults
2485
+ }: useDocumentPreviewOptions): useDocumentPreviewResults;
2355
2486
 
2356
2487
  /**
2357
2488
  * @public
@@ -2362,7 +2493,7 @@ export declare interface useDocumentPreviewOptions extends DocumentHandle {
2362
2493
  * Optional ref object to track visibility. When provided, preview resolution
2363
2494
  * only occurs when the referenced element is visible in the viewport.
2364
2495
  */
2365
- ref?: React.RefObject<unknown>
2496
+ ref?: React.RefObject<unknown>;
2366
2497
  }
2367
2498
 
2368
2499
  /**
@@ -2371,9 +2502,9 @@ export declare interface useDocumentPreviewOptions extends DocumentHandle {
2371
2502
  */
2372
2503
  export declare interface useDocumentPreviewResults {
2373
2504
  /** The results of inferring the document's preview values */
2374
- data: PreviewValue
2505
+ data: PreviewValue;
2375
2506
  /** True when inferred preview values are being refreshed */
2376
- isPending: boolean
2507
+ isPending: boolean;
2377
2508
  }
2378
2509
 
2379
2510
  /**
@@ -2455,10 +2586,19 @@ export declare function useDocumentProjection<
2455
2586
  TDataset extends string = string,
2456
2587
  TProjectId extends string = string,
2457
2588
  >(
2458
- options: useDocumentProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>,
2589
+ options: useDocumentProjectionOptions<
2590
+ TProjection,
2591
+ TDocumentType,
2592
+ TDataset,
2593
+ TProjectId
2594
+ >,
2459
2595
  ): useDocumentProjectionResults<
2460
- SanityProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>
2461
- >
2596
+ SanityProjectionResult<
2597
+ TProjection,
2598
+ TDocumentType,
2599
+ `${TProjectId}.${TDataset}`
2600
+ >
2601
+ >;
2462
2602
 
2463
2603
  /**
2464
2604
  * @public
@@ -2507,7 +2647,7 @@ export declare function useDocumentProjection<
2507
2647
  */
2508
2648
  export declare function useDocumentProjection<TData extends object>(
2509
2649
  options: useDocumentProjectionOptions,
2510
- ): useDocumentProjectionResults<TData>
2650
+ ): useDocumentProjectionResults<TData>;
2511
2651
 
2512
2652
  /**
2513
2653
  * @public
@@ -2520,11 +2660,11 @@ export declare interface useDocumentProjectionOptions<
2520
2660
  TProjectId extends string = string,
2521
2661
  > extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
2522
2662
  /** The GROQ projection string */
2523
- projection: TProjection
2663
+ projection: TProjection;
2524
2664
  /** Optional parameters for the projection query */
2525
- params?: Record<string, unknown>
2665
+ params?: Record<string, unknown>;
2526
2666
  /** Optional ref to track viewport intersection for lazy loading */
2527
- ref?: React.RefObject<unknown>
2667
+ ref?: React.RefObject<unknown>;
2528
2668
  }
2529
2669
 
2530
2670
  /**
@@ -2533,9 +2673,9 @@ export declare interface useDocumentProjectionOptions<
2533
2673
  */
2534
2674
  export declare interface useDocumentProjectionResults<TData> {
2535
2675
  /** The projected data */
2536
- data: TData
2676
+ data: TData;
2537
2677
  /** True if the projection is currently being resolved */
2538
- isPending: boolean
2678
+ isPending: boolean;
2539
2679
  }
2540
2680
 
2541
2681
  /**
@@ -2663,7 +2803,7 @@ export declare function useDocuments<
2663
2803
  TDocumentType,
2664
2804
  TDataset,
2665
2805
  TProjectId
2666
- >
2806
+ >;
2667
2807
 
2668
2808
  declare type UseDocumentSyncStatus = {
2669
2809
  /**
@@ -2698,14 +2838,14 @@ declare type UseDocumentSyncStatus = {
2698
2838
  * // <SyncIndicator doc={doc} />
2699
2839
  * ```
2700
2840
  */
2701
- (doc: DocumentHandle_2): boolean
2702
- }
2841
+ (doc: DocumentHandle_2): boolean;
2842
+ };
2703
2843
 
2704
2844
  /**
2705
2845
  * @public
2706
2846
  * @function
2707
2847
  */
2708
- export declare const useDocumentSyncStatus: UseDocumentSyncStatus
2848
+ export declare const useDocumentSyncStatus: UseDocumentSyncStatus;
2709
2849
 
2710
2850
  /**
2711
2851
  * @public
@@ -2722,8 +2862,12 @@ export declare function useEditDocument<
2722
2862
  >(
2723
2863
  options: DocumentOptions<undefined, TDocumentType, TDataset, TProjectId>,
2724
2864
  ): (
2725
- nextValue: Updater<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>,
2726
- ) => Promise<ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>>
2865
+ nextValue: Updater<
2866
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>
2867
+ >,
2868
+ ) => Promise<
2869
+ ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>
2870
+ >;
2727
2871
 
2728
2872
  /**
2729
2873
  * @public
@@ -2742,9 +2886,14 @@ export declare function useEditDocument<
2742
2886
  options: DocumentOptions<TPath, TDocumentType, TDataset, TProjectId>,
2743
2887
  ): (
2744
2888
  nextValue: Updater<
2745
- JsonMatch<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>, TPath>
2889
+ JsonMatch<
2890
+ SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>,
2891
+ TPath
2892
+ >
2746
2893
  >,
2747
- ) => Promise<ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>>
2894
+ ) => Promise<
2895
+ ActionsResult<SanityDocument_2<TDocumentType, `${TProjectId}.${TDataset}`>>
2896
+ >;
2748
2897
 
2749
2898
  /**
2750
2899
  * @public
@@ -2756,7 +2905,7 @@ export declare function useEditDocument<
2756
2905
  */
2757
2906
  export declare function useEditDocument<TData>(
2758
2907
  options: DocumentOptions<undefined>,
2759
- ): (nextValue: Updater<TData>) => Promise<ActionsResult>
2908
+ ): (nextValue: Updater<TData>) => Promise<ActionsResult>;
2760
2909
 
2761
2910
  /**
2762
2911
  * @public
@@ -2768,7 +2917,7 @@ export declare function useEditDocument<TData>(
2768
2917
  */
2769
2918
  export declare function useEditDocument<TData>(
2770
2919
  options: DocumentOptions<string>,
2771
- ): (nextValue: Updater<TData>) => Promise<ActionsResult>
2920
+ ): (nextValue: Updater<TData>) => Promise<ActionsResult>;
2772
2921
 
2773
2922
  /**
2774
2923
  * @internal
@@ -2776,27 +2925,31 @@ export declare function useEditDocument<TData>(
2776
2925
  export declare function useFrameConnection<
2777
2926
  TFrameMessage extends FrameMessage,
2778
2927
  TWindowMessage extends WindowMessage,
2779
- >(options: UseFrameConnectionOptions<TWindowMessage>): FrameConnection<TFrameMessage>
2928
+ >(
2929
+ options: UseFrameConnectionOptions<TWindowMessage>,
2930
+ ): FrameConnection<TFrameMessage>;
2780
2931
 
2781
2932
  /**
2782
2933
  * @internal
2783
2934
  */
2784
- export declare interface UseFrameConnectionOptions<TWindowMessage extends WindowMessage> {
2785
- name: string
2786
- connectTo: string
2787
- targetOrigin: string
2935
+ export declare interface UseFrameConnectionOptions<
2936
+ TWindowMessage extends WindowMessage,
2937
+ > {
2938
+ name: string;
2939
+ connectTo: string;
2940
+ targetOrigin: string;
2788
2941
  onMessage?: {
2789
- [K in TWindowMessage['type']]: (
2942
+ [K in TWindowMessage["type"]]: (
2790
2943
  data: Extract<
2791
2944
  TWindowMessage,
2792
2945
  {
2793
- type: K
2946
+ type: K;
2794
2947
  }
2795
- >['data'],
2796
- ) => void
2797
- }
2798
- heartbeat?: boolean
2799
- onStatus?: (status: ComlinkStatus) => void
2948
+ >["data"],
2949
+ ) => void;
2950
+ };
2951
+ heartbeat?: boolean;
2952
+ onStatus?: (status: ComlinkStatus) => void;
2800
2953
  }
2801
2954
 
2802
2955
  /**
@@ -2841,19 +2994,19 @@ export declare interface UseFrameConnectionOptions<TWindowMessage extends Window
2841
2994
  */
2842
2995
  export declare const useHandleAuthCallback: () => (
2843
2996
  locationHref?: string | undefined,
2844
- ) => Promise<string | false>
2997
+ ) => Promise<string | false>;
2845
2998
 
2846
2999
  /**
2847
3000
  * @internal
2848
3001
  */
2849
- export declare function useLoginUrl(): string
3002
+ export declare function useLoginUrl(): string;
2850
3003
 
2851
3004
  /**
2852
3005
  * Hook to log out of the current session
2853
3006
  * @internal
2854
3007
  * @returns A function to log out of the current session
2855
3008
  */
2856
- export declare const useLogOut: () => () => Promise<void>
3009
+ export declare const useLogOut: () => () => Promise<void>;
2857
3010
 
2858
3011
  /**
2859
3012
  * @internal
@@ -2908,16 +3061,19 @@ export declare function useManageFavorite({
2908
3061
  resourceId: paramResourceId,
2909
3062
  resourceType,
2910
3063
  schemaName,
2911
- }: UseManageFavoriteProps): ManageFavorite
3064
+ }: UseManageFavoriteProps): ManageFavorite;
2912
3065
 
2913
3066
  declare interface UseManageFavoriteProps extends DocumentHandle_2 {
2914
- resourceId?: string
2915
- resourceType: StudioResource['type'] | MediaResource['type'] | CanvasResource['type']
3067
+ resourceId?: string;
3068
+ resourceType:
3069
+ | StudioResource["type"]
3070
+ | MediaResource["type"]
3071
+ | CanvasResource["type"];
2916
3072
  /**
2917
3073
  * The name of the schema collection this document belongs to.
2918
3074
  * Typically is the name of the workspace when used in the context of a studio.
2919
3075
  */
2920
- schemaName?: string
3076
+ schemaName?: string;
2921
3077
  }
2922
3078
 
2923
3079
  /**
@@ -2967,7 +3123,7 @@ declare interface UseManageFavoriteProps extends DocumentHandle_2 {
2967
3123
  export declare function useNavigateToStudioDocument(
2968
3124
  documentHandle: DocumentHandle_2,
2969
3125
  preferredStudioUrl?: string,
2970
- ): NavigateToStudioResult
3126
+ ): NavigateToStudioResult;
2971
3127
 
2972
3128
  /**
2973
3129
  * Returns metadata for a given organisation.
@@ -2997,7 +3153,7 @@ export declare const useOrganization: <
2997
3153
  IncludeFeatures extends boolean = false,
2998
3154
  >(
2999
3155
  options: OrganizationOptions<IncludeMembers, IncludeFeatures>,
3000
- ) => Organization<IncludeMembers, IncludeFeatures>
3156
+ ) => Organization<IncludeMembers, IncludeFeatures>;
3001
3157
 
3002
3158
  /**
3003
3159
  * Returns metadata for each organisation the current user has access to.
@@ -3032,7 +3188,7 @@ export declare const useOrganizations: <
3032
3188
  IncludeFeatures extends boolean = false,
3033
3189
  >(
3034
3190
  options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>,
3035
- ) => Organizations<IncludeMembers, IncludeFeatures>
3191
+ ) => Organizations<IncludeMembers, IncludeFeatures>;
3036
3192
 
3037
3193
  /**
3038
3194
  * Retrieves pages of {@link DocumentHandle}s, narrowed by optional filters, text searches, and custom ordering,
@@ -3141,25 +3297,27 @@ export declare function usePaginatedDocuments<
3141
3297
  orderings,
3142
3298
  search,
3143
3299
  ...rawOptions
3144
- }: PaginatedDocumentsOptions<TDocumentType, TDataset, TProjectId>): PaginatedDocumentsResponse<
3300
+ }: PaginatedDocumentsOptions<
3145
3301
  TDocumentType,
3146
3302
  TDataset,
3147
3303
  TProjectId
3148
- >
3304
+ >): PaginatedDocumentsResponse<TDocumentType, TDataset, TProjectId>;
3149
3305
 
3150
3306
  /**
3151
3307
  * @public
3152
3308
  * @function
3153
3309
  */
3154
- export declare function usePerspective(perspectiveHandle?: ResourceHandle): string | string[]
3310
+ export declare function usePerspective(
3311
+ perspectiveHandle?: ResourceHandle,
3312
+ ): string | string[];
3155
3313
 
3156
3314
  /**
3157
3315
  * A hook for subscribing to presence information for the current project or Canvas.
3158
3316
  * @public
3159
3317
  */
3160
3318
  export declare function usePresence(options?: ResourceHandle): {
3161
- locations: UserPresence[]
3162
- }
3319
+ locations: UserPresence[];
3320
+ };
3163
3321
 
3164
3322
  /**
3165
3323
  * Returns metadata for a given project.
@@ -3187,6 +3345,12 @@ export declare function usePresence(options?: ResourceHandle): {
3187
3345
  * const projectWithoutMembers = useProject({projectId, includeMembers: false})
3188
3346
  * const projectWithoutFeatures = useProject({projectId, includeFeatures: false})
3189
3347
  * ```
3348
+ * @remarks
3349
+ * The `projectId` is resolved in order from:
3350
+ * 1. an explicit `projectId` option
3351
+ * 2. A legacy ProjectContext (e.g. a `<ResourceProvider projectId="…">` with no dataset), then
3352
+ * 3. The active resource (`ResourceProvider`/`SDKProvider`)
3353
+ * 4. `instance.config`.
3190
3354
  * @public
3191
3355
  * @function
3192
3356
  */
@@ -3195,7 +3359,7 @@ export declare const useProject: <
3195
3359
  IncludeFeatures extends boolean = true,
3196
3360
  >(
3197
3361
  options?: ProjectOptions<IncludeMembers, IncludeFeatures>,
3198
- ) => Project<IncludeMembers, IncludeFeatures>
3362
+ ) => Project<IncludeMembers, IncludeFeatures>;
3199
3363
 
3200
3364
  /**
3201
3365
  * Returns metadata for each project you have access to.
@@ -3232,7 +3396,7 @@ export declare const useProjects: <
3232
3396
  IncludeFeatures extends boolean = true,
3233
3397
  >(
3234
3398
  options?: ProjectsOptions<IncludeMembers, IncludeFeatures>,
3235
- ) => Project<IncludeMembers, IncludeFeatures>[]
3399
+ ) => Project<IncludeMembers, IncludeFeatures>[];
3236
3400
 
3237
3401
  /**
3238
3402
  * @public
@@ -3297,10 +3461,10 @@ export declare function useQuery<
3297
3461
  options: UseQueryOptions<TQuery, TDataset, TProjectId>,
3298
3462
  ): {
3299
3463
  /** The query result, typed based on the GROQ query string */
3300
- data: SanityQueryResult<TQuery, `${TProjectId}.${TDataset}`>
3464
+ data: SanityQueryResult<TQuery, `${TProjectId}.${TDataset}`>;
3301
3465
  /** True if a query transition is in progress */
3302
- isPending: boolean
3303
- }
3466
+ isPending: boolean;
3467
+ };
3304
3468
 
3305
3469
  /**
3306
3470
  * @public
@@ -3330,12 +3494,14 @@ export declare function useQuery<
3330
3494
  * }
3331
3495
  * ```
3332
3496
  */
3333
- export declare function useQuery<TData>(options: WithResourceNameSupport<QueryOptions>): {
3497
+ export declare function useQuery<TData>(
3498
+ options: WithResourceNameSupport<QueryOptions>,
3499
+ ): {
3334
3500
  /** The query result, cast to the provided type TData */
3335
- data: TData
3501
+ data: TData;
3336
3502
  /** True if another query is resolving in the background (suspense handles the initial loading state) */
3337
- isPending: boolean
3338
- }
3503
+ isPending: boolean;
3504
+ };
3339
3505
 
3340
3506
  /**
3341
3507
  * Hook options for useQuery, supporting both direct resource and resourceName.
@@ -3345,7 +3511,7 @@ declare type UseQueryOptions<
3345
3511
  TQuery extends string = string,
3346
3512
  TDataset extends string = string,
3347
3513
  TProjectId extends string = string,
3348
- > = WithResourceNameSupport<QueryOptions<TQuery, TDataset, TProjectId>>
3514
+ > = WithResourceNameSupport<QueryOptions<TQuery, TDataset, TProjectId>>;
3349
3515
 
3350
3516
  /**
3351
3517
  * @internal
@@ -3394,19 +3560,22 @@ export declare function useRecordDocumentHistoryEvent({
3394
3560
  resourceType,
3395
3561
  resourceId,
3396
3562
  schemaName,
3397
- }: UseRecordDocumentHistoryEventProps): DocumentInteractionHistory
3563
+ }: UseRecordDocumentHistoryEventProps): DocumentInteractionHistory;
3398
3564
 
3399
3565
  /**
3400
3566
  * @internal
3401
3567
  */
3402
3568
  declare interface UseRecordDocumentHistoryEventProps extends DocumentHandle_2 {
3403
- resourceType: StudioResource['type'] | MediaResource['type'] | CanvasResource['type']
3404
- resourceId?: string
3569
+ resourceType:
3570
+ | StudioResource["type"]
3571
+ | MediaResource["type"]
3572
+ | CanvasResource["type"];
3573
+ resourceId?: string;
3405
3574
  /**
3406
3575
  * The name of the schema collection this document belongs to.
3407
3576
  * Typically is the name of the workspace when used in the context of a studio.
3408
3577
  */
3409
- schemaName?: string
3578
+ schemaName?: string;
3410
3579
  }
3411
3580
 
3412
3581
  /**
@@ -3426,7 +3595,7 @@ declare interface UseRecordDocumentHistoryEventProps extends DocumentHandle_2 {
3426
3595
  * console.log(resource?.projectId, resource?.dataset)
3427
3596
  * ```
3428
3597
  */
3429
- export declare function useResource(): DocumentResource | undefined
3598
+ export declare function useResource(): DocumentResource | undefined;
3430
3599
 
3431
3600
  /**
3432
3601
  * @public
@@ -3436,11 +3605,11 @@ export declare interface UserResult {
3436
3605
  /**
3437
3606
  * The user data fetched, or undefined if not found.
3438
3607
  */
3439
- data: SanityUser | undefined
3608
+ data: SanityUser | undefined;
3440
3609
  /**
3441
3610
  * Whether a user request is currently in progress
3442
3611
  */
3443
- isPending: boolean
3612
+ isPending: boolean;
3444
3613
  }
3445
3614
 
3446
3615
  /**
@@ -3451,19 +3620,19 @@ export declare interface UsersResult {
3451
3620
  /**
3452
3621
  * The users fetched.
3453
3622
  */
3454
- data: SanityUser[]
3623
+ data: SanityUser[];
3455
3624
  /**
3456
3625
  * Whether there are more users to fetch.
3457
3626
  */
3458
- hasMore: boolean
3627
+ hasMore: boolean;
3459
3628
  /**
3460
3629
  * Whether a users request is currently in progress
3461
3630
  */
3462
- isPending: boolean
3631
+ isPending: boolean;
3463
3632
  /**
3464
3633
  * Load more users.
3465
3634
  */
3466
- loadMore: () => void
3635
+ loadMore: () => void;
3467
3636
  }
3468
3637
 
3469
3638
  /**
@@ -3493,7 +3662,7 @@ export declare const useSanityInstance: (
3493
3662
  * Use `useSanityInstance()` without arguments instead.
3494
3663
  */
3495
3664
  config?: SanityConfig,
3496
- ) => SanityInstance
3665
+ ) => SanityInstance;
3497
3666
 
3498
3667
  /**
3499
3668
  * Hook that fetches studio workspaces and organizes them by projectId:dataset
@@ -3529,7 +3698,7 @@ export declare const useSanityInstance: (
3529
3698
  * }
3530
3699
  * ```
3531
3700
  */
3532
- export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspacesResult
3701
+ export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspacesResult;
3533
3702
 
3534
3703
  /**
3535
3704
  *
@@ -3563,7 +3732,7 @@ export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspace
3563
3732
  * )
3564
3733
  * ```
3565
3734
  */
3566
- export declare function useUser(options: GetUserOptions): UserResult
3735
+ export declare function useUser(options: GetUserOptions): UserResult;
3567
3736
 
3568
3737
  /**
3569
3738
  *
@@ -3596,8 +3765,14 @@ export declare function useUser(options: GetUserOptions): UserResult
3596
3765
  * </div>
3597
3766
  * )
3598
3767
  * ```
3768
+ * @remarks
3769
+ * For project-scoped queries the `projectId` is resolved in order from:
3770
+ * 1. an explicit `projectId` option
3771
+ * 2. A legacy ProjectContext (e.g. a `<ResourceProvider projectId="…">` with no dataset), then
3772
+ * 3. The active resource (`ResourceProvider`/`SDKProvider`)
3773
+ * 4. `instance.config`.
3599
3774
  */
3600
- export declare function useUsers(options?: GetUsersOptions): UsersResult
3775
+ export declare function useUsers(options?: GetUsersOptions): UsersResult;
3601
3776
 
3602
3777
  /**
3603
3778
  * Hook that verifies the current projects belongs to the organization ID specified in the dashboard context.
@@ -3622,7 +3797,7 @@ export declare function useUsers(options?: GetUsersOptions): UsersResult
3622
3797
  export declare function useVerifyOrgProjects(
3623
3798
  disabled?: boolean,
3624
3799
  projectIds?: string[],
3625
- ): string | null
3800
+ ): string | null;
3626
3801
 
3627
3802
  /**
3628
3803
  * @internal
@@ -3640,15 +3815,17 @@ export declare function useWindowConnection<
3640
3815
  name,
3641
3816
  connectTo,
3642
3817
  onMessage,
3643
- }: UseWindowConnectionOptions<TFrameMessage>): WindowConnection<TWindowMessage>
3818
+ }: UseWindowConnectionOptions<TFrameMessage>): WindowConnection<TWindowMessage>;
3644
3819
 
3645
3820
  /**
3646
3821
  * @internal
3647
3822
  */
3648
- export declare interface UseWindowConnectionOptions<TMessage extends FrameMessage> {
3649
- name: string
3650
- connectTo: string
3651
- onMessage?: Record<TMessage['type'], WindowMessageHandler<TMessage>>
3823
+ export declare interface UseWindowConnectionOptions<
3824
+ TMessage extends FrameMessage,
3825
+ > {
3826
+ name: string;
3827
+ connectTo: string;
3828
+ onMessage?: Record<TMessage["type"], WindowMessageHandler<TMessage>>;
3652
3829
  }
3653
3830
 
3654
3831
  /**
@@ -3690,38 +3867,38 @@ export declare interface UseWindowConnectionOptions<TMessage extends FrameMessag
3690
3867
  *
3691
3868
  * @public
3692
3869
  */
3693
- export declare function useWindowTitle(viewTitle?: string): void
3870
+ export declare function useWindowTitle(viewTitle?: string): void;
3694
3871
 
3695
3872
  /**
3696
3873
  * @internal
3697
3874
  */
3698
3875
  export declare interface WindowConnection<TMessage extends WindowMessage> {
3699
- sendMessage: <TType extends TMessage['type']>(
3876
+ sendMessage: <TType extends TMessage["type"]>(
3700
3877
  type: TType,
3701
3878
  data?: Extract<
3702
3879
  TMessage,
3703
3880
  {
3704
- type: TType
3881
+ type: TType;
3705
3882
  }
3706
- >['data'],
3707
- ) => void
3883
+ >["data"],
3884
+ ) => void;
3708
3885
  fetch: <TResponse>(
3709
3886
  type: string,
3710
3887
  data?: MessageData,
3711
3888
  options?: {
3712
- signal?: AbortSignal
3713
- suppressWarnings?: boolean
3714
- responseTimeout?: number
3889
+ signal?: AbortSignal;
3890
+ suppressWarnings?: boolean;
3891
+ responseTimeout?: number;
3715
3892
  },
3716
- ) => Promise<TResponse>
3893
+ ) => Promise<TResponse>;
3717
3894
  }
3718
3895
 
3719
3896
  /**
3720
3897
  * @internal
3721
3898
  */
3722
3899
  export declare type WindowMessageHandler<TFrameMessage extends FrameMessage> = (
3723
- event: TFrameMessage['data'],
3724
- ) => TFrameMessage['response']
3900
+ event: TFrameMessage["data"],
3901
+ ) => TFrameMessage["response"];
3725
3902
 
3726
3903
  /**
3727
3904
  * Adds React hook support (resourceName resolution) to core types.
@@ -3734,7 +3911,7 @@ export declare type WindowMessageHandler<TFrameMessage extends FrameMessage> = (
3734
3911
  */
3735
3912
  declare type WithResourceNameSupport<
3736
3913
  T extends {
3737
- resource?: DocumentResource
3914
+ resource?: DocumentResource;
3738
3915
  },
3739
3916
  > = T & {
3740
3917
  /**
@@ -3742,18 +3919,18 @@ declare type WithResourceNameSupport<
3742
3919
  * If provided, will be resolved to a `DocumentResource` via `ResourcesContext`.
3743
3920
  * @beta
3744
3921
  */
3745
- resourceName?: string
3922
+ resourceName?: string;
3746
3923
  /**
3747
3924
  * @deprecated Use `resourceName` instead.
3748
3925
  * @beta
3749
3926
  */
3750
- sourceName?: string
3751
- }
3927
+ sourceName?: string;
3928
+ };
3752
3929
 
3753
3930
  declare interface WorkspacesByProjectIdDataset {
3754
- [key: `${string}:${string}`]: DashboardResource[]
3931
+ [key: `${string}:${string}`]: DashboardResource[];
3755
3932
  }
3756
3933
 
3757
- export * from '@sanity/sdk'
3934
+ export * from "@sanity/sdk";
3758
3935
 
3759
- export {}
3936
+ export {};