@sanity/client
Advanced tools
Comparing version 6.22.0 to 6.22.1-bundle-perspective
@@ -249,4 +249,3 @@ const rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, reKeySegment = /_key\s*==\s*['"](.*)['"]/, reIndexTuple = /^\d*:\d*$/; | ||
); | ||
if (!baseUrl) | ||
return; | ||
if (!baseUrl) return; | ||
const { _id, _type, _projectId, _dataset } = sourceDoc; | ||
@@ -253,0 +252,0 @@ return { |
@@ -6,4 +6,3 @@ var s = { 0: 8203, 1: 8204, 2: 8205, 3: 8290, 4: 8291, 5: 8288, 6: 65279, 7: 8289, 8: 119155, 9: 119156, a: 119157, b: 119158, c: 119159, d: 119160, e: 119161, f: 119162 }, c = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 }, u = new Array(4).fill(String.fromCodePoint(c[0])).join(""); | ||
let n = r.charCodeAt(0); | ||
if (n > 255) | ||
throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`); | ||
if (n > 255) throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`); | ||
return Array.from(n.toString(4).padStart(4, "0")).map((o) => String.fromCodePoint(c[o])).join(""); | ||
@@ -10,0 +9,0 @@ }).join("")}`; |
@@ -283,4 +283,3 @@ import { C } from "./stegaClean.js"; | ||
); | ||
if (!baseUrl) | ||
return value; | ||
if (!baseUrl) return value; | ||
const { _id: id, _type: type, _projectId: projectId, _dataset: dataset } = sourceDocument; | ||
@@ -287,0 +286,0 @@ return C( |
@@ -5,4 +5,3 @@ import { walkMap, resolveMapping, parseJsonPath, toString, DRAFTS_PREFIX, getPublishedId, get, jsonPath, studioPathToJsonPath, resolveEditInfo, createEditUrl } from "./_chunks-es/resolveEditInfo.js"; | ||
function applySourceDocuments(result, resultSourceMap, getCachedDocument, updateFn = defaultUpdateFunction, perspective = "raw") { | ||
if (!resultSourceMap) | ||
return result; | ||
if (!resultSourceMap) return result; | ||
if (perspective !== "published" && perspective !== "raw" && perspective !== "previewDrafts") | ||
@@ -9,0 +8,0 @@ throw new Error(`Unknown perspective "${perspective}"`); |
@@ -90,4 +90,3 @@ import { getIt } from "get-it"; | ||
function shouldRetry(err, attempt, options) { | ||
if (options.maxRetries === 0) | ||
return !1; | ||
if (options.maxRetries === 0) return !1; | ||
const isSafe = options.method === "GET" || options.method === "HEAD", isQuery = (options.uri || options.url).startsWith("/data/query"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503); | ||
@@ -701,2 +700,3 @@ return (isSafe || isQuery) && isRetriableResponse ? !0 : retry.shouldRetry(err, attempt, options); | ||
perspective: options.perspective, | ||
bundlePerspective: options.bundlePerspective, | ||
resultSourceMap: options.resultSourceMap, | ||
@@ -739,4 +739,4 @@ lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId, | ||
resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query }); | ||
const perspective = options.perspective || config.perspective; | ||
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query }); | ||
const perspective = options.perspective || config.perspective, bundlePerspective = options.bundlePerspective || config.bundlePerspective; | ||
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), typeof bundlePerspective == "string" && (options.query = { perspective: void 0, bundlePerspective, ...options.query }), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query }); | ||
} | ||
@@ -743,0 +743,0 @@ const reqOptions = requestOptions( |
@@ -90,4 +90,3 @@ import { getIt } from "get-it"; | ||
function shouldRetry(err, attempt, options) { | ||
if (options.maxRetries === 0) | ||
return !1; | ||
if (options.maxRetries === 0) return !1; | ||
const isSafe = options.method === "GET" || options.method === "HEAD", isQuery = (options.uri || options.url).startsWith("/data/query"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503); | ||
@@ -701,2 +700,3 @@ return (isSafe || isQuery) && isRetriableResponse ? !0 : retry.shouldRetry(err, attempt, options); | ||
perspective: options.perspective, | ||
bundlePerspective: options.bundlePerspective, | ||
resultSourceMap: options.resultSourceMap, | ||
@@ -739,4 +739,4 @@ lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId, | ||
resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query }); | ||
const perspective = options.perspective || config.perspective; | ||
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query }); | ||
const perspective = options.perspective || config.perspective, bundlePerspective = options.bundlePerspective || config.bundlePerspective; | ||
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), typeof bundlePerspective == "string" && (options.query = { perspective: void 0, bundlePerspective, ...options.query }), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query }); | ||
} | ||
@@ -1525,3 +1525,3 @@ const reqOptions = requestOptions( | ||
} | ||
var name = "@sanity/client", version = "6.22.0"; | ||
var name = "@sanity/client", version = "6.22.1-bundle-perspective"; | ||
const middleware = [ | ||
@@ -1528,0 +1528,0 @@ debug({ verbose: !0, namespace: "sanity:client" }), |
{ | ||
"name": "@sanity/client", | ||
"version": "6.22.0", | ||
"version": "6.22.1-bundle-perspective", | ||
"description": "Client for retrieving, creating and patching data from Sanity.io", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -315,2 +315,3 @@ import {from, type MonoTypeOperatorFunction, Observable} from 'rxjs' | ||
perspective: options.perspective, | ||
bundlePerspective: options.bundlePerspective, | ||
resultSourceMap: options.resultSourceMap, | ||
@@ -409,2 +410,3 @@ lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId, | ||
const perspective = options.perspective || config.perspective | ||
const bundlePerspective = options.bundlePerspective || config.bundlePerspective | ||
if (typeof perspective === 'string' && perspective !== 'raw') { | ||
@@ -420,2 +422,9 @@ validateApiPerspective(perspective) | ||
if (typeof bundlePerspective === 'string') { | ||
if (perspective) { | ||
// printWarning() | ||
} | ||
options.query = {perspective: undefined, bundlePerspective, ...options.query} | ||
} | ||
if (options.lastLiveEventId) { | ||
@@ -422,0 +431,0 @@ options.query = {...options.query, lastLiveEventId: options.lastLiveEventId} |
@@ -45,2 +45,3 @@ // deno-lint-ignore-file no-empty-interface | ||
perspective?: ClientPerspective | ||
bundlePerspective?: string | ||
apiHost?: string | ||
@@ -225,3 +226,3 @@ apiVersion?: string | ||
/** | ||
* Present when `perspective` is set to `previewDrafts` | ||
* Present when `perspective` is set to `previewDrafts` or `bundlePerspective` is specified | ||
*/ | ||
@@ -311,2 +312,3 @@ _originalId?: string | ||
perspective?: ClientPerspective | ||
bundlePerspective?: string | ||
lastLiveEventId?: string | ||
@@ -477,2 +479,4 @@ } | ||
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */ | ||
bundlePerspective?: never | ||
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */ | ||
query?: never | ||
@@ -857,2 +861,3 @@ /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */ | ||
type: 'welcome' | ||
listenerName: string | ||
} | ||
@@ -944,2 +949,3 @@ | ||
perspective?: ClientPerspective | ||
bundlePerspective?: string | ||
resultSourceMap?: boolean | 'withKeyArraySelector' | ||
@@ -946,0 +952,0 @@ returnQuery?: boolean |
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 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 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2176616
24753
1