@sanity/sdk 0.0.0-chore-react-18-compat.1 → 0.0.0-chore-react-18-compat.3

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 (134) hide show
  1. package/dist/index.d.ts +441 -322
  2. package/dist/index.js +1685 -1481
  3. package/dist/index.js.map +1 -1
  4. package/package.json +13 -15
  5. package/src/_exports/index.ts +32 -30
  6. package/src/auth/authStore.test.ts +149 -104
  7. package/src/auth/authStore.ts +51 -100
  8. package/src/auth/handleAuthCallback.test.ts +67 -34
  9. package/src/auth/handleAuthCallback.ts +8 -7
  10. package/src/auth/logout.test.ts +61 -29
  11. package/src/auth/logout.ts +26 -28
  12. package/src/auth/refreshStampedToken.test.ts +197 -91
  13. package/src/auth/refreshStampedToken.ts +170 -59
  14. package/src/auth/subscribeToStateAndFetchCurrentUser.test.ts +5 -5
  15. package/src/auth/subscribeToStateAndFetchCurrentUser.ts +45 -47
  16. package/src/auth/subscribeToStorageEventsAndSetToken.test.ts +4 -5
  17. package/src/auth/subscribeToStorageEventsAndSetToken.ts +22 -24
  18. package/src/client/clientStore.test.ts +131 -67
  19. package/src/client/clientStore.ts +117 -116
  20. package/src/comlink/controller/actions/destroyController.test.ts +38 -13
  21. package/src/comlink/controller/actions/destroyController.ts +11 -15
  22. package/src/comlink/controller/actions/getOrCreateChannel.test.ts +56 -27
  23. package/src/comlink/controller/actions/getOrCreateChannel.ts +37 -35
  24. package/src/comlink/controller/actions/getOrCreateController.test.ts +27 -16
  25. package/src/comlink/controller/actions/getOrCreateController.ts +23 -22
  26. package/src/comlink/controller/actions/releaseChannel.test.ts +37 -13
  27. package/src/comlink/controller/actions/releaseChannel.ts +22 -21
  28. package/src/comlink/controller/comlinkControllerStore.test.ts +65 -36
  29. package/src/comlink/controller/comlinkControllerStore.ts +44 -5
  30. package/src/comlink/node/actions/getOrCreateNode.test.ts +31 -15
  31. package/src/comlink/node/actions/getOrCreateNode.ts +30 -29
  32. package/src/comlink/node/actions/releaseNode.test.ts +75 -55
  33. package/src/comlink/node/actions/releaseNode.ts +19 -21
  34. package/src/comlink/node/comlinkNodeStore.test.ts +6 -11
  35. package/src/comlink/node/comlinkNodeStore.ts +22 -5
  36. package/src/config/authConfig.ts +79 -0
  37. package/src/config/sanityConfig.ts +48 -0
  38. package/src/datasets/datasets.test.ts +2 -2
  39. package/src/datasets/datasets.ts +18 -5
  40. package/src/document/actions.test.ts +22 -10
  41. package/src/document/actions.ts +44 -56
  42. package/src/document/applyDocumentActions.test.ts +96 -36
  43. package/src/document/applyDocumentActions.ts +140 -99
  44. package/src/document/documentStore.test.ts +103 -155
  45. package/src/document/documentStore.ts +247 -238
  46. package/src/document/listen.ts +56 -55
  47. package/src/document/patchOperations.ts +0 -43
  48. package/src/document/permissions.test.ts +25 -12
  49. package/src/document/permissions.ts +11 -4
  50. package/src/document/processActions.test.ts +41 -8
  51. package/src/document/reducers.test.ts +87 -16
  52. package/src/document/reducers.ts +2 -2
  53. package/src/document/sharedListener.test.ts +34 -16
  54. package/src/document/sharedListener.ts +33 -11
  55. package/src/preview/getPreviewState.test.ts +40 -39
  56. package/src/preview/getPreviewState.ts +68 -56
  57. package/src/preview/previewConstants.ts +43 -0
  58. package/src/preview/previewQuery.test.ts +1 -1
  59. package/src/preview/previewQuery.ts +4 -5
  60. package/src/preview/previewStore.test.ts +13 -58
  61. package/src/preview/previewStore.ts +7 -21
  62. package/src/preview/resolvePreview.test.ts +33 -104
  63. package/src/preview/resolvePreview.ts +11 -21
  64. package/src/preview/subscribeToStateAndFetchBatches.test.ts +96 -97
  65. package/src/preview/subscribeToStateAndFetchBatches.ts +85 -81
  66. package/src/preview/util.ts +1 -0
  67. package/src/project/project.test.ts +3 -3
  68. package/src/project/project.ts +28 -5
  69. package/src/projection/getProjectionState.test.ts +188 -72
  70. package/src/projection/getProjectionState.ts +92 -62
  71. package/src/projection/projectionQuery.test.ts +114 -12
  72. package/src/projection/projectionQuery.ts +75 -32
  73. package/src/projection/projectionStore.test.ts +13 -51
  74. package/src/projection/projectionStore.ts +6 -43
  75. package/src/projection/resolveProjection.test.ts +32 -127
  76. package/src/projection/resolveProjection.ts +16 -28
  77. package/src/projection/subscribeToStateAndFetchBatches.test.ts +203 -116
  78. package/src/projection/subscribeToStateAndFetchBatches.ts +140 -85
  79. package/src/projection/types.ts +50 -0
  80. package/src/projection/util.ts +3 -1
  81. package/src/projects/projects.test.ts +13 -4
  82. package/src/projects/projects.ts +6 -1
  83. package/src/query/queryStore.test.ts +10 -47
  84. package/src/query/queryStore.ts +151 -133
  85. package/src/query/queryStoreConstants.ts +2 -0
  86. package/src/store/createActionBinder.test.ts +153 -0
  87. package/src/store/createActionBinder.ts +176 -0
  88. package/src/store/createSanityInstance.test.ts +84 -0
  89. package/src/store/createSanityInstance.ts +124 -0
  90. package/src/store/createStateSourceAction.test.ts +196 -0
  91. package/src/store/createStateSourceAction.ts +260 -0
  92. package/src/store/createStoreInstance.test.ts +81 -0
  93. package/src/store/createStoreInstance.ts +80 -0
  94. package/src/store/createStoreState.test.ts +85 -0
  95. package/src/store/createStoreState.ts +92 -0
  96. package/src/store/defineStore.test.ts +18 -0
  97. package/src/store/defineStore.ts +81 -0
  98. package/src/users/reducers.test.ts +318 -0
  99. package/src/users/reducers.ts +88 -0
  100. package/src/users/types.ts +46 -4
  101. package/src/users/usersConstants.ts +4 -0
  102. package/src/users/usersStore.test.ts +350 -223
  103. package/src/users/usersStore.ts +285 -149
  104. package/src/utils/createFetcherStore.test.ts +6 -7
  105. package/src/utils/createFetcherStore.ts +150 -153
  106. package/src/utils/createGroqSearchFilter.test.ts +75 -0
  107. package/src/utils/createGroqSearchFilter.ts +85 -0
  108. package/src/{common/util.test.ts → utils/hashString.test.ts} +1 -1
  109. package/dist/index.cjs +0 -4888
  110. package/dist/index.cjs.map +0 -1
  111. package/dist/index.d.cts +0 -2121
  112. package/src/auth/fetchLoginUrls.test.ts +0 -163
  113. package/src/auth/fetchLoginUrls.ts +0 -74
  114. package/src/common/createLiveEventSubscriber.test.ts +0 -121
  115. package/src/common/createLiveEventSubscriber.ts +0 -55
  116. package/src/common/types.ts +0 -4
  117. package/src/instance/identity.test.ts +0 -46
  118. package/src/instance/identity.ts +0 -29
  119. package/src/instance/sanityInstance.test.ts +0 -77
  120. package/src/instance/sanityInstance.ts +0 -57
  121. package/src/instance/types.ts +0 -37
  122. package/src/preview/getPreviewProjection.ts +0 -45
  123. package/src/resources/README.md +0 -370
  124. package/src/resources/createAction.test.ts +0 -101
  125. package/src/resources/createAction.ts +0 -44
  126. package/src/resources/createResource.test.ts +0 -112
  127. package/src/resources/createResource.ts +0 -102
  128. package/src/resources/createStateSourceAction.test.ts +0 -114
  129. package/src/resources/createStateSourceAction.ts +0 -83
  130. package/src/resources/createStore.test.ts +0 -67
  131. package/src/resources/createStore.ts +0 -46
  132. package/src/store/createStore.test.ts +0 -108
  133. package/src/store/createStore.ts +0 -106
  134. /package/src/{common/util.ts → utils/hashString.ts} +0 -0
