@tstdl/base 0.71.89 → 0.78.0-beta10
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/.eslintrc.js +2 -4
- package/api/client/client.js +2 -12
- package/api/client/client.js.map +1 -1
- package/api/default-error-handlers.d.ts +0 -4
- package/api/default-error-handlers.js +1 -6
- package/api/default-error-handlers.js.map +1 -1
- package/api/server/gateway.js +15 -18
- package/api/server/gateway.js.map +1 -1
- package/api/server/module.d.ts +0 -4
- package/api/server/module.js +1 -12
- package/api/server/module.js.map +1 -1
- package/api/types.d.ts +15 -36
- package/api/types.js.map +1 -1
- package/container/container.js +2 -2
- package/container/container.js.map +1 -1
- package/container/resolve-chain.d.ts +5 -5
- package/container/resolve-chain.js.map +1 -1
- package/data-structures/index.d.ts +1 -0
- package/data-structures/index.js +1 -0
- package/data-structures/index.js.map +1 -1
- package/data-structures/iterable-weak-map.d.ts +29 -0
- package/data-structures/iterable-weak-map.js +128 -0
- package/data-structures/iterable-weak-map.js.map +1 -0
- package/data-structures/multi-key-map.d.ts +12 -1
- package/data-structures/multi-key-map.js +22 -11
- package/data-structures/multi-key-map.js.map +1 -1
- package/enumerable/async-enumerable.d.ts +2 -1
- package/enumerable/async-enumerable.js +3 -0
- package/enumerable/async-enumerable.js.map +1 -1
- package/enumerable/enumerable-methods.d.ts +1 -0
- package/enumerable/enumerable.d.ts +1 -0
- package/enumerable/enumerable.js +12 -18
- package/enumerable/enumerable.js.map +1 -1
- package/error/custom.error.d.ts +3 -1
- package/error/custom.error.js +16 -7
- package/error/custom.error.js.map +1 -1
- package/examples/api/basic-overview.js +16 -8
- package/examples/api/basic-overview.js.map +1 -1
- package/http/client/adapters/utils.js.map +1 -1
- package/image-service/image-service.d.ts +32 -65
- package/image-service/image-service.js +73 -15
- package/image-service/image-service.js.map +1 -1
- package/json-path/json-path.d.ts +8 -3
- package/json-path/json-path.js +24 -7
- package/json-path/json-path.js.map +1 -1
- package/mail/template-providers/file-mail-template.provider.js +2 -2
- package/mail/template-providers/file-mail-template.provider.js.map +1 -1
- package/module/modules/index.d.ts +0 -1
- package/module/modules/index.js +0 -1
- package/module/modules/index.js.map +1 -1
- package/openid-connect/oidc-configuration.service.js +7 -7
- package/openid-connect/oidc-configuration.service.js.map +1 -1
- package/openid-connect/oidc.service.js +7 -7
- package/openid-connect/oidc.service.js.map +1 -1
- package/package.json +2 -4
- package/process-shutdown.js +3 -2
- package/process-shutdown.js.map +1 -1
- package/promise/deferred-promise.d.ts +2 -15
- package/promise/deferred-promise.js +5 -10
- package/promise/deferred-promise.js.map +1 -1
- package/promise/lazy-promise.d.ts +11 -0
- package/promise/lazy-promise.js +31 -0
- package/promise/lazy-promise.js.map +1 -0
- package/reflection/decorators.js +1 -0
- package/reflection/decorators.js.map +1 -1
- package/reflection/reflection-data-map.d.ts +10 -0
- package/reflection/reflection-data-map.js +40 -0
- package/reflection/reflection-data-map.js.map +1 -0
- package/reflection/registry.d.ts +15 -15
- package/reflection/registry.js +7 -6
- package/reflection/registry.js.map +1 -1
- package/reflection/types.d.ts +1 -0
- package/reflection/utils.d.ts +6 -3
- package/reflection/utils.js +9 -35
- package/reflection/utils.js.map +1 -1
- package/schema/array-constraints/index.d.ts +2 -0
- package/{old-api/validation/validators → schema/array-constraints}/index.js +2 -1
- package/schema/array-constraints/index.js.map +1 -0
- package/schema/array-constraints/maximum-length.d.ts +11 -0
- package/schema/array-constraints/maximum-length.js +26 -0
- package/schema/array-constraints/maximum-length.js.map +1 -0
- package/schema/array-constraints/minimum-length.d.ts +11 -0
- package/schema/array-constraints/minimum-length.js +26 -0
- package/schema/array-constraints/minimum-length.js.map +1 -0
- package/schema/coercers/boolean.coercer.d.ts +9 -0
- package/schema/coercers/boolean.coercer.js +35 -0
- package/schema/coercers/boolean.coercer.js.map +1 -0
- package/schema/coercers/date.coercer.d.ts +9 -0
- package/schema/coercers/date.coercer.js +24 -0
- package/schema/coercers/date.coercer.js.map +1 -0
- package/schema/coercers/default-value.coercer.d.ts +9 -0
- package/schema/coercers/default-value.coercer.js +16 -0
- package/schema/coercers/default-value.coercer.js.map +1 -0
- package/schema/coercers/index.d.ts +7 -0
- package/schema/coercers/index.js +24 -0
- package/schema/coercers/index.js.map +1 -0
- package/schema/coercers/number.coercer.d.ts +9 -0
- package/schema/coercers/number.coercer.js +22 -0
- package/schema/coercers/number.coercer.js.map +1 -0
- package/schema/coercers/regexp.coercer.d.ts +11 -0
- package/schema/coercers/regexp.coercer.js +24 -0
- package/schema/coercers/regexp.coercer.js.map +1 -0
- package/schema/coercers/string.coercer.d.ts +9 -0
- package/schema/coercers/string.coercer.js +22 -0
- package/schema/coercers/string.coercer.js.map +1 -0
- package/schema/coercers/uint8-array.coercer.d.ts +9 -0
- package/schema/coercers/uint8-array.coercer.js +26 -0
- package/schema/coercers/uint8-array.coercer.js.map +1 -0
- package/schema/constraints/enumeration.d.ts +13 -0
- package/schema/constraints/enumeration.js +29 -0
- package/schema/constraints/enumeration.js.map +1 -0
- package/schema/constraints/generic.d.ts +22 -0
- package/schema/constraints/generic.js +32 -0
- package/schema/constraints/generic.js.map +1 -0
- package/schema/constraints/index.d.ts +12 -0
- package/schema/constraints/index.js +29 -0
- package/schema/constraints/index.js.map +1 -0
- package/schema/constraints/integer.d.ts +12 -0
- package/schema/constraints/integer.js +27 -0
- package/schema/constraints/integer.js.map +1 -0
- package/schema/constraints/length.d.ts +6 -0
- package/schema/constraints/length.js +20 -0
- package/schema/constraints/length.js.map +1 -0
- package/schema/constraints/literal.d.ts +10 -0
- package/schema/constraints/literal.js +26 -0
- package/schema/constraints/literal.js.map +1 -0
- package/schema/constraints/maximum-date.d.ts +12 -0
- package/schema/constraints/maximum-date.js +29 -0
- package/schema/constraints/maximum-date.js.map +1 -0
- package/schema/constraints/maximum-length.d.ts +12 -0
- package/schema/constraints/maximum-length.js +29 -0
- package/schema/constraints/maximum-length.js.map +1 -0
- package/schema/constraints/maximum.d.ts +12 -0
- package/schema/constraints/maximum.js +27 -0
- package/schema/constraints/maximum.js.map +1 -0
- package/schema/constraints/minimum-date.d.ts +12 -0
- package/schema/constraints/minimum-date.js +29 -0
- package/schema/constraints/minimum-date.js.map +1 -0
- package/schema/constraints/minimum-length.d.ts +12 -0
- package/schema/constraints/minimum-length.js +29 -0
- package/schema/constraints/minimum-length.js.map +1 -0
- package/schema/constraints/minimum.d.ts +12 -0
- package/schema/constraints/minimum.js +27 -0
- package/schema/constraints/minimum.js.map +1 -0
- package/schema/constraints/pattern.d.ts +13 -0
- package/schema/constraints/pattern.js +28 -0
- package/schema/constraints/pattern.js.map +1 -0
- package/schema/decorators/array.d.ts +5 -0
- package/schema/decorators/array.js +11 -0
- package/schema/decorators/array.js.map +1 -0
- package/schema/decorators/coerce.d.ts +2 -0
- package/schema/decorators/coerce.js +10 -0
- package/schema/decorators/coerce.js.map +1 -0
- package/schema/decorators/defaulted.d.ts +4 -0
- package/schema/decorators/defaulted.js +11 -0
- package/schema/decorators/defaulted.js.map +1 -0
- package/schema/decorators/index.d.ts +8 -0
- package/{old-api → schema/decorators}/index.js +8 -3
- package/schema/decorators/index.js.map +1 -0
- package/schema/decorators/nullable.d.ts +2 -0
- package/schema/decorators/nullable.js +10 -0
- package/schema/decorators/nullable.js.map +1 -0
- package/schema/decorators/optional.d.ts +2 -0
- package/schema/decorators/optional.js +10 -0
- package/schema/decorators/optional.js.map +1 -0
- package/schema/decorators/property.d.ts +6 -0
- package/schema/decorators/property.js +22 -0
- package/schema/decorators/property.js.map +1 -0
- package/schema/decorators/type.d.ts +3 -0
- package/schema/decorators/type.js +10 -0
- package/schema/decorators/type.js.map +1 -0
- package/schema/decorators/types.d.ts +18 -0
- package/schema/decorators/types.js +3 -0
- package/schema/decorators/types.js.map +1 -0
- package/schema/decorators/utils.d.ts +11 -0
- package/schema/decorators/utils.js +55 -0
- package/schema/decorators/utils.js.map +1 -0
- package/schema/index.d.ts +7 -1
- package/schema/index.js +7 -1
- package/schema/index.js.map +1 -1
- package/schema/schema.d.ts +20 -0
- package/schema/schema.error.d.ts +13 -7
- package/schema/schema.error.js +45 -13
- package/schema/schema.error.js.map +1 -1
- package/schema/schema.js +282 -0
- package/schema/schema.js.map +1 -0
- package/schema/schemas/any.d.ts +4 -8
- package/schema/schemas/any.js +9 -14
- package/schema/schemas/any.js.map +1 -1
- package/schema/schemas/array.d.ts +9 -13
- package/schema/schemas/array.js +13 -43
- package/schema/schemas/array.js.map +1 -1
- package/schema/schemas/assign.d.ts +8 -0
- package/schema/schemas/assign.js +27 -0
- package/schema/schemas/assign.js.map +1 -0
- package/schema/schemas/boolean.d.ts +5 -9
- package/schema/schemas/boolean.js +10 -38
- package/schema/schemas/boolean.js.map +1 -1
- package/schema/schemas/constraint.d.ts +4 -0
- package/schema/schemas/constraint.js +13 -0
- package/schema/schemas/constraint.js.map +1 -0
- package/schema/schemas/date.d.ts +7 -11
- package/schema/schemas/date.js +17 -53
- package/schema/schemas/date.js.map +1 -1
- package/schema/schemas/defaulted.d.ts +4 -15
- package/schema/schemas/defaulted.js +6 -23
- package/schema/schemas/defaulted.js.map +1 -1
- package/schema/schemas/enumeration.d.ts +6 -18
- package/schema/schemas/enumeration.js +12 -50
- package/schema/schemas/enumeration.js.map +1 -1
- package/schema/schemas/exclude.d.ts +4 -0
- package/schema/schemas/exclude.js +17 -0
- package/schema/schemas/exclude.js.map +1 -0
- package/schema/schemas/index.d.ts +5 -5
- package/schema/schemas/index.js +5 -5
- package/schema/schemas/index.js.map +1 -1
- package/schema/schemas/instance.d.ts +2 -12
- package/schema/schemas/instance.js +4 -20
- package/schema/schemas/instance.js.map +1 -1
- package/schema/schemas/literal.d.ts +4 -11
- package/schema/schemas/literal.js +12 -18
- package/schema/schemas/literal.js.map +1 -1
- package/schema/schemas/nullable.d.ts +3 -13
- package/schema/schemas/nullable.js +3 -26
- package/schema/schemas/nullable.js.map +1 -1
- package/schema/schemas/number.d.ts +7 -14
- package/schema/schemas/number.js +25 -44
- package/schema/schemas/number.js.map +1 -1
- package/schema/schemas/object.d.ts +5 -34
- package/schema/schemas/object.js +8 -112
- package/schema/schemas/object.js.map +1 -1
- package/schema/schemas/optional.d.ts +3 -13
- package/schema/schemas/optional.js +3 -26
- package/schema/schemas/optional.js.map +1 -1
- package/schema/schemas/pick.d.ts +4 -0
- package/schema/schemas/pick.js +17 -0
- package/schema/schemas/pick.js.map +1 -0
- package/schema/schemas/readable-stream.d.ts +4 -9
- package/schema/schemas/readable-stream.js +9 -16
- package/schema/schemas/readable-stream.js.map +1 -1
- package/schema/schemas/record.d.ts +5 -0
- package/schema/schemas/record.js +14 -0
- package/schema/schemas/record.js.map +1 -0
- package/schema/schemas/regexp.d.ts +6 -9
- package/schema/schemas/regexp.js +10 -27
- package/schema/schemas/regexp.js.map +1 -1
- package/schema/schemas/string.d.ts +9 -13
- package/schema/schemas/string.js +33 -46
- package/schema/schemas/string.js.map +1 -1
- package/schema/schemas/transform.d.ts +5 -16
- package/schema/schemas/transform.js +5 -36
- package/schema/schemas/transform.js.map +1 -1
- package/schema/schemas/uint8-array.d.ts +7 -11
- package/schema/schemas/uint8-array.js +20 -32
- package/schema/schemas/uint8-array.js.map +1 -1
- package/schema/schemas/union.d.ts +10 -17
- package/schema/schemas/union.js +11 -36
- package/schema/schemas/union.js.map +1 -1
- package/schema/schemas/unknown.d.ts +4 -8
- package/schema/schemas/unknown.js +9 -14
- package/schema/schemas/unknown.js.map +1 -1
- package/schema/transformers/generic.d.ts +13 -0
- package/schema/transformers/generic.js +28 -0
- package/schema/transformers/generic.js.map +1 -0
- package/schema/transformers/index.d.ts +3 -0
- package/{old-api/endpoints → schema/transformers}/index.js +3 -1
- package/schema/transformers/index.js.map +1 -0
- package/schema/transformers/lowercase.d.ts +9 -0
- package/schema/transformers/lowercase.js +22 -0
- package/schema/transformers/lowercase.js.map +1 -0
- package/schema/transformers/trim.d.ts +9 -0
- package/schema/transformers/trim.js +22 -0
- package/schema/transformers/trim.js.map +1 -0
- package/schema/transformers/uppercase.d.ts +9 -0
- package/schema/transformers/uppercase.js +22 -0
- package/schema/transformers/uppercase.js.map +1 -0
- package/schema/types.d.ts +155 -17
- package/schema/types.js +74 -3
- package/schema/types.js.map +1 -1
- package/schema/utils/index.d.ts +2 -0
- package/{old-api/validation → schema/utils}/index.js +2 -1
- package/schema/utils/index.js.map +1 -0
- package/schema/utils/schema.d.ts +13 -0
- package/schema/utils/schema.js +74 -0
- package/schema/utils/schema.js.map +1 -0
- package/schema/utils/value-type.d.ts +5 -0
- package/schema/utils/value-type.js +39 -0
- package/schema/utils/value-type.js.map +1 -0
- package/templates/providers/file-template.provider.base.d.ts +1 -1
- package/templates/providers/file-template.provider.base.js +3 -2
- package/templates/providers/file-template.provider.base.js.map +1 -1
- package/templates/providers/file-template.provider.js.map +1 -1
- package/types.d.ts +8 -4
- package/utils/async-iterable-helpers/includes.d.ts +2 -0
- package/utils/async-iterable-helpers/includes.js +13 -0
- package/utils/async-iterable-helpers/includes.js.map +1 -0
- package/utils/async-iterable-helpers/index.d.ts +1 -0
- package/utils/async-iterable-helpers/index.js +1 -0
- package/utils/async-iterable-helpers/index.js.map +1 -1
- package/utils/compression.d.ts +13 -13
- package/utils/compression.js +2 -1
- package/utils/compression.js.map +1 -1
- package/utils/encoding.js +1 -1
- package/utils/encoding.js.map +1 -1
- package/utils/enum.d.ts +1 -1
- package/utils/function/memoize.d.ts +6 -2
- package/utils/function/memoize.js +28 -20
- package/utils/function/memoize.js.map +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/index.js.map +1 -1
- package/utils/iterable-helpers/includes.d.ts +1 -0
- package/utils/iterable-helpers/includes.js +9 -0
- package/utils/iterable-helpers/includes.js.map +1 -0
- package/utils/iterable-helpers/index.d.ts +1 -0
- package/utils/iterable-helpers/index.js +1 -0
- package/utils/iterable-helpers/index.js.map +1 -1
- package/utils/merge.d.ts +5 -0
- package/utils/merge.js +32 -0
- package/utils/merge.js.map +1 -0
- package/utils/object/dereference.js.map +1 -1
- package/utils/object/object.d.ts +4 -0
- package/utils/object/object.js +9 -2
- package/utils/object/object.js.map +1 -1
- package/utils/patterns.d.ts +1 -1
- package/utils/patterns.js +3 -3
- package/utils/patterns.js.map +1 -1
- package/utils/timing.d.ts +0 -8
- package/utils/timing.js.map +1 -1
- package/utils/type-guards.d.ts +6 -0
- package/utils/type-guards.js +16 -4
- package/utils/type-guards.js.map +1 -1
- package/instance-provider.d.ts +0 -17
- package/instance-provider.js +0 -55
- package/instance-provider.js.map +0 -1
- package/module/modules/old-web-server.module.d.ts +0 -22
- package/module/modules/old-web-server.module.js +0 -37
- package/module/modules/old-web-server.module.js.map +0 -1
- package/old-api/endpoint.d.ts +0 -5
- package/old-api/endpoint.js +0 -20
- package/old-api/endpoint.js.map +0 -1
- package/old-api/endpoints/echo.endpoint.d.ts +0 -2
- package/old-api/endpoints/echo.endpoint.js +0 -6
- package/old-api/endpoints/echo.endpoint.js.map +0 -1
- package/old-api/endpoints/index.d.ts +0 -1
- package/old-api/endpoints/index.js.map +0 -1
- package/old-api/http-api.d.ts +0 -63
- package/old-api/http-api.js +0 -269
- package/old-api/http-api.js.map +0 -1
- package/old-api/index.d.ts +0 -3
- package/old-api/index.js.map +0 -1
- package/old-api/validation/index.d.ts +0 -1
- package/old-api/validation/index.js.map +0 -1
- package/old-api/validation/types.d.ts +0 -6
- package/old-api/validation/types.js +0 -6
- package/old-api/validation/types.js.map +0 -1
- package/old-api/validation/validators/index.d.ts +0 -1
- package/old-api/validation/validators/index.js.map +0 -1
- package/old-api/validation/validators/noop.d.ts +0 -2
- package/old-api/validation/validators/noop.js +0 -8
- package/old-api/validation/validators/noop.js.map +0 -1
- package/old-api/validation/validators/superstruct.d.ts +0 -14
- package/old-api/validation/validators/superstruct.js +0 -66
- package/old-api/validation/validators/superstruct.js.map +0 -1
- package/old-api/validation/validators/yup.d.ts +0 -7
- package/old-api/validation/validators/yup.js +0 -60
- package/old-api/validation/validators/yup.js.map +0 -1
- package/schema/schema.validator.d.ts +0 -40
- package/schema/schema.validator.js +0 -75
- package/schema/schema.validator.js.map +0 -1
- package/schema/schemas/async-iterable.d.ts +0 -13
- package/schema/schemas/async-iterable.js +0 -40
- package/schema/schemas/async-iterable.js.map +0 -1
- package/schema/schemas/iterable.d.ts +0 -13
- package/schema/schemas/iterable.js +0 -40
- package/schema/schemas/iterable.js.map +0 -1
- package/schema/schemas/never.d.ts +0 -9
- package/schema/schemas/never.js +0 -22
- package/schema/schemas/never.js.map +0 -1
- package/schema/schemas/preprocess.d.ts +0 -16
- package/schema/schemas/preprocess.js +0 -35
- package/schema/schemas/preprocess.js.map +0 -1
- package/schema/schemas/refine.d.ts +0 -24
- package/schema/schemas/refine.js +0 -52
- package/schema/schemas/refine.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { Decorator } from "../../reflection";
|
|
3
|
+
import type { ConstraintResult } from '../types';
|
|
4
|
+
import { SchemaValueConstraint } from '../types';
|
|
5
|
+
export declare class MaximumConstraint extends SchemaValueConstraint {
|
|
6
|
+
private readonly maximum;
|
|
7
|
+
readonly suitableTypes: NumberConstructor;
|
|
8
|
+
readonly expects: string;
|
|
9
|
+
constructor(maximum: number);
|
|
10
|
+
validate(value: number, path: JsonPath): ConstraintResult;
|
|
11
|
+
}
|
|
12
|
+
export declare function Maximum(maximum: number): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Maximum = exports.MaximumConstraint = void 0;
|
|
5
|
+
const decorators_1 = require("../decorators");
|
|
6
|
+
const schema_error_1 = require("../schema.error");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
class MaximumConstraint extends types_1.SchemaValueConstraint {
|
|
9
|
+
constructor(maximum) {
|
|
10
|
+
super();
|
|
11
|
+
this.suitableTypes = Number;
|
|
12
|
+
this.maximum = maximum;
|
|
13
|
+
this.expects = `<= ${this.maximum}`;
|
|
14
|
+
}
|
|
15
|
+
validate(value, path) {
|
|
16
|
+
if (value > this.maximum) {
|
|
17
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
|
|
18
|
+
}
|
|
19
|
+
return { valid: true };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.MaximumConstraint = MaximumConstraint;
|
|
23
|
+
function Maximum(maximum) {
|
|
24
|
+
return (0, decorators_1.createSchemaValueConstraintDecorator)(new MaximumConstraint(maximum), { schema: (0, types_1.typeSchema)(Number) });
|
|
25
|
+
}
|
|
26
|
+
exports.Maximum = Maximum;
|
|
27
|
+
//# sourceMappingURL=maximum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maximum.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAM1D,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;QACpC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SAClG;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AApBD,8CAoBC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAA,iDAAoC,EAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC9G,CAAC;AAFD,0BAEC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { Decorator } from "../../reflection";
|
|
3
|
+
import type { ConstraintResult } from '../types';
|
|
4
|
+
import { SchemaValueConstraint } from '../types';
|
|
5
|
+
export declare class MinimumDateConstraint extends SchemaValueConstraint {
|
|
6
|
+
private readonly minimum;
|
|
7
|
+
readonly suitableTypes: NumberConstructor;
|
|
8
|
+
readonly expects: string;
|
|
9
|
+
constructor(minimum: Date | number);
|
|
10
|
+
validate(value: Date, path: JsonPath): ConstraintResult;
|
|
11
|
+
}
|
|
12
|
+
export declare function MinimumDate(minimum: number): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MinimumDate = exports.MinimumDateConstraint = void 0;
|
|
5
|
+
const type_guards_1 = require("../../utils/type-guards");
|
|
6
|
+
const decorators_1 = require("../decorators");
|
|
7
|
+
const schema_error_1 = require("../schema.error");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
|
+
class MinimumDateConstraint extends types_1.SchemaValueConstraint {
|
|
10
|
+
constructor(minimum) {
|
|
11
|
+
super();
|
|
12
|
+
this.suitableTypes = Number;
|
|
13
|
+
this.minimum = (0, type_guards_1.isNumber)(minimum) ? new Date(minimum) : minimum;
|
|
14
|
+
this.expects = `>= ${this.minimum.toISOString()}`;
|
|
15
|
+
(0, type_guards_1.assertValidDate)(this.minimum);
|
|
16
|
+
}
|
|
17
|
+
validate(value, path) {
|
|
18
|
+
if (value > this.minimum) {
|
|
19
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path) };
|
|
20
|
+
}
|
|
21
|
+
return { valid: true };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.MinimumDateConstraint = MinimumDateConstraint;
|
|
25
|
+
function MinimumDate(minimum) {
|
|
26
|
+
return (0, decorators_1.createSchemaValueConstraintDecorator)(new MinimumDateConstraint(minimum), { schema: (0, types_1.typeSchema)(Number) });
|
|
27
|
+
}
|
|
28
|
+
exports.MinimumDate = MinimumDate;
|
|
29
|
+
//# sourceMappingURL=minimum-date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimum-date.js","sourceRoot":"","sources":["../../../source/schema/constraints/minimum-date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAgE;AAChE,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,qBAAsB,SAAQ,6BAAqB;IAM9D,YAAY,OAAsB;QAChC,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,IAAA,sBAAQ,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QAElD,IAAA,6BAAe,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ,CAAC,KAAW,EAAE,IAAc;QAClC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SACrG;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAtBD,sDAsBC;AAED,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAO,IAAA,iDAAoC,EAAC,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAClH,CAAC;AAFD,kCAEC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { Decorator } from "../../reflection";
|
|
3
|
+
import type { ConstraintResult } from '../types';
|
|
4
|
+
import { SchemaValueConstraint } from '../types';
|
|
5
|
+
export declare class MinimumLengthConstraint extends SchemaValueConstraint {
|
|
6
|
+
private readonly minimumLength;
|
|
7
|
+
readonly suitableTypes: (ArrayConstructor | StringConstructor | Uint8ArrayConstructor | Int8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | BigInt64ArrayConstructor | BigUint64ArrayConstructor | ArrayBufferConstructor)[];
|
|
8
|
+
readonly expects: string;
|
|
9
|
+
constructor(minimumLength: number);
|
|
10
|
+
validate(value: string | ArrayLike<any> | ArrayBuffer, path: JsonPath): ConstraintResult;
|
|
11
|
+
}
|
|
12
|
+
export declare function MinimumLength(minimumLength: number): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MinimumLength = exports.MinimumLengthConstraint = void 0;
|
|
5
|
+
const type_guards_1 = require("../../utils/type-guards");
|
|
6
|
+
const utils_1 = require("../decorators/utils");
|
|
7
|
+
const schema_error_1 = require("../schema.error");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
|
+
class MinimumLengthConstraint extends types_1.SchemaValueConstraint {
|
|
10
|
+
constructor(minimumLength) {
|
|
11
|
+
super();
|
|
12
|
+
this.suitableTypes = [String, Array, ArrayBuffer, Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, BigInt64Array, BigUint64Array];
|
|
13
|
+
this.minimumLength = minimumLength;
|
|
14
|
+
this.expects = `a minimum length of ${this.minimumLength}`;
|
|
15
|
+
}
|
|
16
|
+
validate(value, path) {
|
|
17
|
+
const length = (0, type_guards_1.isArrayBuffer)(value) ? value.byteLength : value.length;
|
|
18
|
+
if (length < this.minimumLength) {
|
|
19
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `a length of ${length}`, path) };
|
|
20
|
+
}
|
|
21
|
+
return { valid: true };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.MinimumLengthConstraint = MinimumLengthConstraint;
|
|
25
|
+
function MinimumLength(minimumLength) {
|
|
26
|
+
return (0, utils_1.createSchemaValueConstraintDecorator)(new MinimumLengthConstraint(minimumLength));
|
|
27
|
+
}
|
|
28
|
+
exports.MinimumLength = MinimumLength;
|
|
29
|
+
//# sourceMappingURL=minimum-length.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimum-length.js","sourceRoot":"","sources":["../../../source/schema/constraints/minimum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAoD;AACpD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,uBAAwB,SAAQ,6BAAqB;IAMhE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QAM3M,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,uBAAuB,IAAI,CAAC,aAAa,EAAE,CAAC;IAC7D,CAAC;IAED,QAAQ,CAAC,KAA4C,EAAE,IAAc;QACnE,MAAM,MAAM,GAAG,IAAA,2BAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;QAEtE,IAAI,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SACzG;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAtBD,0DAsBC;AAED,SAAgB,aAAa,CAAC,aAAqB;IACjD,OAAO,IAAA,4CAAoC,EAAC,IAAI,uBAAuB,CAAC,aAAa,CAAC,CAAC,CAAC;AAC1F,CAAC;AAFD,sCAEC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { Decorator } from "../../reflection";
|
|
3
|
+
import type { ConstraintResult } from '../types';
|
|
4
|
+
import { SchemaValueConstraint } from '../types';
|
|
5
|
+
export declare class MinimumConstraint extends SchemaValueConstraint {
|
|
6
|
+
private readonly minimum;
|
|
7
|
+
readonly suitableTypes: NumberConstructor;
|
|
8
|
+
readonly expects: string;
|
|
9
|
+
constructor(minimum: number);
|
|
10
|
+
validate(value: number, path: JsonPath): ConstraintResult;
|
|
11
|
+
}
|
|
12
|
+
export declare function Minimum(minimum: number): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Minimum = exports.MinimumConstraint = void 0;
|
|
5
|
+
const utils_1 = require("../decorators/utils");
|
|
6
|
+
const schema_error_1 = require("../schema.error");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
class MinimumConstraint extends types_1.SchemaValueConstraint {
|
|
9
|
+
constructor(minimum) {
|
|
10
|
+
super();
|
|
11
|
+
this.suitableTypes = Number;
|
|
12
|
+
this.minimum = minimum;
|
|
13
|
+
this.expects = `>= ${this.minimum}`;
|
|
14
|
+
}
|
|
15
|
+
validate(value, path) {
|
|
16
|
+
if (value < this.minimum) {
|
|
17
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
|
|
18
|
+
}
|
|
19
|
+
return { valid: true };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.MinimumConstraint = MinimumConstraint;
|
|
23
|
+
function Minimum(minimum) {
|
|
24
|
+
return (0, utils_1.createSchemaValueConstraintDecorator)(new MinimumConstraint(minimum), { schema: (0, types_1.typeSchema)(Number) });
|
|
25
|
+
}
|
|
26
|
+
exports.Minimum = Minimum;
|
|
27
|
+
//# sourceMappingURL=minimum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimum.js","sourceRoot":"","sources":["../../../source/schema/constraints/minimum.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAM1D,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;QACpC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SAClG;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AApBD,8CAoBC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAA,4CAAoC,EAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC9G,CAAC;AAFD,0BAEC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { Decorator } from "../../reflection";
|
|
3
|
+
import type { ConstraintResult } from '../types';
|
|
4
|
+
import { SchemaValueConstraint } from '../types';
|
|
5
|
+
export declare class PatternConstraint extends SchemaValueConstraint {
|
|
6
|
+
private readonly pattern;
|
|
7
|
+
private readonly patternName;
|
|
8
|
+
readonly suitableTypes: StringConstructor;
|
|
9
|
+
readonly expects: string;
|
|
10
|
+
constructor(pattern: RegExp, patternName?: string);
|
|
11
|
+
validate(value: string, path: JsonPath): ConstraintResult;
|
|
12
|
+
}
|
|
13
|
+
export declare function Pattern(pattern: RegExp, patternName?: string): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Pattern = exports.PatternConstraint = void 0;
|
|
5
|
+
const utils_1 = require("../decorators/utils");
|
|
6
|
+
const schema_error_1 = require("../schema.error");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
class PatternConstraint extends types_1.SchemaValueConstraint {
|
|
9
|
+
constructor(pattern, patternName = 'a pattern') {
|
|
10
|
+
super();
|
|
11
|
+
this.suitableTypes = String;
|
|
12
|
+
this.pattern = pattern;
|
|
13
|
+
this.patternName = patternName;
|
|
14
|
+
this.expects = `matching ${this.patternName}`;
|
|
15
|
+
}
|
|
16
|
+
validate(value, path) {
|
|
17
|
+
if (!this.pattern.test(value)) {
|
|
18
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `"${value}"`, path) };
|
|
19
|
+
}
|
|
20
|
+
return { valid: true };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.PatternConstraint = PatternConstraint;
|
|
24
|
+
function Pattern(pattern, patternName) {
|
|
25
|
+
return (0, utils_1.createSchemaValueConstraintDecorator)(new PatternConstraint(pattern, patternName), { schema: (0, types_1.typeSchema)(String) });
|
|
26
|
+
}
|
|
27
|
+
exports.Pattern = Pattern;
|
|
28
|
+
//# sourceMappingURL=pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../source/schema/constraints/pattern.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAO1D,YAAY,OAAe,EAAE,cAAsB,WAAW;QAC5D,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,YAAY,IAAI,CAAC,WAAW,EAAE,CAAC;IAChD,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;QACpC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;SAC9F;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAtBD,8CAsBC;AAED,SAAgB,OAAO,CAAC,OAAe,EAAE,WAAoB;IAC3D,OAAO,IAAA,4CAAoC,EAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC3H,CAAC;AAFD,0BAEC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
2
|
+
import type { OneOrMany } from "../../types";
|
|
3
|
+
import type { Schema } from '../schema';
|
|
4
|
+
import type { ArrayOptions } from '../schemas/array';
|
|
5
|
+
export declare function Array(innerValues: OneOrMany<Schema>, options?: ArrayOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,WAA8B,EAAE,OAAsB;IAC1E,OAAO,IAAA,+CAAuC,EAAC,IAAA,aAAK,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9E,CAAC;AAFD,sBAEC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Coerce = void 0;
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
function Coerce() {
|
|
7
|
+
return (0, utils_1.createSchemaPropertyDecorator)({ coerce: true });
|
|
8
|
+
}
|
|
9
|
+
exports.Coerce = Coerce;
|
|
10
|
+
//# sourceMappingURL=coerce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coerce.js","sourceRoot":"","sources":["../../../source/schema/decorators/coerce.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mCAAwD;AAExD,SAAgB,MAAM;IACpB,OAAO,IAAA,qCAA6B,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACzD,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,IAAuB,EAAE,YAAiB;IAClE,OAAO,IAAA,+CAAuC,EAAC,IAAA,qBAAS,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;AAChF,CAAC;AAFD,8BAEC"}
|
|
@@ -14,7 +14,12 @@ 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("
|
|
18
|
-
__exportStar(require("
|
|
19
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./array"), exports);
|
|
18
|
+
__exportStar(require("./coerce"), exports);
|
|
19
|
+
__exportStar(require("./nullable"), exports);
|
|
20
|
+
__exportStar(require("./optional"), exports);
|
|
21
|
+
__exportStar(require("./property"), exports);
|
|
22
|
+
__exportStar(require("./type"), exports);
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
__exportStar(require("./utils"), exports);
|
|
20
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/schema/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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() {
|
|
7
|
+
return (0, utils_1.createSchemaPropertyDecorator)({ optional: true });
|
|
8
|
+
}
|
|
9
|
+
exports.Optional = Optional;
|
|
10
|
+
//# sourceMappingURL=optional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../source/schema/decorators/optional.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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
2
|
+
import type { OneOrMany, TypedOmit } from "../../types";
|
|
3
|
+
import type { ValueType } from '../types';
|
|
4
|
+
import type { PropertyOptions } from './types';
|
|
5
|
+
export declare function Property(options?: PropertyOptions): Decorator<'property' | 'accessor'>;
|
|
6
|
+
export declare function Property(schema?: OneOrMany<ValueType>, options?: TypedOmit<PropertyOptions, 'schema'>): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Property = void 0;
|
|
5
|
+
const array_1 = require("../../utils/array/array");
|
|
6
|
+
const type_guards_1 = require("../../utils/type-guards");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
function Property(optionsOrTypes = {}, optionsOrNothing) {
|
|
10
|
+
const schema = ((0, type_guards_1.isFunction)(optionsOrTypes) || (0, type_guards_1.isString)(optionsOrTypes)) ? (0, types_1.typeSchema)(optionsOrTypes) : undefined;
|
|
11
|
+
const options = (0, type_guards_1.isUndefined)(schema) ? optionsOrTypes : optionsOrNothing ?? {};
|
|
12
|
+
return (0, utils_1.createSchemaPropertyDecorator)({
|
|
13
|
+
schema,
|
|
14
|
+
...options,
|
|
15
|
+
coercers: (0, type_guards_1.isDefined)(options.coercers) ? (0, array_1.toArray)(options.coercers) : undefined,
|
|
16
|
+
transformers: (0, type_guards_1.isDefined)(options.transformers) ? (0, array_1.toArray)(options.transformers) : undefined,
|
|
17
|
+
arrayConstraints: (0, type_guards_1.isDefined)(options.arrayConstraints) ? (0, array_1.toArray)(options.arrayConstraints) : undefined,
|
|
18
|
+
valueConstraints: (0, type_guards_1.isDefined)(options.valueConstraints) ? (0, array_1.toArray)(options.valueConstraints) : undefined
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.Property = Property;
|
|
22
|
+
//# sourceMappingURL=property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property.js","sourceRoot":"","sources":["../../../source/schema/decorators/property.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,mDAA8C;AAC9C,yDAAmF;AAEnF,oCAAsC;AAEtC,mCAAwD;AAIxD,SAAgB,QAAQ,CAAC,iBAAyD,EAAE,EAAE,gBAAkC;IACtH,MAAM,MAAM,GAAG,CAAC,IAAA,wBAAU,EAAC,cAAc,CAAC,IAAI,IAAA,sBAAQ,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjH,MAAM,OAAO,GAAG,IAAA,yBAAW,EAAC,MAAM,CAAC,CAAC,CAAC,CAAE,cAAkC,CAAC,CAAC,CAAC,gBAAgB,IAAK,EAAsB,CAAC;IAExH,OAAO,IAAA,qCAA6B,EAAC;QACnC,MAAM;QACN,GAAG,OAAO;QACV,QAAQ,EAAE,IAAA,uBAAS,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAA,eAAO,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QAC7E,YAAY,EAAE,IAAA,uBAAS,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAA,eAAO,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;QACzF,gBAAgB,EAAE,IAAA,uBAAS,EAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAA,eAAO,EAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;QACrG,gBAAgB,EAAE,IAAA,uBAAS,EAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAA,eAAO,EAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;KACtG,CAAC,CAAC;AACL,CAAC;AAZD,4BAYC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Type = void 0;
|
|
5
|
+
const reflection_1 = require("../../reflection");
|
|
6
|
+
function Type(options = {}) {
|
|
7
|
+
return (0, reflection_1.createClassDecorator)({ data: { schema: options }, mergeData: true });
|
|
8
|
+
}
|
|
9
|
+
exports.Type = Type;
|
|
10
|
+
//# sourceMappingURL=type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/schema/decorators/type.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,iDAAoD;AAGpD,SAAgB,IAAI,CAAC,UAAoC,EAAE;IACzD,OAAO,IAAA,iCAAoB,EAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC;AAFD,oBAEC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OneOrMany } from "../../types";
|
|
2
|
+
import type { Schema } from '../schema';
|
|
3
|
+
import type { ObjectSchema, SchemaArrayConstraint, SchemaFactoryFunction, SchemaValueCoercer, SchemaValueConstraint, SchemaValueTransformer, ValueSchema } from '../types';
|
|
4
|
+
export declare type SchemaTypeReflectionData = Partial<Pick<ObjectSchema, 'mask' | 'allowUnknownProperties'>> & {
|
|
5
|
+
factory?: SchemaFactoryFunction<any>;
|
|
6
|
+
};
|
|
7
|
+
export declare type SchemaPropertyReflectionData = {
|
|
8
|
+
type?: OneOrMany<Schema>;
|
|
9
|
+
array?: boolean;
|
|
10
|
+
optional?: boolean;
|
|
11
|
+
nullable?: boolean;
|
|
12
|
+
coerce?: boolean;
|
|
13
|
+
coercers?: readonly SchemaValueCoercer[];
|
|
14
|
+
transformers?: readonly SchemaValueTransformer[];
|
|
15
|
+
arrayConstraints?: readonly SchemaArrayConstraint[];
|
|
16
|
+
valueConstraints?: readonly SchemaValueConstraint[];
|
|
17
|
+
};
|
|
18
|
+
export declare type PropertyOptions = Partial<ValueSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../source/schema/decorators/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Decorator } from "../../reflection";
|
|
2
|
+
import type { OneOrMany } from "../../types";
|
|
3
|
+
import type { Schema } from '../schema';
|
|
4
|
+
import type { SchemaArrayConstraint, SchemaValueCoercer, SchemaValueConstraint, SchemaValueTransformer } from '../types';
|
|
5
|
+
import type { PropertyOptions } from './types';
|
|
6
|
+
export declare function createSchemaPropertyDecorator(options: PropertyOptions): Decorator<'property' | 'accessor'>;
|
|
7
|
+
export declare function createSchemaPropertyDecoratorFromSchema(schema: Schema): Decorator<'property' | 'accessor'>;
|
|
8
|
+
export declare function createSchemaValueCoercerDecorator(coercer: SchemaValueCoercer, options?: PropertyOptions): Decorator<'property' | 'accessor'>;
|
|
9
|
+
export declare function createSchemaValueTransformerDecorator(transformer: SchemaValueTransformer, options?: PropertyOptions): Decorator<'property' | 'accessor'>;
|
|
10
|
+
export declare function createSchemaArrayConstraintDecorator(constraint: SchemaArrayConstraint, options?: PropertyOptions): Decorator<'property' | 'accessor'>;
|
|
11
|
+
export declare function createSchemaValueConstraintDecorator(constraints: OneOrMany<SchemaValueConstraint>, options?: PropertyOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createSchemaValueConstraintDecorator = exports.createSchemaArrayConstraintDecorator = exports.createSchemaValueTransformerDecorator = exports.createSchemaValueCoercerDecorator = exports.createSchemaPropertyDecoratorFromSchema = exports.createSchemaPropertyDecorator = void 0;
|
|
5
|
+
const reflection_1 = require("../../reflection");
|
|
6
|
+
const array_1 = require("../../utils/array/array");
|
|
7
|
+
const merge_1 = require("../../utils/merge");
|
|
8
|
+
const object_1 = require("../../utils/object");
|
|
9
|
+
const type_guards_1 = require("../../utils/type-guards");
|
|
10
|
+
const types_1 = require("../types");
|
|
11
|
+
function createSchemaPropertyDecorator(options) {
|
|
12
|
+
return (0, reflection_1.createPropertyOrAccessorDecorator)({
|
|
13
|
+
handler(_, metadata) {
|
|
14
|
+
const schemaData = getSchemaPropertyReflectionData(metadata);
|
|
15
|
+
const newSchemaData = {
|
|
16
|
+
...options,
|
|
17
|
+
coercers: ((0, type_guards_1.isDefined)(options.coercers) && (!(0, type_guards_1.isArray)(options.coercers) || options.coercers.length > 0)) ? (0, merge_1.merge)((0, array_1.toArray)(options.coercers), schemaData.coercers) : undefined,
|
|
18
|
+
transformers: ((0, type_guards_1.isDefined)(options.transformers) && (!(0, type_guards_1.isArray)(options.transformers) || options.transformers.length > 0)) ? (0, merge_1.merge)((0, array_1.toArray)(options.transformers), schemaData.transformers) : undefined,
|
|
19
|
+
arrayConstraints: ((0, type_guards_1.isDefined)(options.arrayConstraints) && (!(0, type_guards_1.isArray)(options.arrayConstraints) || options.arrayConstraints.length > 0)) ? (0, merge_1.merge)((0, array_1.toArray)(options.arrayConstraints), schemaData.arrayConstraints) : undefined,
|
|
20
|
+
valueConstraints: ((0, type_guards_1.isDefined)(options.valueConstraints) && (!(0, type_guards_1.isArray)(options.valueConstraints) || options.valueConstraints.length > 0)) ? (0, merge_1.merge)((0, array_1.toArray)(options.valueConstraints), schemaData.valueConstraints) : undefined
|
|
21
|
+
};
|
|
22
|
+
metadata.data.set('schema', (0, object_1.filterObject)(newSchemaData, type_guards_1.isDefined), true);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.createSchemaPropertyDecorator = createSchemaPropertyDecorator;
|
|
27
|
+
function createSchemaPropertyDecoratorFromSchema(schema) {
|
|
28
|
+
return createSchemaPropertyDecorator((0, types_1.isValueSchema)(schema) ? schema : (0, types_1.valueSchema)(schema));
|
|
29
|
+
}
|
|
30
|
+
exports.createSchemaPropertyDecoratorFromSchema = createSchemaPropertyDecoratorFromSchema;
|
|
31
|
+
function createSchemaValueCoercerDecorator(coercer, options) {
|
|
32
|
+
return createSchemaPropertyDecorator({ ...options, coercers: coercer });
|
|
33
|
+
}
|
|
34
|
+
exports.createSchemaValueCoercerDecorator = createSchemaValueCoercerDecorator;
|
|
35
|
+
function createSchemaValueTransformerDecorator(transformer, options) {
|
|
36
|
+
return createSchemaPropertyDecorator({ ...options, transformers: transformer });
|
|
37
|
+
}
|
|
38
|
+
exports.createSchemaValueTransformerDecorator = createSchemaValueTransformerDecorator;
|
|
39
|
+
function createSchemaArrayConstraintDecorator(constraint, options) {
|
|
40
|
+
return createSchemaPropertyDecorator({ ...options, arrayConstraints: constraint });
|
|
41
|
+
}
|
|
42
|
+
exports.createSchemaArrayConstraintDecorator = createSchemaArrayConstraintDecorator;
|
|
43
|
+
function createSchemaValueConstraintDecorator(constraints, options) {
|
|
44
|
+
return createSchemaPropertyDecorator({ ...options, valueConstraints: constraints });
|
|
45
|
+
}
|
|
46
|
+
exports.createSchemaValueConstraintDecorator = createSchemaValueConstraintDecorator;
|
|
47
|
+
function getSchemaPropertyReflectionData(metadata) {
|
|
48
|
+
let schemaData = metadata.data.tryGet('schema');
|
|
49
|
+
if ((0, type_guards_1.isUndefined)(schemaData)) {
|
|
50
|
+
schemaData = {};
|
|
51
|
+
metadata.data.set('schema', schemaData);
|
|
52
|
+
}
|
|
53
|
+
return schemaData;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../source/schema/decorators/utils.ts"],"names":[],"mappings":"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"}
|
package/schema/index.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
export * from './array-constraints';
|
|
2
|
+
export * from './coercers';
|
|
3
|
+
export * from './constraints';
|
|
4
|
+
export * from './decorators';
|
|
5
|
+
export * from './schema';
|
|
1
6
|
export * from './schema.error';
|
|
2
|
-
export * from './schema.validator';
|
|
3
7
|
export * from './schemas';
|
|
8
|
+
export * from './transformers';
|
|
4
9
|
export * from './types';
|
|
10
|
+
export * from './utils';
|
package/schema/index.js
CHANGED
|
@@ -14,8 +14,14 @@ 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-constraints"), exports);
|
|
18
|
+
__exportStar(require("./coercers"), exports);
|
|
19
|
+
__exportStar(require("./constraints"), exports);
|
|
20
|
+
__exportStar(require("./decorators"), exports);
|
|
21
|
+
__exportStar(require("./schema"), exports);
|
|
17
22
|
__exportStar(require("./schema.error"), exports);
|
|
18
|
-
__exportStar(require("./schema.validator"), exports);
|
|
19
23
|
__exportStar(require("./schemas"), exports);
|
|
24
|
+
__exportStar(require("./transformers"), exports);
|
|
20
25
|
__exportStar(require("./types"), exports);
|
|
26
|
+
__exportStar(require("./utils"), exports);
|
|
21
27
|
//# sourceMappingURL=index.js.map
|
package/schema/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,6CAA2B;AAC3B,gDAA8B;AAC9B,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B;AAC/B,4CAA0B;AAC1B,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JsonPath } from "../json-path";
|
|
2
|
+
import type { AbstractConstructor } from "../types";
|
|
3
|
+
import type { NormalizedObjectSchema, NormalizedTypeSchema, NormalizedValueSchema, ObjectSchema, SchemaTestOptions, SchemaTestResult, SchemaValueCoercer, TypeSchema, ValueSchema, ValueType } from './types';
|
|
4
|
+
export declare type Schema<T = any, O = T> = ObjectSchema<T, O> | ValueSchema<T, O> | TypeSchema<O>;
|
|
5
|
+
export declare type SchemaTestable<T = any, O = T> = Schema<T, O> | ValueType<O>;
|
|
6
|
+
export declare type NormalizedSchema<T = any, O = T> = NormalizedObjectSchema<T, O> | NormalizedValueSchema<T, O> | NormalizedTypeSchema<O>;
|
|
7
|
+
export declare const getSchemaFromReflection: typeof _getObjectSchemaFromReflection;
|
|
8
|
+
export declare const Schema: {
|
|
9
|
+
registerDefaultCoercer(coercer: SchemaValueCoercer): void;
|
|
10
|
+
test<T, O>(schemaOrValueType: SchemaTestable<T, O>, value: unknown, options?: SchemaTestOptions, path?: JsonPath): SchemaTestResult<O>;
|
|
11
|
+
validate<T_1, O_1 = T_1>(schemaOrValueType: SchemaTestable<T_1, O_1>, value: unknown, options?: SchemaTestOptions): boolean;
|
|
12
|
+
parse<T_2, O_2 = T_2>(schemaOrValueType: SchemaTestable<T_2, O_2>, value: unknown, options?: SchemaTestOptions): O_2;
|
|
13
|
+
/**
|
|
14
|
+
* disables stack traces for errors
|
|
15
|
+
* @deprecated for internal use only
|
|
16
|
+
*/
|
|
17
|
+
testWithFastError<T_3, O_3 = T_3>(schema: Schema<T_3, O_3>, value: unknown, options?: SchemaTestOptions, path?: JsonPath): SchemaTestResult<O_3>;
|
|
18
|
+
};
|
|
19
|
+
declare function _getObjectSchemaFromReflection<T>(type: AbstractConstructor<T>): ObjectSchema<T> | null;
|
|
20
|
+
export {};
|