@sanity/client 6.15.6 → 6.15.8
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/README.md +49 -5
- package/dist/_chunks-cjs/nodeMiddleware.cjs +1 -1
- package/dist/_chunks-es/nodeMiddleware.js +1 -1
- package/dist/csm.d.cts +349 -0
- package/dist/index.browser.d.cts +2816 -0
- package/dist/index.browser.d.ts +2816 -0
- package/dist/index.d.cts +2816 -0
- package/dist/index.d.ts +3 -0
- package/dist/stega.browser.d.cts +2876 -0
- package/dist/stega.browser.d.ts +2876 -0
- package/dist/stega.d.cts +2876 -0
- package/dist/stega.d.ts +3 -0
- package/package.json +12 -15
- package/src/types.ts +4 -0
package/README.md
CHANGED
|
@@ -65,11 +65,14 @@ export async function updateDocumentTitle(_id, title) {
|
|
|
65
65
|
- [Browser ESM CDN](#browser-esm-cdn)
|
|
66
66
|
- [UMD](#umd)
|
|
67
67
|
- [Specifying API version](#specifying-api-version)
|
|
68
|
+
- [Request tags](#request-tags)
|
|
68
69
|
- [Performing queries](#performing-queries)
|
|
69
70
|
- [Using perspectives](#using-perspectives)
|
|
70
71
|
- [`published`](#published)
|
|
71
72
|
- [`previewDrafts`](#previewdrafts)
|
|
72
73
|
- [Fetching Content Source Maps](#fetching-content-source-maps)
|
|
74
|
+
- [Using Visual editing with steganography](#using-visual-editing-with-steganography)
|
|
75
|
+
- [Creating Studio edit intent links](#creating-studio-edit-intent-links)
|
|
73
76
|
- [Listening to queries](#listening-to-queries)
|
|
74
77
|
- [Fetch a single document](#fetch-a-single-document)
|
|
75
78
|
- [Fetch multiple documents in one go](#fetch-multiple-documents-in-one-go)
|
|
@@ -94,13 +97,28 @@ export async function updateDocumentTitle(_id, title) {
|
|
|
94
97
|
- [Deleting an asset](#deleting-an-asset)
|
|
95
98
|
- [Mutation options](#mutation-options)
|
|
96
99
|
- [Aborting a request](#aborting-a-request)
|
|
100
|
+
- [1. Abort a request by passing an AbortSignal with the request options](#1-abort-a-request-by-passing-an-abortsignal-with-the-request-options)
|
|
101
|
+
- [2. Cancel a request by unsubscribing from the Observable](#2-cancel-a-request-by-unsubscribing-from-the-observable)
|
|
97
102
|
- [Get client configuration](#get-client-configuration)
|
|
98
103
|
- [Set client configuration](#set-client-configuration)
|
|
99
|
-
- [Release new version](#release-new-version)
|
|
100
104
|
- [License](#license)
|
|
101
|
-
- [
|
|
102
|
-
- [
|
|
103
|
-
|
|
105
|
+
- [From `v5`](#from-v5)
|
|
106
|
+
- [The default `useCdn` is changed to `true`](#the-default-usecdn-is-changed-to-true)
|
|
107
|
+
- [From `v4`](#from-v4)
|
|
108
|
+
- [No longer shipping `ES5`](#no-longer-shipping-es5)
|
|
109
|
+
- [Node.js `v12` no longer supported](#nodejs-v12-no-longer-supported)
|
|
110
|
+
- [The `default` export is replaced with the named export `createClient`](#the-default-export-is-replaced-with-the-named-export-createclient)
|
|
111
|
+
- [`client.assets.delete` is removed](#clientassetsdelete-is-removed)
|
|
112
|
+
- [`client.assets.getImageUrl` is removed, replace with `@sanity/image-url`](#clientassetsgetimageurl-is-removed-replace-with-sanityimage-url)
|
|
113
|
+
- [`SanityClient` static properties moved to named exports](#sanityclient-static-properties-moved-to-named-exports)
|
|
114
|
+
- [`client.clientConfig` is removed, replace with `client.config()`](#clientclientconfig-is-removed-replace-with-clientconfig)
|
|
115
|
+
- [`client.isPromiseAPI()` is removed, replace with an `instanceof` check](#clientispromiseapi-is-removed-replace-with-an-instanceof-check)
|
|
116
|
+
- [`client.observable.isObservableAPI()` is removed, replace with an `instanceof` check](#clientobservableisobservableapi-is-removed-replace-with-an-instanceof-check)
|
|
117
|
+
- [`client._requestObservable` is removed, replace with `client.observable.request`](#client_requestobservable-is-removed-replace-with-clientobservablerequest)
|
|
118
|
+
- [`client._dataRequest` is removed, replace with `client.dataRequest`](#client_datarequest-is-removed-replace-with-clientdatarequest)
|
|
119
|
+
- [`client._create_` is removed, replace with one of `client.create`, `client.createIfNotExists` or `client.createOrReplace`](#client_create_-is-removed-replace-with-one-of-clientcreate-clientcreateifnotexists-or-clientcreateorreplace)
|
|
120
|
+
- [`client.patch.replace` is removed, replace with `client.createOrReplace`](#clientpatchreplace-is-removed-replace-with-clientcreateorreplace)
|
|
121
|
+
- [`client.auth` is removed, replace with `client.request`](#clientauth-is-removed-replace-with-clientrequest)
|
|
104
122
|
|
|
105
123
|
## Requirements
|
|
106
124
|
|
|
@@ -428,6 +446,31 @@ In general, unless you know what API version you want to use, you'll want to sta
|
|
|
428
446
|
|
|
429
447
|
In future versions, specifying an API version will be required. For now (to maintain backwards compatiblity) not specifying a version will trigger a deprecation warning and fall back to using `v1`.
|
|
430
448
|
|
|
449
|
+
### Request tags
|
|
450
|
+
|
|
451
|
+
Request tags are values assigned to API and CDN requests that can be used to filter and aggregate log data within [request logs][request-logs] from your Sanity Content Lake.
|
|
452
|
+
|
|
453
|
+
Sanity Client has out-of-the-box support for tagging every API and CDN request on two levels:
|
|
454
|
+
|
|
455
|
+
- Globally: Using the `requestTagPrefix` client configuration parameter
|
|
456
|
+
- Per Request: Pass the tag option to the SDK’s Request method.
|
|
457
|
+
|
|
458
|
+
The following example will result in a query with `tag=website.landing-page`:
|
|
459
|
+
|
|
460
|
+
```ts
|
|
461
|
+
const client = createClient({
|
|
462
|
+
projectId: '<project>',
|
|
463
|
+
dataset: '<dataset>',
|
|
464
|
+
useCdn: true,
|
|
465
|
+
apiVersion: '2024-01-24',
|
|
466
|
+
requestTagPrefix: 'website', // Added to every request
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
const posts = await client.fetch('*[_type == "post"]', {
|
|
470
|
+
tag: `index-page`, // Appended to requestTagPrefix for this individual request
|
|
471
|
+
})
|
|
472
|
+
```
|
|
473
|
+
|
|
431
474
|
### Performing queries
|
|
432
475
|
|
|
433
476
|
```js
|
|
@@ -640,7 +683,7 @@ Enabling Content Source Maps is a two-step process:
|
|
|
640
683
|
console.log(resultSourceMap)
|
|
641
684
|
```
|
|
642
685
|
|
|
643
|
-
If your `apiVersion` is `2021-03-25` or later, the `resultSourceMap` property will always exist in the response after enabling it. If there is no source map, `resultSourceMap` is an empty object.
|
|
686
|
+
If your `apiVersion` is `2021-03-25` or later, the `resultSourceMap` property will always exist in the response after enabling it. If there is no source map, `resultSourceMap` is an empty object.
|
|
644
687
|
This is the corresponding TypeScript definition:
|
|
645
688
|
|
|
646
689
|
```ts
|
|
@@ -1608,3 +1651,4 @@ await client.request<void>({uri: '/auth/logout', method: 'POST'})
|
|
|
1608
1651
|
[visual-editing]: https://www.sanity.io/docs/vercel-visual-editing?utm_source=github.com&utm_medium=referral&utm_campaign=may-vercel-launch
|
|
1609
1652
|
[content-source-maps]: https://www.sanity.io/docs/content-source-maps?utm_source=github.com&utm_medium=referral&utm_campaign=may-vercel-launch
|
|
1610
1653
|
[content-source-maps-intro]: https://www.sanity.io/blog/content-source-maps-announce?utm_source=github.com&utm_medium=referral&utm_campaign=may-vercel-launch
|
|
1654
|
+
[request-logs]: https://www.sanity.io/docs/request-logs?utm_source=github.com&utm_medium=referral&utm_campaign=may-vercel-launch
|
|
@@ -1474,7 +1474,7 @@ function defineCreateClientExports(envMiddleware, ClassConstructor) {
|
|
|
1474
1474
|
config
|
|
1475
1475
|
) };
|
|
1476
1476
|
}
|
|
1477
|
-
var name = "@sanity/client", version = "6.15.
|
|
1477
|
+
var name = "@sanity/client", version = "6.15.8";
|
|
1478
1478
|
const middleware = [
|
|
1479
1479
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1480
1480
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|
|
@@ -1455,7 +1455,7 @@ function defineCreateClientExports(envMiddleware, ClassConstructor) {
|
|
|
1455
1455
|
config
|
|
1456
1456
|
) };
|
|
1457
1457
|
}
|
|
1458
|
-
var name = "@sanity/client", version = "6.15.
|
|
1458
|
+
var name = "@sanity/client", version = "6.15.8";
|
|
1459
1459
|
const middleware = [
|
|
1460
1460
|
debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1461
1461
|
headers({ "User-Agent": `${name} ${version}` }),
|
package/dist/csm.d.cts
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare type Any = any
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Optimistically applies source documents to a result, using the content source map to trace fields.
|
|
11
|
+
* 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.
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export declare function applySourceDocuments<Result = unknown>(
|
|
15
|
+
result: Result,
|
|
16
|
+
resultSourceMap: ContentSourceMap | undefined,
|
|
17
|
+
getCachedDocument: (
|
|
18
|
+
sourceDocument: ContentSourceMapDocuments[number],
|
|
19
|
+
) => Partial<SanityDocument> | null | undefined,
|
|
20
|
+
updateFn?: ApplySourceDocumentsUpdateFunction,
|
|
21
|
+
perspective?: ClientPerspective,
|
|
22
|
+
): Result
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
export declare type ApplySourceDocumentsUpdateFunction = <T = unknown>(
|
|
28
|
+
changedValue: T,
|
|
29
|
+
context: {
|
|
30
|
+
cachedDocument: Partial<SanityDocument>
|
|
31
|
+
previousValue: T
|
|
32
|
+
sourceDocument: ContentSourceMapDocuments[number]
|
|
33
|
+
sourcePath: ContentSourceMapParsedPath
|
|
34
|
+
},
|
|
35
|
+
) => T
|
|
36
|
+
|
|
37
|
+
/** @public */
|
|
38
|
+
export declare type ClientPerspective = 'previewDrafts' | 'published' | 'raw'
|
|
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
|
|
62
|
+
| ContentSourceMapRemoteDocument
|
|
63
|
+
)[]
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* DocumentValueSource is a path to a value within a document
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export declare interface ContentSourceMapDocumentValueSource {
|
|
70
|
+
type: 'documentValue'
|
|
71
|
+
document: number
|
|
72
|
+
path: number
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* When a value is not from a source, its a literal
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export declare interface ContentSourceMapLiteralSource {
|
|
80
|
+
type: 'literal'
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** @public */
|
|
84
|
+
export declare type ContentSourceMapMapping = ContentSourceMapValueMapping
|
|
85
|
+
|
|
86
|
+
/** @public */
|
|
87
|
+
export declare type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>
|
|
88
|
+
|
|
89
|
+
/** @alpha */
|
|
90
|
+
export declare type ContentSourceMapParsedPath = (
|
|
91
|
+
| string
|
|
92
|
+
| number
|
|
93
|
+
| ContentSourceMapParsedPathKeyedSegment
|
|
94
|
+
)[]
|
|
95
|
+
|
|
96
|
+
/** @alpha */
|
|
97
|
+
export declare type ContentSourceMapParsedPathKeyedSegment = {
|
|
98
|
+
_key: string
|
|
99
|
+
_index: number
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @alpha
|
|
104
|
+
* @deprecated use `ContentSourceMapParsedPath[number]` instead
|
|
105
|
+
*/
|
|
106
|
+
export declare type ContentSourceMapParsedPathSegment = ContentSourceMapParsedPath[number]
|
|
107
|
+
|
|
108
|
+
/** @public */
|
|
109
|
+
export declare type ContentSourceMapPaths = string[]
|
|
110
|
+
|
|
111
|
+
/** @public */
|
|
112
|
+
export declare interface ContentSourceMapRemoteDocument extends ContentSourceMapDocumentBase {
|
|
113
|
+
_projectId: string
|
|
114
|
+
_dataset: string
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** @public */
|
|
118
|
+
export declare type ContentSourceMapSource =
|
|
119
|
+
| ContentSourceMapDocumentValueSource
|
|
120
|
+
| ContentSourceMapLiteralSource
|
|
121
|
+
| ContentSourceMapUnknownSource
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* When a field source is unknown
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export declare interface ContentSourceMapUnknownSource {
|
|
128
|
+
type: 'unknown'
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* ValueMapping is a mapping when for value that is from a single source value
|
|
133
|
+
* It may refer to a field within a document or a literal value
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
export declare interface ContentSourceMapValueMapping {
|
|
137
|
+
type: 'value'
|
|
138
|
+
source: ContentSourceMapSource
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** @internal */
|
|
142
|
+
export declare function createEditUrl(
|
|
143
|
+
options: CreateEditUrlOptions,
|
|
144
|
+
): `${StudioBaseUrl}${EditIntentUrl}`
|
|
145
|
+
|
|
146
|
+
/** @internal */
|
|
147
|
+
export declare interface CreateEditUrlOptions {
|
|
148
|
+
baseUrl: string
|
|
149
|
+
workspace?: string
|
|
150
|
+
tool?: string
|
|
151
|
+
id: string
|
|
152
|
+
type: string
|
|
153
|
+
path: ContentSourceMapParsedPath | string
|
|
154
|
+
projectId?: string
|
|
155
|
+
dataset?: string
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** @alpha */
|
|
159
|
+
export declare type EditIntentUrl =
|
|
160
|
+
`/intent/edit/mode=presentation;id=${string};type=${string};path=${string}`
|
|
161
|
+
|
|
162
|
+
/** @alpha */
|
|
163
|
+
declare function fromString(path: string): Path
|
|
164
|
+
|
|
165
|
+
/** @internal */
|
|
166
|
+
declare function get<Result = unknown, Fallback = unknown>(
|
|
167
|
+
obj: unknown,
|
|
168
|
+
path: Path | string,
|
|
169
|
+
defaultVal?: Fallback,
|
|
170
|
+
): Result | typeof defaultVal
|
|
171
|
+
|
|
172
|
+
/** @internal */
|
|
173
|
+
export declare function getPublishedId(id: string): string
|
|
174
|
+
|
|
175
|
+
/** @alpha */
|
|
176
|
+
export declare type IndexTuple = [number | '', number | '']
|
|
177
|
+
|
|
178
|
+
/** @internal */
|
|
179
|
+
declare function isIndexSegment(segment: PathSegment): segment is number
|
|
180
|
+
|
|
181
|
+
/** @internal */
|
|
182
|
+
declare function isIndexTuple(segment: PathSegment): segment is IndexTuple
|
|
183
|
+
|
|
184
|
+
/** @internal */
|
|
185
|
+
declare function isKeySegment(segment: PathSegment): segment is KeyedSegment
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
export declare function jsonPath(path: ContentSourceMapParsedPath): ContentSourceMapPaths[number]
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
export declare function jsonPathToStudioPath(path: ContentSourceMapParsedPath): Path
|
|
196
|
+
|
|
197
|
+
/** @alpha */
|
|
198
|
+
export declare type KeyedSegment = {
|
|
199
|
+
_key: string
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
205
|
+
export declare function parseJsonPath(
|
|
206
|
+
path: ContentSourceMapPaths[number],
|
|
207
|
+
): ContentSourceMapParsedPath
|
|
208
|
+
|
|
209
|
+
/** @alpha */
|
|
210
|
+
export declare type Path = PathSegment[]
|
|
211
|
+
|
|
212
|
+
/** @alpha */
|
|
213
|
+
export declare type PathSegment = string | number | KeyedSegment | IndexTuple
|
|
214
|
+
|
|
215
|
+
/** @internal */
|
|
216
|
+
declare const reKeySegment: RegExp
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
export declare function resolvedKeyedSourcePath(options: {
|
|
222
|
+
keyedResultPath: ContentSourceMapParsedPath
|
|
223
|
+
pathSuffix?: string
|
|
224
|
+
sourceBasePath: string
|
|
225
|
+
}): ContentSourceMapParsedPath
|
|
226
|
+
|
|
227
|
+
/** @internal */
|
|
228
|
+
export declare function resolveEditInfo(
|
|
229
|
+
options: ResolveEditInfoOptions,
|
|
230
|
+
): CreateEditUrlOptions | undefined
|
|
231
|
+
|
|
232
|
+
/** @alpha */
|
|
233
|
+
export declare interface ResolveEditInfoOptions {
|
|
234
|
+
studioUrl: StudioUrl | ResolveStudioUrl
|
|
235
|
+
resultSourceMap: ContentSourceMap
|
|
236
|
+
resultPath: ContentSourceMapParsedPath
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** @alpha */
|
|
240
|
+
export declare function resolveEditUrl(
|
|
241
|
+
options: ResolveEditUrlOptions,
|
|
242
|
+
): ReturnType<typeof createEditUrl> | undefined
|
|
243
|
+
|
|
244
|
+
/** @alpha */
|
|
245
|
+
export declare interface ResolveEditUrlOptions extends Omit<ResolveEditInfoOptions, 'resultPath'> {
|
|
246
|
+
resultPath: StudioPathLike
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
252
|
+
export declare function resolveMapping(
|
|
253
|
+
resultPath: ContentSourceMapParsedPath,
|
|
254
|
+
csm?: ContentSourceMap,
|
|
255
|
+
):
|
|
256
|
+
| {
|
|
257
|
+
mapping: ContentSourceMapMapping
|
|
258
|
+
matchedPath: string
|
|
259
|
+
pathSuffix: string
|
|
260
|
+
}
|
|
261
|
+
| undefined
|
|
262
|
+
|
|
263
|
+
/** @alpha */
|
|
264
|
+
export declare type ResolveStudioUrl = (
|
|
265
|
+
sourceDocument: ContentSourceMapDocuments[number],
|
|
266
|
+
) => StudioUrl
|
|
267
|
+
|
|
268
|
+
/** @internal */
|
|
269
|
+
export declare type SanityDocument<T extends Record<string, Any> = Record<string, Any>> = {
|
|
270
|
+
[P in keyof T]: T[P]
|
|
271
|
+
} & {
|
|
272
|
+
_id: string
|
|
273
|
+
_rev: string
|
|
274
|
+
_type: string
|
|
275
|
+
_createdAt: string
|
|
276
|
+
_updatedAt: string
|
|
277
|
+
/**
|
|
278
|
+
* Present when `perspective` is set to `previewDrafts`
|
|
279
|
+
*/
|
|
280
|
+
_originalId?: string
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** @alpha */
|
|
284
|
+
export declare type StudioBaseRoute = {
|
|
285
|
+
baseUrl: StudioBaseUrl
|
|
286
|
+
workspace?: string
|
|
287
|
+
tool?: string
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** @alpha */
|
|
291
|
+
export declare type StudioBaseUrl =
|
|
292
|
+
| `/${string}`
|
|
293
|
+
| `${string}.sanity.studio`
|
|
294
|
+
| `https://${string}`
|
|
295
|
+
| string
|
|
296
|
+
|
|
297
|
+
declare namespace studioPath {
|
|
298
|
+
export {
|
|
299
|
+
isIndexSegment,
|
|
300
|
+
isKeySegment,
|
|
301
|
+
isIndexTuple,
|
|
302
|
+
get,
|
|
303
|
+
toString_2 as toString,
|
|
304
|
+
fromString,
|
|
305
|
+
KeyedSegment,
|
|
306
|
+
IndexTuple,
|
|
307
|
+
PathSegment,
|
|
308
|
+
Path,
|
|
309
|
+
reKeySegment,
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
export {studioPath}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Path syntax as used by the `sanity` package, you can give it a string:
|
|
316
|
+
* `products[0].images[_key=="abc123"].asset._ref`
|
|
317
|
+
* or an array:
|
|
318
|
+
* `['products', 0, 'images', {_key: 'abc123'}, 'asset', '_ref']`
|
|
319
|
+
* @alpha
|
|
320
|
+
*/
|
|
321
|
+
export declare type StudioPathLike = Path | string
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* @internal
|
|
325
|
+
*/
|
|
326
|
+
export declare function studioPathToJsonPath(path: Path | string): ContentSourceMapParsedPath
|
|
327
|
+
|
|
328
|
+
/** @alpha */
|
|
329
|
+
export declare type StudioUrl = StudioBaseUrl | StudioBaseRoute
|
|
330
|
+
|
|
331
|
+
/** @alpha */
|
|
332
|
+
declare function toString_2(path: Path): string
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* generic way to walk a nested object or array and apply a mapping function to each value
|
|
336
|
+
* @internal
|
|
337
|
+
*/
|
|
338
|
+
export declare function walkMap(
|
|
339
|
+
value: unknown,
|
|
340
|
+
mappingFn: WalkMapFn,
|
|
341
|
+
path?: ContentSourceMapParsedPath,
|
|
342
|
+
): unknown
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* @internal
|
|
346
|
+
*/
|
|
347
|
+
export declare type WalkMapFn = (value: unknown, path: ContentSourceMapParsedPath) => unknown
|
|
348
|
+
|
|
349
|
+
export {}
|