@sanity/client 5.4.3-dev.0 → 5.4.3-dev.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.cjs +1 -1
- package/dist/index.d.ts +63 -51
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/{types.ts → types/_legacy.ts} +7 -54
- package/src/types/index.ts +2 -0
- package/src/types/resultSourceMap.ts +60 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var getIt = require('get-it');
|
|
|
8
8
|
var rxjs = require('rxjs');
|
|
9
9
|
var operators = require('rxjs/operators');
|
|
10
10
|
var name = "@sanity/client";
|
|
11
|
-
var version = "5.4.3-dev.
|
|
11
|
+
var version = "5.4.3-dev.1";
|
|
12
12
|
const middleware = [middleware$1.debug({
|
|
13
13
|
verbose: true,
|
|
14
14
|
namespace: "sanity:client"
|
package/dist/index.d.ts
CHANGED
|
@@ -322,11 +322,65 @@ export declare class ClientError extends Error {
|
|
|
322
322
|
constructor(res: Any)
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
/** @
|
|
326
|
-
export declare type
|
|
327
|
-
mappings:
|
|
328
|
-
documents:
|
|
329
|
-
paths:
|
|
325
|
+
/** @public */
|
|
326
|
+
export declare type ContentSourceMap = {
|
|
327
|
+
mappings: ContentSourceMapMappings
|
|
328
|
+
documents: ContentSourceMapDocuments
|
|
329
|
+
paths: ContentSourceMapPaths
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** @public */
|
|
333
|
+
export declare type ContentSourceMapDocuments = SanityDocument[]
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* DocumentValueSource is a path to a value within a document
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
export declare type ContentSourceMapDocumentValueSource = {
|
|
340
|
+
type: 'documentValue'
|
|
341
|
+
document: number
|
|
342
|
+
path: number
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* When a value is not from a source, its a literal
|
|
347
|
+
* @public
|
|
348
|
+
*/
|
|
349
|
+
export declare type ContentSourceMapLiteralSource = {
|
|
350
|
+
type: 'literal'
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** @public */
|
|
354
|
+
export declare type ContentSourceMapMapping = ContentSourceMapValueMapping
|
|
355
|
+
|
|
356
|
+
/** @public */
|
|
357
|
+
export declare type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
|
|
358
|
+
|
|
359
|
+
/** @public */
|
|
360
|
+
export declare type ContentSourceMapPaths = string[]
|
|
361
|
+
|
|
362
|
+
/** @public */
|
|
363
|
+
export declare type ContentSourceMapSource =
|
|
364
|
+
| ContentSourceMapDocumentValueSource
|
|
365
|
+
| ContentSourceMapLiteralSource
|
|
366
|
+
| ContentSourceMapUnknownSource
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* When a field source is unknown
|
|
370
|
+
* @public
|
|
371
|
+
*/
|
|
372
|
+
export declare type ContentSourceMapUnknownSource = {
|
|
373
|
+
type: 'unknown'
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* ValueMapping is a mapping when for value that is from a single source value
|
|
378
|
+
* It may refer to a field within a document or a literal value
|
|
379
|
+
* @public
|
|
380
|
+
*/
|
|
381
|
+
export declare type ContentSourceMapValueMapping = {
|
|
382
|
+
type: 'value'
|
|
383
|
+
source: ContentSourceMapSource
|
|
330
384
|
}
|
|
331
385
|
|
|
332
386
|
/** @public */
|
|
@@ -411,16 +465,6 @@ export declare type DisconnectEvent = {
|
|
|
411
465
|
reason: string
|
|
412
466
|
}
|
|
413
467
|
|
|
414
|
-
/**
|
|
415
|
-
* DocumentValueSource is a path to a value within a document
|
|
416
|
-
* @internal
|
|
417
|
-
*/
|
|
418
|
-
export declare type DocumentValueSource = {
|
|
419
|
-
type: 'documentValue'
|
|
420
|
-
document: number
|
|
421
|
-
path: number
|
|
422
|
-
}
|
|
423
|
-
|
|
424
468
|
/** @public */
|
|
425
469
|
export declare interface ErrorProps {
|
|
426
470
|
message: string
|
|
@@ -430,7 +474,7 @@ export declare interface ErrorProps {
|
|
|
430
474
|
details: Any
|
|
431
475
|
}
|
|
432
476
|
|
|
433
|
-
/** @
|
|
477
|
+
/** @public */
|
|
434
478
|
export declare type FilteredResponseQueryOptions = RequestOptions & {
|
|
435
479
|
filterResponse?: true
|
|
436
480
|
}
|
|
@@ -550,17 +594,6 @@ export declare interface ListenOptions {
|
|
|
550
594
|
tag?: string
|
|
551
595
|
}
|
|
552
596
|
|
|
553
|
-
/**
|
|
554
|
-
* When a value is not from a source, its a literal
|
|
555
|
-
* @internal
|
|
556
|
-
*/
|
|
557
|
-
export declare type LiteralSource = {
|
|
558
|
-
type: 'literal'
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/** @internal */
|
|
562
|
-
export declare type Mapping = ValueMapping
|
|
563
|
-
|
|
564
597
|
/** @internal */
|
|
565
598
|
export declare interface MultipleMutationResult {
|
|
566
599
|
transactionId: string
|
|
@@ -1445,12 +1478,12 @@ export declare type QueryParams = {
|
|
|
1445
1478
|
[key: string]: Any
|
|
1446
1479
|
}
|
|
1447
1480
|
|
|
1448
|
-
/** @
|
|
1481
|
+
/** @public */
|
|
1449
1482
|
export declare interface RawQueryResponse<R> {
|
|
1450
1483
|
q: string
|
|
1451
1484
|
ms: number
|
|
1452
1485
|
result: R
|
|
1453
|
-
resultSourceMap:
|
|
1486
|
+
resultSourceMap: ContentSourceMap
|
|
1454
1487
|
}
|
|
1455
1488
|
|
|
1456
1489
|
/** @internal */
|
|
@@ -2125,9 +2158,6 @@ export declare interface SingleMutationResult {
|
|
|
2125
2158
|
}[]
|
|
2126
2159
|
}
|
|
2127
2160
|
|
|
2128
|
-
/** @internal */
|
|
2129
|
-
export declare type Source = DocumentValueSource | LiteralSource | UnknownSource
|
|
2130
|
-
|
|
2131
2161
|
/** @public */
|
|
2132
2162
|
export declare class Transaction extends BaseTransaction {
|
|
2133
2163
|
#private
|
|
@@ -2218,19 +2248,11 @@ export declare type TransactionMutationOptions =
|
|
|
2218
2248
|
| TransactionAllDocumentsMutationOptions
|
|
2219
2249
|
| TransactionAllDocumentIdsMutationOptions
|
|
2220
2250
|
|
|
2221
|
-
/** @
|
|
2251
|
+
/** @public */
|
|
2222
2252
|
export declare type UnfilteredResponseQueryOptions = RequestOptions & {
|
|
2223
2253
|
filterResponse: false
|
|
2224
2254
|
}
|
|
2225
2255
|
|
|
2226
|
-
/**
|
|
2227
|
-
* When a field source is unknown
|
|
2228
|
-
* @internal
|
|
2229
|
-
*/
|
|
2230
|
-
export declare type UnknownSource = {
|
|
2231
|
-
type: 'unknown'
|
|
2232
|
-
}
|
|
2233
|
-
|
|
2234
2256
|
export {unstable__adapter}
|
|
2235
2257
|
|
|
2236
2258
|
export {unstable__environment}
|
|
@@ -2311,16 +2333,6 @@ export declare class UsersClient {
|
|
|
2311
2333
|
getById<T extends 'me' | string>(id: T): Promise<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
2312
2334
|
}
|
|
2313
2335
|
|
|
2314
|
-
/**
|
|
2315
|
-
* ValueMapping is a mapping when for value that is from a single source value
|
|
2316
|
-
* It may refer to a field within a document or a literal value
|
|
2317
|
-
* @internal
|
|
2318
|
-
*/
|
|
2319
|
-
export declare type ValueMapping = {
|
|
2320
|
-
type: 'value'
|
|
2321
|
-
source: Source
|
|
2322
|
-
}
|
|
2323
|
-
|
|
2324
2336
|
/** @public */
|
|
2325
2337
|
export declare type WelcomeEvent = {
|
|
2326
2338
|
type: 'welcome'
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { adapter as unstable__adapter, environment as unstable__environment } fr
|
|
|
4
4
|
import { Observable, lastValueFrom } from 'rxjs';
|
|
5
5
|
import { map, filter } from 'rxjs/operators';
|
|
6
6
|
var name = "@sanity/client";
|
|
7
|
-
var version = "5.4.3-dev.
|
|
7
|
+
var version = "5.4.3-dev.1";
|
|
8
8
|
const middleware = [debug({
|
|
9
9
|
verbose: true,
|
|
10
10
|
namespace: "sanity:client"
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
// @TODO the types in this file should be split into their own files, that's why the file is named `_legacy`
|
|
1
2
|
// deno-lint-ignore-file no-empty-interface
|
|
2
3
|
import type {Requester} from 'get-it'
|
|
3
4
|
|
|
5
|
+
import type {ContentSourceMap} from './resultSourceMap'
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
6
9
|
* @internal
|
|
@@ -472,72 +475,22 @@ export interface ListenOptions {
|
|
|
472
475
|
tag?: string
|
|
473
476
|
}
|
|
474
477
|
|
|
475
|
-
/** @
|
|
478
|
+
/** @public */
|
|
476
479
|
export type FilteredResponseQueryOptions = RequestOptions & {
|
|
477
480
|
filterResponse?: true
|
|
478
481
|
}
|
|
479
482
|
|
|
480
|
-
/**
|
|
481
|
-
* DocumentValueSource is a path to a value within a document
|
|
482
|
-
* @internal
|
|
483
|
-
*/
|
|
484
|
-
export type DocumentValueSource = {
|
|
485
|
-
type: 'documentValue'
|
|
486
|
-
|
|
487
|
-
// index location of the document
|
|
488
|
-
document: number
|
|
489
|
-
// index location of the path
|
|
490
|
-
path: number
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* When a value is not from a source, its a literal
|
|
494
|
-
* @internal
|
|
495
|
-
*/
|
|
496
|
-
export type LiteralSource = {
|
|
497
|
-
type: 'literal'
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* When a field source is unknown
|
|
501
|
-
* @internal
|
|
502
|
-
*/
|
|
503
|
-
export type UnknownSource = {
|
|
504
|
-
type: 'unknown'
|
|
505
|
-
}
|
|
506
|
-
/** @internal */
|
|
507
|
-
export type Source = DocumentValueSource | LiteralSource | UnknownSource
|
|
508
|
-
/**
|
|
509
|
-
* ValueMapping is a mapping when for value that is from a single source value
|
|
510
|
-
* It may refer to a field within a document or a literal value
|
|
511
|
-
* @internal
|
|
512
|
-
*/
|
|
513
|
-
export type ValueMapping = {
|
|
514
|
-
type: 'value'
|
|
515
|
-
|
|
516
|
-
// source of the value
|
|
517
|
-
source: Source
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/** @internal */
|
|
521
|
-
export type Mapping = ValueMapping
|
|
522
|
-
|
|
523
|
-
/** @internal */
|
|
483
|
+
/** @public */
|
|
524
484
|
export type UnfilteredResponseQueryOptions = RequestOptions & {
|
|
525
485
|
filterResponse: false
|
|
526
486
|
}
|
|
527
487
|
|
|
528
|
-
/** @
|
|
529
|
-
export type ContentSourceMapping = {
|
|
530
|
-
mappings: Record<string, Mapping>
|
|
531
|
-
documents: Array<SanityDocument>
|
|
532
|
-
paths: Array<string>
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
/** @internal */
|
|
488
|
+
/** @public */
|
|
536
489
|
export interface RawQueryResponse<R> {
|
|
537
490
|
q: string
|
|
538
491
|
ms: number
|
|
539
492
|
result: R
|
|
540
|
-
resultSourceMap:
|
|
493
|
+
resultSourceMap: ContentSourceMap
|
|
541
494
|
}
|
|
542
495
|
|
|
543
496
|
/** @internal */
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type {SanityDocument} from './_legacy'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* DocumentValueSource is a path to a value within a document
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type ContentSourceMapDocumentValueSource = {
|
|
8
|
+
type: 'documentValue'
|
|
9
|
+
// index location of the document
|
|
10
|
+
document: number
|
|
11
|
+
// index location of the path
|
|
12
|
+
path: number
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* When a value is not from a source, its a literal
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export type ContentSourceMapLiteralSource = {
|
|
19
|
+
type: 'literal'
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* When a field source is unknown
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export type ContentSourceMapUnknownSource = {
|
|
26
|
+
type: 'unknown'
|
|
27
|
+
}
|
|
28
|
+
/** @public */
|
|
29
|
+
export type ContentSourceMapSource =
|
|
30
|
+
| ContentSourceMapDocumentValueSource
|
|
31
|
+
| ContentSourceMapLiteralSource
|
|
32
|
+
| ContentSourceMapUnknownSource
|
|
33
|
+
/**
|
|
34
|
+
* ValueMapping is a mapping when for value that is from a single source value
|
|
35
|
+
* It may refer to a field within a document or a literal value
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export type ContentSourceMapValueMapping = {
|
|
39
|
+
type: 'value'
|
|
40
|
+
// source of the value
|
|
41
|
+
source: ContentSourceMapSource
|
|
42
|
+
}
|
|
43
|
+
/** @public */
|
|
44
|
+
export type ContentSourceMapMapping = ContentSourceMapValueMapping
|
|
45
|
+
|
|
46
|
+
/** @public */
|
|
47
|
+
export type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
|
|
48
|
+
|
|
49
|
+
/** @public */
|
|
50
|
+
export type ContentSourceMapDocuments = SanityDocument[]
|
|
51
|
+
|
|
52
|
+
/** @public */
|
|
53
|
+
export type ContentSourceMapPaths = string[]
|
|
54
|
+
|
|
55
|
+
/** @public */
|
|
56
|
+
export type ContentSourceMap = {
|
|
57
|
+
mappings: ContentSourceMapMappings
|
|
58
|
+
documents: ContentSourceMapDocuments
|
|
59
|
+
paths: ContentSourceMapPaths
|
|
60
|
+
}
|