@sanity/client 6.11.3 → 6.11.4-canary.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.
Files changed (55) hide show
  1. package/README.md +4 -4
  2. package/dist/_chunks/{browserMiddleware-1MULg59S.cjs → browserMiddleware-EnEpy_gt.cjs} +247 -299
  3. package/dist/_chunks/browserMiddleware-EnEpy_gt.cjs.map +1 -0
  4. package/dist/_chunks/{browserMiddleware-heyg-fDk.js → browserMiddleware-nSeu_Rmf.js} +246 -299
  5. package/dist/_chunks/browserMiddleware-nSeu_Rmf.js.map +1 -0
  6. package/dist/_chunks/{nodeMiddleware-CHxg1-zH.cjs → nodeMiddleware-_hIIS1d7.cjs} +248 -300
  7. package/dist/_chunks/nodeMiddleware-_hIIS1d7.cjs.map +1 -0
  8. package/dist/_chunks/{nodeMiddleware-u_fUUnxa.js → nodeMiddleware-hZIb_1T_.js} +247 -300
  9. package/dist/_chunks/nodeMiddleware-hZIb_1T_.js.map +1 -0
  10. package/dist/_chunks/stegaEncodeSourceMap-4w5UCEGT.cjs +479 -0
  11. package/dist/_chunks/stegaEncodeSourceMap-4w5UCEGT.cjs.map +1 -0
  12. package/dist/_chunks/stegaEncodeSourceMap-SOgem38i.js +475 -0
  13. package/dist/_chunks/stegaEncodeSourceMap-SOgem38i.js.map +1 -0
  14. package/dist/_chunks/stegaEncodeSourceMap-Tuf6zjiN.cjs +230 -0
  15. package/dist/_chunks/stegaEncodeSourceMap-Tuf6zjiN.cjs.map +1 -0
  16. package/dist/_chunks/stegaEncodeSourceMap-zvyGxB_C.js +226 -0
  17. package/dist/_chunks/stegaEncodeSourceMap-zvyGxB_C.js.map +1 -0
  18. package/dist/index.browser.cjs +1 -1
  19. package/dist/index.browser.js +2 -2
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.ts +319 -49
  22. package/dist/index.js +2 -2
  23. package/dist/stega.browser.cjs +12 -695
  24. package/dist/stega.browser.cjs.map +1 -1
  25. package/dist/stega.browser.js +7 -690
  26. package/dist/stega.browser.js.map +1 -1
  27. package/dist/stega.cjs +12 -446
  28. package/dist/stega.cjs.js +3 -3
  29. package/dist/stega.cjs.map +1 -1
  30. package/dist/stega.d.ts +1418 -1422
  31. package/dist/stega.js +7 -441
  32. package/dist/stega.js.map +1 -1
  33. package/package.json +11 -9
  34. package/src/SanityClient.ts +152 -75
  35. package/src/assets/AssetsClient.ts +19 -10
  36. package/src/config.ts +34 -12
  37. package/src/data/dataMethods.ts +40 -14
  38. package/src/data/patch.ts +12 -10
  39. package/src/data/transaction.ts +13 -12
  40. package/src/datasets/DatasetsClient.ts +36 -16
  41. package/src/projects/ProjectsClient.ts +21 -12
  42. package/src/stega/index.browser.ts +3 -7
  43. package/src/stega/index.ts +3 -7
  44. package/src/stega/shared.ts +7 -5
  45. package/src/stega/types.ts +11 -18
  46. package/src/types.ts +107 -5
  47. package/src/users/UsersClient.ts +20 -13
  48. package/umd/sanityClient.js +3148 -2235
  49. package/umd/sanityClient.min.js +4 -3
  50. package/dist/_chunks/browserMiddleware-1MULg59S.cjs.map +0 -1
  51. package/dist/_chunks/browserMiddleware-heyg-fDk.js.map +0 -1
  52. package/dist/_chunks/nodeMiddleware-CHxg1-zH.cjs.map +0 -1
  53. package/dist/_chunks/nodeMiddleware-u_fUUnxa.js.map +0 -1
  54. package/src/stega/SanityStegaClient.ts +0 -298
  55. package/src/stega/config.ts +0 -76
package/dist/index.d.ts CHANGED
@@ -42,7 +42,8 @@ export declare type AssetMetadataType =
42
42
 
43
43
  /** @internal */
