@decaf-ts/decorator-validation 1.20.0 → 1.21.1
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/README.md +1 -1
- package/dist/decorator-validation.cjs +1 -1
- package/dist/decorator-validation.cjs.map +1 -1
- package/dist/decorator-validation.js +1 -1
- package/dist/decorator-validation.js.map +1 -1
- package/lib/cjs/index.cjs +2 -1
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/types/constants/index.d.cts +2 -2
- package/lib/types/constants/index.d.mts +2 -2
- package/lib/types/index.d.cts +8 -7
- package/lib/types/index.d.mts +8 -7
- package/lib/types/model/Builder.d.cts +3 -3
- package/lib/types/model/Builder.d.mts +3 -3
- package/lib/types/model/Model.d.cts +4 -4
- package/lib/types/model/Model.d.mts +4 -4
- package/lib/types/model/ModelErrorDefinition.d.cts +1 -1
- package/lib/types/model/ModelErrorDefinition.d.mts +1 -1
- package/lib/types/model/ModelRegistry.d.cts +3 -3
- package/lib/types/model/ModelRegistry.d.mts +3 -3
- package/lib/types/model/construction.d.cts +1 -1
- package/lib/types/model/construction.d.mts +1 -1
- package/lib/types/model/index.d.cts +10 -10
- package/lib/types/model/index.d.mts +10 -10
- package/lib/types/model/types.d.cts +3 -3
- package/lib/types/model/types.d.mts +3 -3
- package/lib/types/model/utils.d.cts +1 -1
- package/lib/types/model/utils.d.mts +1 -1
- package/lib/types/model/validation.d.cts +3 -3
- package/lib/types/model/validation.d.mts +3 -3
- package/lib/types/overrides/Metadata.d.cts +3 -3
- package/lib/types/overrides/Metadata.d.mts +3 -3
- package/lib/types/overrides/index.d.cts +3 -3
- package/lib/types/overrides/index.d.mts +3 -3
- package/lib/types/overrides/types.d.cts +1 -1
- package/lib/types/overrides/types.d.mts +1 -1
- package/lib/types/types/index.d.cts +1 -1
- package/lib/types/types/index.d.mts +1 -1
- package/lib/types/types/validation.d.cts +2 -2
- package/lib/types/types/validation.d.mts +2 -2
- package/lib/types/utils/index.d.cts +11 -11
- package/lib/types/utils/index.d.mts +11 -11
- package/lib/types/utils/serialization.d.cts +1 -1
- package/lib/types/utils/serialization.d.mts +1 -1
- package/lib/types/utils/serializers.d.cts +2 -2
- package/lib/types/utils/serializers.d.mts +2 -2
- package/lib/types/utils/types.d.cts +1 -1
- package/lib/types/utils/types.d.mts +1 -1
- package/lib/types/validation/Validation.d.cts +2 -2
- package/lib/types/validation/Validation.d.mts +2 -2
- package/lib/types/validation/Validators/AsyncValidator.d.cts +3 -3
- package/lib/types/validation/Validators/AsyncValidator.d.mts +3 -3
- package/lib/types/validation/Validators/BaseValidator.d.cts +3 -3
- package/lib/types/validation/Validators/BaseValidator.d.mts +3 -3
- package/lib/types/validation/Validators/DateValidator.d.cts +2 -2
- package/lib/types/validation/Validators/DateValidator.d.mts +2 -2
- package/lib/types/validation/Validators/DiffValidator.d.cts +3 -3
- package/lib/types/validation/Validators/DiffValidator.d.mts +3 -3
- package/lib/types/validation/Validators/EmailValidator.d.cts +2 -2
- package/lib/types/validation/Validators/EmailValidator.d.mts +2 -2
- package/lib/types/validation/Validators/EqualsValidator.d.cts +3 -3
- package/lib/types/validation/Validators/EqualsValidator.d.mts +3 -3
- package/lib/types/validation/Validators/GreaterThanOrEqualValidator.d.cts +3 -3
- package/lib/types/validation/Validators/GreaterThanOrEqualValidator.d.mts +3 -3
- package/lib/types/validation/Validators/GreaterThanValidator.d.cts +3 -3
- package/lib/types/validation/Validators/GreaterThanValidator.d.mts +3 -3
- package/lib/types/validation/Validators/LessThanOrEqualValidator.d.cts +3 -3
- package/lib/types/validation/Validators/LessThanOrEqualValidator.d.mts +3 -3
- package/lib/types/validation/Validators/LessThanValidator.d.cts +3 -3
- package/lib/types/validation/Validators/LessThanValidator.d.mts +3 -3
- package/lib/types/validation/Validators/ListValidator.d.cts +2 -2
- package/lib/types/validation/Validators/ListValidator.d.mts +2 -2
- package/lib/types/validation/Validators/MaxLengthValidator.d.cts +2 -2
- package/lib/types/validation/Validators/MaxLengthValidator.d.mts +2 -2
- package/lib/types/validation/Validators/MaxValidator.d.cts +2 -2
- package/lib/types/validation/Validators/MaxValidator.d.mts +2 -2
- package/lib/types/validation/Validators/MinLengthValidator.d.cts +2 -2
- package/lib/types/validation/Validators/MinLengthValidator.d.mts +2 -2
- package/lib/types/validation/Validators/MinValidator.d.cts +2 -2
- package/lib/types/validation/Validators/MinValidator.d.mts +2 -2
- package/lib/types/validation/Validators/OptionValidator.d.cts +2 -2
- package/lib/types/validation/Validators/OptionValidator.d.mts +2 -2
- package/lib/types/validation/Validators/PasswordValidator.d.cts +2 -2
- package/lib/types/validation/Validators/PasswordValidator.d.mts +2 -2
- package/lib/types/validation/Validators/PatternValidator.d.cts +2 -2
- package/lib/types/validation/Validators/PatternValidator.d.mts +2 -2
- package/lib/types/validation/Validators/RequiredValidator.d.cts +2 -2
- package/lib/types/validation/Validators/RequiredValidator.d.mts +2 -2
- package/lib/types/validation/Validators/StepValidator.d.cts +2 -2
- package/lib/types/validation/Validators/StepValidator.d.mts +2 -2
- package/lib/types/validation/Validators/TypeValidator.d.cts +2 -2
- package/lib/types/validation/Validators/TypeValidator.d.mts +2 -2
- package/lib/types/validation/Validators/URLValidator.d.cts +2 -2
- package/lib/types/validation/Validators/URLValidator.d.mts +2 -2
- package/lib/types/validation/Validators/Validator.d.cts +3 -3
- package/lib/types/validation/Validators/Validator.d.mts +3 -3
- package/lib/types/validation/Validators/ValidatorRegistry.d.cts +3 -3
- package/lib/types/validation/Validators/ValidatorRegistry.d.mts +3 -3
- package/lib/types/validation/Validators/decorators.d.cts +1 -1
- package/lib/types/validation/Validators/decorators.d.mts +1 -1
- package/lib/types/validation/Validators/index.d.cts +26 -26
- package/lib/types/validation/Validators/index.d.mts +26 -26
- package/lib/types/validation/decorators.d.cts +2 -2
- package/lib/types/validation/decorators.d.mts +2 -2
- package/lib/types/validation/index.d.cts +4 -4
- package/lib/types/validation/index.d.mts +4 -4
- package/lib/types/validation/types.d.cts +2 -2
- package/lib/types/validation/types.d.mts +2 -2
- package/package.json +9 -1
- package/lib/types/constants/errors.d.ts +0 -17
- package/lib/types/constants/index.d.ts +0 -2
- package/lib/types/constants/validation.d.ts +0 -16
- package/lib/types/index.d.ts +0 -20
- package/lib/types/model/Builder.d.ts +0 -86
- package/lib/types/model/Model.d.ts +0 -286
- package/lib/types/model/ModelErrorDefinition.d.ts +0 -22
- package/lib/types/model/ModelRegistry.d.ts +0 -181
- package/lib/types/model/constants.d.ts +0 -65
- package/lib/types/model/construction.d.ts +0 -46
- package/lib/types/model/decorators.d.ts +0 -47
- package/lib/types/model/index.d.ts +0 -10
- package/lib/types/model/types.d.ts +0 -145
- package/lib/types/model/utils.d.ts +0 -13
- package/lib/types/model/validation.d.ts +0 -92
- package/lib/types/overrides/Metadata.d.ts +0 -132
- package/lib/types/overrides/index.d.ts +0 -4
- package/lib/types/overrides/overrides.d.ts +0 -1
- package/lib/types/overrides/types.d.ts +0 -17
- package/lib/types/types/index.d.ts +0 -1
- package/lib/types/types/validation.d.ts +0 -28
- package/lib/types/utils/DateBuilder.d.ts +0 -121
- package/lib/types/utils/PathProxy.d.ts +0 -43
- package/lib/types/utils/constants.d.ts +0 -32
- package/lib/types/utils/dates.d.ts +0 -86
- package/lib/types/utils/equality.d.ts +0 -56
- package/lib/types/utils/hashing.d.ts +0 -82
- package/lib/types/utils/index.d.ts +0 -11
- package/lib/types/utils/registry.d.ts +0 -68
- package/lib/types/utils/serialization.d.ts +0 -12
- package/lib/types/utils/serializers.d.ts +0 -41
- package/lib/types/utils/strings.d.ts +0 -25
- package/lib/types/utils/types.d.ts +0 -35
- package/lib/types/validation/Validation.d.ts +0 -53
- package/lib/types/validation/Validators/AsyncValidator.d.ts +0 -72
- package/lib/types/validation/Validators/BaseValidator.d.ts +0 -118
- package/lib/types/validation/Validators/DateValidator.d.ts +0 -60
- package/lib/types/validation/Validators/DiffValidator.d.ts +0 -29
- package/lib/types/validation/Validators/EmailValidator.d.ts +0 -60
- package/lib/types/validation/Validators/EqualsValidator.d.ts +0 -29
- package/lib/types/validation/Validators/GreaterThanOrEqualValidator.d.ts +0 -29
- package/lib/types/validation/Validators/GreaterThanValidator.d.ts +0 -29
- package/lib/types/validation/Validators/LessThanOrEqualValidator.d.ts +0 -29
- package/lib/types/validation/Validators/LessThanValidator.d.ts +0 -29
- package/lib/types/validation/Validators/ListValidator.d.ts +0 -66
- package/lib/types/validation/Validators/MaxLengthValidator.d.ts +0 -29
- package/lib/types/validation/Validators/MaxValidator.d.ts +0 -74
- package/lib/types/validation/Validators/MinLengthValidator.d.ts +0 -29
- package/lib/types/validation/Validators/MinValidator.d.ts +0 -74
- package/lib/types/validation/Validators/OptionValidator.d.ts +0 -29
- package/lib/types/validation/Validators/PasswordValidator.d.ts +0 -28
- package/lib/types/validation/Validators/PatternValidator.d.ts +0 -103
- package/lib/types/validation/Validators/RequiredValidator.d.ts +0 -74
- package/lib/types/validation/Validators/StepValidator.d.ts +0 -29
- package/lib/types/validation/Validators/TypeValidator.d.ts +0 -79
- package/lib/types/validation/Validators/URLValidator.d.ts +0 -61
- package/lib/types/validation/Validators/Validator.d.ts +0 -65
- package/lib/types/validation/Validators/ValidatorRegistry.d.ts +0 -41
- package/lib/types/validation/Validators/constants.d.ts +0 -157
- package/lib/types/validation/Validators/decorators.d.ts +0 -12
- package/lib/types/validation/Validators/index.d.ts +0 -26
- package/lib/types/validation/Validators/utils.d.ts +0 -75
- package/lib/types/validation/decorators.d.ts +0 -313
- package/lib/types/validation/index.d.ts +0 -9
- package/lib/types/validation/types.d.ts +0 -309
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import type { ConditionalAsync } from "../types";
|
|
2
|
-
import { ModelErrorDefinition } from "./ModelErrorDefinition";
|
|
3
|
-
import { Model } from "./Model";
|
|
4
|
-
/**
|
|
5
|
-
* @description Function type for building model instances from objects
|
|
6
|
-
* @summary Type definition for a model builder function that populates model properties
|
|
7
|
-
* @template T
|
|
8
|
-
* @param {T} self - The target model instance to populate
|
|
9
|
-
* @param {T | Record<string, any>} [obj] - The source object containing properties to copy
|
|
10
|
-
* @return {T} - The populated model instance
|
|
11
|
-
* @typedef ModelBuilderFunction
|
|
12
|
-
* @memberOf module:decorator-validation
|
|
13
|
-
*/
|
|
14
|
-
export type ModelBuilderFunction = <T extends Model>(self: T, obj?: T | Record<string, any>) => T;
|
|
15
|
-
/**
|
|
16
|
-
* @description Type representing valid argument types for model constructors
|
|
17
|
-
* @summary Definition of a Model Constructor Argument that can be a complete model, partial model, or plain object
|
|
18
|
-
* @template T
|
|
19
|
-
* @typedef ModelArg
|
|
20
|
-
* @memberOf module:decorator-validation
|
|
21
|
-
* @see ModelConstructor
|
|
22
|
-
*/
|
|
23
|
-
export type ModelArg<T> = T | Partial<T> | Record<string, any>;
|
|
24
|
-
/**
|
|
25
|
-
* @description Specialized constructor type for Model classes
|
|
26
|
-
* @summary Definition of a Model Constructor that creates instances of Model subclasses
|
|
27
|
-
* @template T
|
|
28
|
-
* @param {ModelArg<T>} [model] - Initial data to populate the model with
|
|
29
|
-
* @param {any[]} [args] - Additional constructor arguments
|
|
30
|
-
* @return {T} - An instance of the model class
|
|
31
|
-
* @typedef ModelConstructor
|
|
32
|
-
* @memberOf module:decorator-validation
|
|
33
|
-
*/
|
|
34
|
-
export type ModelConstructor<T extends Model> = {
|
|
35
|
-
new (model?: ModelArg<T>, ...args: any[]): T;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* @description Interface for objects that can be validated.
|
|
39
|
-
* @summary Defines the Validation API for validation behavior on models, supporting both synchronous and asynchronous validations.
|
|
40
|
-
* Implementers must provide a `hasErrors` method that performs the validation and returns either validation errors or undefined if validation passes.
|
|
41
|
-
*
|
|
42
|
-
* @template Async - A boolean flag indicating whether the validation is asynchronous (`true`) or synchronous (`false`).
|
|
43
|
-
*
|
|
44
|
-
* @param {any[]} [args] - Optional arguments to control validation behavior passed to the validation method.
|
|
45
|
-
*
|
|
46
|
-
* @interface Validatable
|
|
47
|
-
* @category Model
|
|
48
|
-
* @memberOf module:decorator-validation
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```typescript
|
|
52
|
-
* // Synchronous validation example
|
|
53
|
-
* class SyncModel implements Validatable<false> {
|
|
54
|
-
* hasErrors(...args: any[]): ModelErrorDefinition | undefined {
|
|
55
|
-
* // perform synchronous validation logic
|
|
56
|
-
* return undefined; // or return errors if invalid
|
|
57
|
-
* }
|
|
58
|
-
* }
|
|
59
|
-
*
|
|
60
|
-
* // Asynchronous validation example
|
|
61
|
-
* class AsyncModel implements Validatable<true> {
|
|
62
|
-
* async hasErrors(...args: any[]): Promise<ModelErrorDefinition | undefined> {
|
|
63
|
-
* // perform asynchronous validation logic
|
|
64
|
-
* return undefined; // or return errors if invalid
|
|
65
|
-
* }
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export interface Validatable<Async extends boolean = false> {
|
|
70
|
-
/**
|
|
71
|
-
* @description Validates the object against its validation rules.
|
|
72
|
-
* @summary Validates the model and returns the {@link ModelErrorDefinition} if any errors exist, or `undefined` if no errors.
|
|
73
|
-
*
|
|
74
|
-
* @param {any[]} [args] - Optional arguments that may influence validation logic.
|
|
75
|
-
* @return {ConditionalAsync<Async, ModelErrorDefinition | undefined>} Validation errors or undefined, conditionally wrapped in a Promise if asynchronous.
|
|
76
|
-
*
|
|
77
|
-
* @method
|
|
78
|
-
*/
|
|
79
|
-
hasErrors(...args: any[]): ConditionalAsync<Async, ModelErrorDefinition | undefined>;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @description Interface for objects that can be serialized to string
|
|
83
|
-
* @summary Defines the serialization API for model objects
|
|
84
|
-
* @interface Serializable
|
|
85
|
-
* @memberOf module:decorator-validation
|
|
86
|
-
* @category Model
|
|
87
|
-
*/
|
|
88
|
-
export interface Serializable {
|
|
89
|
-
/**
|
|
90
|
-
* @description Converts the object to a serialized string representation
|
|
91
|
-
* @summary Serializes the model to a string format
|
|
92
|
-
* @return {string} - The serialized string representation
|
|
93
|
-
* @method
|
|
94
|
-
*/
|
|
95
|
-
serialize(...args: any[]): string;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* @description Interface for objects that can generate a hash representation
|
|
99
|
-
* @summary Defines the hashing API for model objects
|
|
100
|
-
* @interface Hashable
|
|
101
|
-
* @memberOf module:decorator-validation
|
|
102
|
-
* @category Model
|
|
103
|
-
*/
|
|
104
|
-
export interface Hashable {
|
|
105
|
-
/**
|
|
106
|
-
* @description Generates a unique hash string for the object
|
|
107
|
-
* @summary Creates a hash string representation of the object
|
|
108
|
-
* @return {string} - Hash value representing the object
|
|
109
|
-
* @method
|
|
110
|
-
*/
|
|
111
|
-
hash(...args: any[]): string;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @description Interface for objects that can be compared with other objects
|
|
115
|
-
* @summary Defines the equality comparison API for model objects
|
|
116
|
-
* @template T
|
|
117
|
-
* @interface Comparable
|
|
118
|
-
* @memberOf module:decorator-validation
|
|
119
|
-
* @category Model
|
|
120
|
-
*/
|
|
121
|
-
export interface Comparable {
|
|
122
|
-
/**
|
|
123
|
-
* @description Determines if this object is equal to another object
|
|
124
|
-
* @summary Compares this object with another for equality
|
|
125
|
-
* @param {T} other - The object to compare with
|
|
126
|
-
* @param {any[]} [args] - Additional arguments for comparison
|
|
127
|
-
* @return {boolean} - True if the objects are equal, false otherwise
|
|
128
|
-
* @method
|
|
129
|
-
*/
|
|
130
|
-
equals<T extends Model>(this: T, other: T, ...args: any[]): boolean;
|
|
131
|
-
compare<T extends Model>(this: T, other: T, ...args: any[]): Comparison<T> | undefined;
|
|
132
|
-
}
|
|
133
|
-
export type SetterKeyFor<OBJ, K extends keyof OBJ> = `set${Capitalize<string & K>}`;
|
|
134
|
-
export type SetterFor<OBJ, K extends keyof OBJ, R> = (value: OBJ[K]) => R;
|
|
135
|
-
export type Builder<OUT, ARGS extends any[] = any[], IN = OUT> = {
|
|
136
|
-
[K in keyof OUT as K extends keyof Model | "build" ? never : K]: OUT[K];
|
|
137
|
-
} & {
|
|
138
|
-
[K in keyof OUT as K extends keyof Model | "build" ? never : SetterKeyFor<OUT, K>]: SetterFor<OUT, K, IN>;
|
|
139
|
-
} & {
|
|
140
|
-
build: (...args: ARGS) => OUT | Promise<OUT>;
|
|
141
|
-
};
|
|
142
|
-
export type Comparison<M, K extends keyof M = keyof M> = Record<K, {
|
|
143
|
-
other: M[K] | undefined;
|
|
144
|
-
current: M[K] | undefined;
|
|
145
|
-
}>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ConditionalAsync } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Wraps a value in a Promise if the `async` flag is true.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The type of the value being wrapped.
|
|
6
|
-
* @template Async - A boolean type that determines if the result should be wrapped in a Promise.
|
|
7
|
-
*
|
|
8
|
-
* @param value - The value to return directly or wrap in a Promise.
|
|
9
|
-
* @param async - If true, the value is wrapped in a resolved Promise. If false or undefined, the value is returned as-is.
|
|
10
|
-
*
|
|
11
|
-
* @returns The original value or a Promise resolving to it, depending on the `async` flag.
|
|
12
|
-
*/
|
|
13
|
-
export declare function toConditionalPromise<T, Async extends boolean>(value: T, async?: Async): ConditionalAsync<Async, T>;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { ModelErrorDefinition } from "./ModelErrorDefinition";
|
|
2
|
-
import type { Model } from "./Model";
|
|
3
|
-
import { ConditionalAsync } from "../types";
|
|
4
|
-
export declare function validateChildValue<M extends Model>(prop: string, childValue: any, parentModel: M, allowedTypes: string[], async: boolean, ...propsToIgnore: string[]): string | undefined | ModelErrorDefinition | Promise<string | undefined | ModelErrorDefinition>;
|
|
5
|
-
/**
|
|
6
|
-
* @description Retrieves nested properties to ignore for child validation
|
|
7
|
-
* @param parentProp - The property of the parent model
|
|
8
|
-
* @param propsToIgnore - Properties to ignore from the parent model
|
|
9
|
-
* @returns An array of properties to ignore for the child model
|
|
10
|
-
*/
|
|
11
|
-
export declare function getChildNestedPropsToIgnore(parentProp: string, ...propsToIgnore: string[]): string[];
|
|
12
|
-
export declare function validateDecorator<M extends Model, Async extends boolean = false>(model: M, value: any, decorator: any, async?: Async): ConditionalAsync<Async, string | undefined>;
|
|
13
|
-
/**
|
|
14
|
-
* @description
|
|
15
|
-
* Executes validation logic for a set of decorators applied to a model's property, handling both
|
|
16
|
-
* synchronous and asynchronous validations, including support for nested validations and lists.
|
|
17
|
-
*
|
|
18
|
-
* @summary
|
|
19
|
-
* Iterates over an array of decorator metadata objects and applies each validation rule to the
|
|
20
|
-
* provided value. For list decorators (`ValidationKeys.LIST`), it performs element-wise validation,
|
|
21
|
-
* supporting nested model validation and type checks. If the `async` flag is set, asynchronous
|
|
22
|
-
* validation is supported using `Promise.all`. The result is a record mapping validation keys to
|
|
23
|
-
* error messages, or `undefined` if no errors are found.
|
|
24
|
-
*
|
|
25
|
-
* @template M - A type parameter extending `Model`, representing the model type being validated.
|
|
26
|
-
* @template Async - A boolean indicating whether validation should be performed asynchronously.
|
|
27
|
-
*
|
|
28
|
-
* @param {M} model - The model instance that the validation is associated with.
|
|
29
|
-
* @param {string} prop - The model field name
|
|
30
|
-
* @param {any} value - The value to be validated against the provided decorators.
|
|
31
|
-
* @param {DecoratorMetadataAsync} decorators - An object of metadata representing validation decorators.
|
|
32
|
-
* @param {Async} [async] - Optional flag indicating whether validation should be performed asynchronously.
|
|
33
|
-
*
|
|
34
|
-
* @return {ConditionalAsync<Async, Record<string, string>> | undefined}
|
|
35
|
-
* Returns either a record of validation errors (keyed by the decorator key) or `undefined` if no errors are found.
|
|
36
|
-
* If `async` is true, the return value is a Promise resolving to the same structure.
|
|
37
|
-
*
|
|
38
|
-
* @function validateDecorators
|
|
39
|
-
*/
|
|
40
|
-
export declare function validateDecorators<M extends Model, Async extends boolean = false>(model: M, prop: string, value: any, decorators: any, async?: Async, ...propsToIgnore: string[]): ConditionalAsync<Async, Record<string, string> | undefined>;
|
|
41
|
-
/**
|
|
42
|
-
* @function validate
|
|
43
|
-
* @template M
|
|
44
|
-
* @template Async
|
|
45
|
-
* @memberOf module:decorator-validation
|
|
46
|
-
* @category Model
|
|
47
|
-
*
|
|
48
|
-
* @description
|
|
49
|
-
* Validates the properties of a {@link Model} instance using registered decorators.
|
|
50
|
-
* Supports both synchronous and asynchronous validation flows, depending on the `async` flag.
|
|
51
|
-
*
|
|
52
|
-
* @summary
|
|
53
|
-
* This function inspects a given model object, identifies decorated properties that require validation,
|
|
54
|
-
* and applies the corresponding validation rules. It also supports nested model validation and gracefully
|
|
55
|
-
* merges any validation errors. For collections (Array/Set), it enforces the presence of the `@list` decorator
|
|
56
|
-
* and checks the type of elements. If a property is a nested model, it will call `hasErrors` on it and flatten
|
|
57
|
-
* the nested error keys using dot notation.
|
|
58
|
-
*
|
|
59
|
-
* @param {M} model - The model instance to be validated. Must extend from {@link Model}.
|
|
60
|
-
* @param {Async} [async] - A flag indicating whether validation should be asynchronous.
|
|
61
|
-
* @param {...string} propsToIgnore - A variadic list of property names that should be skipped during validation.
|
|
62
|
-
*
|
|
63
|
-
* @returns {ConditionalAsync<Async, ModelErrorDefinition | undefined>}
|
|
64
|
-
* Returns either a {@link ModelErrorDefinition} containing validation errors,
|
|
65
|
-
* or `undefined` if no errors are found. When `async` is `true`, returns a Promise.
|
|
66
|
-
*
|
|
67
|
-
* @see {@link Model}
|
|
68
|
-
* @see {@link ModelErrorDefinition}
|
|
69
|
-
* @see {@link validateDecorators}
|
|
70
|
-
* @see {@link getValidatableProperties}
|
|
71
|
-
*
|
|
72
|
-
* @mermaid
|
|
73
|
-
* sequenceDiagram
|
|
74
|
-
* participant Caller
|
|
75
|
-
* participant validate
|
|
76
|
-
* participant getValidatableProperties
|
|
77
|
-
* participant validateDecorators
|
|
78
|
-
* participant ModelInstance
|
|
79
|
-
* Caller->>validate: call with obj, async, propsToIgnore
|
|
80
|
-
* validate->>getValidatableProperties: retrieve decorated props
|
|
81
|
-
* loop for each property
|
|
82
|
-
* validate->>validateDecorators: validate using decorators
|
|
83
|
-
* alt is nested model
|
|
84
|
-
* validate->>ModelInstance: call hasErrors()
|
|
85
|
-
* end
|
|
86
|
-
* end
|
|
87
|
-
* alt async
|
|
88
|
-
* validate->>validate: Promise.allSettled for errors
|
|
89
|
-
* end
|
|
90
|
-
* validate-->>Caller: return ModelErrorDefinition | undefined
|
|
91
|
-
*/
|
|
92
|
-
export declare function validate<M extends Model<boolean>, Async extends boolean = false>(model: M, async: Async, ...propsToIgnore: string[]): ConditionalAsync<Async, ModelErrorDefinition | undefined>;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { Model } from "../model/Model";
|
|
2
|
-
import "@decaf-ts/decoration";
|
|
3
|
-
import { Constructor } from "@decaf-ts/decoration";
|
|
4
|
-
import { designTypeReturn, ExtendedMetadata } from "./types";
|
|
5
|
-
import { ValidationMetadata } from "../validation/types";
|
|
6
|
-
declare module "@decaf-ts/decoration" {
|
|
7
|
-
namespace Metadata {
|
|
8
|
-
/**
|
|
9
|
-
* @description Retrieves validation metadata for a specific property of a model
|
|
10
|
-
* @summary Fetches validation rules and constraints that were applied to a property
|
|
11
|
-
* via decorators. The optional key parameter allows drilling down to specific
|
|
12
|
-
* validation types (e.g., 'required', 'min', 'max').
|
|
13
|
-
*
|
|
14
|
-
* @template M - The model type extending from Model
|
|
15
|
-
* @param {Constructor<M>} model - The constructor of the target model class
|
|
16
|
-
* @param {keyof M} property - The property name to retrieve validation for
|
|
17
|
-
* @param {string} [key] - Optional specific validation key to retrieve (e.g., 'required', 'pattern')
|
|
18
|
-
* @return {any} The validation metadata object or value at the specified key
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* class User extends Model {
|
|
22
|
-
* @required()
|
|
23
|
-
* @maxLength(100)
|
|
24
|
-
* name!: string;
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* // Get all validation metadata for 'name'
|
|
28
|
-
* const validations = Metadata.validationFor(User, 'name');
|
|
29
|
-
*
|
|
30
|
-
* // Get specific validation metadata
|
|
31
|
-
* const required = Metadata.validationFor(User, 'name', 'required');
|
|
32
|
-
*/
|
|
33
|
-
function validationFor<M extends Model, P extends keyof M = keyof M, K extends string = string>(this: Metadata, model: Constructor<M>, property?: keyof M, key?: string): (K extends string ? ValidationMetadata : P extends keyof M ? Record<string, ValidationMetadata> : Record<keyof M, Record<string, ValidationMetadata>>) | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* @description Retrieves all validatable for a model
|
|
36
|
-
* @param model
|
|
37
|
-
*/
|
|
38
|
-
function validatableProperties<M extends Model>(model: Constructor<M>, ...propsToIgnore: string[]): string[];
|
|
39
|
-
/**
|
|
40
|
-
* @description Retrieves extended metadata for a model or a specific key within it
|
|
41
|
-
* @summary When called with a constructor only, returns the entire metadata object
|
|
42
|
-
* associated with the model, including validation rules, property types, relationships,
|
|
43
|
-
* and other decorator-applied metadata. This override extends the base Metadata.get
|
|
44
|
-
* method with type-safe support for ExtendedMetadata.
|
|
45
|
-
*
|
|
46
|
-
* @template M - The model type
|
|
47
|
-
* @template META - The extended metadata type, defaults to ExtendedMetadata<M>
|
|
48
|
-
* @param {Constructor<M>} model - The target constructor used to locate the metadata record
|
|
49
|
-
* @param {keyof M} prop - Optional property of the model.
|
|
50
|
-
* @return {META|undefined} The complete metadata object for the model, or undefined if no metadata exists
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* class Article extends Model {
|
|
54
|
-
* @pk()
|
|
55
|
-
* @type(Number)
|
|
56
|
-
* id!: number;
|
|
57
|
-
*
|
|
58
|
-
* @required()
|
|
59
|
-
* @maxLength(200)
|
|
60
|
-
* title!: string;
|
|
61
|
-
*
|
|
62
|
-
* @oneToMany(() => Comment, { update: true, delete: true }, true)
|
|
63
|
-
* comments!: Comment[];
|
|
64
|
-
* }
|
|
65
|
-
*
|
|
66
|
-
* // Get all metadata for the Article model
|
|
67
|
-
* const metadata = Metadata.get<Article>(Article);
|
|
68
|
-
* // metadata contains:
|
|
69
|
-
* // - property definitions
|
|
70
|
-
* // - validation rules
|
|
71
|
-
* // - relationship mappings
|
|
72
|
-
* // - primary key information
|
|
73
|
-
* // - column mappings
|
|
74
|
-
*
|
|
75
|
-
* @remarks
|
|
76
|
-
* The @ts-expect-error directive is used because this declaration intentionally
|
|
77
|
-
* overrides the signature from the base module to provide enhanced type information
|
|
78
|
-
* specific to the decorator-validation system.
|
|
79
|
-
*/
|
|
80
|
-
function get<M, META extends ExtendedMetadata<M> = ExtendedMetadata<M>>(model: Constructor<M>, prop?: keyof M): META | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* @description Retrieves the original constructor name for a model
|
|
83
|
-
* @summary Fetches the original constructor name for a model from the metadata of a model.
|
|
84
|
-
*
|
|
85
|
-
* @template M - The model type extending from Model
|
|
86
|
-
* @param {Constructor<M>} model - The constructor of the target model class
|
|
87
|
-
* @return {string} The metadata object or value
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* class User extends Model {
|
|
91
|
-
*
|
|
92
|
-
* // Get the constructor name for 'User'
|
|
93
|
-
* const constName = Metadata.modelName(User);
|
|
94
|
-
*/
|
|
95
|
-
function modelName<M>(model: Constructor<M>): string;
|
|
96
|
-
/**
|
|
97
|
-
* @description Retrieves all allowed types for a model or a property
|
|
98
|
-
* @summary Retrieves all allowed types for a model or a property from it's metadata.
|
|
99
|
-
*
|
|
100
|
-
* @template M - The model type extending from Model
|
|
101
|
-
* @param {Constructor<M>} model - The constructor of the target model class
|
|
102
|
-
* @param {keyof M} property - The property name to retrieve validation for
|
|
103
|
-
* @return {any[]} An array of the allowed types
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* class User extends Model {
|
|
107
|
-
*
|
|
108
|
-
* // Get all validation metadata for 'User'
|
|
109
|
-
* const allowedTypes = Metadata.meallowedTypestadata(User);
|
|
110
|
-
*/
|
|
111
|
-
function allowedTypes<M>(model: Constructor<M>, property?: keyof M): any[];
|
|
112
|
-
/**
|
|
113
|
-
* @description Retrieves all allowed types for a model or a property
|
|
114
|
-
* @summary Retrieves all allowed types for a model or a property from it's metadata.
|
|
115
|
-
*
|
|
116
|
-
* @template model - The model type extending from Model
|
|
117
|
-
* @param {Constructor<M>} model - The constructor of the target model class
|
|
118
|
-
* @param {keyof M} property - The property name to retrieve validation for
|
|
119
|
-
* @return {designTypeReturn} An object of the designtypes
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* class User extends Model {
|
|
123
|
-
*
|
|
124
|
-
* // Get the designtypes for property name
|
|
125
|
-
* const { designTypes, designType } = Metadata.getPropDesignTypes(User.constructor, 'name');
|
|
126
|
-
*/
|
|
127
|
-
function getPropDesignTypes<M>(model: Constructor<M>, property: keyof M): designTypeReturn;
|
|
128
|
-
function isModel(target: Record<string, any>): boolean;
|
|
129
|
-
function isPropertyModel<M extends Model>(target: M, attribute: string): boolean | string | undefined;
|
|
130
|
-
function getAttributes<V extends Model>(model: Constructor<V> | V): string[];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./Metadata";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BasicMetadata } from "@decaf-ts/decoration";
|
|
2
|
-
import { ValidatorOptions } from "../validation/types";
|
|
3
|
-
export type ExtendedMetadata<M> = BasicMetadata<M> & {
|
|
4
|
-
validation: Record<keyof M, ValidatorOptions>;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* @description Return type for design type information.
|
|
8
|
-
* @summary Defines the structure of the return type for functions that provide design type information.
|
|
9
|
-
* @property {any[]} designTypes An array of design types.
|
|
10
|
-
* @property {any} designType The primary design type.
|
|
11
|
-
* @typedef {object} designTypeReturn
|
|
12
|
-
* @memberOf module:decorator-validation
|
|
13
|
-
*/
|
|
14
|
-
export type designTypeReturn = {
|
|
15
|
-
designTypes: any[];
|
|
16
|
-
designType: any;
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./validation";
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Model } from "../model/Model";
|
|
2
|
-
import { ModelErrorDefinition } from "../model/ModelErrorDefinition";
|
|
3
|
-
/**
|
|
4
|
-
* @description Conditionally wraps a type in a `Promise` based on the `Async` flag.
|
|
5
|
-
* @summary Utility type that resolves to `T` if `Async` is `false`, or to `Promise<T>` if `Async` is `true`.
|
|
6
|
-
* Used to abstract the return type of functions that may be either synchronous or asynchronous depending on a flag.
|
|
7
|
-
*
|
|
8
|
-
* @template Async A boolean flag indicating whether the result should be asynchronous (`true`) or synchronous (`false`).
|
|
9
|
-
* @template T The base type to return directly or to wrap in a `Promise`.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Synchronous result
|
|
14
|
-
* type SyncResult: string | number = ConditionalAsync<false, string | number>;
|
|
15
|
-
*
|
|
16
|
-
* // Asynchronous result
|
|
17
|
-
* type AsyncResult: Promise<string | number> = ConditionalAsync<true, string | number>;
|
|
18
|
-
* ```
|
|
19
|
-
* @memberOf module:decorator-validation
|
|
20
|
-
*/
|
|
21
|
-
export type ConditionalAsync<Async extends boolean, T> = Async extends true ? Promise<T> : T;
|
|
22
|
-
export type DecoratorMetadataAsync = {
|
|
23
|
-
async?: boolean;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated
|
|
27
|
-
*/
|
|
28
|
-
export type ModelConditionalAsync<M> = M extends Model<true> ? Promise<ModelErrorDefinition | undefined> : ModelErrorDefinition | undefined;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
type DateBuilderField = "Years" | "Months" | "Days" | "Hours" | "Minutes" | "Seconds";
|
|
2
|
-
export type DateBuilderInstance = DateBuilder<DateBuilderField>;
|
|
3
|
-
export type DateTarget = Date | DateBuilderInstance;
|
|
4
|
-
export type OffsetValues = {
|
|
5
|
-
years: number;
|
|
6
|
-
months: number;
|
|
7
|
-
days: number;
|
|
8
|
-
hours: number;
|
|
9
|
-
minutes: number;
|
|
10
|
-
seconds: number;
|
|
11
|
-
};
|
|
12
|
-
export declare function offsetDate(date: Date, direction: 1 | -1, values: OffsetValues): Date;
|
|
13
|
-
type RemoveField<Input extends DateBuilderField, Field extends DateBuilderField> = Input extends Field ? never : Input;
|
|
14
|
-
interface DateBuilderUtilityMethods {
|
|
15
|
-
Now(): Date;
|
|
16
|
-
Tomorrow(): Date;
|
|
17
|
-
Yesterday(): Date;
|
|
18
|
-
DaysAgo(count: number): Date;
|
|
19
|
-
NextDays(count: number): Date;
|
|
20
|
-
YearsAgo(count: number): Date;
|
|
21
|
-
NextYears(count: number): Date;
|
|
22
|
-
MonthsAgo(count: number): Date;
|
|
23
|
-
NextMonths(count: number): Date;
|
|
24
|
-
HoursAgo(count: number): Date;
|
|
25
|
-
NextHours(count: number): Date;
|
|
26
|
-
MinutesAgo(count: number): Date;
|
|
27
|
-
NextMinutes(count: number): Date;
|
|
28
|
-
SecondsAgo(count: number): Date;
|
|
29
|
-
NextSeconds(count: number): Date;
|
|
30
|
-
}
|
|
31
|
-
interface DateBuilderCoreMethods extends DateBuilderUtilityMethods {
|
|
32
|
-
build(reference?: DateTarget): Date;
|
|
33
|
-
from(reference: DateTarget): Date;
|
|
34
|
-
past(reference: DateTarget): Date;
|
|
35
|
-
after(reference: DateTarget): Date;
|
|
36
|
-
until(reference: DateTarget): Date;
|
|
37
|
-
before(reference: DateTarget): Date;
|
|
38
|
-
ago(reference?: DateTarget): Date;
|
|
39
|
-
}
|
|
40
|
-
export type DateBuilderChain<Remaining extends DateBuilderField = DateBuilderField> = DateBuilderCoreMethods & {
|
|
41
|
-
[Field in Remaining]: (value: number) => DateBuilderChain<RemoveField<Remaining, Field>>;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Fluent builder for producing dates relative to a reference point.
|
|
45
|
-
*/
|
|
46
|
-
export declare class DateBuilder<Remaining extends DateBuilderField = DateBuilderField> implements DateBuilderCoreMethods {
|
|
47
|
-
private years;
|
|
48
|
-
private months;
|
|
49
|
-
private days;
|
|
50
|
-
private hours;
|
|
51
|
-
private minutes;
|
|
52
|
-
private seconds;
|
|
53
|
-
private constructor();
|
|
54
|
-
static Years(value: number): DateBuilderChain<RemoveField<DateBuilderField, "Years">>;
|
|
55
|
-
static Months(value: number): DateBuilderChain<RemoveField<DateBuilderField, "Months">>;
|
|
56
|
-
static Days(value: number): DateBuilderChain<RemoveField<DateBuilderField, "Days">>;
|
|
57
|
-
static Hours(value: number): DateBuilderChain<RemoveField<DateBuilderField, "Hours">>;
|
|
58
|
-
static Minutes(value: number): DateBuilderChain<RemoveField<DateBuilderField, "Minutes">>;
|
|
59
|
-
static Seconds(value: number): DateBuilderChain<RemoveField<DateBuilderField, "Seconds">>;
|
|
60
|
-
static Now(): Date;
|
|
61
|
-
static Tomorrow(): Date;
|
|
62
|
-
static Yesterday(): Date;
|
|
63
|
-
static DaysAgo(count: number): Date;
|
|
64
|
-
static NextDays(count: number): Date;
|
|
65
|
-
static YearsAgo(count: number): Date;
|
|
66
|
-
static NextYears(count: number): Date;
|
|
67
|
-
static MonthsAgo(count: number): Date;
|
|
68
|
-
static NextMonths(count: number): Date;
|
|
69
|
-
static HoursAgo(count: number): Date;
|
|
70
|
-
static NextHours(count: number): Date;
|
|
71
|
-
static MinutesAgo(count: number): Date;
|
|
72
|
-
static NextMinutes(count: number): Date;
|
|
73
|
-
static SecondsAgo(count: number): Date;
|
|
74
|
-
static NextSeconds(count: number): Date;
|
|
75
|
-
Years(value: number): DateBuilderChain<RemoveField<Remaining, "Years">>;
|
|
76
|
-
Months(value: number): DateBuilderChain<RemoveField<Remaining, "Months">>;
|
|
77
|
-
Days(value: number): DateBuilderChain<RemoveField<Remaining, "Days">>;
|
|
78
|
-
Hours(value: number): DateBuilderChain<RemoveField<Remaining, "Hours">>;
|
|
79
|
-
Minutes(value: number): DateBuilderChain<RemoveField<Remaining, "Minutes">>;
|
|
80
|
-
Seconds(value: number): DateBuilderChain<RemoveField<Remaining, "Seconds">>;
|
|
81
|
-
build(reference?: DateTarget): Date;
|
|
82
|
-
from(reference: DateTarget): Date;
|
|
83
|
-
past(reference: DateTarget): Date;
|
|
84
|
-
after(reference: DateTarget): Date;
|
|
85
|
-
until(reference: DateTarget): Date;
|
|
86
|
-
before(reference: DateTarget): Date;
|
|
87
|
-
ago(reference?: DateTarget): Date;
|
|
88
|
-
Now(): Date;
|
|
89
|
-
Tomorrow(): Date;
|
|
90
|
-
Yesterday(): Date;
|
|
91
|
-
DaysAgo(count: number): Date;
|
|
92
|
-
NextDays(count: number): Date;
|
|
93
|
-
YearsAgo(count: number): Date;
|
|
94
|
-
NextYears(count: number): Date;
|
|
95
|
-
MonthsAgo(count: number): Date;
|
|
96
|
-
NextMonths(count: number): Date;
|
|
97
|
-
HoursAgo(count: number): Date;
|
|
98
|
-
NextHours(count: number): Date;
|
|
99
|
-
MinutesAgo(count: number): Date;
|
|
100
|
-
NextMinutes(count: number): Date;
|
|
101
|
-
SecondsAgo(count: number): Date;
|
|
102
|
-
NextSeconds(count: number): Date;
|
|
103
|
-
private offsets;
|
|
104
|
-
}
|
|
105
|
-
export declare const Dates: typeof DateBuilder;
|
|
106
|
-
export declare const Now: () => Date;
|
|
107
|
-
export declare const Tomorrow: () => Date;
|
|
108
|
-
export declare const Yesterday: () => Date;
|
|
109
|
-
export declare const DaysAgo: (count: number) => Date;
|
|
110
|
-
export declare const NextDays: (count: number) => Date;
|
|
111
|
-
export declare const YearsAgo: (count: number) => Date;
|
|
112
|
-
export declare const NextYears: (count: number) => Date;
|
|
113
|
-
export declare const MonthsAgo: (count: number) => Date;
|
|
114
|
-
export declare const NextMonths: (count: number) => Date;
|
|
115
|
-
export declare const HoursAgo: (count: number) => Date;
|
|
116
|
-
export declare const NextHours: (count: number) => Date;
|
|
117
|
-
export declare const MinutesAgo: (count: number) => Date;
|
|
118
|
-
export declare const NextMinutes: (count: number) => Date;
|
|
119
|
-
export declare const SecondsAgo: (count: number) => Date;
|
|
120
|
-
export declare const NextSeconds: (count: number) => Date;
|
|
121
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Proxy object that provides path-based access to nested properties
|
|
3
|
-
* @template T - The type of the target object being proxied
|
|
4
|
-
*/
|
|
5
|
-
export type PathProxy<T> = T & {
|
|
6
|
-
getValueFromPath: (path: string, fallback?: any) => any;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Standard path resolution utility for accessing nested object properties.
|
|
10
|
-
* Provides consistent dot-notation access to both parent and child properties
|
|
11
|
-
* across complex object structures.
|
|
12
|
-
*
|
|
13
|
-
* - Dot-notation path resolution ('object.child.property')
|
|
14
|
-
* - Parent traversal using '../' notation
|
|
15
|
-
* - Configurable property access behavior
|
|
16
|
-
* - Null/undefined safety checks
|
|
17
|
-
*/
|
|
18
|
-
export declare class PathProxyEngine {
|
|
19
|
-
/**
|
|
20
|
-
* Creates a path-aware proxy for the target object
|
|
21
|
-
* @template T - The type of the target object
|
|
22
|
-
* @param {T} rootTarget - The target object to proxy
|
|
23
|
-
* @param opts - Configuration options
|
|
24
|
-
* @param opts.getValue - Custom function to get property value
|
|
25
|
-
* @param opts.getParent - Custom function to get parent object
|
|
26
|
-
* @param opts.ignoreUndefined - Whether to ignore undefined values in paths
|
|
27
|
-
* @param opts.ignoreNull - Whether to ignore null values in paths
|
|
28
|
-
* @returns A proxy object with path access capabilities
|
|
29
|
-
*/
|
|
30
|
-
static create<T extends object>(rootTarget: T, opts?: {
|
|
31
|
-
getValue?: (target: T, prop: string) => any;
|
|
32
|
-
getParent?: (target: T) => any;
|
|
33
|
-
ignoreUndefined: boolean;
|
|
34
|
-
ignoreNull: boolean;
|
|
35
|
-
}): PathProxy<T>;
|
|
36
|
-
/**
|
|
37
|
-
* Parses a path string into individual components
|
|
38
|
-
* @param path - The path string to parse (e.g., "user.address.city")
|
|
39
|
-
* @returns An array of path components
|
|
40
|
-
* @throws Error if the path is invalid
|
|
41
|
-
*/
|
|
42
|
-
private static parsePath;
|
|
43
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Enum containing metadata keys used for reflection in the model system
|
|
3
|
-
* @summary Defines the various Model keys used for reflection and metadata storage.
|
|
4
|
-
* These keys are used throughout the library to store and retrieve metadata about models,
|
|
5
|
-
* their properties, and their behavior.
|
|
6
|
-
*
|
|
7
|
-
* @property {string} TYPE - Key for storing design type information
|
|
8
|
-
* @property {string} MODEL - Key for identifying model metadata
|
|
9
|
-
* @property {string} ANCHOR - Anchor key that serves as a ghost property in the model
|
|
10
|
-
* @property {string} CONSTRUCTION - Key for storing construction information
|
|
11
|
-
* @property {string} ATTRIBUTE - Key for storing attribute metadata
|
|
12
|
-
* @property {string} HASHING - Key for storing hashing configuration
|
|
13
|
-
* @property {string} SERIALIZATION - Key for storing serialization configuration
|
|
14
|
-
*
|
|
15
|
-
* @enum {string}
|
|
16
|
-
* @readonly
|
|
17
|
-
* @memberOf module:decorator-validation
|
|
18
|
-
* @category Model
|
|
19
|
-
*/
|
|
20
|
-
export declare enum ModelKeys {
|
|
21
|
-
DESCRIPTION = "description",
|
|
22
|
-
TYPE = "design:type",
|
|
23
|
-
MODEL = "model",
|
|
24
|
-
ANCHOR = "__model",
|
|
25
|
-
CONSTRUCTION = "constructed-by",
|
|
26
|
-
ATTRIBUTE = "__attributes",
|
|
27
|
-
HASHING = "hashing",
|
|
28
|
-
SERIALIZATION = "serialization",
|
|
29
|
-
DECORATORS = "decorators",
|
|
30
|
-
CONSTRUCTOR = "__original"
|
|
31
|
-
}
|
|
32
|
-
export declare const DefaultSerializationMethod = "json";
|