@sanity/client 5.3.1 → 5.4.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
@@ -2,6 +2,8 @@
2
2
 
3
3
  import {Observable} from 'rxjs'
4
4
  import {Requester} from 'get-it'
5
+ import {adapter as unstable__adapter} from 'get-it'
6
+ import {environment as unstable__environment} from 'get-it'
5
7
 
6
8
  /** @internal */
7
9
  export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
@@ -51,7 +53,7 @@ export declare class AssetsClient {
51
53
  */
52
54
  upload(
53
55
  assetType: 'file',
54
- body: File | Blob | Buffer | NodeJS.ReadableStream,
56
+ body: UploadBody,
55
57
  options?: UploadClientConfig
56
58
  ): Promise<SanityAssetDocument>
57
59
  /**
@@ -63,7 +65,7 @@ export declare class AssetsClient {
63
65
  */
64
66
  upload(
65
67
  assetType: 'image',
66
- body: File | Blob | Buffer | NodeJS.ReadableStream,
68
+ body: UploadBody,
67
69
  options?: UploadClientConfig
68
70
  ): Promise<SanityImageAssetDocument>
69
71
  /**
@@ -75,7 +77,7 @@ export declare class AssetsClient {
75
77
  */
76
78
  upload(
77
79
  assetType: 'file' | 'image',
78
- body: File | Blob | Buffer | NodeJS.ReadableStream,
80
+ body: UploadBody,
79
81
  options?: UploadClientConfig
80
82
  ): Promise<SanityAssetDocument | SanityImageAssetDocument>
81
83
  }
@@ -611,7 +613,7 @@ export declare class ObservableAssetsClient {
611
613
  */
612
614
  upload(
613
615
  assetType: 'file',
614
- body: File | Blob | Buffer | NodeJS.ReadableStream,
616
+ body: UploadBody,
615
617
  options?: UploadClientConfig
616
618
  ): Observable<
617
619
  HttpRequestEvent<{
@@ -627,7 +629,7 @@ export declare class ObservableAssetsClient {
627
629
  */
628
630
  upload(
629
631
  assetType: 'image',
630
- body: File | Blob | Buffer | NodeJS.ReadableStream,
632
+ body: UploadBody,
631
633
  options?: UploadClientConfig
632
634
  ): Observable<
633
635
  HttpRequestEvent<{
@@ -643,7 +645,7 @@ export declare class ObservableAssetsClient {
643
645
  */
644
646
  upload(
645
647
  assetType: 'file' | 'image',
646
- body: File | Blob | Buffer | NodeJS.ReadableStream,
648
+ body: UploadBody,
647
649
  options?: UploadClientConfig
648
650
  ): Observable<
649
651
  HttpRequestEvent<{
@@ -2172,6 +2174,13 @@ export declare type UnfilteredResponseQueryOptions = RequestOptions & {
2172
2174
  filterResponse: false
2173
2175
  }
2174
2176
 
2177
+ export {unstable__adapter}
2178
+
2179
+ export {unstable__environment}
2180
+
2181
+ /** @public */
2182
+ export declare type UploadBody = File | Blob | Buffer | NodeJS.ReadableStream
2183
+
2175
2184
  /** @public */
2176
2185
  export declare interface UploadClientConfig {
2177
2186
  /**
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { debug, headers, retry, jsonRequest, jsonResponse, progress, observable } from 'get-it/middleware';
2
2
  import { getIt } from 'get-it';
3
+ export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
3
4
  import { Observable, lastValueFrom } from 'rxjs';
4
5
  import { map, filter } from 'rxjs/operators';
5
6
  import polyfilledEventSource from '@sanity/eventsource';
6
7
  var name = "@sanity/client";
7
- var version = "5.3.1";
8
+ var version = "5.4.0";
8
9
  const middleware = [debug({
9
10
  verbose: true,
10
11
  namespace: "sanity:client"
@@ -957,7 +958,7 @@ function _upload(client, httpRequest, assetType, body) {
957
958
  });
958
959
  }
959
960
  function optionsFromFile(opts, file) {
960
- if (typeof window === "undefined" || !(file instanceof window.File)) {
961
+ if (typeof File === "undefined" || !(file instanceof File)) {
961
962
  return opts;
962
963
  }
963
964
  return Object.assign({