New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/client

Package Overview
Dependencies
Maintainers
71
Versions
1027
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.27.3-canary.0 to 6.27.3-canary.1

31

dist/_chunks-es/config.js

@@ -87,22 +87,17 @@ const BASE_URL = "https://www.sanity.io/help/";

}
const VALID_PERSPECTIVE = /^[a-z0-9_]+$/i;
function validateApiPerspective(perspective) {
if (Array.isArray(perspective)) {
for (const perspectiveValue of perspective)
if (perspectiveValue !== "published" && perspectiveValue !== "drafts" && !(typeof perspectiveValue == "string" && perspectiveValue.startsWith("r") && perspectiveValue !== "raw"))
throw new TypeError(
"Invalid API perspective value, expected `published`, `drafts` or a valid release identifier string"
);
return;
if (Array.isArray(perspective) && perspective.includes("raw"))
throw new TypeError(
'Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives'
);
const invalid = (Array.isArray(perspective) ? perspective : [perspective]).filter(
(perspectiveName) => typeof perspectiveName != "string" || !VALID_PERSPECTIVE.test(perspectiveName)
);
if (invalid.length > 0) {
const formatted = invalid.map((v) => JSON.stringify(v));
throw new TypeError(
`Invalid API perspective value${invalid.length === 1 ? "" : "s"}: ${formatted.join(", ")}, expected \`published\`, \`drafts\`, \`raw\` or a release identifier string`
);
}
switch (perspective) {
case "previewDrafts":
case "drafts":
case "published":
case "raw":
return;
default:
throw new TypeError(
"Invalid API perspective string, expected `published`, `previewDrafts` or `raw`"
);
}
}

@@ -109,0 +104,0 @@ const initConfig = (config, prevConfig) => {

@@ -44,3 +44,3 @@ /**

| 'raw'
| ('published' | 'drafts' | ReleaseId)[]
| StackablePerspective[]

@@ -262,5 +262,2 @@ /** @public */

/** @public */
declare type ReleaseId = `r${string}`
/**

@@ -331,2 +328,5 @@ * @internal

/** @public */
declare type StackablePerspective = ('published' | 'drafts' | string) & {}
/** @alpha */

@@ -333,0 +333,0 @@ export declare type StudioBaseRoute = {

@@ -969,6 +969,6 @@ import { getIt } from "get-it";

), observable2 = concat(checkCors, events).pipe(
finalize$1(() => eventsCache.delete(key)),
shareReplayLatest({
predicate: (event) => event.type === "welcome"
}),
finalize$1(() => eventsCache.delete(key))
})
);

@@ -1510,3 +1510,3 @@ return eventsCache.set(key, observable2), observable2;

}
var name = "@sanity/client", version = "6.27.3-canary.0";
var name = "@sanity/client", version = "6.27.3-canary.1";
const middleware = [

@@ -1513,0 +1513,0 @@ debug({ verbose: !0, namespace: "sanity:client" }),

{
"name": "@sanity/client",
"version": "6.27.3-canary.0",
"version": "6.27.3-canary.1",
"description": "Client for retrieving, creating and patching data from Sanity.io",

@@ -5,0 +5,0 @@ "keywords": [

@@ -31,2 +31,4 @@ import {generateHelpUrl} from './generateHelpUrl'

const VALID_PERSPECTIVE = /^[a-z0-9_]+$/i
/**

@@ -39,32 +41,18 @@ * @internal - it may have breaking changes in any release

if (Array.isArray(perspective)) {
for (const perspectiveValue of perspective) {
if (perspectiveValue === 'published') {
continue
}
if (perspectiveValue === 'drafts') {
continue
}
if (
typeof perspectiveValue === 'string' &&
perspectiveValue.startsWith('r') &&
perspectiveValue !== 'raw'
) {
continue
}
if (perspective.includes('raw')) {
throw new TypeError(
'Invalid API perspective value, expected `published`, `drafts` or a valid release identifier string',
`Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives`,
)
}
return
}
switch (perspective as ClientPerspective) {
case 'previewDrafts':
case 'drafts':
case 'published':
case 'raw':
return
default:
throw new TypeError(
'Invalid API perspective string, expected `published`, `previewDrafts` or `raw`',
)
const invalid = (Array.isArray(perspective) ? perspective : [perspective]).filter(
(perspectiveName) =>
typeof perspectiveName !== 'string' || !VALID_PERSPECTIVE.test(perspectiveName),
)
if (invalid.length > 0) {
const formatted = invalid.map((v) => JSON.stringify(v))
throw new TypeError(
`Invalid API perspective value${invalid.length === 1 ? '' : 's'}: ${formatted.join(', ')}, expected \`published\`, \`drafts\`, \`raw\` or a release identifier string`,
)
}

@@ -71,0 +59,0 @@ }

import {validateApiPerspective} from '../config'
import type {ReleaseId} from '../types'
import type {StackablePerspective} from '../types'
import type {ClientPerspective} from './types'

@@ -12,3 +12,3 @@

perspective: Exclude<ClientPerspective, 'raw'>,
): ('published' | 'drafts' | ReleaseId)[] {
): ('published' | 'drafts' | StackablePerspective)[] {
validateApiPerspective(perspective)

@@ -15,0 +15,0 @@

@@ -130,6 +130,6 @@ import {catchError, concat, EMPTY, mergeMap, Observable, of} from 'rxjs'

const observable = concat(checkCors, events).pipe(
finalize(() => eventsCache.delete(key)),
shareReplayLatest({
predicate: (event) => event.type === 'welcome',
}),
finalize(() => eventsCache.delete(key)),
)

@@ -136,0 +136,0 @@ eventsCache.set(key, observable)

@@ -34,6 +34,12 @@ // deno-lint-ignore-file no-empty-interface

/** @public */
/**
* @public
* @deprecated – The `r`-prefix is not required, use `string` instead
*/
export type ReleaseId = `r${string}`
/** @public */
export type StackablePerspective = ('published' | 'drafts' | string) & {}
/** @public */
export type ClientPerspective =

@@ -44,3 +50,3 @@ | 'previewDrafts'

| 'raw'
| ('published' | 'drafts' | ReleaseId)[]
| StackablePerspective[]

@@ -47,0 +53,0 @@ /** @public */

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

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 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

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