@sanity/client 7.26.2 → 8.0.0

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 (130) hide show
  1. package/README.md +5 -377
  2. package/dist/browserUpload-CQgx9YYo.js +86 -0
  3. package/dist/browserUpload-CQgx9YYo.js.map +1 -0
  4. package/dist/browserUpload-icWlVP15.js +86 -0
  5. package/dist/browserUpload-icWlVP15.js.map +1 -0
  6. package/dist/config-a8VajuEY.js +126 -0
  7. package/dist/config-a8VajuEY.js.map +1 -0
  8. package/dist/csm.d.ts +122 -335
  9. package/dist/csm.js +79 -91
  10. package/dist/csm.js.map +1 -1
  11. package/dist/dist-C9ExSk2R.js +73 -0
  12. package/dist/dist-C9ExSk2R.js.map +1 -0
  13. package/dist/dist-Z8cIRxoB.js +69 -0
  14. package/dist/dist-Z8cIRxoB.js.map +1 -0
  15. package/dist/index.d.ts +107 -6723
  16. package/dist/index.js +2822 -2847
  17. package/dist/index.js.map +1 -1
  18. package/dist/{index.d.cts → index.node.d.ts} +4291 -5328
  19. package/dist/index.node.js +3131 -0
  20. package/dist/index.node.js.map +1 -0
  21. package/dist/isRecord-Kfmt-nk-.js +7 -0
  22. package/dist/isRecord-Kfmt-nk-.js.map +1 -0
  23. package/dist/media-library.d.ts +9 -100
  24. package/dist/media-library.js +36 -14
  25. package/dist/media-library.js.map +1 -1
  26. package/dist/request-CJxcN16k.js +372 -0
  27. package/dist/request-CJxcN16k.js.map +1 -0
  28. package/dist/request-k7VS_NnC.js +354 -0
  29. package/dist/request-k7VS_NnC.js.map +1 -0
  30. package/dist/resolveEditInfo-sq7yF78q.js +325 -0
  31. package/dist/resolveEditInfo-sq7yF78q.js.map +1 -0
  32. package/dist/rolldown-runtime-vyAXikos.js +9 -0
  33. package/dist/stega.d.ts +78 -7137
  34. package/dist/stega.js +27 -20
  35. package/dist/stega.js.map +1 -1
  36. package/dist/stegaClean-C18wLWau.js +21 -0
  37. package/dist/stegaClean-C18wLWau.js.map +1 -0
  38. package/dist/stegaEncodeSourceMap-B2fGArSf.js +163 -0
  39. package/dist/stegaEncodeSourceMap-B2fGArSf.js.map +1 -0
  40. package/dist/stegaEncodeSourceMap-DkoIlutY.js +367 -0
  41. package/dist/stegaEncodeSourceMap-DkoIlutY.js.map +1 -0
  42. package/dist/{index.browser.d.cts → types-CUxZSgB2.d.ts} +3956 -5256
  43. package/dist/types-CfGzbXrl.d.ts +108 -0
  44. package/package.json +64 -141
  45. package/src/SanityClient.ts +82 -117
  46. package/src/agent/actions/AgentActionsClient.ts +12 -12
  47. package/src/agent/actions/commonTypes.ts +2 -1
  48. package/src/agent/actions/generate.ts +26 -6
  49. package/src/agent/actions/patch.ts +27 -7
  50. package/src/agent/actions/prompt.ts +19 -5
  51. package/src/agent/actions/transform.ts +23 -5
  52. package/src/agent/actions/translate.ts +23 -5
  53. package/src/assets/AssetsClient.ts +71 -23
  54. package/src/csm/applySourceDocuments.ts +3 -1
  55. package/src/csm/createEditUrl.ts +1 -1
  56. package/src/csm/draftUtils.ts +0 -1
  57. package/src/csm/index.ts +2 -2
  58. package/src/csm/studioPath.ts +2 -1
  59. package/src/csm/types.ts +8 -2
  60. package/src/data/dataMethods.ts +801 -349
  61. package/src/data/eventsource.ts +13 -10
  62. package/src/data/listen.ts +18 -23
  63. package/src/data/live.ts +44 -27
  64. package/src/data/resolveEventSourceFetch.ts +96 -0
  65. package/src/datasets/DatasetsClient.ts +58 -41
  66. package/src/defineCreateClient.ts +35 -23
  67. package/src/http/browserMiddleware.ts +7 -1
  68. package/src/http/browserUpload.ts +162 -0
  69. package/src/http/errors.ts +60 -6
  70. package/src/http/nodeMiddleware.ts +94 -30
  71. package/src/http/request.ts +310 -87
  72. package/src/http/requestOptions.ts +131 -15
  73. package/src/{index.browser.ts → index.node.ts} +9 -4
  74. package/src/index.ts +4 -3
  75. package/src/mediaLibrary/MediaLibraryVideoClient.ts +26 -11
  76. package/src/projects/ProjectsClient.ts +18 -16
  77. package/src/releases/ReleasesClient.ts +38 -33
  78. package/src/stega/index.ts +1 -2
  79. package/src/stega/stegaEncodeSourceMap.ts +5 -0
  80. package/src/stega/types.ts +2 -2
  81. package/src/types.ts +148 -105
  82. package/src/users/UsersClient.ts +10 -14
  83. package/src/util/shareReplayLatest.ts +1 -1
  84. package/src/warnings.ts +6 -1
  85. package/dist/_chunks-cjs/config.cjs +0 -206
  86. package/dist/_chunks-cjs/config.cjs.map +0 -1
  87. package/dist/_chunks-cjs/isRecord.cjs +0 -6
  88. package/dist/_chunks-cjs/isRecord.cjs.map +0 -1
  89. package/dist/_chunks-cjs/resolveEditInfo.cjs +0 -334
  90. package/dist/_chunks-cjs/resolveEditInfo.cjs.map +0 -1
  91. package/dist/_chunks-cjs/stegaClean.cjs +0 -46
  92. package/dist/_chunks-cjs/stegaClean.cjs.map +0 -1
  93. package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +0 -388
  94. package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +0 -1
  95. package/dist/_chunks-es/config.js +0 -207
  96. package/dist/_chunks-es/config.js.map +0 -1
  97. package/dist/_chunks-es/isRecord.js +0 -7
  98. package/dist/_chunks-es/isRecord.js.map +0 -1
  99. package/dist/_chunks-es/resolveEditInfo.js +0 -335
  100. package/dist/_chunks-es/resolveEditInfo.js.map +0 -1
  101. package/dist/_chunks-es/stegaClean.js +0 -47
  102. package/dist/_chunks-es/stegaClean.js.map +0 -1
  103. package/dist/_chunks-es/stegaEncodeSourceMap.js +0 -389
  104. package/dist/_chunks-es/stegaEncodeSourceMap.js.map +0 -1
  105. package/dist/csm.cjs +0 -99
  106. package/dist/csm.cjs.map +0 -1
  107. package/dist/csm.d.cts +0 -391
  108. package/dist/index.browser.cjs +0 -3106
  109. package/dist/index.browser.cjs.map +0 -1
  110. package/dist/index.browser.d.ts +0 -6802
  111. package/dist/index.browser.js +0 -3082
  112. package/dist/index.browser.js.map +0 -1
  113. package/dist/index.cjs +0 -2946
  114. package/dist/index.cjs.map +0 -1
  115. package/dist/media-library.cjs +0 -20
  116. package/dist/media-library.cjs.map +0 -1
  117. package/dist/media-library.d.cts +0 -117
  118. package/dist/stega.browser.cjs +0 -29
  119. package/dist/stega.browser.cjs.map +0 -1
  120. package/dist/stega.browser.d.cts +0 -7200
  121. package/dist/stega.browser.d.ts +0 -7200
  122. package/dist/stega.browser.js +0 -24
  123. package/dist/stega.browser.js.map +0 -1
  124. package/dist/stega.cjs +0 -29
  125. package/dist/stega.cjs.map +0 -1
  126. package/dist/stega.d.cts +0 -7200
  127. package/src/data/eventsourcePolyfill.ts +0 -7
  128. package/umd/.gitkeep +0 -1
  129. package/umd/sanityClient.js +0 -6543
  130. package/umd/sanityClient.min.js +0 -6
