@sanity/client 6.13.3 → 6.14.1
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/_chunks/{browserMiddleware--4iEqxOv.js → browserMiddleware-DhUBf_19.js} +197 -358
- package/dist/_chunks/{browserMiddleware--4iEqxOv.js.map → browserMiddleware-DhUBf_19.js.map} +1 -1
- package/dist/_chunks/{browserMiddleware-3B0LRN1j.cjs → browserMiddleware-FpdqDQ1o.cjs} +197 -358
- package/dist/_chunks/{browserMiddleware-3B0LRN1j.cjs.map → browserMiddleware-FpdqDQ1o.cjs.map} +1 -1
- package/dist/_chunks/{nodeMiddleware-CpwnMbUW.js → nodeMiddleware-BSZoKrW0.js} +199 -360
- package/dist/_chunks/{nodeMiddleware-CpwnMbUW.js.map → nodeMiddleware-BSZoKrW0.js.map} +1 -1
- package/dist/_chunks/{nodeMiddleware-ClJKodBZ.cjs → nodeMiddleware-DmcqX3kz.cjs} +199 -360
- package/dist/_chunks/{nodeMiddleware-ClJKodBZ.cjs.map → nodeMiddleware-DmcqX3kz.cjs.map} +1 -1
- package/dist/_chunks/{resolveEditInfo-CkO-V0Hb.cjs → resolveEditInfo-BB1WiUDY.cjs} +34 -24
- package/dist/_chunks/resolveEditInfo-BB1WiUDY.cjs.map +1 -0
- package/dist/_chunks/{resolveEditInfo-BC6qdqZw.js → resolveEditInfo-Cf8D1Agp.js} +34 -24
- package/dist/_chunks/resolveEditInfo-Cf8D1Agp.js.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-DYge0fQ_.cjs → stegaEncodeSourceMap-8TjLXjYU.cjs} +13 -12
- package/dist/_chunks/stegaEncodeSourceMap-8TjLXjYU.cjs.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-VuriKnxL.cjs → stegaEncodeSourceMap-DIcuvN0P.cjs} +39 -30
- package/dist/_chunks/stegaEncodeSourceMap-DIcuvN0P.cjs.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-D3O62d5b.js → stegaEncodeSourceMap-DLon0Yls.js} +39 -30
- package/dist/_chunks/stegaEncodeSourceMap-DLon0Yls.js.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-Do2NcGKy.js → stegaEncodeSourceMap-DU95idpa.js} +13 -12
- package/dist/_chunks/stegaEncodeSourceMap-DU95idpa.js.map +1 -0
- package/dist/csm.cjs +3 -3
- package/dist/csm.cjs.map +1 -1
- package/dist/csm.d.ts +2 -0
- package/dist/csm.js +4 -4
- package/dist/csm.js.map +1 -1
- package/dist/index.browser.cjs +1 -1
- package/dist/index.browser.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -2
- package/dist/stega.browser.cjs +2 -2
- package/dist/stega.browser.js +3 -3
- package/dist/stega.cjs +2 -2
- package/dist/stega.d.ts +4 -0
- package/dist/stega.js +3 -3
- package/package.json +11 -11
- package/src/csm/createEditUrl.ts +8 -0
- package/src/csm/resolveEditInfo.ts +3 -1
- package/src/csm/types.ts +2 -0
- package/src/stega/stegaEncodeSourceMap.ts +2 -1
- package/src/stega/types.ts +4 -0
- package/umd/sanityClient.js +2603 -2779
- package/umd/sanityClient.min.js +3 -3
- package/dist/_chunks/resolveEditInfo-BC6qdqZw.js.map +0 -1
- package/dist/_chunks/resolveEditInfo-CkO-V0Hb.cjs.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-D3O62d5b.js.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-DYge0fQ_.cjs.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-Do2NcGKy.js.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-VuriKnxL.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b } from './nodeMiddleware-
|
|
2
|
-
import { walkMap, resolveMapping, parseJsonPath, resolveStudioBaseRoute, createEditUrl, reKeySegment, toString, jsonPathToStudioPath } from './resolveEditInfo-
|
|
1
|
+
import { b } from './nodeMiddleware-BSZoKrW0.js';
|
|
2
|
+
import { walkMap, resolveMapping, parseJsonPath, resolveStudioBaseRoute, createEditUrl, reKeySegment, toString, jsonPathToStudioPath } from './resolveEditInfo-Cf8D1Agp.js';
|
|
3
3
|
|
|
4
4
|
function encodeIntoResult(result, csm, encoder) {
|
|
5
5
|
return walkMap(result, (value, path) => {
|
|
@@ -119,7 +119,7 @@ function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
|
|
119
119
|
const { filter, logger, enabled } = config;
|
|
120
120
|
if (!enabled) {
|
|
121
121
|
const msg = "config.enabled must be true, don't call this function otherwise";
|
|
122
|
-
(_a = logger == null ? void 0 : logger.error) == null ? void 0 : _a.call(logger,
|
|
122
|
+
(_a = logger == null ? void 0 : logger.error) == null ? void 0 : _a.call(logger, `[@sanity/client]: ${msg}`, { result, resultSourceMap, config });
|
|
123
123
|
throw new TypeError(msg);
|
|
124
124
|
}
|
|
125
125
|
if (!resultSourceMap) {
|
|
@@ -132,7 +132,7 @@ function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
|
|
132
132
|
}
|
|
133
133
|
if (!config.studioUrl) {
|
|
134
134
|
const msg = "config.studioUrl must be defined";
|
|
135
|
-
(_c = logger == null ? void 0 : logger.error) == null ? void 0 : _c.call(logger,
|
|
135
|
+
(_c = logger == null ? void 0 : logger.error) == null ? void 0 : _c.call(logger, `[@sanity/client]: ${msg}`, { result, resultSourceMap, config });
|
|
136
136
|
throw new TypeError(msg);
|
|
137
137
|
}
|
|
138
138
|
const report = {
|
|
@@ -147,7 +147,7 @@ function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
|
|
147
147
|
if (logger) {
|
|
148
148
|
report.skipped.push({
|
|
149
149
|
path: prettyPathForLogging(sourcePath),
|
|
150
|
-
value:
|
|
150
|
+
value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? "..." : ""}`,
|
|
151
151
|
length: value.length
|
|
152
152
|
});
|
|
153
153
|
}
|
|
@@ -156,7 +156,7 @@ function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
|
|
156
156
|
if (logger) {
|
|
157
157
|
report.encoded.push({
|
|
158
158
|
path: prettyPathForLogging(sourcePath),
|
|
159
|
-
value:
|
|
159
|
+
value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? "..." : ""}`,
|
|
160
160
|
length: value.length
|
|
161
161
|
});
|
|
162
162
|
}
|
|
@@ -165,7 +165,7 @@ function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
|
|
165
165
|
);
|
|
166
166
|
if (!baseUrl)
|
|
167
167
|
return value;
|
|
168
|
-
const { _id: id, _type: type } = sourceDocument;
|
|
168
|
+
const { _id: id, _type: type, _projectId: projectId, _dataset: dataset } = sourceDocument;
|
|
169
169
|
return b(
|
|
170
170
|
value,
|
|
171
171
|
{
|
|
@@ -176,7 +176,8 @@ function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
|
|
176
176
|
tool,
|
|
177
177
|
id,
|
|
178
178
|
type,
|
|
179
|
-
path: sourcePath
|
|
179
|
+
path: sourcePath,
|
|
180
|
+
...!config.omitCrossDatasetReferenceData && { dataset, projectId }
|
|
180
181
|
})
|
|
181
182
|
},
|
|
182
183
|
// We use custom logic to determine if we should skip encoding
|
|
@@ -191,11 +192,11 @@ function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
|
|
191
192
|
(_d = (logger == null ? void 0 : logger.groupCollapsed) || logger.log) == null ? void 0 : _d("[@sanity/client]: Encoding source map into result");
|
|
192
193
|
(_e = logger.log) == null ? void 0 : _e.call(
|
|
193
194
|
logger,
|
|
194
|
-
|
|
195
|
+
`[@sanity/client]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`
|
|
195
196
|
);
|
|
196
197
|
}
|
|
197
198
|
if (report.encoded.length > 0) {
|
|
198
|
-
(_f = logger == null ? void 0 : logger.log) == null ? void 0 : _f.call(logger,
|
|
199
|
+
(_f = logger == null ? void 0 : logger.log) == null ? void 0 : _f.call(logger, `[@sanity/client]: Table of encoded paths`);
|
|
199
200
|
(_g = (logger == null ? void 0 : logger.table) || logger.log) == null ? void 0 : _g(report.encoded);
|
|
200
201
|
}
|
|
201
202
|
if (report.skipped.length > 0) {
|
|
@@ -203,7 +204,7 @@ function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
|
|
203
204
|
for (const { path } of report.skipped) {
|
|
204
205
|
skipped.add(path.replace(reKeySegment, "0").replace(/\[\d+\]/g, "[]"));
|
|
205
206
|
}
|
|
206
|
-
(_h = logger == null ? void 0 : logger.log) == null ? void 0 : _h.call(logger,
|
|
207
|
+
(_h = logger == null ? void 0 : logger.log) == null ? void 0 : _h.call(logger, `[@sanity/client]: List of skipped paths`, [...skipped.values()]);
|
|
207
208
|
}
|
|
208
209
|
if (isSkipping || isEncoding) {
|
|
209
210
|
(_i = logger == null ? void 0 : logger.groupEnd) == null ? void 0 : _i.call(logger);
|
|
@@ -221,4 +222,4 @@ var stegaEncodeSourceMap$1 = /*#__PURE__*/Object.freeze({
|
|
|
221
222
|
});
|
|
222
223
|
|
|
223
224
|
export { encodeIntoResult, stegaEncodeSourceMap, stegaEncodeSourceMap$1 };
|
|
224
|
-
//# sourceMappingURL=stegaEncodeSourceMap-
|
|
225
|
+
//# sourceMappingURL=stegaEncodeSourceMap-DU95idpa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stegaEncodeSourceMap-DU95idpa.js","sources":["../../src/stega/encodeIntoResult.ts","../../src/stega/filterDefault.ts","../../src/stega/stegaEncodeSourceMap.ts"],"sourcesContent":["import {parseJsonPath} from '../csm/jsonPath'\nimport {resolveMapping} from '../csm/resolveMapping'\nimport type {ContentSourceMap} from '../csm/types'\nimport {walkMap} from '../csm/walkMap'\nimport type {Encoder} from './types'\n\n/**\n * @internal\n */\nexport function encodeIntoResult<Result>(\n result: Result,\n csm: ContentSourceMap,\n encoder: Encoder,\n): Result {\n return walkMap(result, (value, path) => {\n // Only map strings, we could extend this in the future to support other types like integers...\n if (typeof value !== 'string') {\n return value\n }\n\n const resolveMappingResult = resolveMapping(path, csm)\n if (!resolveMappingResult) {\n return value\n }\n\n const {mapping, matchedPath} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = csm.documents[mapping.source.document!]\n const sourcePath = csm.paths[mapping.source.path]\n\n const matchPathSegments = parseJsonPath(matchedPath)\n const sourcePathSegments = parseJsonPath(sourcePath)\n const fullSourceSegments = sourcePathSegments.concat(path.slice(matchPathSegments.length))\n\n return encoder({\n sourcePath: fullSourceSegments,\n sourceDocument,\n resultPath: path,\n value,\n })\n }) as Result\n}\n","import type {FilterDefault} from './types'\n\nexport const filterDefault: FilterDefault = ({sourcePath, value}) => {\n // Skips encoding on URL or Date strings, similar to the `skip: 'auto'` parameter in vercelStegaCombine()\n if (isValidDate(value) || isValidURL(value)) {\n return false\n }\n\n const endPath = sourcePath.at(-1)\n // Never encode slugs\n if (sourcePath.at(-2) === 'slug' && endPath === 'current') {\n return false\n }\n\n // Skip underscored keys, needs better heuristics but it works for now\n if (typeof endPath === 'string' && endPath.startsWith('_')) {\n return false\n }\n\n /**\n * Best effort infer Portable Text paths that should not be encoded.\n * Nothing is for certain, and the below implementation may cause paths that aren't Portable Text and otherwise be safe to encode to be skipped.\n * However, that's ok as userland can always opt-in with the `encodeSourceMapAtPath` option and mark known safe paths as such, which will override this heuristic.\n */\n // If the path ends in marks[number] it's likely a PortableTextSpan: https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#LL154C16-L154C16\n if (typeof endPath === 'number' && sourcePath.at(-2) === 'marks') {\n return false\n }\n // Or if it's [number].markDefs[number].href it's likely a PortableTextLink: https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#L163\n if (\n endPath === 'href' &&\n typeof sourcePath.at(-2) === 'number' &&\n sourcePath.at(-3) === 'markDefs'\n ) {\n return false\n }\n // Otherwise we have to deal with special properties of PortableTextBlock, and we can't confidently know if it's actually a `_type: 'block'` array item or not.\n // All we know is that if it is indeed a block, and we encode the strings on these keys it'll for sure break the PortableText rendering and thus we skip encoding.\n // https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#L48-L58\n if (endPath === 'style' || endPath === 'listItem') {\n return false\n }\n\n // Don't encode into anything that is suggested it'll render for SEO in meta tags\n if (\n sourcePath.some(\n (path) => path === 'meta' || path === 'metadata' || path === 'openGraph' || path === 'seo',\n )\n ) {\n return false\n }\n\n // Finally, we ignore a bunch of paths that are typically used for page building\n if (typeof endPath === 'string' && denylist.has(endPath)) {\n return false\n }\n\n return true\n}\n\nconst denylist = new Set([\n 'color',\n 'colour',\n 'currency',\n 'email',\n 'format',\n 'gid',\n 'hex',\n 'href',\n 'hsl',\n 'hsla',\n 'icon',\n 'id',\n 'index',\n 'key',\n 'language',\n 'layout',\n 'link',\n 'linkAction',\n 'locale',\n 'lqip',\n 'page',\n 'path',\n 'ref',\n 'rgb',\n 'rgba',\n 'route',\n 'secret',\n 'slug',\n 'status',\n 'tag',\n 'template',\n 'theme',\n 'type',\n 'unit',\n 'url',\n 'username',\n 'variant',\n 'website',\n])\n\nfunction isValidDate(dateString: string) {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(dateString) ? Boolean(Date.parse(dateString)) : false\n}\n\nfunction isValidURL(url: string) {\n try {\n new URL(url, url.startsWith('/') ? 'https://acme.com' : undefined)\n } catch {\n return false\n }\n return true\n}\n","import {vercelStegaCombine} from '@vercel/stega'\n\nimport {createEditUrl} from '../csm/createEditUrl'\nimport {jsonPathToStudioPath} from '../csm/jsonPath'\nimport {resolveStudioBaseRoute} from '../csm/resolveEditInfo'\nimport {reKeySegment, toString as studioPathToString} from '../csm/studioPath'\nimport {encodeIntoResult} from './encodeIntoResult'\nimport {filterDefault} from './filterDefault'\nimport {ContentSourceMap, ContentSourceMapParsedPath, InitializedStegaConfig} from './types'\n\nconst TRUNCATE_LENGTH = 20\n\n/**\n * Uses `@vercel/stega` to embed edit info JSON into strings in your query result.\n * The JSON payloads are added using invisible characters so they don't show up visually.\n * The edit info is generated from the Content Source Map (CSM) that is returned from Sanity for the query.\n * @public\n */\nexport function stegaEncodeSourceMap<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n config: InitializedStegaConfig,\n): Result {\n const {filter, logger, enabled} = config\n if (!enabled) {\n const msg = \"config.enabled must be true, don't call this function otherwise\"\n logger?.error?.(`[@sanity/client]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n if (!resultSourceMap) {\n logger?.error?.('[@sanity/client]: Missing Content Source Map from response body', {\n result,\n resultSourceMap,\n config,\n })\n return result\n }\n\n if (!config.studioUrl) {\n const msg = 'config.studioUrl must be defined'\n logger?.error?.(`[@sanity/client]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n const report: Record<'encoded' | 'skipped', {path: string; length: number; value: string}[]> = {\n encoded: [],\n skipped: [],\n }\n\n const resultWithStega = encodeIntoResult(\n result,\n resultSourceMap,\n ({sourcePath, sourceDocument, resultPath, value}) => {\n // Allow userland to control when to opt-out of encoding\n if (\n (typeof filter === 'function'\n ? filter({sourcePath, resultPath, filterDefault, sourceDocument, value})\n : filterDefault({sourcePath, resultPath, filterDefault, sourceDocument, value})) === false\n ) {\n if (logger) {\n report.skipped.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${\n value.length > TRUNCATE_LENGTH ? '...' : ''\n }`,\n length: value.length,\n })\n }\n return value\n }\n\n if (logger) {\n report.encoded.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? '...' : ''}`,\n length: value.length,\n })\n }\n\n const {baseUrl, workspace, tool} = resolveStudioBaseRoute(\n typeof config.studioUrl === 'function'\n ? config.studioUrl(sourceDocument)\n : config.studioUrl!,\n )\n if (!baseUrl) return value\n const {_id: id, _type: type, _projectId: projectId, _dataset: dataset} = sourceDocument\n\n return vercelStegaCombine(\n value,\n {\n origin: 'sanity.io',\n href: createEditUrl({\n baseUrl,\n workspace,\n tool,\n id,\n type,\n path: sourcePath,\n ...(!config.omitCrossDatasetReferenceData && {dataset, projectId}),\n }),\n },\n // We use custom logic to determine if we should skip encoding\n false,\n )\n },\n )\n\n if (logger) {\n const isSkipping = report.skipped.length\n const isEncoding = report.encoded.length\n if (isSkipping || isEncoding) {\n ;(logger?.groupCollapsed || logger.log)?.('[@sanity/client]: Encoding source map into result')\n logger.log?.(\n `[@sanity/client]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`,\n )\n }\n if (report.encoded.length > 0) {\n logger?.log?.(`[@sanity/client]: Table of encoded paths`)\n ;(logger?.table || logger.log)?.(report.encoded)\n }\n if (report.skipped.length > 0) {\n const skipped = new Set<string>()\n for (const {path} of report.skipped) {\n skipped.add(path.replace(reKeySegment, '0').replace(/\\[\\d+\\]/g, '[]'))\n }\n logger?.log?.(`[@sanity/client]: List of skipped paths`, [...skipped.values()])\n }\n\n if (isSkipping || isEncoding) {\n logger?.groupEnd?.()\n }\n }\n\n return resultWithStega\n}\n\nfunction prettyPathForLogging(path: ContentSourceMapParsedPath): string {\n return studioPathToString(jsonPathToStudioPath(path))\n}\n"],"names":["vercelStegaCombine","studioPathToString"],"mappings":";;;AASgB,SAAA,gBAAA,CACd,MACA,EAAA,GAAA,EACA,OACQ,EAAA;AACR,EAAA,OAAO,OAAQ,CAAA,MAAA,EAAQ,CAAC,KAAA,EAAO,IAAS,KAAA;AAEtC,IAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAM,MAAA,oBAAA,GAAuB,cAAe,CAAA,IAAA,EAAM,GAAG,CAAA,CA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AO,OAAAC,QAAA,CAAmB,oBAAqB,CAAA,IAAI,CAAC,CAAA,CAAA;AACtD;;;;;;;;;"}
|
package/dist/csm.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var resolveEditInfo = require('./_chunks/resolveEditInfo-
|
|
5
|
+
var resolveEditInfo = require('./_chunks/resolveEditInfo-BB1WiUDY.cjs');
|
|
6
6
|
|
|
7
7
|
const defaultUpdateFunction = (changed) => changed;
|
|
8
8
|
function applySourceDocuments(result, resultSourceMap, getCachedDocument, updateFn = defaultUpdateFunction, perspective = "raw") {
|
|
9
9
|
if (!resultSourceMap)
|
|
10
10
|
return result;
|
|
11
11
|
if (perspective !== "published" && perspective !== "raw" && perspective !== "previewDrafts") {
|
|
12
|
-
throw new Error(
|
|
12
|
+
throw new Error(`Unknown perspective "${perspective}"`);
|
|
13
13
|
}
|
|
14
14
|
return resolveEditInfo.walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {
|
|
15
15
|
const resolveMappingResult = resolveEditInfo.resolveMapping(path, resultSourceMap);
|
|
@@ -34,7 +34,7 @@ function applySourceDocuments(result, resultSourceMap, getCachedDocument, update
|
|
|
34
34
|
let cachedDocument;
|
|
35
35
|
if (perspective === "previewDrafts") {
|
|
36
36
|
cachedDocument = getCachedDocument(
|
|
37
|
-
sourceDocument._id.startsWith(resolveEditInfo.DRAFTS_PREFIX) ? sourceDocument : { ...sourceDocument, _id:
|
|
37
|
+
sourceDocument._id.startsWith(resolveEditInfo.DRAFTS_PREFIX) ? sourceDocument : { ...sourceDocument, _id: `${resolveEditInfo.DRAFTS_PREFIX}.${sourceDocument._id}}` }
|
|
38
38
|
);
|
|
39
39
|
if (!cachedDocument) {
|
|
40
40
|
cachedDocument = getCachedDocument(
|
package/dist/csm.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csm.cjs","sources":["../src/csm/applySourceDocuments.ts","../src/csm/resolvedKeyedSourcePath.ts","../src/csm/resolveEditUrl.ts"],"sourcesContent":["import {DRAFTS_PREFIX, getPublishedId} from './getPublishedId'\nimport {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport * as paths from './studioPath'\nimport type {\n Any,\n ApplySourceDocumentsUpdateFunction,\n ClientPerspective,\n ContentSourceMap,\n ContentSourceMapDocuments,\n Path,\n SanityDocument,\n} from './types'\nimport {walkMap} from './walkMap'\n\nconst defaultUpdateFunction = <T = unknown>(changed: T): T => changed\n\n/**\n * Optimistically applies source documents to a result, using the content source map to trace fields.\n * 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.\n * @alpha\n */\nexport function applySourceDocuments<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) => Partial<SanityDocument> | null | undefined,\n updateFn: ApplySourceDocumentsUpdateFunction = defaultUpdateFunction,\n perspective: ClientPerspective = 'raw',\n): Result {\n if (!resultSourceMap) return result\n\n if (perspective !== 'published' && perspective !== 'raw' && perspective !== 'previewDrafts') {\n throw new Error(`Unknown perspective \"${perspective}\"`)\n }\n\n return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {\n const resolveMappingResult = resolveMapping(path, resultSourceMap)\n if (!resolveMappingResult) {\n // console.warn('no mapping for path', path)\n return value\n }\n\n const {mapping, pathSuffix} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = resultSourceMap.documents[mapping.source.document]\n const sourcePath = resultSourceMap.paths[mapping.source.path]\n\n if (sourceDocument) {\n const parsedPath = parseJsonPath(sourcePath + pathSuffix)\n const stringifiedPath = paths.toString(parsedPath as Path)\n\n // The _id is sometimes used used as `key` in lists, and should not be changed optimistically\n if (stringifiedPath === '_id') {\n return value\n }\n\n let cachedDocument: Partial<SanityDocument> | null | undefined\n if (perspective === 'previewDrafts') {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? sourceDocument\n : {...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}`},\n )\n if (!cachedDocument) {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? {...sourceDocument, _id: getPublishedId(sourceDocument._id)}\n : sourceDocument,\n )\n }\n if (cachedDocument) {\n cachedDocument = {\n ...cachedDocument,\n _id: getPublishedId(sourceDocument._id),\n _originalId: sourceDocument._id,\n }\n }\n } else {\n cachedDocument = getCachedDocument(sourceDocument)\n }\n\n if (!cachedDocument) {\n return value\n }\n\n const changedValue = cachedDocument\n ? paths.get<Result[keyof Result]>(cachedDocument, stringifiedPath, value)\n : value\n return value === changedValue\n ? value\n : updateFn<Result[keyof Result]>(changedValue as Any, {\n cachedDocument,\n previousValue: value as Result[keyof Result],\n sourceDocument,\n sourcePath: parsedPath,\n })\n }\n\n return value\n }) as Result\n}\n","import {jsonPath, parseJsonPath} from './jsonPath'\nimport type {ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolvedKeyedSourcePath(options: {\n keyedResultPath: ContentSourceMapParsedPath\n pathSuffix?: string\n sourceBasePath: string\n}): ContentSourceMapParsedPath {\n const {keyedResultPath, pathSuffix, sourceBasePath} = options\n\n const inferredResultPath = pathSuffix === undefined ? [] : parseJsonPath(pathSuffix)\n\n const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length)\n\n const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : ''\n\n return parseJsonPath(sourceBasePath + inferredPathSuffix)\n}\n","import {createEditUrl} from './createEditUrl'\nimport {studioPathToJsonPath} from './jsonPath'\nimport {resolveEditInfo} from './resolveEditInfo'\nimport type {ResolveEditUrlOptions} from './types'\n\n/** @alpha */\nexport function resolveEditUrl(\n options: ResolveEditUrlOptions,\n): ReturnType<typeof createEditUrl> | undefined {\n const {resultSourceMap, studioUrl} = options\n const resultPath = studioPathToJsonPath(options.resultPath)\n\n const editInfo = resolveEditInfo({\n resultPath,\n resultSourceMap,\n studioUrl,\n })\n if (!editInfo) {\n return undefined\n }\n\n return createEditUrl(editInfo)\n}\n"],"names":["walkMap","resolveMapping","parseJsonPath","paths.toString","DRAFTS_PREFIX","getPublishedId","paths.get","jsonPath","studioPathToJsonPath","resolveEditInfo","createEditUrl"],"mappings":";;;;;;AAeA,MAAM,qBAAA,GAAwB,CAAc,OAAkB,KAAA,OAAA,CAAA;AAOvD,SAAS,qBACd,MACA,EAAA,eAAA,EACA,mBAGA,QAA+C,GAAA,qBAAA,EAC/C,cAAiC,KACzB,EAAA;AACR,EAAA,IAAI,CAAC,eAAA;AAAiB,IAAO,OAAA,MAAA,CAAA;AAE7B,EAAA,IAAI,WAAgB,KAAA,WAAA,IAAe,WAAgB,KAAA,KAAA,IAAS,gBAAgB,eAAiB,EAAA;AAC3F,IAAA,MAAM,IAAI,KAAA,CAAM,
|
|
1
|
+
{"version":3,"file":"csm.cjs","sources":["../src/csm/applySourceDocuments.ts","../src/csm/resolvedKeyedSourcePath.ts","../src/csm/resolveEditUrl.ts"],"sourcesContent":["import {DRAFTS_PREFIX, getPublishedId} from './getPublishedId'\nimport {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport * as paths from './studioPath'\nimport type {\n Any,\n ApplySourceDocumentsUpdateFunction,\n ClientPerspective,\n ContentSourceMap,\n ContentSourceMapDocuments,\n Path,\n SanityDocument,\n} from './types'\nimport {walkMap} from './walkMap'\n\nconst defaultUpdateFunction = <T = unknown>(changed: T): T => changed\n\n/**\n * Optimistically applies source documents to a result, using the content source map to trace fields.\n * 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.\n * @alpha\n */\nexport function applySourceDocuments<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) => Partial<SanityDocument> | null | undefined,\n updateFn: ApplySourceDocumentsUpdateFunction = defaultUpdateFunction,\n perspective: ClientPerspective = 'raw',\n): Result {\n if (!resultSourceMap) return result\n\n if (perspective !== 'published' && perspective !== 'raw' && perspective !== 'previewDrafts') {\n throw new Error(`Unknown perspective \"${perspective}\"`)\n }\n\n return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {\n const resolveMappingResult = resolveMapping(path, resultSourceMap)\n if (!resolveMappingResult) {\n // console.warn('no mapping for path', path)\n return value\n }\n\n const {mapping, pathSuffix} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = resultSourceMap.documents[mapping.source.document]\n const sourcePath = resultSourceMap.paths[mapping.source.path]\n\n if (sourceDocument) {\n const parsedPath = parseJsonPath(sourcePath + pathSuffix)\n const stringifiedPath = paths.toString(parsedPath as Path)\n\n // The _id is sometimes used used as `key` in lists, and should not be changed optimistically\n if (stringifiedPath === '_id') {\n return value\n }\n\n let cachedDocument: Partial<SanityDocument> | null | undefined\n if (perspective === 'previewDrafts') {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? sourceDocument\n : {...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}`},\n )\n if (!cachedDocument) {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? {...sourceDocument, _id: getPublishedId(sourceDocument._id)}\n : sourceDocument,\n )\n }\n if (cachedDocument) {\n cachedDocument = {\n ...cachedDocument,\n _id: getPublishedId(sourceDocument._id),\n _originalId: sourceDocument._id,\n }\n }\n } else {\n cachedDocument = getCachedDocument(sourceDocument)\n }\n\n if (!cachedDocument) {\n return value\n }\n\n const changedValue = cachedDocument\n ? paths.get<Result[keyof Result]>(cachedDocument, stringifiedPath, value)\n : value\n return value === changedValue\n ? value\n : updateFn<Result[keyof Result]>(changedValue as Any, {\n cachedDocument,\n previousValue: value as Result[keyof Result],\n sourceDocument,\n sourcePath: parsedPath,\n })\n }\n\n return value\n }) as Result\n}\n","import {jsonPath, parseJsonPath} from './jsonPath'\nimport type {ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolvedKeyedSourcePath(options: {\n keyedResultPath: ContentSourceMapParsedPath\n pathSuffix?: string\n sourceBasePath: string\n}): ContentSourceMapParsedPath {\n const {keyedResultPath, pathSuffix, sourceBasePath} = options\n\n const inferredResultPath = pathSuffix === undefined ? [] : parseJsonPath(pathSuffix)\n\n const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length)\n\n const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : ''\n\n return parseJsonPath(sourceBasePath + inferredPathSuffix)\n}\n","import {createEditUrl} from './createEditUrl'\nimport {studioPathToJsonPath} from './jsonPath'\nimport {resolveEditInfo} from './resolveEditInfo'\nimport type {ResolveEditUrlOptions} from './types'\n\n/** @alpha */\nexport function resolveEditUrl(\n options: ResolveEditUrlOptions,\n): ReturnType<typeof createEditUrl> | undefined {\n const {resultSourceMap, studioUrl} = options\n const resultPath = studioPathToJsonPath(options.resultPath)\n\n const editInfo = resolveEditInfo({\n resultPath,\n resultSourceMap,\n studioUrl,\n })\n if (!editInfo) {\n return undefined\n }\n\n return createEditUrl(editInfo)\n}\n"],"names":["walkMap","resolveMapping","parseJsonPath","paths.toString","DRAFTS_PREFIX","getPublishedId","paths.get","jsonPath","studioPathToJsonPath","resolveEditInfo","createEditUrl"],"mappings":";;;;;;AAeA,MAAM,qBAAA,GAAwB,CAAc,OAAkB,KAAA,OAAA,CAAA;AAOvD,SAAS,qBACd,MACA,EAAA,eAAA,EACA,mBAGA,QAA+C,GAAA,qBAAA,EAC/C,cAAiC,KACzB,EAAA;AACR,EAAA,IAAI,CAAC,eAAA;AAAiB,IAAO,OAAA,MAAA,C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;AAAA,GACR,CAAA,CAAA;AACH;;ACvGO,SAAS,wBAAwB,OAIT,EAAA;AAC7B,EAAA,MAAM,EAAC,eAAA,EAAiB,UAAY,EAAA,cAAA,EAAkB,GAAA,OAAA,CAAA;AAEtD,EAAA,MAAM,qBAAqB,UAAe,KAAA,KAAA,CAAA,GAAY,EAAC,GAAIJ,8BAAc,UAAU,CAAA,CAAA;AAEnF,EAAA,MAAM,eAAe,eAAgB,CAAA,KAAA,CAAM,eAAgB,CAAA,MAAA,GAAS,mBAAmB,MAAM,CAAA,CAAA;AAE7F,EAAM,MAAA,kBAAA,GAAqB,aAAa,MAAS,GAAAK,wBAAA,CAAS,YAAY,CAAE,CAAA,KAAA,CAAM,CAAC,CAAI,GAAA,EAAA,CAAA;AAEnF,EAAO,OAAAL,6BAAA,CAAc,iBAAiB,kBAAkB,CAAA,CAAA;AAC1D;;ACdO,SAAS,eACd,OAC8C,EAAA;AAC9C,EAAM,MAAA,EAAC,eAAiB,EAAA,SAAA,EAAa,GAAA,OAAA,CAAA;AACrC,EAAM,MAAA,UAAA,GAAaM,oCAAqB,CAAA,OAAA,CAAQ,UAAU,CAAA,CAAA;AAE1D,EAAA,MAAM,WAAWC,+BAAgB,CAAA;AAAA,IAC/B,UAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,GACD,CAAA,CAAA;AACD,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAA,OAAOC,8BAAc,QAAQ,CAAA,CAAA;AAC/B;;;;;;;;;;;;;;;;"}
|
package/dist/csm.d.ts
CHANGED
package/dist/csm.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { walkMap, resolveMapping, parseJsonPath, toString, DRAFTS_PREFIX, getPublishedId, get, jsonPath, studioPathToJsonPath, resolveEditInfo, createEditUrl } from './_chunks/resolveEditInfo-
|
|
2
|
-
export { jsonPathToStudioPath, studioPath } from './_chunks/resolveEditInfo-
|
|
1
|
+
import { walkMap, resolveMapping, parseJsonPath, toString, DRAFTS_PREFIX, getPublishedId, get, jsonPath, studioPathToJsonPath, resolveEditInfo, createEditUrl } from './_chunks/resolveEditInfo-Cf8D1Agp.js';
|
|
2
|
+
export { jsonPathToStudioPath, studioPath } from './_chunks/resolveEditInfo-Cf8D1Agp.js';
|
|
3
3
|
|
|
4
4
|
const defaultUpdateFunction = (changed) => changed;
|
|
5
5
|
function applySourceDocuments(result, resultSourceMap, getCachedDocument, updateFn = defaultUpdateFunction, perspective = "raw") {
|
|
6
6
|
if (!resultSourceMap)
|
|
7
7
|
return result;
|
|
8
8
|
if (perspective !== "published" && perspective !== "raw" && perspective !== "previewDrafts") {
|
|
9
|
-
throw new Error(
|
|
9
|
+
throw new Error(`Unknown perspective "${perspective}"`);
|
|
10
10
|
}
|
|
11
11
|
return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {
|
|
12
12
|
const resolveMappingResult = resolveMapping(path, resultSourceMap);
|
|
@@ -31,7 +31,7 @@ function applySourceDocuments(result, resultSourceMap, getCachedDocument, update
|
|
|
31
31
|
let cachedDocument;
|
|
32
32
|
if (perspective === "previewDrafts") {
|
|
33
33
|
cachedDocument = getCachedDocument(
|
|
34
|
-
sourceDocument._id.startsWith(DRAFTS_PREFIX) ? sourceDocument : { ...sourceDocument, _id:
|
|
34
|
+
sourceDocument._id.startsWith(DRAFTS_PREFIX) ? sourceDocument : { ...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}` }
|
|
35
35
|
);
|
|
36
36
|
if (!cachedDocument) {
|
|
37
37
|
cachedDocument = getCachedDocument(
|
package/dist/csm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csm.js","sources":["../src/csm/applySourceDocuments.ts","../src/csm/resolvedKeyedSourcePath.ts","../src/csm/resolveEditUrl.ts"],"sourcesContent":["import {DRAFTS_PREFIX, getPublishedId} from './getPublishedId'\nimport {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport * as paths from './studioPath'\nimport type {\n Any,\n ApplySourceDocumentsUpdateFunction,\n ClientPerspective,\n ContentSourceMap,\n ContentSourceMapDocuments,\n Path,\n SanityDocument,\n} from './types'\nimport {walkMap} from './walkMap'\n\nconst defaultUpdateFunction = <T = unknown>(changed: T): T => changed\n\n/**\n * Optimistically applies source documents to a result, using the content source map to trace fields.\n * 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.\n * @alpha\n */\nexport function applySourceDocuments<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) => Partial<SanityDocument> | null | undefined,\n updateFn: ApplySourceDocumentsUpdateFunction = defaultUpdateFunction,\n perspective: ClientPerspective = 'raw',\n): Result {\n if (!resultSourceMap) return result\n\n if (perspective !== 'published' && perspective !== 'raw' && perspective !== 'previewDrafts') {\n throw new Error(`Unknown perspective \"${perspective}\"`)\n }\n\n return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {\n const resolveMappingResult = resolveMapping(path, resultSourceMap)\n if (!resolveMappingResult) {\n // console.warn('no mapping for path', path)\n return value\n }\n\n const {mapping, pathSuffix} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = resultSourceMap.documents[mapping.source.document]\n const sourcePath = resultSourceMap.paths[mapping.source.path]\n\n if (sourceDocument) {\n const parsedPath = parseJsonPath(sourcePath + pathSuffix)\n const stringifiedPath = paths.toString(parsedPath as Path)\n\n // The _id is sometimes used used as `key` in lists, and should not be changed optimistically\n if (stringifiedPath === '_id') {\n return value\n }\n\n let cachedDocument: Partial<SanityDocument> | null | undefined\n if (perspective === 'previewDrafts') {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? sourceDocument\n : {...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}`},\n )\n if (!cachedDocument) {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? {...sourceDocument, _id: getPublishedId(sourceDocument._id)}\n : sourceDocument,\n )\n }\n if (cachedDocument) {\n cachedDocument = {\n ...cachedDocument,\n _id: getPublishedId(sourceDocument._id),\n _originalId: sourceDocument._id,\n }\n }\n } else {\n cachedDocument = getCachedDocument(sourceDocument)\n }\n\n if (!cachedDocument) {\n return value\n }\n\n const changedValue = cachedDocument\n ? paths.get<Result[keyof Result]>(cachedDocument, stringifiedPath, value)\n : value\n return value === changedValue\n ? value\n : updateFn<Result[keyof Result]>(changedValue as Any, {\n cachedDocument,\n previousValue: value as Result[keyof Result],\n sourceDocument,\n sourcePath: parsedPath,\n })\n }\n\n return value\n }) as Result\n}\n","import {jsonPath, parseJsonPath} from './jsonPath'\nimport type {ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolvedKeyedSourcePath(options: {\n keyedResultPath: ContentSourceMapParsedPath\n pathSuffix?: string\n sourceBasePath: string\n}): ContentSourceMapParsedPath {\n const {keyedResultPath, pathSuffix, sourceBasePath} = options\n\n const inferredResultPath = pathSuffix === undefined ? [] : parseJsonPath(pathSuffix)\n\n const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length)\n\n const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : ''\n\n return parseJsonPath(sourceBasePath + inferredPathSuffix)\n}\n","import {createEditUrl} from './createEditUrl'\nimport {studioPathToJsonPath} from './jsonPath'\nimport {resolveEditInfo} from './resolveEditInfo'\nimport type {ResolveEditUrlOptions} from './types'\n\n/** @alpha */\nexport function resolveEditUrl(\n options: ResolveEditUrlOptions,\n): ReturnType<typeof createEditUrl> | undefined {\n const {resultSourceMap, studioUrl} = options\n const resultPath = studioPathToJsonPath(options.resultPath)\n\n const editInfo = resolveEditInfo({\n resultPath,\n resultSourceMap,\n studioUrl,\n })\n if (!editInfo) {\n return undefined\n }\n\n return createEditUrl(editInfo)\n}\n"],"names":["paths.toString","paths.get"],"mappings":";;;AAeA,MAAM,qBAAA,GAAwB,CAAc,OAAkB,KAAA,OAAA,CAAA;AAOvD,SAAS,qBACd,MACA,EAAA,eAAA,EACA,mBAGA,QAA+C,GAAA,qBAAA,EAC/C,cAAiC,KACzB,EAAA;AACR,EAAA,IAAI,CAAC,eAAA;AAAiB,IAAO,OAAA,MAAA,CAAA;AAE7B,EAAA,IAAI,WAAgB,KAAA,WAAA,IAAe,WAAgB,KAAA,KAAA,IAAS,gBAAgB,eAAiB,EAAA;AAC3F,IAAA,MAAM,IAAI,KAAA,CAAM,
|
|
1
|
+
{"version":3,"file":"csm.js","sources":["../src/csm/applySourceDocuments.ts","../src/csm/resolvedKeyedSourcePath.ts","../src/csm/resolveEditUrl.ts"],"sourcesContent":["import {DRAFTS_PREFIX, getPublishedId} from './getPublishedId'\nimport {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport * as paths from './studioPath'\nimport type {\n Any,\n ApplySourceDocumentsUpdateFunction,\n ClientPerspective,\n ContentSourceMap,\n ContentSourceMapDocuments,\n Path,\n SanityDocument,\n} from './types'\nimport {walkMap} from './walkMap'\n\nconst defaultUpdateFunction = <T = unknown>(changed: T): T => changed\n\n/**\n * Optimistically applies source documents to a result, using the content source map to trace fields.\n * 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.\n * @alpha\n */\nexport function applySourceDocuments<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) => Partial<SanityDocument> | null | undefined,\n updateFn: ApplySourceDocumentsUpdateFunction = defaultUpdateFunction,\n perspective: ClientPerspective = 'raw',\n): Result {\n if (!resultSourceMap) return result\n\n if (perspective !== 'published' && perspective !== 'raw' && perspective !== 'previewDrafts') {\n throw new Error(`Unknown perspective \"${perspective}\"`)\n }\n\n return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {\n const resolveMappingResult = resolveMapping(path, resultSourceMap)\n if (!resolveMappingResult) {\n // console.warn('no mapping for path', path)\n return value\n }\n\n const {mapping, pathSuffix} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = resultSourceMap.documents[mapping.source.document]\n const sourcePath = resultSourceMap.paths[mapping.source.path]\n\n if (sourceDocument) {\n const parsedPath = parseJsonPath(sourcePath + pathSuffix)\n const stringifiedPath = paths.toString(parsedPath as Path)\n\n // The _id is sometimes used used as `key` in lists, and should not be changed optimistically\n if (stringifiedPath === '_id') {\n return value\n }\n\n let cachedDocument: Partial<SanityDocument> | null | undefined\n if (perspective === 'previewDrafts') {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? sourceDocument\n : {...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}`},\n )\n if (!cachedDocument) {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? {...sourceDocument, _id: getPublishedId(sourceDocument._id)}\n : sourceDocument,\n )\n }\n if (cachedDocument) {\n cachedDocument = {\n ...cachedDocument,\n _id: getPublishedId(sourceDocument._id),\n _originalId: sourceDocument._id,\n }\n }\n } else {\n cachedDocument = getCachedDocument(sourceDocument)\n }\n\n if (!cachedDocument) {\n return value\n }\n\n const changedValue = cachedDocument\n ? paths.get<Result[keyof Result]>(cachedDocument, stringifiedPath, value)\n : value\n return value === changedValue\n ? value\n : updateFn<Result[keyof Result]>(changedValue as Any, {\n cachedDocument,\n previousValue: value as Result[keyof Result],\n sourceDocument,\n sourcePath: parsedPath,\n })\n }\n\n return value\n }) as Result\n}\n","import {jsonPath, parseJsonPath} from './jsonPath'\nimport type {ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolvedKeyedSourcePath(options: {\n keyedResultPath: ContentSourceMapParsedPath\n pathSuffix?: string\n sourceBasePath: string\n}): ContentSourceMapParsedPath {\n const {keyedResultPath, pathSuffix, sourceBasePath} = options\n\n const inferredResultPath = pathSuffix === undefined ? [] : parseJsonPath(pathSuffix)\n\n const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length)\n\n const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : ''\n\n return parseJsonPath(sourceBasePath + inferredPathSuffix)\n}\n","import {createEditUrl} from './createEditUrl'\nimport {studioPathToJsonPath} from './jsonPath'\nimport {resolveEditInfo} from './resolveEditInfo'\nimport type {ResolveEditUrlOptions} from './types'\n\n/** @alpha */\nexport function resolveEditUrl(\n options: ResolveEditUrlOptions,\n): ReturnType<typeof createEditUrl> | undefined {\n const {resultSourceMap, studioUrl} = options\n const resultPath = studioPathToJsonPath(options.resultPath)\n\n const editInfo = resolveEditInfo({\n resultPath,\n resultSourceMap,\n studioUrl,\n })\n if (!editInfo) {\n return undefined\n }\n\n return createEditUrl(editInfo)\n}\n"],"names":["paths.toString","paths.get"],"mappings":";;;AAeA,MAAM,qBAAA,GAAwB,CAAc,OAAkB,KAAA,OAAA,CAAA;AAOvD,SAAS,qBACd,MACA,EAAA,eAAA,EACA,mBAGA,QAA+C,GAAA,qBAAA,EAC/C,cAAiC,KACzB,EAAA;AACR,EAAA,IAAI,CAAC,eAAA;AAAiB,IAAO,OAAA,MAAA,CAAA;AAE7B,EAAA,IAAI,WAAgB,KAAA,WAAA,IAAe,WAAgB,KAAA,KAAA,IAAS,gBAAgB,eAAiB,EAAA;AAC3F,IAAA,MAAM,IAAI,KAAA,CAAM,CAAwB,qBAAA,EAAA,WAAW,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GACxD;AAEA,EAAO,OAAA,OAAA,CAAQ,IAAK,CAAA,KAAA,CAAM,IAAK,CAAA,SAAA,CAAU,MAAM,CAAC,CAAA,EAAG,CAAC,KAAA,EAAO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E7F,EAAM,MAAA,kBAAA,GAAqB,aAAa,MAAS,GAAA,QAAA,CAAS,YAAY,CAAE,CAAA,KAAA,CAAM,CAAC,CAAI,GAAA,EAAA,CAAA;AAEnF,EAAO,OAAA,aAAA,CAAc,iBAAiB,kBAAkB,CAAA,CAAA;AAC1D;;ACdO,SAAS,eACd,OAC8C,EAAA;AAC9C,EAAM,MAAA,EAAC,eAAiB,EAAA,SAAA,EAAa,GAAA,OAAA,CAAA;AACrC,EAAM,MAAA,UAAA,GAAa,oBAAqB,CAAA,OAAA,CAAQ,UAAU,CAAA,CAAA;AAE1D,EAAA,MAAM,WAAW,eAAgB,CAAA;AAAA,IAC/B,UAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,GACD,CAAA,CAAA;AACD,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAA,OAAO,cAAc,QAAQ,CAAA,CAAA;AAC/B;;;;"}
|
package/dist/index.browser.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var browserMiddleware = require('./_chunks/browserMiddleware-
|
|
5
|
+
var browserMiddleware = require('./_chunks/browserMiddleware-FpdqDQ1o.cjs');
|
|
6
6
|
var getIt = require('get-it');
|
|
7
7
|
|
|
8
8
|
function defineDeprecatedCreateClient(createClient) {
|
package/dist/index.browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { printNoDefaultExport, defineCreateClientExports, SanityClient, envMiddleware } from './_chunks/browserMiddleware
|
|
2
|
-
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/browserMiddleware
|
|
1
|
+
import { printNoDefaultExport, defineCreateClientExports, SanityClient, envMiddleware } from './_chunks/browserMiddleware-DhUBf_19.js';
|
|
2
|
+
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/browserMiddleware-DhUBf_19.js';
|
|
3
3
|
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
|
|
4
4
|
|
|
5
5
|
function defineDeprecatedCreateClient(createClient) {
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeMiddleware = require('./_chunks/nodeMiddleware-
|
|
5
|
+
var nodeMiddleware = require('./_chunks/nodeMiddleware-DmcqX3kz.cjs');
|
|
6
6
|
var getIt = require('get-it');
|
|
7
7
|
|
|
8
8
|
function defineDeprecatedCreateClient(createClient) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2576,6 +2576,10 @@ export declare interface StegaConfig {
|
|
|
2576
2576
|
* Specify a `console.log` compatible logger to see debug logs, which keys are encoded and which are not.
|
|
2577
2577
|
*/
|
|
2578
2578
|
logger?: Logger
|
|
2579
|
+
/**
|
|
2580
|
+
* Set to `true` to omit cross dataset reference specific data from encoded strings
|
|
2581
|
+
*/
|
|
2582
|
+
omitCrossDatasetReferenceData?: boolean
|
|
2579
2583
|
}
|
|
2580
2584
|
|
|
2581
2585
|
/** @public */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-
|
|
2
|
-
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-
|
|
1
|
+
import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-BSZoKrW0.js';
|
|
2
|
+
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-BSZoKrW0.js';
|
|
3
3
|
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
|
|
4
4
|
|
|
5
5
|
function defineDeprecatedCreateClient(createClient) {
|
package/dist/stega.browser.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var browserMiddleware = require('./_chunks/browserMiddleware-
|
|
5
|
+
var browserMiddleware = require('./_chunks/browserMiddleware-FpdqDQ1o.cjs');
|
|
6
6
|
var getIt = require('get-it');
|
|
7
|
-
var stegaEncodeSourceMap = require('./_chunks/stegaEncodeSourceMap-
|
|
7
|
+
var stegaEncodeSourceMap = require('./_chunks/stegaEncodeSourceMap-DIcuvN0P.cjs');
|
|
8
8
|
|
|
9
9
|
class SanityStegaClient extends browserMiddleware.SanityClient {
|
|
10
10
|
}
|
package/dist/stega.browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SanityClient, ObservableSanityClient, defineCreateClientExports, envMiddleware } from './_chunks/browserMiddleware
|
|
2
|
-
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from './_chunks/browserMiddleware
|
|
1
|
+
import { SanityClient, ObservableSanityClient, defineCreateClientExports, envMiddleware } from './_chunks/browserMiddleware-DhUBf_19.js';
|
|
2
|
+
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from './_chunks/browserMiddleware-DhUBf_19.js';
|
|
3
3
|
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
|
|
4
|
-
export { encodeIntoResult, stegaEncodeSourceMap } from './_chunks/stegaEncodeSourceMap-
|
|
4
|
+
export { encodeIntoResult, stegaEncodeSourceMap } from './_chunks/stegaEncodeSourceMap-DLon0Yls.js';
|
|
5
5
|
|
|
6
6
|
class SanityStegaClient extends SanityClient {
|
|
7
7
|
}
|
package/dist/stega.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeMiddleware = require('./_chunks/nodeMiddleware-
|
|
5
|
+
var nodeMiddleware = require('./_chunks/nodeMiddleware-DmcqX3kz.cjs');
|
|
6
6
|
var getIt = require('get-it');
|
|
7
|
-
var stegaEncodeSourceMap = require('./_chunks/stegaEncodeSourceMap-
|
|
7
|
+
var stegaEncodeSourceMap = require('./_chunks/stegaEncodeSourceMap-8TjLXjYU.cjs');
|
|
8
8
|
|
|
9
9
|
class SanityStegaClient extends nodeMiddleware.SanityClient {
|
|
10
10
|
}
|
package/dist/stega.d.ts
CHANGED
|
@@ -2617,6 +2617,10 @@ export declare interface StegaConfig {
|
|
|
2617
2617
|
* Specify a `console.log` compatible logger to see debug logs, which keys are encoded and which are not.
|
|
2618
2618
|
*/
|
|
2619
2619
|
logger?: Logger
|
|
2620
|
+
/**
|
|
2621
|
+
* Set to `true` to omit cross dataset reference specific data from encoded strings
|
|
2622
|
+
*/
|
|
2623
|
+
omitCrossDatasetReferenceData?: boolean
|
|
2620
2624
|
}
|
|
2621
2625
|
|
|
2622
2626
|
/** @public */
|
package/dist/stega.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SanityClient, ObservableSanityClient, defineCreateClientExports, middleware } from './_chunks/nodeMiddleware-
|
|
2
|
-
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from './_chunks/nodeMiddleware-
|
|
1
|
+
import { SanityClient, ObservableSanityClient, defineCreateClientExports, middleware } from './_chunks/nodeMiddleware-BSZoKrW0.js';
|
|
2
|
+
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from './_chunks/nodeMiddleware-BSZoKrW0.js';
|
|
3
3
|
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
|
|
4
|
-
export { encodeIntoResult, stegaEncodeSourceMap } from './_chunks/stegaEncodeSourceMap-
|
|
4
|
+
export { encodeIntoResult, stegaEncodeSourceMap } from './_chunks/stegaEncodeSourceMap-DU95idpa.js';
|
|
5
5
|
|
|
6
6
|
class SanityStegaClient extends SanityClient {
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/client",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.14.1",
|
|
4
4
|
"description": "Client for retrieving, creating and patching data from Sanity.io",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"dependencies": {
|
|
131
131
|
"@sanity/eventsource": "^5.0.0",
|
|
132
132
|
"@vercel/stega": "0.1.0",
|
|
133
|
-
"get-it": "^8.4.
|
|
133
|
+
"get-it": "^8.4.7",
|
|
134
134
|
"rxjs": "^7.0.0"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
@@ -138,12 +138,12 @@
|
|
|
138
138
|
"@edge-runtime/vm": "^3.2.0",
|
|
139
139
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
140
140
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
141
|
-
"@sanity/pkg-utils": "^4.2.
|
|
141
|
+
"@sanity/pkg-utils": "^4.2.6",
|
|
142
142
|
"@types/json-diff": "^1.0.3",
|
|
143
143
|
"@types/node": "^20.8.8",
|
|
144
|
-
"@typescript-eslint/eslint-plugin": "^7.0.
|
|
145
|
-
"@typescript-eslint/parser": "^7.0.
|
|
146
|
-
"@vitest/coverage-v8": "1.
|
|
144
|
+
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
|
145
|
+
"@typescript-eslint/parser": "^7.0.2",
|
|
146
|
+
"@vitest/coverage-v8": "1.3.1",
|
|
147
147
|
"eslint": "^8.56.0",
|
|
148
148
|
"eslint-config-prettier": "^9.1.0",
|
|
149
149
|
"eslint-plugin-prettier": "^5.1.3",
|
|
@@ -153,15 +153,15 @@
|
|
|
153
153
|
"json-diff": "^1.0.6",
|
|
154
154
|
"ls-engines": "^0.9.1",
|
|
155
155
|
"next": "^14.1.0",
|
|
156
|
-
"nock": "^13.5.
|
|
156
|
+
"nock": "^13.5.3",
|
|
157
157
|
"prettier": "^3.2.5",
|
|
158
|
-
"prettier-plugin-packagejson": "^2.4.
|
|
158
|
+
"prettier-plugin-packagejson": "^2.4.11",
|
|
159
159
|
"rimraf": "^5.0.1",
|
|
160
|
-
"rollup": "^4.
|
|
160
|
+
"rollup": "^4.12.0",
|
|
161
161
|
"sse-channel": "^4.0.0",
|
|
162
|
-
"terser": "^5.27.
|
|
162
|
+
"terser": "^5.27.2",
|
|
163
163
|
"typescript": "^5.3.3",
|
|
164
|
-
"vitest": "1.
|
|
164
|
+
"vitest": "1.3.1",
|
|
165
165
|
"vitest-github-actions-reporter": "0.11.1"
|
|
166
166
|
},
|
|
167
167
|
"engines": {
|
package/src/csm/createEditUrl.ts
CHANGED
|
@@ -12,6 +12,8 @@ export function createEditUrl(options: CreateEditUrlOptions): `${StudioBaseUrl}$
|
|
|
12
12
|
id: _id,
|
|
13
13
|
type,
|
|
14
14
|
path,
|
|
15
|
+
projectId,
|
|
16
|
+
dataset,
|
|
15
17
|
} = options
|
|
16
18
|
|
|
17
19
|
if (!baseUrl) {
|
|
@@ -50,6 +52,12 @@ export function createEditUrl(options: CreateEditUrlOptions): `${StudioBaseUrl}$
|
|
|
50
52
|
if (tool) {
|
|
51
53
|
searchParams.set('tool', tool)
|
|
52
54
|
}
|
|
55
|
+
if (projectId) {
|
|
56
|
+
searchParams.set('projectId', projectId)
|
|
57
|
+
}
|
|
58
|
+
if (dataset) {
|
|
59
|
+
searchParams.set('dataset', dataset)
|
|
60
|
+
}
|
|
53
61
|
|
|
54
62
|
const segments = [baseUrl === '/' ? '' : baseUrl]
|
|
55
63
|
if (workspace) {
|
|
@@ -34,7 +34,7 @@ export function resolveEditInfo(options: ResolveEditInfoOptions): CreateEditUrlO
|
|
|
34
34
|
typeof options.studioUrl === 'function' ? options.studioUrl(sourceDoc) : options.studioUrl,
|
|
35
35
|
)
|
|
36
36
|
if (!baseUrl) return undefined
|
|
37
|
-
const {_id, _type} = sourceDoc
|
|
37
|
+
const {_id, _type, _projectId, _dataset} = sourceDoc
|
|
38
38
|
return {
|
|
39
39
|
baseUrl,
|
|
40
40
|
workspace,
|
|
@@ -42,6 +42,8 @@ export function resolveEditInfo(options: ResolveEditInfoOptions): CreateEditUrlO
|
|
|
42
42
|
id: _id,
|
|
43
43
|
type: _type,
|
|
44
44
|
path: parseJsonPath(sourcePath + pathSuffix),
|
|
45
|
+
projectId: _projectId,
|
|
46
|
+
dataset: _dataset,
|
|
45
47
|
} satisfies CreateEditUrlOptions
|
|
46
48
|
}
|
|
47
49
|
|
package/src/csm/types.ts
CHANGED
|
@@ -84,7 +84,7 @@ export function stegaEncodeSourceMap<Result = unknown>(
|
|
|
84
84
|
: config.studioUrl!,
|
|
85
85
|
)
|
|
86
86
|
if (!baseUrl) return value
|
|
87
|
-
const {_id: id, _type: type} = sourceDocument
|
|
87
|
+
const {_id: id, _type: type, _projectId: projectId, _dataset: dataset} = sourceDocument
|
|
88
88
|
|
|
89
89
|
return vercelStegaCombine(
|
|
90
90
|
value,
|
|
@@ -97,6 +97,7 @@ export function stegaEncodeSourceMap<Result = unknown>(
|
|
|
97
97
|
id,
|
|
98
98
|
type,
|
|
99
99
|
path: sourcePath,
|
|
100
|
+
...(!config.omitCrossDatasetReferenceData && {dataset, projectId}),
|
|
100
101
|
}),
|
|
101
102
|
},
|
|
102
103
|
// We use custom logic to determine if we should skip encoding
|
package/src/stega/types.ts
CHANGED
|
@@ -50,6 +50,10 @@ export interface StegaConfig {
|
|
|
50
50
|
* Specify a `console.log` compatible logger to see debug logs, which keys are encoded and which are not.
|
|
51
51
|
*/
|
|
52
52
|
logger?: Logger
|
|
53
|
+
/**
|
|
54
|
+
* Set to `true` to omit cross dataset reference specific data from encoded strings
|
|
55
|
+
*/
|
|
56
|
+
omitCrossDatasetReferenceData?: boolean
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
/** @public */
|