@sanity/sdk-react 0.0.0-alpha.11 → 0.0.0-alpha.13
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/README.md +0 -10
- package/dist/_chunks-es/context.js.map +1 -1
- package/dist/_chunks-es/useLogOut.js.map +1 -1
- package/dist/components.js +11 -1
- package/dist/components.js.map +1 -1
- package/dist/context.d.ts +4 -2
- package/dist/hooks.d.ts +484 -99
- package/dist/hooks.js +266 -11
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
- package/src/_exports/hooks.ts +5 -2
- package/src/_exports/index.ts +1 -1
- package/src/components/SanityApp.tsx +8 -0
- package/src/components/auth/AuthBoundary.tsx +13 -3
- package/src/components/utils.ts +3 -0
- package/src/context/SanityProvider.tsx +4 -2
- package/src/hooks/auth/useAuthState.tsx +0 -2
- package/src/hooks/auth/useCurrentUser.tsx +2 -1
- package/src/hooks/client/useClient.ts +1 -0
- package/src/hooks/comlink/useFrameConnection.test.tsx +45 -10
- package/src/hooks/comlink/useFrameConnection.ts +24 -5
- package/src/hooks/comlink/useWindowConnection.test.ts +43 -12
- package/src/hooks/comlink/useWindowConnection.ts +13 -1
- package/src/hooks/context/useSanityInstance.ts +1 -1
- package/src/hooks/document/useApplyActions.ts +45 -1
- package/src/hooks/document/useDocument.ts +77 -3
- package/src/hooks/document/useDocumentEvent.ts +23 -1
- package/src/hooks/document/useDocumentSyncStatus.test.ts +1 -1
- package/src/hooks/document/useDocumentSyncStatus.ts +25 -2
- package/src/hooks/document/useEditDocument.ts +118 -3
- package/src/hooks/document/usePermissions.ts +28 -0
- package/src/hooks/documentCollection/useDocuments.ts +15 -7
- package/src/hooks/preview/usePreview.tsx +7 -4
- package/src/hooks/users/useUsers.test.ts +164 -0
- package/src/hooks/users/useUsers.ts +73 -0
package/dist/hooks.d.ts
CHANGED
|
@@ -12,10 +12,10 @@ import {FrameMessage} from '@sanity/sdk'
|
|
|
12
12
|
import {JsonMatch} from '@sanity/sdk'
|
|
13
13
|
import {JsonMatchPath} from '@sanity/sdk'
|
|
14
14
|
import {Observable} from 'rxjs'
|
|
15
|
+
import {PermissionsResult} from '@sanity/sdk'
|
|
15
16
|
import {PreviewValue} from '@sanity/sdk'
|
|
16
17
|
import {Requester} from 'get-it'
|
|
17
|
-
import {SanityDocument
|
|
18
|
-
import {SanityDocumentLike} from '@sanity/types'
|
|
18
|
+
import {SanityDocument} from '@sanity/types'
|
|
19
19
|
import {SanityInstance} from '@sanity/sdk'
|
|
20
20
|
import {WindowMessage} from '@sanity/sdk'
|
|
21
21
|
|
|
@@ -300,9 +300,18 @@ declare interface ClientConfig {
|
|
|
300
300
|
/** @defaultValue true */
|
|
301
301
|
useCdn?: boolean
|
|
302
302
|
token?: string
|
|
303
|
-
/**
|
|
303
|
+
/**
|
|
304
|
+
* What perspective to use for the client. See {@link https://www.sanity.io/docs/perspectives|perspective documentation}
|
|
305
|
+
* @remarks
|
|
306
|
+
* As of API version `v2025-02-19`, the default perspective has changed from `raw` to `published`. {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog}
|
|
307
|
+
* @defaultValue 'published'
|
|
308
|
+
*/
|
|
304
309
|
perspective?: ClientPerspective
|
|
305
310
|
apiHost?: string
|
|
311
|
+
/**
|
|
312
|
+
@remarks
|
|
313
|
+
* As of API version `v2025-02-19`, the default perspective has changed from `raw` to `published`. {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog}
|
|
314
|
+
*/
|
|
306
315
|
apiVersion?: string
|
|
307
316
|
proxy?: string
|
|
308
317
|
/**
|
|
@@ -353,11 +362,11 @@ declare interface ClientConfig {
|
|
|
353
362
|
|
|
354
363
|
/** @public */
|
|
355
364
|
declare type ClientPerspective =
|
|
356
|
-
|
|
|
365
|
+
| DeprecatedPreviewDrafts
|
|
357
366
|
| 'published'
|
|
358
367
|
| 'drafts'
|
|
359
368
|
| 'raw'
|
|
360
|
-
|
|
|
369
|
+
| StackablePerspective[]
|
|
361
370
|
|
|
362
371
|
/** @public */
|
|
363
372
|
declare type ClientReturn<
|
|
@@ -507,7 +516,7 @@ declare type CreateAction = {
|
|
|
507
516
|
ifExists: 'fail' | 'ignore'
|
|
508
517
|
}
|
|
509
518
|
|
|
510
|
-
/** @
|
|
519
|
+
/** @public */
|
|
511
520
|
declare interface CurrentSanityUser {
|
|
512
521
|
id: string
|
|
513
522
|
name: string
|
|
@@ -518,10 +527,10 @@ declare interface CurrentSanityUser {
|
|
|
518
527
|
|
|
519
528
|
export {CurrentUser}
|
|
520
529
|
|
|
521
|
-
/** @
|
|
530
|
+
/** @public */
|
|
522
531
|
declare type DatasetAclMode = 'public' | 'private' | 'custom'
|
|
523
532
|
|
|
524
|
-
/** @
|
|
533
|
+
/** @public */
|
|
525
534
|
declare type DatasetResponse = {
|
|
526
535
|
datasetName: string
|
|
527
536
|
aclMode: DatasetAclMode
|
|
@@ -569,7 +578,7 @@ declare class DatasetsClient {
|
|
|
569
578
|
list(): Promise<DatasetsResponse>
|
|
570
579
|
}
|
|
571
580
|
|
|
572
|
-
/** @
|
|
581
|
+
/** @public */
|
|
573
582
|
declare type DatasetsResponse = {
|
|
574
583
|
name: string
|
|
575
584
|
aclMode: DatasetAclMode
|
|
@@ -604,6 +613,11 @@ declare type DeleteAction = {
|
|
|
604
613
|
purge?: boolean
|
|
605
614
|
}
|
|
606
615
|
|
|
616
|
+
/**
|
|
617
|
+
* @deprecated use 'drafts' instead
|
|
618
|
+
*/
|
|
619
|
+
declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
620
|
+
|
|
607
621
|
/**
|
|
608
622
|
* Delete the draft version of a document.
|
|
609
623
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
|
@@ -636,10 +650,14 @@ declare type DisconnectEvent = {
|
|
|
636
650
|
reason: string
|
|
637
651
|
}
|
|
638
652
|
|
|
653
|
+
export {DocumentHandle}
|
|
654
|
+
|
|
639
655
|
/**
|
|
640
656
|
* @public
|
|
657
|
+
* A live collection of {@link DocumentHandle}s, along with metadata about the collection and a function for loading more of them.
|
|
658
|
+
* @category Types
|
|
641
659
|
*/
|
|
642
|
-
export declare interface
|
|
660
|
+
export declare interface DocumentHandleCollection {
|
|
643
661
|
/** Retrieve more documents matching the provided options */
|
|
644
662
|
loadMore: () => void
|
|
645
663
|
/** The retrieved document handles of the documents matching the provided options */
|
|
@@ -764,6 +782,7 @@ export declare interface FrameConnection<TFrameMessage extends FrameMessage> {
|
|
|
764
782
|
>['data'],
|
|
765
783
|
]
|
|
766
784
|
) => void
|
|
785
|
+
status: Status
|
|
767
786
|
}
|
|
768
787
|
|
|
769
788
|
/** @public */
|
|
@@ -893,6 +912,16 @@ declare interface ListenOptions {
|
|
|
893
912
|
* @defaultValue `false`
|
|
894
913
|
*/
|
|
895
914
|
includePreviousRevision?: boolean
|
|
915
|
+
/**
|
|
916
|
+
* Whether to include events for drafts and versions. As of API Version >= v2025-02-19, only events
|
|
917
|
+
* for published documents will be included by default (see {@link https://www.sanity.io/changelog/e93a2d5a-9cee-4801-829e-8d3394bfed85|Changelog})
|
|
918
|
+
* If you need events from drafts and versions, set this to `true`.
|
|
919
|
+
* Note: Keep in mind that additional document variants may be introduced in the future, so it's
|
|
920
|
+
* recommended to respond to events in a way that's tolerant of potential future variants, e.g. by
|
|
921
|
+
* explicitly checking whether the event is for a draft or a version.
|
|
922
|
+
* @defaultValue `false`
|
|
923
|
+
*/
|
|
924
|
+
includeAllVersions?: boolean
|
|
896
925
|
/**
|
|
897
926
|
* Whether events should be sent as soon as a transaction has been committed (`transaction`, default),
|
|
898
927
|
* or only after they are available for queries (query). Note that this is on a best-effort basis,
|
|
@@ -987,6 +1016,16 @@ declare type Logger =
|
|
|
987
1016
|
Pick<typeof console, 'debug' | 'error' | 'groupCollapsed' | 'groupEnd' | 'log' | 'table'>
|
|
988
1017
|
>
|
|
989
1018
|
|
|
1019
|
+
declare type Membership = {
|
|
1020
|
+
addedAt?: string
|
|
1021
|
+
resourceType: string
|
|
1022
|
+
resourceId: string
|
|
1023
|
+
roleNames: Array<string>
|
|
1024
|
+
lastSeenAt?: string | null
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
declare type Memberships = Array<Membership>
|
|
1028
|
+
|
|
990
1029
|
/**
|
|
991
1030
|
* @internal
|
|
992
1031
|
*/
|
|
@@ -1064,12 +1103,12 @@ declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>
|
|
|
1064
1103
|
* The document as it looked after the mutation was performed. This is only included if
|
|
1065
1104
|
* the listener was configured with `includeResult: true`.
|
|
1066
1105
|
*/
|
|
1067
|
-
result?:
|
|
1106
|
+
result?: SanityDocument_2<R>
|
|
1068
1107
|
/**
|
|
1069
1108
|
* The document as it looked before the mutation was performed. This is only included if
|
|
1070
1109
|
* the listener was configured with `includePreviousRevision: true`.
|
|
1071
1110
|
*/
|
|
1072
|
-
previous?:
|
|
1111
|
+
previous?: SanityDocument_2<R> | null
|
|
1073
1112
|
/**
|
|
1074
1113
|
* The effects of the mutation, if the listener was configured with `effectFormat: 'mendoza'`.
|
|
1075
1114
|
* Object with `apply` and `revert` arrays, see {@link https://github.com/sanity-io/mendoza}.
|
|
@@ -1256,7 +1295,7 @@ declare class ObservablePatch extends BasePatch {
|
|
|
1256
1295
|
*/
|
|
1257
1296
|
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1258
1297
|
options: FirstDocumentMutationOptions,
|
|
1259
|
-
): Observable<
|
|
1298
|
+
): Observable<SanityDocument_2<R>>
|
|
1260
1299
|
/**
|
|
1261
1300
|
* Commit the patch, returning an observable that produces an array of the mutated documents
|
|
1262
1301
|
*
|
|
@@ -1264,7 +1303,7 @@ declare class ObservablePatch extends BasePatch {
|
|
|
1264
1303
|
*/
|
|
1265
1304
|
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1266
1305
|
options: AllDocumentsMutationOptions,
|
|
1267
|
-
): Observable<
|
|
1306
|
+
): Observable<SanityDocument_2<R>[]>
|
|
1268
1307
|
/**
|
|
1269
1308
|
* Commit the patch, returning an observable that produces a mutation result object
|
|
1270
1309
|
*
|
|
@@ -1284,7 +1323,7 @@ declare class ObservablePatch extends BasePatch {
|
|
|
1284
1323
|
*/
|
|
1285
1324
|
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1286
1325
|
options?: BaseMutationOptions,
|
|
1287
|
-
): Observable<
|
|
1326
|
+
): Observable<SanityDocument_2<R>>
|
|
1288
1327
|
}
|
|
1289
1328
|
|
|
1290
1329
|
/** @public */
|
|
@@ -1410,7 +1449,7 @@ declare class ObservableSanityClient {
|
|
|
1410
1449
|
options?: {
|
|
1411
1450
|
tag?: string
|
|
1412
1451
|
},
|
|
1413
|
-
): Observable<
|
|
1452
|
+
): Observable<SanityDocument_2<R> | undefined>
|
|
1414
1453
|
/**
|
|
1415
1454
|
* Fetch multiple documents in one request.
|
|
1416
1455
|
* Should be used sparingly - performing a query is usually a better option.
|
|
@@ -1425,7 +1464,7 @@ declare class ObservableSanityClient {
|
|
|
1425
1464
|
options?: {
|
|
1426
1465
|
tag?: string
|
|
1427
1466
|
},
|
|
1428
|
-
): Observable<(
|
|
1467
|
+
): Observable<(SanityDocument_2<R> | null)[]>
|
|
1429
1468
|
/**
|
|
1430
1469
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
1431
1470
|
* Returns an observable that resolves to the created document.
|
|
@@ -1436,7 +1475,7 @@ declare class ObservableSanityClient {
|
|
|
1436
1475
|
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
1437
1476
|
document: SanityDocumentStub<R>,
|
|
1438
1477
|
options: FirstDocumentMutationOptions,
|
|
1439
|
-
): Observable<
|
|
1478
|
+
): Observable<SanityDocument_2<R>>
|
|
1440
1479
|
/**
|
|
1441
1480
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
1442
1481
|
* Returns an observable that resolves to an array containing the created document.
|
|
@@ -1447,7 +1486,7 @@ declare class ObservableSanityClient {
|
|
|
1447
1486
|
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
1448
1487
|
document: SanityDocumentStub<R>,
|
|
1449
1488
|
options: AllDocumentsMutationOptions,
|
|
1450
|
-
): Observable<
|
|
1489
|
+
): Observable<SanityDocument_2<R>[]>
|
|
1451
1490
|
/**
|
|
1452
1491
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
1453
1492
|
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
@@ -1480,7 +1519,7 @@ declare class ObservableSanityClient {
|
|
|
1480
1519
|
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
1481
1520
|
document: SanityDocumentStub<R>,
|
|
1482
1521
|
options?: BaseMutationOptions,
|
|
1483
|
-
): Observable<
|
|
1522
|
+
): Observable<SanityDocument_2<R>>
|
|
1484
1523
|
/**
|
|
1485
1524
|
* Create a document if no document with the same ID already exists.
|
|
1486
1525
|
* Returns an observable that resolves to the created document.
|
|
@@ -1491,7 +1530,7 @@ declare class ObservableSanityClient {
|
|
|
1491
1530
|
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
1492
1531
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1493
1532
|
options: FirstDocumentMutationOptions,
|
|
1494
|
-
): Observable<
|
|
1533
|
+
): Observable<SanityDocument_2<R>>
|
|
1495
1534
|
/**
|
|
1496
1535
|
* Create a document if no document with the same ID already exists.
|
|
1497
1536
|
* Returns an observable that resolves to an array containing the created document.
|
|
@@ -1502,7 +1541,7 @@ declare class ObservableSanityClient {
|
|
|
1502
1541
|
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
1503
1542
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1504
1543
|
options: AllDocumentsMutationOptions,
|
|
1505
|
-
): Observable<
|
|
1544
|
+
): Observable<SanityDocument_2<R>[]>
|
|
1506
1545
|
/**
|
|
1507
1546
|
* Create a document if no document with the same ID already exists.
|
|
1508
1547
|
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
@@ -1535,7 +1574,7 @@ declare class ObservableSanityClient {
|
|
|
1535
1574
|
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
1536
1575
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1537
1576
|
options?: BaseMutationOptions,
|
|
1538
|
-
): Observable<
|
|
1577
|
+
): Observable<SanityDocument_2<R>>
|
|
1539
1578
|
/**
|
|
1540
1579
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
1541
1580
|
* Returns an observable that resolves to the created document.
|
|
@@ -1546,7 +1585,7 @@ declare class ObservableSanityClient {
|
|
|
1546
1585
|
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
1547
1586
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1548
1587
|
options: FirstDocumentMutationOptions,
|
|
1549
|
-
): Observable<
|
|
1588
|
+
): Observable<SanityDocument_2<R>>
|
|
1550
1589
|
/**
|
|
1551
1590
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
1552
1591
|
* Returns an observable that resolves to an array containing the created document.
|
|
@@ -1557,7 +1596,7 @@ declare class ObservableSanityClient {
|
|
|
1557
1596
|
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
1558
1597
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1559
1598
|
options: AllDocumentsMutationOptions,
|
|
1560
|
-
): Observable<
|
|
1599
|
+
): Observable<SanityDocument_2<R>[]>
|
|
1561
1600
|
/**
|
|
1562
1601
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
1563
1602
|
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
@@ -1590,7 +1629,7 @@ declare class ObservableSanityClient {
|
|
|
1590
1629
|
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
1591
1630
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1592
1631
|
options?: BaseMutationOptions,
|
|
1593
|
-
): Observable<
|
|
1632
|
+
): Observable<SanityDocument_2<R>>
|
|
1594
1633
|
/**
|
|
1595
1634
|
* Deletes a document with the given document ID.
|
|
1596
1635
|
* Returns an observable that resolves to the deleted document.
|
|
@@ -1601,7 +1640,7 @@ declare class ObservableSanityClient {
|
|
|
1601
1640
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1602
1641
|
id: string,
|
|
1603
1642
|
options: FirstDocumentMutationOptions,
|
|
1604
|
-
): Observable<
|
|
1643
|
+
): Observable<SanityDocument_2<R>>
|
|
1605
1644
|
/**
|
|
1606
1645
|
* Deletes a document with the given document ID.
|
|
1607
1646
|
* Returns an observable that resolves to an array containing the deleted document.
|
|
@@ -1612,7 +1651,7 @@ declare class ObservableSanityClient {
|
|
|
1612
1651
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1613
1652
|
id: string,
|
|
1614
1653
|
options: AllDocumentsMutationOptions,
|
|
1615
|
-
): Observable<
|
|
1654
|
+
): Observable<SanityDocument_2<R>[]>
|
|
1616
1655
|
/**
|
|
1617
1656
|
* Deletes a document with the given document ID.
|
|
1618
1657
|
* Returns an observable that resolves to a mutation result object containing the deleted document ID.
|
|
@@ -1639,7 +1678,7 @@ declare class ObservableSanityClient {
|
|
|
1639
1678
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1640
1679
|
id: string,
|
|
1641
1680
|
options?: BaseMutationOptions,
|
|
1642
|
-
): Observable<
|
|
1681
|
+
): Observable<SanityDocument_2<R>>
|
|
1643
1682
|
/**
|
|
1644
1683
|
* Deletes one or more documents matching the given query or document ID.
|
|
1645
1684
|
* Returns an observable that resolves to first deleted document.
|
|
@@ -1650,7 +1689,7 @@ declare class ObservableSanityClient {
|
|
|
1650
1689
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1651
1690
|
selection: MutationSelection,
|
|
1652
1691
|
options: FirstDocumentMutationOptions,
|
|
1653
|
-
): Observable<
|
|
1692
|
+
): Observable<SanityDocument_2<R>>
|
|
1654
1693
|
/**
|
|
1655
1694
|
* Deletes one or more documents matching the given query or document ID.
|
|
1656
1695
|
* Returns an observable that resolves to an array containing the deleted documents.
|
|
@@ -1661,7 +1700,7 @@ declare class ObservableSanityClient {
|
|
|
1661
1700
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1662
1701
|
selection: MutationSelection,
|
|
1663
1702
|
options: AllDocumentsMutationOptions,
|
|
1664
|
-
): Observable<
|
|
1703
|
+
): Observable<SanityDocument_2<R>[]>
|
|
1665
1704
|
/**
|
|
1666
1705
|
* Deletes one or more documents matching the given query or document ID.
|
|
1667
1706
|
* Returns an observable that resolves to a mutation result object containing the ID of the first deleted document.
|
|
@@ -1694,7 +1733,7 @@ declare class ObservableSanityClient {
|
|
|
1694
1733
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1695
1734
|
selection: MutationSelection,
|
|
1696
1735
|
options?: BaseMutationOptions,
|
|
1697
|
-
): Observable<
|
|
1736
|
+
): Observable<SanityDocument_2<R>>
|
|
1698
1737
|
/**
|
|
1699
1738
|
* Perform mutation operations against the configured dataset
|
|
1700
1739
|
* Returns an observable that resolves to the first mutated document.
|
|
@@ -1705,7 +1744,7 @@ declare class ObservableSanityClient {
|
|
|
1705
1744
|
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1706
1745
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1707
1746
|
options: FirstDocumentMutationOptions,
|
|
1708
|
-
): Observable<
|
|
1747
|
+
): Observable<SanityDocument_2<R>>
|
|
1709
1748
|
/**
|
|
1710
1749
|
* Perform mutation operations against the configured dataset.
|
|
1711
1750
|
* Returns an observable that resolves to an array of the mutated documents.
|
|
@@ -1716,7 +1755,7 @@ declare class ObservableSanityClient {
|
|
|
1716
1755
|
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1717
1756
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1718
1757
|
options: AllDocumentsMutationOptions,
|
|
1719
|
-
): Observable<
|
|
1758
|
+
): Observable<SanityDocument_2<R>[]>
|
|
1720
1759
|
/**
|
|
1721
1760
|
* Perform mutation operations against the configured dataset
|
|
1722
1761
|
* Returns an observable that resolves to a mutation result object containing the document ID of the first mutated document.
|
|
@@ -1749,7 +1788,7 @@ declare class ObservableSanityClient {
|
|
|
1749
1788
|
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1750
1789
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1751
1790
|
options?: BaseMutationOptions,
|
|
1752
|
-
): Observable<
|
|
1791
|
+
): Observable<SanityDocument_2<R>>
|
|
1753
1792
|
/**
|
|
1754
1793
|
* Create a new buildable patch of operations to perform
|
|
1755
1794
|
*
|
|
@@ -1829,7 +1868,7 @@ declare class ObservableTransaction extends BaseTransaction {
|
|
|
1829
1868
|
*/
|
|
1830
1869
|
commit<R extends Record<string, Any>>(
|
|
1831
1870
|
options: TransactionFirstDocumentMutationOptions,
|
|
1832
|
-
): Observable<
|
|
1871
|
+
): Observable<SanityDocument_2<R>>
|
|
1833
1872
|
/**
|
|
1834
1873
|
* Commit the transaction, returning an observable that produces an array of the mutated documents
|
|
1835
1874
|
*
|
|
@@ -1837,7 +1876,7 @@ declare class ObservableTransaction extends BaseTransaction {
|
|
|
1837
1876
|
*/
|
|
1838
1877
|
commit<R extends Record<string, Any>>(
|
|
1839
1878
|
options: TransactionAllDocumentsMutationOptions,
|
|
1840
|
-
): Observable<
|
|
1879
|
+
): Observable<SanityDocument_2<R>[]>
|
|
1841
1880
|
/**
|
|
1842
1881
|
* Commit the transaction, returning an observable that produces a mutation result object
|
|
1843
1882
|
*
|
|
@@ -1911,7 +1950,7 @@ declare class Patch extends BasePatch {
|
|
|
1911
1950
|
*/
|
|
1912
1951
|
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1913
1952
|
options: FirstDocumentMutationOptions,
|
|
1914
|
-
): Promise<
|
|
1953
|
+
): Promise<SanityDocument_2<R>>
|
|
1915
1954
|
/**
|
|
1916
1955
|
* Commit the patch, returning a promise that resolves to an array of the mutated documents
|
|
1917
1956
|
*
|
|
@@ -1919,7 +1958,7 @@ declare class Patch extends BasePatch {
|
|
|
1919
1958
|
*/
|
|
1920
1959
|
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1921
1960
|
options: AllDocumentsMutationOptions,
|
|
1922
|
-
): Promise<
|
|
1961
|
+
): Promise<SanityDocument_2<R>[]>
|
|
1923
1962
|
/**
|
|
1924
1963
|
* Commit the patch, returning a promise that resolves to a mutation result object
|
|
1925
1964
|
*
|
|
@@ -1939,7 +1978,7 @@ declare class Patch extends BasePatch {
|
|
|
1939
1978
|
*/
|
|
1940
1979
|
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1941
1980
|
options?: BaseMutationOptions,
|
|
1942
|
-
): Promise<
|
|
1981
|
+
): Promise<SanityDocument_2<R>>
|
|
1943
1982
|
}
|
|
1944
1983
|
|
|
1945
1984
|
/** @public */
|
|
@@ -2124,9 +2163,6 @@ declare type ReconnectEvent = {
|
|
|
2124
2163
|
type: 'reconnect'
|
|
2125
2164
|
}
|
|
2126
2165
|
|
|
2127
|
-
/** @public */
|
|
2128
|
-
declare type ReleaseId = `r${string}`
|
|
2129
|
-
|
|
2130
2166
|
/**
|
|
2131
2167
|
* Replaces an existing draft document.
|
|
2132
2168
|
* At least one of the draft or published versions of the document must exist.
|
|
@@ -2160,6 +2196,13 @@ declare interface RequestOptions {
|
|
|
2160
2196
|
/** @alpha */
|
|
2161
2197
|
declare type ResolveStudioUrl = (sourceDocument: ContentSourceMapDocuments[number]) => StudioUrl
|
|
2162
2198
|
|
|
2199
|
+
/**
|
|
2200
|
+
* Resources are entities that can be managed and accessed through the
|
|
2201
|
+
* Access API.
|
|
2202
|
+
*
|
|
2203
|
+
*/
|
|
2204
|
+
declare type ResourceType = 'organization' | 'project'
|
|
2205
|
+
|
|
2163
2206
|
/** @public */
|
|
2164
2207
|
declare interface ResponseEvent<T = unknown> {
|
|
2165
2208
|
type: 'response'
|
|
@@ -2191,7 +2234,7 @@ declare interface ResponseQueryOptions extends RequestOptions {
|
|
|
2191
2234
|
}
|
|
2192
2235
|
|
|
2193
2236
|
/** @internal */
|
|
2194
|
-
declare interface SanityAssetDocument extends
|
|
2237
|
+
declare interface SanityAssetDocument extends SanityDocument_2 {
|
|
2195
2238
|
url: string
|
|
2196
2239
|
path: string
|
|
2197
2240
|
size: number
|
|
@@ -2308,7 +2351,7 @@ declare class SanityClient {
|
|
|
2308
2351
|
signal?: AbortSignal
|
|
2309
2352
|
tag?: string
|
|
2310
2353
|
},
|
|
2311
|
-
): Promise<
|
|
2354
|
+
): Promise<SanityDocument_2<R> | undefined>
|
|
2312
2355
|
/**
|
|
2313
2356
|
* Fetch multiple documents in one request.
|
|
2314
2357
|
* Should be used sparingly - performing a query is usually a better option.
|
|
@@ -2324,7 +2367,7 @@ declare class SanityClient {
|
|
|
2324
2367
|
signal?: AbortSignal
|
|
2325
2368
|
tag?: string
|
|
2326
2369
|
},
|
|
2327
|
-
): Promise<(
|
|
2370
|
+
): Promise<(SanityDocument_2<R> | null)[]>
|
|
2328
2371
|
/**
|
|
2329
2372
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
2330
2373
|
* Returns a promise that resolves to the created document.
|
|
@@ -2335,7 +2378,7 @@ declare class SanityClient {
|
|
|
2335
2378
|
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
2336
2379
|
document: SanityDocumentStub<R>,
|
|
2337
2380
|
options: FirstDocumentMutationOptions,
|
|
2338
|
-
): Promise<
|
|
2381
|
+
): Promise<SanityDocument_2<R>>
|
|
2339
2382
|
/**
|
|
2340
2383
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
2341
2384
|
* Returns a promise that resolves to an array containing the created document.
|
|
@@ -2346,7 +2389,7 @@ declare class SanityClient {
|
|
|
2346
2389
|
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
2347
2390
|
document: SanityDocumentStub<R>,
|
|
2348
2391
|
options: AllDocumentsMutationOptions,
|
|
2349
|
-
): Promise<
|
|
2392
|
+
): Promise<SanityDocument_2<R>[]>
|
|
2350
2393
|
/**
|
|
2351
2394
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
2352
2395
|
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
@@ -2379,7 +2422,7 @@ declare class SanityClient {
|
|
|
2379
2422
|
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
2380
2423
|
document: SanityDocumentStub<R>,
|
|
2381
2424
|
options?: BaseMutationOptions,
|
|
2382
|
-
): Promise<
|
|
2425
|
+
): Promise<SanityDocument_2<R>>
|
|
2383
2426
|
/**
|
|
2384
2427
|
* Create a document if no document with the same ID already exists.
|
|
2385
2428
|
* Returns a promise that resolves to the created document.
|
|
@@ -2390,7 +2433,7 @@ declare class SanityClient {
|
|
|
2390
2433
|
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
2391
2434
|
document: IdentifiedSanityDocumentStub<R>,
|
|
2392
2435
|
options: FirstDocumentMutationOptions,
|
|
2393
|
-
): Promise<
|
|
2436
|
+
): Promise<SanityDocument_2<R>>
|
|
2394
2437
|
/**
|
|
2395
2438
|
* Create a document if no document with the same ID already exists.
|
|
2396
2439
|
* Returns a promise that resolves to an array containing the created document.
|
|
@@ -2401,7 +2444,7 @@ declare class SanityClient {
|
|
|
2401
2444
|
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
2402
2445
|
document: IdentifiedSanityDocumentStub<R>,
|
|
2403
2446
|
options: AllDocumentsMutationOptions,
|
|
2404
|
-
): Promise<
|
|
2447
|
+
): Promise<SanityDocument_2<R>[]>
|
|
2405
2448
|
/**
|
|
2406
2449
|
* Create a document if no document with the same ID already exists.
|
|
2407
2450
|
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
@@ -2434,7 +2477,7 @@ declare class SanityClient {
|
|
|
2434
2477
|
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
2435
2478
|
document: IdentifiedSanityDocumentStub<R>,
|
|
2436
2479
|
options?: BaseMutationOptions,
|
|
2437
|
-
): Promise<
|
|
2480
|
+
): Promise<SanityDocument_2<R>>
|
|
2438
2481
|
/**
|
|
2439
2482
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
2440
2483
|
* Returns a promise that resolves to the created document.
|
|
@@ -2445,7 +2488,7 @@ declare class SanityClient {
|
|
|
2445
2488
|
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
2446
2489
|
document: IdentifiedSanityDocumentStub<R>,
|
|
2447
2490
|
options: FirstDocumentMutationOptions,
|
|
2448
|
-
): Promise<
|
|
2491
|
+
): Promise<SanityDocument_2<R>>
|
|
2449
2492
|
/**
|
|
2450
2493
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
2451
2494
|
* Returns a promise that resolves to an array containing the created document.
|
|
@@ -2456,7 +2499,7 @@ declare class SanityClient {
|
|
|
2456
2499
|
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
2457
2500
|
document: IdentifiedSanityDocumentStub<R>,
|
|
2458
2501
|
options: AllDocumentsMutationOptions,
|
|
2459
|
-
): Promise<
|
|
2502
|
+
): Promise<SanityDocument_2<R>[]>
|
|
2460
2503
|
/**
|
|
2461
2504
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
2462
2505
|
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
@@ -2489,7 +2532,7 @@ declare class SanityClient {
|
|
|
2489
2532
|
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
2490
2533
|
document: IdentifiedSanityDocumentStub<R>,
|
|
2491
2534
|
options?: BaseMutationOptions,
|
|
2492
|
-
): Promise<
|
|
2535
|
+
): Promise<SanityDocument_2<R>>
|
|
2493
2536
|
/**
|
|
2494
2537
|
* Deletes a document with the given document ID.
|
|
2495
2538
|
* Returns a promise that resolves to the deleted document.
|
|
@@ -2500,7 +2543,7 @@ declare class SanityClient {
|
|
|
2500
2543
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2501
2544
|
id: string,
|
|
2502
2545
|
options: FirstDocumentMutationOptions,
|
|
2503
|
-
): Promise<
|
|
2546
|
+
): Promise<SanityDocument_2<R>>
|
|
2504
2547
|
/**
|
|
2505
2548
|
* Deletes a document with the given document ID.
|
|
2506
2549
|
* Returns a promise that resolves to an array containing the deleted document.
|
|
@@ -2511,7 +2554,7 @@ declare class SanityClient {
|
|
|
2511
2554
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2512
2555
|
id: string,
|
|
2513
2556
|
options: AllDocumentsMutationOptions,
|
|
2514
|
-
): Promise<
|
|
2557
|
+
): Promise<SanityDocument_2<R>[]>
|
|
2515
2558
|
/**
|
|
2516
2559
|
* Deletes a document with the given document ID.
|
|
2517
2560
|
* Returns a promise that resolves to a mutation result object containing the deleted document ID.
|
|
@@ -2538,7 +2581,7 @@ declare class SanityClient {
|
|
|
2538
2581
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2539
2582
|
id: string,
|
|
2540
2583
|
options?: BaseMutationOptions,
|
|
2541
|
-
): Promise<
|
|
2584
|
+
): Promise<SanityDocument_2<R>>
|
|
2542
2585
|
/**
|
|
2543
2586
|
* Deletes one or more documents matching the given query or document ID.
|
|
2544
2587
|
* Returns a promise that resolves to first deleted document.
|
|
@@ -2549,7 +2592,7 @@ declare class SanityClient {
|
|
|
2549
2592
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2550
2593
|
selection: MutationSelection,
|
|
2551
2594
|
options: FirstDocumentMutationOptions,
|
|
2552
|
-
): Promise<
|
|
2595
|
+
): Promise<SanityDocument_2<R>>
|
|
2553
2596
|
/**
|
|
2554
2597
|
* Deletes one or more documents matching the given query or document ID.
|
|
2555
2598
|
* Returns a promise that resolves to an array containing the deleted documents.
|
|
@@ -2560,7 +2603,7 @@ declare class SanityClient {
|
|
|
2560
2603
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2561
2604
|
selection: MutationSelection,
|
|
2562
2605
|
options: AllDocumentsMutationOptions,
|
|
2563
|
-
): Promise<
|
|
2606
|
+
): Promise<SanityDocument_2<R>[]>
|
|
2564
2607
|
/**
|
|
2565
2608
|
* Deletes one or more documents matching the given query or document ID.
|
|
2566
2609
|
* Returns a promise that resolves to a mutation result object containing the ID of the first deleted document.
|
|
@@ -2593,7 +2636,7 @@ declare class SanityClient {
|
|
|
2593
2636
|
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2594
2637
|
selection: MutationSelection,
|
|
2595
2638
|
options?: BaseMutationOptions,
|
|
2596
|
-
): Promise<
|
|
2639
|
+
): Promise<SanityDocument_2<R>>
|
|
2597
2640
|
/**
|
|
2598
2641
|
* Perform mutation operations against the configured dataset
|
|
2599
2642
|
* Returns a promise that resolves to the first mutated document.
|
|
@@ -2604,7 +2647,7 @@ declare class SanityClient {
|
|
|
2604
2647
|
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
2605
2648
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
2606
2649
|
options: FirstDocumentMutationOptions,
|
|
2607
|
-
): Promise<
|
|
2650
|
+
): Promise<SanityDocument_2<R>>
|
|
2608
2651
|
/**
|
|
2609
2652
|
* Perform mutation operations against the configured dataset.
|
|
2610
2653
|
* Returns a promise that resolves to an array of the mutated documents.
|
|
@@ -2615,7 +2658,7 @@ declare class SanityClient {
|
|
|
2615
2658
|
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
2616
2659
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
2617
2660
|
options: AllDocumentsMutationOptions,
|
|
2618
|
-
): Promise<
|
|
2661
|
+
): Promise<SanityDocument_2<R>[]>
|
|
2619
2662
|
/**
|
|
2620
2663
|
* Perform mutation operations against the configured dataset
|
|
2621
2664
|
* Returns a promise that resolves to a mutation result object containing the document ID of the first mutated document.
|
|
@@ -2648,7 +2691,7 @@ declare class SanityClient {
|
|
|
2648
2691
|
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
2649
2692
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
2650
2693
|
options?: BaseMutationOptions,
|
|
2651
|
-
): Promise<
|
|
2694
|
+
): Promise<SanityDocument_2<R>>
|
|
2652
2695
|
/**
|
|
2653
2696
|
* Create a new buildable patch of operations to perform
|
|
2654
2697
|
*
|
|
@@ -2727,8 +2770,10 @@ declare class SanityClient {
|
|
|
2727
2770
|
getDataUrl(operation: string, path?: string): string
|
|
2728
2771
|
}
|
|
2729
2772
|
|
|
2773
|
+
export {SanityDocument}
|
|
2774
|
+
|
|
2730
2775
|
/** @internal */
|
|
2731
|
-
declare type
|
|
2776
|
+
declare type SanityDocument_2<T extends Record<string, Any> = Record<string, Any>> = {
|
|
2732
2777
|
[P in keyof T]: T[P]
|
|
2733
2778
|
} & {
|
|
2734
2779
|
_id: string
|
|
@@ -2792,7 +2837,7 @@ declare interface SanityImagePalette {
|
|
|
2792
2837
|
title: string
|
|
2793
2838
|
}
|
|
2794
2839
|
|
|
2795
|
-
/** @
|
|
2840
|
+
/** @public */
|
|
2796
2841
|
declare interface SanityProject {
|
|
2797
2842
|
id: string
|
|
2798
2843
|
displayName: string
|
|
@@ -2820,7 +2865,7 @@ declare interface SanityProject {
|
|
|
2820
2865
|
}
|
|
2821
2866
|
}
|
|
2822
2867
|
|
|
2823
|
-
/** @
|
|
2868
|
+
/** @public */
|
|
2824
2869
|
declare interface SanityProjectMember {
|
|
2825
2870
|
id: string
|
|
2826
2871
|
role: string
|
|
@@ -2831,7 +2876,7 @@ declare interface SanityProjectMember {
|
|
|
2831
2876
|
/** @public */
|
|
2832
2877
|
declare interface SanityQueries {}
|
|
2833
2878
|
|
|
2834
|
-
/** @
|
|
2879
|
+
/** @public */
|
|
2835
2880
|
declare interface SanityUser {
|
|
2836
2881
|
id: string
|
|
2837
2882
|
projectId: string
|
|
@@ -2860,6 +2905,14 @@ declare interface SingleMutationResult {
|
|
|
2860
2905
|
}[]
|
|
2861
2906
|
}
|
|
2862
2907
|
|
|
2908
|
+
/** @public */
|
|
2909
|
+
declare type StackablePerspective = ('published' | 'drafts' | string) & {}
|
|
2910
|
+
|
|
2911
|
+
/**
|
|
2912
|
+
* @public
|
|
2913
|
+
*/
|
|
2914
|
+
declare type Status = 'idle' | 'handshaking' | 'connected' | 'disconnected'
|
|
2915
|
+
|
|
2863
2916
|
/** @public */
|
|
2864
2917
|
declare interface StegaConfig {
|
|
2865
2918
|
/**
|
|
@@ -2924,7 +2977,7 @@ declare class Transaction extends BaseTransaction {
|
|
|
2924
2977
|
*/
|
|
2925
2978
|
commit<R extends Record<string, Any>>(
|
|
2926
2979
|
options: TransactionFirstDocumentMutationOptions,
|
|
2927
|
-
): Promise<
|
|
2980
|
+
): Promise<SanityDocument_2<R>>
|
|
2928
2981
|
/**
|
|
2929
2982
|
* Commit the transaction, returning a promise that resolves to an array of the mutated documents
|
|
2930
2983
|
*
|
|
@@ -2932,7 +2985,7 @@ declare class Transaction extends BaseTransaction {
|
|
|
2932
2985
|
*/
|
|
2933
2986
|
commit<R extends Record<string, Any>>(
|
|
2934
2987
|
options: TransactionAllDocumentsMutationOptions,
|
|
2935
|
-
): Promise<
|
|
2988
|
+
): Promise<SanityDocument_2<R>[]>
|
|
2936
2989
|
/**
|
|
2937
2990
|
* Commit the transaction, returning a promise that resolves to a mutation result object
|
|
2938
2991
|
*
|
|
@@ -3106,8 +3159,51 @@ declare interface UploadClientConfig {
|
|
|
3106
3159
|
}
|
|
3107
3160
|
}
|
|
3108
3161
|
|
|
3109
|
-
/**
|
|
3110
|
-
|
|
3162
|
+
/**
|
|
3163
|
+
*
|
|
3164
|
+
* @beta
|
|
3165
|
+
*
|
|
3166
|
+
* Provides a callback for applying one or more actions to a document.
|
|
3167
|
+
*
|
|
3168
|
+
* @category Documents
|
|
3169
|
+
* @returns A function that takes one more more {@link DocumentAction}s and returns a promise that resolves to an {@link ActionsResult}.
|
|
3170
|
+
* @example Publish or unpublish a document
|
|
3171
|
+
* ```
|
|
3172
|
+
* import { publishDocument, unpublishDocument } from '@sanity/sdk'
|
|
3173
|
+
* import { useApplyActions } from '@sanity/sdk-react'
|
|
3174
|
+
*
|
|
3175
|
+
* const apply = useApplyActions()
|
|
3176
|
+
* const myDocument = { _id: 'my-document-id', _type: 'my-document-type' }
|
|
3177
|
+
*
|
|
3178
|
+
* return (
|
|
3179
|
+
* <button onClick={() => apply(publishDocument(myDocument))}>Publish</button>
|
|
3180
|
+
* <button onClick={() => apply(unpublishDocument(myDocument))}>Unpublish</button>
|
|
3181
|
+
* )
|
|
3182
|
+
* ```
|
|
3183
|
+
*
|
|
3184
|
+
* @example Create and publish a new document
|
|
3185
|
+
* ```
|
|
3186
|
+
* import { createDocument, publishDocument } from '@sanity/sdk'
|
|
3187
|
+
* import { useApplyActions } from '@sanity/sdk-react'
|
|
3188
|
+
*
|
|
3189
|
+
* const apply = useApplyActions()
|
|
3190
|
+
*
|
|
3191
|
+
* const handleCreateAndPublish = () => {
|
|
3192
|
+
* const handle = { _id: window.crypto.randomUUID(), _type: 'my-document-type' }
|
|
3193
|
+
* apply([
|
|
3194
|
+
* createDocument(handle),
|
|
3195
|
+
* publishDocument(handle),
|
|
3196
|
+
* ])
|
|
3197
|
+
* }
|
|
3198
|
+
*
|
|
3199
|
+
* return (
|
|
3200
|
+
* <button onClick={handleCreateAndPublish}>
|
|
3201
|
+
* I’m feeling lucky
|
|
3202
|
+
* </button>
|
|
3203
|
+
* )
|
|
3204
|
+
* ```
|
|
3205
|
+
*/
|
|
3206
|
+
export declare function useApplyActions(): <TDocument extends SanityDocument>(
|
|
3111
3207
|
action: DocumentAction<TDocument> | DocumentAction<TDocument>[],
|
|
3112
3208
|
options?: ApplyActionsOptions,
|
|
3113
3209
|
) => Promise<ActionsResult<TDocument>>
|
|
@@ -3132,8 +3228,6 @@ export declare function useApplyActions(): <TDocument extends SanityDocument_2>(
|
|
|
3132
3228
|
* return <div>Current auth state: {authState}</div>
|
|
3133
3229
|
* }
|
|
3134
3230
|
* ```
|
|
3135
|
-
*
|
|
3136
|
-
* @public
|
|
3137
3231
|
*/
|
|
3138
3232
|
export declare const useAuthState: () => AuthState
|
|
3139
3233
|
|
|
@@ -3152,6 +3246,7 @@ export declare const useAuthToken: () => string | null
|
|
|
3152
3246
|
* The hook uses `useSyncExternalStore` to safely subscribe to changes
|
|
3153
3247
|
* and ensure consistency between server and client rendering.
|
|
3154
3248
|
*
|
|
3249
|
+
* @category Platform
|
|
3155
3250
|
* @returns A Sanity client
|
|
3156
3251
|
*
|
|
3157
3252
|
* @example
|
|
@@ -3176,9 +3271,10 @@ export declare function useClient(options: ClientOptions): SanityClient
|
|
|
3176
3271
|
*
|
|
3177
3272
|
* @public
|
|
3178
3273
|
*
|
|
3179
|
-
*
|
|
3274
|
+
* Provides the currently authenticated user’s profile information (their name, email, roles, etc).
|
|
3180
3275
|
* If no users are currently logged in, the hook returns null.
|
|
3181
3276
|
*
|
|
3277
|
+
* @category Authentication
|
|
3182
3278
|
* @returns The current user data, or `null` if not authenticated
|
|
3183
3279
|
*
|
|
3184
3280
|
* @example Rendering a basic user profile
|
|
@@ -3195,30 +3291,115 @@ export declare function useClient(options: ClientOptions): SanityClient
|
|
|
3195
3291
|
*/
|
|
3196
3292
|
export declare const useCurrentUser: () => CurrentUser | null
|
|
3197
3293
|
|
|
3198
|
-
/**
|
|
3294
|
+
/**
|
|
3295
|
+
* @beta
|
|
3296
|
+
*
|
|
3297
|
+
* ## useDocument(doc, path)
|
|
3298
|
+
* Read and subscribe to nested values in a document
|
|
3299
|
+
* @category Documents
|
|
3300
|
+
* @param doc - The document to read state from
|
|
3301
|
+
* @param path - The path to the nested value to read from
|
|
3302
|
+
* @returns The value at the specified path
|
|
3303
|
+
* @example
|
|
3304
|
+
* ```tsx
|
|
3305
|
+
* import {type DocumentHandle, useDocument} from '@sanity/sdk-react'
|
|
3306
|
+
*
|
|
3307
|
+
* function OrderLink({documentHandle}: {documentHandle: DocumentHandle}) {
|
|
3308
|
+
* const title = useDocument(documentHandle, 'title')
|
|
3309
|
+
* const id = useDocument(documentHandle, '_id')
|
|
3310
|
+
*
|
|
3311
|
+
* return (
|
|
3312
|
+
* <a href=`/order/${id}`>Order {title} today!</a>
|
|
3313
|
+
* )
|
|
3314
|
+
* }
|
|
3315
|
+
* ```
|
|
3316
|
+
*
|
|
3317
|
+
*/
|
|
3199
3318
|
export declare function useDocument<
|
|
3200
|
-
TDocument extends
|
|
3319
|
+
TDocument extends SanityDocument,
|
|
3201
3320
|
TPath extends JsonMatchPath<TDocument>,
|
|
3202
3321
|
>(doc: string | DocumentHandle<TDocument>, path: TPath): JsonMatch<TDocument, TPath> | undefined
|
|
3203
3322
|
|
|
3204
|
-
/**
|
|
3205
|
-
|
|
3323
|
+
/**
|
|
3324
|
+
* @beta
|
|
3325
|
+
* ## useDocument(doc)
|
|
3326
|
+
* Read and subscribe to an entire document
|
|
3327
|
+
* @param doc - The document to read state from
|
|
3328
|
+
* @returns The document state as an object
|
|
3329
|
+
* @example
|
|
3330
|
+
* ```tsx
|
|
3331
|
+
* import {type SanityDocument, type DocumentHandle, useDocument} from '@sanity/sdk-react'
|
|
3332
|
+
*
|
|
3333
|
+
* interface Book extends SanityDocument {
|
|
3334
|
+
* title: string
|
|
3335
|
+
* author: string
|
|
3336
|
+
* summary: string
|
|
3337
|
+
* }
|
|
3338
|
+
*
|
|
3339
|
+
* function DocumentView({documentHandle}: {documentHandle: DocumentHandle}) {
|
|
3340
|
+
* const book = useDocument<Book>(documentHandle)
|
|
3341
|
+
*
|
|
3342
|
+
* return (
|
|
3343
|
+
* <article>
|
|
3344
|
+
* <h1>{book?.title}</h1>
|
|
3345
|
+
* <address>By {book?.author}</address>
|
|
3346
|
+
*
|
|
3347
|
+
* <h2>Summary</h2>
|
|
3348
|
+
* {book?.summary}
|
|
3349
|
+
*
|
|
3350
|
+
* <h2>Order</h2>
|
|
3351
|
+
* <a href=`/order/${book._id}`>Order {book?.title} today!</a>
|
|
3352
|
+
* </article>
|
|
3353
|
+
* )
|
|
3354
|
+
* }
|
|
3355
|
+
* ```
|
|
3356
|
+
*
|
|
3357
|
+
*/
|
|
3358
|
+
export declare function useDocument<TDocument extends SanityDocument>(
|
|
3206
3359
|
doc: string | DocumentHandle<TDocument>,
|
|
3207
3360
|
): TDocument | null
|
|
3208
3361
|
|
|
3209
|
-
/**
|
|
3362
|
+
/**
|
|
3363
|
+
*
|
|
3364
|
+
* @beta
|
|
3365
|
+
*
|
|
3366
|
+
* Subscribes an event handler to events in your application’s document store, such as document
|
|
3367
|
+
* creation, deletion, and updates.
|
|
3368
|
+
*
|
|
3369
|
+
* @category Documents
|
|
3370
|
+
* @param handler - The event handler to register.
|
|
3371
|
+
* @example
|
|
3372
|
+
* ```
|
|
3373
|
+
* import {useDocumentEvent} from '@sanity/sdk-react'
|
|
3374
|
+
* import {type DocumentEvent} from '@sanity/sdk'
|
|
3375
|
+
*
|
|
3376
|
+
* useDocumentEvent((event) => {
|
|
3377
|
+
* if (event.type === DocumentEvent.DocumentDeletedEvent) {
|
|
3378
|
+
* alert(`Document with ID ${event.documentId} deleted!`)
|
|
3379
|
+
* } else {
|
|
3380
|
+
* console.log(event)
|
|
3381
|
+
* }
|
|
3382
|
+
* })
|
|
3383
|
+
* ```
|
|
3384
|
+
*/
|
|
3210
3385
|
export declare function useDocumentEvent(handler: (documentEvent: DocumentEvent) => void): void
|
|
3211
3386
|
|
|
3212
3387
|
/**
|
|
3213
3388
|
* @public
|
|
3214
3389
|
*
|
|
3215
|
-
*
|
|
3216
|
-
*
|
|
3390
|
+
* Retrieves and provides access to a live collection of {@link DocumentHandle}s, with an optional filter and sort applied.
|
|
3391
|
+
* The returned document handles are canonical — that is, they refer to the document in its current state, whether draft, published, or within a release or perspective.
|
|
3392
|
+
* Because the returned document handle collection is live, the results will update in real time until the component invoking the hook is unmounted.
|
|
3393
|
+
*
|
|
3394
|
+
* @remarks
|
|
3395
|
+
* {@link DocumentHandle}s are used by many other hooks (such as {@link usePreview}, {@link useDocument}, and {@link useEditDocument})
|
|
3396
|
+
* to work with documents in various ways without the entire document needing to be fetched upfront.
|
|
3217
3397
|
*
|
|
3398
|
+
* @category Documents
|
|
3218
3399
|
* @param options - Options for narrowing and sorting the document collection
|
|
3219
|
-
* @returns The collection of
|
|
3400
|
+
* @returns The collection of document handles matching the provided options (if any), as well as properties describing the collection and a function to load more.
|
|
3220
3401
|
*
|
|
3221
|
-
* @example Retrieving all documents of type 'movie'
|
|
3402
|
+
* @example Retrieving document handles for all documents of type 'movie'
|
|
3222
3403
|
* ```
|
|
3223
3404
|
* const { results, isPending } = useDocuments({ filter: '_type == "movie"' })
|
|
3224
3405
|
*
|
|
@@ -3235,7 +3416,7 @@ export declare function useDocumentEvent(handler: (documentEvent: DocumentEvent)
|
|
|
3235
3416
|
* )
|
|
3236
3417
|
* ```
|
|
3237
3418
|
*
|
|
3238
|
-
* @example Retrieving all movies released since 1980, sorted by director’s last name
|
|
3419
|
+
* @example Retrieving document handles for all movies released since 1980, sorted by director’s last name
|
|
3239
3420
|
* ```
|
|
3240
3421
|
* const { results } = useDocuments({
|
|
3241
3422
|
* filter: '_type == "movie" && releaseDate >= "1980-01-01"',
|
|
@@ -3260,24 +3441,150 @@ export declare function useDocumentEvent(handler: (documentEvent: DocumentEvent)
|
|
|
3260
3441
|
* )
|
|
3261
3442
|
* ```
|
|
3262
3443
|
*/
|
|
3263
|
-
export declare function useDocuments(options?: DocumentListOptions):
|
|
3444
|
+
export declare function useDocuments(options?: DocumentListOptions): DocumentHandleCollection
|
|
3264
3445
|
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3446
|
+
declare type UseDocumentSyncStatus = {
|
|
3447
|
+
/**
|
|
3448
|
+
* Exposes the document’s sync status between local and remote document states.
|
|
3449
|
+
*
|
|
3450
|
+
* @category Documents
|
|
3451
|
+
* @param doc - The document handle to get sync status for
|
|
3452
|
+
* @returns `true` if local changes are synced with remote, `false` if the changes are not synced, and `undefined` if the document is not found
|
|
3453
|
+
* @example Disable a Save button when there are no changes to sync
|
|
3454
|
+
* ```
|
|
3455
|
+
* const myDocumentHandle = { _id: 'documentId', _type: 'documentType' }
|
|
3456
|
+
* const documentSynced = useDocumentSyncStatus(myDocumentHandle)
|
|
3457
|
+
*
|
|
3458
|
+
* return (
|
|
3459
|
+
* <button disabled={documentSynced}>
|
|
3460
|
+
* Save Changes
|
|
3461
|
+
* </button>
|
|
3462
|
+
* )
|
|
3463
|
+
* ```
|
|
3464
|
+
*/
|
|
3465
|
+
(doc: DocumentHandle): boolean | undefined
|
|
3466
|
+
}
|
|
3269
3467
|
|
|
3270
3468
|
/** @beta */
|
|
3469
|
+
export declare const useDocumentSyncStatus: UseDocumentSyncStatus
|
|
3470
|
+
|
|
3471
|
+
/**
|
|
3472
|
+
*
|
|
3473
|
+
* @beta
|
|
3474
|
+
*
|
|
3475
|
+
* ## useEditDocument(doc, path)
|
|
3476
|
+
* Edit a nested value within a document
|
|
3477
|
+
*
|
|
3478
|
+
* @category Documents
|
|
3479
|
+
* @param doc - The document to be edited; either as a document handle or the document’s ID a string
|
|
3480
|
+
* @param path - The path to the nested value to be edited
|
|
3481
|
+
* @returns A function to update the nested value. Accepts either a new value, or an updater function that exposes the previous value and returns a new value.
|
|
3482
|
+
* @example Update a document’s name by providing the new value directly
|
|
3483
|
+
* ```
|
|
3484
|
+
* const handle = { _id: 'documentId', _type: 'documentType' }
|
|
3485
|
+
* const name = useDocument(handle, 'name')
|
|
3486
|
+
* const editName = useEditDocument(handle, 'name')
|
|
3487
|
+
*
|
|
3488
|
+
* function handleNameChange(event: React.ChangeEvent<HTMLInputElement>) {
|
|
3489
|
+
* editName(event.target.value)
|
|
3490
|
+
* }
|
|
3491
|
+
*
|
|
3492
|
+
* return (
|
|
3493
|
+
* <input type='text' value={name} onChange={handleNameChange} />
|
|
3494
|
+
* )
|
|
3495
|
+
* ```
|
|
3496
|
+
*
|
|
3497
|
+
* @example Update a count on a document by providing an updater function
|
|
3498
|
+
* ```
|
|
3499
|
+
* const handle = { _id: 'documentId', _type: 'documentType' }
|
|
3500
|
+
* const count = useDocument(handle, 'count')
|
|
3501
|
+
* const editCount = useEditDocument(handle, 'count')
|
|
3502
|
+
*
|
|
3503
|
+
* function incrementCount() {
|
|
3504
|
+
* editCount(previousCount => previousCount + 1)
|
|
3505
|
+
* }
|
|
3506
|
+
*
|
|
3507
|
+
* return (
|
|
3508
|
+
* <>
|
|
3509
|
+
* <button onClick={incrementCount}>
|
|
3510
|
+
* Increment
|
|
3511
|
+
* </button>
|
|
3512
|
+
* Current count: {count}
|
|
3513
|
+
* </>
|
|
3514
|
+
* )
|
|
3515
|
+
* ```
|
|
3516
|
+
*/
|
|
3271
3517
|
export declare function useEditDocument<
|
|
3272
|
-
TDocument extends
|
|
3518
|
+
TDocument extends SanityDocument,
|
|
3273
3519
|
TPath extends JsonMatchPath<TDocument>,
|
|
3274
3520
|
>(
|
|
3275
3521
|
doc: string | DocumentHandle<TDocument>,
|
|
3276
3522
|
path: TPath,
|
|
3277
3523
|
): (nextValue: Updater<JsonMatch<TDocument, TPath>>) => Promise<ActionsResult<TDocument>>
|
|
3278
3524
|
|
|
3279
|
-
/**
|
|
3280
|
-
|
|
3525
|
+
/**
|
|
3526
|
+
*
|
|
3527
|
+
* @beta
|
|
3528
|
+
*
|
|
3529
|
+
* ## useEditDocument(doc)
|
|
3530
|
+
* Edit an entire document
|
|
3531
|
+
* @param doc - The document to be edited; either as a document handle or the document’s ID a string
|
|
3532
|
+
* @returns A function to update the document state. Accepts either a new document state, or an updater function that exposes the previous document state and returns the new document state.
|
|
3533
|
+
* @example
|
|
3534
|
+
* ```
|
|
3535
|
+
* const myDocumentHandle = { _id: 'documentId', _type: 'documentType' }
|
|
3536
|
+
*
|
|
3537
|
+
* const myDocument = useDocument(myDocumentHandle)
|
|
3538
|
+
* const { title, price } = myDocument
|
|
3539
|
+
*
|
|
3540
|
+
* const editMyDocument = useEditDocument(myDocumentHandle)
|
|
3541
|
+
*
|
|
3542
|
+
* function handleFieldChange(e: React.ChangeEvent<HTMLInputElement>) {
|
|
3543
|
+
* const {name, value} = e.currentTarget
|
|
3544
|
+
* // Use an updater function to update the document state based on the previous state
|
|
3545
|
+
* editMyDocument(previousDocument => ({
|
|
3546
|
+
* ...previousDocument,
|
|
3547
|
+
* [name]: value
|
|
3548
|
+
* }))
|
|
3549
|
+
* }
|
|
3550
|
+
*
|
|
3551
|
+
* function handleSaleChange(e: React.ChangeEvent<HTMLInputElement>) {
|
|
3552
|
+
* const { checked } = e.currentTarget
|
|
3553
|
+
* if (checked) {
|
|
3554
|
+
* // Use an updater function to add a new salePrice field;
|
|
3555
|
+
* // set it at a 20% discount off the normal price
|
|
3556
|
+
* editMyDocument(previousDocument => ({
|
|
3557
|
+
* ...previousDocument,
|
|
3558
|
+
* salePrice: previousDocument.price * 0.8,
|
|
3559
|
+
* }))
|
|
3560
|
+
* } else {
|
|
3561
|
+
* // Get the document state without the salePrice field
|
|
3562
|
+
* const { salePrice, ...rest } = myDocument
|
|
3563
|
+
* // Update the document state to remove the salePrice field
|
|
3564
|
+
* editMyDocument(rest)
|
|
3565
|
+
* }
|
|
3566
|
+
* }
|
|
3567
|
+
*
|
|
3568
|
+
* return (
|
|
3569
|
+
* <>
|
|
3570
|
+
* <form onSubmit={e => e.preventDefault()}>
|
|
3571
|
+
* <input name='title' type='text' value={title} onChange={handleFieldChange} />
|
|
3572
|
+
* <input name='price' type='number' value={price} onChange={handleFieldChange} />
|
|
3573
|
+
* <input
|
|
3574
|
+
* name='salePrice'
|
|
3575
|
+
* type='checkbox'
|
|
3576
|
+
* checked={Object(myDocument).hasOwnProperty('salePrice')}
|
|
3577
|
+
* onChange={handleSaleChange}
|
|
3578
|
+
* />
|
|
3579
|
+
* </form>
|
|
3580
|
+
* <pre><code>
|
|
3581
|
+
* {JSON.stringify(myDocument, null, 2)}
|
|
3582
|
+
* </code></pre>
|
|
3583
|
+
* </>
|
|
3584
|
+
* )
|
|
3585
|
+
* ```
|
|
3586
|
+
*/
|
|
3587
|
+
export declare function useEditDocument<TDocument extends SanityDocument>(
|
|
3281
3588
|
doc: string | DocumentHandle<TDocument>,
|
|
3282
3589
|
): (nextValue: Updater<TDocument>) => Promise<ActionsResult<TDocument>>
|
|
3283
3590
|
|
|
@@ -3296,7 +3603,17 @@ export declare interface UseFrameConnectionOptions<TWindowMessage extends Window
|
|
|
3296
3603
|
name: string
|
|
3297
3604
|
connectTo: string
|
|
3298
3605
|
targetOrigin: string
|
|
3299
|
-
onMessage?:
|
|
3606
|
+
onMessage?: {
|
|
3607
|
+
[K in TWindowMessage['type']]: (
|
|
3608
|
+
data: Extract<
|
|
3609
|
+
TWindowMessage,
|
|
3610
|
+
{
|
|
3611
|
+
type: K
|
|
3612
|
+
}
|
|
3613
|
+
>['data'],
|
|
3614
|
+
) => void
|
|
3615
|
+
}
|
|
3616
|
+
heartbeat?: boolean
|
|
3300
3617
|
}
|
|
3301
3618
|
|
|
3302
3619
|
/**
|
|
@@ -3391,14 +3708,20 @@ export declare function useLoginUrls(): AuthProvider[]
|
|
|
3391
3708
|
*/
|
|
3392
3709
|
export declare const useLogOut: () => () => Promise<void>
|
|
3393
3710
|
|
|
3711
|
+
/** @beta */
|
|
3712
|
+
export declare function usePermissions(
|
|
3713
|
+
actions: DocumentAction | DocumentAction[],
|
|
3714
|
+
): PermissionsResult
|
|
3715
|
+
|
|
3394
3716
|
/**
|
|
3395
|
-
* @
|
|
3717
|
+
* @beta
|
|
3396
3718
|
*
|
|
3397
|
-
*
|
|
3719
|
+
* Returns the preview values of a document (specified via a `DocumentHandle`),
|
|
3398
3720
|
* including the document’s `title`, `subtitle`, `media`, and `status`. These values are live and will update in realtime.
|
|
3399
3721
|
* To reduce unnecessary network requests for resolving the preview values, an optional `ref` can be passed to the hook so that preview
|
|
3400
3722
|
* resolution will only occur if the `ref` is intersecting the current viewport.
|
|
3401
3723
|
*
|
|
3724
|
+
* @category Documents
|
|
3402
3725
|
* @param options - The document handle for the document you want to resolve preview values for, and an optional ref
|
|
3403
3726
|
* @returns The preview values for the given document and a boolean to indicate whether the resolution is pending
|
|
3404
3727
|
*
|
|
@@ -3440,7 +3763,8 @@ export declare function usePreview({
|
|
|
3440
3763
|
}: UsePreviewOptions): UsePreviewResults
|
|
3441
3764
|
|
|
3442
3765
|
/**
|
|
3443
|
-
* @
|
|
3766
|
+
* @beta
|
|
3767
|
+
* @category Types
|
|
3444
3768
|
*/
|
|
3445
3769
|
export declare interface UsePreviewOptions {
|
|
3446
3770
|
document: DocumentHandle
|
|
@@ -3448,7 +3772,8 @@ export declare interface UsePreviewOptions {
|
|
|
3448
3772
|
}
|
|
3449
3773
|
|
|
3450
3774
|
/**
|
|
3451
|
-
* @
|
|
3775
|
+
* @beta
|
|
3776
|
+
* @category Types
|
|
3452
3777
|
*/
|
|
3453
3778
|
export declare interface UsePreviewResults {
|
|
3454
3779
|
/** The results of resolving the document’s preview values */
|
|
@@ -3457,6 +3782,28 @@ export declare interface UsePreviewResults {
|
|
|
3457
3782
|
isPending: boolean
|
|
3458
3783
|
}
|
|
3459
3784
|
|
|
3785
|
+
declare type User = {
|
|
3786
|
+
sanityUserId: string
|
|
3787
|
+
profile: UserProfile
|
|
3788
|
+
memberships: Memberships
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
declare type UserProfile = {
|
|
3792
|
+
id: string
|
|
3793
|
+
displayName: string
|
|
3794
|
+
email: string
|
|
3795
|
+
familyName?: string
|
|
3796
|
+
givenName?: string
|
|
3797
|
+
middleName?: string | null
|
|
3798
|
+
imageUrl?: string
|
|
3799
|
+
provider: string
|
|
3800
|
+
tosAcceptedAt?: string
|
|
3801
|
+
createdAt: string
|
|
3802
|
+
updatedAt?: string
|
|
3803
|
+
isCurrentUser?: boolean
|
|
3804
|
+
providerId?: string
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3460
3807
|
/** @public */
|
|
3461
3808
|
declare class UsersClient {
|
|
3462
3809
|
#private
|
|
@@ -3472,7 +3819,7 @@ declare class UsersClient {
|
|
|
3472
3819
|
/**
|
|
3473
3820
|
* `useSanityInstance` returns the current Sanity instance from the application context.
|
|
3474
3821
|
* This must be called from within a `SanityProvider` component.
|
|
3475
|
-
* @
|
|
3822
|
+
* @internal
|
|
3476
3823
|
* @returns The current Sanity instance
|
|
3477
3824
|
* @example
|
|
3478
3825
|
* ```tsx
|
|
@@ -3481,6 +3828,43 @@ declare class UsersClient {
|
|
|
3481
3828
|
*/
|
|
3482
3829
|
export declare const useSanityInstance: () => SanityInstance
|
|
3483
3830
|
|
|
3831
|
+
/** @public */
|
|
3832
|
+
export declare function useUsers(params: UseUsersParams): UseUsersResult
|
|
3833
|
+
|
|
3834
|
+
/**
|
|
3835
|
+
* @public
|
|
3836
|
+
*/
|
|
3837
|
+
declare interface UseUsersParams {
|
|
3838
|
+
/**
|
|
3839
|
+
* The type of resource to fetch users for.
|
|
3840
|
+
*/
|
|
3841
|
+
resourceType: ResourceType
|
|
3842
|
+
/**
|
|
3843
|
+
* The ID of the resource to fetch users for.
|
|
3844
|
+
*/
|
|
3845
|
+
resourceId: string
|
|
3846
|
+
/**
|
|
3847
|
+
* The limit of users to fetch.
|
|
3848
|
+
*/
|
|
3849
|
+
limit?: number
|
|
3850
|
+
}
|
|
3851
|
+
|
|
3852
|
+
/** @public */
|
|
3853
|
+
export declare interface UseUsersResult {
|
|
3854
|
+
/**
|
|
3855
|
+
* The users fetched.
|
|
3856
|
+
*/
|
|
3857
|
+
users: User[]
|
|
3858
|
+
/**
|
|
3859
|
+
* Whether there are more users to fetch.
|
|
3860
|
+
*/
|
|
3861
|
+
hasMore: boolean
|
|
3862
|
+
/**
|
|
3863
|
+
* Load more users.
|
|
3864
|
+
*/
|
|
3865
|
+
loadMore: () => void
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3484
3868
|
/**
|
|
3485
3869
|
* @internal
|
|
3486
3870
|
*/
|
|
@@ -3522,6 +3906,7 @@ export declare interface WindowConnection<TMessage extends WindowMessage> {
|
|
|
3522
3906
|
}
|
|
3523
3907
|
>['data'],
|
|
3524
3908
|
) => void
|
|
3909
|
+
status: Status
|
|
3525
3910
|
}
|
|
3526
3911
|
|
|
3527
3912
|
/**
|