package/dist/csm.d.ts CHANGED
@@ -1,188 +1,128 @@
1
+ import { Any, ClientPerspective, ContentSourceMap, ContentSourceMap as ContentSourceMap$1, ContentSourceMapDocument, ContentSourceMapDocumentBase, ContentSourceMapDocumentValueSource, ContentSourceMapDocuments, ContentSourceMapDocuments as ContentSourceMapDocuments$1, ContentSourceMapLiteralSource, ContentSourceMapMapping, ContentSourceMapMappings, ContentSourceMapPaths, ContentSourceMapRemoteDocument, ContentSourceMapSource, ContentSourceMapUnknownSource, ContentSourceMapValueMapping, SanityDocument, SanityDocument as SanityDocument$1 } from "@sanity/client";
2
+ declare namespace studioPath_d_exports {
3
+ export { IndexTuple, KeyedSegment, Path, PathSegment, fromString, get, isIndexSegment, isIndexTuple, isKeySegment, reKeySegment, toString };
4
+ }
5
+ /** @alpha */
6
+ type KeyedSegment = {
7
+ _key: string;
8
+ };
9
+ /** @alpha */
10
+ type IndexTuple = [number | '', number | ''];
11
+ /** @alpha */
12
+ type PathSegment = string | number | KeyedSegment | IndexTuple;
13
+ /** @alpha */
14
+ type Path = PathSegment[];
15
+ /** @internal */
16
+ declare const reKeySegment: RegExp;
17
+ /** @internal */
18
+ declare function isIndexSegment(segment: PathSegment): segment is number;
19
+ /** @internal */
20
+ declare function isKeySegment(segment: PathSegment): segment is KeyedSegment;
21
+ /** @internal */
22
+ declare function isIndexTuple(segment: PathSegment): segment is IndexTuple;
23
+ /** @internal */
24
+ declare function get<Result = unknown, Fallback = unknown>(obj: unknown, path: Path | string, defaultVal?: Fallback): Result | typeof defaultVal;
25
+ /** @alpha */
26
+ declare function toString(path: Path): string;
27
+ /** @alpha */
28
+ declare function fromString(path: string): Path;
1
29
  /**
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
6
-
7
- /**
8
- * Optimistically applies source documents to a result, using the content source map to trace fields.
9
- * Can be used to apply mutations to documents being edited in a Studio, or any mutation on Content Lake, to a result with extremely low latency.
10
30
  * @alpha
31
+ * @deprecated use `ContentSourceMapParsedPath[number]` instead
11
32
  */
