@sanity/sdk 0.0.0-rc.2 → 0.0.0-rc.4
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 +438 -320
- package/dist/index.js +1642 -1555
- package/dist/index.js.map +1 -1
- package/package.json +9 -10
- package/src/_exports/index.ts +32 -30
- package/src/auth/authStore.test.ts +149 -104
- package/src/auth/authStore.ts +51 -100
- package/src/auth/handleAuthCallback.test.ts +67 -34
- package/src/auth/handleAuthCallback.ts +8 -7
- package/src/auth/logout.test.ts +61 -29
- package/src/auth/logout.ts +26 -28
- package/src/auth/refreshStampedToken.test.ts +9 -9
- package/src/auth/refreshStampedToken.ts +62 -56
- package/src/auth/subscribeToStateAndFetchCurrentUser.test.ts +5 -5
- package/src/auth/subscribeToStateAndFetchCurrentUser.ts +45 -47
- package/src/auth/subscribeToStorageEventsAndSetToken.test.ts +4 -5
- package/src/auth/subscribeToStorageEventsAndSetToken.ts +22 -24
- package/src/client/clientStore.test.ts +131 -67
- package/src/client/clientStore.ts +117 -116
- package/src/comlink/controller/actions/destroyController.test.ts +38 -13
- package/src/comlink/controller/actions/destroyController.ts +11 -15
- package/src/comlink/controller/actions/getOrCreateChannel.test.ts +56 -27
- package/src/comlink/controller/actions/getOrCreateChannel.ts +37 -35
- package/src/comlink/controller/actions/getOrCreateController.test.ts +27 -16
- package/src/comlink/controller/actions/getOrCreateController.ts +23 -22
- package/src/comlink/controller/actions/releaseChannel.test.ts +37 -13
- package/src/comlink/controller/actions/releaseChannel.ts +22 -21
- package/src/comlink/controller/comlinkControllerStore.test.ts +65 -36
- package/src/comlink/controller/comlinkControllerStore.ts +44 -5
- package/src/comlink/node/actions/getOrCreateNode.test.ts +31 -15
- package/src/comlink/node/actions/getOrCreateNode.ts +30 -29
- package/src/comlink/node/actions/releaseNode.test.ts +75 -55
- package/src/comlink/node/actions/releaseNode.ts +19 -21
- package/src/comlink/node/comlinkNodeStore.test.ts +6 -11
- package/src/comlink/node/comlinkNodeStore.ts +22 -5
- package/src/config/authConfig.ts +79 -0
- package/src/config/sanityConfig.ts +48 -0
- package/src/datasets/datasets.test.ts +2 -2
- package/src/datasets/datasets.ts +18 -5
- package/src/document/actions.test.ts +22 -10
- package/src/document/actions.ts +44 -56
- package/src/document/applyDocumentActions.test.ts +96 -36
- package/src/document/applyDocumentActions.ts +140 -99
- package/src/document/documentStore.test.ts +103 -155
- package/src/document/documentStore.ts +247 -238
- package/src/document/listen.ts +56 -55
- package/src/document/patchOperations.ts +0 -43
- package/src/document/permissions.test.ts +25 -12
- package/src/document/permissions.ts +11 -4
- package/src/document/processActions.test.ts +41 -8
- package/src/document/reducers.test.ts +87 -16
- package/src/document/reducers.ts +2 -2
- package/src/document/sharedListener.test.ts +34 -16
- package/src/document/sharedListener.ts +33 -11
- package/src/preview/getPreviewState.test.ts +40 -39
- package/src/preview/getPreviewState.ts +68 -56
- package/src/preview/previewConstants.ts +43 -0
- package/src/preview/previewQuery.test.ts +1 -1
- package/src/preview/previewQuery.ts +4 -5
- package/src/preview/previewStore.test.ts +13 -58
- package/src/preview/previewStore.ts +7 -21
- package/src/preview/resolvePreview.test.ts +33 -104
- package/src/preview/resolvePreview.ts +11 -21
- package/src/preview/subscribeToStateAndFetchBatches.test.ts +96 -97
- package/src/preview/subscribeToStateAndFetchBatches.ts +85 -81
- package/src/preview/util.ts +1 -0
- package/src/project/project.test.ts +3 -3
- package/src/project/project.ts +28 -5
- package/src/projection/getProjectionState.test.ts +69 -49
- package/src/projection/getProjectionState.ts +42 -50
- package/src/projection/projectionQuery.ts +1 -1
- package/src/projection/projectionStore.test.ts +13 -51
- package/src/projection/projectionStore.ts +6 -18
- package/src/projection/resolveProjection.test.ts +32 -127
- package/src/projection/resolveProjection.ts +15 -28
- package/src/projection/subscribeToStateAndFetchBatches.test.ts +105 -90
- package/src/projection/subscribeToStateAndFetchBatches.ts +94 -81
- package/src/projection/util.ts +2 -0
- package/src/projects/projects.test.ts +13 -4
- package/src/projects/projects.ts +6 -1
- package/src/query/queryStore.test.ts +10 -47
- package/src/query/queryStore.ts +151 -133
- package/src/query/queryStoreConstants.ts +2 -0
- package/src/store/createActionBinder.test.ts +153 -0
- package/src/store/createActionBinder.ts +176 -0
- package/src/store/createSanityInstance.test.ts +84 -0
- package/src/store/createSanityInstance.ts +124 -0
- package/src/store/createStateSourceAction.test.ts +196 -0
- package/src/store/createStateSourceAction.ts +260 -0
- package/src/store/createStoreInstance.test.ts +81 -0
- package/src/store/createStoreInstance.ts +80 -0
- package/src/store/createStoreState.test.ts +85 -0
- package/src/store/createStoreState.ts +92 -0
- package/src/store/defineStore.test.ts +18 -0
- package/src/store/defineStore.ts +81 -0
- package/src/users/reducers.test.ts +318 -0
- package/src/users/reducers.ts +88 -0
- package/src/users/types.ts +46 -4
- package/src/users/usersConstants.ts +4 -0
- package/src/users/usersStore.test.ts +350 -223
- package/src/users/usersStore.ts +285 -149
- package/src/utils/createFetcherStore.test.ts +6 -7
- package/src/utils/createFetcherStore.ts +150 -153
- package/src/utils/createGroqSearchFilter.test.ts +75 -0
- package/src/utils/createGroqSearchFilter.ts +85 -0
- package/src/{common/util.test.ts → utils/hashString.test.ts} +1 -1
- package/src/auth/fetchLoginUrls.test.ts +0 -163
- package/src/auth/fetchLoginUrls.ts +0 -74
- package/src/common/createLiveEventSubscriber.test.ts +0 -121
- package/src/common/createLiveEventSubscriber.ts +0 -55
- package/src/common/types.ts +0 -4
- package/src/instance/identity.test.ts +0 -46
- package/src/instance/identity.ts +0 -29
- package/src/instance/sanityInstance.test.ts +0 -77
- package/src/instance/sanityInstance.ts +0 -57
- package/src/instance/types.ts +0 -37
- package/src/preview/getPreviewProjection.ts +0 -45
- package/src/resources/README.md +0 -370
- package/src/resources/createAction.test.ts +0 -101
- package/src/resources/createAction.ts +0 -44
- package/src/resources/createResource.test.ts +0 -112
- package/src/resources/createResource.ts +0 -102
- package/src/resources/createStateSourceAction.test.ts +0 -114
- package/src/resources/createStateSourceAction.ts +0 -83
- package/src/resources/createStore.test.ts +0 -67
- package/src/resources/createStore.ts +0 -46
- package/src/store/createStore.test.ts +0 -108
- package/src/store/createStore.ts +0 -106
- /package/src/{common/util.ts → utils/hashString.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import {AuthStoreState as AuthStoreState_2} from './authStore'
|
|
2
|
+
import {BoundStoreAction} from '../store/createActionBinder'
|
|
3
|
+
import {BoundStoreAction as BoundStoreAction_2} from '../../store/createActionBinder'
|
|
1
4
|
import {ChannelInput} from '@sanity/comlink'
|
|
2
5
|
import {ChannelInstance} from '@sanity/comlink'
|
|
3
6
|
import {ClientConfig} from '@sanity/client'
|
|
4
7
|
import {Controller} from '@sanity/comlink'
|
|
5
8
|
import {CurrentUser} from '@sanity/types'
|
|
6
9
|
import {DatasetsResponse} from '@sanity/client'
|
|
10
|
+
import {DocumentPermissionsResult as DocumentPermissionsResult_2} from './permissions'
|
|
11
|
+
import {FetcherStoreState as FetcherStoreState_2} from '../_exports'
|
|
7
12
|
import {IndexTuple} from '@sanity/types'
|
|
8
13
|
import {ListenEvent} from '@sanity/client'
|
|
9
14
|
import {Message} from '@sanity/comlink'
|
|
@@ -14,13 +19,20 @@ import {Observable} from 'rxjs'
|
|
|
14
19
|
import {PatchMutation} from '@sanity/mutate/_unstable_store'
|
|
15
20
|
import {PatchOperations} from '@sanity/types'
|
|
16
21
|
import {PathSegment} from '@sanity/types'
|
|
22
|
+
import {PreviewStoreState as PreviewStoreState_2} from './previewStore'
|
|
23
|
+
import {ProjectionStoreState} from './projectionStore'
|
|
24
|
+
import {ProjectionValuePending as ProjectionValuePending_2} from './projectionStore'
|
|
17
25
|
import {ResponseQueryOptions} from '@sanity/client'
|
|
18
26
|
import {Role} from '@sanity/types'
|
|
19
27
|
import {SanityClient} from '@sanity/client'
|
|
20
28
|
import {SanityDocument} from '@sanity/types'
|
|
29
|
+
import {SanityDocument as SanityDocument_2} from '@sanity/client'
|
|
21
30
|
import {SanityDocumentLike} from '@sanity/types'
|
|
22
31
|
import {SanityProject as SanityProject_2} from '@sanity/client'
|
|
32
|
+
import {SanityUser as SanityUser_2} from './types'
|
|
33
|
+
import {StateSource as StateSource_2} from '../_exports'
|
|
23
34
|
import {Subject} from 'rxjs'
|
|
35
|
+
import {ValuePending as ValuePending_2} from './previewStore'
|
|
24
36
|
|
|
25
37
|
declare interface AccessAttributeNode extends BaseNode {
|
|
26
38
|
type: 'AccessAttribute'
|
|
@@ -34,12 +46,6 @@ declare interface AccessElementNode extends BaseNode {
|
|
|
34
46
|
index: number
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
/** @public */
|
|
38
|
-
export declare interface ActionContext<TState> {
|
|
39
|
-
instance: SanityInstance
|
|
40
|
-
state: ResourceState<TState>
|
|
41
|
-
}
|
|
42
|
-
|
|
43
49
|
/**
|
|
44
50
|
* @beta
|
|
45
51
|
* Event emitted when a precondition to applying an action fails.
|
|
@@ -76,6 +82,20 @@ export declare interface ActionsResult<TDocument extends SanityDocument = Sanity
|
|
|
76
82
|
submitted: () => ReturnType<SanityClient['action']>
|
|
77
83
|
}
|
|
78
84
|
|
|
85
|
+
declare type AllowedClientConfigKey =
|
|
86
|
+
| 'useCdn'
|
|
87
|
+
| 'token'
|
|
88
|
+
| 'perspective'
|
|
89
|
+
| 'apiHost'
|
|
90
|
+
| 'proxy'
|
|
91
|
+
| 'withCredentials'
|
|
92
|
+
| 'timeout'
|
|
93
|
+
| 'maxRetries'
|
|
94
|
+
| 'dataset'
|
|
95
|
+
| 'projectId'
|
|
96
|
+
| 'requestTagPrefix'
|
|
97
|
+
| 'useProjectHostname'
|
|
98
|
+
|
|
79
99
|
declare interface AndNode extends BaseNode {
|
|
80
100
|
type: 'And'
|
|
81
101
|
left: ExprNode
|
|
@@ -147,14 +167,14 @@ declare interface AppliedTransaction extends QueuedTransaction {
|
|
|
147
167
|
|
|
148
168
|
/** @beta */
|
|
149
169
|
export declare function applyDocumentActions<TDocument extends SanityDocument>(
|
|
150
|
-
instance: SanityInstance
|
|
170
|
+
instance: SanityInstance,
|
|
151
171
|
action: DocumentAction<TDocument> | DocumentAction<TDocument>[],
|
|
152
172
|
options?: ApplyDocumentActionsOptions,
|
|
153
173
|
): Promise<ActionsResult<TDocument>>
|
|
154
174
|
|
|
155
175
|
/** @beta */
|
|
156
176
|
export declare function applyDocumentActions(
|
|
157
|
-
instance: SanityInstance
|
|
177
|
+
instance: SanityInstance,
|
|
158
178
|
action: DocumentAction | DocumentAction[],
|
|
159
179
|
options?: ApplyDocumentActionsOptions,
|
|
160
180
|
): Promise<ActionsResult>
|
|
@@ -299,6 +319,7 @@ export declare interface AuthStoreState {
|
|
|
299
319
|
storageKey: string
|
|
300
320
|
storageArea: Storage | undefined
|
|
301
321
|
apiHost: string | undefined
|
|
322
|
+
loginUrl: string
|
|
302
323
|
callbackUrl: string | undefined
|
|
303
324
|
providedToken: string | undefined
|
|
304
325
|
}
|
|
@@ -313,9 +334,10 @@ declare interface BaseNode {
|
|
|
313
334
|
declare type BooleanValue = StaticValue<boolean, 'boolean'>
|
|
314
335
|
|
|
315
336
|
/**
|
|
316
|
-
*
|
|
337
|
+
* Represents a store action that has been bound to a specific store instance
|
|
317
338
|
*/
|
|
318
|
-
|
|
339
|
+
declare type BoundStoreAction_3<_TState, TParams extends unknown[], TReturn> = (
|
|
340
|
+
instance: SanityInstance,
|
|
319
341
|
...params: TParams
|
|
320
342
|
) => TReturn
|
|
321
343
|
|
|
@@ -339,27 +361,25 @@ declare interface ChannelEntry {
|
|
|
339
361
|
* ('project') and the global client ('global'). When set to `'global'`, the
|
|
340
362
|
* global client is used.
|
|
341
363
|
*
|
|
342
|
-
* These options are utilized by `getClient` and `getClientState` to
|
|
343
|
-
* client
|
|
344
|
-
* updates
|
|
364
|
+
* These options are utilized by `getClient` and `getClientState` to configure and
|
|
365
|
+
* return appropriate client instances that automatically handle authentication
|
|
366
|
+
* updates and configuration changes.
|
|
345
367
|
*
|
|
346
368
|
* @public
|
|
347
369
|
*/
|
|
348
|
-
export declare interface ClientOptions
|
|
370
|
+
export declare interface ClientOptions
|
|
371
|
+
extends Pick<ClientConfig, AllowedClientConfigKey>,
|
|
372
|
+
DatasetHandle {
|
|
349
373
|
/**
|
|
350
|
-
* An optional flag to choose between the
|
|
374
|
+
* An optional flag to choose between the default client (typically project-level)
|
|
351
375
|
* and the global client ('global'). When set to `'global'`, the global client
|
|
352
376
|
* is used.
|
|
353
377
|
*/
|
|
354
|
-
scope?: '
|
|
378
|
+
scope?: 'default' | 'global'
|
|
355
379
|
/**
|
|
356
380
|
* A required string indicating the API version for the client.
|
|
357
381
|
*/
|
|
358
382
|
apiVersion: string
|
|
359
|
-
/**
|
|
360
|
-
* A resource identifier for a document, in the format of `projectId.dataset`
|
|
361
|
-
*/
|
|
362
|
-
resourceId?: ResourceId
|
|
363
383
|
}
|
|
364
384
|
|
|
365
385
|
/**
|
|
@@ -367,8 +387,10 @@ export declare interface ClientOptions extends ClientConfig {
|
|
|
367
387
|
* @public
|
|
368
388
|
*/
|
|
369
389
|
export declare interface ClientState {
|
|
370
|
-
|
|
371
|
-
|
|
390
|
+
token: string | null
|
|
391
|
+
clients: {
|
|
392
|
+
[TKey in string]?: SanityClient
|
|
393
|
+
}
|
|
372
394
|
}
|
|
373
395
|
|
|
374
396
|
/**
|
|
@@ -414,70 +436,40 @@ export declare const CORE_SDK_VERSION: {}
|
|
|
414
436
|
|
|
415
437
|
/** @beta */
|
|
416
438
|
export declare function createDocument<TDocument extends SanityDocumentLike>(
|
|
417
|
-
doc: DocumentTypeHandle<TDocument
|
|
439
|
+
doc: DocumentTypeHandle<TDocument>,
|
|
418
440
|
): CreateDocumentAction<TDocument>
|
|
419
441
|
|
|
420
442
|
/** @beta */
|
|
421
443
|
export declare interface CreateDocumentAction<
|
|
422
444
|
TDocument extends SanityDocumentLike = SanityDocumentLike,
|
|
423
|
-
> {
|
|
445
|
+
> extends DocumentTypeHandle<TDocument> {
|
|
424
446
|
type: 'document.create'
|
|
425
|
-
documentId?: string
|
|
426
|
-
resourceId?: DocumentResourceId
|
|
427
|
-
documentType: TDocument['_type']
|
|
428
447
|
}
|
|
429
448
|
|
|
430
449
|
/**
|
|
431
|
-
*
|
|
450
|
+
* Creates a GROQ search filter string (`[@] match text::query("...")`)
|
|
451
|
+
* from a raw search query string.
|
|
432
452
|
*
|
|
433
|
-
*
|
|
453
|
+
* It applies wildcard ('*') logic to the last eligible token and escapes
|
|
454
|
+
* double quotes within the search term.
|
|
434
455
|
*
|
|
435
|
-
*
|
|
456
|
+
* If the input query is empty or only whitespace, it returns an empty string.
|
|
436
457
|
*
|
|
437
|
-
* @
|
|
458
|
+
* @param query - The raw input search string.
|
|
459
|
+
* @returns The GROQ search filter string, or an empty string.
|
|
460
|
+
* @internal
|
|
438
461
|
*/
|
|
439
|
-
export declare function
|
|
440
|
-
projectId,
|
|
441
|
-
dataset,
|
|
442
|
-
...config
|
|
443
|
-
}: SanityConfig): SanityInstance
|
|
462
|
+
export declare function createGroqSearchFilter(query: string): string
|
|
444
463
|
|
|
445
464
|
/**
|
|
465
|
+
* Creates a new Sanity resource instance
|
|
466
|
+
* @param config - Configuration for the instance (optional)
|
|
467
|
+
* @returns A configured SanityInstance
|
|
468
|
+
* @remarks When creating child instances, configurations are merged with parent values
|
|
469
|
+
*
|
|
446
470
|
* @public
|
|
447
471
|
*/
|
|
448
|
-
export declare
|
|
449
|
-
dispose: () => void
|
|
450
|
-
} & {
|
|
451
|
-
getState: BoundResourceAction<
|
|
452
|
-
[],
|
|
453
|
-
StateSource<{
|
|
454
|
-
users: SanityUser[]
|
|
455
|
-
totalCount: number
|
|
456
|
-
nextCursor: string | null
|
|
457
|
-
hasMore: boolean
|
|
458
|
-
options: {
|
|
459
|
-
resourceType: ResourceType
|
|
460
|
-
resourceId: string
|
|
461
|
-
/**
|
|
462
|
-
* The maximum number of users to fetch. [Default: 100]
|
|
463
|
-
*/
|
|
464
|
-
limit?: number
|
|
465
|
-
}
|
|
466
|
-
initialFetchCompleted: boolean
|
|
467
|
-
}>
|
|
468
|
-
>
|
|
469
|
-
loadMore: BoundResourceAction<[], Promise<void>>
|
|
470
|
-
resolveUsers: BoundResourceAction<[], Promise<SanityUserResponse>>
|
|
471
|
-
setOptions: BoundResourceAction<
|
|
472
|
-
[
|
|
473
|
-
options: {
|
|
474
|
-
resourceType: 'organization' | 'project'
|
|
475
|
-
resourceId: string
|
|
476
|
-
},
|
|
477
|
-
],
|
|
478
|
-
void
|
|
479
|
-
>
|
|
480
|
-
}
|
|
472
|
+
export declare function createSanityInstance(config?: SanityConfig): SanityInstance
|
|
481
473
|
|
|
482
474
|
export {CurrentUser}
|
|
483
475
|
|
|
@@ -492,6 +484,13 @@ declare interface DashboardContext {
|
|
|
492
484
|
orgId?: string
|
|
493
485
|
}
|
|
494
486
|
|
|
487
|
+
/**
|
|
488
|
+
* @public
|
|
489
|
+
*/
|
|
490
|
+
export declare interface DatasetHandle extends ProjectHandle {
|
|
491
|
+
dataset?: string | undefined
|
|
492
|
+
}
|
|
493
|
+
|
|
495
494
|
declare class DateTime {
|
|
496
495
|
date: Date
|
|
497
496
|
constructor(date: Date)
|
|
@@ -532,11 +531,9 @@ export declare function deleteDocument<TDocument extends SanityDocumentLike>(
|
|
|
532
531
|
|
|
533
532
|
/** @beta */
|
|
534
533
|
export declare interface DeleteDocumentAction<
|
|
535
|
-
|
|
536
|
-
> {
|
|
534
|
+
TDocument extends SanityDocumentLike = SanityDocumentLike,
|
|
535
|
+
> extends DocumentHandle<TDocument> {
|
|
537
536
|
type: 'document.delete'
|
|
538
|
-
documentId: string
|
|
539
|
-
resourceId?: DocumentResourceId
|
|
540
537
|
}
|
|
541
538
|
|
|
542
539
|
declare type DereferenceFunction = (obj: {
|
|
@@ -557,9 +554,7 @@ declare interface DescNode extends BaseNode {
|
|
|
557
554
|
* Calls the destroy method on the controller and resets the controller state.
|
|
558
555
|
* @public
|
|
559
556
|
*/
|
|
560
|
-
export declare const destroyController:
|
|
561
|
-
actionContext: ActionContext<ComlinkControllerState>,
|
|
562
|
-
) => void
|
|
557
|
+
export declare const destroyController: BoundStoreAction_2<ComlinkControllerState, [], void>
|
|
563
558
|
|
|
564
559
|
/** @beta */
|
|
565
560
|
export declare function discardDocument<TDocument extends SanityDocumentLike>(
|
|
@@ -568,11 +563,9 @@ export declare function discardDocument<TDocument extends SanityDocumentLike>(
|
|
|
568
563
|
|
|
569
564
|
/** @beta */
|
|
570
565
|
export declare interface DiscardDocumentAction<
|
|
571
|
-
|
|
572
|
-
> {
|
|
566
|
+
TDocument extends SanityDocumentLike = SanityDocumentLike,
|
|
567
|
+
> extends DocumentHandle<TDocument> {
|
|
573
568
|
type: 'document.discard'
|
|
574
|
-
documentId: string
|
|
575
|
-
resourceId?: DocumentResourceId
|
|
576
569
|
}
|
|
577
570
|
|
|
578
571
|
declare type Document_2 = {
|
|
@@ -644,16 +637,15 @@ export declare type DocumentEvent =
|
|
|
644
637
|
| DocumentDiscardedEvent
|
|
645
638
|
|
|
646
639
|
/**
|
|
647
|
-
* @
|
|
640
|
+
* @public
|
|
648
641
|
* A minimal set of metadata for a given document, comprising the document's ID and type.
|
|
649
642
|
* Used by most document-related hooks (such as {@link usePreview}, {@link useDocument}, and {@link useEditDocument})
|
|
650
643
|
* to reference a particular document without fetching the entire document upfront.
|
|
651
644
|
* @category Types
|
|
652
645
|
*/
|
|
653
|
-
export declare interface DocumentHandle<TDocument extends SanityDocumentLike = SanityDocumentLike>
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
resourceId?: DocumentResourceId
|
|
646
|
+
export declare interface DocumentHandle<TDocument extends SanityDocumentLike = SanityDocumentLike>
|
|
647
|
+
extends DocumentTypeHandle<TDocument> {
|
|
648
|
+
documentId: string
|
|
657
649
|
}
|
|
658
650
|
|
|
659
651
|
/** @beta */
|
|
@@ -691,12 +683,6 @@ declare interface DocumentRebaseErrorEvent {
|
|
|
691
683
|
error: unknown
|
|
692
684
|
}
|
|
693
685
|
|
|
694
|
-
/**
|
|
695
|
-
* @beta
|
|
696
|
-
* A resource identifier for a document, in the format of `document:${projectId}.${dataset}:${documentId}`
|
|
697
|
-
*/
|
|
698
|
-
export declare type DocumentResourceId = `document:${string}.${string}:${string}`
|
|
699
|
-
|
|
700
686
|
/**
|
|
701
687
|
* Represents a set of document that will go into `applyMutations`. Before
|
|
702
688
|
* applying a mutation, it's expected that all relevant documents that the
|
|
@@ -753,18 +739,17 @@ declare interface DocumentStoreState {
|
|
|
753
739
|
outgoing?: OutgoingTransaction
|
|
754
740
|
grants?: Record<Grant, ExprNode>
|
|
755
741
|
error?: unknown
|
|
756
|
-
sharedListener:
|
|
742
|
+
sharedListener: SharedListener
|
|
757
743
|
fetchDocument: (documentId: string) => Observable<SanityDocument | null>
|
|
758
744
|
events: Subject<DocumentEvent>
|
|
759
745
|
}
|
|
760
746
|
|
|
761
|
-
/** @
|
|
747
|
+
/** @public */
|
|
762
748
|
export declare interface DocumentTypeHandle<
|
|
763
749
|
TDocument extends SanityDocumentLike = SanityDocumentLike,
|
|
764
|
-
> {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
resourceId?: DocumentResourceId
|
|
750
|
+
> extends DatasetHandle {
|
|
751
|
+
documentId?: string
|
|
752
|
+
documentType: TDocument['_type']
|
|
768
753
|
}
|
|
769
754
|
|
|
770
755
|
/**
|
|
@@ -779,6 +764,7 @@ export declare interface DocumentUnpublishedEvent {
|
|
|
779
764
|
|
|
780
765
|
/** @beta */
|
|
781
766
|
export declare function editDocument<TDocument extends SanityDocumentLike>(
|
|
767
|
+
doc: DocumentHandle<TDocument>,
|
|
782
768
|
sanityMutatePatch: PatchMutation,
|
|
783
769
|
): EditDocumentAction<TDocument>
|
|
784
770
|
|
|
@@ -790,11 +776,9 @@ export declare function editDocument<TDocument extends SanityDocumentLike>(
|
|
|
790
776
|
|
|
791
777
|
/** @beta */
|
|
792
778
|
export declare interface EditDocumentAction<
|
|
793
|
-
|
|
794
|
-
> {
|
|
779
|
+
TDocument extends SanityDocumentLike = SanityDocumentLike,
|
|
780
|
+
> extends DocumentHandle<TDocument> {
|
|
795
781
|
type: 'document.edit'
|
|
796
|
-
documentId: string
|
|
797
|
-
resourceId?: DocumentResourceId
|
|
798
782
|
patches?: PatchOperations[]
|
|
799
783
|
}
|
|
800
784
|
|
|
@@ -856,12 +840,12 @@ declare type ExprNode =
|
|
|
856
840
|
* @public
|
|
857
841
|
*/
|
|
858
842
|
export declare interface FetcherStore<TParams extends unknown[], TData> {
|
|
859
|
-
getState:
|
|
843
|
+
getState: BoundStoreAction_3<
|
|
860
844
|
FetcherStoreState<TParams, TData>,
|
|
861
845
|
TParams,
|
|
862
846
|
StateSource<TData | undefined>
|
|
863
847
|
>
|
|
864
|
-
resolveState:
|
|
848
|
+
resolveState: BoundStoreAction_3<FetcherStoreState<TParams, TData>, TParams, Promise<TData>>
|
|
865
849
|
}
|
|
866
850
|
|
|
867
851
|
/**
|
|
@@ -875,21 +859,6 @@ export declare interface FetcherStoreState<TParams extends unknown[], TData> {
|
|
|
875
859
|
error?: unknown
|
|
876
860
|
}
|
|
877
861
|
|
|
878
|
-
/**
|
|
879
|
-
* @public
|
|
880
|
-
*/
|
|
881
|
-
export declare const fetchLoginUrls: ResourceAction<
|
|
882
|
-
AuthStoreState,
|
|
883
|
-
[],
|
|
884
|
-
Promise<
|
|
885
|
-
{
|
|
886
|
-
url: string
|
|
887
|
-
name: string
|
|
888
|
-
title: string
|
|
889
|
-
}[]
|
|
890
|
-
>
|
|
891
|
-
>
|
|
892
|
-
|
|
893
862
|
declare interface FilterNode extends BaseNode {
|
|
894
863
|
type: 'Filter'
|
|
895
864
|
base: ExprNode
|
|
@@ -919,60 +888,63 @@ declare interface FuncCallNode extends BaseNode {
|
|
|
919
888
|
/**
|
|
920
889
|
* @public
|
|
921
890
|
*/
|
|
922
|
-
export declare const getAuthState:
|
|
891
|
+
export declare const getAuthState: BoundStoreAction<AuthStoreState, [], StateSource_2<AuthState>>
|
|
923
892
|
|
|
924
893
|
/**
|
|
925
|
-
* Retrieves a
|
|
894
|
+
* Retrieves a Sanity client instance configured with the provided options.
|
|
926
895
|
*
|
|
927
|
-
* This function
|
|
928
|
-
* client
|
|
929
|
-
*
|
|
930
|
-
*
|
|
931
|
-
*
|
|
896
|
+
* This function returns a client instance configured for the project or as a
|
|
897
|
+
* global client based on the options provided. It ensures efficient reuse of
|
|
898
|
+
* client instances by returning the same instance for the same options.
|
|
899
|
+
* For automatic handling of authentication token updates, consider using
|
|
900
|
+
* `getClientState`.
|
|
932
901
|
*
|
|
933
902
|
* @public
|
|
934
903
|
*/
|
|
935
|
-
export declare const getClient:
|
|
904
|
+
export declare const getClient: BoundStoreAction<
|
|
905
|
+
ClientState,
|
|
906
|
+
[options: ClientOptions],
|
|
907
|
+
SanityClient
|
|
908
|
+
>
|
|
936
909
|
|
|
937
910
|
/**
|
|
938
911
|
* Returns a state source for the Sanity client instance.
|
|
939
912
|
*
|
|
940
913
|
* This function provides a subscribable state source that emits updated client
|
|
941
|
-
* instances whenever
|
|
942
|
-
*
|
|
943
|
-
* to ensure that subscribers receive the most current client configuration.
|
|
914
|
+
* instances whenever relevant configurations change (such as authentication tokens).
|
|
915
|
+
* Use this when you need to react to client configuration changes in your application.
|
|
944
916
|
*
|
|
945
917
|
* @public
|
|
946
918
|
*/
|
|
947
|
-
export declare const getClientState:
|
|
919
|
+
export declare const getClientState: BoundStoreAction<
|
|
948
920
|
ClientState,
|
|
949
921
|
[options: ClientOptions],
|
|
950
|
-
|
|
922
|
+
StateSource_2<SanityClient>
|
|
951
923
|
>
|
|
952
924
|
|
|
953
925
|
/**
|
|
954
926
|
* @public
|
|
955
927
|
*/
|
|
956
|
-
export declare const getCurrentUserState:
|
|
928
|
+
export declare const getCurrentUserState: BoundStoreAction<
|
|
957
929
|
AuthStoreState,
|
|
958
930
|
[],
|
|
959
|
-
|
|
931
|
+
StateSource_2<CurrentUser | null>
|
|
960
932
|
>
|
|
961
933
|
|
|
962
934
|
/**
|
|
963
935
|
* @public
|
|
964
936
|
*/
|
|
965
|
-
export declare const getDashboardOrganizationId:
|
|
937
|
+
export declare const getDashboardOrganizationId: BoundStoreAction<
|
|
966
938
|
AuthStoreState,
|
|
967
939
|
[],
|
|
968
|
-
|
|
940
|
+
StateSource_2<string | undefined>
|
|
969
941
|
>
|
|
970
942
|
|
|
971
943
|
/** @public */
|
|
972
|
-
export declare const getDatasetsState:
|
|
973
|
-
|
|
974
|
-
[],
|
|
975
|
-
|
|
944
|
+
export declare const getDatasetsState: BoundStoreAction<
|
|
945
|
+
FetcherStoreState_2<[options?: ProjectHandle | undefined], DatasetsResponse>,
|
|
946
|
+
[options?: ProjectHandle | undefined],
|
|
947
|
+
StateSource_2<DatasetsResponse | undefined>
|
|
976
948
|
>
|
|
977
949
|
|
|
978
950
|
/** @beta */
|
|
@@ -980,26 +952,26 @@ export declare function getDocumentState<
|
|
|
980
952
|
TDocument extends SanityDocument,
|
|
981
953
|
TPath extends JsonMatchPath<TDocument>,
|
|
982
954
|
>(
|
|
983
|
-
instance: SanityInstance
|
|
955
|
+
instance: SanityInstance,
|
|
984
956
|
doc: string | DocumentHandle<TDocument>,
|
|
985
957
|
path: TPath,
|
|
986
958
|
): StateSource<JsonMatch<TDocument, TPath> | undefined>
|
|
987
959
|
|
|
988
960
|
/** @beta */
|
|
989
961
|
export declare function getDocumentState<TDocument extends SanityDocument>(
|
|
990
|
-
instance: SanityInstance
|
|
962
|
+
instance: SanityInstance,
|
|
991
963
|
doc: string | DocumentHandle<TDocument>,
|
|
992
964
|
): StateSource<TDocument | null>
|
|
993
965
|
|
|
994
966
|
/** @beta */
|
|
995
967
|
export declare function getDocumentState(
|
|
996
|
-
instance: SanityInstance
|
|
968
|
+
instance: SanityInstance,
|
|
997
969
|
doc: string | DocumentHandle,
|
|
998
970
|
path?: string,
|
|
999
971
|
): StateSource<unknown>
|
|
1000
972
|
|
|
1001
973
|
/** @beta */
|
|
1002
|
-
export declare const getDocumentSyncStatus:
|
|
974
|
+
export declare const getDocumentSyncStatus: BoundStoreAction<
|
|
1003
975
|
DocumentStoreState,
|
|
1004
976
|
[doc: DocumentHandle<SanityDocumentLike>],
|
|
1005
977
|
StateSource<boolean | undefined>
|
|
@@ -1008,18 +980,14 @@ export declare const getDocumentSyncStatus: ResourceAction<
|
|
|
1008
980
|
/**
|
|
1009
981
|
* @public
|
|
1010
982
|
*/
|
|
1011
|
-
export declare const
|
|
1012
|
-
AuthStoreState,
|
|
1013
|
-
[],
|
|
1014
|
-
StateSource<AuthProvider[] | null>
|
|
1015
|
-
>
|
|
983
|
+
export declare const getLoginUrlState: BoundStoreAction<AuthStoreState, [], StateSource_2<string>>
|
|
1016
984
|
|
|
1017
985
|
/**
|
|
1018
986
|
* Retrieve or create a channel to be used for communication between
|
|
1019
987
|
* an application and the controller.
|
|
1020
988
|
* @public
|
|
1021
989
|
*/
|
|
1022
|
-
export declare const getOrCreateChannel:
|
|
990
|
+
export declare const getOrCreateChannel: BoundStoreAction_2<
|
|
1023
991
|
ComlinkControllerState,
|
|
1024
992
|
[options: ChannelInput],
|
|
1025
993
|
ChannelInstance<Message, Message>
|
|
@@ -1030,7 +998,7 @@ export declare const getOrCreateChannel: ResourceAction<
|
|
|
1030
998
|
* between an application and iframes.
|
|
1031
999
|
* @public
|
|
1032
1000
|
*/
|
|
1033
|
-
export declare const getOrCreateController:
|
|
1001
|
+
export declare const getOrCreateController: BoundStoreAction_2<
|
|
1034
1002
|
ComlinkControllerState,
|
|
1035
1003
|
[targetOrigin: string],
|
|
1036
1004
|
Controller
|
|
@@ -1042,40 +1010,45 @@ export declare const getOrCreateController: ResourceAction<
|
|
|
1042
1010
|
* be created within a frame / window to communicate with the controller.
|
|
1043
1011
|
* @public
|
|
1044
1012
|
*/
|
|
1045
|
-
export declare const getOrCreateNode:
|
|
1013
|
+
export declare const getOrCreateNode: BoundStoreAction_2<
|
|
1046
1014
|
ComlinkNodeState,
|
|
1047
1015
|
[options: NodeInput],
|
|
1048
1016
|
Node_2<Message, Message>
|
|
1049
1017
|
>
|
|
1050
1018
|
|
|
1051
1019
|
/** @beta */
|
|
1052
|
-
export declare const getPermissionsState:
|
|
1020
|
+
export declare const getPermissionsState: BoundStoreAction<
|
|
1053
1021
|
DocumentStoreState,
|
|
1054
|
-
[
|
|
1055
|
-
StateSource<
|
|
1022
|
+
[DocumentAction | DocumentAction[]],
|
|
1023
|
+
StateSource<DocumentPermissionsResult_2 | undefined>
|
|
1056
1024
|
>
|
|
1057
1025
|
|
|
1058
1026
|
/**
|
|
1059
1027
|
* @beta
|
|
1060
1028
|
*/
|
|
1061
|
-
export declare
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
>
|
|
1029
|
+
export declare function getPreviewState<TResult extends object>(
|
|
1030
|
+
instance: SanityInstance,
|
|
1031
|
+
options: GetPreviewStateOptions,
|
|
1032
|
+
): StateSource<ValuePending<TResult>>
|
|
1066
1033
|
|
|
1067
1034
|
/**
|
|
1068
1035
|
* @beta
|
|
1069
1036
|
*/
|
|
1070
|
-
export declare
|
|
1071
|
-
|
|
1072
|
-
|
|
1037
|
+
export declare function getPreviewState(
|
|
1038
|
+
instance: SanityInstance,
|
|
1039
|
+
options: GetPreviewStateOptions,
|
|
1040
|
+
): StateSource<ValuePending<PreviewValue>>
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* @beta
|
|
1044
|
+
*/
|
|
1045
|
+
export declare type GetPreviewStateOptions = DocumentHandle
|
|
1073
1046
|
|
|
1074
1047
|
/**
|
|
1075
1048
|
* @beta
|
|
1076
1049
|
*/
|
|
1077
1050
|
export declare function getProjectionState<TResult extends object>(
|
|
1078
|
-
instance: SanityInstance
|
|
1051
|
+
instance: SanityInstance,
|
|
1079
1052
|
options: GetProjectionStateOptions,
|
|
1080
1053
|
): StateSource<ProjectionValuePending<TResult>>
|
|
1081
1054
|
|
|
@@ -1083,27 +1056,26 @@ export declare function getProjectionState<TResult extends object>(
|
|
|
1083
1056
|
* @beta
|
|
1084
1057
|
*/
|
|
1085
1058
|
export declare function getProjectionState(
|
|
1086
|
-
instance: SanityInstance
|
|
1059
|
+
instance: SanityInstance,
|
|
1087
1060
|
options: GetProjectionStateOptions,
|
|
1088
1061
|
): StateSource<ProjectionValuePending<Record<string, unknown>>>
|
|
1089
1062
|
|
|
1090
|
-
declare interface GetProjectionStateOptions {
|
|
1091
|
-
document: DocumentHandle
|
|
1063
|
+
declare interface GetProjectionStateOptions extends DocumentHandle {
|
|
1092
1064
|
projection: ValidProjection
|
|
1093
1065
|
}
|
|
1094
1066
|
|
|
1095
1067
|
/** @public */
|
|
1096
|
-
export declare const getProjectsState:
|
|
1097
|
-
|
|
1068
|
+
export declare const getProjectsState: BoundStoreAction<
|
|
1069
|
+
FetcherStoreState_2<[], Omit<SanityProject_2, 'members'>[]>,
|
|
1098
1070
|
[],
|
|
1099
|
-
|
|
1071
|
+
StateSource_2<Omit<SanityProject_2, 'members'>[] | undefined>
|
|
1100
1072
|
>
|
|
1101
1073
|
|
|
1102
1074
|
/** @public */
|
|
1103
|
-
export declare const getProjectState:
|
|
1104
|
-
|
|
1105
|
-
[
|
|
1106
|
-
|
|
1075
|
+
export declare const getProjectState: BoundStoreAction<
|
|
1076
|
+
FetcherStoreState_2<[options?: ProjectHandle | undefined], SanityProject_2>,
|
|
1077
|
+
[options?: ProjectHandle | undefined],
|
|
1078
|
+
StateSource_2<SanityProject_2 | undefined>
|
|
1107
1079
|
>
|
|
1108
1080
|
|
|
1109
1081
|
/** @beta */
|
|
@@ -1126,30 +1098,67 @@ export declare const getQueryKey: (query: string, options?: QueryOptions) => str
|
|
|
1126
1098
|
* @beta
|
|
1127
1099
|
*/
|
|
1128
1100
|
export declare function getQueryState<T>(
|
|
1129
|
-
instance: SanityInstance
|
|
1101
|
+
instance: SanityInstance,
|
|
1130
1102
|
query: string,
|
|
1131
1103
|
options?: QueryOptions,
|
|
1132
1104
|
): StateSource<T | undefined>
|
|
1133
1105
|
|
|
1134
1106
|
/** @beta */
|
|
1135
1107
|
export declare function getQueryState(
|
|
1136
|
-
instance: SanityInstance
|
|
1108
|
+
instance: SanityInstance,
|
|
1137
1109
|
query: string,
|
|
1138
1110
|
options?: QueryOptions,
|
|
1139
1111
|
): StateSource<unknown>
|
|
1140
1112
|
|
|
1141
1113
|
/**
|
|
1142
|
-
* @
|
|
1143
|
-
* Get the resource ID from a document resource ID
|
|
1114
|
+
* @public
|
|
1144
1115
|
*/
|
|
1145
|
-
export declare
|
|
1146
|
-
|
|
1147
|
-
|
|
1116
|
+
export declare const getTokenState: BoundStoreAction<
|
|
1117
|
+
AuthStoreState,
|
|
1118
|
+
[],
|
|
1119
|
+
StateSource_2<string | null>
|
|
1120
|
+
>
|
|
1121
|
+
|
|
1122
|
+
/** @internal */
|
|
1123
|
+
export declare const getUsersKey: (
|
|
1124
|
+
instance: SanityInstance,
|
|
1125
|
+
{resourceType, organizationId, batchSize, projectId}?: GetUsersOptions,
|
|
1126
|
+
) => string
|
|
1148
1127
|
|
|
1149
1128
|
/**
|
|
1150
1129
|
* @public
|
|
1151
1130
|
*/
|
|
1152
|
-
export declare
|
|
1131
|
+
export declare interface GetUsersOptions extends ProjectHandle {
|
|
1132
|
+
resourceType?: 'organization' | 'project'
|
|
1133
|
+
batchSize?: number
|
|
1134
|
+
organizationId?: string
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Returns the state source for users associated with a specific resource.
|
|
1139
|
+
*
|
|
1140
|
+
* This function returns a state source that represents the current list of users for a given
|
|
1141
|
+
* resource. Subscribing to the state source will instruct the SDK to fetch the users (if not
|
|
1142
|
+
* already fetched) and will load more from this state source as well. When the last subscriber is
|
|
1143
|
+
* removed, the users state is automatically cleaned up from the store after a delay.
|
|
1144
|
+
*
|
|
1145
|
+
* Note: This functionality is for advanced users who want to build their own framework
|
|
1146
|
+
* integrations. Our SDK also provides a React integration for convenient usage.
|
|
1147
|
+
*
|
|
1148
|
+
* @beta
|
|
1149
|
+
*/
|
|
1150
|
+
export declare const getUsersState: BoundStoreAction<
|
|
1151
|
+
UsersStoreState,
|
|
1152
|
+
[options?: GetUsersOptions | undefined],
|
|
1153
|
+
StateSource_2<
|
|
1154
|
+
| {
|
|
1155
|
+
data: SanityUser_2[]
|
|
1156
|
+
totalCount: number
|
|
1157
|
+
hasMore: boolean
|
|
1158
|
+
}
|
|
1159
|
+
| undefined
|
|
1160
|
+
>
|
|
1161
|
+
>
|
|
1153
1162
|
|
|
1154
1163
|
declare type Grant = 'read' | 'update' | 'create' | 'history'
|
|
1155
1164
|
|
|
@@ -1191,7 +1200,7 @@ declare interface GroupNode extends BaseNode {
|
|
|
1191
1200
|
/**
|
|
1192
1201
|
* @public
|
|
1193
1202
|
*/
|
|
1194
|
-
export declare const handleAuthCallback:
|
|
1203
|
+
export declare const handleAuthCallback: BoundStoreAction<
|
|
1195
1204
|
AuthStoreState,
|
|
1196
1205
|
[locationHref?: string | undefined],
|
|
1197
1206
|
Promise<string | false>
|
|
@@ -1276,10 +1285,27 @@ export declare function jsonMatch<TValue>(input: unknown, path: string): MatchEn
|
|
|
1276
1285
|
*/
|
|
1277
1286
|
export declare type JsonMatchPath<_TDocument extends SanityDocumentLike> = string
|
|
1278
1287
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1288
|
+
/**
|
|
1289
|
+
* Loads more users for a specific resource.
|
|
1290
|
+
*
|
|
1291
|
+
* This function triggers a request to fetch the next page of users for a given resource. It
|
|
1292
|
+
* requires that users have already been loaded for the resource (via `resolveUsers` or
|
|
1293
|
+
* `getUsersState`), and that there are more users available to load (as indicated by the `hasMore`
|
|
1294
|
+
* property).
|
|
1295
|
+
*
|
|
1296
|
+
* The function returns a promise that resolves when the next page of users has been loaded.
|
|
1297
|
+
*
|
|
1298
|
+
* @beta
|
|
1299
|
+
*/
|
|
1300
|
+
export declare const loadMoreUsers: BoundStoreAction<
|
|
1301
|
+
UsersStoreState,
|
|
1302
|
+
[options?: GetUsersOptions | undefined],
|
|
1303
|
+
Promise<{
|
|
1304
|
+
data: SanityUser_2[]
|
|
1305
|
+
totalCount: number
|
|
1306
|
+
hasMore: boolean
|
|
1307
|
+
}>
|
|
1308
|
+
>
|
|
1283
1309
|
|
|
1284
1310
|
/**
|
|
1285
1311
|
* Logged-in state from the auth state.
|
|
@@ -1312,7 +1338,7 @@ export declare type LoggingInAuthState = {
|
|
|
1312
1338
|
/**
|
|
1313
1339
|
* @public
|
|
1314
1340
|
*/
|
|
1315
|
-
export declare const logout:
|
|
1341
|
+
export declare const logout: BoundStoreAction<AuthStoreState_2, [], Promise<void>>
|
|
1316
1342
|
|
|
1317
1343
|
declare interface MapNode extends BaseNode {
|
|
1318
1344
|
type: 'Map'
|
|
@@ -1494,6 +1520,14 @@ declare type ParseSegment<TInput extends string> = TInput extends `${infer TProp
|
|
|
1494
1520
|
? []
|
|
1495
1521
|
: [TInput]
|
|
1496
1522
|
|
|
1523
|
+
/** @internal */
|
|
1524
|
+
export declare const parseUsersKey: (key: string) => {
|
|
1525
|
+
batchSize: number
|
|
1526
|
+
resourceType?: 'organization' | 'project'
|
|
1527
|
+
projectId?: string
|
|
1528
|
+
organizationId?: string
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1497
1531
|
declare class Path {
|
|
1498
1532
|
private pattern
|
|
1499
1533
|
private patternRe
|
|
@@ -1558,13 +1592,10 @@ declare interface PreviewMedia {
|
|
|
1558
1592
|
/**
|
|
1559
1593
|
* @public
|
|
1560
1594
|
*/
|
|
1561
|
-
export declare interface PreviewStoreState
|
|
1595
|
+
export declare interface PreviewStoreState {
|
|
1562
1596
|
values: {
|
|
1563
1597
|
[TDocumentId in string]?: ValuePending<PreviewValue>
|
|
1564
1598
|
}
|
|
1565
|
-
documentTypes: {
|
|
1566
|
-
[TDocumentId in string]?: string
|
|
1567
|
-
}
|
|
1568
1599
|
subscriptions: {
|
|
1569
1600
|
[TDocumentId in string]?: {
|
|
1570
1601
|
[TSubscriptionId in string]?: true
|
|
@@ -1575,7 +1606,7 @@ export declare interface PreviewStoreState extends LiveEventAwareState {
|
|
|
1575
1606
|
/**
|
|
1576
1607
|
* Represents the set of values displayed as a preview for a given Sanity document.
|
|
1577
1608
|
* This includes a primary title, a secondary subtitle, an optional piece of media associated
|
|
1578
|
-
* with the document, and the document
|
|
1609
|
+
* with the document, and the document's status.
|
|
1579
1610
|
*
|
|
1580
1611
|
* @public
|
|
1581
1612
|
*/
|
|
@@ -1604,26 +1635,19 @@ export declare interface PreviewValue {
|
|
|
1604
1635
|
}
|
|
1605
1636
|
}
|
|
1606
1637
|
|
|
1638
|
+
/**
|
|
1639
|
+
* @public
|
|
1640
|
+
*/
|
|
1641
|
+
export declare interface ProjectHandle {
|
|
1642
|
+
projectId?: string | undefined
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1607
1645
|
declare interface ProjectionNode extends BaseNode {
|
|
1608
1646
|
type: 'Projection'
|
|
1609
1647
|
base: ExprNode
|
|
1610
1648
|
expr: ExprNode
|
|
1611
1649
|
}
|
|
1612
1650
|
|
|
1613
|
-
declare interface ProjectionStoreState<TValue extends object = object> extends LiveEventAwareState {
|
|
1614
|
-
values: {
|
|
1615
|
-
[TDocumentId in string]?: ProjectionValuePending<TValue>
|
|
1616
|
-
}
|
|
1617
|
-
documentProjections: {
|
|
1618
|
-
[TDocumentId in string]?: ValidProjection
|
|
1619
|
-
}
|
|
1620
|
-
subscriptions: {
|
|
1621
|
-
[TDocumentId in string]?: {
|
|
1622
|
-
[TSubscriptionId in string]?: true
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
1651
|
/**
|
|
1628
1652
|
* @beta
|
|
1629
1653
|
*/
|
|
@@ -1639,37 +1663,23 @@ export declare function publishDocument<TDocument extends SanityDocumentLike>(
|
|
|
1639
1663
|
|
|
1640
1664
|
/** @beta */
|
|
1641
1665
|
export declare interface PublishDocumentAction<
|
|
1642
|
-
|
|
1643
|
-
> {
|
|
1666
|
+
TDocument extends SanityDocumentLike = SanityDocumentLike,
|
|
1667
|
+
> extends DocumentHandle<TDocument> {
|
|
1644
1668
|
type: 'document.publish'
|
|
1645
|
-
documentId: string
|
|
1646
|
-
resourceId?: DocumentResourceId
|
|
1647
1669
|
}
|
|
1648
1670
|
|
|
1649
1671
|
/**
|
|
1650
1672
|
* @beta
|
|
1651
1673
|
*/
|
|
1652
1674
|
export declare interface QueryOptions
|
|
1653
|
-
extends Pick<
|
|
1654
|
-
|
|
1675
|
+
extends Pick<
|
|
1676
|
+
ResponseQueryOptions,
|
|
1677
|
+
'perspective' | 'useCdn' | 'cache' | 'next' | 'cacheMode' | 'tag'
|
|
1678
|
+
>,
|
|
1679
|
+
DatasetHandle {
|
|
1655
1680
|
params?: Record<string, unknown>
|
|
1656
1681
|
}
|
|
1657
1682
|
|
|
1658
|
-
declare interface QueryState {
|
|
1659
|
-
syncTags?: string[]
|
|
1660
|
-
result?: unknown
|
|
1661
|
-
error?: unknown
|
|
1662
|
-
lastLiveEventId?: string
|
|
1663
|
-
subscribers: string[]
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
declare interface QueryStoreState {
|
|
1667
|
-
queries: {
|
|
1668
|
-
[key: string]: QueryState | undefined
|
|
1669
|
-
}
|
|
1670
|
-
error?: unknown
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
1683
|
/**
|
|
1674
1684
|
* Represents a transaction that is queued to be applied but has not yet been
|
|
1675
1685
|
* applied. A transaction will remain in a queued state until all required
|
|
@@ -1697,80 +1707,81 @@ declare interface QueuedTransaction {
|
|
|
1697
1707
|
* Signals to the store that the consumer has stopped using the channel
|
|
1698
1708
|
* @public
|
|
1699
1709
|
*/
|
|
1700
|
-
export declare const releaseChannel:
|
|
1710
|
+
export declare const releaseChannel: BoundStoreAction_2<
|
|
1711
|
+
ComlinkControllerState,
|
|
1712
|
+
[name: string],
|
|
1713
|
+
void
|
|
1714
|
+
>
|
|
1701
1715
|
|
|
1702
1716
|
/**
|
|
1703
1717
|
* Signals to the store that the consumer has stopped using the node
|
|
1704
1718
|
* @public
|
|
1705
1719
|
*/
|
|
1706
|
-
export declare const releaseNode:
|
|
1720
|
+
export declare const releaseNode: BoundStoreAction_2<ComlinkNodeState, [name: string], void>
|
|
1707
1721
|
|
|
1708
1722
|
/** @public */
|
|
1709
|
-
export declare const resolveDatasets:
|
|
1710
|
-
|
|
1711
|
-
[],
|
|
1723
|
+
export declare const resolveDatasets: BoundStoreAction<
|
|
1724
|
+
FetcherStoreState_2<[options?: ProjectHandle | undefined], DatasetsResponse>,
|
|
1725
|
+
[options?: ProjectHandle | undefined],
|
|
1712
1726
|
Promise<DatasetsResponse>
|
|
1713
1727
|
>
|
|
1714
1728
|
|
|
1715
1729
|
/** @beta */
|
|
1716
1730
|
export declare function resolveDocument<TDocument extends SanityDocument>(
|
|
1717
|
-
instance: SanityInstance
|
|
1731
|
+
instance: SanityInstance,
|
|
1718
1732
|
doc: string | DocumentHandle<TDocument>,
|
|
1719
1733
|
): Promise<TDocument | null>
|
|
1720
1734
|
|
|
1721
1735
|
/** @beta */
|
|
1722
1736
|
export declare function resolveDocument(
|
|
1723
|
-
instance: SanityInstance
|
|
1737
|
+
instance: SanityInstance,
|
|
1724
1738
|
doc: string | DocumentHandle,
|
|
1725
1739
|
): Promise<SanityDocument | null>
|
|
1726
1740
|
|
|
1727
1741
|
/** @beta */
|
|
1728
|
-
export declare const resolvePermissions:
|
|
1742
|
+
export declare const resolvePermissions: BoundStoreAction<
|
|
1729
1743
|
DocumentStoreState,
|
|
1730
1744
|
[actions: DocumentAction | DocumentAction[]],
|
|
1731
|
-
Promise<
|
|
1745
|
+
Promise<DocumentPermissionsResult_2>
|
|
1732
1746
|
>
|
|
1733
1747
|
|
|
1734
1748
|
/**
|
|
1735
1749
|
* @beta
|
|
1736
1750
|
*/
|
|
1737
|
-
export declare const resolvePreview:
|
|
1738
|
-
|
|
1739
|
-
[ResolvePreviewOptions],
|
|
1740
|
-
Promise<
|
|
1751
|
+
export declare const resolvePreview: BoundStoreAction<
|
|
1752
|
+
PreviewStoreState_2,
|
|
1753
|
+
[docHandle: ResolvePreviewOptions],
|
|
1754
|
+
Promise<ValuePending_2<object>>
|
|
1741
1755
|
>
|
|
1742
1756
|
|
|
1743
1757
|
/**
|
|
1744
1758
|
* @beta
|
|
1745
1759
|
*/
|
|
1746
|
-
export declare
|
|
1747
|
-
document: DocumentHandle
|
|
1748
|
-
}
|
|
1760
|
+
export declare type ResolvePreviewOptions = DocumentHandle
|
|
1749
1761
|
|
|
1750
1762
|
/** @public */
|
|
1751
|
-
export declare const resolveProject:
|
|
1752
|
-
|
|
1753
|
-
[
|
|
1763
|
+
export declare const resolveProject: BoundStoreAction<
|
|
1764
|
+
FetcherStoreState_2<[options?: ProjectHandle | undefined], SanityProject_2>,
|
|
1765
|
+
[options?: ProjectHandle | undefined],
|
|
1754
1766
|
Promise<SanityProject_2>
|
|
1755
1767
|
>
|
|
1756
1768
|
|
|
1757
1769
|
/**
|
|
1758
1770
|
* @beta
|
|
1759
1771
|
*/
|
|
1760
|
-
export declare const resolveProjection:
|
|
1772
|
+
export declare const resolveProjection: BoundStoreAction<
|
|
1761
1773
|
ProjectionStoreState<object>,
|
|
1762
1774
|
[ResolveProjectionOptions],
|
|
1763
|
-
Promise<
|
|
1775
|
+
Promise<ProjectionValuePending_2<object>>
|
|
1764
1776
|
>
|
|
1765
1777
|
|
|
1766
|
-
declare interface ResolveProjectionOptions {
|
|
1767
|
-
document: DocumentHandle
|
|
1778
|
+
declare interface ResolveProjectionOptions extends DocumentHandle {
|
|
1768
1779
|
projection: ValidProjection
|
|
1769
1780
|
}
|
|
1770
1781
|
|
|
1771
1782
|
/** @public */
|
|
1772
|
-
export declare const resolveProjects:
|
|
1773
|
-
|
|
1783
|
+
export declare const resolveProjects: BoundStoreAction<
|
|
1784
|
+
FetcherStoreState_2<[], Omit<SanityProject_2, 'members'>[]>,
|
|
1774
1785
|
[],
|
|
1775
1786
|
Promise<Omit<SanityProject_2, 'members'>[]>
|
|
1776
1787
|
>
|
|
@@ -1790,14 +1801,14 @@ export declare const resolveProjects: ResourceAction<
|
|
|
1790
1801
|
* @beta
|
|
1791
1802
|
*/
|
|
1792
1803
|
export declare function resolveQuery<T>(
|
|
1793
|
-
instance: SanityInstance
|
|
1804
|
+
instance: SanityInstance,
|
|
1794
1805
|
query: string,
|
|
1795
1806
|
options?: ResolveQueryOptions,
|
|
1796
1807
|
): Promise<T>
|
|
1797
1808
|
|
|
1798
1809
|
/** @beta */
|
|
1799
1810
|
export declare function resolveQuery(
|
|
1800
|
-
instance: SanityInstance
|
|
1811
|
+
instance: SanityInstance,
|
|
1801
1812
|
query: string,
|
|
1802
1813
|
options?: ResolveQueryOptions,
|
|
1803
1814
|
): Promise<unknown>
|
|
@@ -1810,41 +1821,48 @@ declare interface ResolveQueryOptions extends QueryOptions {
|
|
|
1810
1821
|
}
|
|
1811
1822
|
|
|
1812
1823
|
/**
|
|
1813
|
-
*
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
*
|
|
1822
|
-
*
|
|
1824
|
+
* Resolves the users for a specific resource without registering a lasting subscriber.
|
|
1825
|
+
*
|
|
1826
|
+
* This function fetches the users for a given resource and returns a promise that resolves with
|
|
1827
|
+
* the users result. Unlike `getUsersState`, which registers subscribers to keep the data live and
|
|
1828
|
+
* performs automatic cleanup, `resolveUsers` does not track subscribers. This makes it ideal for
|
|
1829
|
+
* use with React Suspense, where the returned promise is thrown to delay rendering until the users
|
|
1830
|
+
* result becomes available. Once the promise resolves, it is expected that a real subscriber will
|
|
1831
|
+
* be added via `getUsersState` to manage ongoing updates.
|
|
1832
|
+
*
|
|
1833
|
+
* Additionally, an optional AbortSignal can be provided to cancel the request and immediately
|
|
1834
|
+
* clear the associated state if there are no active subscribers.
|
|
1835
|
+
*
|
|
1836
|
+
* @beta
|
|
1823
1837
|
*/
|
|
1824
|
-
export declare
|
|
1838
|
+
export declare const resolveUsers: BoundStoreAction<
|
|
1839
|
+
UsersStoreState,
|
|
1840
|
+
[ResolveUsersOptions],
|
|
1841
|
+
Promise<{
|
|
1842
|
+
data: SanityUser_2[]
|
|
1843
|
+
totalCount: number
|
|
1844
|
+
hasMore: boolean
|
|
1845
|
+
}>
|
|
1846
|
+
>
|
|
1825
1847
|
|
|
1826
1848
|
/**
|
|
1827
1849
|
* @public
|
|
1828
1850
|
*/
|
|
1829
|
-
export declare
|
|
1830
|
-
|
|
1831
|
-
set: (name: string, state: Partial<TState> | ((s: TState) => Partial<TState>)) => void
|
|
1832
|
-
observable: Observable<TState>
|
|
1851
|
+
export declare interface ResolveUsersOptions extends GetUsersOptions {
|
|
1852
|
+
signal?: AbortSignal
|
|
1833
1853
|
}
|
|
1834
1854
|
|
|
1835
|
-
/**
|
|
1836
|
-
* @public
|
|
1837
|
-
*/
|
|
1838
|
-
export declare type ResourceType = 'organization' | 'project'
|
|
1839
|
-
|
|
1840
1855
|
export {Role}
|
|
1841
1856
|
|
|
1842
1857
|
/**
|
|
1858
|
+
* Represents the complete configuration for a Sanity SDK instance
|
|
1843
1859
|
* @public
|
|
1844
1860
|
*/
|
|
1845
|
-
export declare interface SanityConfig {
|
|
1846
|
-
|
|
1847
|
-
|
|
1861
|
+
export declare interface SanityConfig extends DatasetHandle {
|
|
1862
|
+
/**
|
|
1863
|
+
* Authentication configuration for the instance
|
|
1864
|
+
* @remarks Merged with parent configurations when using createChild
|
|
1865
|
+
*/
|
|
1848
1866
|
auth?: AuthConfig
|
|
1849
1867
|
}
|
|
1850
1868
|
|
|
@@ -1852,17 +1870,57 @@ export {SanityDocument}
|
|
|
1852
1870
|
|
|
1853
1871
|
export {SanityDocumentLike}
|
|
1854
1872
|
|
|
1855
|
-
/**
|
|
1873
|
+
/**
|
|
1874
|
+
* Represents a Sanity.io resource instance with its own configuration and lifecycle
|
|
1875
|
+
* @remarks Instances form a hierarchy through parent/child relationships
|
|
1876
|
+
*
|
|
1877
|
+
* @public
|
|
1878
|
+
*/
|
|
1856
1879
|
export declare interface SanityInstance {
|
|
1857
1880
|
/**
|
|
1858
|
-
*
|
|
1859
|
-
*
|
|
1860
|
-
*
|
|
1861
|
-
* @public
|
|
1881
|
+
* Unique identifier for this instance
|
|
1882
|
+
* @remarks Generated using crypto.randomUUID()
|
|
1862
1883
|
*/
|
|
1863
|
-
readonly
|
|
1864
|
-
|
|
1865
|
-
|
|
1884
|
+
readonly instanceId: string
|
|
1885
|
+
/**
|
|
1886
|
+
* Resolved configuration for this instance
|
|
1887
|
+
* @remarks Merges values from parent instances where appropriate
|
|
1888
|
+
*/
|
|
1889
|
+
readonly config: SanityConfig
|
|
1890
|
+
/**
|
|
1891
|
+
* Checks if the instance has been disposed
|
|
1892
|
+
* @returns true if dispose() has been called
|
|
1893
|
+
*/
|
|
1894
|
+
isDisposed(): boolean
|
|
1895
|
+
/**
|
|
1896
|
+
* Disposes the instance and cleans up associated resources
|
|
1897
|
+
* @remarks Triggers all registered onDispose callbacks
|
|
1898
|
+
*/
|
|
1899
|
+
dispose(): void
|
|
1900
|
+
/**
|
|
1901
|
+
* Registers a callback to be invoked when the instance is disposed
|
|
1902
|
+
* @param cb - Callback to execute on disposal
|
|
1903
|
+
* @returns Function to unsubscribe the callback
|
|
1904
|
+
*/
|
|
1905
|
+
onDispose(cb: () => void): () => void
|
|
1906
|
+
/**
|
|
1907
|
+
* Gets the parent instance in the hierarchy
|
|
1908
|
+
* @returns Parent instance or undefined if this is the root
|
|
1909
|
+
*/
|
|
1910
|
+
getParent(): SanityInstance | undefined
|
|
1911
|
+
/**
|
|
1912
|
+
* Creates a child instance with merged configuration
|
|
1913
|
+
* @param config - Configuration to merge with parent values
|
|
1914
|
+
* @remarks Child instances inherit parent configuration but can override values
|
|
1915
|
+
*/
|
|
1916
|
+
createChild(config: SanityConfig): SanityInstance
|
|
1917
|
+
/**
|
|
1918
|
+
* Traverses the instance hierarchy to find the first instance whose configuration
|
|
1919
|
+
* matches the given target config using a shallow comparison.
|
|
1920
|
+
* @param targetConfig - A partial configuration object containing key-value pairs to match.
|
|
1921
|
+
* @returns The first matching instance or undefined if no match is found.
|
|
1922
|
+
*/
|
|
1923
|
+
match(targetConfig: Partial<SanityConfig>): SanityInstance | undefined
|
|
1866
1924
|
}
|
|
1867
1925
|
|
|
1868
1926
|
/**
|
|
@@ -1879,15 +1937,6 @@ export declare interface SanityUser {
|
|
|
1879
1937
|
memberships: Membership[]
|
|
1880
1938
|
}
|
|
1881
1939
|
|
|
1882
|
-
/**
|
|
1883
|
-
* @public
|
|
1884
|
-
*/
|
|
1885
|
-
declare interface SanityUserResponse {
|
|
1886
|
-
data: SanityUser[]
|
|
1887
|
-
totalCount: number
|
|
1888
|
-
nextCursor: string | null
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
1940
|
declare class Scope {
|
|
1892
1941
|
params: Record<string, unknown>
|
|
1893
1942
|
source: Value
|
|
@@ -1906,14 +1955,6 @@ declare class Scope {
|
|
|
1906
1955
|
createHidden(value: Value): Scope
|
|
1907
1956
|
}
|
|
1908
1957
|
|
|
1909
|
-
/** @public */
|
|
1910
|
-
export declare interface SdkIdentity {
|
|
1911
|
-
readonly id: string
|
|
1912
|
-
readonly projectId: string
|
|
1913
|
-
readonly dataset: string
|
|
1914
|
-
readonly resourceId: ResourceId
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
1958
|
declare interface SelectAlternativeNode extends BaseNode {
|
|
1918
1959
|
type: 'SelectAlternative'
|
|
1919
1960
|
condition: ExprNode
|
|
@@ -1926,10 +1967,56 @@ declare interface SelectNode extends BaseNode {
|
|
|
1926
1967
|
fallback?: ExprNode
|
|
1927
1968
|
}
|
|
1928
1969
|
|
|
1970
|
+
/**
|
|
1971
|
+
* Function type for selecting derived state from store state and parameters
|
|
1972
|
+
* @public
|
|
1973
|
+
*/
|
|
1974
|
+
export declare type Selector<TState, TParams extends unknown[], TReturn> = (
|
|
1975
|
+
context: SelectorContext<TState>,
|
|
1976
|
+
...params: TParams
|
|
1977
|
+
) => TReturn
|
|
1978
|
+
|
|
1979
|
+
/**
|
|
1980
|
+
* Context passed to selectors when deriving state
|
|
1981
|
+
*
|
|
1982
|
+
* @remarks
|
|
1983
|
+
* Provides access to both the current state value and the Sanity instance,
|
|
1984
|
+
* allowing selectors to use configuration values when computing derived state.
|
|
1985
|
+
* The context is memoized for each state object and instance combination
|
|
1986
|
+
* to optimize performance and prevent unnecessary recalculations.
|
|
1987
|
+
*
|
|
1988
|
+
* @example
|
|
1989
|
+
* ```ts
|
|
1990
|
+
* // Using both state and instance in a selector (psuedo example)
|
|
1991
|
+
* const getUserByProjectId = createStateSourceAction(
|
|
1992
|
+
* ({ state, instance }: SelectorContext<UsersState>, options?: ProjectHandle) => {
|
|
1993
|
+
* const allUsers = state.users
|
|
1994
|
+
* const projectId = options?.projectId ?? instance.config.projectId
|
|
1995
|
+
* return allUsers.filter(user => user.projectId === projectId)
|
|
1996
|
+
* }
|
|
1997
|
+
* )
|
|
1998
|
+
* ```
|
|
1999
|
+
*/
|
|
2000
|
+
declare interface SelectorContext<TState> {
|
|
2001
|
+
/**
|
|
2002
|
+
* The current state object from the store
|
|
2003
|
+
*/
|
|
2004
|
+
state: TState
|
|
2005
|
+
/**
|
|
2006
|
+
* The Sanity instance associated with this state
|
|
2007
|
+
*/
|
|
2008
|
+
instance: SanityInstance
|
|
2009
|
+
}
|
|
2010
|
+
|
|
1929
2011
|
declare interface SelectorNode extends BaseNode {
|
|
1930
2012
|
type: 'Selector'
|
|
1931
2013
|
}
|
|
1932
2014
|
|
|
2015
|
+
declare interface SharedListener {
|
|
2016
|
+
events: Observable<ListenEvent<SanityDocument_2>>
|
|
2017
|
+
dispose: () => void
|
|
2018
|
+
}
|
|
2019
|
+
|
|
1933
2020
|
declare type SingleValuePath = Exclude<PathSegment, IndexTuple>[]
|
|
1934
2021
|
|
|
1935
2022
|
declare interface SliceNode extends BaseNode {
|
|
@@ -1941,11 +2028,40 @@ declare interface SliceNode extends BaseNode {
|
|
|
1941
2028
|
}
|
|
1942
2029
|
|
|
1943
2030
|
/**
|
|
2031
|
+
* Represents a reactive state source that provides synchronized access to store data
|
|
2032
|
+
*
|
|
2033
|
+
* @remarks
|
|
2034
|
+
* Designed to work with React's useSyncExternalStore hook. Provides three ways to access data:
|
|
2035
|
+
* 1. `getCurrent()` for synchronous current value access
|
|
2036
|
+
* 2. `subscribe()` for imperative change notifications
|
|
2037
|
+
* 3. `observable` for reactive stream access
|
|
2038
|
+
*
|
|
1944
2039
|
* @public
|
|
1945
2040
|
*/
|
|
1946
2041
|
export declare interface StateSource<T> {
|
|
2042
|
+
/**
|
|
2043
|
+
* Subscribes to state changes with optional callback
|
|
2044
|
+
* @param onStoreChanged - Called whenever relevant state changes occur
|
|
2045
|
+
* @returns Unsubscribe function to clean up the subscription
|
|
2046
|
+
*/
|
|
1947
2047
|
subscribe: (onStoreChanged?: () => void) => () => void
|
|
2048
|
+
/**
|
|
2049
|
+
* Gets the current derived state value
|
|
2050
|
+
*
|
|
2051
|
+
* @remarks
|
|
2052
|
+
* Safe to call without subscription. Will always return the latest value
|
|
2053
|
+
* based on the current store state and selector parameters.
|
|
2054
|
+
*/
|
|
1948
2055
|
getCurrent: () => T
|
|
2056
|
+
/**
|
|
2057
|
+
* Observable stream of state values
|
|
2058
|
+
*
|
|
2059
|
+
* @remarks
|
|
2060
|
+
* Shares a single underlying subscription between all observers. Emits:
|
|
2061
|
+
* - Immediately with current value on subscription
|
|
2062
|
+
* - On every relevant state change
|
|
2063
|
+
* - Errors if selector throws
|
|
2064
|
+
*/
|
|
1949
2065
|
observable: Observable<T>
|
|
1950
2066
|
}
|
|
1951
2067
|
|
|
@@ -1960,6 +2076,7 @@ declare class StaticValue<P, T extends GroqType> {
|
|
|
1960
2076
|
|
|
1961
2077
|
declare interface StoreEntry<TParams extends unknown[], TData> {
|
|
1962
2078
|
params: TParams
|
|
2079
|
+
instance: SanityInstance
|
|
1963
2080
|
key: string
|
|
1964
2081
|
data?: TData
|
|
1965
2082
|
error?: unknown
|
|
@@ -1983,7 +2100,7 @@ declare class StreamValue {
|
|
|
1983
2100
|
declare type StringValue = StaticValue<string, 'string'>
|
|
1984
2101
|
|
|
1985
2102
|
/** @beta */
|
|
1986
|
-
export declare const subscribeDocumentEvents:
|
|
2103
|
+
export declare const subscribeDocumentEvents: BoundStoreAction<
|
|
1987
2104
|
DocumentStoreState,
|
|
1988
2105
|
[eventHandler: (e: DocumentEvent) => void],
|
|
1989
2106
|
() => void
|
|
@@ -2030,11 +2147,9 @@ export declare function unpublishDocument<TDocument extends SanityDocumentLike>(
|
|
|
2030
2147
|
|
|
2031
2148
|
/** @beta */
|
|
2032
2149
|
export declare interface UnpublishDocumentAction<
|
|
2033
|
-
|
|
2034
|
-
> {
|
|
2150
|
+
TDocument extends SanityDocumentLike = SanityDocumentLike,
|
|
2151
|
+
> extends DocumentHandle<TDocument> {
|
|
2035
2152
|
type: 'document.unpublish'
|
|
2036
|
-
documentId: string
|
|
2037
|
-
resourceId?: DocumentResourceId
|
|
2038
2153
|
}
|
|
2039
2154
|
|
|
2040
2155
|
declare interface UnverifiedDocumentRevision {
|
|
@@ -2066,20 +2181,23 @@ export declare interface UserProfile {
|
|
|
2066
2181
|
/**
|
|
2067
2182
|
* @public
|
|
2068
2183
|
*/
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
totalCount
|
|
2072
|
-
nextCursor
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2184
|
+
declare interface UsersGroupState {
|
|
2185
|
+
subscriptions: string[]
|
|
2186
|
+
totalCount?: number
|
|
2187
|
+
nextCursor?: string | null
|
|
2188
|
+
lastLoadMoreRequest?: string
|
|
2189
|
+
users?: SanityUser[]
|
|
2190
|
+
error?: unknown
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
/**
|
|
2194
|
+
* @public
|
|
2195
|
+
*/
|
|
2196
|
+
declare interface UsersStoreState {
|
|
2197
|
+
users: {
|
|
2198
|
+
[TUsersKey in string]?: UsersGroupState
|
|
2082
2199
|
}
|
|
2200
|
+
error?: unknown
|
|
2083
2201
|
}
|
|
2084
2202
|
|
|
2085
2203
|
/**
|