schemastery
Advanced tools
Comparing version 3.12.0 to 3.13.0
@@ -23,4 +23,4 @@ import { Dict } from 'cosmokit'; | ||
interface Static { | ||
<T = any>(options: Partial<Schema.Base<T>>): Schema<T>; | ||
new <T = any>(options: Partial<Schema.Base<T>>): Schema<T>; | ||
<T = any>(options: Partial<Schema<T>>): Schema<T>; | ||
new <T = any>(options: Partial<Schema<T>>): Schema<T>; | ||
prototype: Schema; | ||
@@ -53,8 +53,33 @@ resolve: Resolve; | ||
} | ||
interface Meta<T = any> { | ||
default?: T extends {} ? Partial<T> : T; | ||
required?: boolean; | ||
disabled?: boolean; | ||
collapse?: boolean; | ||
badges?: { | ||
text: string; | ||
type: string; | ||
}[]; | ||
hidden?: boolean; | ||
loose?: boolean; | ||
role?: string; | ||
extra?: any; | ||
link?: string; | ||
description?: string | Dict<string>; | ||
comment?: string; | ||
pattern?: { | ||
source: string; | ||
flags?: string; | ||
}; | ||
max?: number; | ||
min?: number; | ||
step?: number; | ||
} | ||
} | ||
} | ||
declare namespace Schema { | ||
interface Base<T = any> { | ||
interface Schemastery<S = any, T = S> { | ||
(data?: S | null, options?: Schemastery.Options): T; | ||
new (data?: S | null, options?: Schemastery.Options): T; | ||
[kSchema]: true; | ||
uid: number; | ||
meta: Meta<T>; | ||
meta: Schemastery.Meta<T>; | ||
type: string; | ||
@@ -71,55 +96,28 @@ sKey?: Schema; | ||
toString(inline?: boolean): string; | ||
toJSON(): Schema<S, T>; | ||
required(value?: boolean): Schema<S, T>; | ||
hidden(value?: boolean): Schema<S, T>; | ||
loose(value?: boolean): Schema<S, T>; | ||
role(text: string, extra?: any): Schema<S, T>; | ||
link(link: string): Schema<S, T>; | ||
default(value: T): Schema<S, T>; | ||
comment(text: string): Schema<S, T>; | ||
description(text: string): Schema<S, T>; | ||
disabled(): Schema<S, T>; | ||
collapse(): Schema<S, T>; | ||
deprecated(): Schema<S, T>; | ||
experimental(): Schema<S, T>; | ||
pattern(regexp: RegExp): Schema<S, T>; | ||
max(value: number): Schema<S, T>; | ||
min(value: number): Schema<S, T>; | ||
step(value: number): Schema<S, T>; | ||
set(key: string, value: Schema): Schema<S, T>; | ||
push(value: Schema): Schema<S, T>; | ||
simplify(value?: any): any; | ||
i18n(messages: Dict): Schema<S, T>; | ||
extra<K extends keyof Schemastery.Meta>(key: K, value: Schemastery.Meta[K]): Schema<S, T>; | ||
} | ||
interface Meta<T = any> { | ||
default?: T extends {} ? Partial<T> : T; | ||
required?: boolean; | ||
disabled?: boolean; | ||
collapse?: boolean; | ||
badges?: { | ||
text: string; | ||
type: string; | ||
}[]; | ||
hidden?: boolean; | ||
loose?: boolean; | ||
role?: string; | ||
extra?: any; | ||
link?: string; | ||
description?: string | Dict<string>; | ||
comment?: string; | ||
pattern?: { | ||
source: string; | ||
flags?: string; | ||
}; | ||
max?: number; | ||
min?: number; | ||
step?: number; | ||
} | ||
} | ||
type Schema<S = any, T = S> = Schemastery<S, T>; | ||
declare const Schema: Schemastery.Static; | ||
interface Schema<S = any, T = S> extends Schema.Base<T> { | ||
(data?: S | null, options?: Schemastery.Options): T; | ||
new (data?: S | null, options?: Schemastery.Options): T; | ||
[kSchema]: true; | ||
toJSON(): Schema.Base<T>; | ||
required(value?: boolean): Schema<S, T>; | ||
hidden(value?: boolean): Schema<S, T>; | ||
loose(value?: boolean): Schema<S, T>; | ||
role(text: string, extra?: any): Schema<S, T>; | ||
link(link: string): Schema<S, T>; | ||
default(value: T): Schema<S, T>; | ||
comment(text: string): Schema<S, T>; | ||
description(text: string): Schema<S, T>; | ||
disabled(): Schema<S, T>; | ||
collapse(): Schema<S, T>; | ||
deprecated(): Schema<S, T>; | ||
experimental(): Schema<S, T>; | ||
pattern(regexp: RegExp): Schema<S, T>; | ||
max(value: number): Schema<S, T>; | ||
min(value: number): Schema<S, T>; | ||
step(value: number): Schema<S, T>; | ||
set(key: string, value: Schema): Schema<S, T>; | ||
push(value: Schema): Schema<S, T>; | ||
simplify(value?: any): any; | ||
i18n(messages: Dict): Schema<S, T>; | ||
} | ||
export = Schema; |
{ | ||
"name": "schemastery", | ||
"description": "Type driven schema validator", | ||
"version": "3.12.0", | ||
"version": "3.13.0", | ||
"main": "lib/index.cjs", | ||
@@ -6,0 +6,0 @@ "module": "lib/index.mjs", |
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
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
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
133119
1237