@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/README.md +1 -1
- package/dist/index.browser.cjs +13 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +2 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -6
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
- package/src/assets/AssetsClient.ts +11 -10
- package/src/index.browser.ts +3 -0
- package/src/index.ts +3 -0
- package/src/types.ts +9 -0
- package/umd/sanityClient.js +11 -4
- package/umd/sanityClient.min.js +3 -3
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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.
|
|
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
|
|
961
|
+
if (typeof File === "undefined" || !(file instanceof File)) {
|
|
961
962
|
return opts;
|
|
962
963
|
}
|
|
963
964
|
return Object.assign({
|