@sanity/client 6.24.2 → 6.24.3

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/csm.d.cts CHANGED
@@ -1,21 +1,8 @@
1
- import {Any} from '@sanity/client'
2
- import {ClientPerspective} from '@sanity/client'
3
- import {ContentSourceMap} from '@sanity/client'
4
- import {ContentSourceMapDocument} from '@sanity/client'
5
- import {ContentSourceMapDocumentBase} from '@sanity/client'
6
- import {ContentSourceMapDocuments} from '@sanity/client'
7
- import {ContentSourceMapDocumentValueSource} from '@sanity/client'
8
- import {ContentSourceMapLiteralSource} from '@sanity/client'
9
- import {ContentSourceMapMapping} from '@sanity/client'
10
- import {ContentSourceMapMappings} from '@sanity/client'
11
- import {ContentSourceMapPaths} from '@sanity/client'
12
- import {ContentSourceMapRemoteDocument} from '@sanity/client'
13
- import {ContentSourceMapSource} from '@sanity/client'
14
- import {ContentSourceMapUnknownSource} from '@sanity/client'
15
- import {ContentSourceMapValueMapping} from '@sanity/client'
16
- import {SanityDocument} from '@sanity/client'
17
-
18
- export {Any}
1
+ /**
2
+ * Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
3
+ * @internal
4
+ */
5
+ export declare type Any = any
19
6
 
20
7
  /**
21
8
  * Optimistically applies source documents to a result, using the content source map to trace fields.
@@ -45,23 +32,62 @@ export declare type ApplySourceDocumentsUpdateFunction = <T = unknown>(
45
32
  },
46
33
  ) => T
47
34
 
48
- export {ClientPerspective}
49
-
50
- export {ContentSourceMap}
35
+ /** @public */
36
+ export declare type ClientPerspective =
37
+ | 'previewDrafts'
38
+ | 'published'
39
+ | 'drafts'
40
+ | 'raw'
41
+ | ('published' | 'drafts' | ReleaseId)[]
42
+
43
+ /** @public */
44
+ export declare interface ContentSourceMap {
45
+ mappings: ContentSourceMapMappings
46
+ documents: ContentSourceMapDocuments
47
+ paths: ContentSourceMapPaths
48
+ }
51
49
 
52
- export {ContentSourceMapDocument}
50
+ /** @public */
51
+ export declare interface ContentSourceMapDocument extends ContentSourceMapDocumentBase {
52
+ _projectId?: undefined
53
+ _dataset?: undefined
54
+ }
53
55
 
54
- export {ContentSourceMapDocumentBase}
56
+ /** @public */
57
+ export declare interface ContentSourceMapDocumentBase {
58
+ _id: string
59
+ _type: string
60
+ }
55
61
 
56
- export {ContentSourceMapDocuments}
62
+ /** @public */
63
+ export declare type ContentSourceMapDocuments = (
64
+ | ContentSourceMapDocument
65
+ | ContentSourceMapRemoteDocument
66
+ )[]
57
67
 
58
- export {ContentSourceMapDocumentValueSource}
68
+ /**
69
+ * DocumentValueSource is a path to a value within a document
70
+ * @public
71
+ */
72
+ export declare interface ContentSourceMapDocumentValueSource {
73
+ type: 'documentValue'
74
+ document: number
75
+ path: number
76
+ }
59
77
 
60
- export {ContentSourceMapLiteralSource}
78
+ /**
79
+ * When a value is not from a source, its a literal
80
+ * @public
81
+ */
82
+ export declare interface ContentSourceMapLiteralSource {
83
+ type: 'literal'
84
+ }
61
85
 
62
- export {ContentSourceMapMapping}
86
+ /** @public */
87
+ export declare type ContentSourceMapMapping = ContentSourceMapValueMapping
63
88
 
64
- export {ContentSourceMapMappings}
89
+ /** @public */
90
+ export declare type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
65
91
 
66
92
  /** @alpha */
