@sanity/client 5.1.0 → 5.2.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.
package/dist/index.d.ts CHANGED
@@ -1178,6 +1178,20 @@ export declare class ObservableSanityClient {
1178
1178
  * @param options - Request options
1179
1179
  */
1180
1180
  request<R = FIXME>(options: RawRequestOptions): Observable<R>
1181
+ /**
1182
+ * Get a Sanity API URL for the URI provided
1183
+ *
1184
+ * @param uri - URI/path to build URL for
1185
+ * @param canUseCdn - Whether or not to allow using the API CDN for this route
1186
+ */
1187
+ getUrl(uri: string, canUseCdn?: boolean): string
1188
+ /**
1189
+ * Get a Sanity API URL for the data operation and path provided
1190
+ *
1191
+ * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
1192
+ * @param path - Path to append after the operation
1193
+ */
1194
+ getDataUrl(operation: string, path?: string): string
1181
1195
  }
1182
1196
 
1183
1197
  /** @public */
@@ -1896,6 +1910,20 @@ export declare class SanityClient {
1896
1910
  * @param options - Request options
1897
1911
  */
1898
1912
  dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<FIXME>
1913
+ /**
1914
+ * Get a Sanity API URL for the URI provided
1915
+ *
1916
+ * @param uri - URI/path to build URL for
1917
+ * @param canUseCdn - Whether or not to allow using the API CDN for this route
1918
+ */
1919
+ getUrl(uri: string, canUseCdn?: boolean): string
1920
+ /**
1921
+ * Get a Sanity API URL for the data operation and path provided
1922
+ *
1923
+ * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
1924
+ * @param path - Path to append after the operation
1925
+ */
1926
+ getDataUrl(operation: string, path?: string): string
1899
1927
  }
1900
1928
 
1901
1929
  /** @internal */
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { Observable, lastValueFrom } from 'rxjs';
4
4
  import { map, filter } from 'rxjs/operators';
5
5
  import polyfilledEventSource from '@sanity/eventsource';
6
6
  var name = "@sanity/client";
7
- var version = "5.1.0";
7
+ var version = "5.2.0";
8
8
  const middleware = [debug({
9
9
  verbose: true,
10
10
  namespace: "sanity:client"
@@ -1552,6 +1552,24 @@ const _ObservableSanityClient = class {
1552
1552
  request(options) {
1553
1553
  return _request(this, __privateGet(this, _httpRequest), options);
1554
1554
  }
1555
+ /**
1556
+ * Get a Sanity API URL for the URI provided
1557
+ *
1558
+ * @param uri - URI/path to build URL for
1559
+ * @param canUseCdn - Whether or not to allow using the API CDN for this route
1560
+ */
1561
+ getUrl(uri, canUseCdn) {
1562
+ return _getUrl(this, uri, canUseCdn);
1563
+ }
1564
+ /**
1565
+ * Get a Sanity API URL for the data operation and path provided
1566
+ *
1567
+ * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
1568
+ * @param path - Path to append after the operation
1569
+ */
1570
+ getDataUrl(operation, path) {
1571
+ return _getDataUrl(this, operation, path);
1572
+ }
1555
1573
  };
1556
1574
  let ObservableSanityClient = _ObservableSanityClient;
1557
1575
  _clientConfig = new WeakMap();
@@ -1685,6 +1703,24 @@ const _SanityClient = class {
1685
1703
  dataRequest(endpoint, body, options) {
1686
1704
  return lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest2), endpoint, body, options));
1687
1705
  }
1706
+ /**
1707
+ * Get a Sanity API URL for the URI provided
1708
+ *
1709
+ * @param uri - URI/path to build URL for
1710
+ * @param canUseCdn - Whether or not to allow using the API CDN for this route
1711
+ */
1712
+ getUrl(uri, canUseCdn) {
1713
+ return _getUrl(this, uri, canUseCdn);
1714
+ }
1715
+ /**
1716
+ * Get a Sanity API URL for the data operation and path provided
1717
+ *
1718
+ * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
1719
+ * @param path - Path to append after the operation
1720
+ */
1721
+ getDataUrl(operation, path) {
1722
+ return _getDataUrl(this, operation, path);
1723
+ }
1688
1724
  };
1689
1725
  let SanityClient = _SanityClient;
1690
1726
  _clientConfig2 = new WeakMap();