@thisisagile/easy 17.34.3 → 17.35.0
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/dist/{chunk-JDNKYQAV.mjs → chunk-EDH6XY6O.mjs} +3 -1
- package/dist/chunk-EDH6XY6O.mjs.map +1 -0
- package/dist/{chunk-G2H4MJUT.mjs → chunk-Y3QJPP25.mjs} +2 -2
- package/dist/domain/Audit.mjs +2 -2
- package/dist/domain/Child.mjs +1 -1
- package/dist/domain/Entity.mjs +2 -2
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/validation/Contraints.d.ts +1 -0
- package/dist/validation/Contraints.mjs +3 -1
- package/package.json +1 -1
- package/src/validation/Contraints.ts +3 -0
- package/dist/chunk-JDNKYQAV.mjs.map +0 -1
- /package/dist/{chunk-G2H4MJUT.mjs.map → chunk-Y3QJPP25.mjs.map} +0 -0
|
@@ -35,6 +35,7 @@ var optional = () => constraint((v) => !isDefined(v) || validate(v), "");
|
|
|
35
35
|
var includes = (sub, message) => constraint((s) => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);
|
|
36
36
|
var inList = (values, message) => constraint((v) => isDefined(v) && isIn(v, values), message ?? "Value {actual} must appear in list.");
|
|
37
37
|
var inOptionalList = (values, message) => constraint((v) => !isDefined(v) || isIn(v, values), message ?? "Value {actual} must appear in list.");
|
|
38
|
+
var inUnion = (values, message) => constraint((v) => isDefined(v) && isIn(v, [...values]), message ?? "Value {actual} must be in union.");
|
|
38
39
|
var gt = (limit, message) => constraint((v) => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);
|
|
39
40
|
var gte = (limit, message) => constraint((v) => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);
|
|
40
41
|
var lt = (limit, message) => constraint((v) => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);
|
|
@@ -61,6 +62,7 @@ export {
|
|
|
61
62
|
includes,
|
|
62
63
|
inList,
|
|
63
64
|
inOptionalList,
|
|
65
|
+
inUnion,
|
|
64
66
|
gt,
|
|
65
67
|
gte,
|
|
66
68
|
lt,
|
|
@@ -71,4 +73,4 @@ export {
|
|
|
71
73
|
maxLength,
|
|
72
74
|
rule
|
|
73
75
|
};
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-EDH6XY6O.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/validation/Contraints.ts"],"sourcesContent":["import { validate, Validator } from './Validate';\nimport { Func } from '../types/Func';\nimport { Results } from '../types/Results';\nimport { meta } from '../types/Meta';\nimport { List, toList } from '../types/List';\nimport { isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString } from '../types/Is';\nimport { tryTo } from '../types/Try';\nimport { inFuture, inPast } from '../types/IsDate';\nimport type { Text } from '../types/Text';\nimport { text } from '../types/ToText';\n\nexport type Constraint = Func<boolean | Results, any>;\n\nexport const constraint =\n <T>(c: Constraint, message: Text): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n const cs = meta(subject).property(property).get<List<Validator>>('constraint') ?? toList<Validator>();\n meta(subject)\n .property(property)\n .set('constraint', cs.add({ property, constraint: c, text: message }));\n };\n\nexport const defined = (message?: Text): PropertyDecorator => constraint(v => isDefined(v), message ?? 'Property {property} must be defined.');\n\nexport const required = (message?: Text): PropertyDecorator =>\n constraint(v => isNotEmpty(v), message ?? 'Property {property} is required, and may not be empty.');\n\nexport const notEmpty = (message?: Text): PropertyDecorator => constraint(v => isNotEmpty(v), message ?? 'Property {property} may not be empty.');\n\nexport const valid = (): PropertyDecorator => constraint(v => validate(v), '');\n\nexport const optional = (): PropertyDecorator => constraint(v => !isDefined(v) || validate(v), '');\n\nexport const includes = (sub: string, message?: string): PropertyDecorator =>\n constraint(s => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);\n\nexport const inList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inOptionalList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => !isDefined(v) || isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inUnion = (values: readonly unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, [...values]), message ?? 'Value {actual} must be in union.');\n\nexport const gt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);\n\nexport const gte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);\n\nexport const lt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);\n\nexport const lte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);\n\nexport const past = (message?: Text): PropertyDecorator => constraint(v => inPast(v), message ?? 'Value {actual} must lay in the past.');\n\nexport const future = (message?: Text): PropertyDecorator => constraint(v => inFuture(v), message ?? 'Value {actual} must lay in the future.');\n\nexport const minLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length >= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} must be at least '${length}' characters long.`\n );\n\nexport const maxLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length <= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} cannot be longer than '${length}' characters.`\n );\n\nexport const rule = (message?: Text): PropertyDecorator =>\n constraint(v => (isFunction(v) ? (v() as boolean | Results) : isBoolean(v) ? v : false), message ?? `Value {actual} must be true`);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAM,aACX,CAAI,GAAe,YACnB,CAAC,SAAkB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kDAAkD,KAAK,GAAG;AAE5F,IAAM,KAAK,CAAC,OAAe,YAAsC,WAAW,OAAK,IAAI,OAAO,WAAW,uCAAuC,KAAK,GAAG;AAEtJ,IAAM,MAAM,CAAC,OAAe,YACjC,WAAW,OAAK,KAAK,OAAO,WAAW,mDAAmD,KAAK,GAAG;AAE7F,IAAM,OAAO,CAAC,YAAsC,WAAW,OAAK,OAAO,CAAC,GAAG,WAAW,sCAAsC;AAEhI,IAAM,SAAS,CAAC,YAAsC,WAAW,OAAK,SAAS,CAAC,GAAG,WAAW,wCAAwC;AAEtI,IAAM,YAAY,CAAC,QAAgB,YACxC;AAAA,EACE,OACE,MAAM,MAAM,CAAC,EACV,GAAG,QAAQ,EACX,IAAI,CAAAA,OAAK,KAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,oCAAoC,MAAM;AACvD;AAEK,IAAM,YAAY,CAAC,QAAgB,YACxC;AAAA,EACE,OACE,MAAM,MAAM,CAAC,EACV,GAAG,QAAQ,EACX,IAAI,CAAAA,OAAK,KAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,yCAAyC,MAAM;AAC5D;AAEK,IAAM,OAAO,CAAC,YACnB,WAAW,OAAM,WAAW,CAAC,IAAK,EAAE,IAA0B,UAAU,CAAC,IAAI,IAAI,OAAQ,WAAW,6BAA6B;","names":["v"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
required,
|
|
3
3
|
valid
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EDH6XY6O.mjs";
|
|
5
5
|
import {
|
|
6
6
|
DateTime
|
|
7
7
|
} from "./chunk-2FCAPKO3.mjs";
|
|
@@ -45,4 +45,4 @@ __decorateClass([
|
|
|
45
45
|
export {
|
|
46
46
|
Audit
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-Y3QJPP25.mjs.map
|
package/dist/domain/Audit.mjs
CHANGED
package/dist/domain/Child.mjs
CHANGED
package/dist/domain/Entity.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import "../chunk-HTNGE3BS.mjs";
|
|
5
5
|
import {
|
|
6
6
|
Audit
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-Y3QJPP25.mjs";
|
|
8
8
|
import {
|
|
9
9
|
required
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-EDH6XY6O.mjs";
|
|
11
11
|
import "../chunk-2FCAPKO3.mjs";
|
|
12
12
|
import "../chunk-MABGLPDW.mjs";
|
|
13
13
|
import "../chunk-ADJAEGCT.mjs";
|
package/dist/index.js
CHANGED
|
@@ -155,6 +155,7 @@ __export(src_exports, {
|
|
|
155
155
|
inList: () => inList,
|
|
156
156
|
inOptionalList: () => inOptionalList,
|
|
157
157
|
inPast: () => inPast,
|
|
158
|
+
inUnion: () => inUnion,
|
|
158
159
|
includes: () => includes,
|
|
159
160
|
includesUuid: () => includesUuid,
|
|
160
161
|
isA: () => isA,
|
|
@@ -1929,6 +1930,7 @@ var optional = () => constraint((v) => !isDefined(v) || validate(v), "");
|
|
|
1929
1930
|
var includes = (sub, message) => constraint((s) => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);
|
|
1930
1931
|
var inList = (values2, message) => constraint((v) => isDefined(v) && isIn(v, values2), message ?? "Value {actual} must appear in list.");
|
|
1931
1932
|
var inOptionalList = (values2, message) => constraint((v) => !isDefined(v) || isIn(v, values2), message ?? "Value {actual} must appear in list.");
|
|
1933
|
+
var inUnion = (values2, message) => constraint((v) => isDefined(v) && isIn(v, [...values2]), message ?? "Value {actual} must be in union.");
|
|
1932
1934
|
var gt = (limit, message) => constraint((v) => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);
|
|
1933
1935
|
var gte = (limit, message) => constraint((v) => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);
|
|
1934
1936
|
var lt = (limit, message) => constraint((v) => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);
|
|
@@ -3609,6 +3611,7 @@ var wait = (millis) => Wait.wait(millis);
|
|
|
3609
3611
|
inList,
|
|
3610
3612
|
inOptionalList,
|
|
3611
3613
|
inPast,
|
|
3614
|
+
inUnion,
|
|
3612
3615
|
includes,
|
|
3613
3616
|
includesUuid,
|
|
3614
3617
|
isA,
|