67
93
  export declare type ContentSourceMapParsedPath = (
@@ -82,15 +108,38 @@ export declare type ContentSourceMapParsedPathKeyedSegment = {
82
108
  */
83
109
  export declare type ContentSourceMapParsedPathSegment = ContentSourceMapParsedPath[number]
84
110
 
85
- export {ContentSourceMapPaths}
111
+ /** @public */
112
+ export declare type ContentSourceMapPaths = string[]
86
113
 
87
- export {ContentSourceMapRemoteDocument}
114
+ /** @public */
115
+ export declare interface ContentSourceMapRemoteDocument extends ContentSourceMapDocumentBase {
116
+ _projectId: string
117
+ _dataset: string
118
+ }
88
119
 
89
- export {ContentSourceMapSource}
120
+ /** @public */
121
+ export declare type ContentSourceMapSource =
122
+ | ContentSourceMapDocumentValueSource
123
+ | ContentSourceMapLiteralSource
124
+ | ContentSourceMapUnknownSource
90
125
 
91
- export {ContentSourceMapUnknownSource}
126
+ /**
127
+ * When a field source is unknown
128
+ * @public
129
+ */
130
+ export declare interface ContentSourceMapUnknownSource {
131
+ type: 'unknown'
132
+ }
92
133
 
93
- export {ContentSourceMapValueMapping}
134
+ /**
135
+ * ValueMapping is a mapping when for value that is from a single source value
136
+ * It may refer to a field within a document or a literal value
137
+ * @public
138
+ */
139
+ export declare interface ContentSourceMapValueMapping {
140
+ type: 'value'
141
+ source: ContentSourceMapSource
142
+ }
94
143
 
95
144
  /** @internal */
96
145
  export declare function createEditUrl(
@@ -169,6 +218,9 @@ export declare type PathSegment = string | number | KeyedSegment | IndexTuple
169
218
  /** @internal */
170
219
  declare const reKeySegment: RegExp
171
220
 
221
+ /** @public */
222
+ declare type ReleaseId = `r${string}`
223
+
172
224
  /**
173
225
  * @internal
174
226
  */
@@ -219,7 +271,20 @@ export declare type ResolveStudioUrl = (
219
271
  sourceDocument: ContentSourceMapDocuments[number],
220
272
  ) => StudioUrl
221
273
 
222
- export {SanityDocument}
274
+ /** @internal */
275
+ export declare type SanityDocument<T extends Record<string, Any> = Record<string, Any>> = {
276
+ [P in keyof T]: T[P]
277
+ } & {
278
+ _id: string
279
+ _rev: string
280
+ _type: string
281
+ _createdAt: string
282
+ _updatedAt: string
283
+ /**
284
+ * Present when `perspective` is set to `previewDrafts`
285
+ */
286
+ _originalId?: string
287
+ }
223
288
 
224
289
  /** @alpha */
225
290
  export declare type StudioBaseRoute = {
package/dist/csm.d.ts CHANGED
@@ -1,21 +1,8 @@
1
- import {Any} from '@sanity/client'
2
- import {ClientPerspective} from '@sanity/client'
3
- import {ContentSourceMap} from '@sanity/client'
4
- import {ContentSourceMapDocument} from '@sanity/client'
5
- import {ContentSourceMapDocumentBase} from '@sanity/client'
6
- import {ContentSourceMapDocuments} from '@sanity/client'
7
- import {ContentSourceMapDocumentValueSource} from '@sanity/client'
8
- import {ContentSourceMapLiteralSource} from '@sanity/client'
9
- import {ContentSourceMapMapping} from '@sanity/client'
10
- import {ContentSourceMapMappings} from '@sanity/client'
11
- import {ContentSourceMapPaths} from '@sanity/client'
12
- import {ContentSourceMapRemoteDocument} from '@sanity/client'
13
- import {ContentSourceMapSource} from '@sanity/client'
14
- import {ContentSourceMapUnknownSource} from '@sanity/client'
15
- import {ContentSourceMapValueMapping} from '@sanity/client'
16
- import {SanityDocument} from '@sanity/client'
17
-
18
- export {Any}
1
+ /**
2
+ * Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
3
+ * @internal
4
+ */
5
+ export declare type Any = any
19
6
 
20
7
  /**
21
8
  * Optimistically applies source documents to a result, using the content source map to trace fields.
@@ -45,23 +32,62 @@ export declare type ApplySourceDocumentsUpdateFunction = <T = unknown>(
45
32
  },
46
33
  ) => T
47
34
 
48
- export {ClientPerspective}
49
-
50
- export {ContentSourceMap}
35
+ /** @public */
36
+ export declare type ClientPerspective =
37
+ | 'previewDrafts'
38
+ | 'published'
39
+ | 'drafts'
40
+ | 'raw'
41
+ | ('published' | 'drafts' | ReleaseId)[]
42
+
43
+ /** @public */
44
+ export declare interface ContentSourceMap {
45
+ mappings: ContentSourceMapMappings
46
+ documents: ContentSourceMapDocuments
47
+ paths: ContentSourceMapPaths
48
+ }
51
49
 
52
- export {ContentSourceMapDocument}
50
+ /** @public */
51
+ export declare interface ContentSourceMapDocument extends ContentSourceMapDocumentBase {
52
+ _projectId?: undefined
53
+ _dataset?: undefined
54
+ }
53
55
 
54
- export {ContentSourceMapDocumentBase}
56
+ /** @public */
57
+ export declare interface ContentSourceMapDocumentBase {
58
+ _id: string
59
+ _type: string
60
+ }
55
61
 
56
- export {ContentSourceMapDocuments}
62
+ /** @public */
63
+ export declare type ContentSourceMapDocuments = (
64
+ | ContentSourceMapDocument
65
+ | ContentSourceMapRemoteDocument
66
+ )[]
57
67
 
58
- export {ContentSourceMapDocumentValueSource}
68
+ /**
69
+ * DocumentValueSource is a path to a value within a document
70
+ * @public
71
+ */
72
+ export declare interface ContentSourceMapDocumentValueSource {
73
+ type: 'documentValue'
74
+ document: number
75
+ path: number
76
+ }
59
77
 
60
- export {ContentSourceMapLiteralSource}
78
+ /**
79
+ * When a value is not from a source, its a literal
80
+ * @public
81
+ */
82
+ export declare interface ContentSourceMapLiteralSource {
83
+ type: 'literal'
84
+ }
61
85
 
62
- export {ContentSourceMapMapping}
86
+ /** @public */
87
+ export declare type ContentSourceMapMapping = ContentSourceMapValueMapping
63
88
 
64
- export {ContentSourceMapMappings}
89
+ /** @public */
90
+ export declare type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
65
91
 
66
92
  /** @alpha */
67
93
  export declare type ContentSourceMapParsedPath = (
@@ -82,15 +108,38 @@ export declare type ContentSourceMapParsedPathKeyedSegment = {
82
108
  */
83
109
  export declare type ContentSourceMapParsedPathSegment = ContentSourceMapParsedPath[number]
84
110
 
85
- export {ContentSourceMapPaths}
111
+ /** @public */
112
+ export declare type ContentSourceMapPaths = string[]
86
113
 
87
- export {ContentSourceMapRemoteDocument}
114
+ /** @public */
115
+ export declare interface ContentSourceMapRemoteDocument extends ContentSourceMapDocumentBase {
116
+ _projectId: string
117
+ _dataset: string
118
+ }
88
119
 
89
- export {ContentSourceMapSource}
120
+ /** @public */
121
+ export declare type ContentSourceMapSource =
122
+ | ContentSourceMapDocumentValueSource
123
+ | ContentSourceMapLiteralSource
124
+ | ContentSourceMapUnknownSource
90
125
 
91
- export {ContentSourceMapUnknownSource}
126
+ /**
127
+ * When a field source is unknown
128
+ * @public
129
+ */
130
+ export declare interface ContentSourceMapUnknownSource {
131
+ type: 'unknown'
132
+ }
92
133
 
93
- export {ContentSourceMapValueMapping}
134
+ /**
135
+ * ValueMapping is a mapping when for value that is from a single source value
136
+ * It may refer to a field within a document or a literal value
137
+ * @public
138
+ */
139
+ export declare interface ContentSourceMapValueMapping {
140
+ type: 'value'
141
+ source: ContentSourceMapSource
142
+ }
94
143
 
95
144
  /** @internal */
96
145
  export declare function createEditUrl(
@@ -169,6 +218,9 @@ export declare type PathSegment = string | number | KeyedSegment | IndexTuple
169
218
  /** @internal */
170
219
  declare const reKeySegment: RegExp
171
220
 
221
+ /** @public */
222
+ declare type ReleaseId = `r${string}`
223
+
172
224
  /**
173
225
  * @internal
174
226
  */
@@ -219,7 +271,20 @@ export declare type ResolveStudioUrl = (
219
271
  sourceDocument: ContentSourceMapDocuments[number],
220
272
  ) => StudioUrl
221
273
 
222
- export {SanityDocument}
274
+ /** @internal */
275
+ export declare type SanityDocument<T extends Record<string, Any> = Record<string, Any>> = {
276
+ [P in keyof T]: T[P]
277
+ } & {
278
+ _id: string
279
+ _rev: string
280
+ _type: string
281
+ _createdAt: string
282
+ _updatedAt: string
283
+ /**
284
+ * Present when `perspective` is set to `previewDrafts`
285
+ */
286
+ _originalId?: string
287
+ }
223
288
 
224
289
  /** @alpha */
225
290
  export declare type StudioBaseRoute = {
@@ -826,7 +826,7 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
826
826
  this: SanityClient | ObservableSanityClient,
827
827
  query: string,
828
828
  params?: ListenParams,
829
- ): Observable<MutationEvent_2<R>>
829
+ ): Observable<MutationEvent<R>>
830
830
 
831
831
  /**
832
832
  * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
@@ -845,7 +845,7 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
845
845
 
846
846
  /** @public */
847
847
  export declare type ListenEvent<R extends Record<string, Any>> =
848
- | MutationEvent_2<R>
848
+ | MutationEvent<R>
849
849
  | ChannelErrorEvent
850
850
  | DisconnectEvent
851
851
  | ReconnectEvent
@@ -1031,7 +1031,7 @@ export declare interface MutationErrorItem {
1031
1031
  *
1032
1032
  * @public
1033
1033
  */
1034
- declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>> = {
1034
+ export declare type MutationEvent<R extends Record<string, Any> = Record<string, Any>> = {
1035
1035
  type: 'mutation'
1036
1036
  /**
1037
1037
  * The ID of the document that was affected
@@ -1120,7 +1120,6 @@ declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>
1120
1120
  */
1121
1121
  transactionCurrentEvent: number
1122
1122
  }
1123
- export {MutationEvent_2 as MutationEvent}
1124
1123
 
1125
1124
  /** @internal */
1126
1125
  export declare type MutationOperation = 'create' | 'delete' | 'update' | 'none'
@@ -826,7 +826,7 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
826
826
  this: SanityClient | ObservableSanityClient,
827
827
  query: string,
828
828
  params?: ListenParams,
829
- ): Observable<MutationEvent_2<R>>
829
+ ): Observable<MutationEvent<R>>
830
830
 
831
831
  /**
832
832
  * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
@@ -845,7 +845,7 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
845
845
 
846
846
  /** @public */
847
847
  export declare type ListenEvent<R extends Record<string, Any>> =
848
- | MutationEvent_2<R>
848
+ | MutationEvent<R>
849
849
  | ChannelErrorEvent
850
850
  | DisconnectEvent
851
851
  | ReconnectEvent
@@ -1031,7 +1031,7 @@ export declare interface MutationErrorItem {
1031
1031
  *
1032
1032
  * @public
1033
1033
  */
1034
- declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>> = {
1034
+ export declare type MutationEvent<R extends Record<string, Any> = Record<string, Any>> = {
1035
1035
  type: 'mutation'
1036
1036
  /**
1037
1037
  * The ID of the document that was affected
@@ -1120,7 +1120,6 @@ declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>
1120
1120
  */
1121
1121
  transactionCurrentEvent: number
1122
1122
  }
1123
- export {MutationEvent_2 as MutationEvent}
1124
1123
 
1125
1124
  /** @internal */
1126
1125
  export declare type MutationOperation = 'create' | 'delete' | 'update' | 'none'
package/dist/index.cjs CHANGED
@@ -1582,7 +1582,7 @@ function defineDeprecatedCreateClient(createClient2) {
1582
1582
  return printNoDefaultExport(), createClient2(config);
1583
1583
  };
1584
1584
  }
1585
- var name = "@sanity/client", version = "6.24.2";
1585
+ var name = "@sanity/client", version = "6.24.3";
1586
1586
  const middleware = [
1587
1587
  middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
1588
1588
  middleware$1.headers({ "User-Agent": `${name} ${version}` }),
package/dist/index.d.cts CHANGED
@@ -826,7 +826,7 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
826
826
  this: SanityClient | ObservableSanityClient,
827
827
  query: string,
828
828
  params?: ListenParams,
829
- ): Observable<MutationEvent_2<R>>
829
+ ): Observable<MutationEvent<R>>
830
830
 
831
831
  /**
832
832
  * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
@@ -845,7 +845,7 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
845
845
 
846
846
  /** @public */
847
847
  export declare type ListenEvent<R extends Record<string, Any>> =
848
- | MutationEvent_2<R>
848
+ | MutationEvent<R>
849
849
  | ChannelErrorEvent
850
850
  | DisconnectEvent
851
851
  | ReconnectEvent
@@ -1031,7 +1031,7 @@ export declare interface MutationErrorItem {
1031
1031
  *
1032
1032
  * @public
1033
1033
  */
1034
- declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>> = {
1034
+ export declare type MutationEvent<R extends Record<string, Any> = Record<string, Any>> = {
1035
1035
  type: 'mutation'
1036
1036
  /**
1037
1037
  * The ID of the document that was affected
@@ -1120,7 +1120,6 @@ declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>
1120
1120
  */
1121
1121
  transactionCurrentEvent: number
1122
1122
  }
1123
- export {MutationEvent_2 as MutationEvent}
1124
1123
 
1125
1124
  /** @internal */
1126
1125
  export declare type MutationOperation = 'create' | 'delete' | 'update' | 'none'
package/dist/index.d.ts CHANGED
@@ -826,7 +826,7 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
826
826
  this: SanityClient | ObservableSanityClient,
827
827
  query: string,
828
828
  params?: ListenParams,
829
- ): Observable<MutationEvent_2<R>>
829
+ ): Observable<MutationEvent<R>>
830
830
 
831
831
  /**
832
832
  * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
@@ -845,7 +845,7 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
845
845
 
846
846
  /** @public */
847
847
  export declare type ListenEvent<R extends Record<string, Any>> =
848
- | MutationEvent_2<R>
848
+ | MutationEvent<R>
849
849
  | ChannelErrorEvent
850
850
  | DisconnectEvent
851
851
  | ReconnectEvent
@@ -1031,7 +1031,7 @@ export declare interface MutationErrorItem {
1031
1031
  *
1032
1032
  * @public
1033
1033
  */
1034
- declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>> = {
1034
+ export declare type MutationEvent<R extends Record<string, Any> = Record<string, Any>> = {
1035
1035
  type: 'mutation'
1036
1036
  /**
1037
1037
  * The ID of the document that was affected
@@ -1120,7 +1120,6 @@ declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>
1120
1120
  */
1121
1121
  transactionCurrentEvent: number
1122
1122
  }
1123
- export {MutationEvent_2 as MutationEvent}
1124
1123
 
1125
1124
  /** @internal */
1126
1125
  export declare type MutationOperation = 'create' | 'delete' | 'update' | 'none'
package/dist/index.js CHANGED
@@ -1564,7 +1564,7 @@ function defineDeprecatedCreateClient(createClient2) {
1564
1564
  return printNoDefaultExport(), createClient2(config);
1565
1565
  };
1566
1566
  }
1567
- var name = "@sanity/client", version = "6.24.2";
1567
+ var name = "@sanity/client", version = "6.24.3";
1568
1568
  const middleware = [
1569
1569
  debug({ verbose: !0, namespace: "sanity:client" }),
1570
1570
  headers({ "User-Agent": `${name} ${version}` }),