package/dist/index.d.cts DELETED
@@ -1,2121 +0,0 @@
1
- import {ChannelInput} from '@sanity/comlink'
2
- import {ChannelInstance} from '@sanity/comlink'
3
- import {ClientConfig} from '@sanity/client'
4
- import {Controller} from '@sanity/comlink'
5
- import {CurrentUser} from '@sanity/types'
6
- import {DatasetsResponse} from '@sanity/client'
7
- import {IndexTuple} from '@sanity/types'
8
- import {ListenEvent} from '@sanity/client'
9
- import {Message} from '@sanity/comlink'
10
- import {Mutation} from '@sanity/types'
11
- import {Node as Node_2} from '@sanity/comlink'
12
- import {NodeInput} from '@sanity/comlink'
13
- import {Observable} from 'rxjs'
14
- import {PatchMutation} from '@sanity/mutate/_unstable_store'
15
- import {PatchOperations} from '@sanity/types'
16
- import {PathSegment} from '@sanity/types'
17
- import {ResponseQueryOptions} from '@sanity/client'
18
- import {Role} from '@sanity/types'
19
- import {SanityClient} from '@sanity/client'
20
- import {SanityDocument} from '@sanity/types'
21
- import {SanityDocumentLike} from '@sanity/types'
22
- import {SanityProject as SanityProject_2} from '@sanity/client'
23
- import {Subject} from 'rxjs'
24
-
25
- declare interface AccessAttributeNode extends BaseNode {
26
- type: 'AccessAttribute'
27
- base?: ExprNode
28
- name: string
29
- }
30
-
31
- declare interface AccessElementNode extends BaseNode {
32
- type: 'AccessElement'
33
- base: ExprNode
34
- index: number
35
- }
36
-
37
- /** @public */
38
- export declare interface ActionContext<TState> {
39
- instance: SanityInstance
40
- state: ResourceState<TState>
41
- }
42
-
43
- /**
44
- * @beta
45
- * Event emitted when a precondition to applying an action fails.
46
- * (For example: when trying to edit a document that no longer exists.)
47
- */
48
- export declare interface ActionErrorEvent {
49
- type: 'error'
50
- documentId: string
51
- transactionId: string
52
- message: string
53
- error: unknown
54
- }
55
-
56
- declare type ActionMap = {
57
- create: 'sanity.action.document.version.create'
58
- discard: 'sanity.action.document.version.discard'
59
- unpublish: 'sanity.action.document.unpublish'
60
- delete: 'sanity.action.document.delete'
61
- edit: 'sanity.action.document.edit'
62
- publish: 'sanity.action.document.publish'
63
- }
64
-
65
- /** @beta */
66
- export declare interface ActionsResult<TDocument extends SanityDocument = SanityDocument> {
67
- transactionId: string
68
- documents: DocumentSet<TDocument>
69
- previous: DocumentSet<TDocument>
70
- previousRevs: {
71
- [documentId: string]: string | undefined
72
- }
73
- appeared: string[]
74
- updated: string[]
75
- disappeared: string[]
76
- submitted: () => ReturnType<SanityClient['action']>
77
- }
78
-
79
- declare interface AndNode extends BaseNode {
80
- type: 'And'
81
- left: ExprNode
82
- right: ExprNode
83
- }
84
-
85
- declare type AnyStaticValue =
86
- | StringValue
87
- | NumberValue
88
- | NullValue
89
- | BooleanValue
90
- | DateTimeValue
91
- | ObjectValue
92
- | ArrayValue
93
- | PathValue
94
-
95
- /**
96
- * Represents a transaction that has been applied locally but has not been
97
- * committed/transitioned-to-outgoing. These transactions are visible to the
98
- * user but may be rebased upon a new working document set. Applied transactions
99
- * also contain the resulting `outgoingActions` that will be submitted to
100
- * Content Lake. These `outgoingActions` depend on the state of the working
101
- * documents so they are recomputed on rebase and are only relevant to applied
102
- * actions (we cannot compute `outgoingActions` for queued transactions because
103
- * we haven't resolved the set of documents the actions are dependent on yet).
104
- *
105
- * In order to support better conflict resolution, the original `previous` set
106
- * is saved as the `base` set.
107
- */
108
- declare interface AppliedTransaction extends QueuedTransaction {
109
- /**
110
- * the resulting set of documents after the actions have been applied
111
- */
112
- working: DocumentSet
113
- /**
114
- * the previous set of documents before the action was applied
115
- */
116
- previous: DocumentSet
117
- /**
118
- * the original `previous` document set captured when this action was
119
- * originally applied. this is used as a reference point to do a 3-way merge
120
- * if this applied transaction ever needs to be reapplied on a different
121
- * set of documents.
122
- */
123
- base: DocumentSet
124
- /**
125
- * the `_rev`s from `previous` document set
126
- */
127
- previousRevs: {
128
- [TDocumentId in string]?: string
129
- }
130
- /**
131
- * a timestamp for when this transaction was applied locally
132
- */
133
- timestamp: string
134
- /**
135
- * the resulting HTTP actions derived from the state of the `working` document
136
- * set. these are sent to Content Lake as-is when this transaction is batched
137
- * and transitioned into an outgoing transaction.
138
- */
139
- outgoingActions: HttpAction[]
140
- /**
141
- * similar to `outgoingActions` but comprised of mutations instead of action.
142
- * this left here for debugging purposes but could be used to send mutations
143
- * to Content Lake instead of actions.
144
- */
145
- outgoingMutations: Mutation[]
146
- }
147
-
148
- /** @beta */
149
- export declare function applyDocumentActions<TDocument extends SanityDocument>(
150
- instance: SanityInstance | ActionContext<DocumentStoreState>,
151
- action: DocumentAction<TDocument> | DocumentAction<TDocument>[],
152
- options?: ApplyDocumentActionsOptions,
153
- ): Promise<ActionsResult<TDocument>>
154
-
155
- /** @beta */
156
- export declare function applyDocumentActions(
157
- instance: SanityInstance | ActionContext<DocumentStoreState>,
158
- action: DocumentAction | DocumentAction[],
159
- options?: ApplyDocumentActionsOptions,
160
- ): Promise<ActionsResult>
161
-
162
- /** @beta */
163
- export declare interface ApplyDocumentActionsOptions {
164
- /**
165
- * Optionally provide an ID to be used as this transaction ID
166
- */
167
- transactionId?: string
168
- /**
169
- * Set this to true to prevent this action from being batched with others.
170
- */
171
- disableBatching?: boolean
172
- }
173
-
174
- declare interface ArrayCoerceNode extends BaseNode {
175
- type: 'ArrayCoerce'
176
- base: ExprNode
177
- }
178
-
179
- declare interface ArrayElementNode extends BaseNode {
180
- type: 'ArrayElement'
181
- value: ExprNode
182
- isSplat: boolean
183
- }
184
-
185
- declare interface ArrayNode extends BaseNode {
186
- type: 'Array'
187
- elements: ArrayElementNode[]
188
- }
189
-
190
- declare type ArrayValue = StaticValue<unknown[], 'array'>
191
-
192
- declare interface AscNode extends BaseNode {
193
- type: 'Asc'
194
- base: ExprNode
195
- }
196
-
197
- /**
198
- * Configuration options for creating an auth store.
199
- *
200
- * @public
201
- */
202
- export declare interface AuthConfig {
203
- /**
204
- * The initial location href to use when handling auth callbacks.
205
- * Defaults to the current window location if available.
206
- */
207
- initialLocationHref?: string
208
- /**
209
- * Factory function to create a SanityClient instance.
210
- * Defaults to the standard Sanity client factory if not provided.
211
- */
212
- clientFactory?: (config: ClientConfig) => SanityClient
213
- /**
214
- * Custom authentication providers to use instead of or in addition to the default ones.
215
- * Can be an array of providers or a function that takes the default providers and returns
216
- * a modified array or a Promise resolving to one.
217
- */
218
- providers?: AuthProvider[] | ((prev: AuthProvider[]) => AuthProvider[] | Promise<AuthProvider[]>)
219
- /**
220
- * The API hostname for requests. Usually leave this undefined, but it can be set
221
- * if using a custom domain or CNAME for the API endpoint.
222
- */
223
- apiHost?: string
224
- /**
225
- * Storage implementation to persist authentication state.
226
- * Defaults to `localStorage` if available.
227
- */
228
- storageArea?: Storage
229
- /**
230
- * A callback URL for your application.
231
- * If none is provided, the auth API will redirect back to the current location (`location.href`).
232
- * When handling callbacks, this URL's pathname is checked to ensure it matches the callback.
233
- */
234
- callbackUrl?: string
235
- /**
236
- * A static authentication token to use instead of handling the OAuth flow.
237
- * When provided, the auth store will remain in a logged-in state with this token,
238
- * ignoring any storage or callback handling.
239
- */
240
- token?: string
241
- }
242
-
243
- /**
244
- * Configuration for an authentication provider
245
- * @public
246
- */
247
- export declare interface AuthProvider {
248
- /**
249
- * Unique identifier for the auth provider (e.g., 'google', 'github')
250
- */
251
- name: string
252
- /**
253
- * Display name for the auth provider in the UI
254
- */
255
- title: string
256
- /**
257
- * Complete authentication URL including callback and token parameters
258
- */
259
- url: string
260
- /**
261
- * Optional URL for direct sign-up flow
262
- */
263
- signUpUrl?: string
264
- }
265
-
266
- /**
267
- * Represents the various states the authentication can be in.
268
- *
269
- * @public
270
- */
271
- export declare type AuthState =
272
- | LoggedInAuthState
273
- | LoggedOutAuthState
274
- | LoggingInAuthState
275
- | ErrorAuthState
276
-
277
- /**
278
- * Represents the various states the authentication type can be in.
279
- *
280
- * @public
281
- */
282
- export declare enum AuthStateType {
283
- LOGGED_IN = 'logged-in',
284
- LOGGING_IN = 'logging-in',
285
- ERROR = 'error',
286
- LOGGED_OUT = 'logged-out',
287
- }
288
-
289
- /**
290
- * @public
291
- */
292
- export declare interface AuthStoreState {
293
- authState: AuthState
294
- providers?: AuthProvider[]
295
- options: {
296
- initialLocationHref: string
297
- clientFactory: (config: ClientConfig) => SanityClient
298
- customProviders: AuthConfig['providers']
299
- storageKey: string
300
- storageArea: Storage | undefined
301
- apiHost: string | undefined
302
- callbackUrl: string | undefined
303
- providedToken: string | undefined
304
- }
305
- dashboardContext?: DashboardContext
306
- }
307
-
308
- /** The base interface for SyntaxNode. */
309
- declare interface BaseNode {
310
- type: string
311
- }
312
-
313
- declare type BooleanValue = StaticValue<boolean, 'boolean'>
314
-
315
- /**
316
- * @public
317
- */
318
- export declare type BoundResourceAction<TParams extends unknown[], TReturn> = (
319
- ...params: TParams
320
- ) => TReturn
321
-
322
- /**
323
- * Individual channel with its relevant options
324
- * @public
325
- */
326
- declare interface ChannelEntry {
327
- channel: ChannelInstance<FrameMessage, WindowMessage>
328
- options: ChannelInput
329
- refCount: number
330
- }
331
-
332
- /**
333
- * Options used when retrieving a client instance from the client store.
334
- *
335
- * This interface extends the base {@link ClientConfig} and adds:
336
- *
337
- * - **apiVersion:** A required string indicating the API version for the client.
338
- * - **scope:** An optional flag to choose between the project-specific client
339
- * ('project') and the global client ('global'). When set to `'global'`, the
340
- * global client is used.
341
- *
342
- * These options are utilized by `getClient` and `getClientState` to return a memoized
343
- * client instance, ensuring that clients are reused for identical configurations and that
344
- * updates (such as auth token changes) propagate correctly.
345
- *
346
- * @public
347
- */
348
- export declare interface ClientOptions extends ClientConfig {
349
- /**
350
- * An optional flag to choose between the project-specific client ('project')
351
- * and the global client ('global'). When set to `'global'`, the global client
352
- * is used.
353
- */
354
- scope?: 'project' | 'global'
355
- /**
356
- * A required string indicating the API version for the client.
357
- */
358
- apiVersion: string
359
- /**
360
- * A resource identifier for a document, in the format of `projectId.dataset`
361
- */
362
- resourceId?: ResourceId
363
- }
364
-
365
- /**
366
- * States tracked by the client store
367
- * @public
368
- */
369
- export declare interface ClientState {
370
- defaultClient: SanityClient
371
- defaultGlobalClient: SanityClient
372
- }
373
-
374
- /**
375
- * Internal state tracking comlink connections
376
- * @public
377
- */
378
- export declare interface ComlinkControllerState {
379
- controller: Controller | null
380
- controllerOrigin: string | null
381
- channels: Map<string, ChannelEntry>
382
- }
383
-
384
- /**
385
- * Internal state tracking comlink connections
386
- * @public
387
- */
388
- export declare interface ComlinkNodeState {
389
- nodes: Map<string, NodeEntry>
390
- }
391
-
392
- declare interface Context {
393
- timestamp: Date
394
- identity: string
395
- before: Value | null
396
- after: Value | null
397
- sanity?: {
398
- projectId: string
399
- dataset: string
400
- }
401
- dereference?: DereferenceFunction
402
- }
403
-
404
- declare interface ContextNode extends BaseNode {
405
- type: 'Context'
406
- key: string
407
- }
408
-
409
- /**
410
- * This version is provided by pkg-utils at build time
411
- * @internal
412
- */
413
- export declare const CORE_SDK_VERSION: {}
414
-
415
- /** @beta */
416
- export declare function createDocument<TDocument extends SanityDocumentLike>(
417
- doc: DocumentTypeHandle<TDocument> | DocumentHandle<TDocument>,
418
- ): CreateDocumentAction<TDocument>
419
-
420
- /** @beta */
421
- export declare interface CreateDocumentAction<
422
- TDocument extends SanityDocumentLike = SanityDocumentLike,
423
- > {
424
- type: 'document.create'
425
- documentId?: string
426
- resourceId?: DocumentResourceId
427
- documentType: TDocument['_type']
428
- }
429
-
430
- /**
431
- * Returns a new instance of dependencies required for SanitySDK.
432
- *
433
- * @public
434
- *
435
- * @param config - The configuration for this instance
436
- *
437
- * @returns A new "instance" of a Sanity SDK, used to bind resources/configuration to it
438
- */
439
- export declare function createSanityInstance({
440
- projectId,
441
- dataset,
442
- ...config
443
- }: SanityConfig): SanityInstance
444
-
445
- /**
446
- * @public
447
- */
448
- export declare const createUsersStore: (instance: SanityInstance | ActionContext<any>) => {
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
- }
481
-
482
- export {CurrentUser}
483
-
484
- /**
485
- * Represents the various states the authentication can be in.
486
- *
487
- * @public
488
- */
489
- declare interface DashboardContext {
490
- mode?: string
491
- env?: string
492
- orgId?: string
493
- }
494
-
495
- declare class DateTime {
496
- date: Date
497
- constructor(date: Date)
498
- static parseToValue(str: string): Value
499
- equals(other: DateTime): boolean
500
- add(secs: number): DateTime
501
- difference(other: DateTime): number
502
- compareTo(other: DateTime): number
503
- toString(): string
504
- toJSON(): string
505
- }
506
-
507
- declare type DateTimeValue = StaticValue<DateTime, 'datetime'>
508
-
509
- /**
510
- * Given a type T and an array of “access keys” Parts, recursively index into T.
511
- *
512
- * If a part is a key, it looks up that property.
513
- * If T is an array and the part is a number, it “indexes” into the element type.
514
- */
515
- declare type DeepGet<T, TParts extends readonly unknown[]> = TParts extends [
516
- infer Head,
517
- ...infer Tail,
518
- ]
519
- ? Head extends keyof T
520
- ? DeepGet<T[Head], Tail>
521
- : T extends Array<infer U>
522
- ? Head extends number
523
- ? DeepGet<U, Tail>
524
- : never
525
- : never
526
- : T
527
-
528
- /** @beta */
529
- export declare function deleteDocument<TDocument extends SanityDocumentLike>(
530
- doc: DocumentHandle<TDocument>,
531
- ): DeleteDocumentAction<TDocument>
532
-
533
- /** @beta */
534
- export declare interface DeleteDocumentAction<
535
- _TDocument extends SanityDocumentLike = SanityDocumentLike,
536
- > {
537
- type: 'document.delete'
538
- documentId: string
539
- resourceId?: DocumentResourceId
540
- }
541
-
542
- declare type DereferenceFunction = (obj: {
543
- _ref: string
544
- }) => PromiseLike<Document_2 | null | undefined>
545
-
546
- declare interface DerefNode extends BaseNode {
547
- type: 'Deref'
548
- base: ExprNode
549
- }
550
-
551
- declare interface DescNode extends BaseNode {
552
- type: 'Desc'
553
- base: ExprNode
554
- }
555
-
556
- /**
557
- * Calls the destroy method on the controller and resets the controller state.
558
- * @public
559
- */
560
- export declare const destroyController: (
561
- actionContext: ActionContext<ComlinkControllerState>,
562
- ) => void
563
-
564
- /** @beta */
565
- export declare function discardDocument<TDocument extends SanityDocumentLike>(
566
- doc: DocumentHandle<TDocument>,
567
- ): DiscardDocumentAction<TDocument>
568
-
569
- /** @beta */
570
- export declare interface DiscardDocumentAction<
571
- _TDocument extends SanityDocumentLike = SanityDocumentLike,
572
- > {
573
- type: 'document.discard'
574
- documentId: string
575
- resourceId?: DocumentResourceId
576
- }
577
-
578
- declare type Document_2 = {
579
- _id?: string
580
- _type?: string
581
- [T: string]: unknown
582
- }
583
-
584
- /** @beta */
585
- export declare type DocumentAction<TDocument extends SanityDocumentLike = SanityDocumentLike> =
586
- | CreateDocumentAction<TDocument>
587
- | DeleteDocumentAction<TDocument>
588
- | EditDocumentAction<TDocument>
589
- | PublishDocumentAction<TDocument>
590
- | UnpublishDocumentAction<TDocument>
591
- | DiscardDocumentAction<TDocument>
592
-
593
- /**
594
- * @beta
595
- * Event emitted when a document is created.
596
- */
597
- export declare interface DocumentCreatedEvent {
598
- type: 'created'
599
- documentId: string
600
- outgoing: OutgoingTransaction
601
- }
602
-
603
- /**
604
- * @beta
605
- * Event emitted when a document is deleted.
606
- */
607
- export declare interface DocumentDeletedEvent {
608
- type: 'deleted'
609
- documentId: string
610
- outgoing: OutgoingTransaction
611
- }
612
-
613
- /**
614
- * @beta
615
- * Event emitted when a document version is discarded.
616
- */
617
- export declare interface DocumentDiscardedEvent {
618
- type: 'discarded'
619
- documentId: string
620
- outgoing: OutgoingTransaction
621
- }
622
-
623
- /**
624
- * @beta
625
- * Event emitted when a document is edited.
626
- */
627
- export declare interface DocumentEditedEvent {
628
- type: 'edited'
629
- documentId: string
630
- outgoing: OutgoingTransaction
631
- }
632
-
633
- /** @beta */
634
- export declare type DocumentEvent =
635
- | ActionErrorEvent
636
- | TransactionRevertedEvent
637
- | TransactionAcceptedEvent
638
- | DocumentRebaseErrorEvent
639
- | DocumentEditedEvent
640
- | DocumentCreatedEvent
641
- | DocumentDeletedEvent
642
- | DocumentPublishedEvent
643
- | DocumentUnpublishedEvent
644
- | DocumentDiscardedEvent
645
-
646
- /**
647
- * @beta
648
- * A minimal set of metadata for a given document, comprising the document's ID and type.
649
- * Used by most document-related hooks (such as {@link usePreview}, {@link useDocument}, and {@link useEditDocument})
650
- * to reference a particular document without fetching the entire document upfront.
651
- * @category Types
652
- */
653
- export declare interface DocumentHandle<TDocument extends SanityDocumentLike = SanityDocumentLike> {
654
- _id: string
655
- _type: TDocument['_type']
656
- resourceId?: DocumentResourceId
657
- }
658
-
659
- /** @beta */
660
- export declare type DocumentPermissionsResult =
661
- | {
662
- allowed: false
663
- message: string
664
- reasons: PermissionDeniedReason[]
665
- }
666
- | {
667
- allowed: true
668
- message?: undefined
669
- reasons?: undefined
670
- }
671
-
672
- /**
673
- * @beta
674
- * Event emitted when a document is published.
675
- */
676
- export declare interface DocumentPublishedEvent {
677
- type: 'published'
678
- documentId: string
679
- outgoing: OutgoingTransaction
680
- }
681
-
682
- /**
683
- * @beta
684
- * Event emitted when an attempt to apply local changes to a modified remote document fails.
685
- */
686
- declare interface DocumentRebaseErrorEvent {
687
- type: 'rebase-error'
688
- documentId: string
689
- transactionId: string
690
- message: string
691
- error: unknown
692
- }
693
-
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
- /**
701
- * Represents a set of document that will go into `applyMutations`. Before
702
- * applying a mutation, it's expected that all relevant documents that the
703
- * mutations affect are included, including those that do not exist yet.
704
- * Documents that don't exist have a `null` value.
705
- */
706
- declare type DocumentSet<TDocument extends SanityDocument = SanityDocument> = {
707
- [TDocumentId in string]?: TDocument | null
708
- }
709
-
710
- declare interface DocumentState {
711
- id: string
712
- /**
713
- * the "remote" local copy that matches the server. represents the last known
714
- * server state. this gets updated every time we confirm remote patches
715
- */
716
- remote?: SanityDocument | null
717
- /**
718
- * the current ephemeral working copy that includes local optimistic changes
719
- * that have not yet been confirmed by the server
720
- */
721
- local?: SanityDocument | null
722
- /**
723
- * the revision that our remote document is at
724
- */
725
- remoteRev?: string | null
726
- /**
727
- * Array of subscription IDs. This document state will be deleted if there are
728
- * no subscribers.
729
- */
730
- subscriptions: string[]
731
- /**
732
- * An object keyed by transaction ID of revisions sent out but that have not
733
- * yet been verified yet. When an applied transaction is transitioned to an
734
- * outgoing transaction, it also adds unverified revisions for each document
735
- * that is part of that outgoing transaction. Transactions are submitted to
736
- * the server with a locally generated transaction ID. This way we can observe
737
- * when our transaction comes back through the shared listener. Each listener
738
- * event that comes back contains a `previousRev`. If we see our own
739
- * transaction with a different `previousRev` than expected, we can rebase our
740
- * local transactions on top of this new remote.
741
- */
742
- unverifiedRevisions?: {
743
- [TTransactionId in string]?: UnverifiedDocumentRevision
744
- }
745
- }
746
-
747
- declare interface DocumentStoreState {
748
- documentStates: {
749
- [TDocumentId in string]?: DocumentState
750
- }
751
- queued: QueuedTransaction[]
752
- applied: AppliedTransaction[]
753
- outgoing?: OutgoingTransaction
754
- grants?: Record<Grant, ExprNode>
755
- error?: unknown
756
- sharedListener: Observable<ListenEvent<SanityDocument>>
757
- fetchDocument: (documentId: string) => Observable<SanityDocument | null>
758
- events: Subject<DocumentEvent>
759
- }
760
-
761
- /** @beta */
762
- export declare interface DocumentTypeHandle<
763
- TDocument extends SanityDocumentLike = SanityDocumentLike,
764
- > {
765
- _id?: string
766
- _type: TDocument['_type']
767
- resourceId?: DocumentResourceId
768
- }
769
-
770
- /**
771
- * @beta
772
- * Event emitted when a document is unpublished.
773
- */
774
- export declare interface DocumentUnpublishedEvent {
775
- type: 'unpublished'
776
- documentId: string
777
- outgoing: OutgoingTransaction
778
- }
779
-
780
- /** @beta */
781
- export declare function editDocument<TDocument extends SanityDocumentLike>(
782
- sanityMutatePatch: PatchMutation,
783
- ): EditDocumentAction<TDocument>
784
-
785
- /** @beta */
786
- export declare function editDocument<TDocument extends SanityDocumentLike>(
787
- doc: DocumentHandle<TDocument>,
788
- patches?: PatchOperations | PatchOperations[],
789
- ): EditDocumentAction<TDocument>
790
-
791
- /** @beta */
792
- export declare interface EditDocumentAction<
793
- _TDocument extends SanityDocumentLike = SanityDocumentLike,
794
- > {
795
- type: 'document.edit'
796
- documentId: string
797
- resourceId?: DocumentResourceId
798
- patches?: PatchOperations[]
799
- }
800
-
801
- /**
802
- * Error state from the auth state.
803
- * @public
804
- */
805
- export declare type ErrorAuthState = {
806
- type: AuthStateType.ERROR
807
- error: unknown
808
- }
809
-
810
- declare interface EverythingNode extends BaseNode {
811
- type: 'Everything'
812
- }
813
-
814
- declare type Executor<N = ExprNode> = (node: N, scope: Scope) => Value | PromiseLike<Value>
815
-
816
- /**
817
- * A node which can be evaluated into a value.
818
- * @public
819
- */
820
- declare type ExprNode =
821
- | AccessAttributeNode
822
- | AccessElementNode
823
- | AndNode
824
- | ArrayNode
825
- | ArrayCoerceNode
826
- | AscNode
827
- | ContextNode
828
- | DerefNode
829
- | DescNode
830
- | EverythingNode
831
- | FilterNode
832
- | FlatMapNode
833
- | FuncCallNode
834
- | GroupNode
835
- | InRangeNode
836
- | MapNode
837
- | NegNode
838
- | NotNode
839
- | ObjectNode
840
- | OpCallNode
841
- | OrNode
842
- | ParameterNode
843
- | ParentNode_2
844
- | PipeFuncCallNode
845
- | PosNode
846
- | ProjectionNode
847
- | SelectNode
848
- | SelectorNode
849
- | SliceNode
850
- | ThisNode
851
- | TupleNode
852
- | ValueNode
853
-
854
- /**
855
- * Internal helper type
856
- * @public
857
- */
858
- export declare interface FetcherStore<TParams extends unknown[], TData> {
859
- getState: ResourceAction<
860
- FetcherStoreState<TParams, TData>,
861
- TParams,
862
- StateSource<TData | undefined>
863
- >
864
- resolveState: ResourceAction<FetcherStoreState<TParams, TData>, TParams, Promise<TData>>
865
- }
866
-
867
- /**
868
- * Internal helper type
869
- * @public
870
- */
871
- export declare interface FetcherStoreState<TParams extends unknown[], TData> {
872
- stateByParams: {
873
- [TSerializedKey in string]?: StoreEntry<TParams, TData>
874
- }
875
- error?: unknown
876
- }
877
-
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
- declare interface FilterNode extends BaseNode {
894
- type: 'Filter'
895
- base: ExprNode
896
- expr: ExprNode
897
- }
898
-
899
- declare interface FlatMapNode extends BaseNode {
900
- type: 'FlatMap'
901
- base: ExprNode
902
- expr: ExprNode
903
- }
904
-
905
- /**
906
- * Message sent from a containing app to an iframe
907
- * @public
908
- */
909
- export declare type FrameMessage = Message
910
-
911
- declare interface FuncCallNode extends BaseNode {
912
- type: 'FuncCall'
913
- func: GroqFunction
914
- namespace: string
915
- name: string
916
- args: ExprNode[]
917
- }
918
-
919
- /**
920
- * @public
921
- */
922
- export declare const getAuthState: ResourceAction<AuthStoreState, [], StateSource<AuthState>>
923
-
924
- /**
925
- * Retrieves a memoized Sanity client instance configured with the provided options.
926
- *
927
- * This function uses a memoized selector to return a client instance from the
928
- * client store, based on the default project or global client. The selector
929
- * leverages a WeakMap-based cache and reselect to ensure that clients with the
930
- * same configuration are reused, and that updates, such as authentication token
931
- * changes, propagate automatically.
932
- *
933
- * @public
934
- */
935
- export declare const getClient: ResourceAction<ClientState, [options: ClientOptions], SanityClient>
936
-
937
- /**
938
- * Returns a state source for the Sanity client instance.
939
- *
940
- * This function provides a subscribable state source that emits updated client
941
- * instances whenever the client configuration changes (for example, due to
942
- * token updates). It leverages the underlying client store and memoized selector
943
- * to ensure that subscribers receive the most current client configuration.
944
- *
945
- * @public
946
- */
947
- export declare const getClientState: ResourceAction<
948
- ClientState,
949
- [options: ClientOptions],
950
- StateSource<SanityClient>
951
- >
952
-
953
- /**
954
- * @public
955
- */
956
- export declare const getCurrentUserState: ResourceAction<
957
- AuthStoreState,
958
- [],
959
- StateSource<CurrentUser | null>
960
- >
961
-
962
- /**
963
- * @public
964
- */
965
- export declare const getDashboardOrganizationId: ResourceAction<
966
- AuthStoreState,
967
- [],
968
- StateSource<string | undefined>
969
- >
970
-
971
- /** @public */
972
- export declare const getDatasetsState: ResourceAction<
973
- FetcherStoreState<[], DatasetsResponse>,
974
- [],
975
- StateSource<DatasetsResponse | undefined>
976
- >
977
-
978
- /** @beta */
979
- export declare function getDocumentState<
980
- TDocument extends SanityDocument,
981
- TPath extends JsonMatchPath<TDocument>,
982
- >(
983
- instance: SanityInstance | ActionContext<DocumentStoreState>,
984
- doc: string | DocumentHandle<TDocument>,
985
- path: TPath,
986
- ): StateSource<JsonMatch<TDocument, TPath> | undefined>
987
-
988
- /** @beta */
989
- export declare function getDocumentState<TDocument extends SanityDocument>(
990
- instance: SanityInstance | ActionContext<DocumentStoreState>,
991
- doc: string | DocumentHandle<TDocument>,
992
- ): StateSource<TDocument | null>
993
-
994
- /** @beta */
995
- export declare function getDocumentState(
996
- instance: SanityInstance | ActionContext<DocumentStoreState>,
997
- doc: string | DocumentHandle,
998
- path?: string,
999
- ): StateSource<unknown>
1000
-
1001
- /** @beta */
1002
- export declare const getDocumentSyncStatus: ResourceAction<
1003
- DocumentStoreState,
1004
- [doc: DocumentHandle<SanityDocumentLike>],
1005
- StateSource<boolean | undefined>
1006
- >
1007
-
1008
- /**
1009
- * @public
1010
- */
1011
- export declare const getLoginUrlsState: ResourceAction<
1012
- AuthStoreState,
1013
- [],
1014
- StateSource<AuthProvider[] | null>
1015
- >
1016
-
1017
- /**
1018
- * Retrieve or create a channel to be used for communication between
1019
- * an application and the controller.
1020
- * @public
1021
- */
1022
- export declare const getOrCreateChannel: ResourceAction<
1023
- ComlinkControllerState,
1024
- [options: ChannelInput],
1025
- ChannelInstance<Message, Message>
1026
- >
1027
-
1028
- /**
1029
- * Initializes or fetches a controller to handle communication
1030
- * between an application and iframes.
1031
- * @public
1032
- */
1033
- export declare const getOrCreateController: ResourceAction<
1034
- ComlinkControllerState,
1035
- [targetOrigin: string],
1036
- Controller
1037
- >
1038
-
1039
- /**
1040
- * Retrieve or create a node to be used for communication between
1041
- * an application and the controller -- specifically, a node should
1042
- * be created within a frame / window to communicate with the controller.
1043
- * @public
1044
- */
1045
- export declare const getOrCreateNode: ResourceAction<
1046
- ComlinkNodeState,
1047
- [options: NodeInput],
1048
- Node_2<Message, Message>
1049
- >
1050
-
1051
- /** @beta */
1052
- export declare const getPermissionsState: ResourceAction<
1053
- DocumentStoreState,
1054
- [actions: DocumentAction | DocumentAction[]],
1055
- StateSource<DocumentPermissionsResult | undefined>
1056
- >
1057
-
1058
- /**
1059
- * @beta
1060
- */
1061
- export declare const getPreviewState: ResourceAction<
1062
- PreviewStoreState,
1063
- [GetPreviewStateOptions],
1064
- StateSource<ValuePending<PreviewValue>>
1065
- >
1066
-
1067
- /**
1068
- * @beta
1069
- */
1070
- export declare interface GetPreviewStateOptions {
1071
- document: DocumentHandle
1072
- }
1073
-
1074
- /**
1075
- * @beta
1076
- */
1077
- export declare function getProjectionState<TResult extends object>(
1078
- instance: SanityInstance | ActionContext<ProjectionStoreState>,
1079
- options: GetProjectionStateOptions,
1080
- ): StateSource<ProjectionValuePending<TResult>>
1081
-
1082
- /**
1083
- * @beta
1084
- */
1085
- export declare function getProjectionState(
1086
- instance: SanityInstance | ActionContext<ProjectionStoreState>,
1087
- options: GetProjectionStateOptions,
1088
- ): StateSource<ProjectionValuePending<Record<string, unknown>>>
1089
-
1090
- declare interface GetProjectionStateOptions {
1091
- document: DocumentHandle
1092
- projection: ValidProjection
1093
- }
1094
-
1095
- /** @public */
1096
- export declare const getProjectsState: ResourceAction<
1097
- FetcherStoreState<[], Omit<SanityProject_2, 'members'>[]>,
1098
- [],
1099
- StateSource<Omit<SanityProject_2, 'members'>[] | undefined>
1100
- >
1101
-
1102
- /** @public */
1103
- export declare const getProjectState: ResourceAction<
1104
- FetcherStoreState<[projectId: string], SanityProject_2>,
1105
- [projectId: string],
1106
- StateSource<SanityProject_2 | undefined>
1107
- >
1108
-
1109
- /** @beta */
1110
- export declare const getQueryKey: (query: string, options?: QueryOptions) => string
1111
-
1112
- /**
1113
- * Returns the state source for a query.
1114
- *
1115
- * This function returns a state source that represents the current result of a GROQ query.
1116
- * Subscribing to the state source will instruct the SDK to fetch the query (if not already fetched)
1117
- * and will keep the query live using the Live content API (considering sync tags) to provide up-to-date results.
1118
- * When the last subscriber is removed, the query state is automatically cleaned up from the store.
1119
- *
1120
- * Note: This functionality is for advanced users who want to build their own framework integrations.
1121
- * Our SDK also provides a React integration (useQuery hook) for convenient usage.
1122
- *
1123
- * Note: Automatic cleanup can interfere with React Suspense because if a component suspends while being the only subscriber,
1124
- * cleanup might occur unexpectedly. In such cases, consider using `resolveQuery` instead.
1125
- *
1126
- * @beta
1127
- */
1128
- export declare function getQueryState<T>(
1129
- instance: SanityInstance | ActionContext<QueryStoreState>,
1130
- query: string,
1131
- options?: QueryOptions,
1132
- ): StateSource<T | undefined>
1133
-
1134
- /** @beta */
1135
- export declare function getQueryState(
1136
- instance: SanityInstance | ActionContext<QueryStoreState>,
1137
- query: string,
1138
- options?: QueryOptions,
1139
- ): StateSource<unknown>
1140
-
1141
- /**
1142
- * @beta
1143
- * Get the resource ID from a document resource ID
1144
- */
1145
- export declare function getResourceId(
1146
- documentResourceId: DocumentResourceId | undefined,
1147
- ): ResourceId | undefined
1148
-
1149
- /**
1150
- * @public
1151
- */
1152
- export declare const getTokenState: ResourceAction<AuthStoreState, [], StateSource<string | null>>
1153
-
1154
- declare type Grant = 'read' | 'update' | 'create' | 'history'
1155
-
1156
- /** @public */
1157
- declare type GroqFunction = (
1158
- args: GroqFunctionArg[],
1159
- scope: Scope,
1160
- execute: Executor,
1161
- ) => PromiseLike<Value>
1162
-
1163
- /** @public */
1164
- declare type GroqFunctionArg = ExprNode
1165
-
1166
- declare type GroqPipeFunction = (
1167
- base: Value,
1168
- args: ExprNode[],
1169
- scope: Scope,
1170
- execute: Executor,
1171
- ) => PromiseLike<Value>
1172
-
1173
- /**
1174
- * A type of a value in GROQ.
1175
- */
1176
- declare type GroqType =
1177
- | 'null'
1178
- | 'boolean'
1179
- | 'number'
1180
- | 'string'
1181
- | 'array'
1182
- | 'object'
1183
- | 'path'
1184
- | 'datetime'
1185
-
1186
- declare interface GroupNode extends BaseNode {
1187
- type: 'Group'
1188
- base: ExprNode
1189
- }
1190
-
1191
- /**
1192
- * @public
1193
- */
1194
- export declare const handleAuthCallback: ResourceAction<
1195
- AuthStoreState,
1196
- [locationHref?: string | undefined],
1197
- Promise<string | false>
1198
- >
1199
-
1200
- declare type HttpAction =
1201
- | {
1202
- actionType: ActionMap['create']
1203
- publishedId: string
1204
- attributes: SanityDocumentLike
1205
- }
1206
- | {
1207
- actionType: ActionMap['discard']
1208
- versionId: string
1209
- purge?: boolean
1210
- }
1211
- | {
1212
- actionType: ActionMap['unpublish']
1213
- draftId: string
1214
- publishedId: string
1215
- }
1216
- | {
1217
- actionType: ActionMap['delete']
1218
- publishedId: string
1219
- includeDrafts?: string[]
1220
- }
1221
- | {
1222
- actionType: ActionMap['edit']
1223
- draftId: string
1224
- publishedId: string
1225
- patch: PatchOperations
1226
- }
1227
- | ({
1228
- actionType: ActionMap['publish']
1229
- draftId: string
1230
- publishedId: string
1231
- } & OptimisticLock)
1232
-
1233
- declare interface InRangeNode extends BaseNode {
1234
- type: 'InRange'
1235
- base: ExprNode
1236
- left: ExprNode
1237
- right: ExprNode
1238
- isInclusive: boolean
1239
- }
1240
-
1241
- /**
1242
- * Given a document type TDocument and a JSON Match path string TPath,
1243
- * compute the type found at that path.
1244
- * @beta
1245
- */
1246
- export declare type JsonMatch<TDocument extends SanityDocumentLike, TPath extends string> = DeepGet<
1247
- TDocument,
1248
- PathParts<TPath>
1249
- >
1250
-
1251
- /**
1252
- * A very simplified implementation of [JSONMatch][0] that only supports:
1253
- * - descent e.g. `friend.name`
1254
- * - array index e.g. `items[-1]`
1255
- * - array matching with `_key` e.g. `items[_key=="dd9efe09"]`
1256
- * - array matching with a range e.g. `items[4:]`
1257
- *
1258
- * E.g. `friends[_key=="dd9efe09"].address.zip`
1259
- *
1260
- * [0]: https://www.sanity.io/docs/json-match
1261
- *
1262
- * @beta
1263
- */
1264
- export declare function jsonMatch<
1265
- TDocument extends SanityDocumentLike,
1266
- TPath extends JsonMatchPath<TDocument>,
1267
- >(input: TDocument, path: TPath): MatchEntry<JsonMatch<TDocument, TPath>>[]
1268
-
1269
- /** @beta */
1270
- export declare function jsonMatch<TValue>(input: unknown, path: string): MatchEntry<TValue>[]
1271
-
1272
- /**
1273
- * Computing the full possible paths may be possible but is hard to compute
1274
- * within the type system for complex document types so we use string.
1275
- * @beta
1276
- */
1277
- export declare type JsonMatchPath<_TDocument extends SanityDocumentLike> = string
1278
-
1279
- declare interface LiveEventAwareState {
1280
- lastLiveEventId: string | null
1281
- syncTags: Record<string, true>
1282
- }
1283
-
1284
- /**
1285
- * Logged-in state from the auth state.
1286
- * @public
1287
- */
1288
- export declare type LoggedInAuthState = {
1289
- type: AuthStateType.LOGGED_IN
1290
- token: string
1291
- currentUser: CurrentUser | null
1292
- }
1293
-
1294
- /**
1295
- * Logged-out state from the auth state.
1296
- * @public
1297
- */
1298
- export declare type LoggedOutAuthState = {
1299
- type: AuthStateType.LOGGED_OUT
1300
- isDestroyingSession: boolean
1301
- }
1302
-
1303
- /**
1304
- * Logging-in state from the auth state.
1305
- * @public
1306
- */
1307
- export declare type LoggingInAuthState = {
1308
- type: AuthStateType.LOGGING_IN
1309
- isExchangingToken: boolean
1310
- }
1311
-
1312
- /**
1313
- * @public
1314
- */
1315
- export declare const logout: ResourceAction<AuthStoreState, [], Promise<void>>
1316
-
1317
- declare interface MapNode extends BaseNode {
1318
- type: 'Map'
1319
- base: ExprNode
1320
- expr: ExprNode
1321
- }
1322
-
1323
- declare type MatchEntry<T = unknown> = {
1324
- value: T
1325
- path: SingleValuePath
1326
- }
1327
-
1328
- /**
1329
- * @public
1330
- */
1331
- export declare interface Membership {
1332
- addedAt?: string
1333
- resourceType: string
1334
- resourceId: string
1335
- roleNames: Array<string>
1336
- lastSeenAt?: string | null
1337
- }
1338
-
1339
- declare interface NegNode extends BaseNode {
1340
- type: 'Neg'
1341
- base: ExprNode
1342
- }
1343
-
1344
- /**
1345
- * Individual node with its relevant options
1346
- * @public
1347
- */
1348
- declare interface NodeEntry {
1349
- node: Node_2<WindowMessage, FrameMessage>
1350
- options: NodeInput
1351
- refCount: number
1352
- }
1353
-
1354
- declare interface NotNode extends BaseNode {
1355
- type: 'Not'
1356
- base: ExprNode
1357
- }
1358
-
1359
- declare type NullValue = StaticValue<null, 'null'>
1360
-
1361
- declare type NumberValue = StaticValue<number, 'number'>
1362
-
1363
- declare type ObjectAttributeNode =
1364
- | ObjectAttributeValueNode
1365
- | ObjectConditionalSplatNode
1366
- | ObjectSplatNode
1367
-
1368
- declare interface ObjectAttributeValueNode extends BaseNode {
1369
- type: 'ObjectAttributeValue'
1370
- name: string
1371
- value: ExprNode
1372
- }
1373
-
1374
- declare interface ObjectConditionalSplatNode extends BaseNode {
1375
- type: 'ObjectConditionalSplat'
1376
- condition: ExprNode
1377
- value: ExprNode
1378
- }
1379
-
1380
- declare interface ObjectNode extends BaseNode {
1381
- type: 'Object'
1382
- attributes: ObjectAttributeNode[]
1383
- }
1384
-
1385
- declare interface ObjectSplatNode extends BaseNode {
1386
- type: 'ObjectSplat'
1387
- value: ExprNode
1388
- }
1389
-
1390
- declare type ObjectValue = StaticValue<Record<string, unknown>, 'object'>
1391
-
1392
- declare type OpCall =
1393
- | '=='
1394
- | '!='
1395
- | '>'
1396
- | '>='
1397
- | '<'
1398
- | '<='
1399
- | '+'
1400
- | '-'
1401
- | '*'
1402
- | '/'
1403
- | '%'
1404
- | '**'
1405
- | 'in'
1406
- | 'match'
1407
-
1408
- declare interface OpCallNode extends BaseNode {
1409
- type: 'OpCall'
1410
- op: OpCall
1411
- left: ExprNode
1412
- right: ExprNode
1413
- }
1414
-
1415
- declare type OptimisticLock = {
1416
- ifDraftRevisionId?: string
1417
- ifPublishedRevisionId?: string
1418
- }
1419
-
1420
- declare interface OrNode extends BaseNode {
1421
- type: 'Or'
1422
- left: ExprNode
1423
- right: ExprNode
1424
- }
1425
-
1426
- /**
1427
- * Represents a set of applied transactions batched into a single outgoing
1428
- * transaction. An outgoing transaction is the result of batching many applied
1429
- * actions. An outgoing transaction may be reverted locally if the server
1430
- * does not accept it.
1431
- */
1432
- declare interface OutgoingTransaction extends AppliedTransaction {
1433
- disableBatching: boolean
1434
- batchedTransactionIds: string[]
1435
- }
1436
-
1437
- declare interface ParameterNode extends BaseNode {
1438
- type: 'Parameter'
1439
- name: string
1440
- }
1441
-
1442
- declare interface ParentNode_2 extends BaseNode {
1443
- type: 'Parent'
1444
- n: number
1445
- }
1446
-
1447
- /**
1448
- * Parse one or more bracketed parts from a segment.
1449
- *
1450
- * It recursively “peels off” a bracketed part and then continues.
1451
- *
1452
- * For example, given the string:
1453
- *
1454
- * ```
1455
- * "[0][foo]"
1456
- * ```
1457
- *
1458
- * it produces:
1459
- *
1460
- * ```
1461
- * [ToNumber<"0">, "foo"]
1462
- * ```
1463
- */
1464
- declare type ParseBracket<TInput extends string> = TInput extends `[${infer TPart}]${infer TRest}`
1465
- ? [ToNumber<TPart>, ...ParseSegment<TRest>]
1466
- : []
1467
-
1468
- /** @beta */
1469
- export declare const parseQueryKey: (key: string) => {
1470
- query: string
1471
- options: QueryOptions
1472
- }
1473
-
1474
- /**
1475
- * Parse a single “segment” that may include bracket parts.
1476
- *
1477
- * For example, the literal
1478
- *
1479
- * ```
1480
- * "friends[0][1]"
1481
- * ```
1482
- *
1483
- * is parsed as:
1484
- *
1485
- * ```
1486
- * ["friends", 0, 1]
1487
- * ```
1488
- */
1489
- declare type ParseSegment<TInput extends string> = TInput extends `${infer TProp}[${infer TRest}`
1490
- ? TProp extends ''
1491
- ? [...ParseBracket<`[${TRest}`>]
1492
- : [TProp, ...ParseBracket<`[${TRest}`>]
1493
- : TInput extends ''
1494
- ? []
1495
- : [TInput]
1496
-
1497
- declare class Path {
1498
- private pattern
1499
- private patternRe
1500
- constructor(pattern: string)
1501
- matches(str: string): boolean
1502
- toJSON(): string
1503
- }
1504
-
1505
- /**
1506
- * Split the entire path string on dots “outside” of any brackets.
1507
- *
1508
- * For example:
1509
- * ```
1510
- * "friends[0].name"
1511
- * ```
1512
- *
1513
- * becomes:
1514
- *
1515
- * ```
1516
- * [...ParseSegment<"friends[0]">, ...ParseSegment<"name">]
1517
- * ```
1518
- *
1519
- * (We use a simple recursion that splits on the first dot.)
1520
- */
1521
- declare type PathParts<TPath extends string> = TPath extends `${infer TLeft}.${infer TRight}`
1522
- ? [...ParseSegment<TLeft>, ...PathParts<TRight>]
1523
- : ParseSegment<TPath>
1524
-
1525
- declare type PathValue = StaticValue<Path, 'path'>
1526
-
1527
- /** @beta */
1528
- export declare interface PermissionDeniedReason {
1529
- type: 'precondition' | 'access'
1530
- message: string
1531
- documentId?: string
1532
- }
1533
-
1534
- declare interface PipeFuncCallNode extends BaseNode {
1535
- type: 'PipeFuncCall'
1536
- func: GroqPipeFunction
1537
- base: ExprNode
1538
- name: string
1539
- args: ExprNode[]
1540
- }
1541
-
1542
- declare interface PosNode extends BaseNode {
1543
- type: 'Pos'
1544
- base: ExprNode
1545
- }
1546
-
1547
- /**
1548
- * Represents a media asset in a preview.
1549
- *
1550
- * @public
1551
- */
1552
- declare interface PreviewMedia {
1553
- type: 'image-asset'
1554
- _ref: string
1555
- url: string
1556
- }
1557
-
1558
- /**
1559
- * @public
1560
- */
1561
- export declare interface PreviewStoreState extends LiveEventAwareState {
1562
- values: {
1563
- [TDocumentId in string]?: ValuePending<PreviewValue>
1564
- }
1565
- documentTypes: {
1566
- [TDocumentId in string]?: string
1567
- }
1568
- subscriptions: {
1569
- [TDocumentId in string]?: {
1570
- [TSubscriptionId in string]?: true
1571
- }
1572
- }
1573
- }
1574
-
1575
- /**
1576
- * Represents the set of values displayed as a preview for a given Sanity document.
1577
- * This includes a primary title, a secondary subtitle, an optional piece of media associated
1578
- * with the document, and the document’s status.
1579
- *
1580
- * @public
1581
- */
1582
- export declare interface PreviewValue {
1583
- /**
1584
- * The primary text displayed for the document preview.
1585
- */
1586
- title: string
1587
- /**
1588
- * A secondary line of text providing additional context about the document.
1589
- */
1590
- subtitle?: string
1591
- /**
1592
- * An optional piece of media representing the document within its preview.
1593
- * Currently, only image assets are available.
1594
- */
1595
- media?: PreviewMedia | null
1596
- /**
1597
- * The status of the document.
1598
- */
1599
- status?: {
1600
- /** The date of the last published edit */
1601
- lastEditedPublishedAt?: string
1602
- /** The date of the last draft edit */
1603
- lastEditedDraftAt?: string
1604
- }
1605
- }
1606
-
1607
- declare interface ProjectionNode extends BaseNode {
1608
- type: 'Projection'
1609
- base: ExprNode
1610
- expr: ExprNode
1611
- }
1612
-
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
- /**
1628
- * @beta
1629
- */
1630
- export declare interface ProjectionValuePending<TValue extends object> {
1631
- data: TValue | null
1632
- isPending: boolean
1633
- }
1634
-
1635
- /** @beta */
1636
- export declare function publishDocument<TDocument extends SanityDocumentLike>(
1637
- doc: DocumentHandle<TDocument>,
1638
- ): PublishDocumentAction<TDocument>
1639
-
1640
- /** @beta */
1641
- export declare interface PublishDocumentAction<
1642
- _TDocument extends SanityDocumentLike = SanityDocumentLike,
1643
- > {
1644
- type: 'document.publish'
1645
- documentId: string
1646
- resourceId?: DocumentResourceId
1647
- }
1648
-
1649
- /**
1650
- * @beta
1651
- */
1652
- export declare interface QueryOptions
1653
- extends Pick<ResponseQueryOptions, 'perspective' | 'useCdn' | 'cache' | 'next' | 'cacheMode'>,
1654
- Pick<ClientOptions, 'scope' | 'resourceId'> {
1655
- params?: Record<string, unknown>
1656
- }
1657
-
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
- /**
1674
- * Represents a transaction that is queued to be applied but has not yet been
1675
- * applied. A transaction will remain in a queued state until all required
1676
- * documents for the transactions are available locally.
1677
- */
1678
- declare interface QueuedTransaction {
1679
- /**
1680
- * the ID of this transaction. this is generated client-side.
1681
- */
1682
- transactionId: string
1683
- /**
1684
- * the high-level actions associated with this transaction. note that these
1685
- * actions don't mention draft IDs and is meant to abstract away the draft
1686
- * model from users.
1687
- */
1688
- actions: DocumentAction[]
1689
- /**
1690
- * An optional flag set to disable this transaction from being batched with
1691
- * other transactions.
1692
- */
1693
- disableBatching?: boolean
1694
- }
1695
-
1696
- /**
1697
- * Signals to the store that the consumer has stopped using the channel
1698
- * @public
1699
- */
1700
- export declare const releaseChannel: ResourceAction<ComlinkControllerState, [name: string], void>
1701
-
1702
- /**
1703
- * Signals to the store that the consumer has stopped using the node
1704
- * @public
1705
- */
1706
- export declare const releaseNode: ResourceAction<ComlinkNodeState, [name: string], void>
1707
-
1708
- /** @public */
1709
- export declare const resolveDatasets: ResourceAction<
1710
- FetcherStoreState<[], DatasetsResponse>,
1711
- [],
1712
- Promise<DatasetsResponse>
1713
- >
1714
-
1715
- /** @beta */
1716
- export declare function resolveDocument<TDocument extends SanityDocument>(
1717
- instance: SanityInstance | ActionContext<DocumentStoreState>,
1718
- doc: string | DocumentHandle<TDocument>,
1719
- ): Promise<TDocument | null>
1720
-
1721
- /** @beta */
1722
- export declare function resolveDocument(
1723
- instance: SanityInstance | ActionContext<DocumentStoreState>,
1724
- doc: string | DocumentHandle,
1725
- ): Promise<SanityDocument | null>
1726
-
1727
- /** @beta */
1728
- export declare const resolvePermissions: ResourceAction<
1729
- DocumentStoreState,
1730
- [actions: DocumentAction | DocumentAction[]],
1731
- Promise<DocumentPermissionsResult>
1732
- >
1733
-
1734
- /**
1735
- * @beta
1736
- */
1737
- export declare const resolvePreview: ResourceAction<
1738
- PreviewStoreState,
1739
- [ResolvePreviewOptions],
1740
- Promise<ValuePending<PreviewValue>>
1741
- >
1742
-
1743
- /**
1744
- * @beta
1745
- */
1746
- export declare interface ResolvePreviewOptions {
1747
- document: DocumentHandle
1748
- }
1749
-
1750
- /** @public */
1751
- export declare const resolveProject: ResourceAction<
1752
- FetcherStoreState<[projectId: string], SanityProject_2>,
1753
- [projectId: string],
1754
- Promise<SanityProject_2>
1755
- >
1756
-
1757
- /**
1758
- * @beta
1759
- */
1760
- export declare const resolveProjection: ResourceAction<
1761
- ProjectionStoreState<object>,
1762
- [ResolveProjectionOptions],
1763
- Promise<ProjectionValuePending<Record<string, unknown>>>
1764
- >
1765
-
1766
- declare interface ResolveProjectionOptions {
1767
- document: DocumentHandle
1768
- projection: ValidProjection
1769
- }
1770
-
1771
- /** @public */
1772
- export declare const resolveProjects: ResourceAction<
1773
- FetcherStoreState<[], Omit<SanityProject_2, 'members'>[]>,
1774
- [],
1775
- Promise<Omit<SanityProject_2, 'members'>[]>
1776
- >
1777
-
1778
- /**
1779
- * Resolves the result of a query without registering a lasting subscriber.
1780
- *
1781
- * This function fetches the result of a GROQ query and returns a promise that resolves with the query result.
1782
- * Unlike `getQueryState`, which registers subscribers to keep the query live and performs automatic cleanup,
1783
- * `resolveQuery` does not track subscribers. This makes it ideal for use with React Suspense, where the returned
1784
- * promise is thrown to delay rendering until the query result becomes available.
1785
- * Once the promise resolves, it is expected that a real subscriber will be added via `getQueryState` to manage ongoing updates.
1786
- *
1787
- * Additionally, an optional AbortSignal can be provided to cancel the query and immediately clear the associated state
1788
- * if there are no active subscribers.
1789
- *
1790
- * @beta
1791
- */
1792
- export declare function resolveQuery<T>(
1793
- instance: SanityInstance | ActionContext<QueryStoreState>,
1794
- query: string,
1795
- options?: ResolveQueryOptions,
1796
- ): Promise<T>
1797
-
1798
- /** @beta */
1799
- export declare function resolveQuery(
1800
- instance: SanityInstance | ActionContext<QueryStoreState>,
1801
- query: string,
1802
- options?: ResolveQueryOptions,
1803
- ): Promise<unknown>
1804
-
1805
- /**
1806
- * @beta
1807
- */
1808
- declare interface ResolveQueryOptions extends QueryOptions {
1809
- signal?: AbortSignal
1810
- }
1811
-
1812
- /**
1813
- * @public
1814
- */
1815
- export declare type ResourceAction<TState, TParams extends unknown[], TReturn> = (
1816
- dependencies: SanityInstance | ActionContext<TState>,
1817
- ...params: TParams
1818
- ) => TReturn
1819
-
1820
- /**
1821
- * @public
1822
- * A resource identifier for a document, in the format of `projectId.dataset`
1823
- */
1824
- export declare type ResourceId = `${string}.${string}`
1825
-
1826
- /**
1827
- * @public
1828
- */
1829
- export declare type ResourceState<TState> = {
1830
- get: () => TState
1831
- set: (name: string, state: Partial<TState> | ((s: TState) => Partial<TState>)) => void
1832
- observable: Observable<TState>
1833
- }
1834
-
1835
- /**
1836
- * @public
1837
- */
1838
- export declare type ResourceType = 'organization' | 'project'
1839
-
1840
- export {Role}
1841
-
1842
- /**
1843
- * @public
1844
- */
1845
- export declare interface SanityConfig {
1846
- projectId: string
1847
- dataset: string
1848
- auth?: AuthConfig
1849
- }
1850
-
1851
- export {SanityDocument}
1852
-
1853
- export {SanityDocumentLike}
1854
-
1855
- /** @public */
1856
- export declare interface SanityInstance {
1857
- /**
1858
- * The following is used to look up resources associated with this instance,
1859
- * and can be used to retrieve an "id" for the instance - useful in debugging.
1860
- *
1861
- * @public
1862
- */
1863
- readonly identity: SdkIdentity
1864
- config: Omit<SanityConfig, 'projectId' | 'dataset'>
1865
- dispose: () => void
1866
- }
1867
-
1868
- /**
1869
- * @public
1870
- */
1871
- export declare type SanityProject = SanityProject_2
1872
-
1873
- /**
1874
- * @public
1875
- */
1876
- export declare interface SanityUser {
1877
- sanityUserId: string
1878
- profile: UserProfile
1879
- memberships: Membership[]
1880
- }
1881
-
1882
- /**
1883
- * @public
1884
- */
1885
- declare interface SanityUserResponse {
1886
- data: SanityUser[]
1887
- totalCount: number
1888
- nextCursor: string | null
1889
- }
1890
-
1891
- declare class Scope {
1892
- params: Record<string, unknown>
1893
- source: Value
1894
- value: Value
1895
- parent: Scope | null
1896
- context: Context
1897
- isHidden: boolean
1898
- constructor(
1899
- params: Record<string, unknown>,
1900
- source: Value,
1901
- value: Value,
1902
- context: Context,
1903
- parent: Scope | null,
1904
- )
1905
- createNested(value: Value): Scope
1906
- createHidden(value: Value): Scope
1907
- }
1908
-
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
- declare interface SelectAlternativeNode extends BaseNode {
1918
- type: 'SelectAlternative'
1919
- condition: ExprNode
1920
- value: ExprNode
1921
- }
1922
-
1923
- declare interface SelectNode extends BaseNode {
1924
- type: 'Select'
1925
- alternatives: SelectAlternativeNode[]
1926
- fallback?: ExprNode
1927
- }
1928
-
1929
- declare interface SelectorNode extends BaseNode {
1930
- type: 'Selector'
1931
- }
1932
-
1933
- declare type SingleValuePath = Exclude<PathSegment, IndexTuple>[]
1934
-
1935
- declare interface SliceNode extends BaseNode {
1936
- type: 'Slice'
1937
- base: ExprNode
1938
- left: number
1939
- right: number
1940
- isInclusive: boolean
1941
- }
1942
-
1943
- /**
1944
- * @public
1945
- */
1946
- export declare interface StateSource<T> {
1947
- subscribe: (onStoreChanged?: () => void) => () => void
1948
- getCurrent: () => T
1949
- observable: Observable<T>
1950
- }
1951
-
1952
- declare class StaticValue<P, T extends GroqType> {
1953
- data: P
1954
- type: T
1955
- constructor(data: P, type: T)
1956
- isArray(): boolean
1957
- get(): Promise<any>
1958
- [Symbol.asyncIterator](): Generator<Value, void, unknown>
1959
- }
1960
-
1961
- declare interface StoreEntry<TParams extends unknown[], TData> {
1962
- params: TParams
1963
- key: string
1964
- data?: TData
1965
- error?: unknown
1966
- subscriptions: string[]
1967
- lastFetchInitiatedAt?: string
1968
- }
1969
-
1970
- declare class StreamValue {
1971
- type: 'stream'
1972
- private generator
1973
- private ticker
1974
- private isDone
1975
- private data
1976
- constructor(generator: () => AsyncGenerator<Value, void, unknown>)
1977
- isArray(): boolean
1978
- get(): Promise<any>
1979
- [Symbol.asyncIterator](): AsyncGenerator<Value, void, unknown>
1980
- _nextTick(): Promise<void>
1981
- }
1982
-
1983
- declare type StringValue = StaticValue<string, 'string'>
1984
-
1985
- /** @beta */
1986
- export declare const subscribeDocumentEvents: ResourceAction<
1987
- DocumentStoreState,
1988
- [eventHandler: (e: DocumentEvent) => void],
1989
- () => void
1990
- >
1991
-
1992
- declare interface ThisNode extends BaseNode {
1993
- type: 'This'
1994
- }
1995
-
1996
- declare type ToNumber<TInput extends string> = TInput extends `${infer TNumber extends number}`
1997
- ? TNumber
1998
- : TInput
1999
-
2000
- /**
2001
- * @beta
2002
- * Event emitted when a transaction is accepted.
2003
- */
2004
- export declare interface TransactionAcceptedEvent {
2005
- type: 'accepted'
2006
- outgoing: OutgoingTransaction
2007
- result: Awaited<ReturnType<SanityClient['action']>>
2008
- }
2009
-
2010
- /**
2011
- * @beta
2012
- * Event emitted when a transaction is reverted.
2013
- */
2014
- export declare interface TransactionRevertedEvent {
2015
- type: 'reverted'
2016
- message: string
2017
- error: unknown
2018
- outgoing: OutgoingTransaction
2019
- }
2020
-
2021
- declare interface TupleNode extends BaseNode {
2022
- type: 'Tuple'
2023
- members: Array<ExprNode>
2024
- }
2025
-
2026
- /** @beta */
2027
- export declare function unpublishDocument<TDocument extends SanityDocumentLike>(
2028
- doc: DocumentHandle<TDocument>,
2029
- ): UnpublishDocumentAction<TDocument>
2030
-
2031
- /** @beta */
2032
- export declare interface UnpublishDocumentAction<
2033
- _TDocument extends SanityDocumentLike = SanityDocumentLike,
2034
- > {
2035
- type: 'document.unpublish'
2036
- documentId: string
2037
- resourceId?: DocumentResourceId
2038
- }
2039
-
2040
- declare interface UnverifiedDocumentRevision {
2041
- transactionId: string
2042
- documentId: string
2043
- previousRev: string | undefined
2044
- timestamp: string
2045
- }
2046
-
2047
- /**
2048
- * @public
2049
- */
2050
- export declare interface UserProfile {
2051
- id: string
2052
- displayName: string
2053
- email: string
2054
- familyName?: string
2055
- givenName?: string
2056
- middleName?: string | null
2057
- imageUrl?: string
2058
- provider: string
2059
- tosAcceptedAt?: string
2060
- createdAt: string
2061
- updatedAt?: string
2062
- isCurrentUser?: boolean
2063
- providerId?: string
2064
- }
2065
-
2066
- /**
2067
- * @public
2068
- */
2069
- export declare interface UsersStoreState {
2070
- users: SanityUser[]
2071
- totalCount: number
2072
- nextCursor: string | null
2073
- hasMore: boolean
2074
- initialFetchCompleted: boolean
2075
- options: {
2076
- resourceType: ResourceType
2077
- resourceId: string
2078
- /**
2079
- * The maximum number of users to fetch. [Default: 100]
2080
- */
2081
- limit?: number
2082
- }
2083
- }
2084
-
2085
- /**
2086
- * @beta
2087
- */
2088
- export declare type ValidProjection = `{${string}}`
2089
-
2090
- /**
2091
- * The result of an expression.
2092
- */
2093
- declare type Value = AnyStaticValue | StreamValue
2094
-
2095
- declare interface ValueNode<P = any> {
2096
- type: 'Value'
2097
- value: P
2098
- }
2099
-
2100
- /**
2101
- * Represents the current state of a preview value along with a flag indicating whether
2102
- * the preview data is still being fetched or is fully resolved.
2103
- *
2104
- * The tuple contains a preview value or null, and a boolean indicating if the data is
2105
- * pending. A `true` value means a fetch is ongoing; `false` indicates that the
2106
- * currently provided preview value is up-to-date.
2107
- *
2108
- * @public
2109
- */
2110
- export declare type ValuePending<T> = {
2111
- data: T | null
2112
- isPending: boolean
2113
- }
2114
-
2115
- /**
2116
- * Message sent from an iframe to a containing app
2117
- * @public
2118
- */
2119
- export declare type WindowMessage = Message
2120
-
2121
- export {}