Files
med-notes/.pnpm-store/v10/files/cd/3f5e822d89e49d135b66f9147f962ff58a3edbb34403b3ee0919021c96f8e0081a40e47349139aff9300b2f4aa26c768dd4ffd08d35a19b25ff25dfffef750
2025-05-09 05:30:08 +02:00

41 lines
1.0 KiB
Plaintext

/**
* @fileoverview Types for object-schema package.
*/
/**
* Built-in validation strategies.
*/
export type BuiltInValidationStrategy = "array" | "boolean" | "number" | "object" | "object?" | "string" | "string!";
/**
* Built-in merge strategies.
*/
export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace";
/**
* Property definition.
*/
export interface PropertyDefinition {
/**
* Indicates if the property is required.
*/
required: boolean;
/**
* The other properties that must be present when this property is used.
*/
requires?: string[];
/**
* The strategy to merge the property.
*/
merge: BuiltInMergeStrategy | ((target: any, source: any) => any);
/**
* The strategy to validate the property.
*/
validate: BuiltInValidationStrategy | ((value: any) => void);
/**
* The schema for the object value of this property.
*/
schema?: ObjectDefinition;
}
/**
* Object definition.
*/
export type ObjectDefinition = Record<string, PropertyDefinition>;