12
- export declare function applySourceDocuments<Result = unknown>(
13
- result: Result,
14
- resultSourceMap: ContentSourceMap | undefined,
15
- getCachedDocument: (
16
- sourceDocument: ContentSourceMapDocuments[number],
17
- ) =>
18
- (Partial<SanityDocument> & Required<Pick<SanityDocument, '_id' | '_type'>>) | null | undefined,
19
- updateFn: ApplySourceDocumentsUpdateFunction,
20
- perspective: Exclude<ClientPerspective, 'raw'>,
21
- ): Result
22
-
33
+ type ContentSourceMapParsedPathSegment = ContentSourceMapParsedPath[number];
34
+ /** @alpha */
35
+ type ContentSourceMapParsedPathKeyedSegment = {
36
+ _key: string;
37
+ _index: number;
38
+ };
39
+ /** @alpha */
40
+ type ContentSourceMapParsedPath = (string | number | ContentSourceMapParsedPathKeyedSegment)[];
41
+ /** @alpha */
42
+ type StudioBaseUrl = `/${string}` | `${string}.sanity.studio` | `https://${string}` | (string & {});
43
+ /** @alpha */
44
+ type StudioBaseRoute = {
45
+ baseUrl: StudioBaseUrl;
46
+ workspace?: string;
47
+ tool?: string;
48
+ };
49
+ /** @alpha */
50
+ type StudioUrl = StudioBaseUrl | StudioBaseRoute;
51
+ /** @alpha */
52
+ type ResolveStudioUrl = (sourceDocument: ContentSourceMapDocuments$1[number]) => StudioUrl;
23
53
  /**
54
+ * Path syntax as used by the `sanity` package, you can give it a string:
55
+ * `products[0].images[_key=="abc123"].asset._ref`
56
+ * or an array:
57
+ * `['products', 0, 'images', {_key: 'abc123'}, 'asset', '_ref']`
24
58
  * @alpha
25
59
  */
