@sanity/client 5.2.0 → 5.2.1
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.browser.cjs +13 -11
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +13 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +14 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +128 -128
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/src/SanityClient.ts +80 -80
- package/src/assets/AssetsClient.ts +4 -4
- package/src/config.ts +1 -1
- package/src/data/dataMethods.ts +31 -31
- package/src/data/encodeQueryString.ts +3 -3
- package/src/data/listen.ts +11 -11
- package/src/data/patch.ts +18 -18
- package/src/data/transaction.ts +13 -15
- package/src/generateHelpUrl.ts +1 -1
- package/src/http/errors.ts +7 -7
- package/src/http/request.ts +4 -4
- package/src/http/requestOptions.ts +3 -3
- package/src/index.browser.ts +9 -1
- package/src/index.ts +9 -1
- package/src/types.ts +27 -28
- package/src/util/defaults.ts +3 -3
- package/src/util/getSelection.ts +1 -1
- package/src/util/once.ts +4 -4
- package/src/util/pick.ts +3 -3
- package/src/validators.ts +4 -4
- package/src/warnings.ts +8 -4
- package/umd/sanityClient.js +13 -11
- package/umd/sanityClient.min.js +1 -1
- package/src/migrationNotice.ts +0 -9
package/src/http/request.ts
CHANGED
|
@@ -2,11 +2,11 @@ import {getIt, type Middlewares} from 'get-it'
|
|
|
2
2
|
import {jsonRequest, jsonResponse, observable, progress} from 'get-it/middleware'
|
|
3
3
|
import {Observable} from 'rxjs'
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {Any, HttpRequest, RequestOptions} from '../types'
|
|
6
6
|
import {ClientError, ServerError} from './errors'
|
|
7
7
|
|
|
8
8
|
const httpError = {
|
|
9
|
-
onResponse: (res:
|
|
9
|
+
onResponse: (res: Any) => {
|
|
10
10
|
if (res.statusCode >= 500) {
|
|
11
11
|
throw new ServerError(res)
|
|
12
12
|
} else if (res.statusCode >= 400) {
|
|
@@ -18,7 +18,7 @@ const httpError = {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const printWarnings = {
|
|
21
|
-
onResponse: (res:
|
|
21
|
+
onResponse: (res: Any) => {
|
|
22
22
|
const warn = res.headers['x-sanity-warning']
|
|
23
23
|
const warnings = Array.isArray(warn) ? warn : [warn]
|
|
24
24
|
warnings.filter(Boolean).forEach((msg) => console.warn(msg)) // eslint-disable-line no-console
|
|
@@ -39,7 +39,7 @@ export function defineHttpRequest(envMiddleware: Middlewares): HttpRequest {
|
|
|
39
39
|
])
|
|
40
40
|
|
|
41
41
|
function httpRequest(options: RequestOptions, requester = request) {
|
|
42
|
-
return requester({maxRedirects: 0, ...options} as
|
|
42
|
+
return requester({maxRedirects: 0, ...options} as Any)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
httpRequest.defaultRequester = request
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type {RequestOptions} from 'get-it'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {Any} from '../types'
|
|
4
4
|
|
|
5
5
|
const projectHeader = 'X-Sanity-Project-ID'
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
const headers:
|
|
7
|
+
export function requestOptions(config: Any, overrides: Any = {}): Omit<RequestOptions, 'url'> {
|
|
8
|
+
const headers: Any = {}
|
|
9
9
|
|
|
10
10
|
const token = overrides.token || config.token
|
|
11
11
|
if (token) {
|
package/src/index.browser.ts
CHANGED
|
@@ -2,6 +2,7 @@ import envMiddleware from './http/browserMiddleware'
|
|
|
2
2
|
import {defineHttpRequest} from './http/request'
|
|
3
3
|
import {SanityClient} from './SanityClient'
|
|
4
4
|
import type {ClientConfig} from './types'
|
|
5
|
+
import {printNoDefaultExport} from './warnings'
|
|
5
6
|
|
|
6
7
|
export * from './data/patch'
|
|
7
8
|
export * from './data/transaction'
|
|
@@ -17,4 +18,11 @@ export const requester = httpRequest.defaultRequester
|
|
|
17
18
|
/** @public */
|
|
18
19
|
export const createClient = (config: ClientConfig) => new SanityClient(httpRequest, config)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
* @deprecated Use the named export `createClient` instead of the `default` export
|
|
24
|
+
*/
|
|
25
|
+
export default function deprecatedCreateClient(config: ClientConfig) {
|
|
26
|
+
printNoDefaultExport()
|
|
27
|
+
return new SanityClient(httpRequest, config)
|
|
28
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import envMiddleware from './http/nodeMiddleware'
|
|
|
2
2
|
import {defineHttpRequest} from './http/request'
|
|
3
3
|
import {SanityClient} from './SanityClient'
|
|
4
4
|
import type {ClientConfig} from './types'
|
|
5
|
+
import {printNoDefaultExport} from './warnings'
|
|
5
6
|
|
|
6
7
|
export * from './data/patch'
|
|
7
8
|
export * from './data/transaction'
|
|
@@ -17,4 +18,11 @@ export const requester = httpRequest.defaultRequester
|
|
|
17
18
|
/** @public */
|
|
18
19
|
export const createClient = (config: ClientConfig) => new SanityClient(httpRequest, config)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
* @deprecated Use the named export `createClient` instead of the `default` export
|
|
24
|
+
*/
|
|
25
|
+
export default function deprecatedCreateClient(config: ClientConfig) {
|
|
26
|
+
printNoDefaultExport()
|
|
27
|
+
return new SanityClient(httpRequest, config)
|
|
28
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {Requester} from 'get-it'
|
|
|
4
4
|
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type Any = any // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export interface RequestOptions {
|
|
@@ -13,8 +13,8 @@ export interface RequestOptions {
|
|
|
13
13
|
tag?: string
|
|
14
14
|
headers?: Record<string, string>
|
|
15
15
|
method?: string
|
|
16
|
-
query?:
|
|
17
|
-
body?:
|
|
16
|
+
query?: Any
|
|
17
|
+
body?: Any
|
|
18
18
|
signal?: AbortSignal
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -155,7 +155,7 @@ export interface SanityReference {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/** @internal */
|
|
158
|
-
export type SanityDocument<T extends Record<string,
|
|
158
|
+
export type SanityDocument<T extends Record<string, Any> = Record<string, Any>> = {
|
|
159
159
|
[P in keyof T]: T[P]
|
|
160
160
|
} & {
|
|
161
161
|
_id: string
|
|
@@ -212,11 +212,11 @@ export interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
|
212
212
|
}
|
|
213
213
|
image?: {
|
|
214
214
|
_type: 'sanity.imageExifTags'
|
|
215
|
-
[key: string]:
|
|
215
|
+
[key: string]: Any
|
|
216
216
|
}
|
|
217
217
|
exif?: {
|
|
218
218
|
_type: 'sanity.imageExifMetadata'
|
|
219
|
-
[key: string]:
|
|
219
|
+
[key: string]: Any
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
@@ -224,10 +224,10 @@ export interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
|
224
224
|
/** @public */
|
|
225
225
|
export interface ErrorProps {
|
|
226
226
|
message: string
|
|
227
|
-
response:
|
|
227
|
+
response: Any
|
|
228
228
|
statusCode: number
|
|
229
|
-
responseBody:
|
|
230
|
-
details:
|
|
229
|
+
responseBody: Any
|
|
230
|
+
details: Any
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
/** @public */
|
|
@@ -337,32 +337,31 @@ export interface CurrentSanityUser {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
/** @public */
|
|
340
|
-
export type SanityDocumentStub<T extends Record<string,
|
|
340
|
+
export type SanityDocumentStub<T extends Record<string, Any> = Record<string, Any>> = {
|
|
341
341
|
[P in keyof T]: T[P]
|
|
342
342
|
} & {
|
|
343
343
|
_type: string
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
/** @public */
|
|
347
|
-
export type IdentifiedSanityDocumentStub<T extends Record<string,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
} & SanityDocumentStub
|
|
347
|
+
export type IdentifiedSanityDocumentStub<T extends Record<string, Any> = Record<string, Any>> = {
|
|
348
|
+
[P in keyof T]: T[P]
|
|
349
|
+
} & {
|
|
350
|
+
_id: string
|
|
351
|
+
} & SanityDocumentStub
|
|
353
352
|
|
|
354
353
|
/** @internal */
|
|
355
354
|
export type InsertPatch =
|
|
356
|
-
| {before: string; items:
|
|
357
|
-
| {after: string; items:
|
|
358
|
-
| {replace: string; items:
|
|
355
|
+
| {before: string; items: Any[]}
|
|
356
|
+
| {after: string; items: Any[]}
|
|
357
|
+
| {replace: string; items: Any[]}
|
|
359
358
|
|
|
360
359
|
// Note: this is actually incorrect/invalid, but implemented as-is for backwards compatibility
|
|
361
360
|
/** @internal */
|
|
362
361
|
export interface PatchOperations {
|
|
363
|
-
set?: {[key: string]:
|
|
364
|
-
setIfMissing?: {[key: string]:
|
|
365
|
-
diffMatchPatch?: {[key: string]:
|
|
362
|
+
set?: {[key: string]: Any}
|
|
363
|
+
setIfMissing?: {[key: string]: Any}
|
|
364
|
+
diffMatchPatch?: {[key: string]: Any}
|
|
366
365
|
unset?: string[]
|
|
367
366
|
inc?: {[key: string]: number}
|
|
368
367
|
dec?: {[key: string]: number}
|
|
@@ -371,7 +370,7 @@ export interface PatchOperations {
|
|
|
371
370
|
}
|
|
372
371
|
|
|
373
372
|
/** @public */
|
|
374
|
-
export type QueryParams = {[key: string]:
|
|
373
|
+
export type QueryParams = {[key: string]: Any}
|
|
375
374
|
/** @internal */
|
|
376
375
|
export type MutationSelection = {query: string; params?: QueryParams} | {id: string | string[]}
|
|
377
376
|
/** @internal */
|
|
@@ -380,7 +379,7 @@ export type PatchSelection = string | string[] | MutationSelection
|
|
|
380
379
|
export type PatchMutationOperation = PatchOperations & MutationSelection
|
|
381
380
|
|
|
382
381
|
/** @public */
|
|
383
|
-
export type Mutation<R extends Record<string,
|
|
382
|
+
export type Mutation<R extends Record<string, Any> = Record<string, Any>> =
|
|
384
383
|
| {create: SanityDocumentStub<R>}
|
|
385
384
|
| {createOrReplace: IdentifiedSanityDocumentStub<R>}
|
|
386
385
|
| {createIfNotExists: IdentifiedSanityDocumentStub<R>}
|
|
@@ -388,7 +387,7 @@ export type Mutation<R extends Record<string, FIXME> = Record<string, FIXME>> =
|
|
|
388
387
|
| {patch: PatchMutationOperation}
|
|
389
388
|
|
|
390
389
|
/** @public */
|
|
391
|
-
export type MutationEvent<R extends Record<string,
|
|
390
|
+
export type MutationEvent<R extends Record<string, Any> = Record<string, Any>> = {
|
|
392
391
|
type: 'mutation'
|
|
393
392
|
documentId: string
|
|
394
393
|
eventId: string
|
|
@@ -428,7 +427,7 @@ export type WelcomeEvent = {
|
|
|
428
427
|
}
|
|
429
428
|
|
|
430
429
|
/** @public */
|
|
431
|
-
export type ListenEvent<R extends Record<string,
|
|
430
|
+
export type ListenEvent<R extends Record<string, Any>> =
|
|
432
431
|
| MutationEvent<R>
|
|
433
432
|
| ChannelErrorEvent
|
|
434
433
|
| DisconnectEvent
|
|
@@ -517,7 +516,7 @@ export type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
|
517
516
|
}
|
|
518
517
|
|
|
519
518
|
/** @internal */
|
|
520
|
-
export type AttributeSet = {[key: string]:
|
|
519
|
+
export type AttributeSet = {[key: string]: Any}
|
|
521
520
|
|
|
522
521
|
/** @internal */
|
|
523
522
|
export type TransactionFirstDocumentMutationOptions = BaseMutationOptions & {
|
|
@@ -564,6 +563,6 @@ export interface RawRequestOptions {
|
|
|
564
563
|
headers?: {[key: string]: string}
|
|
565
564
|
timeout?: number
|
|
566
565
|
proxy?: string
|
|
567
|
-
body?:
|
|
566
|
+
body?: Any
|
|
568
567
|
maxRedirects?: number
|
|
569
568
|
}
|
package/src/util/defaults.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {Any} from '../types'
|
|
2
2
|
|
|
3
|
-
export default (obj:
|
|
3
|
+
export default (obj: Any, defaults: Any) =>
|
|
4
4
|
Object.keys(defaults)
|
|
5
5
|
.concat(Object.keys(obj))
|
|
6
6
|
.reduce((target, prop) => {
|
|
7
7
|
target[prop] = typeof obj[prop] === 'undefined' ? defaults[prop] : obj[prop]
|
|
8
8
|
|
|
9
9
|
return target
|
|
10
|
-
}, {} as
|
|
10
|
+
}, {} as Any)
|
package/src/util/getSelection.ts
CHANGED
package/src/util/once.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {Any} from '../types'
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function once(fn: Any) {
|
|
4
4
|
let didCall = false
|
|
5
|
-
let returnValue:
|
|
6
|
-
return (...args:
|
|
5
|
+
let returnValue: Any
|
|
6
|
+
return (...args: Any[]) => {
|
|
7
7
|
if (didCall) {
|
|
8
8
|
return returnValue
|
|
9
9
|
}
|
package/src/util/pick.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Any} from '../types'
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
props.reduce((selection:
|
|
3
|
+
export const pick = (obj: Any, props: Any) =>
|
|
4
|
+
props.reduce((selection: Any, prop: Any) => {
|
|
5
5
|
if (typeof obj[prop] === 'undefined') {
|
|
6
6
|
return selection
|
|
7
7
|
}
|
package/src/validators.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {Any, InitializedClientConfig} from './types'
|
|
2
2
|
|
|
3
3
|
const VALID_ASSET_TYPES = ['image', 'file']
|
|
4
4
|
const VALID_INSERT_LOCATIONS = ['before', 'after', 'replace']
|
|
@@ -23,7 +23,7 @@ export const validateAssetType = (type: string) => {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const validateObject = (op: string, val:
|
|
26
|
+
export const validateObject = (op: string, val: Any) => {
|
|
27
27
|
if (val === null || typeof val !== 'object' || Array.isArray(val)) {
|
|
28
28
|
throw new Error(`${op}() takes an object of properties`)
|
|
29
29
|
}
|
|
@@ -35,7 +35,7 @@ export const validateDocumentId = (op: string, id: string) => {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export const requireDocumentId = (op: string, doc: Record<string,
|
|
38
|
+
export const requireDocumentId = (op: string, doc: Record<string, Any>) => {
|
|
39
39
|
if (!doc._id) {
|
|
40
40
|
throw new Error(`${op}() requires that the document contains an ID ("_id" property)`)
|
|
41
41
|
}
|
|
@@ -43,7 +43,7 @@ export const requireDocumentId = (op: string, doc: Record<string, FIXME>) => {
|
|
|
43
43
|
validateDocumentId(op, doc._id)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export const validateInsert = (at: string, selector: string, items:
|
|
46
|
+
export const validateInsert = (at: string, selector: string, items: Any[]) => {
|
|
47
47
|
const signature = 'insert(at, selector, items)'
|
|
48
48
|
if (VALID_INSERT_LOCATIONS.indexOf(at) === -1) {
|
|
49
49
|
const valid = VALID_INSERT_LOCATIONS.map((loc) => `"${loc}"`).join(', ')
|
package/src/warnings.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import generateHelpUrl from './generateHelpUrl'
|
|
2
|
-
import {
|
|
3
|
-
import once from './util/once'
|
|
1
|
+
import {generateHelpUrl} from './generateHelpUrl'
|
|
2
|
+
import {Any} from './types'
|
|
3
|
+
import {once} from './util/once'
|
|
4
4
|
|
|
5
5
|
const createWarningPrinter = (message: string[]) =>
|
|
6
6
|
// eslint-disable-next-line no-console
|
|
7
|
-
once((...args:
|
|
7
|
+
once((...args: Any[]) => console.warn(message.join(' '), ...args))
|
|
8
8
|
|
|
9
9
|
export const printCdnWarning = createWarningPrinter([
|
|
10
10
|
'You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and',
|
|
@@ -24,3 +24,7 @@ export const printNoApiVersionSpecifiedWarning = createWarningPrinter([
|
|
|
24
24
|
'Using the Sanity client without specifying an API version is deprecated.',
|
|
25
25
|
`See ${generateHelpUrl('js-client-api-version')}`,
|
|
26
26
|
])
|
|
27
|
+
|
|
28
|
+
export const printNoDefaultExport = createWarningPrinter([
|
|
29
|
+
'The default export of @sanity/client has been deprecated. Use the named export `createClient` instead',
|
|
30
|
+
])
|
package/umd/sanityClient.js
CHANGED
|
@@ -3185,7 +3185,7 @@
|
|
|
3185
3185
|
return httpRequest;
|
|
3186
3186
|
}
|
|
3187
3187
|
const projectHeader = "X-Sanity-Project-ID";
|
|
3188
|
-
|
|
3188
|
+
function requestOptions(config) {
|
|
3189
3189
|
let overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3190
3190
|
const headers = {};
|
|
3191
3191
|
const token = overrides.token || config.token;
|
|
@@ -3204,7 +3204,7 @@
|
|
|
3204
3204
|
json: true,
|
|
3205
3205
|
withCredentials
|
|
3206
3206
|
});
|
|
3207
|
-
}
|
|
3207
|
+
}
|
|
3208
3208
|
function getSelection(sel) {
|
|
3209
3209
|
if (typeof sel === "string" || Array.isArray(sel)) {
|
|
3210
3210
|
return {
|
|
@@ -3280,7 +3280,7 @@
|
|
|
3280
3280
|
}
|
|
3281
3281
|
return tag;
|
|
3282
3282
|
};
|
|
3283
|
-
|
|
3283
|
+
const encodeQueryString = _ref => {
|
|
3284
3284
|
let {
|
|
3285
3285
|
query,
|
|
3286
3286
|
params = {},
|
|
@@ -3885,7 +3885,7 @@
|
|
|
3885
3885
|
...options.query
|
|
3886
3886
|
};
|
|
3887
3887
|
}
|
|
3888
|
-
const reqOptions =
|
|
3888
|
+
const reqOptions = requestOptions(config, Object.assign({}, options, {
|
|
3889
3889
|
url: _getUrl(client, uri, useCdn)
|
|
3890
3890
|
}));
|
|
3891
3891
|
const request = new Observable(subscriber =>
|
|
@@ -4041,7 +4041,7 @@
|
|
|
4041
4041
|
function generateHelpUrl(slug) {
|
|
4042
4042
|
return BASE_URL + slug;
|
|
4043
4043
|
}
|
|
4044
|
-
|
|
4044
|
+
function once(fn) {
|
|
4045
4045
|
let didCall = false;
|
|
4046
4046
|
let returnValue;
|
|
4047
4047
|
return function () {
|
|
@@ -4052,7 +4052,7 @@
|
|
|
4052
4052
|
didCall = true;
|
|
4053
4053
|
return returnValue;
|
|
4054
4054
|
};
|
|
4055
|
-
}
|
|
4055
|
+
}
|
|
4056
4056
|
const createWarningPrinter = message =>
|
|
4057
4057
|
// eslint-disable-next-line no-console
|
|
4058
4058
|
once(function () {
|
|
@@ -4064,6 +4064,7 @@
|
|
|
4064
4064
|
const printCdnWarning = createWarningPrinter(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and", "cheaper. Think about it! For more info, see ".concat(generateHelpUrl("js-client-cdn-configuration"), " "), "To hide this warning, please set the `useCdn` option to either `true` or `false` when creating", "the client."]);
|
|
4065
4065
|
const printBrowserTokenWarning = createWarningPrinter(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.", "See ".concat(generateHelpUrl("js-client-browser-token"), " for more information and how to hide this warning.")]);
|
|
4066
4066
|
const printNoApiVersionSpecifiedWarning = createWarningPrinter(["Using the Sanity client without specifying an API version is deprecated.", "See ".concat(generateHelpUrl("js-client-api-version"))]);
|
|
4067
|
+
const printNoDefaultExport = createWarningPrinter(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead"]);
|
|
4067
4068
|
const defaultCdnHost = "apicdn.sanity.io";
|
|
4068
4069
|
const defaultConfig = {
|
|
4069
4070
|
apiHost: "https://api.sanity.io",
|
|
@@ -4133,7 +4134,7 @@
|
|
|
4133
4134
|
target[prop] = typeof obj[prop] === "undefined" ? defaults[prop] : obj[prop];
|
|
4134
4135
|
return target;
|
|
4135
4136
|
}, {});
|
|
4136
|
-
|
|
4137
|
+
const pick = (obj, props) => props.reduce((selection, prop) => {
|
|
4137
4138
|
if (typeof obj[prop] === "undefined") {
|
|
4138
4139
|
return selection;
|
|
4139
4140
|
}
|
|
@@ -4818,12 +4819,13 @@
|
|
|
4818
4819
|
let SanityClient = _SanityClient;
|
|
4819
4820
|
_clientConfig2 = new WeakMap();
|
|
4820
4821
|
_httpRequest2 = new WeakMap();
|
|
4821
|
-
function migrationNotice() {
|
|
4822
|
-
throw new TypeError("The default export of @sanity/client has been deprecated. Use the named export `createClient` instead");
|
|
4823
|
-
}
|
|
4824
4822
|
const httpRequest = defineHttpRequest(envMiddleware);
|
|
4825
4823
|
const requester = httpRequest.defaultRequester;
|
|
4826
4824
|
const createClient = config => new SanityClient(httpRequest, config);
|
|
4825
|
+
function deprecatedCreateClient(config) {
|
|
4826
|
+
printNoDefaultExport();
|
|
4827
|
+
return new SanityClient(httpRequest, config);
|
|
4828
|
+
}
|
|
4827
4829
|
|
|
4828
4830
|
exports.BasePatch = BasePatch;
|
|
4829
4831
|
exports.BaseTransaction = BaseTransaction;
|
|
@@ -4836,7 +4838,7 @@
|
|
|
4836
4838
|
exports.ServerError = ServerError;
|
|
4837
4839
|
exports.Transaction = Transaction;
|
|
4838
4840
|
exports.createClient = createClient;
|
|
4839
|
-
exports.default =
|
|
4841
|
+
exports.default = deprecatedCreateClient;
|
|
4840
4842
|
exports.requester = requester;
|
|
4841
4843
|
|
|
4842
4844
|
Object.defineProperty(exports, '__esModule', { value: true });
|