Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@sanity/client

Package Overview
Dependencies
Maintainers
44
Versions
986
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/client - npm Package Compare versions

Comparing version 6.14.1 to 6.14.2

dist/_chunks/browserMiddleware-BHXO2Lcy.cjs

90

dist/csm.js

@@ -1,4 +0,3 @@

import { walkMap, resolveMapping, parseJsonPath, toString, DRAFTS_PREFIX, getPublishedId, get, jsonPath, studioPathToJsonPath, resolveEditInfo, createEditUrl } from './_chunks/resolveEditInfo-Cf8D1Agp.js';
export { jsonPathToStudioPath, studioPath } from './_chunks/resolveEditInfo-Cf8D1Agp.js';
import { walkMap, resolveMapping, parseJsonPath, toString, DRAFTS_PREFIX, getPublishedId, get, jsonPath, studioPathToJsonPath, resolveEditInfo, createEditUrl } from "./_chunks/resolveEditInfo-qA5twkfC.js";
import { jsonPathToStudioPath, studioPath } from "./_chunks/resolveEditInfo-qA5twkfC.js";
const defaultUpdateFunction = (changed) => changed;

@@ -8,48 +7,27 @@ function applySourceDocuments(result, resultSourceMap, getCachedDocument, updateFn = defaultUpdateFunction, perspective = "raw") {

return result;
if (perspective !== "published" && perspective !== "raw" && perspective !== "previewDrafts") {
if (perspective !== "published" && perspective !== "raw" && perspective !== "previewDrafts")
throw new Error(`Unknown perspective "${perspective}"`);
}
return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {
const resolveMappingResult = resolveMapping(path, resultSourceMap);
if (!resolveMappingResult) {
if (!resolveMappingResult)
return value;
}
const { mapping, pathSuffix } = resolveMappingResult;
if (mapping.type !== "value") {
if (mapping.type !== "value" || mapping.source.type !== "documentValue")
return value;
}
if (mapping.source.type !== "documentValue") {
return value;
}
const sourceDocument = resultSourceMap.documents[mapping.source.document];
const sourcePath = resultSourceMap.paths[mapping.source.path];
const sourceDocument = resultSourceMap.documents[mapping.source.document], sourcePath = resultSourceMap.paths[mapping.source.path];
if (sourceDocument) {
const parsedPath = parseJsonPath(sourcePath + pathSuffix);
const stringifiedPath = toString(parsedPath);
if (stringifiedPath === "_id") {
const parsedPath = parseJsonPath(sourcePath + pathSuffix), stringifiedPath = toString(parsedPath);
if (stringifiedPath === "_id")
return value;
}
let cachedDocument;
if (perspective === "previewDrafts") {
cachedDocument = getCachedDocument(
sourceDocument._id.startsWith(DRAFTS_PREFIX) ? sourceDocument : { ...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}` }
);
if (!cachedDocument) {
cachedDocument = getCachedDocument(
sourceDocument._id.startsWith(DRAFTS_PREFIX) ? { ...sourceDocument, _id: getPublishedId(sourceDocument._id) } : sourceDocument
);
}
if (cachedDocument) {
cachedDocument = {
...cachedDocument,
_id: getPublishedId(sourceDocument._id),
_originalId: sourceDocument._id
};
}
} else {
cachedDocument = getCachedDocument(sourceDocument);
}
if (!cachedDocument) {
if (perspective === "previewDrafts" ? (cachedDocument = getCachedDocument(
sourceDocument._id.startsWith(DRAFTS_PREFIX) ? sourceDocument : { ...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}` }
), cachedDocument || (cachedDocument = getCachedDocument(
sourceDocument._id.startsWith(DRAFTS_PREFIX) ? { ...sourceDocument, _id: getPublishedId(sourceDocument._id) } : sourceDocument
)), cachedDocument && (cachedDocument = {
...cachedDocument,
_id: getPublishedId(sourceDocument._id),
_originalId: sourceDocument._id
})) : cachedDocument = getCachedDocument(sourceDocument), !cachedDocument)
return value;
}
const changedValue = cachedDocument ? get(cachedDocument, stringifiedPath, value) : value;

