@sanity/types
Advanced tools
Comparing version 2.14.1-canary.36 to 2.14.1-conditional-fields.64
@@ -12,2 +12,3 @@ export * from './slug'; | ||
export * from './images'; | ||
export * from './user'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,2 +5,4 @@ import React from 'react'; | ||
import { SlugOptions } from '../slug'; | ||
import { SanityDocument } from '../documents'; | ||
import { CurrentUser } from '../user'; | ||
export interface Schema { | ||
@@ -29,2 +31,10 @@ name: string; | ||
}; | ||
export interface HiddenOptionCallbackContext { | ||
parent?: Record<string, unknown>; | ||
document: SanityDocument; | ||
currentUser: Omit<CurrentUser, 'role'>; | ||
value: unknown; | ||
} | ||
export declare type HiddenOption = boolean | HiddenOptionCallback; | ||
export declare type HiddenOptionCallback = (context: HiddenOptionCallbackContext) => boolean; | ||
export declare type InitialValueParams = Record<string, unknown>; | ||
@@ -43,3 +53,2 @@ export declare type InitialValueResolver<T> = (params?: InitialValueParams) => Promise<T> | T; | ||
options?: unknown; | ||
hidden?: boolean; | ||
preview?: { | ||
@@ -115,8 +124,9 @@ select?: PreviewValue; | ||
} | ||
export declare type ObjectFieldType<T extends SchemaType = SchemaType> = T & { | ||
hidden?: HiddenOption; | ||
}; | ||
export interface ObjectField<T extends SchemaType = SchemaType> { | ||
name: string; | ||
fieldset?: string; | ||
type: T & { | ||
hidden?: boolean; | ||
}; | ||
type: ObjectFieldType<T>; | ||
} | ||
@@ -123,0 +133,0 @@ export interface ObjectSchemaType extends BaseSchemaType { |
@@ -148,2 +148,15 @@ "use strict"; | ||
}); | ||
}); | ||
var _user = require("./user"); | ||
Object.keys(_user).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _user[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _user[key]; | ||
} | ||
}); | ||
}); |
{ | ||
"name": "@sanity/types", | ||
"version": "2.14.1-canary.36+e74126bdd6", | ||
"version": "2.14.1-conditional-fields.64+9588d94d86", | ||
"description": "Type definitions for common Sanity data structures", | ||
@@ -23,5 +23,5 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@sanity/client": "2.14.1-canary.36+e74126bdd6", | ||
"@sanity/client": "2.14.1-conditional-fields.64+9588d94d86", | ||
"@sanity/color": "^2.1.4", | ||
"@sanity/types": "2.14.1-canary.36+e74126bdd6", | ||
"@sanity/types": "2.14.1-conditional-fields.64+9588d94d86", | ||
"@types/react": "^17.0.0", | ||
@@ -43,3 +43,3 @@ "react": "17.0.1", | ||
"homepage": "https://www.sanity.io/", | ||
"gitHead": "e74126bdd6f95d98aae8032eb078edb082ce593b" | ||
"gitHead": "9588d94d8697a535026272767681a1cdfefb1f4c" | ||
} |
@@ -12,1 +12,2 @@ export * from './slug' | ||
export * from './images' | ||
export * from './user' |
@@ -6,2 +6,4 @@ // Note: INCOMPLETE, but it's a start | ||
import {SlugOptions} from '../slug' | ||
import {SanityDocument} from '../documents' | ||
import {CurrentUser} from '../user' | ||
@@ -35,2 +37,12 @@ export interface Schema { | ||
export interface HiddenOptionCallbackContext { | ||
parent?: Record<string, unknown> | ||
document: SanityDocument | ||
currentUser: Omit<CurrentUser, 'role'> | ||
value: unknown | ||
} | ||
export type HiddenOption = boolean | HiddenOptionCallback | ||
export type HiddenOptionCallback = (context: HiddenOptionCallbackContext) => boolean | ||
export type InitialValueParams = Record<string, unknown> | ||
@@ -50,3 +62,2 @@ export type InitialValueResolver<T> = (params?: InitialValueParams) => Promise<T> | T | ||
options?: unknown | ||
hidden?: boolean | ||
@@ -139,6 +150,8 @@ preview?: { | ||
export type ObjectFieldType<T extends SchemaType = SchemaType> = T & {hidden?: HiddenOption} | ||
export interface ObjectField<T extends SchemaType = SchemaType> { | ||
name: string | ||
fieldset?: string | ||
type: T & {hidden?: boolean} | ||
type: ObjectFieldType<T> | ||
} | ||
@@ -145,0 +158,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
432735
541
14616
1