@sanity/client 5.4.3-dev.0 → 5.4.3-dev.2

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 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.0";
11
+ var version = "5.4.3-dev.2";
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,72 @@ export declare class ClientError extends Error {
322
322
  constructor(res: Any)
323
323
  }
324
324
 
325
- /** @internal */
326
- export declare type ContentSourceMapping = {
327
- mappings: Record<string, Mapping>
328
- documents: Array<SanityDocument>
329
- paths: Array<string>
325
+ /** @public */
326
+ export declare interface ContentSourceMap {
327
+ mappings: ContentSourceMapMappings
328
+ documents: ContentSourceMapDocuments
329
+ paths: ContentSourceMapPaths
330
+ }
331
+
332
+ /** @public */
333
+ export declare interface ContentSourceMapDocument {
334
+ _projectId: string
335
+ _dataset: string
336
+ _id: string
337
+ }
338
+
339
+ /** @public */
340
+ export declare type ContentSourceMapDocuments = ContentSourceMapDocument[]
341
+
342
+ /**
343
+ * DocumentValueSource is a path to a value within a document
344
+ * @public
345
+ */
346
+ export declare interface ContentSourceMapDocumentValueSource {
347
+ type: 'documentValue'
348
+ document: number
349
+ path: number
350
+ }
351
+
352
+ /**
353
+ * When a value is not from a source, its a literal
354
+ * @public
355
+ */
356
+ export declare interface ContentSourceMapLiteralSource {
357
+ type: 'literal'
358
+ }
359
+
360
+ /** @public */
361
+ export declare type ContentSourceMapMapping = ContentSourceMapValueMapping
362
+
363
+ /** @public */
364
+ export declare type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
365
+
366
+ /** @public */
367
+ export declare type ContentSourceMapPaths = string[]
368
+
369
+ /** @public */
370
+ export declare type ContentSourceMapSource =
371
+ | ContentSourceMapDocumentValueSource
372
+ | ContentSourceMapLiteralSource
373
+ | ContentSourceMapUnknownSource
374
+
375
+ /**
376
+ * When a field source is unknown
377
+ * @public
378
+ */
379
+ export declare interface ContentSourceMapUnknownSource {
380
+ type: 'unknown'
381
+ }
382
+
383
+ /**
384
+ * ValueMapping is a mapping when for value that is from a single source value
385
+ * It may refer to a field within a document or a literal value
386
+ * @public
387
+ */
388
+ export declare interface ContentSourceMapValueMapping {
389
+ type: 'value'
390
+ source: ContentSourceMapSource
330
391
  }
331
392
 
332
393
  /** @public */
@@ -411,16 +472,6 @@ export declare type DisconnectEvent = {
411
472
  reason: string
412
473
  }
413
474
 
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
475
  /** @public */
425
476
  export declare interface ErrorProps {
426
477
  message: string
@@ -430,7 +481,7 @@ export declare interface ErrorProps {
430
481
  details: Any
431
482
  }
432
483
 
433
- /** @internal */
484
+ /** @public */
434
485
  export declare type FilteredResponseQueryOptions = RequestOptions & {
435
486
  filterResponse?: true
436
487
  }
@@ -550,17 +601,6 @@ export declare interface ListenOptions {
550
601
  tag?: string
551
602
  }
552
603
 
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
604
  /** @internal */
565
605
  export declare interface MultipleMutationResult {
566
606
  transactionId: string
@@ -1445,12 +1485,12 @@ export declare type QueryParams = {
1445
1485
  [key: string]: Any
1446
1486
  }
1447
1487
 
1448
- /** @internal */
1488
+ /** @public */
1449
1489
  export declare interface RawQueryResponse<R> {
1450
1490
  q: string
1451
1491
  ms: number
1452
1492
  result: R
1453
- resultSourceMap: ContentSourceMapping
1493
+ resultSourceMap: ContentSourceMap
1454
1494
  }
1455
1495
 
1456
1496
  /** @internal */
@@ -2125,9 +2165,6 @@ export declare interface SingleMutationResult {
2125
2165
  }[]
2126
2166
  }
2127
2167
 
2128
- /** @internal */
2129
- export declare type Source = DocumentValueSource | LiteralSource | UnknownSource
2130
-
2131
2168
  /** @public */
2132
2169
  export declare class Transaction extends BaseTransaction {
2133
2170
  #private
@@ -2218,19 +2255,11 @@ export declare type TransactionMutationOptions =
2218
2255
  | TransactionAllDocumentsMutationOptions
2219
2256
  | TransactionAllDocumentIdsMutationOptions
2220
2257
 
2221
- /** @internal */
2258
+ /** @public */
2222
2259
  export declare type UnfilteredResponseQueryOptions = RequestOptions & {
2223
2260
  filterResponse: false
2224
2261
  }
2225
2262
 
2226
- /**
2227
- * When a field source is unknown
2228
- * @internal
2229
- */
2230
- export declare type UnknownSource = {
2231
- type: 'unknown'
2232
- }
2233
-
2234
2263
  export {unstable__adapter}
2235
2264
 
2236
2265
  export {unstable__environment}
@@ -2311,16 +2340,6 @@ export declare class UsersClient {
2311
2340
  getById<T extends 'me' | string>(id: T): Promise<T extends 'me' ? CurrentSanityUser : SanityUser>
2312
2341
  }
2313
2342
 
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
2343
  /** @public */
2325
2344
  export declare type WelcomeEvent = {
2326
2345
  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.0";
7
+ var version = "5.4.3-dev.2";
8
8
  const middleware = [debug({
9
9
  verbose: true,
10
10
  namespace: "sanity:client"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "5.4.3-dev.0",
3
+ "version": "5.4.3-dev.2",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -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
- /** @internal */
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
- /** @internal */
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: ContentSourceMapping
493
+ resultSourceMap: ContentSourceMap
541
494
  }
542
495
 
543
496
  /** @internal */
@@ -0,0 +1,2 @@
1
+ export type * from './_legacy'
2
+ export type * from './resultSourceMap'
@@ -0,0 +1,65 @@
1
+ /**
2
+ * DocumentValueSource is a path to a value within a document
3
+ * @public
4
+ */
5
+ export interface ContentSourceMapDocumentValueSource {
6
+ type: 'documentValue'
7
+ // index location of the document
8
+ document: number
9
+ // index location of the path
10
+ path: number
11
+ }
12
+ /**
13
+ * When a value is not from a source, its a literal
14
+ * @public
15
+ */
16
+ export interface ContentSourceMapLiteralSource {
17
+ type: 'literal'
18
+ }
19
+ /**
20
+ * When a field source is unknown
21
+ * @public
22
+ */
23
+ export interface ContentSourceMapUnknownSource {
24
+ type: 'unknown'
25
+ }
26
+ /** @public */
27
+ export type ContentSourceMapSource =
28
+ | ContentSourceMapDocumentValueSource
29
+ | ContentSourceMapLiteralSource
30
+ | ContentSourceMapUnknownSource
31
+ /**
32
+ * ValueMapping is a mapping when for value that is from a single source value
33
+ * It may refer to a field within a document or a literal value
34
+ * @public
35
+ */
36
+ export interface ContentSourceMapValueMapping {
37
+ type: 'value'
38
+ // source of the value
39
+ source: ContentSourceMapSource
40
+ }
41
+ /** @public */
42
+ export type ContentSourceMapMapping = ContentSourceMapValueMapping
43
+
44
+ /** @public */
45
+ export type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
46
+
47
+ /** @public */
48
+ export interface ContentSourceMapDocument {
49
+ _projectId: string
50
+ _dataset: string
51
+ _id: string
52
+ }
53
+
54
+ /** @public */
55
+ export type ContentSourceMapDocuments = ContentSourceMapDocument[]
56
+
57
+ /** @public */
58
+ export type ContentSourceMapPaths = string[]
59
+
60
+ /** @public */
61
+ export interface ContentSourceMap {
62
+ mappings: ContentSourceMapMappings
63
+ documents: ContentSourceMapDocuments
64
+ paths: ContentSourceMapPaths
65
+ }