@tstdl/base 0.78.5 → 0.79.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/package.json +2 -2
- package/schema/constraints/generic.d.ts +0 -2
- package/schema/constraints/generic.js +1 -7
- package/schema/constraints/generic.js.map +1 -1
- package/schema/decorators/constraint.d.ts +4 -0
- package/schema/decorators/constraint.js +12 -0
- package/schema/decorators/constraint.js.map +1 -0
- package/schema/decorators/index.d.ts +1 -4
- package/schema/decorators/index.js +1 -4
- package/schema/decorators/index.js.map +1 -1
- package/schema/schemas/any.js +1 -1
- package/schema/schemas/any.js.map +1 -1
- package/schema/schemas/array.d.ts +2 -0
- package/schema/schemas/array.js +6 -1
- package/schema/schemas/array.js.map +1 -1
- package/schema/schemas/boolean.d.ts +1 -1
- package/schema/schemas/boolean.js +4 -4
- package/schema/schemas/boolean.js.map +1 -1
- package/schema/schemas/constraint.js +0 -1
- package/schema/schemas/constraint.js.map +1 -1
- package/schema/schemas/date.d.ts +1 -1
- package/schema/schemas/date.js +4 -4
- package/schema/schemas/date.js.map +1 -1
- package/schema/schemas/defaulted.d.ts +2 -0
- package/schema/schemas/defaulted.js +6 -1
- package/schema/schemas/defaulted.js.map +1 -1
- package/schema/schemas/nullable.d.ts +2 -0
- package/schema/schemas/nullable.js +7 -1
- package/schema/schemas/nullable.js.map +1 -1
- package/schema/schemas/number.d.ts +1 -1
- package/schema/schemas/number.js +4 -4
- package/schema/schemas/number.js.map +1 -1
- package/schema/schemas/one-or-many.d.ts +5 -2
- package/schema/schemas/one-or-many.js +7 -1
- package/schema/schemas/one-or-many.js.map +1 -1
- package/schema/schemas/optional.d.ts +2 -0
- package/schema/schemas/optional.js +6 -1
- package/schema/schemas/optional.js.map +1 -1
- package/schema/schemas/readable-stream.d.ts +2 -2
- package/schema/schemas/readable-stream.js +5 -5
- package/schema/schemas/readable-stream.js.map +1 -1
- package/schema/schemas/regexp.d.ts +2 -2
- package/schema/schemas/regexp.js +4 -4
- package/schema/schemas/regexp.js.map +1 -1
- package/schema/schemas/string.d.ts +1 -1
- package/schema/schemas/string.js +4 -4
- package/schema/schemas/string.js.map +1 -1
- package/schema/schemas/uint8-array.d.ts +2 -2
- package/schema/schemas/uint8-array.js +4 -4
- package/schema/schemas/uint8-array.js.map +1 -1
- package/schema/schemas/unknown.d.ts +1 -1
- package/schema/schemas/unknown.js +4 -4
- package/schema/schemas/unknown.js.map +1 -1
- package/schema/decorators/array.d.ts +0 -5
- package/schema/decorators/array.js +0 -11
- package/schema/decorators/array.js.map +0 -1
- package/schema/decorators/defaulted.d.ts +0 -4
- package/schema/decorators/defaulted.js +0 -11
- package/schema/decorators/defaulted.js.map +0 -1
- package/schema/decorators/nullable.d.ts +0 -2
- package/schema/decorators/nullable.js +0 -10
- package/schema/decorators/nullable.js.map +0 -1
- package/schema/decorators/one-or-many.d.ts +0 -6
- package/schema/decorators/one-or-many.js +0 -12
- package/schema/decorators/one-or-many.js.map +0 -1
- package/schema/decorators/optional.d.ts +0 -4
- package/schema/decorators/optional.js +0 -10
- package/schema/decorators/optional.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.1",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@elastic/elasticsearch": "^8.4",
|
|
41
41
|
"@koa/router": "^12.0",
|
|
42
|
-
"@tstdl/angular": "^0.
|
|
42
|
+
"@tstdl/angular": "^0.79.0",
|
|
43
43
|
"chroma-js": "^2.4",
|
|
44
44
|
"got": "^12.5",
|
|
45
45
|
"handlebars": "^4.7",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
-
import type { Decorator } from "../../reflection";
|
|
3
2
|
import type { OneOrMany } from "../../types";
|
|
4
3
|
import { SchemaError } from '../schema.error';
|
|
5
4
|
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
@@ -19,4 +18,3 @@ export declare class GenericConstraint<T> extends SchemaValueConstraint {
|
|
|
19
18
|
constructor(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>);
|
|
20
19
|
validate(value: T, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
21
20
|
}
|
|
22
|
-
export declare function Constraint<T>(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>): Decorator<'property' | 'accessor'>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.GenericConstraint = void 0;
|
|
5
5
|
const type_guards_1 = require("../../utils/type-guards");
|
|
6
|
-
const decorators_1 = require("../decorators");
|
|
7
6
|
const schema_error_1 = require("../schema.error");
|
|
8
7
|
const types_1 = require("../types");
|
|
9
8
|
class GenericConstraint extends types_1.SchemaValueConstraint {
|
|
@@ -24,9 +23,4 @@ class GenericConstraint extends types_1.SchemaValueConstraint {
|
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
exports.GenericConstraint = GenericConstraint;
|
|
27
|
-
function Constraint(constraintFunction, expects) {
|
|
28
|
-
const constraint = new GenericConstraint(constraintFunction, expects);
|
|
29
|
-
return (0, decorators_1.createSchemaValueConstraintDecorator)(constraint);
|
|
30
|
-
}
|
|
31
|
-
exports.Constraint = Constraint;
|
|
32
26
|
//# sourceMappingURL=generic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../source/schema/constraints/generic.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../source/schema/constraints/generic.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAgD;AAChD,kDAA8C;AAE9C,oCAAiD;AAQjD,MAAa,iBAAqB,SAAQ,6BAAqB;IAK7D,YAAY,kBAAgD,EAAE,UAA6B,aAAa;QACtG,KAAK,EAAE,CAAC;QALD,kBAAa,GAAG,MAAM,CAAC;QAO9B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,KAAQ,EAAE,IAAc,EAAE,OAA0B;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAEpD,IAAI,IAAA,uBAAS,EAAC,MAAM,CAAC,EAAE;YACrB,OAAO,MAAM;gBACX,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;gBACjB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACpI;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAvBD,8CAuBC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
2
|
+
import type { OneOrMany } from "../../types";
|
|
3
|
+
import type { GenericConstraintFunction } from '../constraints/generic';
|
|
4
|
+
export declare function Constraint<T>(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Constraint = void 0;
|
|
4
|
+
const generic_1 = require("../constraints/generic");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
function Constraint(constraintFunction, expects) {
|
|
8
|
+
const constraint = new generic_1.GenericConstraint(constraintFunction, expects);
|
|
9
|
+
return (0, utils_1.createSchemaValueConstraintDecorator)(constraint);
|
|
10
|
+
}
|
|
11
|
+
exports.Constraint = Constraint;
|
|
12
|
+
//# sourceMappingURL=constraint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraint.js","sourceRoot":"","sources":["../../../source/schema/decorators/constraint.ts"],"names":[],"mappings":";;;AAGA,oDAA2D;AAC3D,mCAA+D;AAE/D,gEAAgE;AAChE,SAAgB,UAAU,CAAI,kBAAgD,EAAE,OAA2B;IACzG,MAAM,UAAU,GAAG,IAAI,2BAAiB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACtE,OAAO,IAAA,4CAAoC,EAAC,UAAU,CAAC,CAAC;AAC1D,CAAC;AAHD,gCAGC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export * from './array';
|
|
2
1
|
export * from './class';
|
|
3
2
|
export * from './coerce';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './one-or-many';
|
|
6
|
-
export * from './optional';
|
|
3
|
+
export * from './constraint';
|
|
7
4
|
export * from './property';
|
|
8
5
|
export * from './types';
|
|
9
6
|
export * from './utils';
|
|
@@ -14,12 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./array"), exports);
|
|
18
17
|
__exportStar(require("./class"), exports);
|
|
19
18
|
__exportStar(require("./coerce"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./one-or-many"), exports);
|
|
22
|
-
__exportStar(require("./optional"), exports);
|
|
19
|
+
__exportStar(require("./constraint"), exports);
|
|
23
20
|
__exportStar(require("./property"), exports);
|
|
24
21
|
__exportStar(require("./types"), exports);
|
|
25
22
|
__exportStar(require("./utils"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/schema/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/schema/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB"}
|
package/schema/schemas/any.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.Any = exports.any = void 0;
|
|
|
5
5
|
const decorators_1 = require("../decorators");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function any(options) {
|
|
8
|
-
return (0, types_1.valueSchema)(
|
|
8
|
+
return (0, types_1.valueSchema)('any', options);
|
|
9
9
|
}
|
|
10
10
|
exports.any = any;
|
|
11
11
|
function Any(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../../source/schema/schemas/any.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAExE,
|
|
1
|
+
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../../source/schema/schemas/any.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAExE,oCAAuC;AAIvC,SAAgB,GAAG,CAAC,OAAoB;IACtC,OAAO,IAAA,mBAAW,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC;AAFD,kBAEC;AAED,SAAgB,GAAG,CAAC,OAAoB;IACtC,OAAO,IAAA,oDAAuC,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D,CAAC;AAFD,kBAEC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
1
2
|
import type { OneOrMany } from "../../types";
|
|
2
3
|
import type { SchemaTestable } from '../schema';
|
|
3
4
|
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
@@ -8,3 +9,4 @@ export declare type ArrayOptions = ValueSchemaOptions & {
|
|
|
8
9
|
maximumLength?: number;
|
|
9
10
|
};
|
|
10
11
|
export declare function array<T>(innerValues: OneOrMany<SchemaTestable<T>>, options?: ArrayOptions): ValueSchema<T[]>;
|
|
12
|
+
export declare function Array(innerValues: OneOrMany<SchemaTestable>, options?: ArrayOptions): Decorator<'property' | 'accessor'>;
|
package/schema/schemas/array.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.array = void 0;
|
|
4
|
+
exports.Array = exports.array = void 0;
|
|
5
5
|
const array_1 = require("../../utils/array/array");
|
|
6
6
|
const type_guards_1 = require("../../utils/type-guards");
|
|
7
7
|
const array_constraints_1 = require("../array-constraints");
|
|
8
|
+
const utils_1 = require("../decorators/utils");
|
|
8
9
|
const types_1 = require("../types");
|
|
9
10
|
function array(innerValues, options = {}) {
|
|
10
11
|
const arrayConstraints = (0, array_1.toArray)(options.arrayConstraints ?? []);
|
|
@@ -21,4 +22,8 @@ function array(innerValues, options = {}) {
|
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
exports.array = array;
|
|
25
|
+
function Array(innerValues, options) {
|
|
26
|
+
return (0, utils_1.createSchemaPropertyDecoratorFromSchema)(array(innerValues, options));
|
|
27
|
+
}
|
|
28
|
+
exports.Array = Array;
|
|
24
29
|
//# sourceMappingURL=array.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/schema/schemas/array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/schema/schemas/array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,mDAA8C;AAC9C,yDAAgD;AAChD,4DAAoE;AACpE,+CAA8E;AAG9E,oCAAuC;AAUvC,SAAgB,KAAK,CAAI,WAAyC,EAAE,UAAwB,EAAE;IAC5F,MAAM,gBAAgB,GAA4B,IAAA,eAAO,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAE1F,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,gDAA4B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAChF;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,gDAA4B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAChF;IAED,OAAO,IAAA,mBAAW,EAAM,WAAW,EAAE;QACnC,GAAG,OAAO;QACV,KAAK,EAAE,IAAI;QACX,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAhBD,sBAgBC;AAED,SAAgB,KAAK,CAAC,WAAsC,EAAE,OAAsB;IAClF,OAAO,IAAA,+CAAuC,EAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9E,CAAC;AAFD,sBAEC"}
|
|
@@ -2,4 +2,4 @@ import type { Decorator } from "../../reflection";
|
|
|
2
2
|
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
3
3
|
export declare type BooleanOptions = ValueSchemaOptions;
|
|
4
4
|
export declare function boolean(options?: BooleanOptions): ValueSchema<boolean>;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function BooleanProperty(options?: BooleanOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.BooleanProperty = exports.boolean = void 0;
|
|
5
5
|
const decorators_1 = require("../decorators");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function boolean(options = {}) {
|
|
8
|
-
return (0, types_1.valueSchema)(
|
|
8
|
+
return (0, types_1.valueSchema)(Boolean, options);
|
|
9
9
|
}
|
|
10
10
|
exports.boolean = boolean;
|
|
11
|
-
function
|
|
11
|
+
function BooleanProperty(options) {
|
|
12
12
|
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(boolean(options));
|
|
13
13
|
}
|
|
14
|
-
exports.
|
|
14
|
+
exports.BooleanProperty = BooleanProperty;
|
|
15
15
|
//# sourceMappingURL=boolean.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../source/schema/schemas/boolean.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAExE,oCAAuC;AAIvC,SAAgB,OAAO,CAAC,UAA0B,EAAE;IAClD,OAAO,IAAA,mBAAW,EAAU,
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../source/schema/schemas/boolean.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAExE,oCAAuC;AAIvC,SAAgB,OAAO,CAAC,UAA0B,EAAE;IAClD,OAAO,IAAA,mBAAW,EAAU,OAAO,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAFD,0BAEC;AAED,SAAgB,eAAe,CAAC,OAAwB;IACtD,OAAO,IAAA,oDAAuC,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC;AAFD,0CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraint.js","sourceRoot":"","sources":["../../../source/schema/schemas/constraint.ts"],"names":[],"mappings":";;;AAEA,oDAA2D;AAG3D,oCAAuC;AAEvC,SAAgB,UAAU,CAAI,MAAyB,EAAE,kBAAgD,EAAE,OAA2B;IACpI,OAAO,IAAA,mBAAW,EAAC,MAAM,EAAE;QACzB,gBAAgB,EAAE,IAAI,2BAAiB,CAAC,kBAAkB,EAAE,OAAO,CAAC;KACrE,CAAC,CAAC;AACL,CAAC;AAJD,gCAIC
|
|
1
|
+
{"version":3,"file":"constraint.js","sourceRoot":"","sources":["../../../source/schema/schemas/constraint.ts"],"names":[],"mappings":";;;AAEA,oDAA2D;AAG3D,oCAAuC;AAEvC,SAAgB,UAAU,CAAI,MAAyB,EAAE,kBAAgD,EAAE,OAA2B;IACpI,OAAO,IAAA,mBAAW,EAAC,MAAM,EAAE;QACzB,gBAAgB,EAAE,IAAI,2BAAiB,CAAC,kBAAkB,EAAE,OAAO,CAAC;KACrE,CAAC,CAAC;AACL,CAAC;AAJD,gCAIC"}
|
package/schema/schemas/date.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export declare type DateOptions = ValueSchemaOptions & {
|
|
|
5
5
|
maximum?: Date | number;
|
|
6
6
|
};
|
|
7
7
|
export declare function date(options?: DateOptions): ValueSchema<Date>;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function DateProperty(options?: DateOptions): Decorator<'property' | 'accessor'>;
|
package/schema/schemas/date.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.DateProperty = exports.date = void 0;
|
|
5
5
|
const array_1 = require("../../utils/array/array");
|
|
6
6
|
const type_guards_1 = require("../../utils/type-guards");
|
|
7
7
|
const constraints_1 = require("../constraints");
|
|
@@ -15,14 +15,14 @@ function date(options = {}) {
|
|
|
15
15
|
if ((0, type_guards_1.isDefined)(options.maximum)) {
|
|
16
16
|
constraints.push(new constraints_1.MaximumDateConstraint(options.maximum));
|
|
17
17
|
}
|
|
18
|
-
return (0, types_1.valueSchema)(
|
|
18
|
+
return (0, types_1.valueSchema)(Date, {
|
|
19
19
|
...options,
|
|
20
20
|
valueConstraints: constraints
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
exports.date = date;
|
|
24
|
-
function
|
|
24
|
+
function DateProperty(options) {
|
|
25
25
|
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(date(options));
|
|
26
26
|
}
|
|
27
|
-
exports.
|
|
27
|
+
exports.DateProperty = DateProperty;
|
|
28
28
|
//# sourceMappingURL=date.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../source/schema/schemas/date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAA8C;AAC9C,yDAAgD;AAChD,gDAA8E;AAC9E,8CAAwE;AAExE,
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../source/schema/schemas/date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAA8C;AAC9C,yDAAgD;AAChD,gDAA8E;AAC9E,8CAAwE;AAExE,oCAAuC;AAOvC,SAAgB,IAAI,CAAC,UAAuB,EAAE;IAC5C,MAAM,WAAW,GAA4B,IAAA,eAAO,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAErF,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,mCAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC9D;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,mCAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC9D;IAED,OAAO,IAAA,mBAAW,EAAC,IAAI,EAAE;QACvB,GAAG,OAAO;QACV,gBAAgB,EAAE,WAAW;KAC9B,CAAC,CAAC;AACL,CAAC;AAfD,oBAeC;AAED,SAAgB,YAAY,CAAC,OAAqB;IAChD,OAAO,IAAA,oDAAuC,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAChE,CAAC;AAFD,oCAEC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
1
2
|
import type { OneOrMany } from "../../types";
|
|
2
3
|
import type { SchemaTestable } from '../schema';
|
|
3
4
|
import type { ValueSchema } from '../types';
|
|
4
5
|
export declare function defaulted<T, Default>(type: OneOrMany<SchemaTestable<T>>, defaultValue: Default): ValueSchema<NonNullable<T> | Default>;
|
|
6
|
+
export declare function Defaulted(type: OneOrMany<SchemaTestable>, defaultValue: any): Decorator<'property' | 'accessor'>;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.defaulted = void 0;
|
|
4
|
+
exports.Defaulted = exports.defaulted = void 0;
|
|
5
|
+
const utils_1 = require("../decorators/utils");
|
|
5
6
|
const types_1 = require("../types");
|
|
6
7
|
const transform_1 = require("./transform");
|
|
7
8
|
function defaulted(type, defaultValue) {
|
|
8
9
|
return (0, transform_1.transform)((0, types_1.valueSchema)(type, { optional: true, nullable: true }), (value) => value ?? defaultValue); // eslint-disable-line @typescript-eslint/no-unnecessary-condition
|
|
9
10
|
}
|
|
10
11
|
exports.defaulted = defaulted;
|
|
12
|
+
function Defaulted(type, defaultValue) {
|
|
13
|
+
return (0, utils_1.createSchemaPropertyDecoratorFromSchema)(defaulted(type, defaultValue));
|
|
14
|
+
}
|
|
15
|
+
exports.Defaulted = Defaulted;
|
|
11
16
|
//# sourceMappingURL=defaulted.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaulted.js","sourceRoot":"","sources":["../../../source/schema/schemas/defaulted.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;
|
|
1
|
+
{"version":3,"file":"defaulted.js","sourceRoot":"","sources":["../../../source/schema/schemas/defaulted.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA8E;AAG9E,oCAAuC;AACvC,2CAAwC;AAExC,SAAgB,SAAS,CAAa,IAAkC,EAAE,YAAqB;IAC7F,OAAO,IAAA,qBAAS,EAAC,IAAA,mBAAW,EAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,KAAQ,EAAE,EAAE,CAAC,KAAK,IAAI,YAAY,CAAC,CAAC,CAAC,kEAAkE;AAClL,CAAC;AAFD,8BAEC;AAED,SAAgB,SAAS,CAAC,IAA+B,EAAE,YAAiB;IAC1E,OAAO,IAAA,+CAAuC,EAAC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;AAChF,CAAC;AAFD,8BAEC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
1
2
|
import type { SchemaTestable } from '../schema';
|
|
2
3
|
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
3
4
|
export declare type NullableOptions = ValueSchemaOptions;
|
|
4
5
|
export declare function nullable<T>(schema: SchemaTestable<T>, options?: NullableOptions): ValueSchema<T | null>;
|
|
6
|
+
export declare function Nullable(options?: NullableOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nullable = void 0;
|
|
3
|
+
exports.Nullable = exports.nullable = void 0;
|
|
4
|
+
const utils_1 = require("../decorators/utils");
|
|
4
5
|
const types_1 = require("../types");
|
|
5
6
|
function nullable(schema, options) {
|
|
6
7
|
return (0, types_1.valueSchema)(schema, { ...options, nullable: true });
|
|
7
8
|
}
|
|
8
9
|
exports.nullable = nullable;
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
+
function Nullable(options) {
|
|
12
|
+
return (0, utils_1.createSchemaPropertyDecorator)({ ...options, nullable: true });
|
|
13
|
+
}
|
|
14
|
+
exports.Nullable = Nullable;
|
|
9
15
|
//# sourceMappingURL=nullable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../source/schema/schemas/nullable.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../source/schema/schemas/nullable.ts"],"names":[],"mappings":";;;AACA,+CAAoE;AAGpE,oCAAuC;AAIvC,SAAgB,QAAQ,CAAI,MAAyB,EAAE,OAAyB;IAC9E,OAAO,IAAA,mBAAW,EAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAA0B,CAAC;AACtF,CAAC;AAFD,4BAEC;AAED,gEAAgE;AAChE,SAAgB,QAAQ,CAAC,OAAyB;IAChD,OAAO,IAAA,qCAA6B,EAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACvE,CAAC;AAFD,4BAEC"}
|
|
@@ -6,4 +6,4 @@ export declare type NumberOptions = ValueSchemaOptions & {
|
|
|
6
6
|
integer?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare function number(options?: NumberOptions): ValueSchema<number>;
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function NumberProperty(options?: NumberOptions): Decorator<'property' | 'accessor'>;
|
package/schema/schemas/number.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.NumberProperty = exports.number = void 0;
|
|
5
5
|
const array_1 = require("../../utils/array/array");
|
|
6
6
|
const type_guards_1 = require("../../utils/type-guards");
|
|
7
7
|
const integer_1 = require("../constraints/integer");
|
|
@@ -20,14 +20,14 @@ function number(options = {}) {
|
|
|
20
20
|
if (options.integer == true) {
|
|
21
21
|
valueConstraints.push(integer_1.integerConstraint);
|
|
22
22
|
}
|
|
23
|
-
return (0, types_1.valueSchema)(
|
|
23
|
+
return (0, types_1.valueSchema)(Number, {
|
|
24
24
|
...options,
|
|
25
25
|
valueConstraints
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
exports.number = number;
|
|
29
|
-
function
|
|
29
|
+
function NumberProperty(options) {
|
|
30
30
|
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(number(options));
|
|
31
31
|
}
|
|
32
|
-
exports.
|
|
32
|
+
exports.NumberProperty = NumberProperty;
|
|
33
33
|
//# sourceMappingURL=number.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../source/schema/schemas/number.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAA8C;AAC9C,yDAAgD;AAChD,oDAA2D;AAC3D,oDAA2D;AAC3D,oDAA2D;AAC3D,8CAAwE;AAExE,
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../source/schema/schemas/number.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAA8C;AAC9C,yDAAgD;AAChD,oDAA2D;AAC3D,oDAA2D;AAC3D,oDAA2D;AAC3D,8CAAwE;AAExE,oCAAuC;AAQvC,SAAgB,MAAM,CAAC,UAAyB,EAAE;IAChD,MAAM,gBAAgB,GAA4B,IAAA,eAAO,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAE1F,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,gBAAgB,CAAC,IAAI,CAAC,IAAI,2BAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/D;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,gBAAgB,CAAC,IAAI,CAAC,IAAI,2BAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/D;IAED,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE;QAC3B,gBAAgB,CAAC,IAAI,CAAC,2BAAiB,CAAC,CAAC;KAC1C;IAED,OAAO,IAAA,mBAAW,EAAS,MAAM,EAAE;QACjC,GAAG,OAAO;QACV,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAnBD,wBAmBC;AAED,SAAgB,cAAc,CAAC,OAAuB;IACpD,OAAO,IAAA,oDAAuC,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wCAEC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
2
|
+
import type { OneOrMany as OneOrManyType } from "../../types";
|
|
2
3
|
import type { SchemaTestable } from '../schema';
|
|
3
4
|
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
4
|
-
import { ArrayOptions } from './array';
|
|
5
|
+
import type { ArrayOptions } from './array';
|
|
6
|
+
export declare type OneOrMany<T> = OneOrManyType<T>;
|
|
5
7
|
export declare type OneOrManyOptions = ValueSchemaOptions & Pick<ArrayOptions, 'minimumLength' | 'maximumLength'>;
|
|
6
8
|
export declare function oneOrMany<T>(innerValues: OneOrMany<SchemaTestable<T>>, options?: OneOrManyOptions): ValueSchema<T | T[]>;
|
|
9
|
+
export declare function OneOrMany(innerValues: OneOrMany<SchemaTestable>, options?: OneOrManyOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.oneOrMany = void 0;
|
|
4
|
+
exports.OneOrMany = exports.oneOrMany = void 0;
|
|
5
5
|
const array_1 = require("../../utils/array");
|
|
6
|
+
const utils_1 = require("../decorators/utils");
|
|
6
7
|
const array_2 = require("./array");
|
|
7
8
|
const union_1 = require("./union");
|
|
8
9
|
function oneOrMany(innerValues, options) {
|
|
@@ -12,4 +13,9 @@ function oneOrMany(innerValues, options) {
|
|
|
12
13
|
], options);
|
|
13
14
|
}
|
|
14
15
|
exports.oneOrMany = oneOrMany;
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
17
|
+
function OneOrMany(innerValues, options) {
|
|
18
|
+
return (0, utils_1.createSchemaPropertyDecoratorFromSchema)(oneOrMany(innerValues, options));
|
|
19
|
+
}
|
|
20
|
+
exports.OneOrMany = OneOrMany;
|
|
15
21
|
//# sourceMappingURL=one-or-many.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one-or-many.js","sourceRoot":"","sources":["../../../source/schema/schemas/one-or-many.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;
|
|
1
|
+
{"version":3,"file":"one-or-many.js","sourceRoot":"","sources":["../../../source/schema/schemas/one-or-many.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,6CAAwC;AACxC,+CAA8E;AAI9E,mCAAgC;AAChC,mCAAgC;AAKhC,SAAgB,SAAS,CAAI,WAAyC,EAAE,OAA0B;IAChG,OAAO,IAAA,aAAK,EACV;QACE,IAAA,aAAK,EAAC,WAAW,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;QACpG,GAAG,IAAA,eAAO,EAAC,WAAW,CAAC;KACxB,EACD,OAAO,CACgB,CAAC;AAC5B,CAAC;AARD,8BAQC;AAED,2DAA2D;AAC3D,SAAgB,SAAS,CAAC,WAAsC,EAAE,OAA0B;IAC1F,OAAO,IAAA,+CAAuC,EAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAClF,CAAC;AAFD,8BAEC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
1
2
|
import type { OneOrMany } from "../../types";
|
|
2
3
|
import type { SchemaTestable } from '../schema';
|
|
3
4
|
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
4
5
|
export declare type OptionalOptions = ValueSchemaOptions;
|
|
5
6
|
export declare function optional<T>(schema: OneOrMany<SchemaTestable<T>>, options?: OptionalOptions): ValueSchema<T | undefined>;
|
|
7
|
+
export declare function Optional(schema?: OneOrMany<SchemaTestable>): Decorator<'property' | 'accessor'>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.optional = void 0;
|
|
3
|
+
exports.Optional = exports.optional = void 0;
|
|
4
|
+
const utils_1 = require("../decorators/utils");
|
|
4
5
|
const types_1 = require("../types");
|
|
5
6
|
function optional(schema, options) {
|
|
6
7
|
return (0, types_1.valueSchema)(schema, { ...options, optional: true });
|
|
7
8
|
}
|
|
8
9
|
exports.optional = optional;
|
|
10
|
+
function Optional(schema) {
|
|
11
|
+
return (0, utils_1.createSchemaPropertyDecorator)({ schema, optional: true });
|
|
12
|
+
}
|
|
13
|
+
exports.Optional = Optional;
|
|
9
14
|
//# sourceMappingURL=optional.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../source/schema/schemas/optional.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../source/schema/schemas/optional.ts"],"names":[],"mappings":";;;AAEA,+CAAoE;AAGpE,oCAAuC;AAIvC,SAAgB,QAAQ,CAAI,MAAoC,EAAE,OAAyB;IACzF,OAAO,IAAA,mBAAW,EAAC,MAAuC,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9F,CAAC;AAFD,4BAEC;AAED,SAAgB,QAAQ,CAAC,MAAkC;IACzD,OAAO,IAAA,qCAA6B,EAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC;AAFD,4BAEC"}
|
|
@@ -2,5 +2,5 @@ import type { Decorator } from "../../reflection";
|
|
|
2
2
|
import type { Schema } from '../schema';
|
|
3
3
|
import type { ValueSchemaOptions } from '../types';
|
|
4
4
|
export declare type ReadableStreamOptions = ValueSchemaOptions;
|
|
5
|
-
export declare function readableStream(options?: ReadableStreamOptions): Schema<
|
|
6
|
-
export declare function
|
|
5
|
+
export declare function readableStream(options?: ReadableStreamOptions): Schema<ReadableStream>;
|
|
6
|
+
export declare function ReadableStreamProperty(options?: ReadableStreamOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.ReadableStreamProperty = exports.readableStream = void 0;
|
|
5
5
|
const decorators_1 = require("../decorators");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function readableStream(options) {
|
|
8
|
-
return (0, types_1.valueSchema)(
|
|
8
|
+
return (0, types_1.valueSchema)(ReadableStream, options);
|
|
9
9
|
}
|
|
10
10
|
exports.readableStream = readableStream;
|
|
11
|
-
function
|
|
12
|
-
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(readableStream());
|
|
11
|
+
function ReadableStreamProperty(options) {
|
|
12
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(readableStream(options));
|
|
13
13
|
}
|
|
14
|
-
exports.
|
|
14
|
+
exports.ReadableStreamProperty = ReadableStreamProperty;
|
|
15
15
|
//# sourceMappingURL=readable-stream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readable-stream.js","sourceRoot":"","sources":["../../../source/schema/schemas/readable-stream.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAGxE,oCAAuC;AAIvC,SAAgB,cAAc,CAAC,OAA+B;IAC5D,OAAO,IAAA,mBAAW,EAAC,
|
|
1
|
+
{"version":3,"file":"readable-stream.js","sourceRoot":"","sources":["../../../source/schema/schemas/readable-stream.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAGxE,oCAAuC;AAIvC,SAAgB,cAAc,CAAC,OAA+B;IAC5D,OAAO,IAAA,mBAAW,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAFD,wCAEC;AAED,SAAgB,sBAAsB,CAAC,OAA+B;IACpE,OAAO,IAAA,oDAAuC,EAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1E,CAAC;AAFD,wDAEC"}
|
|
@@ -2,5 +2,5 @@ import type { Decorator } from "../../reflection";
|
|
|
2
2
|
import type { Schema } from '../schema';
|
|
3
3
|
import type { ValueSchemaOptions } from '../types';
|
|
4
4
|
export declare type RegExpSchemaOptions = ValueSchemaOptions;
|
|
5
|
-
export declare function regexp(options?: RegExpSchemaOptions): Schema<
|
|
6
|
-
export declare function
|
|
5
|
+
export declare function regexp(options?: RegExpSchemaOptions): Schema<RegExp>;
|
|
6
|
+
export declare function RegExpProperty(options?: RegExpSchemaOptions): Decorator<'property' | 'accessor'>;
|
package/schema/schemas/regexp.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.RegExpProperty = exports.regexp = void 0;
|
|
5
5
|
const decorators_1 = require("../decorators");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function regexp(options) {
|
|
8
|
-
return (0, types_1.valueSchema)(
|
|
8
|
+
return (0, types_1.valueSchema)(RegExp, options);
|
|
9
9
|
}
|
|
10
10
|
exports.regexp = regexp;
|
|
11
|
-
function
|
|
11
|
+
function RegExpProperty(options) {
|
|
12
12
|
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(regexp(options));
|
|
13
13
|
}
|
|
14
|
-
exports.
|
|
14
|
+
exports.RegExpProperty = RegExpProperty;
|
|
15
15
|
//# sourceMappingURL=regexp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regexp.js","sourceRoot":"","sources":["../../../source/schema/schemas/regexp.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAGxE,oCAAuC;AAIvC,SAAgB,MAAM,CAAC,OAA6B;IAClD,OAAO,IAAA,mBAAW,EAAC,
|
|
1
|
+
{"version":3,"file":"regexp.js","sourceRoot":"","sources":["../../../source/schema/schemas/regexp.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAGxE,oCAAuC;AAIvC,SAAgB,MAAM,CAAC,OAA6B;IAClD,OAAO,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAFD,wBAEC;AAED,SAAgB,cAAc,CAAC,OAA6B;IAC1D,OAAO,IAAA,oDAAuC,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wCAEC"}
|
|
@@ -19,4 +19,4 @@ export declare type StringOptions = ValueSchemaOptions & {
|
|
|
19
19
|
patternName?: string;
|
|
20
20
|
};
|
|
21
21
|
export declare function string(options?: StringOptions): ValueSchema<string>;
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function StringProperty(options?: StringOptions): Decorator<'property' | 'accessor'>;
|
package/schema/schemas/string.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.StringProperty = exports.string = void 0;
|
|
5
5
|
const array_1 = require("../../utils/array/array");
|
|
6
6
|
const type_guards_1 = require("../../utils/type-guards");
|
|
7
7
|
const constraints_1 = require("../constraints");
|
|
@@ -30,15 +30,15 @@ function string(options = {}) {
|
|
|
30
30
|
if ((0, type_guards_1.isDefined)(options.uppercase)) {
|
|
31
31
|
transformers.push(new transformers_1.UppercaseTransformer());
|
|
32
32
|
}
|
|
33
|
-
return (0, types_1.valueSchema)(
|
|
33
|
+
return (0, types_1.valueSchema)(String, {
|
|
34
34
|
...options,
|
|
35
35
|
valueConstraints,
|
|
36
36
|
transformers
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
exports.string = string;
|
|
40
|
-
function
|
|
40
|
+
function StringProperty(options) {
|
|
41
41
|
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(string(options));
|
|
42
42
|
}
|
|
43
|
-
exports.
|
|
43
|
+
exports.StringProperty = StringProperty;
|
|
44
44
|
//# sourceMappingURL=string.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../source/schema/schemas/string.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAA8C;AAC9C,yDAAgD;AAChD,gDAAqG;AACrG,8CAAwE;AACxE,kDAA8F;AAE9F,
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../source/schema/schemas/string.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAA8C;AAC9C,yDAAgD;AAChD,gDAAqG;AACrG,8CAAwE;AACxE,kDAA8F;AAE9F,oCAAuC;AA4BvC,SAAgB,MAAM,CAAC,UAAyB,EAAE;IAChD,MAAM,gBAAgB,GAA4B,IAAA,eAAO,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAC1F,MAAM,YAAY,GAA6B,IAAA,eAAO,EAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IAEnF,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,qCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,qCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QAC9D,gBAAgB,CAAC,IAAI,CAAC,IAAI,+BAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;KAC5E;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC3B,YAAY,CAAC,IAAI,CAAC,IAAI,8BAAe,EAAE,CAAC,CAAC;KAC1C;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAChC,YAAY,CAAC,IAAI,CAAC,IAAI,mCAAoB,EAAE,CAAC,CAAC;KAC/C;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAChC,YAAY,CAAC,IAAI,CAAC,IAAI,mCAAoB,EAAE,CAAC,CAAC;KAC/C;IAED,OAAO,IAAA,mBAAW,EAAS,MAAM,EAAE;QACjC,GAAG,OAAO;QACV,gBAAgB;QAChB,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAlCD,wBAkCC;AAED,SAAgB,cAAc,CAAC,OAAuB;IACpD,OAAO,IAAA,oDAAuC,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wCAEC"}
|
|
@@ -6,5 +6,5 @@ export declare type Uint8ArraySchemaOptions = ValueSchemaOptions & {
|
|
|
6
6
|
/** Maximum byte length */
|
|
7
7
|
maximumLength?: number;
|
|
8
8
|
};
|
|
9
|
-
export declare function uint8Array(options?: Uint8ArraySchemaOptions): ValueSchema<
|
|
10
|
-
export declare function
|
|
9
|
+
export declare function uint8Array(options?: Uint8ArraySchemaOptions): ValueSchema<Uint8Array>;
|
|
10
|
+
export declare function Uint8ArrayProperty(options?: Uint8ArraySchemaOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.Uint8ArrayProperty = exports.uint8Array = void 0;
|
|
5
5
|
const array_1 = require("../../utils/array/array");
|
|
6
6
|
const type_guards_1 = require("../../utils/type-guards");
|
|
7
7
|
const uint8_array_coercer_1 = require("../coercers/uint8-array.coercer");
|
|
@@ -21,15 +21,15 @@ function uint8Array(options = {}) {
|
|
|
21
21
|
if ((0, type_guards_1.isDefined)(options.maximumLength)) {
|
|
22
22
|
valueConstraints.push(new maximum_length_1.MaximumLengthConstraint(options.maximumLength));
|
|
23
23
|
}
|
|
24
|
-
return (0, types_1.valueSchema)(
|
|
24
|
+
return (0, types_1.valueSchema)(Uint8Array, {
|
|
25
25
|
...options,
|
|
26
26
|
coercers,
|
|
27
27
|
valueConstraints
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
exports.uint8Array = uint8Array;
|
|
31
|
-
function
|
|
31
|
+
function Uint8ArrayProperty(options) {
|
|
32
32
|
return (0, utils_1.createSchemaPropertyDecoratorFromSchema)(uint8Array(options));
|
|
33
33
|
}
|
|
34
|
-
exports.
|
|
34
|
+
exports.Uint8ArrayProperty = Uint8ArrayProperty;
|
|
35
35
|
//# sourceMappingURL=uint8-array.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8-array.js","sourceRoot":"","sources":["../../../source/schema/schemas/uint8-array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAA8C;AAC9C,yDAAgD;AAChD,yEAAoE;AACpE,kEAAwE;AACxE,kEAAwE;AACxE,+CAA8E;AAE9E,
|
|
1
|
+
{"version":3,"file":"uint8-array.js","sourceRoot":"","sources":["../../../source/schema/schemas/uint8-array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAA8C;AAC9C,yDAAgD;AAChD,yEAAoE;AACpE,kEAAwE;AACxE,kEAAwE;AACxE,+CAA8E;AAE9E,oCAAuC;AAUvC,SAAgB,UAAU,CAAC,UAAmC,EAAE;IAC9D,MAAM,QAAQ,GAAyB,IAAA,eAAO,EAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IACvE,MAAM,gBAAgB,GAA4B,IAAA,eAAO,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAE1F,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE;QAC1B,QAAQ,CAAC,IAAI,CAAC,uCAAiB,CAAC,CAAC;KAClC;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,wCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,wCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E;IAED,OAAO,IAAA,mBAAW,EAAC,UAAU,EAAE;QAC7B,GAAG,OAAO;QACV,QAAQ;QACR,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AArBD,gCAqBC;AAED,SAAgB,kBAAkB,CAAC,OAAiC;IAClE,OAAO,IAAA,+CAAuC,EAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC;AAFD,gDAEC"}
|
|
@@ -2,4 +2,4 @@ import type { Decorator } from "../../reflection";
|
|
|
2
2
|
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
3
3
|
export declare type UnknownOptions = ValueSchemaOptions;
|
|
4
4
|
export declare function unknown(options?: UnknownOptions): ValueSchema<unknown>;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function UnknownProperty(options?: UnknownOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.UnknownProperty = exports.unknown = void 0;
|
|
5
5
|
const decorators_1 = require("../decorators");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function unknown(options) {
|
|
8
|
-
return (0, types_1.valueSchema)(
|
|
8
|
+
return (0, types_1.valueSchema)('any', options);
|
|
9
9
|
}
|
|
10
10
|
exports.unknown = unknown;
|
|
11
|
-
function
|
|
11
|
+
function UnknownProperty(options) {
|
|
12
12
|
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(unknown(options));
|
|
13
13
|
}
|
|
14
|
-
exports.
|
|
14
|
+
exports.UnknownProperty = UnknownProperty;
|
|
15
15
|
//# sourceMappingURL=unknown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown.js","sourceRoot":"","sources":["../../../source/schema/schemas/unknown.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAExE,
|
|
1
|
+
{"version":3,"file":"unknown.js","sourceRoot":"","sources":["../../../source/schema/schemas/unknown.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAExE,oCAAuC;AAIvC,SAAgB,OAAO,CAAC,OAAwB;IAC9C,OAAO,IAAA,mBAAW,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC;AAFD,0BAEC;AAED,SAAgB,eAAe,CAAC,OAAwB;IACtD,OAAO,IAAA,oDAAuC,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC;AAFD,0CAEC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type { OneOrMany } from "../../types";
|
|
3
|
-
import type { SchemaTestable } from '../schema';
|
|
4
|
-
import type { ArrayOptions } from '../schemas/array';
|
|
5
|
-
export declare function Array(innerValues: OneOrMany<SchemaTestable>, options?: ArrayOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Array = void 0;
|
|
5
|
-
const array_1 = require("../schemas/array");
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
function Array(innerValues, options) {
|
|
8
|
-
return (0, utils_1.createSchemaPropertyDecoratorFromSchema)((0, array_1.array)(innerValues, options));
|
|
9
|
-
}
|
|
10
|
-
exports.Array = Array;
|
|
11
|
-
//# sourceMappingURL=array.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/schema/decorators/array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAMzD,4CAAyC;AACzC,mCAAkE;AAElE,SAAgB,KAAK,CAAC,WAAsC,EAAE,OAAsB;IAClF,OAAO,IAAA,+CAAuC,EAAC,IAAA,aAAK,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9E,CAAC;AAFD,sBAEC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type { OneOrMany } from "../../types";
|
|
3
|
-
import type { SchemaTestable } from '../schema';
|
|
4
|
-
export declare function Defaulted(type: OneOrMany<SchemaTestable>, defaultValue: any): Decorator<'property' | 'accessor'>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Defaulted = void 0;
|
|
5
|
-
const defaulted_1 = require("../schemas/defaulted");
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
function Defaulted(type, defaultValue) {
|
|
8
|
-
return (0, utils_1.createSchemaPropertyDecoratorFromSchema)((0, defaulted_1.defaulted)(type, defaultValue));
|
|
9
|
-
}
|
|
10
|
-
exports.Defaulted = Defaulted;
|
|
11
|
-
//# sourceMappingURL=defaulted.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaulted.js","sourceRoot":"","sources":["../../../source/schema/decorators/defaulted.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAKzD,oDAAiD;AACjD,mCAAkE;AAElE,SAAgB,SAAS,CAAC,IAA+B,EAAE,YAAiB;IAC1E,OAAO,IAAA,+CAAuC,EAAC,IAAA,qBAAS,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;AAChF,CAAC;AAFD,8BAEC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Nullable = void 0;
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
function Nullable() {
|
|
7
|
-
return (0, utils_1.createSchemaPropertyDecorator)({ nullable: true });
|
|
8
|
-
}
|
|
9
|
-
exports.Nullable = Nullable;
|
|
10
|
-
//# sourceMappingURL=nullable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../source/schema/decorators/nullable.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mCAAwD;AAExD,SAAgB,QAAQ;IACtB,OAAO,IAAA,qCAA6B,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3D,CAAC;AAFD,4BAEC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type { OneOrMany as OneOrManyType } from "../../types";
|
|
3
|
-
import type { SchemaTestable } from '../schema';
|
|
4
|
-
import type { OneOrManyOptions } from '../schemas/one-or-many';
|
|
5
|
-
export declare type OneOrMany<T> = OneOrManyType<T>;
|
|
6
|
-
export declare function OneOrMany(innerValues: OneOrMany<SchemaTestable>, options?: OneOrManyOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.OneOrMany = void 0;
|
|
5
|
-
const one_or_many_1 = require("../schemas/one-or-many");
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
8
|
-
function OneOrMany(innerValues, options) {
|
|
9
|
-
return (0, utils_1.createSchemaPropertyDecoratorFromSchema)((0, one_or_many_1.oneOrMany)(innerValues, options));
|
|
10
|
-
}
|
|
11
|
-
exports.OneOrMany = OneOrMany;
|
|
12
|
-
//# sourceMappingURL=one-or-many.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"one-or-many.js","sourceRoot":"","sources":["../../../source/schema/decorators/one-or-many.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAMzD,wDAAmD;AACnD,mCAAkE;AAIlE,2DAA2D;AAC3D,SAAgB,SAAS,CAAC,WAAsC,EAAE,OAA0B;IAC1F,OAAO,IAAA,+CAAuC,EAAC,IAAA,uBAAS,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAClF,CAAC;AAFD,8BAEC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Optional = void 0;
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
function Optional(schema) {
|
|
7
|
-
return (0, utils_1.createSchemaPropertyDecorator)({ schema, optional: true });
|
|
8
|
-
}
|
|
9
|
-
exports.Optional = Optional;
|
|
10
|
-
//# sourceMappingURL=optional.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../source/schema/decorators/optional.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAKzD,mCAAwD;AAExD,SAAgB,QAAQ,CAAC,MAAkC;IACzD,OAAO,IAAA,qCAA6B,EAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC;AAFD,4BAEC"}
|