@sanity/client 6.29.1 → 7.0.1-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,22 +59,16 @@ export type {
59
59
  }
60
60
 
61
61
  /** @public */
62
- export class ObservableSanityClient {
62
+ export class ObservableSanityClient implements ObservableSanityClientType {
63
63
  assets: ObservableAssetsClient
64
64
  datasets: ObservableDatasetsClient
65
65
  live: LiveClient
66
66
  projects: ObservableProjectsClient
67
67
  users: ObservableUsersClient
68
68
 
69
- /**
70
- * Private properties
71
- */
72
69
  #clientConfig: InitializedClientConfig
73
70
  #httpRequest: HttpRequest
74
71
 
75
- /**
76
- * Instance properties
77
- */
78
72
  listen = _listen
79
73
 
80
74
  constructor(httpRequest: HttpRequest, config: ClientConfig = defaultConfig) {
@@ -176,7 +170,7 @@ export class ObservableSanityClient {
176
170
  Q extends QueryWithoutParams | QueryParams = QueryParams,
177
171
  const G extends string = string,
178
172
  >(
179
- query: string,
173
+ query: G,
180
174
  params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
181
175
  options: UnfilteredResponseQueryOptions,
182
176
  ): Observable<RawQueryResponse<ClientReturn<G, R>>>
@@ -727,7 +721,7 @@ export class ObservableSanityClient {
727
721
  }
728
722
 
729
723
  /** @public */
730
- export class SanityClient {
724
+ export class SanityClient implements SanityClientType {
731
725
  assets: AssetsClient
732
726
  datasets: DatasetsClient
733
727
  live: LiveClient
@@ -739,15 +733,9 @@ export class SanityClient {
739
733
  */
740
734
  observable: ObservableSanityClient
741
735
 
742
- /**
743
- * Private properties
744
- */
745
736
  #clientConfig: InitializedClientConfig
746
737
  #httpRequest: HttpRequest
747
738
 
748
- /**
749
- * Instance properties
750
- */
751
739
  listen = _listen
752
740
 
753
741
  constructor(httpRequest: HttpRequest, config: ClientConfig = defaultConfig) {
@@ -1355,8 +1343,8 @@ export class SanityClient {
1355
1343
  * @param operations - Optional object of patch operations to initialize the patch instance with
1356
1344
  * @returns Patch instance - call `.commit()` to perform the operations defined
1357
1345
  */
1358
- patch(documentId: PatchSelection, operations?: PatchOperations): Patch {
1359
- return new Patch(documentId, operations, this)
1346
+ patch(selection: PatchSelection, operations?: PatchOperations): Patch {
1347
+ return new Patch(selection, operations, this)
1360
1348
  }
1361
1349
 
1362
1350
  /**
@@ -1429,3 +1417,1067 @@ export class SanityClient {
1429
1417
  return dataMethods._getDataUrl(this, operation, path)
1430
1418
  }
1431
1419
  }
1420
+
1421
+ /**
1422
+ * Shared base type for the `SanityClient` and `ObservableSanityClient` classes.
1423
+ * TODO: refactor the Promise and Observable differences to use generics so we no longer suffer from all this duplication in TS docs
1424
+ */
1425
+ interface SanityClientBase {
1426
+ live: LiveClient
1427
+ listen: typeof _listen
1428
+
1429
+ /**
1430
+ * Returns the current client configuration
1431
+ */
1432
+ config(): InitializedClientConfig
1433
+ /**
1434
+ * Reconfigure the client. Note that this _mutates_ the current client.
1435
+ */
1436
+ config(newConfig?: Partial<ClientConfig>): this
1437
+
1438
+ /**
1439
+ * Get a Sanity API URL for the URI provided
1440
+ *
1441
+ * @param uri - URI/path to build URL for
1442
+ * @param canUseCdn - Whether or not to allow using the API CDN for this route
1443
+ */
1444
+ getUrl(uri: string, canUseCdn?: boolean): string
1445
+
1446
+ /**
1447
+ * Get a Sanity API URL for the data operation and path provided
1448
+ *
1449
+ * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
1450
+ * @param path - Path to append after the operation
1451
+ */
1452
+ getDataUrl(operation: string, path?: string): string
1453
+ }
1454
+
1455
+ /**
1456
+ * The interface implemented by the `ObservableSanityClient` class.
1457
+ * When writing code that wants to take an instance of `ObservableSanityClient` as input it's better to use this type,
1458
+ * as the `ObservableSanityClient` class has private properties and thus TypeScrict will consider the type incompatible
1459
+ * in cases where you might have multiple `@sanity/client` instances in your node_modules.
1460
+ * @public
1461
+ */
1462
+ export interface ObservableSanityClientType extends SanityClientBase {
1463
+ assets: ObservableAssetsClient
1464
+ datasets: ObservableDatasetsClient
1465
+ projects: ObservableProjectsClient
1466
+ users: ObservableUsersClient
1467
+
1468
+ /**
1469
+ * Clone the client - returns a new instance
1470
+ */
1471
+ clone(): ObservableSanityClient
1472
+
1473
+ /**
1474
+ * Clone the client with a new (partial) configuration.
1475
+ *
1476
+ * @param newConfig - New client configuration properties, shallowly merged with existing configuration
1477
+ */
1478
+ withConfig(newConfig?: Partial<ClientConfig>): ObservableSanityClient
1479
+
1480
+ /**
1481
+ * Perform a GROQ-query against the configured dataset.
1482
+ *
1483
+ * @param query - GROQ-query to perform
1484
+ */
1485
+ fetch<
1486
+ R = Any,
1487
+ Q extends QueryWithoutParams = QueryWithoutParams,
1488
+ const G extends string = string,
1489
+ >(
1490
+ query: G,
1491
+ params?: Q | QueryWithoutParams,
1492
+ ): Observable<ClientReturn<G, R>>
1493
+ /**
1494
+ * Perform a GROQ-query against the configured dataset.
1495
+ *
1496
+ * @param query - GROQ-query to perform
1497
+ * @param params - Optional query parameters
1498
+ * @param options - Optional request options
1499
+ */
1500
+ fetch<
1501
+ R = Any,
1502
+ Q extends QueryWithoutParams | QueryParams = QueryParams,
1503
+ const G extends string = string,
1504
+ >(
1505
+ query: G,
1506
+ params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
1507
+ options?: FilteredResponseQueryOptions,
1508
+ ): Observable<ClientReturn<G, R>>
1509
+ /**
1510
+ * Perform a GROQ-query against the configured dataset.
1511
+ *
1512
+ * @param query - GROQ-query to perform
1513
+ * @param params - Optional query parameters
1514
+ * @param options - Request options
1515
+ */
1516
+ fetch<
1517
+ R = Any,
1518
+ Q extends QueryWithoutParams | QueryParams = QueryParams,
1519
+ const G extends string = string,
1520
+ >(
1521
+ query: G,
1522
+ params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
1523
+ options: UnfilteredResponseQueryOptions,
1524
+ ): Observable<RawQueryResponse<ClientReturn<G, R>>>
1525
+ /**
1526
+ * Perform a GROQ-query against the configured dataset.
1527
+ *
1528
+ * @param query - GROQ-query to perform
1529
+ * @param params - Optional query parameters
1530
+ * @param options - Request options
1531
+ */
1532
+ fetch<
1533
+ R = Any,
1534
+ Q extends QueryWithoutParams | QueryParams = QueryParams,
1535
+ const G extends string = string,
1536
+ >(
1537
+ query: G,
1538
+ params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
1539
+ options: UnfilteredResponseWithoutQuery,
1540
+ ): Observable<RawQuerylessQueryResponse<ClientReturn<G, R>>>
1541
+
1542
+ /**
1543
+ * Fetch a single document with the given ID.
1544
+ *
1545
+ * @param id - Document ID to fetch
1546
+ * @param options - Request options
1547
+ */
1548
+ getDocument<R extends Record<string, Any> = Record<string, Any>>(
1549
+ id: string,
1550
+ options?: {tag?: string},
1551
+ ): Observable<SanityDocument<R> | undefined>
1552
+
1553
+ /**
1554
+ * Fetch multiple documents in one request.
1555
+ * Should be used sparingly - performing a query is usually a better option.
1556
+ * The order/position of documents is preserved based on the original array of IDs.
1557
+ * If any of the documents are missing, they will be replaced by a `null` entry in the returned array
1558
+ *
1559
+ * @param ids - Document IDs to fetch
1560
+ * @param options - Request options
1561
+ */
1562
+ getDocuments<R extends Record<string, Any> = Record<string, Any>>(
1563
+ ids: string[],
1564
+ options?: {tag?: string},
1565
+ ): Observable<(SanityDocument<R> | null)[]>
1566
+
1567
+ /**
1568
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
1569
+ * Returns an observable that resolves to the created document.
1570
+ *
1571
+ * @param document - Document to create
1572
+ * @param options - Mutation options
1573
+ */
1574
+ create<R extends Record<string, Any> = Record<string, Any>>(
1575
+ document: SanityDocumentStub<R>,
1576
+ options: FirstDocumentMutationOptions,
1577
+ ): Observable<SanityDocument<R>>
1578
+ /**
1579
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
1580
+ * Returns an observable that resolves to an array containing the created document.
1581
+ *
1582
+ * @param document - Document to create
1583
+ * @param options - Mutation options
1584
+ */
1585
+ create<R extends Record<string, Any> = Record<string, Any>>(
1586
+ document: SanityDocumentStub<R>,
1587
+ options: AllDocumentsMutationOptions,
1588
+ ): Observable<SanityDocument<R>[]>
1589
+ /**
1590
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
1591
+ * Returns an observable that resolves to a mutation result object containing the ID of the created document.
1592
+ *
1593
+ * @param document - Document to create
1594
+ * @param options - Mutation options
1595
+ */
1596
+ create<R extends Record<string, Any> = Record<string, Any>>(
1597
+ document: SanityDocumentStub<R>,
1598
+ options: FirstDocumentIdMutationOptions,
1599
+ ): Observable<SingleMutationResult>
1600
+ /**
1601
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
1602
+ * Returns an observable that resolves to a mutation result object containing the ID of the created document.
1603
+ *
1604
+ * @param document - Document to create
1605
+ * @param options - Mutation options
1606
+ */
1607
+ create<R extends Record<string, Any> = Record<string, Any>>(
1608
+ document: SanityDocumentStub<R>,
1609
+ options: AllDocumentIdsMutationOptions,
1610
+ ): Observable<MultipleMutationResult>
1611
+ /**
1612
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
1613
+ * Returns an observable that resolves to the created document.
1614
+ *
1615
+ * @param document - Document to create
1616
+ * @param options - Mutation options
1617
+ */
1618
+ create<R extends Record<string, Any> = Record<string, Any>>(
1619
+ document: SanityDocumentStub<R>,
1620
+ options?: BaseMutationOptions,
1621
+ ): Observable<SanityDocument<R>>
1622
+
1623
+ /**
1624
+ * Create a document if no document with the same ID already exists.
1625
+ * Returns an observable that resolves to the created document.
1626
+ *
1627
+ * @param document - Document to create
1628
+ * @param options - Mutation options
1629
+ */
1630
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
1631
+ document: IdentifiedSanityDocumentStub<R>,
1632
+ options: FirstDocumentMutationOptions,
1633
+ ): Observable<SanityDocument<R>>
1634
+ /**
1635
+ * Create a document if no document with the same ID already exists.
1636
+ * Returns an observable that resolves to an array containing the created document.
1637
+ *
1638
+ * @param document - Document to create
1639
+ * @param options - Mutation options
1640
+ */
1641
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
1642
+ document: IdentifiedSanityDocumentStub<R>,
1643
+ options: AllDocumentsMutationOptions,
1644
+ ): Observable<SanityDocument<R>[]>
1645
+ /**
1646
+ * Create a document if no document with the same ID already exists.
1647
+ * Returns an observable that resolves to a mutation result object containing the ID of the created document.
1648
+ *
1649
+ * @param document - Document to create
1650
+ * @param options - Mutation options
1651
+ */
1652
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
1653
+ document: IdentifiedSanityDocumentStub<R>,
1654
+ options: FirstDocumentIdMutationOptions,
1655
+ ): Observable<SingleMutationResult>
1656
+ /**
1657
+ * Create a document if no document with the same ID already exists.
1658
+ * Returns an observable that resolves to a mutation result object containing the ID of the created document.
1659
+ *
1660
+ * @param document - Document to create
1661
+ * @param options - Mutation options
1662
+ */
1663
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
1664
+ document: IdentifiedSanityDocumentStub<R>,
1665
+ options: AllDocumentIdsMutationOptions,
1666
+ ): Observable<MultipleMutationResult>
1667
+ /**
1668
+ * Create a document if no document with the same ID already exists.
1669
+ * Returns an observable that resolves to the created document.
1670
+ *
1671
+ * @param document - Document to create
1672
+ * @param options - Mutation options
1673
+ */
1674
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
1675
+ document: IdentifiedSanityDocumentStub<R>,
1676
+ options?: BaseMutationOptions,
1677
+ ): Observable<SanityDocument<R>>
1678
+
1679
+ /**
1680
+ * Create a document if it does not exist, or replace a document with the same document ID
1681
+ * Returns an observable that resolves to the created document.
1682
+ *
1683
+ * @param document - Document to either create or replace
1684
+ * @param options - Mutation options
1685
+ */
1686
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
1687
+ document: IdentifiedSanityDocumentStub<R>,
1688
+ options: FirstDocumentMutationOptions,
1689
+ ): Observable<SanityDocument<R>>
1690
+ /**
1691
+ * Create a document if it does not exist, or replace a document with the same document ID
1692
+ * Returns an observable that resolves to an array containing the created document.
1693
+ *
1694
+ * @param document - Document to either create or replace
1695
+ * @param options - Mutation options
1696
+ */
1697
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
1698
+ document: IdentifiedSanityDocumentStub<R>,
1699
+ options: AllDocumentsMutationOptions,
1700
+ ): Observable<SanityDocument<R>[]>
1701
+ /**
1702
+ * Create a document if it does not exist, or replace a document with the same document ID
1703
+ * Returns an observable that resolves to a mutation result object containing the ID of the created document.
1704
+ *
1705
+ * @param document - Document to either create or replace
1706
+ * @param options - Mutation options
1707
+ */
1708
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
1709
+ document: IdentifiedSanityDocumentStub<R>,
1710
+ options: FirstDocumentIdMutationOptions,
1711
+ ): Observable<SingleMutationResult>
1712
+ /**
1713
+ * Create a document if it does not exist, or replace a document with the same document ID
1714
+ * Returns an observable that resolves to a mutation result object containing the created document ID.
1715
+ *
1716
+ * @param document - Document to either create or replace
1717
+ * @param options - Mutation options
1718
+ */
1719
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
1720
+ document: IdentifiedSanityDocumentStub<R>,
1721
+ options: AllDocumentIdsMutationOptions,
1722
+ ): Observable<MultipleMutationResult>
1723
+ /**
1724
+ * Create a document if it does not exist, or replace a document with the same document ID
1725
+ * Returns an observable that resolves to the created document.
1726
+ *
1727
+ * @param document - Document to either create or replace
1728
+ * @param options - Mutation options
1729
+ */
1730
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
1731
+ document: IdentifiedSanityDocumentStub<R>,
1732
+ options?: BaseMutationOptions,
1733
+ ): Observable<SanityDocument<R>>
1734
+
1735
+ /**
1736
+ * Deletes a document with the given document ID.
1737
+ * Returns an observable that resolves to the deleted document.
1738
+ *
1739
+ * @param id - Document ID to delete
1740
+ * @param options - Options for the mutation
1741
+ */
1742
+ delete<R extends Record<string, Any> = Record<string, Any>>(
1743
+ id: string,
1744
+ options: FirstDocumentMutationOptions,
1745
+ ): Observable<SanityDocument<R>>
1746
+ /**
1747
+ * Deletes a document with the given document ID.
1748
+ * Returns an observable that resolves to an array containing the deleted document.
1749
+ *
1750
+ * @param id - Document ID to delete
1751
+ * @param options - Options for the mutation
1752
+ */
1753
+ delete<R extends Record<string, Any> = Record<string, Any>>(
1754
+ id: string,
1755
+ options: AllDocumentsMutationOptions,
1756
+ ): Observable<SanityDocument<R>[]>
1757
+ /**
1758
+ * Deletes a document with the given document ID.
1759
+ * Returns an observable that resolves to a mutation result object containing the deleted document ID.
1760
+ *
1761
+ * @param id - Document ID to delete
1762
+ * @param options - Options for the mutation
1763
+ */
1764
+ delete(id: string, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>
1765
+ /**
1766
+ * Deletes a document with the given document ID.
1767
+ * Returns an observable that resolves to a mutation result object containing the deleted document ID.
1768
+ *
1769
+ * @param id - Document ID to delete
1770
+ * @param options - Options for the mutation
1771
+ */
1772
+ delete(id: string, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
1773
+ /**
1774
+ * Deletes a document with the given document ID.
1775
+ * Returns an observable that resolves to the deleted document.
1776
+ *
1777
+ * @param id - Document ID to delete
1778
+ * @param options - Options for the mutation
1779
+ */
1780
+ delete<R extends Record<string, Any> = Record<string, Any>>(
1781
+ id: string,
1782
+ options?: BaseMutationOptions,
1783
+ ): Observable<SanityDocument<R>>
1784
+ /**
1785
+ * Deletes one or more documents matching the given query or document ID.
1786
+ * Returns an observable that resolves to first deleted document.
1787
+ *
1788
+ * @param selection - An object with either an `id` or `query` key defining what to delete
1789
+ * @param options - Options for the mutation
1790
+ */
1791
+ delete<R extends Record<string, Any> = Record<string, Any>>(
1792
+ selection: MutationSelection,
1793
+ options: FirstDocumentMutationOptions,
1794
+ ): Observable<SanityDocument<R>>
1795
+ /**
1796
+ * Deletes one or more documents matching the given query or document ID.
1797
+ * Returns an observable that resolves to an array containing the deleted documents.
1798
+ *
1799
+ * @param selection - An object with either an `id` or `query` key defining what to delete
1800
+ * @param options - Options for the mutation
1801
+ */
1802
+ delete<R extends Record<string, Any> = Record<string, Any>>(
1803
+ selection: MutationSelection,
1804
+ options: AllDocumentsMutationOptions,
1805
+ ): Observable<SanityDocument<R>[]>
1806
+ /**
1807
+ * Deletes one or more documents matching the given query or document ID.
1808
+ * Returns an observable that resolves to a mutation result object containing the ID of the first deleted document.
1809
+ *
1810
+ * @param selection - An object with either an `id` or `query` key defining what to delete
1811
+ * @param options - Options for the mutation
1812
+ */
1813
+ delete(
1814
+ selection: MutationSelection,
1815
+ options: FirstDocumentIdMutationOptions,
1816
+ ): Observable<SingleMutationResult>
1817
+ /**
1818
+ * Deletes one or more documents matching the given query or document ID.
1819
+ * Returns an observable that resolves to a mutation result object containing the document IDs that were deleted.
1820
+ *
1821
+ * @param selection - An object with either an `id` or `query` key defining what to delete
1822
+ * @param options - Options for the mutation
1823
+ */
1824
+ delete(
1825
+ selection: MutationSelection,
1826
+ options: AllDocumentIdsMutationOptions,
1827
+ ): Observable<MultipleMutationResult>
1828
+ /**
1829
+ * Deletes one or more documents matching the given query or document ID.
1830
+ * Returns an observable that resolves to first deleted document.
1831
+ *
1832
+ * @param selection - An object with either an `id` or `query` key defining what to delete
1833
+ * @param options - Options for the mutation
1834
+ */
1835
+ delete<R extends Record<string, Any> = Record<string, Any>>(
1836
+ selection: MutationSelection,
1837
+ options?: BaseMutationOptions,
1838
+ ): Observable<SanityDocument<R>>
1839
+
1840
+ /**
1841
+ * Perform mutation operations against the configured dataset
1842
+ * Returns an observable that resolves to the first mutated document.
1843
+ *
1844
+ * @param operations - Mutation operations to execute
1845
+ * @param options - Mutation options
1846
+ */
1847
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
1848
+ operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
1849
+ options: FirstDocumentMutationOptions,
1850
+ ): Observable<SanityDocument<R>>
1851
+ /**
1852
+ * Perform mutation operations against the configured dataset.
1853
+ * Returns an observable that resolves to an array of the mutated documents.
1854
+ *
1855
+ * @param operations - Mutation operations to execute
1856
+ * @param options - Mutation options
1857
+ */
1858
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
1859
+ operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
1860
+ options: AllDocumentsMutationOptions,
1861
+ ): Observable<SanityDocument<R>[]>
1862
+ /**
1863
+ * Perform mutation operations against the configured dataset
1864
+ * Returns an observable that resolves to a mutation result object containing the document ID of the first mutated document.
1865
+ *
1866
+ * @param operations - Mutation operations to execute
1867
+ * @param options - Mutation options
1868
+ */
1869
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
1870
+ operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
1871
+ options: FirstDocumentIdMutationOptions,
1872
+ ): Observable<SingleMutationResult>
1873
+ /**
1874
+ * Perform mutation operations against the configured dataset
1875
+ * Returns an observable that resolves to a mutation result object containing the mutated document IDs.
1876
+ *
1877
+ * @param operations - Mutation operations to execute
1878
+ * @param options - Mutation options
1879
+ */
1880
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
1881
+ operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
1882
+ options: AllDocumentIdsMutationOptions,
1883
+ ): Observable<MultipleMutationResult>
1884
+ /**
1885
+ * Perform mutation operations against the configured dataset
1886
+ * Returns an observable that resolves to the first mutated document.
1887
+ *
1888
+ * @param operations - Mutation operations to execute
1889
+ * @param options - Mutation options
1890
+ */
1891
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
1892
+ operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
1893
+ options?: BaseMutationOptions,
1894
+ ): Observable<SanityDocument<R>>
1895
+
1896
+ /**
1897
+ * Create a new buildable patch of operations to perform
1898
+ *
1899
+ * @param documentId - Document ID to patch
1900
+ * @param operations - Optional object of patch operations to initialize the patch instance with
1901
+ * @returns Patch instance - call `.commit()` to perform the operations defined
1902
+ */
1903
+ patch(documentId: string, operations?: PatchOperations): ObservablePatch
1904
+
1905
+ /**
1906
+ * Create a new buildable patch of operations to perform
1907
+ *
1908
+ * @param documentIds - Array of document IDs to patch
1909
+ * @param operations - Optional object of patch operations to initialize the patch instance with
1910
+ * @returns Patch instance - call `.commit()` to perform the operations defined
1911
+ */
1912
+ patch(documentIds: string[], operations?: PatchOperations): ObservablePatch
1913
+
1914
+ /**
1915
+ * Create a new buildable patch of operations to perform
1916
+ *
1917
+ * @param selection - An object with `query` and optional `params`, defining which document(s) to patch
1918
+ * @param operations - Optional object of patch operations to initialize the patch instance with
1919
+ * @returns Patch instance - call `.commit()` to perform the operations defined
1920
+ */
1921
+ patch(selection: MutationSelection, operations?: PatchOperations): ObservablePatch
1922
+
1923
+ /**
1924
+ * Create a new buildable patch of operations to perform
1925
+ *
1926
+ * @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch
1927
+ * @param operations - Optional object of patch operations to initialize the patch instance with
1928
+ * @returns Patch instance - call `.commit()` to perform the operations defined
1929
+ */
1930
+ patch(selection: PatchSelection, operations?: PatchOperations): ObservablePatch
1931
+
1932
+ /**
1933
+ * Create a new transaction of mutations
1934
+ *
1935
+ * @param operations - Optional array of mutation operations to initialize the transaction instance with
1936
+ */
1937
+ transaction<R extends Record<string, Any> = Record<string, Any>>(
1938
+ operations?: Mutation<R>[],
1939
+ ): ObservableTransaction
1940
+
1941
+ /**
1942
+ * Perform action operations against the configured dataset
1943
+ *
1944
+ * @param operations - Action operation(s) to execute
1945
+ * @param options - Action options
1946
+ */
1947
+ action(
1948
+ operations: Action | Action[],
1949
+ options?: BaseActionOptions,
1950
+ ): Observable<SingleActionResult | MultipleActionResult>
1951
+
1952
+ /**
1953
+ * Perform an HTTP request against the Sanity API
1954
+ *
1955
+ * @param options - Request options
1956
+ */
1957
+ request<R = Any>(options: RawRequestOptions): Observable<R>
1958
+ }
1959
+
1960
+ /**
1961
+ * The interface implemented by the `SanityClient` class.
1962
+ * When writing code that wants to take an instance of `SanityClient` as input it's better to use this type,
1963
+ * as the `SanityClient` class has private properties and thus TypeScrict will consider the type incompatible
1964
+ * in cases where you might have multiple `@sanity/client` instances in your node_modules.
1965
+ * @public
1966
+ */
1967
+ export interface SanityClientType extends SanityClientBase {
1968
+ assets: AssetsClient
1969
+ datasets: DatasetsClient
1970
+ projects: ProjectsClient
1971
+ users: UsersClient
1972
+
1973
+ /**
1974
+ * Observable version of the Sanity client, with the same configuration as the promise-based one
1975
+ */
1976
+ observable: ObservableSanityClient
1977
+
1978
+ /**
1979
+ * Clone the client - returns a new instance
1980
+ */
1981
+ clone(): SanityClient
1982
+
1983
+ /**
1984
+ * Clone the client with a new (partial) configuration.
1985
+ *
1986
+ * @param newConfig - New client configuration properties, shallowly merged with existing configuration
1987
+ */
1988
+ withConfig(newConfig?: Partial<ClientConfig>): SanityClient
1989
+
1990
+ /**
1991
+ * Perform a GROQ-query against the configured dataset.
1992
+ *
1993
+ * @param query - GROQ-query to perform
1994
+ */
1995
+ fetch<
1996
+ R = Any,
1997
+ Q extends QueryWithoutParams = QueryWithoutParams,
1998
+ const G extends string = string,
1999
+ >(
2000
+ query: G,
2001
+ params?: Q | QueryWithoutParams,
2002
+ ): Promise<ClientReturn<G, R>>
2003
+ /**
2004
+ * Perform a GROQ-query against the configured dataset.
2005
+ *
2006
+ * @param query - GROQ-query to perform
2007
+ * @param params - Optional query parameters
2008
+ * @param options - Optional request options
2009
+ */
2010
+ fetch<
2011
+ R = Any,
2012
+ Q extends QueryWithoutParams | QueryParams = QueryParams,
2013
+ const G extends string = string,
2014
+ >(
2015
+ query: G,
2016
+ params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
2017
+ options?: FilteredResponseQueryOptions,
2018
+ ): Promise<ClientReturn<G, R>>
2019
+ /**
2020
+ * Perform a GROQ-query against the configured dataset.
2021
+ *
2022
+ * @param query - GROQ-query to perform
2023
+ * @param params - Optional query parameters
2024
+ * @param options - Request options
2025
+ */
2026
+ fetch<
2027
+ R = Any,
2028
+ Q extends QueryWithoutParams | QueryParams = QueryParams,
2029
+ const G extends string = string,
2030
+ >(
2031
+ query: G,
2032
+ params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
2033
+ options: UnfilteredResponseQueryOptions,
2034
+ ): Promise<RawQueryResponse<ClientReturn<G, R>>>
2035
+ /**
2036
+ * Perform a GROQ-query against the configured dataset.
2037
+ *
2038
+ * @param query - GROQ-query to perform
2039
+ * @param params - Optional query parameters
2040
+ * @param options - Request options
2041
+ */
2042
+ fetch<
2043
+ R = Any,
2044
+ Q extends QueryWithoutParams | QueryParams = QueryParams,
2045
+ const G extends string = string,
2046
+ >(
2047
+ query: G,
2048
+ params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
2049
+ options: UnfilteredResponseWithoutQuery,
2050
+ ): Promise<RawQuerylessQueryResponse<ClientReturn<G, R>>>
2051
+
2052
+ /**
2053
+ * Fetch a single document with the given ID.
2054
+ *
2055
+ * @param id - Document ID to fetch
2056
+ * @param options - Request options
2057
+ */
2058
+ getDocument<R extends Record<string, Any> = Record<string, Any>>(
2059
+ id: string,
2060
+ options?: {signal?: AbortSignal; tag?: string},
2061
+ ): Promise<SanityDocument<R> | undefined>
2062
+
2063
+ /**
2064
+ * Fetch multiple documents in one request.
2065
+ * Should be used sparingly - performing a query is usually a better option.
2066
+ * The order/position of documents is preserved based on the original array of IDs.
2067
+ * If any of the documents are missing, they will be replaced by a `null` entry in the returned array
2068
+ *
2069
+ * @param ids - Document IDs to fetch
2070
+ * @param options - Request options
2071
+ */
2072
+ getDocuments<R extends Record<string, Any> = Record<string, Any>>(
2073
+ ids: string[],
2074
+ options?: {signal?: AbortSignal; tag?: string},
2075
+ ): Promise<(SanityDocument<R> | null)[]>
2076
+
2077
+ /**
2078
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
2079
+ * Returns a promise that resolves to the created document.
2080
+ *
2081
+ * @param document - Document to create
2082
+ * @param options - Mutation options
2083
+ */
2084
+ create<R extends Record<string, Any> = Record<string, Any>>(
2085
+ document: SanityDocumentStub<R>,
2086
+ options: FirstDocumentMutationOptions,
2087
+ ): Promise<SanityDocument<R>>
2088
+ /**
2089
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
2090
+ * Returns a promise that resolves to an array containing the created document.
2091
+ *
2092
+ * @param document - Document to create
2093
+ * @param options - Mutation options
2094
+ */
2095
+ create<R extends Record<string, Any> = Record<string, Any>>(
2096
+ document: SanityDocumentStub<R>,
2097
+ options: AllDocumentsMutationOptions,
2098
+ ): Promise<SanityDocument<R>[]>
2099
+ /**
2100
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
2101
+ * Returns a promise that resolves to a mutation result object containing the ID of the created document.
2102
+ *
2103
+ * @param document - Document to create
2104
+ * @param options - Mutation options
2105
+ */
2106
+ create<R extends Record<string, Any> = Record<string, Any>>(
2107
+ document: SanityDocumentStub<R>,
2108
+ options: FirstDocumentIdMutationOptions,
2109
+ ): Promise<SingleMutationResult>
2110
+ /**
2111
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
2112
+ * Returns a promise that resolves to a mutation result object containing the ID of the created document.
2113
+ *
2114
+ * @param document - Document to create
2115
+ * @param options - Mutation options
2116
+ */
2117
+ create<R extends Record<string, Any> = Record<string, Any>>(
2118
+ document: SanityDocumentStub<R>,
2119
+ options: AllDocumentIdsMutationOptions,
2120
+ ): Promise<MultipleMutationResult>
2121
+ /**
2122
+ * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
2123
+ * Returns a promise that resolves to the created document.
2124
+ *
2125
+ * @param document - Document to create
2126
+ * @param options - Mutation options
2127
+ */
2128
+ create<R extends Record<string, Any> = Record<string, Any>>(
2129
+ document: SanityDocumentStub<R>,
2130
+ options?: BaseMutationOptions,
2131
+ ): Promise<SanityDocument<R>>
2132
+
2133
+ /**
2134
+ * Create a document if no document with the same ID already exists.
2135
+ * Returns a promise that resolves to the created document.
2136
+ *
2137
+ * @param document - Document to create
2138
+ * @param options - Mutation options
2139
+ */
2140
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
2141
+ document: IdentifiedSanityDocumentStub<R>,
2142
+ options: FirstDocumentMutationOptions,
2143
+ ): Promise<SanityDocument<R>>
2144
+ /**
2145
+ * Create a document if no document with the same ID already exists.
2146
+ * Returns a promise that resolves to an array containing the created document.
2147
+ *
2148
+ * @param document - Document to create
2149
+ * @param options - Mutation options
2150
+ */
2151
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
2152
+ document: IdentifiedSanityDocumentStub<R>,
2153
+ options: AllDocumentsMutationOptions,
2154
+ ): Promise<SanityDocument<R>[]>
2155
+ /**
2156
+ * Create a document if no document with the same ID already exists.
2157
+ * Returns a promise that resolves to a mutation result object containing the ID of the created document.
2158
+ *
2159
+ * @param document - Document to create
2160
+ * @param options - Mutation options
2161
+ */
2162
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
2163
+ document: IdentifiedSanityDocumentStub<R>,
2164
+ options: FirstDocumentIdMutationOptions,
2165
+ ): Promise<SingleMutationResult>
2166
+ /**
2167
+ * Create a document if no document with the same ID already exists.
2168
+ * Returns a promise that resolves to a mutation result object containing the ID of the created document.
2169
+ *
2170
+ * @param document - Document to create
2171
+ * @param options - Mutation options
2172
+ */
2173
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
2174
+ document: IdentifiedSanityDocumentStub<R>,
2175
+ options: AllDocumentIdsMutationOptions,
2176
+ ): Promise<MultipleMutationResult>
2177
+ /**
2178
+ * Create a document if no document with the same ID already exists.
2179
+ * Returns a promise that resolves to the created document.
2180
+ *
2181
+ * @param document - Document to create
2182
+ * @param options - Mutation options
2183
+ */
2184
+ createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
2185
+ document: IdentifiedSanityDocumentStub<R>,
2186
+ options?: BaseMutationOptions,
2187
+ ): Promise<SanityDocument<R>>
2188
+
2189
+ /**
2190
+ * Create a document if it does not exist, or replace a document with the same document ID
2191
+ * Returns a promise that resolves to the created document.
2192
+ *
2193
+ * @param document - Document to either create or replace
2194
+ * @param options - Mutation options
2195
+ */
2196
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
2197
+ document: IdentifiedSanityDocumentStub<R>,
2198
+ options: FirstDocumentMutationOptions,
2199
+ ): Promise<SanityDocument<R>>
2200
+ /**
2201
+ * Create a document if it does not exist, or replace a document with the same document ID
2202
+ * Returns a promise that resolves to an array containing the created document.
2203
+ *
2204
+ * @param document - Document to either create or replace
2205
+ * @param options - Mutation options
2206
+ */
2207
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
2208
+ document: IdentifiedSanityDocumentStub<R>,
2209
+ options: AllDocumentsMutationOptions,
2210
+ ): Promise<SanityDocument<R>[]>
2211
+ /**
2212
+ * Create a document if it does not exist, or replace a document with the same document ID
2213
+ * Returns a promise that resolves to a mutation result object containing the ID of the created document.
2214
+ *
2215
+ * @param document - Document to either create or replace
2216
+ * @param options - Mutation options
2217
+ */
2218
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
2219
+ document: IdentifiedSanityDocumentStub<R>,
2220
+ options: FirstDocumentIdMutationOptions,
2221
+ ): Promise<SingleMutationResult>
2222
+ /**
2223
+ * Create a document if it does not exist, or replace a document with the same document ID
2224
+ * Returns a promise that resolves to a mutation result object containing the created document ID.
2225
+ *
2226
+ * @param document - Document to either create or replace
2227
+ * @param options - Mutation options
2228
+ */
2229
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
2230
+ document: IdentifiedSanityDocumentStub<R>,
2231
+ options: AllDocumentIdsMutationOptions,
2232
+ ): Promise<MultipleMutationResult>
2233
+ /**
2234
+ * Create a document if it does not exist, or replace a document with the same document ID
2235
+ * Returns a promise that resolves to the created document.
2236
+ *
2237
+ * @param document - Document to either create or replace
2238
+ * @param options - Mutation options
2239
+ */
2240
+ createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
2241
+ document: IdentifiedSanityDocumentStub<R>,
2242
+ options?: BaseMutationOptions,
2243
+ ): Promise<SanityDocument<R>>
2244
+
2245
+ /**
2246
+ * Deletes a document with the given document ID.
2247
+ * Returns a promise that resolves to the deleted document.
2248
+ *
2249
+ * @param id - Document ID to delete
2250
+ * @param options - Options for the mutation
2251
+ */
2252
+ delete<R extends Record<string, Any> = Record<string, Any>>(
2253
+ id: string,
2254
+ options: FirstDocumentMutationOptions,
2255
+ ): Promise<SanityDocument<R>>
2256
+ /**
2257
+ * Deletes a document with the given document ID.
2258
+ * Returns a promise that resolves to an array containing the deleted document.
2259
+ *
2260
+ * @param id - Document ID to delete
2261
+ * @param options - Options for the mutation
2262
+ */
2263
+ delete<R extends Record<string, Any> = Record<string, Any>>(
2264
+ id: string,
2265
+ options: AllDocumentsMutationOptions,
2266
+ ): Promise<SanityDocument<R>[]>
2267
+ /**
2268
+ * Deletes a document with the given document ID.
2269
+ * Returns a promise that resolves to a mutation result object containing the deleted document ID.
2270
+ *
2271
+ * @param id - Document ID to delete
2272
+ * @param options - Options for the mutation
2273
+ */
2274
+ delete(id: string, options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>
2275
+ /**
2276
+ * Deletes a document with the given document ID.
2277
+ * Returns a promise that resolves to a mutation result object containing the deleted document ID.
2278
+ *
2279
+ * @param id - Document ID to delete
2280
+ * @param options - Options for the mutation
2281
+ */
2282
+ delete(id: string, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>
2283
+ /**
2284
+ * Deletes a document with the given document ID.
2285
+ * Returns a promise that resolves to the deleted document.
2286
+ *
2287
+ * @param id - Document ID to delete
2288
+ * @param options - Options for the mutation
2289
+ */
2290
+ delete<R extends Record<string, Any> = Record<string, Any>>(
2291
+ id: string,
2292
+ options?: BaseMutationOptions,
2293
+ ): Promise<SanityDocument<R>>
2294
+ /**
2295
+ * Deletes one or more documents matching the given query or document ID.
2296
+ * Returns a promise that resolves to first deleted document.
2297
+ *
2298
+ * @param selection - An object with either an `id` or `query` key defining what to delete
2299
+ * @param options - Options for the mutation
2300
+ */
2301
+ delete<R extends Record<string, Any> = Record<string, Any>>(
2302
+ selection: MutationSelection,
2303
+ options: FirstDocumentMutationOptions,
2304
+ ): Promise<SanityDocument<R>>
2305
+ /**
2306
+ * Deletes one or more documents matching the given query or document ID.
2307
+ * Returns a promise that resolves to an array containing the deleted documents.
2308
+ *
2309
+ * @param selection - An object with either an `id` or `query` key defining what to delete
2310
+ * @param options - Options for the mutation
2311
+ */
2312
+ delete<R extends Record<string, Any> = Record<string, Any>>(
2313
+ selection: MutationSelection,
2314
+ options: AllDocumentsMutationOptions,
2315
+ ): Promise<SanityDocument<R>[]>
2316
+ /**
2317
+ * Deletes one or more documents matching the given query or document ID.
2318
+ * Returns a promise that resolves to a mutation result object containing the ID of the first deleted document.
2319
+ *
2320
+ * @param selection - An object with either an `id` or `query` key defining what to delete
2321
+ * @param options - Options for the mutation
2322
+ */
2323
+ delete(
2324
+ selection: MutationSelection,
2325
+ options: FirstDocumentIdMutationOptions,
2326
+ ): Promise<SingleMutationResult>
2327
+ /**
2328
+ * Deletes one or more documents matching the given query or document ID.
2329
+ * Returns a promise that resolves to a mutation result object containing the document IDs that were deleted.
2330
+ *
2331
+ * @param selection - An object with either an `id` or `query` key defining what to delete
2332
+ * @param options - Options for the mutation
2333
+ */
2334
+ delete(
2335
+ selection: MutationSelection,
2336
+ options: AllDocumentIdsMutationOptions,
2337
+ ): Promise<MultipleMutationResult>
2338
+ /**
2339
+ * Deletes one or more documents matching the given query or document ID.
2340
+ * Returns a promise that resolves to first deleted document.
2341
+ *
2342
+ * @param selection - An object with either an `id` or `query` key defining what to delete
2343
+ * @param options - Options for the mutation
2344
+ */
2345
+ delete<R extends Record<string, Any> = Record<string, Any>>(
2346
+ selection: MutationSelection,
2347
+ options?: BaseMutationOptions,
2348
+ ): Promise<SanityDocument<R>>
2349
+
2350
+ /**
2351
+ * Perform mutation operations against the configured dataset
2352
+ * Returns a promise that resolves to the first mutated document.
2353
+ *
2354
+ * @param operations - Mutation operations to execute
2355
+ * @param options - Mutation options
2356
+ */
2357
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
2358
+ operations: Mutation<R>[] | Patch | Transaction,
2359
+ options: FirstDocumentMutationOptions,
2360
+ ): Promise<SanityDocument<R>>
2361
+ /**
2362
+ * Perform mutation operations against the configured dataset.
2363
+ * Returns a promise that resolves to an array of the mutated documents.
2364
+ *
2365
+ * @param operations - Mutation operations to execute
2366
+ * @param options - Mutation options
2367
+ */
2368
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
2369
+ operations: Mutation<R>[] | Patch | Transaction,
2370
+ options: AllDocumentsMutationOptions,
2371
+ ): Promise<SanityDocument<R>[]>
2372
+ /**
2373
+ * Perform mutation operations against the configured dataset
2374
+ * Returns a promise that resolves to a mutation result object containing the document ID of the first mutated document.
2375
+ *
2376
+ * @param operations - Mutation operations to execute
2377
+ * @param options - Mutation options
2378
+ */
2379
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
2380
+ operations: Mutation<R>[] | Patch | Transaction,
2381
+ options: FirstDocumentIdMutationOptions,
2382
+ ): Promise<SingleMutationResult>
2383
+ /**
2384
+ * Perform mutation operations against the configured dataset
2385
+ * Returns a promise that resolves to a mutation result object containing the mutated document IDs.
2386
+ *
2387
+ * @param operations - Mutation operations to execute
2388
+ * @param options - Mutation options
2389
+ */
2390
+ mutate<R extends Record<string, Any>>(
2391
+ operations: Mutation<R>[] | Patch | Transaction,
2392
+ options: AllDocumentIdsMutationOptions,
2393
+ ): Promise<MultipleMutationResult>
2394
+ /**
2395
+ * Perform mutation operations against the configured dataset
2396
+ * Returns a promise that resolves to the first mutated document.
2397
+ *
2398
+ * @param operations - Mutation operations to execute
2399
+ * @param options - Mutation options
2400
+ */
2401
+ mutate<R extends Record<string, Any> = Record<string, Any>>(
2402
+ operations: Mutation<R>[] | Patch | Transaction,
2403
+ options?: BaseMutationOptions,
2404
+ ): Promise<SanityDocument<R>>
2405
+
2406
+ /**
2407
+ * Create a new buildable patch of operations to perform
2408
+ *
2409
+ * @param documentId - Document ID to patch
2410
+ * @param operations - Optional object of patch operations to initialize the patch instance with
2411
+ * @returns Patch instance - call `.commit()` to perform the operations defined
2412
+ */
2413
+ patch(documentId: string, operations?: PatchOperations): Patch
2414
+
2415
+ /**
2416
+ * Create a new buildable patch of operations to perform
2417
+ *
2418
+ * @param documentIds - Array of document IDs to patch
2419
+ * @param operations - Optional object of patch operations to initialize the patch instance with
2420
+ * @returns Patch instance - call `.commit()` to perform the operations defined
2421
+ */
2422
+ patch(documentIds: string[], operations?: PatchOperations): Patch
2423
+
2424
+ /**
2425
+ * Create a new buildable patch of operations to perform
2426
+ *
2427
+ * @param selection - An object with `query` and optional `params`, defining which document(s) to patch
2428
+ * @param operations - Optional object of patch operations to initialize the patch instance with
2429
+ * @returns Patch instance - call `.commit()` to perform the operations defined
2430
+ */
2431
+ patch(selection: MutationSelection, operations?: PatchOperations): Patch
2432
+
2433
+ /**
2434
+ * Create a new buildable patch of operations to perform
2435
+ *
2436
+ * @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch
2437
+ * @param operations - Optional object of patch operations to initialize the patch instance with
2438
+ * @returns Patch instance - call `.commit()` to perform the operations defined
2439
+ */
2440
+ patch(selection: PatchSelection, operations?: PatchOperations): Patch
2441
+
2442
+ /**
2443
+ * Create a new transaction of mutations
2444
+ *
2445
+ * @param operations - Optional array of mutation operations to initialize the transaction instance with
2446
+ */
2447
+ transaction<R extends Record<string, Any> = Record<string, Any>>(
2448
+ operations?: Mutation<R>[],
2449
+ ): Transaction
2450
+
2451
+ /**
2452
+ * Perform action operations against the configured dataset
2453
+ * Returns a promise that resolves to the transaction result
2454
+ *
2455
+ * @param operations - Action operation(s) to execute
2456
+ * @param options - Action options
2457
+ */
2458
+ action(
2459
+ operations: Action | Action[],
2460
+ options?: BaseActionOptions,
2461
+ ): Promise<SingleActionResult | MultipleActionResult>
2462
+
2463
+ /**
2464
+ * Perform a request against the Sanity API
2465
+ * NOTE: Only use this for Sanity API endpoints, not for your own APIs!
2466
+ *
2467
+ * @param options - Request options
2468
+ * @returns Promise resolving to the response body
2469
+ */
2470
+ request<R = Any>(options: RawRequestOptions): Promise<R>
2471
+
2472
+ /**
2473
+ * Perform an HTTP request a `/data` sub-endpoint
2474
+ * NOTE: Considered internal, thus marked as deprecated. Use `request` instead.
2475
+ *
2476
+ * @deprecated - Use `request()` or your own HTTP library instead
2477
+ * @param endpoint - Endpoint to hit (mutate, query etc)
2478
+ * @param body - Request body
2479
+ * @param options - Request options
2480
+ * @internal
2481
+ */
2482
+ dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<Any>
2483
+ }