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