@@ -66,15 +44,8 @@ return value === changedValue ? value : updateFn(changedValue, {

}
function resolvedKeyedSourcePath(options) {
const { keyedResultPath, pathSuffix, sourceBasePath } = options;
const inferredResultPath = pathSuffix === void 0 ? [] : parseJsonPath(pathSuffix);
const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length);
const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : "";
const { keyedResultPath, pathSuffix, sourceBasePath } = options, inferredResultPath = pathSuffix === void 0 ? [] : parseJsonPath(pathSuffix), inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length), inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : "";
return parseJsonPath(sourceBasePath + inferredPathSuffix);
}
function resolveEditUrl(options) {
const { resultSourceMap, studioUrl } = options;
const resultPath = studioPathToJsonPath(options.resultPath);
const editInfo = resolveEditInfo({
const { resultSourceMap, studioUrl } = options, resultPath = studioPathToJsonPath(options.resultPath), editInfo = resolveEditInfo({
resultPath,

@@ -84,9 +55,20 @@ resultSourceMap,

});
if (!editInfo) {
return void 0;
}
return createEditUrl(editInfo);
if (editInfo)
return createEditUrl(editInfo);
}
export { applySourceDocuments, createEditUrl, getPublishedId, jsonPath, parseJsonPath, resolveEditInfo, resolveEditUrl, resolveMapping, resolvedKeyedSourcePath, studioPathToJsonPath, walkMap };
export {
applySourceDocuments,
createEditUrl,
getPublishedId,
jsonPath,
jsonPathToStudioPath,
parseJsonPath,
resolveEditInfo,
resolveEditUrl,
resolveMapping,
resolvedKeyedSourcePath,
studioPath,
studioPathToJsonPath,
walkMap
};
//# sourceMappingURL=csm.js.map

39

dist/index.browser.js

@@ -1,18 +0,27 @@

import { printNoDefaultExport, defineCreateClientExports, SanityClient, envMiddleware } from './_chunks/browserMiddleware-DhUBf_19.js';
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/browserMiddleware-DhUBf_19.js';
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
function defineDeprecatedCreateClient(createClient) {
return function deprecatedCreateClient(config) {
printNoDefaultExport();
return createClient(config);
import { printNoDefaultExport, defineCreateClientExports, SanityClient, envMiddleware } from "./_chunks/browserMiddleware-jPnXCUlp.js";
import { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from "./_chunks/browserMiddleware-jPnXCUlp.js";
import { adapter, environment } from "get-it";
function defineDeprecatedCreateClient(createClient2) {
return function(config) {
return printNoDefaultExport(), createClient2(config);
};
}
const exp = defineCreateClientExports(envMiddleware, SanityClient);
const requester = exp.requester;
const createClient = exp.createClient;
const deprecatedCreateClient = defineDeprecatedCreateClient(createClient);
export { SanityClient, createClient, deprecatedCreateClient as default, requester };
const exp = defineCreateClientExports(envMiddleware, SanityClient), requester = exp.requester, createClient = exp.createClient, deprecatedCreateClient = defineDeprecatedCreateClient(createClient);
export {
BasePatch,
BaseTransaction,
ClientError,
ObservablePatch,
ObservableSanityClient,
ObservableTransaction,
Patch,
SanityClient,
ServerError,
Transaction,
createClient,
deprecatedCreateClient as default,
requester,
adapter as unstable__adapter,
environment as unstable__environment
};
//# sourceMappingURL=index.browser.js.map

@@ -1,18 +0,27 @@

import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-BSZoKrW0.js';
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-BSZoKrW0.js';
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
function defineDeprecatedCreateClient(createClient) {
return function deprecatedCreateClient(config) {
printNoDefaultExport();
return createClient(config);
import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from "./_chunks/nodeMiddleware-CrO2pNEp.js";
import { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from "./_chunks/nodeMiddleware-CrO2pNEp.js";
import { adapter, environment } from "get-it";
function defineDeprecatedCreateClient(createClient2) {
return function(config) {
return printNoDefaultExport(), createClient2(config);
};
}
const exp = defineCreateClientExports(middleware, SanityClient);
const requester = exp.requester;
const createClient = exp.createClient;
const deprecatedCreateClient = defineDeprecatedCreateClient(createClient);
export { SanityClient, createClient, deprecatedCreateClient as default, requester };
const exp = defineCreateClientExports(middleware, SanityClient), requester = exp.requester, createClient = exp.createClient, deprecatedCreateClient = defineDeprecatedCreateClient(createClient);
export {
BasePatch,
BaseTransaction,
ClientError,
ObservablePatch,
ObservableSanityClient,
ObservableTransaction,
Patch,
SanityClient,
ServerError,
Transaction,
createClient,
deprecatedCreateClient as default,
requester,
adapter as unstable__adapter,
environment as unstable__environment
};
//# sourceMappingURL=index.js.map

@@ -1,6 +0,5 @@

import { SanityClient, ObservableSanityClient, defineCreateClientExports, envMiddleware } from './_chunks/browserMiddleware-DhUBf_19.js';
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from './_chunks/browserMiddleware-DhUBf_19.js';
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
export { encodeIntoResult, stegaEncodeSourceMap } from './_chunks/stegaEncodeSourceMap-DLon0Yls.js';
import { SanityClient, ObservableSanityClient, defineCreateClientExports, envMiddleware } from "./_chunks/browserMiddleware-jPnXCUlp.js";
import { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from "./_chunks/browserMiddleware-jPnXCUlp.js";
import { adapter, environment } from "get-it";
import { encodeIntoResult, stegaEncodeSourceMap } from "./_chunks/stegaEncodeSourceMap-De3F_oJN.js";
class SanityStegaClient extends SanityClient {

@@ -10,8 +9,24 @@ }

}
const exp = defineCreateClientExports(envMiddleware, SanityClient);
const requester = exp.requester;
const createClient = exp.createClient;
export { ObservableSanityClient, ObservableSanityStegaClient, SanityClient, SanityStegaClient, createClient, requester };
const exp = defineCreateClientExports(envMiddleware, SanityClient), requester = exp.requester, createClient = exp.createClient;
export {
BasePatch,
BaseTransaction,
ClientError,
ObservablePatch,
ObservableSanityClient,
ObservableSanityStegaClient,
ObservableTransaction,
Patch,
SanityClient,
SanityStegaClient,
ServerError,
Transaction,
createClient,
encodeIntoResult,
requester,
stegaEncodeSourceMap,
adapter as unstable__adapter,
environment as unstable__environment,
vercelStegaCleanAll
};
//# sourceMappingURL=stega.browser.js.map

@@ -1,6 +0,5 @@

import { SanityClient, ObservableSanityClient, defineCreateClientExports, middleware } from './_chunks/nodeMiddleware-BSZoKrW0.js';
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from './_chunks/nodeMiddleware-BSZoKrW0.js';
export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
export { encodeIntoResult, stegaEncodeSourceMap } from './_chunks/stegaEncodeSourceMap-DU95idpa.js';
import { SanityClient, ObservableSanityClient, defineCreateClientExports, middleware } from "./_chunks/nodeMiddleware-CrO2pNEp.js";
import { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableTransaction, Patch, ServerError, Transaction, vercelStegaCleanAll } from "./_chunks/nodeMiddleware-CrO2pNEp.js";
import { adapter, environment } from "get-it";
import { encodeIntoResult, stegaEncodeSourceMap } from "./_chunks/stegaEncodeSourceMap-bRxIGJ-b.js";
class SanityStegaClient extends SanityClient {

@@ -10,8 +9,24 @@ }

}
const exp = defineCreateClientExports(middleware, SanityClient);
const requester = exp.requester;
const createClient = exp.createClient;
export { ObservableSanityClient, ObservableSanityStegaClient, SanityClient, SanityStegaClient, createClient, requester };
const exp = defineCreateClientExports(middleware, SanityClient), requester = exp.requester, createClient = exp.createClient;
export {
BasePatch,
BaseTransaction,
ClientError,
ObservablePatch,
ObservableSanityClient,
ObservableSanityStegaClient,
ObservableTransaction,
Patch,
SanityClient,
SanityStegaClient,
ServerError,
Transaction,
createClient,
encodeIntoResult,
requester,
stegaEncodeSourceMap,
adapter as unstable__adapter,
environment as unstable__environment,
vercelStegaCleanAll
};
//# sourceMappingURL=stega.js.map
{
"name": "@sanity/client",
"version": "6.14.1",
"version": "6.14.2",
"description": "Client for retrieving, creating and patching data from Sanity.io",

@@ -133,3 +133,3 @@ "keywords": [

"@vercel/stega": "0.1.0",
"get-it": "^8.4.7",
"get-it": "^8.4.9",
"rxjs": "^7.0.0"

@@ -142,3 +142,3 @@ },

"@rollup/plugin-node-resolve": "^15.2.3",
"@sanity/pkg-utils": "^4.2.6",
"@sanity/pkg-utils": "^4.2.8",
"@types/json-diff": "^1.0.3",

@@ -145,0 +145,0 @@ "@types/node": "^20.8.8",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc