@sanity/types 5.9.0-next.8 → 5.10.0-next.28
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/lib/index.d.ts +8 -2
- package/package.json +5 -5
package/lib/index.d.ts
CHANGED
|
@@ -368,6 +368,7 @@ interface Rule {
|
|
|
368
368
|
either(children: Rule[]): Rule;
|
|
369
369
|
optional(): Rule;
|
|
370
370
|
required(): Rule;
|
|
371
|
+
skip(): Rule;
|
|
371
372
|
custom<T = unknown>(fn: CustomValidator<T>, options?: {
|
|
372
373
|
bypassConcurrencyLimit?: boolean;
|
|
373
374
|
}): Rule;
|
|
@@ -525,6 +526,10 @@ interface ValidationContext {
|
|
|
525
526
|
id: string;
|
|
526
527
|
}) => Promise<boolean>;
|
|
527
528
|
environment: 'cli' | 'studio';
|
|
529
|
+
/**
|
|
530
|
+
* Whether this field is hidden for any reason (either itself or any of its ancestors).
|
|
531
|
+
*/
|
|
532
|
+
hidden?: boolean;
|
|
528
533
|
}
|
|
529
534
|
/**
|
|
530
535
|
* The base type for all validators in the validation library. Takes in a
|
|
@@ -711,6 +716,7 @@ declare interface InsertMenuOptions {
|
|
|
711
716
|
/** @public */
|
|
712
717
|
interface RuleDef<T, FieldValue = unknown> {
|
|
713
718
|
required: () => T;
|
|
719
|
+
skip: () => T;
|
|
714
720
|
custom: <LenientFieldValue extends FieldValue>(fn: CustomValidator<LenientFieldValue | undefined>) => T;
|
|
715
721
|
info: (message?: string | LocalizedValidationMessages) => T;
|
|
716
722
|
error: (message?: string | LocalizedValidationMessages) => T;
|
|
@@ -720,7 +726,7 @@ interface RuleDef<T, FieldValue = unknown> {
|
|
|
720
726
|
/** @public */
|
|
721
727
|
type RuleBuilder<T extends RuleDef<T, FieldValue>, FieldValue = unknown> = T | T[];
|
|
722
728
|
/** @public */
|
|
723
|
-
type ValidationBuilder<T extends RuleDef<T, FieldValue>, FieldValue = unknown> = (rule: T) => RuleBuilder<T, FieldValue>;
|
|
729
|
+
type ValidationBuilder<T extends RuleDef<T, FieldValue>, FieldValue = unknown> = (rule: T, context?: ValidationContext) => RuleBuilder<T, FieldValue>;
|
|
724
730
|
/** @public */
|
|
725
731
|
interface ObjectOptions extends BaseSchemaTypeOptions {
|
|
726
732
|
collapsible?: boolean;
|
|
@@ -2047,7 +2053,7 @@ type InitialValueProperty<Params, Value> = Value | InitialValueResolver<Params,
|
|
|
2047
2053
|
*
|
|
2048
2054
|
* @public
|
|
2049
2055
|
*/
|
|
2050
|
-
type SchemaValidationValue = false | undefined | Rule | SchemaValidationValue[] | ((rule: Rule) => SchemaValidationValue);
|
|
2056
|
+
type SchemaValidationValue = false | undefined | Rule | SchemaValidationValue[] | ((rule: Rule, context?: ValidationContext) => SchemaValidationValue);
|
|
2051
2057
|
/** @public */
|
|
2052
2058
|
type DeprecatedSchemaType<TSchemaType extends BaseSchemaType = BaseSchemaType> = TSchemaType & DeprecationConfiguration;
|
|
2053
2059
|
/** @public */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/types",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.0-next.28+bbadd3b534",
|
|
4
4
|
"description": "Type definitions for common Sanity data structures",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"react": "^19.2.4",
|
|
48
48
|
"rimraf": "^5.0.10",
|
|
49
49
|
"vitest": "^4.0.18",
|
|
50
|
-
"@repo/eslint-config": "5.
|
|
51
|
-
"@repo/package.config": "5.
|
|
52
|
-
"@repo/
|
|
53
|
-
"@repo/
|
|
50
|
+
"@repo/eslint-config": "5.10.0-next.28+bbadd3b534",
|
|
51
|
+
"@repo/package.config": "5.10.0-next.28+bbadd3b534",
|
|
52
|
+
"@repo/tsconfig": "5.10.0-next.28+bbadd3b534",
|
|
53
|
+
"@repo/test-config": "5.10.0-next.28+bbadd3b534"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@types/react": "^19.2"
|