44
44
  export declare class AssetsClient {
45
- #private
45
+ private [clientSymbol]
46
+ private [httpRequestSymbol]
46
47
  constructor(client: SanityClient, httpRequest: HttpRequest)
47
48
  /**
48
49
  * Uploads a file asset to the configured dataset
@@ -325,8 +326,14 @@ export declare interface ClientConfig {
325
326
  *@deprecated set `cache` and `next` options on `client.fetch` instead
326
327
  */
327
328
  fetch?: RequestFetchOptions | boolean
329
+ /**
330
+ * Options for how, if enabled, Content Source Maps are encoded into query results using steganography
331
+ */
332
+ stega?: StegaConfig | boolean
328
333
  }
329
334
 
335
+ declare const clientConfigSymbol: unique symbol
336
+
330
337
  /** @public */
331
338
  export declare class ClientError extends Error {
332
339
  response: ErrorProps['response']
@@ -339,6 +346,18 @@ export declare class ClientError extends Error {
339
346
  /** @public */
340
347
  export declare type ClientPerspective = 'previewDrafts' | 'published' | 'raw'
341
348
 
349
+ declare const clientSymbol: unique symbol
350
+
351
+ declare const clientSymbol_2: unique symbol
352
+
353
+ declare const clientSymbol_3: unique symbol
354
+
355
+ declare const clientSymbol_4: unique symbol
356
+
357
+ declare const clientSymbol_5: unique symbol
358
+
359
+ declare const clientSymbol_6: unique symbol
360
+
342
361
  /** @public */
343
362
  export declare interface ContentSourceMap {
344
363
  mappings: ContentSourceMapMappings
@@ -388,6 +407,19 @@ export declare type ContentSourceMapMapping = ContentSourceMapValueMapping
388
407
  /** @public */
389
408
  export declare type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
390
409
 
410
+ /** @alpha */
411
+ export declare type ContentSourceMapParsedPath = (
412
+ | string
413
+ | number
414
+ | ContentSourceMapParsedPathKeyedSegment
415
+ )[]
416
+
417
+ /** @alpha */
418
+ export declare type ContentSourceMapParsedPathKeyedSegment = {
419
+ _key: string
420
+ _index: number
421
+ }
422
+
391
423
  /** @public */
392
424
  export declare type ContentSourceMapPaths = string[]
393
425
 
@@ -444,7 +476,8 @@ export declare type DatasetResponse = {
444
476
 
445
477
  /** @internal */
446
478
  export declare class DatasetsClient {
447
- #private
479
+ private [clientSymbol_2]
480
+ private [httpRequestSymbol_2]
448
481
  constructor(client: SanityClient, httpRequest: HttpRequest)
449
482
  /**
450
483
  * Create a new dataset with the given name
@@ -521,7 +554,56 @@ export declare interface ErrorProps {
521
554
  }
522
555
 
523
556
  /** @public */
524
- export declare type FilteredResponseQueryOptions = ResponseQueryOptions & {
557
+ export declare type FilterDefault = (props: {
558
+ /**
559
+ * The path to the value in the source document, for example if you queried for a document like this:
560
+ * `*[_type == "author"][0]{"slug": slug.current}`
561
+ * Then the `sourcePath` for `result.slug` would be `['slug', 'current']`.
562
+ *
563
+ */
564
+ sourcePath: ContentSourceMapParsedPath
565
+ /**
566
+ * If `sourcePath` alone isn't enough to tell you if it's safe to contain stega strings, then you can use `sourceDocument`
567
+ * for additional metadata.
568
+ * It'll always have a `_type` property, which can be used to trace it to the Studio Schema that were used initially.
569
+ * It also has `_id` to help you debug and look at the whole document when troubleshooting.
570
+ * Finally, if the document origins in a Cross Dataset Reference you'll also have `_projectId` and `_dataset` properties to help you trace it.
571
+ */
572
+ sourceDocument: ContentSourceMapDocuments[number]
573
+ /**
574
+ * If you don't colocate your Studio Schemas with your GROQ queries it might be hard to make sense of `sourcePath`,
575
+ * as it operates on the original shape of a document.
576
+ * In that case `resultPath` can be used, as it mirrors the path to the value in the result.
577
+ * For example in a query like this:
578
+ * `*[_type == "author"][0]{"slug": slug.current}`
579
+ * The `resultPath` for `result.slug` would be `['slug']`, while `sourcePath` will be `['slug', 'current']`.
580
+ */
581
+ resultPath: ContentSourceMapParsedPath
582
+ /**
583
+ * You can also use your own string validation logic to determine if it's safe.
584
+ */
585
+ value: string
586
+ /**
587
+ * If you want to keep the default filtering behavior, but only override it for a specific path, you can use `filterDefault` to do that.
588
+ * For example, here all "icon" documents in a Page Builder skips encoding:
589
+ * ```ts
590
+ {
591
+ filter: (props) => {
592
+ switch (props.sourceDocument._type) {
593
+ case 'icon':
594
+ return false
595
+ default:
596
+ return props.filterDefault(props)
597
+ }
598
+ }
599
+ }
600
+ * ```
601
+ */
602
+ filterDefault: FilterDefault
603
+ }) => boolean
604
+
605
+ /** @public */
606
+ export declare interface FilteredResponseQueryOptions extends ResponseQueryOptions {
525
607
  filterResponse?: true
526
608
  }
527
609
 
@@ -546,6 +628,16 @@ export declare type HttpRequest = {
546
628
  /** @public */
547
629
  export declare type HttpRequestEvent<T = unknown> = ResponseEvent<T> | ProgressEvent_2
548
630
 
631
+ declare const httpRequestSymbol: unique symbol
632
+
633
+ declare const httpRequestSymbol_2: unique symbol
634
+
635
+ declare const httpRequestSymbol_3: unique symbol
636
+
637
+ declare const httpRequestSymbol_4: unique symbol
638
+
639
+ declare const httpRequestSymbol_5: unique symbol
640
+
549
641
  /** @public */
550
642
  export declare type IdentifiedSanityDocumentStub<
551
643
  T extends Record<string, Any> = Record<string, Any>,
@@ -573,8 +665,16 @@ export declare interface InitializedClientConfig extends ClientConfig {
573
665
  * @deprecated Internal, don't use
574
666
  */
575
667
  cdnUrl: string
668
+ /**
669
+ * The fully initialized stega config, can be used to check if stega is enabled
670
+ */
671
+ stega: InitializedStegaConfig
576
672
  }
577
673
 
674
+ /** @public */
675
+ export declare type InitializedStegaConfig = Omit<StegaConfig, StegaConfigRequiredKeys> &
676
+ Required<Pick<StegaConfig, StegaConfigRequiredKeys>>
677
+
578
678
  /** @internal */
579
679
  export declare type InsertPatch =
580
680
  | {
@@ -685,6 +785,13 @@ export declare interface ListenOptions {
685
785
  tag?: string
686
786
  }
687
787
 
788
+ /** @public */
789
+ export declare type Logger =
790
+ | typeof console
791
+ | Partial<
792
+ Pick<typeof console, 'debug' | 'error' | 'groupCollapsed' | 'groupEnd' | 'log' | 'table'>
793
+ >
794
+
688
795
  /** @internal */
689
796
  export declare interface MultipleMutationResult {
690
797
  transactionId: string
@@ -843,7 +950,8 @@ export declare type MutationSelection =
843
950
 
844
951
  /** @internal */
845
952
  export declare class ObservableAssetsClient {
846
- #private
953
+ private [clientSymbol]
954
+ private [httpRequestSymbol]
847
955
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
848
956
  /**
849
957
  * Uploads a file asset to the configured dataset
@@ -897,7 +1005,8 @@ export declare class ObservableAssetsClient {
897
1005
 
898
1006
  /** @internal */
899
1007
  export declare class ObservableDatasetsClient {
900
- #private
1008
+ private [clientSymbol_2]
1009
+ private [httpRequestSymbol_2]
901
1010
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
902
1011
  /**
903
1012
  * Create a new dataset with the given name
@@ -939,7 +1048,7 @@ export declare class ObservableDatasetsClient {
939
1048
 
940
1049
  /** @public */
941
1050
  export declare class ObservablePatch extends BasePatch {
942
- #private
1051
+ private [clientSymbol_5]?
943
1052
  constructor(
944
1053
  selection: PatchSelection,
945
1054
  operations?: PatchOperations,
@@ -992,7 +1101,8 @@ export declare type ObservablePatchBuilder = (patch: ObservablePatch) => Observa
992
1101
 
993
1102
  /** @internal */
994
1103
  export declare class ObservableProjectsClient {
995
- #private
1104
+ private [clientSymbol_3]
1105
+ private [httpRequestSymbol_3]
996
1106
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
997
1107
  /**
998
1108
  * Fetch a list of projects the authenticated user has access to.
@@ -1012,11 +1122,15 @@ export declare class ObservableProjectsClient {
1012
1122
 
1013
1123
  /** @public */
1014
1124
  export declare class ObservableSanityClient {
1015
- #private
1016
1125
  assets: ObservableAssetsClient
1017
1126
  datasets: ObservableDatasetsClient
1018
1127
  projects: ObservableProjectsClient
1019
1128
  users: ObservableUsersClient
1129
+ /**
1130
+ * Private properties
1131
+ */
1132
+ private [clientConfigSymbol]
1133
+ private [httpRequestSymbol_5]
1020
1134
  /**
1021
1135
  * Instance properties
1022
1136
  */
@@ -1045,38 +1159,49 @@ export declare class ObservableSanityClient {
1045
1159
  *
1046
1160
  * @param query - GROQ-query to perform
1047
1161
  */
1048
- fetch<R = Any>(query: string): Observable<R>
1049
- /**
1050
- * Perform a GROQ-query against the configured dataset.
1051
- *
1052
- * @param query - GROQ-query to perform
1053
- * @param params - Query parameters
1054
- */
1055
- fetch<R = Any, Q = QueryParams>(query: string, params: Q): Observable<R>
1162
+ fetch<R = Any, Q extends never | undefined | Record<string, never> = never>(
1163
+ query: string,
1164
+ ): Observable<R>
1056
1165
  /**
1057
1166
  * Perform a GROQ-query against the configured dataset.
1058
1167
  *
1059
1168
  * @param query - GROQ-query to perform
1060
- * @param params - Query parameters
1061
- * @param options - Request options
1169
+ * @param params - Optional query parameters
1170
+ * @param options - Optional request options
1062
1171
  */
1063
- fetch<R = Any, Q = QueryParams>(
1172
+ fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(
1064
1173
  query: string,
1065
- params: Q | undefined,
1066
- options: FilteredResponseQueryOptions,
1174
+ params: QueryParamsParameter<Q>,
1175
+ options?: FilteredResponseQueryOptions,
1067
1176
  ): Observable<R>
1068
1177
  /**
1069
1178
  * Perform a GROQ-query against the configured dataset.
1070
1179
  *
1071
1180
  * @param query - GROQ-query to perform
1072
- * @param params - Query parameters
1181
+ * @param params - Optional query parameters
1073
1182
  * @param options - Request options
1074
1183
  */
1075
- fetch<R = Any, Q = QueryParams>(
1184
+ fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(
1076
1185
  query: string,
1077
- params: Q | undefined,
1186
+ params: QueryParamsParameter<Q>,
1078
1187
  options: UnfilteredResponseQueryOptions,
1079
1188
  ): Observable<RawQueryResponse<R>>
1189
+ /**
1190
+ * You're passing in query parameters to a GROQ query that looks like query options.
1191
+ * This is likely a mistake, you can either:
1192
+ * a) replace the second argument with an empty object, and move the options to the third argument
1193
+ * ```diff
1194
+ * -client.fetch(query, {cache: 'no-store'})
1195
+ * +client.fetch(query, {}, {cache: 'no-store'})
1196
+ * ```
1197
+ * b) add a generic type parameter that allows the query parameters to be passed in to silence the error
1198
+ * @deprecated not actually deprecated, marking it as deprecated makes this error easier to spot
1199
+ */
1200
+ fetch<R = Any>(
1201
+ query: string,
1202
+ params: QueryParamsLikelyByMistake & QueryParams,
1203
+ options?: QueryOptions,
1204
+ ): unknown
1080
1205
  /**
1081
1206
  * Fetch a single document with the given ID.
1082
1207
  *
@@ -1484,7 +1609,7 @@ export declare class ObservableSanityClient {
1484
1609
 
1485
1610
  /** @public */
1486
1611
  export declare class ObservableTransaction extends BaseTransaction {
1487
- #private
1612
+ private [clientSymbol_6]?
1488
1613
  constructor(operations?: Mutation[], client?: ObservableSanityClient, transactionId?: string)
1489
1614
  /**
1490
1615
  * Clones the transaction
@@ -1543,7 +1668,8 @@ export declare class ObservableTransaction extends BaseTransaction {
1543
1668
 
1544
1669
  /** @public */
1545
1670
  export declare class ObservableUsersClient {
1546
- #private
1671
+ private [clientSymbol_4]
1672
+ private [httpRequestSymbol_4]
1547
1673
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
1548
1674
  /**
1549
1675
  * Fetch a user by user ID
@@ -1557,7 +1683,7 @@ export declare class ObservableUsersClient {
1557
1683
 
1558
1684
  /** @public */
1559
1685
  export declare class Patch extends BasePatch {
1560
- #private
1686
+ private [clientSymbol_5]?
1561
1687
  constructor(selection: PatchSelection, operations?: PatchOperations, client?: SanityClient)
1562
1688
  /**
1563
1689
  * Clones the patch
@@ -1645,7 +1771,8 @@ export {ProgressEvent_2 as ProgressEvent}
1645
1771
 
1646
1772
  /** @internal */
1647
1773
  export declare class ProjectsClient {
1648
- #private
1774
+ private [clientSymbol_3]
1775
+ private [httpRequestSymbol_3]
1649
1776
  constructor(client: SanityClient, httpRequest: HttpRequest)
1650
1777
  /**
1651
1778
  * Fetch a list of projects the authenticated user has access to.
@@ -1663,11 +1790,86 @@ export declare class ProjectsClient {
1663
1790
  getById(projectId: string): Promise<SanityProject>
1664
1791
  }
1665
1792
 
1793
+ /** @public */
1794
+ export declare type QueryOptions = FilteredResponseQueryOptions | UnfilteredResponseQueryOptions
1795
+
1666
1796
  /** @public */
1667
1797
  export declare type QueryParams = {
1668
1798
  [key: string]: Any
1669
1799
  }
1670
1800
 
1801
+ /**
1802
+ * It's easy to accidentally set query options such as `filterResponse`, `cache` and `next` as the second parameter in `client.fetch`,
1803
+ * as that is a wide type used to set GROQ query paramaters and it accepts anything that can serialize to JSON.
1804
+ * This type is used to prevent that, and will cause a type error if you try to pass a query option as the second parameter.
1805
+ * If this type is `never`, it means `_QueryParamsLikelyByMistake` is missing keys from `QueryOptions`.
1806
+ * @internal
1807
+ */
1808
+ export declare type QueryParamsLikelyByMistake =
1809
+ Required<_QueryParamsLikelyByMistake> extends Record<keyof QueryOptions, Any>
1810
+ ? _QueryParamsLikelyByMistake
1811
+ : never
1812
+
1813
+ /**
1814
+ * Verify this type has all the same keys as QueryOptions before exporting
1815
+ * @internal
1816
+ */
1817
+ export declare type _QueryParamsLikelyByMistake = {
1818
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1819
+ body?: Any
1820
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1821
+ cache?: Any
1822
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1823
+ filterResponse?: Any
1824
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1825
+ headers?: Any
1826
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1827
+ method?: Any
1828
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1829
+ next?: Any
1830
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1831
+ perspective?: Any
1832
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1833
+ query?: Any
1834
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1835
+ resultSourceMap?: Any
1836
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1837
+ signal?: Any
1838
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1839
+ stega?: Any
1840
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1841
+ tag?: Any
1842
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1843
+ timeout?: Any
1844
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1845
+ token?: Any
1846
+ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
1847
+ useCdn?: Any
1848
+ }
1849
+
1850
+ /**
1851
+ * Transform a QueryParams generic type to a valid parameter type for `client.fetch
1852
+ * @public
1853
+ */
1854
+ export declare type QueryParamsParameter<QueryParamsParameterType> =
1855
+ QueryParamsParameterType extends QueryParams
1856
+ ? QueryParamsParameterType
1857
+ : QueryParamsParameterType extends Record<string, never>
1858
+ ? Record<string, never>
1859
+ : QueryParamsParameterType extends undefined
1860
+ ? undefined | Record<string, never>
1861
+ : never
1862
+
1863
+ /**
1864
+ * It's easy to accidentally set query options such as `filterResponse`, `cache` and `next` as the second parameter in `client.fetch`,
1865
+ * as that is a wide type used to set GROQ query paramaters and it accepts anything that can serialize to JSON.
1866
+ * This type is used to prevent that, and will cause a type error if you try to pass a query option as the second parameter.
1867
+ * @internal
1868
+ */
1869
+ export declare type QueryParamsWithoutQueryOptions = {
1870
+ [K in keyof _QueryParamsLikelyByMistake]: never
1871
+ } & QueryParams
1872
+
1671
1873
  /** @public */
1672
1874
  export declare interface RawQueryResponse<R> {
1673
1875
  query: string
@@ -1742,6 +1944,11 @@ export declare interface RequestOptions {
1742
1944
  signal?: AbortSignal
1743
1945
  }
1744
1946
 
1947
+ /** @alpha */
1948
+ export declare type ResolveStudioUrl = (
1949
+ sourceDocument: ContentSourceMapDocuments[number],
1950
+ ) => StudioUrl
1951
+
1745
1952
  /** @public */
1746
1953
  export declare interface ResponseEvent<T = unknown> {
1747
1954
  type: 'response'
@@ -1754,12 +1961,13 @@ export declare interface ResponseEvent<T = unknown> {
1754
1961
  }
1755
1962
 
1756
1963
  /** @public */
1757
- export declare interface ResponseQueryOptions<T = 'next'> extends RequestOptions {
1964
+ export declare interface ResponseQueryOptions extends RequestOptions {
1758
1965
  perspective?: ClientPerspective
1759
1966
  resultSourceMap?: boolean | 'withKeyArraySelector'
1760
- cache?: RequestInit['cache']
1761
- next?: T extends keyof RequestInit ? RequestInit[T] : never
1762
1967
  useCdn?: boolean
1968
+ stega?: boolean | StegaConfig
1969
+ cache?: 'next' extends keyof RequestInit ? RequestInit['cache'] : never
1970
+ next?: ('next' extends keyof RequestInit ? RequestInit : never)['next']
1763
1971
  }
1764
1972
 
1765
1973
  /** @internal */
@@ -1777,7 +1985,6 @@ export declare interface SanityAssetDocument extends SanityDocument {
1777
1985
 
1778
1986
  /** @public */
1779
1987
  export declare class SanityClient {
1780
- #private
1781
1988
  assets: AssetsClient
1782
1989
  datasets: DatasetsClient
1783
1990
  projects: ProjectsClient
@@ -1786,6 +1993,11 @@ export declare class SanityClient {
1786
1993
  * Observable version of the Sanity client, with the same configuration as the promise-based one
1787
1994
  */
1788
1995
  observable: ObservableSanityClient
1996
+ /**
1997
+ * Private properties
1998
+ */
1999
+ private [clientConfigSymbol]
2000
+ private [httpRequestSymbol_5]
1789
2001
  /**
1790
2002
  * Instance properties
1791
2003
  */
@@ -1814,25 +2026,20 @@ export declare class SanityClient {
1814
2026
  *
1815
2027
  * @param query - GROQ-query to perform
1816
2028
  */
1817
- fetch<R = Any>(query: string): Promise<R>
1818
- /**
1819
- * Perform a GROQ-query against the configured dataset.
1820
- *
1821
- * @param query - GROQ-query to perform
1822
- * @param params - Optional query parameters
1823
- */
1824
- fetch<R = Any, Q = QueryParams>(query: string, params: Q): Promise<R>
2029
+ fetch<R = Any, Q extends never | undefined | Record<string, never> = never>(
2030
+ query: string,
2031
+ ): Promise<R>
1825
2032
  /**
1826
2033
  * Perform a GROQ-query against the configured dataset.
1827
2034
  *
1828
2035
  * @param query - GROQ-query to perform
1829
2036
  * @param params - Optional query parameters
1830
- * @param options - Request options
2037
+ * @param options - Optional request options
1831
2038
  */
1832
- fetch<R = Any, Q = QueryParams>(
2039
+ fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(
1833
2040
  query: string,
1834
- params: Q | undefined,
1835
- options: FilteredResponseQueryOptions,
2041
+ params: QueryParamsParameter<Q>,
2042
+ options?: FilteredResponseQueryOptions,
1836
2043
  ): Promise<R>
1837
2044
  /**
1838
2045
  * Perform a GROQ-query against the configured dataset.
@@ -1841,11 +2048,27 @@ export declare class SanityClient {
1841
2048
  * @param params - Optional query parameters
1842
2049
  * @param options - Request options
1843
2050
  */
1844
- fetch<R = Any, Q = QueryParams>(
2051
+ fetch<R = Any, Q = QueryParamsWithoutQueryOptions>(
1845
2052
  query: string,
1846
- params: Q | undefined,
2053
+ params: QueryParamsParameter<Q>,
1847
2054
  options: UnfilteredResponseQueryOptions,
1848
2055
  ): Promise<RawQueryResponse<R>>
2056
+ /**
2057
+ * You're passing in query parameters to a GROQ query that looks like query options.
2058
+ * This is likely a mistake, you can either:
2059
+ * a) replace the second argument with an empty object, and move the options to the third argument
2060
+ * ```diff
2061
+ * -client.fetch(query, {cache: 'no-store'})
2062
+ * +client.fetch(query, {}, {cache: 'no-store'})
2063
+ * ```
2064
+ * b) add a generic type parameter that allows the query parameters to be passed in to silence the error
2065
+ * @deprecated not actually deprecated, marking it as deprecated makes this error easier to spot
2066
+ */
2067
+ fetch<R = Any>(
2068
+ query: string,
2069
+ params: QueryParamsLikelyByMistake & QueryParams,
2070
+ options?: QueryOptions,
2071
+ ): unknown
1849
2072
  /**
1850
2073
  * Fetch a single document with the given ID.
1851
2074
  *
@@ -2394,9 +2617,55 @@ export declare interface SingleMutationResult {
2394
2617
  }[]
2395
2618
  }
2396
2619
 
2620
+ /** @public */
2621
+ export declare interface StegaConfig {
2622
+ /**
2623
+ * Enable or disable stega encoded strings in query results
2624
+ * ```ts
2625
+ {
2626
+ enabled: process.env.VERCEL_ENV !== 'production'
2627
+ }
2628
+ * ```
2629
+ * @defaultValue `false`
2630
+ */
2631
+ enabled?: boolean
2632
+ /**
2633
+ * Where the Studio is hosted.
2634
+ * If it's embedded in the app, use the base path for example `/studio`.
2635
+ * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.
2636
+ *
2637
+ */
2638
+ studioUrl?: StudioUrl | ResolveStudioUrl
2639
+ filter?: FilterDefault
2640
+ /**
2641
+ * Specify a `console.log` compatible logger to see debug logs, which keys are encoded and which are not.
2642
+ */
2643
+ logger?: Logger
2644
+ }
2645
+
2646
+ /** @public */
2647
+ export declare type StegaConfigRequiredKeys = Extract<keyof StegaConfig, 'enabled'>
2648
+
2649
+ /** @alpha */
2650
+ export declare type StudioBaseRoute = {
2651
+ baseUrl: StudioBaseUrl
2652
+ workspace?: string
2653
+ tool?: string
2654
+ }
2655
+
2656
+ /** @alpha */
2657
+ export declare type StudioBaseUrl =
2658
+ | `/${string}`
2659
+ | `${string}.sanity.studio`
2660
+ | `https://${string}`
2661
+ | string
2662
+
2663
+ /** @alpha */
2664
+ export declare type StudioUrl = StudioBaseUrl | StudioBaseRoute
2665
+
2397
2666
  /** @public */
2398
2667
  export declare class Transaction extends BaseTransaction {
2399
- #private
2668
+ private [clientSymbol_6]?
2400
2669
  constructor(operations?: Mutation[], client?: SanityClient, transactionId?: string)
2401
2670
  /**
2402
2671
  * Clones the transaction
@@ -2485,7 +2754,7 @@ export declare type TransactionMutationOptions =
2485
2754
  | TransactionAllDocumentIdsMutationOptions
2486
2755
 
2487
2756
  /** @public */
2488
- export declare type UnfilteredResponseQueryOptions = ResponseQueryOptions & {
2757
+ export declare interface UnfilteredResponseQueryOptions extends ResponseQueryOptions {
2489
2758
  filterResponse: false
2490
2759
  }
2491
2760
 
@@ -2559,7 +2828,8 @@ export declare interface UploadClientConfig {
2559
2828
 
2560
2829
  /** @public */
2561
2830
  export declare class UsersClient {
2562
- #private
2831
+ private [clientSymbol_4]
2832
+ private [httpRequestSymbol_4]
2563
2833
  constructor(client: SanityClient, httpRequest: HttpRequest)
2564
2834
  /**
2565
2835
  * Fetch a user by user ID
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-u_fUUnxa.js';
2
- export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-u_fUUnxa.js';
1
+ import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-hZIb_1T_.js';
2
+ export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-hZIb_1T_.js';
3
3
  export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
4
4
 
5
5
  function defineDeprecatedCreateClient(createClient) {