26
- export declare type ApplySourceDocumentsUpdateFunction = <T = unknown>(
27
- changedValue: T,
28
- context: {
29
- cachedDocument: Partial<SanityDocument>
30
- previousValue: T
31
- sourceDocument: ContentSourceMapDocuments[number]
32
- sourcePath: ContentSourceMapParsedPath
33
- },
34
- ) => T
35
-
36
- /** @public */
37
- export declare type ClientPerspective =
38
- DeprecatedPreviewDrafts | 'published' | 'drafts' | 'raw' | StackablePerspective[]
39
-
40
- /** @public */
41
- export declare interface ContentSourceMap {
42
- mappings: ContentSourceMapMappings
43
- documents: ContentSourceMapDocuments
44
- paths: ContentSourceMapPaths
45
- }
46
-
47
- /** @public */
48
- export declare interface ContentSourceMapDocument extends ContentSourceMapDocumentBase {
49
- _projectId?: undefined
50
- _dataset?: undefined
51
- }
52
-
53
- /** @public */
54
- export declare interface ContentSourceMapDocumentBase {
55
- _id: string
56
- _type: string
57
- }
58
-
59
- /** @public */
60
- export declare type ContentSourceMapDocuments = (
61
- ContentSourceMapDocument | ContentSourceMapRemoteDocument
62
- )[]
63
-
64
- /**
65
- * DocumentValueSource is a path to a value within a document
66
- * @public
67
- */
68
- export declare interface ContentSourceMapDocumentValueSource {
69
- type: 'documentValue'
70
- document: number
71
- path: number
72
- }
73
-
74
- /**
75
- * When a value is not from a source, its a literal
76
- * @public
77
- */
78
- export declare interface ContentSourceMapLiteralSource {
79
- type: 'literal'
60
+ type StudioPathLike = Path | string;
61
+ /** @alpha */
62
+ type EditIntentUrl = `/intent/edit/mode=presentation;id=${string};type=${string};path=${string}`;
63
+ /** @internal */
64
+ interface CreateEditUrlOptions {
65
+ baseUrl: string;
66
+ workspace?: string;
67
+ tool?: string;
68
+ id: string;
69
+ type: string;
70
+ path: ContentSourceMapParsedPath | string;
71
+ projectId?: string;
72
+ dataset?: string;
80
73
  }
81
-
82
- /** @public */
83
- export declare type ContentSourceMapMapping = ContentSourceMapValueMapping
84
-
85
- /** @public */
86
- export declare type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
87
-
88
74
  /** @alpha */
89
- export declare type ContentSourceMapParsedPath = (
90
- string | number | ContentSourceMapParsedPathKeyedSegment
91
- )[]
92
-
75
+ interface ResolveEditInfoOptions {
76
+ studioUrl: StudioUrl | ResolveStudioUrl;
77
+ resultSourceMap: ContentSourceMap$1;
78
+ resultPath: ContentSourceMapParsedPath;
79
+ }
93
80
  /** @alpha */
94
- export declare type ContentSourceMapParsedPathKeyedSegment = {
95
- _key: string
96
- _index: number
81
+ interface ResolveEditUrlOptions extends Omit<ResolveEditInfoOptions, 'resultPath'> {
82
+ resultPath: StudioPathLike;
97
83
  }
98
-
99
84
  /**
100
85
  * @alpha
101
- * @deprecated use `ContentSourceMapParsedPath[number]` instead
102
86
  */
103
- export declare type ContentSourceMapParsedPathSegment = ContentSourceMapParsedPath[number]
104
-
105
- /** @public */
106
- export declare type ContentSourceMapPaths = string[]
107
-
108
- /** @public */
109
- export declare interface ContentSourceMapRemoteDocument extends ContentSourceMapDocumentBase {
110
- _projectId: string
111
- _dataset: string
112
- }
113
-
114
- /** @public */
115
- export declare type ContentSourceMapSource =
116
- | ContentSourceMapDocumentValueSource
117
- | ContentSourceMapLiteralSource
118
- | ContentSourceMapUnknownSource
119
-
87
+ type ApplySourceDocumentsUpdateFunction = <T = unknown>(changedValue: T, context: {
88
+ cachedDocument: Partial<SanityDocument$1>;
89
+ previousValue: T;
90
+ sourceDocument: ContentSourceMapDocuments$1[number];
91
+ sourcePath: ContentSourceMapParsedPath;
92
+ }) => T;
120
93
  /**
121
- * When a field source is unknown
122
- * @public
94
+ * @internal
123
95
  */
124
- export declare interface ContentSourceMapUnknownSource {
125
- type: 'unknown'
126
- }
127
-
96
+ type WalkMapFn = (value: unknown, path: ContentSourceMapParsedPath) => unknown;
128
97
  /**
129
- * ValueMapping is a mapping when for value that is from a single source value
130
- * It may refer to a field within a document or a literal value
131
- * @public
98
+ * Optimistically applies source documents to a result, using the content source map to trace fields.
99
+ * Can be used to apply mutations to documents being edited in a Studio, or any mutation on Content Lake, to a result with extremely low latency.
100
+ * @alpha
132
101
  */
133
- export declare interface ContentSourceMapValueMapping {
134
- type: 'value'
135
- source: ContentSourceMapSource
136
- }
137
-
102
+ declare function applySourceDocuments<Result = unknown>(result: Result, resultSourceMap: ContentSourceMap | undefined, getCachedDocument: (sourceDocument: ContentSourceMapDocuments[number]) => (Partial<SanityDocument> & Required<Pick<SanityDocument, '_id' | '_type'>>) | null | undefined, updateFn: ApplySourceDocumentsUpdateFunction, perspective: Exclude<ClientPerspective, 'raw'>): Result;
138
103
  /** @internal */
139
- export declare function createEditUrl(
140
- options: CreateEditUrlOptions,
141
- ): `${StudioBaseUrl}${EditIntentUrl}`
142
-
104
+ declare function createEditUrl(options: CreateEditUrlOptions): `${StudioBaseUrl}${EditIntentUrl}`;
105
+ type Opaque<T, K> = T & {
106
+ __opaqueId__: K;
107
+ };
143
108
  /** @internal */
144
- export declare interface CreateEditUrlOptions {
145
- baseUrl: string
146
- workspace?: string
147
- tool?: string
148
- id: string
149
- type: string
150
- path: ContentSourceMapParsedPath | string
151
- projectId?: string
152
- dataset?: string
153
- }
154
-
155
- /**
156
- * @deprecated use 'drafts' instead
157
- */
158
- declare type DeprecatedPreviewDrafts = 'previewDrafts'
159
-
109
+ type DraftId = Opaque<string, 'draftId'>;
160
110
  /** @internal */
161
- export declare type DraftId = Opaque<string, 'draftId'>
162
-
111
+ type PublishedId = Opaque<string, 'publishedId'>;
163
112
  /** @internal */
164
- export declare const DRAFTS_FOLDER = 'drafts'
165
-
166
- /** @alpha */
167
- export declare type EditIntentUrl =
168
- `/intent/edit/mode=presentation;id=${string};type=${string};path=${string}`
169
-
170
- /** @alpha */
171
- declare function fromString(path: string): Path
172
-
113
+ declare const DRAFTS_FOLDER = "drafts";
114
+ /** @internal */
115
+ declare const VERSION_FOLDER = "versions";
173
116
  /** @internal */
174
- declare function get<Result = unknown, Fallback = unknown>(
175
- obj: unknown,
176
- path: Path | string,
177
- defaultVal?: Fallback,
178
- ): Result | typeof defaultVal
179
-
117
+ declare function isDraftId(id: string): id is DraftId;
180
118
  /** @internal */
181
- export declare function getDraftId(id: string): DraftId
182
-
119
+ declare function isVersionId(id: string): boolean;
183
120
  /** @internal */
184
- export declare function getPublishedId(id: string): PublishedId
185
-
121
+ declare function isPublishedId(id: string): id is PublishedId;
122
+ /** @internal */
123
+ declare function getDraftId(id: string): DraftId;
124
+ /** @internal */
125
+ declare function getVersionId(id: string, version: string): string;
186
126
  /**
187
127
  * @internal
188
128
  * Given an id, returns the versionId if it exists.
@@ -190,202 +130,49 @@ export declare function getPublishedId(id: string): PublishedId
190
130
  * e.g. `drafts.foo` = `undefined`
191
131
  * e.g. `foo` = `undefined`
192
132
  */
193
- export declare function getVersionFromId(id: string): string | undefined
194
-
195
- /** @internal */
196
- export declare function getVersionId(id: string, version: string): string
197
-
198
- /** @alpha */
199
- export declare type IndexTuple = [number | '', number | '']
200
-
201
- /** @internal */
202
- export declare function isDraftId(id: string): id is DraftId
203
-
204
- /** @internal */
205
- declare function isIndexSegment(segment: PathSegment): segment is number
206
-
133
+ declare function getVersionFromId(id: string): string | undefined;
207
134
  /** @internal */
208
- declare function isIndexTuple(segment: PathSegment): segment is IndexTuple
209
-
210
- /** @internal */
211
- declare function isKeySegment(segment: PathSegment): segment is KeyedSegment
212
-
213
- /** @internal */
214
- export declare function isPublishedId(id: string): id is PublishedId
215
-
216
- /** @internal */
217
- export declare function isVersionId(id: string): boolean
218
-
135
+ declare function getPublishedId(id: string): PublishedId;
219
136
  /**
220
137
  * @internal
221
138
  */
222
- export declare function jsonPath(path: ContentSourceMapParsedPath): ContentSourceMapPaths[number]
223
-
139
+ declare function jsonPath(path: ContentSourceMapParsedPath): ContentSourceMapPaths[number];
224
140
  /**
225
141
  * @internal
226
142
  */
227
- export declare function jsonPathToStudioPath(path: ContentSourceMapParsedPath): Path
228
-
229
- /** @alpha */
230
- export declare type KeyedSegment = {
231
- _key: string
232
- }
233
-
234
- declare type Opaque<T, K> = T & {
235
- __opaqueId__: K
236
- }
237
-
143
+ declare function parseJsonPath(path: ContentSourceMapPaths[number]): ContentSourceMapParsedPath;
238
144
  /**
239
145
  * @internal
240
146
  */
241
- export declare function parseJsonPath(
242
- path: ContentSourceMapPaths[number],
243
- ): ContentSourceMapParsedPath
244
-
245
- /** @alpha */
246
- export declare type Path = PathSegment[]
247
-
248
- /** @alpha */
249
- export declare type PathSegment = string | number | KeyedSegment | IndexTuple
250
-
251
- /** @internal */
252
- export declare type PublishedId = Opaque<string, 'publishedId'>
253
-
254
- /** @internal */
255
- declare const reKeySegment: RegExp
256
-
147
+ declare function jsonPathToStudioPath(path: ContentSourceMapParsedPath): Path;
257
148
  /**
258
149
  * @internal
259
150
  */
260
- export declare function resolvedKeyedSourcePath(options: {
261
- keyedResultPath: ContentSourceMapParsedPath
262
- pathSuffix?: string
263
- sourceBasePath: string
264
- }): ContentSourceMapParsedPath
265
-
266
- /** @internal */
267
- export declare function resolveEditInfo(
268
- options: ResolveEditInfoOptions,
269
- ): CreateEditUrlOptions | undefined
270
-
271
- /** @alpha */
272
- export declare interface ResolveEditInfoOptions {
273
- studioUrl: StudioUrl | ResolveStudioUrl
274
- resultSourceMap: ContentSourceMap
275
- resultPath: ContentSourceMapParsedPath
276
- }
277
-
278
- /** @alpha */
279
- export declare function resolveEditUrl(
280
- options: ResolveEditUrlOptions,
281
- ): ReturnType<typeof createEditUrl> | undefined
282
-
283
- /** @alpha */
284
- export declare interface ResolveEditUrlOptions extends Omit<ResolveEditInfoOptions, 'resultPath'> {
285
- resultPath: StudioPathLike
286
- }
287
-
151
+ declare function studioPathToJsonPath(path: Path | string): ContentSourceMapParsedPath;
288
152
  /**
289
153
  * @internal
290
154
  */
291
- export declare function resolveMapping(
292
- resultPath: ContentSourceMapParsedPath,
293
- csm?: ContentSourceMap,
294
- ):
295
- | {
296
- mapping: ContentSourceMapMapping
297
- matchedPath: string
298
- pathSuffix: string
299
- }
300
- | undefined
301
-
302
- /** @alpha */
303
- export declare type ResolveStudioUrl = (
304
- sourceDocument: ContentSourceMapDocuments[number],
305
- ) => StudioUrl
306
-
155
+ declare function resolvedKeyedSourcePath(options: {
156
+ keyedResultPath: ContentSourceMapParsedPath;
157
+ pathSuffix?: string;
158
+ sourceBasePath: string;
159
+ }): ContentSourceMapParsedPath;
307
160
  /** @internal */
308
- export declare type SanityDocument<T extends Record<string, Any> = Record<string, Any>> = {
309
- [P in keyof T]: T[P]
310
- } & {
311
- _id: string
312
- _rev: string
313
- _type: string
314
- _createdAt: string
315
- _updatedAt: string
316
- /**
317
- * Present when `perspective` is set to `previewDrafts`
318
- */
319
- _originalId?: string
320
- }
321
-
322
- /** @public */
323
- declare type StackablePerspective = ('published' | 'drafts' | string) & {}
324
-
325
- /** @alpha */
326
- export declare type StudioBaseRoute = {
327
- baseUrl: StudioBaseUrl
328
- workspace?: string
329
- tool?: string
330
- }
331
-
161
+ declare function resolveEditInfo(options: ResolveEditInfoOptions): CreateEditUrlOptions | undefined;
332
162
  /** @alpha */
333
- export declare type StudioBaseUrl =
334
- `/${string}` | `${string}.sanity.studio` | `https://${string}` | string
335
-
336
- declare namespace studioPath {
337
- export {
338
- isIndexSegment,
339
- isKeySegment,
340
- isIndexTuple,
341
- get,
342
- toString_2 as toString,
343
- fromString,
344
- KeyedSegment,
345
- IndexTuple,
346
- PathSegment,
347
- Path,
348
- reKeySegment,
349
- }
350
- }
351
- export {studioPath}
352
-
353
- /**
354
- * Path syntax as used by the `sanity` package, you can give it a string:
355
- * `products[0].images[_key=="abc123"].asset._ref`
356
- * or an array:
357
- * `['products', 0, 'images', {_key: 'abc123'}, 'asset', '_ref']`
358
- * @alpha
359
- */
360
- export declare type StudioPathLike = Path | string
361
-
163
+ declare function resolveEditUrl(options: ResolveEditUrlOptions): ReturnType<typeof createEditUrl> | undefined;
362
164
  /**
363
165
  * @internal
364
166
  */
365
- export declare function studioPathToJsonPath(path: Path | string): ContentSourceMapParsedPath
366
-
367
- /** @alpha */
368
- export declare type StudioUrl = StudioBaseUrl | StudioBaseRoute
369
-
370
- /** @alpha */
371
- declare function toString_2(path: Path): string
372
-
373
- /** @internal */
374
- export declare const VERSION_FOLDER = 'versions'
375
-
167
+ declare function resolveMapping(resultPath: ContentSourceMapParsedPath, csm?: ContentSourceMap): {
168
+ mapping: ContentSourceMapMapping;
169
+ matchedPath: string;
170
+ pathSuffix: string;
171
+ } | undefined;
376
172
  /**
377
173
  * generic way to walk a nested object or array and apply a mapping function to each value
378
174
  * @internal
379
175
  */
380
- export declare function walkMap(
381
- value: unknown,
382
- mappingFn: WalkMapFn,
383
- path?: ContentSourceMapParsedPath,
384
- ): unknown
385
-
386
- /**
387
- * @internal
388
- */
389
- export declare type WalkMapFn = (value: unknown, path: ContentSourceMapParsedPath) => unknown
390
-
391
- export {}
176
+ declare function walkMap(value: unknown, mappingFn: WalkMapFn, path?: ContentSourceMapParsedPath): unknown;
177
+ export { type Any, type ApplySourceDocumentsUpdateFunction, type ClientPerspective, type ContentSourceMap, type ContentSourceMapDocument, type ContentSourceMapDocumentBase, type ContentSourceMapDocumentValueSource, type ContentSourceMapDocuments, type ContentSourceMapLiteralSource, type ContentSourceMapMapping, type ContentSourceMapMappings, type ContentSourceMapParsedPath, type ContentSourceMapParsedPathKeyedSegment, type ContentSourceMapParsedPathSegment, type ContentSourceMapPaths, type ContentSourceMapRemoteDocument, type ContentSourceMapSource, type ContentSourceMapUnknownSource, type ContentSourceMapValueMapping, type CreateEditUrlOptions, DRAFTS_FOLDER, type DraftId, type EditIntentUrl, type IndexTuple, type KeyedSegment, type Path, type PathSegment, type PublishedId, type ResolveEditInfoOptions, type ResolveEditUrlOptions, type ResolveStudioUrl, type SanityDocument, type StudioBaseRoute, type StudioBaseUrl, type StudioPathLike, type StudioUrl, VERSION_FOLDER, type WalkMapFn, applySourceDocuments, createEditUrl, getDraftId, getPublishedId, getVersionFromId, getVersionId, isDraftId, isPublishedId, isVersionId, jsonPath, jsonPathToStudioPath, parseJsonPath, resolveEditInfo, resolveEditUrl, resolveMapping, resolvedKeyedSourcePath, studioPath_d_exports as studioPath, studioPathToJsonPath, walkMap };
178
+ //# sourceMappingURL=csm.d.ts.map