@sanity/client 6.8.0-pink-lizard.11 → 6.8.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 +2 -112
- package/dist/_chunks/{nodeMiddleware-cQeqivr5.cjs → nodeMiddleware-AQIXW8nd.cjs} +2 -2
- package/dist/_chunks/{nodeMiddleware-cQeqivr5.cjs.map → nodeMiddleware-AQIXW8nd.cjs.map} +1 -1
- package/dist/_chunks/{nodeMiddleware-pr0WzTXK.js → nodeMiddleware-cKmlsf7J.js} +2 -2
- package/dist/_chunks/{nodeMiddleware-pr0WzTXK.js.map → nodeMiddleware-cKmlsf7J.js.map} +1 -1
- package/dist/_chunks/{resolveEditInfo-xcYOjX4T.cjs → resolveEditInfo-2keGcJpx.cjs} +2 -1
- package/dist/_chunks/{resolveEditInfo-xcYOjX4T.cjs.map → resolveEditInfo-2keGcJpx.cjs.map} +1 -1
- package/dist/_chunks/{resolveEditInfo-8A-bssPb.js → resolveEditInfo-hVGpZYTe.js} +2 -2
- package/dist/_chunks/{resolveEditInfo-8A-bssPb.js.map → resolveEditInfo-hVGpZYTe.js.map} +1 -1
- package/dist/csm.cjs +1 -1
- package/dist/csm.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/stega.browser.cjs +23 -65
- package/dist/stega.browser.cjs.map +1 -1
- package/dist/stega.browser.js +23 -65
- package/dist/stega.browser.js.map +1 -1
- package/dist/stega.cjs +25 -21
- package/dist/stega.cjs.map +1 -1
- package/dist/stega.js +26 -22
- package/dist/stega.js.map +1 -1
- package/package.json +3 -3
- package/src/csm/resolveEditInfo.ts +2 -1
- package/src/stega/stegaEncodeSourceMap.ts +25 -18
- package/src/csm/applySourceDocuments.test.ts +0 -410
- package/src/csm/createEditUrl.test.ts +0 -39
- package/src/csm/jsonPath.test.ts +0 -39
- package/src/csm/resolveEditUrl.test.ts +0 -537
- package/src/csm/studioPath.test.ts +0 -237
- package/src/stega/encodeIntoResult.test.ts +0 -259
- package/src/stega/vercelStegaCleanAll.test.ts +0 -21
|
@@ -1,537 +0,0 @@
|
|
|
1
|
-
import {expect, test} from 'vitest'
|
|
2
|
-
|
|
3
|
-
import {resolveEditUrl} from './resolveEditUrl'
|
|
4
|
-
import type {ContentSourceMap} from './types'
|
|
5
|
-
|
|
6
|
-
const projectId = 'abc123'
|
|
7
|
-
const dataset = 'production'
|
|
8
|
-
const mock = {
|
|
9
|
-
query:
|
|
10
|
-
'{\n "products": *[_type == "product" && defined(slug.current)]{\n _id,\n title,\n description,\n slug,\n "media": media[0]\n },\n "siteSettings": *[_id == "siteSettings"][0]{\n title,\n copyrightText\n }\n}',
|
|
11
|
-
result: {
|
|
12
|
-
products: [
|
|
13
|
-
{
|
|
14
|
-
description: [
|
|
15
|
-
{
|
|
16
|
-
markDefs: [],
|
|
17
|
-
children: [
|
|
18
|
-
{
|
|
19
|
-
_key: '6a057cf2fb310',
|
|
20
|
-
_type: 'span',
|
|
21
|
-
marks: [],
|
|
22
|
-
text: 'After revisiting one of its best-selling pendants, ACME presents the new and improved Akoya. The original hand-blown, opal glass bulb now boasts increased technical capabilities, as well as more refined perforations to its sheer, spun-aluminum shade. With Akoya’s shades now fabricated in North America, we’ve also cut down our carbon footprint by manufacturing closer to home.',
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
_type: 'block',
|
|
26
|
-
style: 'normal',
|
|
27
|
-
_key: 'd8fa6d59e49b',
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
slug: {
|
|
31
|
-
current: 'akoya',
|
|
32
|
-
_type: 'slug',
|
|
33
|
-
},
|
|
34
|
-
media: {
|
|
35
|
-
_type: 'image',
|
|
36
|
-
alt: 'A Scandi minimal lamp with round bulb',
|
|
37
|
-
_key: 'cee5fbb69da2',
|
|
38
|
-
asset: {
|
|
39
|
-
_ref: 'image-a75b03fdd5b5fa36947bf2b776a542e0c940f682-1000x1500-jpg',
|
|
40
|
-
_type: 'reference',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
_id: '462efcc6-3c8b-47c6-8474-5544e1a4acde',
|
|
44
|
-
title: 'Akoyas - the greatest lamp ever',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
_id: '807cc05c-8c4c-443a-a9c1-198fd3fd7b16',
|
|
48
|
-
title: 'All sew',
|
|
49
|
-
description: [
|
|
50
|
-
{
|
|
51
|
-
_type: 'block',
|
|
52
|
-
style: 'normal',
|
|
53
|
-
_key: '60b5ed16f4cc',
|
|
54
|
-
markDefs: [],
|
|
55
|
-
children: [
|
|
56
|
-
{
|
|
57
|
-
_type: 'span',
|
|
58
|
-
marks: [],
|
|
59
|
-
text: 'All sew, our modular, scalable pendant inspired by the luminosity of lanterns, and the lightweight, collapsible efficiency of kites.',
|
|
60
|
-
_key: '0ebc1c5b37350',
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
children: [
|
|
66
|
-
{
|
|
67
|
-
text: '',
|
|
68
|
-
_key: 'ad7206c98f29',
|
|
69
|
-
_type: 'span',
|
|
70
|
-
marks: [],
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
_type: 'block',
|
|
74
|
-
style: 'normal',
|
|
75
|
-
_key: '5d457324f980',
|
|
76
|
-
markDefs: [],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
_key: '782db3651957',
|
|
80
|
-
markDefs: [],
|
|
81
|
-
children: [
|
|
82
|
-
{
|
|
83
|
-
marks: [],
|
|
84
|
-
text: 'Another row.',
|
|
85
|
-
_key: 'cbd1965e0d78',
|
|
86
|
-
_type: 'span',
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
_type: 'block',
|
|
90
|
-
style: 'normal',
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
slug: {
|
|
94
|
-
_type: 'slug',
|
|
95
|
-
current: 'all-sew',
|
|
96
|
-
},
|
|
97
|
-
media: {
|
|
98
|
-
_type: 'image',
|
|
99
|
-
alt: 'A glorious lamp pendant thingy',
|
|
100
|
-
_key: '55659c72ec46',
|
|
101
|
-
asset: {
|
|
102
|
-
_ref: 'image-c46098d15d7e75080ba279c09f2ea88f24736eb0-1000x1500-jpg',
|
|
103
|
-
_type: 'reference',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
_id: 'a643da0c-2cc6-439e-92b7-9f31c822ee05',
|
|
109
|
-
title: 'Test',
|
|
110
|
-
description: [
|
|
111
|
-
{
|
|
112
|
-
markDefs: [],
|
|
113
|
-
children: [
|
|
114
|
-
{
|
|
115
|
-
_type: 'span',
|
|
116
|
-
marks: [],
|
|
117
|
-
text: 'asldkmsa ldkmasdlka msdlkamdskam ldamsdlk amsdlkamslkdmas lkamsld kamsdlkasm dlkasm lkamsdlka smakld mlamsdlk amlsdkam sldkmslk mdaslkdm alkdmk',
|
|
118
|
-
_key: 'd53c7c4c3314',
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
_type: 'block',
|
|
122
|
-
style: 'normal',
|
|
123
|
-
_key: '94e937616df1',
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
style: 'normal',
|
|
127
|
-
_key: '65f554bf0220',
|
|
128
|
-
markDefs: [],
|
|
129
|
-
children: [
|
|
130
|
-
{
|
|
131
|
-
_type: 'span',
|
|
132
|
-
marks: [],
|
|
133
|
-
text: '',
|
|
134
|
-
_key: '633d1506e24f',
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
_type: 'block',
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
_key: '7c6bbc4dc6c9',
|
|
141
|
-
markDefs: [],
|
|
142
|
-
children: [
|
|
143
|
-
{
|
|
144
|
-
_type: 'span',
|
|
145
|
-
marks: [],
|
|
146
|
-
text: 'okokok',
|
|
147
|
-
_key: '4f27de6e55d8',
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
_type: 'block',
|
|
151
|
-
style: 'normal',
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
slug: {
|
|
155
|
-
current: 'test',
|
|
156
|
-
_type: 'slug',
|
|
157
|
-
},
|
|
158
|
-
media: {
|
|
159
|
-
_type: 'image',
|
|
160
|
-
_key: 'f304342d5bb0',
|
|
161
|
-
asset: {
|
|
162
|
-
_ref: 'image-9d18bc376926c8e0b27a71adf95002d64ef65684-2200x2500-jpg',
|
|
163
|
-
_type: 'reference',
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
media: {
|
|
169
|
-
_key: '3239041c90c8',
|
|
170
|
-
asset: {
|
|
171
|
-
_ref: 'image-c5f75081a501ac31a648253fc9533348602fe628-1000x1500-jpg',
|
|
172
|
-
_type: 'reference',
|
|
173
|
-
},
|
|
174
|
-
_type: 'image',
|
|
175
|
-
},
|
|
176
|
-
_id: 'c9de5527-ebd9-4f90-8c30-a26e3439ca2d',
|
|
177
|
-
title: 'AllSew Reclaimed',
|
|
178
|
-
description: [
|
|
179
|
-
{
|
|
180
|
-
style: 'normal',
|
|
181
|
-
_key: '85cce8f03c3c',
|
|
182
|
-
markDefs: [],
|
|
183
|
-
children: [
|
|
184
|
-
{
|
|
185
|
-
_type: 'span',
|
|
186
|
-
marks: [],
|
|
187
|
-
text: 'Allsew, our modular, scalable pendant inspired by the luminosity of lanterns, and the lightweight, collapsible efficiency of kites.',
|
|
188
|
-
_key: '1689e57dff090',
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
_type: 'block',
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
slug: {
|
|
195
|
-
current: 'all-sew-reclaimed',
|
|
196
|
-
_type: 'slug',
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
description: [
|
|
201
|
-
{
|
|
202
|
-
_key: 'b61f8576b42b',
|
|
203
|
-
markDefs: [],
|
|
204
|
-
children: [
|
|
205
|
-
{
|
|
206
|
-
_type: 'span',
|
|
207
|
-
marks: [],
|
|
208
|
-
text: 'Meet Ripple, a new sconce and flush mount collection distinguished by its substantial solid glass shade. A unique texture of raised, concentric rings brings to mind ripples coursing along the surface of water.',
|
|
209
|
-
_key: '625afd80ca530',
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
_type: 'block',
|
|
213
|
-
style: 'normal',
|
|
214
|
-
},
|
|
215
|
-
],
|
|
216
|
-
slug: {
|
|
217
|
-
current: 'ripple-sconce',
|
|
218
|
-
_type: 'slug',
|
|
219
|
-
},
|
|
220
|
-
media: {
|
|
221
|
-
_type: 'image',
|
|
222
|
-
_key: 'c3c15f50cc9b',
|
|
223
|
-
asset: {
|
|
224
|
-
_ref: 'image-bd59994447e4618b1075c24b8fd519eaf69b4fd5-1200x1800-jpg',
|
|
225
|
-
_type: 'reference',
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
_id: 'e1bf9f1f-efdb-4105-8c26-6b64f897e9c1',
|
|
229
|
-
title: 'Ripple Sconce',
|
|
230
|
-
},
|
|
231
|
-
],
|
|
232
|
-
siteSettings: {
|
|
233
|
-
title: 'acme',
|
|
234
|
-
copyrightText: 'acme © 2023 — all rights reserved',
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
resultSourceMap: {
|
|
238
|
-
documents: [
|
|
239
|
-
{
|
|
240
|
-
_id: 'drafts.462efcc6-3c8b-47c6-8474-5544e1a4acde',
|
|
241
|
-
_type: 'product',
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
_id: 'drafts.807cc05c-8c4c-443a-a9c1-198fd3fd7b16',
|
|
245
|
-
_type: 'product',
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
_id: 'drafts.a643da0c-2cc6-439e-92b7-9f31c822ee05',
|
|
249
|
-
_type: 'product',
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
_id: 'drafts.c9de5527-ebd9-4f90-8c30-a26e3439ca2d',
|
|
253
|
-
_type: 'product',
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
_id: 'drafts.e1bf9f1f-efdb-4105-8c26-6b64f897e9c1',
|
|
257
|
-
_type: 'product',
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
_id: 'siteSettings',
|
|
261
|
-
_type: 'siteSettings',
|
|
262
|
-
},
|
|
263
|
-
],
|
|
264
|
-
paths: [
|
|
265
|
-
"$['description']",
|
|
266
|
-
"$['slug']",
|
|
267
|
-
"$['media'][?(@._key=='cee5fbb69da2')]",
|
|
268
|
-
"$['_id']",
|
|
269
|
-
"$['title']",
|
|
270
|
-
"$['media'][?(@._key=='55659c72ec46')]",
|
|
271
|
-
"$['media'][?(@._key=='f304342d5bb0')]",
|
|
272
|
-
"$['media'][?(@._key=='3239041c90c8')]",
|
|
273
|
-
"$['media'][?(@._key=='c3c15f50cc9b')]",
|
|
274
|
-
"$['copyrightText']",
|
|
275
|
-
],
|
|
276
|
-
mappings: {
|
|
277
|
-
"$['products'][0]['_id']": {
|
|
278
|
-
source: {
|
|
279
|
-
document: 0,
|
|
280
|
-
path: 3,
|
|
281
|
-
type: 'documentValue',
|
|
282
|
-
},
|
|
283
|
-
type: 'value',
|
|
284
|
-
},
|
|
285
|
-
"$['products'][0]['description']": {
|
|
286
|
-
source: {
|
|
287
|
-
document: 0,
|
|
288
|
-
path: 0,
|
|
289
|
-
type: 'documentValue',
|
|
290
|
-
},
|
|
291
|
-
type: 'value',
|
|
292
|
-
},
|
|
293
|
-
"$['products'][0]['media']": {
|
|
294
|
-
source: {
|
|
295
|
-
document: 0,
|
|
296
|
-
path: 2,
|
|
297
|
-
type: 'documentValue',
|
|
298
|
-
},
|
|
299
|
-
type: 'value',
|
|
300
|
-
},
|
|
301
|
-
"$['products'][0]['slug']": {
|
|
302
|
-
source: {
|
|
303
|
-
document: 0,
|
|
304
|
-
path: 1,
|
|
305
|
-
type: 'documentValue',
|
|
306
|
-
},
|
|
307
|
-
type: 'value',
|
|
308
|
-
},
|
|
309
|
-
"$['products'][0]['title']": {
|
|
310
|
-
source: {
|
|
311
|
-
document: 0,
|
|
312
|
-
path: 4,
|
|
313
|
-
type: 'documentValue',
|
|
314
|
-
},
|
|
315
|
-
type: 'value',
|
|
316
|
-
},
|
|
317
|
-
"$['products'][1]['_id']": {
|
|
318
|
-
source: {
|
|
319
|
-
document: 1,
|
|
320
|
-
path: 3,
|
|
321
|
-
type: 'documentValue',
|
|
322
|
-
},
|
|
323
|
-
type: 'value',
|
|
324
|
-
},
|
|
325
|
-
"$['products'][1]['description']": {
|
|
326
|
-
source: {
|
|
327
|
-
document: 1,
|
|
328
|
-
path: 0,
|
|
329
|
-
type: 'documentValue',
|
|
330
|
-
},
|
|
331
|
-
type: 'value',
|
|
332
|
-
},
|
|
333
|
-
"$['products'][1]['media']": {
|
|
334
|
-
source: {
|
|
335
|
-
document: 1,
|
|
336
|
-
path: 5,
|
|
337
|
-
type: 'documentValue',
|
|
338
|
-
},
|
|
339
|
-
type: 'value',
|
|
340
|
-
},
|
|
341
|
-
"$['products'][1]['slug']": {
|
|
342
|
-
source: {
|
|
343
|
-
document: 1,
|
|
344
|
-
path: 1,
|
|
345
|
-
type: 'documentValue',
|
|
346
|
-
},
|
|
347
|
-
type: 'value',
|
|
348
|
-
},
|
|
349
|
-
"$['products'][1]['title']": {
|
|
350
|
-
source: {
|
|
351
|
-
document: 1,
|
|
352
|
-
path: 4,
|
|
353
|
-
type: 'documentValue',
|
|
354
|
-
},
|
|
355
|
-
type: 'value',
|
|
356
|
-
},
|
|
357
|
-
"$['products'][2]['_id']": {
|
|
358
|
-
source: {
|
|
359
|
-
document: 2,
|
|
360
|
-
path: 3,
|
|
361
|
-
type: 'documentValue',
|
|
362
|
-
},
|
|
363
|
-
type: 'value',
|
|
364
|
-
},
|
|
365
|
-
"$['products'][2]['description']": {
|
|
366
|
-
source: {
|
|
367
|
-
document: 2,
|
|
368
|
-
path: 0,
|
|
369
|
-
type: 'documentValue',
|
|
370
|
-
},
|
|
371
|
-
type: 'value',
|
|
372
|
-
},
|
|
373
|
-
"$['products'][2]['media']": {
|
|
374
|
-
source: {
|
|
375
|
-
document: 2,
|
|
376
|
-
path: 6,
|
|
377
|
-
type: 'documentValue',
|
|
378
|
-
},
|
|
379
|
-
type: 'value',
|
|
380
|
-
},
|
|
381
|
-
"$['products'][2]['slug']": {
|
|
382
|
-
source: {
|
|
383
|
-
document: 2,
|
|
384
|
-
path: 1,
|
|
385
|
-
type: 'documentValue',
|
|
386
|
-
},
|
|
387
|
-
type: 'value',
|
|
388
|
-
},
|
|
389
|
-
"$['products'][2]['title']": {
|
|
390
|
-
source: {
|
|
391
|
-
document: 2,
|
|
392
|
-
path: 4,
|
|
393
|
-
type: 'documentValue',
|
|
394
|
-
},
|
|
395
|
-
type: 'value',
|
|
396
|
-
},
|
|
397
|
-
"$['products'][3]['_id']": {
|
|
398
|
-
source: {
|
|
399
|
-
document: 3,
|
|
400
|
-
path: 3,
|
|
401
|
-
type: 'documentValue',
|
|
402
|
-
},
|
|
403
|
-
type: 'value',
|
|
404
|
-
},
|
|
405
|
-
"$['products'][3]['description']": {
|
|
406
|
-
source: {
|
|
407
|
-
document: 3,
|
|
408
|
-
path: 0,
|
|
409
|
-
type: 'documentValue',
|
|
410
|
-
},
|
|
411
|
-
type: 'value',
|
|
412
|
-
},
|
|
413
|
-
"$['products'][3]['media']": {
|
|
414
|
-
source: {
|
|
415
|
-
document: 3,
|
|
416
|
-
path: 7,
|
|
417
|
-
type: 'documentValue',
|
|
418
|
-
},
|
|
419
|
-
type: 'value',
|
|
420
|
-
},
|
|
421
|
-
"$['products'][3]['slug']": {
|
|
422
|
-
source: {
|
|
423
|
-
document: 3,
|
|
424
|
-
path: 1,
|
|
425
|
-
type: 'documentValue',
|
|
426
|
-
},
|
|
427
|
-
type: 'value',
|
|
428
|
-
},
|
|
429
|
-
"$['products'][3]['title']": {
|
|
430
|
-
source: {
|
|
431
|
-
document: 3,
|
|
432
|
-
path: 4,
|
|
433
|
-
type: 'documentValue',
|
|
434
|
-
},
|
|
435
|
-
type: 'value',
|
|
436
|
-
},
|
|
437
|
-
"$['products'][4]['_id']": {
|
|
438
|
-
source: {
|
|
439
|
-
document: 4,
|
|
440
|
-
path: 3,
|
|
441
|
-
type: 'documentValue',
|
|
442
|
-
},
|
|
443
|
-
type: 'value',
|
|
444
|
-
},
|
|
445
|
-
"$['products'][4]['description']": {
|
|
446
|
-
source: {
|
|
447
|
-
document: 4,
|
|
448
|
-
path: 0,
|
|
449
|
-
type: 'documentValue',
|
|
450
|
-
},
|
|
451
|
-
type: 'value',
|
|
452
|
-
},
|
|
453
|
-
"$['products'][4]['media']": {
|
|
454
|
-
source: {
|
|
455
|
-
document: 4,
|
|
456
|
-
path: 8,
|
|
457
|
-
type: 'documentValue',
|
|
458
|
-
},
|
|
459
|
-
type: 'value',
|
|
460
|
-
},
|
|
461
|
-
"$['products'][4]['slug']": {
|
|
462
|
-
source: {
|
|
463
|
-
document: 4,
|
|
464
|
-
path: 1,
|
|
465
|
-
type: 'documentValue',
|
|
466
|
-
},
|
|
467
|
-
type: 'value',
|
|
468
|
-
},
|
|
469
|
-
"$['products'][4]['title']": {
|
|
470
|
-
source: {
|
|
471
|
-
document: 4,
|
|
472
|
-
path: 4,
|
|
473
|
-
type: 'documentValue',
|
|
474
|
-
},
|
|
475
|
-
type: 'value',
|
|
476
|
-
},
|
|
477
|
-
"$['siteSettings']['copyrightText']": {
|
|
478
|
-
source: {
|
|
479
|
-
document: 5,
|
|
480
|
-
path: 9,
|
|
481
|
-
type: 'documentValue',
|
|
482
|
-
},
|
|
483
|
-
type: 'value',
|
|
484
|
-
},
|
|
485
|
-
"$['siteSettings']['title']": {
|
|
486
|
-
source: {
|
|
487
|
-
document: 5,
|
|
488
|
-
path: 4,
|
|
489
|
-
type: 'documentValue',
|
|
490
|
-
},
|
|
491
|
-
type: 'value',
|
|
492
|
-
},
|
|
493
|
-
},
|
|
494
|
-
},
|
|
495
|
-
ms: 40,
|
|
496
|
-
} satisfies {
|
|
497
|
-
query: string
|
|
498
|
-
result: unknown
|
|
499
|
-
resultSourceMap: ContentSourceMap
|
|
500
|
-
ms: number
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
const cases = [
|
|
504
|
-
{
|
|
505
|
-
path: 'products[0].title',
|
|
506
|
-
studioUrl: 'https://test.sanity.studio',
|
|
507
|
-
expected:
|
|
508
|
-
'https://test.sanity.studio/intent/edit/id=462efcc6-3c8b-47c6-8474-5544e1a4acde;type=product;path=title?baseUrl=https://test.sanity.studio&projectId=production&dataset=abc123&id=462efcc6-3c8b-47c6-8474-5544e1a4acde&type=product&path=title',
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
path: 'products[0].media.alt',
|
|
512
|
-
studioUrl: '/',
|
|
513
|
-
expected:
|
|
514
|
-
'/intent/edit/id=462efcc6-3c8b-47c6-8474-5544e1a4acde;type=product;path=media[_key=="cee5fbb69da2"].alt?baseUrl=/&projectId=production&dataset=abc123&id=462efcc6-3c8b-47c6-8474-5544e1a4acde&type=product&path=media[_key=="cee5fbb69da2"].alt',
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
path: 'products[0].description[0].children[0].text',
|
|
518
|
-
studioUrl: '/',
|
|
519
|
-
expected:
|
|
520
|
-
'/intent/edit/id=462efcc6-3c8b-47c6-8474-5544e1a4acde;type=product;path=description[0].children[0].text?baseUrl=/&projectId=production&dataset=abc123&id=462efcc6-3c8b-47c6-8474-5544e1a4acde&type=product&path=description[0].children[0].text',
|
|
521
|
-
},
|
|
522
|
-
]
|
|
523
|
-
|
|
524
|
-
test.each(cases)('resolveEditUrl $path', ({path, studioUrl, expected}) => {
|
|
525
|
-
const {resultSourceMap} = mock
|
|
526
|
-
expect(
|
|
527
|
-
decodeURIComponent(
|
|
528
|
-
resolveEditUrl({
|
|
529
|
-
projectId,
|
|
530
|
-
dataset,
|
|
531
|
-
studioUrl,
|
|
532
|
-
resultSourceMap,
|
|
533
|
-
resultPath: path,
|
|
534
|
-
})!,
|
|
535
|
-
),
|
|
536
|
-
).toEqual(expected)
|
|
537
|
-
})
|