@tstdl/base 0.78.0-beta2 → 0.78.0-beta22
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/api/client/client.d.ts +2 -1
- package/api/client/client.js +6 -13
- package/api/client/client.js.map +1 -1
- package/api/response.js.map +1 -1
- package/api/server/gateway.js +7 -5
- package/api/server/gateway.js.map +1 -1
- package/api/types.d.ts +24 -10
- package/api/types.js +1 -2
- package/api/types.js.map +1 -1
- package/api/utils.d.ts +9 -0
- package/api/utils.js +15 -0
- package/api/utils.js.map +1 -0
- package/container/container.js.map +1 -1
- package/container/resolve-chain.d.ts +5 -5
- package/container/resolve-chain.js.map +1 -1
- package/database/mongo/mongo-base.repository.js.map +1 -1
- package/database/mongo/mongo-entity-repository.js +2 -2
- package/database/mongo/mongo-entity-repository.js.map +1 -1
- package/database/mongo/types.d.ts +2 -2
- 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 +1 -1
- package/error/custom.error.js +8 -6
- package/error/custom.error.js.map +1 -1
- package/examples/api/basic-overview.js +0 -1
- package/examples/api/basic-overview.js.map +1 -1
- package/http/client/adapters/utils.js +20 -8
- package/http/client/adapters/utils.js.map +1 -1
- package/http/client/http-client.js +2 -2
- package/http/client/http-client.js.map +1 -1
- package/key-value-store/mongo/mongo-key-value.model.d.ts +1 -0
- package/mail/template-providers/file-mail-template.provider.js +2 -2
- package/mail/template-providers/file-mail-template.provider.js.map +1 -1
- package/package.json +6 -7
- 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/index.d.ts +1 -0
- package/promise/index.js +1 -0
- package/promise/index.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/queue/mongo/mongo-job.repository.js +1 -1
- package/queue/mongo/mongo-job.repository.js.map +1 -1
- package/reflection/decorator-data.js +1 -1
- package/reflection/decorator-data.js.map +1 -1
- package/reflection/decorators.d.ts +2 -2
- package/reflection/decorators.js +7 -7
- package/reflection/decorators.js.map +1 -1
- package/reflection/registry.d.ts +9 -9
- package/reflection/registry.js +1 -1
- package/reflection/registry.js.map +1 -1
- package/reflection/types.d.ts +3 -2
- package/reflection/utils.d.ts +7 -2
- package/reflection/utils.js +38 -12
- package/reflection/utils.js.map +1 -1
- package/schema/array-constraints/maximum-length.js +2 -2
- package/schema/array-constraints/maximum-length.js.map +1 -1
- package/schema/array-constraints/minimum-length.js +2 -2
- package/schema/array-constraints/minimum-length.js.map +1 -1
- package/schema/coercers/default-value.coercer.d.ts +1 -1
- package/schema/coercers/default-value.coercer.js +1 -1
- package/schema/coercers/default-value.coercer.js.map +1 -1
- package/schema/coercers/uint8-array.coercer.js +4 -9
- package/schema/coercers/uint8-array.coercer.js.map +1 -1
- package/schema/constraints/enumeration.js +2 -2
- package/schema/constraints/enumeration.js.map +1 -1
- package/schema/constraints/generic.js +2 -2
- package/schema/constraints/generic.js.map +1 -1
- package/schema/constraints/integer.js +3 -3
- package/schema/constraints/integer.js.map +1 -1
- package/schema/constraints/literal.js +2 -2
- package/schema/constraints/literal.js.map +1 -1
- package/schema/constraints/maximum-date.js +3 -3
- package/schema/constraints/maximum-date.js.map +1 -1
- package/schema/constraints/maximum-length.js +2 -2
- package/schema/constraints/maximum-length.js.map +1 -1
- package/schema/constraints/maximum.js +3 -3
- package/schema/constraints/maximum.js.map +1 -1
- package/schema/constraints/minimum-date.js +3 -3
- package/schema/constraints/minimum-date.js.map +1 -1
- package/schema/constraints/minimum-length.js +2 -2
- package/schema/constraints/minimum-length.js.map +1 -1
- package/schema/constraints/minimum.js +3 -3
- package/schema/constraints/minimum.js.map +1 -1
- package/schema/constraints/pattern.js +3 -3
- package/schema/constraints/pattern.js.map +1 -1
- package/schema/decorators/array.d.ts +3 -2
- package/schema/decorators/array.js +1 -1
- package/schema/decorators/array.js.map +1 -1
- package/schema/decorators/defaulted.d.ts +3 -2
- package/schema/decorators/defaulted.js +1 -1
- package/schema/decorators/defaulted.js.map +1 -1
- package/schema/decorators/property.d.ts +3 -3
- package/schema/decorators/property.js +4 -1
- package/schema/decorators/property.js.map +1 -1
- package/schema/decorators/types.d.ts +3 -3
- package/schema/decorators/utils.d.ts +3 -2
- package/schema/decorators/utils.js +4 -8
- package/schema/decorators/utils.js.map +1 -1
- package/schema/schema.d.ts +8 -11
- package/schema/schema.error.d.ts +1 -0
- package/schema/schema.error.js +1 -1
- package/schema/schema.error.js.map +1 -1
- package/schema/schema.js +122 -157
- package/schema/schema.js.map +1 -1
- package/schema/schemas/any.d.ts +2 -2
- package/schema/schemas/any.js +2 -2
- package/schema/schemas/any.js.map +1 -1
- package/schema/schemas/array.d.ts +4 -2
- package/schema/schemas/array.js +1 -2
- package/schema/schemas/array.js.map +1 -1
- package/schema/schemas/assign.d.ts +5 -5
- package/schema/schemas/assign.js +0 -1
- package/schema/schemas/assign.js.map +1 -1
- package/schema/schemas/boolean.js +2 -3
- package/schema/schemas/boolean.js.map +1 -1
- package/schema/schemas/constraint.d.ts +1 -1
- package/schema/schemas/constraint.js +1 -2
- package/schema/schemas/constraint.js.map +1 -1
- package/schema/schemas/date.js +2 -3
- package/schema/schemas/date.js.map +1 -1
- package/schema/schemas/defaulted.d.ts +4 -2
- package/schema/schemas/defaulted.js +1 -2
- package/schema/schemas/defaulted.js.map +1 -1
- package/schema/schemas/enumeration.js +2 -3
- package/schema/schemas/enumeration.js.map +1 -1
- package/schema/schemas/exclude.d.ts +4 -1
- package/schema/schemas/exclude.js +6 -11
- package/schema/schemas/exclude.js.map +1 -1
- package/schema/schemas/index.d.ts +2 -0
- package/schema/schemas/index.js +2 -0
- package/schema/schemas/index.js.map +1 -1
- package/schema/schemas/instance.d.ts +2 -2
- package/schema/schemas/instance.js +1 -1
- package/schema/schemas/instance.js.map +1 -1
- package/schema/schemas/literal.js +2 -3
- package/schema/schemas/literal.js.map +1 -1
- package/schema/schemas/nullable.d.ts +1 -1
- package/schema/schemas/nullable.js +1 -1
- package/schema/schemas/nullable.js.map +1 -1
- package/schema/schemas/number.d.ts +1 -1
- package/schema/schemas/number.js +5 -3
- package/schema/schemas/number.js.map +1 -1
- package/schema/schemas/object.d.ts +2 -3
- package/schema/schemas/object.js.map +1 -1
- package/schema/schemas/omit.d.ts +4 -0
- package/schema/schemas/omit.js +17 -0
- package/schema/schemas/omit.js.map +1 -0
- package/schema/schemas/optional.d.ts +1 -1
- package/schema/schemas/optional.js +1 -1
- package/schema/schemas/optional.js.map +1 -1
- package/schema/schemas/pick.js.map +1 -1
- package/schema/schemas/readable-stream.d.ts +2 -2
- package/schema/schemas/readable-stream.js +3 -4
- package/schema/schemas/readable-stream.js.map +1 -1
- package/schema/schemas/record.d.ts +5 -4
- package/schema/schemas/record.js +2 -2
- package/schema/schemas/record.js.map +1 -1
- package/schema/schemas/regexp.js +3 -3
- package/schema/schemas/regexp.js.map +1 -1
- package/schema/schemas/string.js +2 -3
- package/schema/schemas/string.js.map +1 -1
- package/schema/schemas/transform.d.ts +4 -3
- package/schema/schemas/transform.js +1 -3
- package/schema/schemas/transform.js.map +1 -1
- package/schema/schemas/uint8-array.d.ts +2 -3
- package/schema/schemas/uint8-array.js +4 -4
- package/schema/schemas/uint8-array.js.map +1 -1
- package/schema/schemas/union.d.ts +9 -4
- package/schema/schemas/union.js +5 -4
- package/schema/schemas/union.js.map +1 -1
- package/schema/schemas/unknown.d.ts +2 -2
- package/schema/schemas/unknown.js +2 -2
- package/schema/schemas/unknown.js.map +1 -1
- package/schema/transformers/generic.d.ts +9 -9
- package/schema/transformers/generic.js.map +1 -1
- package/schema/transformers/lowercase.d.ts +2 -2
- package/schema/transformers/lowercase.js +1 -1
- package/schema/transformers/lowercase.js.map +1 -1
- package/schema/transformers/trim.d.ts +2 -2
- package/schema/transformers/trim.js +1 -1
- package/schema/transformers/trim.js.map +1 -1
- package/schema/transformers/uppercase.d.ts +2 -2
- package/schema/transformers/uppercase.js +1 -1
- package/schema/transformers/uppercase.js.map +1 -1
- package/schema/types.d.ts +71 -52
- package/schema/types.js +60 -12
- package/schema/types.js.map +1 -1
- package/schema/utils/schema.d.ts +13 -9
- package/schema/utils/schema.js +82 -44
- package/schema/utils/schema.js.map +1 -1
- package/schema/utils/value-type.d.ts +4 -3
- package/schema/utils/value-type.js +18 -14
- package/schema/utils/value-type.js.map +1 -1
- package/templates/providers/file-template.provider.js.map +1 -1
- package/templates/template.service.js +2 -2
- package/templates/template.service.js.map +1 -1
- package/types.d.ts +35 -1
- package/utils/array/array.d.ts +1 -2
- package/utils/array/array.js.map +1 -1
- 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 +10 -9
- package/utils/compression.js.map +1 -1
- package/utils/encoding.js +1 -1
- package/utils/encoding.js.map +1 -1
- package/utils/helpers.d.ts +0 -2
- package/utils/helpers.js +1 -12
- package/utils/helpers.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/throw.d.ts +2 -0
- package/utils/throw.js +15 -0
- package/utils/throw.js.map +1 -0
- package/utils/type-guards.d.ts +9 -1
- package/utils/type-guards.js +25 -5
- package/utils/type-guards.js.map +1 -1
- package/web-types.d.ts +28 -0
- package/web-types.js +3 -0
- package/web-types.js.map +1 -0
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { OneOrMany } from "../../types";
|
|
2
|
+
import type { Schema } from '../schema';
|
|
3
|
+
import type { ValueSchema } from '../types';
|
|
4
|
+
export declare function defaulted<T, O, Default>(type: OneOrMany<Schema<T, O>>, defaultValue: Default): ValueSchema<T, O | Default>;
|
|
@@ -5,8 +5,7 @@ exports.defaulted = void 0;
|
|
|
5
5
|
const coercers_1 = require("../coercers");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function defaulted(type, defaultValue) {
|
|
8
|
-
return (0, types_1.valueSchema)({
|
|
9
|
-
type,
|
|
8
|
+
return (0, types_1.valueSchema)(type, {
|
|
10
9
|
coercers: new coercers_1.DefaultValueCoercer(defaultValue)
|
|
11
10
|
});
|
|
12
11
|
}
|
|
@@ -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;;;AAGzD,0CAAkD;AAGlD,oCAAuC;AAEvC,SAAgB,SAAS,CAAgB,IAA6B,EAAE,YAAqB;IAC3F,OAAO,IAAA,mBAAW,EAAC,IAAI,EAAE;QACvB,QAAQ,EAAE,IAAI,8BAAmB,CAAC,YAAY,CAAC;KAChD,CAAC,CAAC;AACL,CAAC;AAJD,8BAIC"}
|
|
@@ -7,15 +7,14 @@ const decorators_1 = require("../decorators");
|
|
|
7
7
|
const types_1 = require("../types");
|
|
8
8
|
function enumeration(enumerationValue, options = {}) {
|
|
9
9
|
const enumerationConstraint = new constraints_1.EnumerationConstraint(enumerationValue);
|
|
10
|
-
return (0, types_1.valueSchema)({
|
|
11
|
-
type: enumerationConstraint.suitableTypes,
|
|
10
|
+
return (0, types_1.valueSchema)((0, types_1.valueTypesOrSchemasToSchemas)(enumerationConstraint.suitableTypes), {
|
|
12
11
|
coerce: options.coerce,
|
|
13
12
|
valueConstraints: enumerationConstraint
|
|
14
13
|
});
|
|
15
14
|
}
|
|
16
15
|
exports.enumeration = enumeration;
|
|
17
16
|
function Enumeration(enumerationValue, options = {}) {
|
|
18
|
-
return (0, decorators_1.
|
|
17
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(enumeration(enumerationValue, options));
|
|
19
18
|
}
|
|
20
19
|
exports.Enumeration = Enumeration;
|
|
21
20
|
//# sourceMappingURL=enumeration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumeration.js","sourceRoot":"","sources":["../../../source/schema/schemas/enumeration.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,gDAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"enumeration.js","sourceRoot":"","sources":["../../../source/schema/schemas/enumeration.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,gDAAuD;AACvD,8CAAwE;AAExE,oCAAqE;AAIrE,SAAgB,WAAW,CAA4B,gBAAmB,EAAE,UAA8B,EAAE;IAC1G,MAAM,qBAAqB,GAAG,IAAI,mCAAqB,CAAC,gBAAgB,CAAC,CAAC;IAE1E,OAAO,IAAA,mBAAW,EAAC,IAAA,oCAA4B,EAAC,qBAAqB,CAAC,aAAa,CAAC,EAAE;QACpF,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,gBAAgB,EAAE,qBAAqB;KACxC,CAAC,CAAC;AACL,CAAC;AAPD,kCAOC;AAED,SAAgB,WAAW,CAAC,gBAAiC,EAAE,UAA8B,EAAE;IAC7F,OAAO,IAAA,oDAAuC,EAAC,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;AACzF,CAAC;AAFD,kCAEC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { OneOrMany, Record } from "../../types";
|
|
2
2
|
import type { Simplify } from 'type-fest';
|
|
3
3
|
import type { ObjectSchema } from '../types';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated use {@link omit}
|
|
6
|
+
*/
|
|
7
|
+
export declare function exclude<T extends Record, K extends keyof T>(schema: ObjectSchema<T>, keys: OneOrMany<K>): ObjectSchema<Simplify<Omit<T, K>>>;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exclude = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const pickedSchema = (0, types_1.objectSchema)({
|
|
11
|
-
...schema,
|
|
12
|
-
properties: Object.fromEntries(pickedEntries)
|
|
13
|
-
});
|
|
14
|
-
return pickedSchema;
|
|
4
|
+
const omit_1 = require("./omit");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use {@link omit}
|
|
7
|
+
*/
|
|
8
|
+
function exclude(schema, keys) {
|
|
9
|
+
return (0, omit_1.omit)(schema, keys);
|
|
15
10
|
}
|
|
16
11
|
exports.exclude = exclude;
|
|
17
12
|
//# sourceMappingURL=exclude.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../../source/schema/schemas/exclude.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../../source/schema/schemas/exclude.ts"],"names":[],"mappings":";;;AAGA,iCAA8B;AAE9B;;GAEG;AACH,SAAgB,OAAO,CAAsC,MAAuB,EAAE,IAAkB;IACtG,OAAO,IAAA,WAAI,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AAFD,0BAEC"}
|
|
@@ -4,6 +4,7 @@ export * from './assign';
|
|
|
4
4
|
export * from './boolean';
|
|
5
5
|
export * from './constraint';
|
|
6
6
|
export * from './date';
|
|
7
|
+
export * from './defaulted';
|
|
7
8
|
export * from './enumeration';
|
|
8
9
|
export * from './exclude';
|
|
9
10
|
export * from './instance';
|
|
@@ -11,6 +12,7 @@ export * from './literal';
|
|
|
11
12
|
export * from './nullable';
|
|
12
13
|
export * from './number';
|
|
13
14
|
export * from './object';
|
|
15
|
+
export * from './omit';
|
|
14
16
|
export * from './optional';
|
|
15
17
|
export * from './pick';
|
|
16
18
|
export * from './readable-stream';
|
package/schema/schemas/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./assign"), exports);
|
|
|
20
20
|
__exportStar(require("./boolean"), exports);
|
|
21
21
|
__exportStar(require("./constraint"), exports);
|
|
22
22
|
__exportStar(require("./date"), exports);
|
|
23
|
+
__exportStar(require("./defaulted"), exports);
|
|
23
24
|
__exportStar(require("./enumeration"), exports);
|
|
24
25
|
__exportStar(require("./exclude"), exports);
|
|
25
26
|
__exportStar(require("./instance"), exports);
|
|
@@ -27,6 +28,7 @@ __exportStar(require("./literal"), exports);
|
|
|
27
28
|
__exportStar(require("./nullable"), exports);
|
|
28
29
|
__exportStar(require("./number"), exports);
|
|
29
30
|
__exportStar(require("./object"), exports);
|
|
31
|
+
__exportStar(require("./omit"), exports);
|
|
30
32
|
__exportStar(require("./optional"), exports);
|
|
31
33
|
__exportStar(require("./pick"), exports);
|
|
32
34
|
__exportStar(require("./readable-stream"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/schema/schemas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,yCAAuB;AACvB,gDAA8B;AAC9B,4CAA0B;AAC1B,6CAA2B;AAC3B,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,2CAAyB;AACzB,6CAA2B;AAC3B,yCAAuB;AACvB,oDAAkC;AAClC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,8CAA4B;AAC5B,gDAA8B;AAC9B,0CAAwB;AACxB,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/schema/schemas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,yCAAuB;AACvB,8CAA4B;AAC5B,gDAA8B;AAC9B,4CAA0B;AAC1B,6CAA2B;AAC3B,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,2CAAyB;AACzB,yCAAuB;AACvB,6CAA2B;AAC3B,yCAAuB;AACvB,oDAAkC;AAClC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,8CAA4B;AAC5B,gDAA8B;AAC9B,0CAAwB;AACxB,4CAA0B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function instance<T>(type:
|
|
1
|
+
import type { NormalizeValueType, TypeSchema, ValueType } from '../types';
|
|
2
|
+
export declare function instance<T>(type: ValueType<T>): TypeSchema<NormalizeValueType<T>>;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.instance = void 0;
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
function instance(type) {
|
|
7
|
-
return (0, types_1.
|
|
7
|
+
return (0, types_1.typeSchema)(type);
|
|
8
8
|
}
|
|
9
9
|
exports.instance = instance;
|
|
10
10
|
//# sourceMappingURL=instance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../../source/schema/schemas/instance.ts"],"names":[],"mappings":";AAAA,iDAAiD;;;AAGjD,
|
|
1
|
+
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../../source/schema/schemas/instance.ts"],"names":[],"mappings":";AAAA,iDAAiD;;;AAGjD,oCAAsC;AAEtC,SAAgB,QAAQ,CAAI,IAAkB;IAC5C,OAAO,IAAA,kBAAU,EAAI,IAAI,CAAC,CAAC;AAC7B,CAAC;AAFD,4BAEC"}
|
|
@@ -7,14 +7,13 @@ const decorators_1 = require("../decorators");
|
|
|
7
7
|
const types_1 = require("../types");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
function literal(value) {
|
|
10
|
-
return (0, types_1.valueSchema)({
|
|
11
|
-
type: (0, utils_1.getValueType)(value),
|
|
10
|
+
return (0, types_1.valueSchema)((0, types_1.typeSchema)((0, utils_1.getValueType)(value)), {
|
|
12
11
|
valueConstraints: new constraints_1.LiteralConstraint(value)
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
14
|
exports.literal = literal;
|
|
16
15
|
function Literal(value) {
|
|
17
|
-
return (0, decorators_1.
|
|
16
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(literal(value));
|
|
18
17
|
}
|
|
19
18
|
exports.Literal = Literal;
|
|
20
19
|
//# sourceMappingURL=literal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal.js","sourceRoot":"","sources":["../../../source/schema/schemas/literal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,gDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"literal.js","sourceRoot":"","sources":["../../../source/schema/schemas/literal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,gDAAmD;AACnD,8CAAwE;AAExE,oCAAmD;AACnD,oCAAwC;AAExC,SAAgB,OAAO,CAAI,KAAQ;IACjC,OAAO,IAAA,mBAAW,EAAM,IAAA,kBAAU,EAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC,EAAE;QACvD,gBAAgB,EAAE,IAAI,+BAAiB,CAAC,KAAK,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC;AAJD,0BAIC;AAED,SAAgB,OAAO,CAAC,KAAU;IAChC,OAAO,IAAA,oDAAuC,EAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AACjE,CAAC;AAFD,0BAEC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.nullable = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
function nullable(schema) {
|
|
6
|
-
return (0, types_1.valueSchema)(
|
|
6
|
+
return (0, types_1.valueSchema)(schema, { nullable: true });
|
|
7
7
|
}
|
|
8
8
|
exports.nullable = nullable;
|
|
9
9
|
//# sourceMappingURL=nullable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../source/schema/schemas/nullable.ts"],"names":[],"mappings":";;;AAEA,oCAAuC;AAEvC,SAAgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../source/schema/schemas/nullable.ts"],"names":[],"mappings":";;;AAEA,oCAAuC;AAEvC,SAAgB,QAAQ,CAAO,MAAoB;IACjD,OAAO,IAAA,mBAAW,EAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAoC,CAAC;AACpF,CAAC;AAFD,4BAEC"}
|
package/schema/schemas/number.js
CHANGED
|
@@ -19,15 +19,17 @@ function number(options = {}) {
|
|
|
19
19
|
if (options.integer == true) {
|
|
20
20
|
constraints.push(integer_1.integerConstraint);
|
|
21
21
|
}
|
|
22
|
-
return (0, types_1.valueSchema)({
|
|
23
|
-
|
|
22
|
+
return (0, types_1.valueSchema)((0, types_1.typeSchema)(globalThis.Number), {
|
|
23
|
+
array: false,
|
|
24
|
+
optional: false,
|
|
25
|
+
nullable: false,
|
|
24
26
|
coerce: options.coerce,
|
|
25
27
|
valueConstraints: constraints
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
exports.number = number;
|
|
29
31
|
function Number(options) {
|
|
30
|
-
return (0, decorators_1.
|
|
32
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(number(options));
|
|
31
33
|
}
|
|
32
34
|
exports.Number = Number;
|
|
33
35
|
//# sourceMappingURL=number.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../source/schema/schemas/number.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,oDAA2D;AAC3D,oDAA2D;AAC3D,oDAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../source/schema/schemas/number.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,oDAA2D;AAC3D,oDAA2D;AAC3D,oDAA2D;AAC3D,8CAAwE;AACxE,oCAAkG;AAQlG,SAAgB,MAAM,CAAC,UAAyB,EAAE;IAChD,MAAM,WAAW,GAA4B,EAAE,CAAC;IAEhD,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,2BAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC1D;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,2BAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC1D;IAED,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE;QAC3B,WAAW,CAAC,IAAI,CAAC,2BAAiB,CAAC,CAAC;KACrC;IAED,OAAO,IAAA,mBAAW,EAAC,IAAA,kBAAU,EAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAChD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,gBAAgB,EAAE,WAAW;KAC9B,CAAC,CAAC;AACL,CAAC;AAtBD,wBAsBC;AAED,SAAgB,MAAM,CAAC,OAAuB;IAC5C,OAAO,IAAA,oDAAuC,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wBAEC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Record, TypedOmit } from "../../types";
|
|
2
|
-
import type { PartialOnUndefinedDeep } from 'type-fest';
|
|
1
|
+
import type { Record, SimplifiedOptionalize, TypedOmit } from "../../types";
|
|
3
2
|
import type { ObjectSchema, ObjectSchemaProperties } from '../types';
|
|
4
3
|
export declare type ObjectOptions<T extends Record = Record> = TypedOmit<ObjectSchema<T>, 'properties'>;
|
|
5
4
|
export declare function explicitObject<T extends Record>(properties: ObjectSchemaProperties<T>, options?: ObjectOptions<T>): ObjectSchema<T>;
|
|
6
|
-
export declare function object<T extends Record>(properties: ObjectSchemaProperties<T>, options?: ObjectOptions<T>): ObjectSchema<
|
|
5
|
+
export declare function object<T extends Record>(properties: ObjectSchemaProperties<T>, options?: ObjectOptions<T>): ObjectSchema<SimplifiedOptionalize<T>, SimplifiedOptionalize<T>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../source/schema/schemas/object.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../source/schema/schemas/object.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,oCAAwC;AAIxC,SAAgB,cAAc,CAAmB,UAAqC,EAAE,OAA0B;IAChH,OAAO,MAAM,CAAC,UAAU,EAAE,OAAO,CAA2B,CAAC;AAC/D,CAAC;AAFD,wCAEC;AAED,SAAgB,MAAM,CAAmB,UAAqC,EAAE,OAA0B;IACxG,OAAO,IAAA,oBAAY,EAAC;QAClB,UAAU;QACV,GAAG,OAAO;KACX,CAAgF,CAAC;AACpF,CAAC;AALD,wBAKC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OneOrMany, Record } from "../../types";
|
|
2
|
+
import type { Simplify } from 'type-fest';
|
|
3
|
+
import type { ObjectSchema } from '../types';
|
|
4
|
+
export declare function omit<T extends Record, K extends keyof T>(schema: ObjectSchema<T>, keys: OneOrMany<K>): ObjectSchema<Simplify<Omit<T, K>>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.omit = void 0;
|
|
4
|
+
const array_1 = require("../../utils/array/array");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
function omit(schema, keys) {
|
|
7
|
+
const keyArray = (0, array_1.toArray)(keys);
|
|
8
|
+
const entries = Object.entries(schema.properties);
|
|
9
|
+
const pickedEntries = entries.filter(([propertyKey]) => !keyArray.includes(propertyKey));
|
|
10
|
+
const pickedSchema = (0, types_1.objectSchema)({
|
|
11
|
+
...schema,
|
|
12
|
+
properties: Object.fromEntries(pickedEntries)
|
|
13
|
+
});
|
|
14
|
+
return pickedSchema;
|
|
15
|
+
}
|
|
16
|
+
exports.omit = omit;
|
|
17
|
+
//# sourceMappingURL=omit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../../source/schema/schemas/omit.ts"],"names":[],"mappings":";;;AACA,mDAA8C;AAG9C,oCAAwC;AAExC,SAAgB,IAAI,CAAsC,MAAuB,EAAE,IAAkB;IACnG,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,IAAI,CAAC,CAAC;IAE/B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAgB,CAAC,CAAC,CAAC;IAE9F,MAAM,YAAY,GAAG,IAAA,oBAAY,EAAC;QAChC,GAAG,MAAM;QACT,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,CAA8B;KAC3E,CAAC,CAAC;IAEH,OAAO,YAAmD,CAAC;AAC7D,CAAC;AAZD,oBAYC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Schema } from '../schema';
|
|
2
2
|
import type { ValueSchema } from '../types';
|
|
3
|
-
export declare function optional<T>(schema: Schema<T>): ValueSchema<T | undefined>;
|
|
3
|
+
export declare function optional<T, O>(schema: Schema<T, O>): ValueSchema<T | undefined, O | undefined>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.optional = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
function optional(schema) {
|
|
6
|
-
return (0, types_1.valueSchema)(
|
|
6
|
+
return (0, types_1.valueSchema)(schema, { optional: true });
|
|
7
7
|
}
|
|
8
8
|
exports.optional = optional;
|
|
9
9
|
//# sourceMappingURL=optional.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../source/schema/schemas/optional.ts"],"names":[],"mappings":";;;AAEA,oCAAuC;AAEvC,SAAgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../source/schema/schemas/optional.ts"],"names":[],"mappings":";;;AAEA,oCAAuC;AAEvC,SAAgB,QAAQ,CAAO,MAAoB;IACjD,OAAO,IAAA,mBAAW,EAAC,MAA8C,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACzF,CAAC;AAFD,4BAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick.js","sourceRoot":"","sources":["../../../source/schema/schemas/pick.ts"],"names":[],"mappings":";;;AACA,mDAA8C;AAG9C,oCAAwC;AAExC,SAAgB,IAAI,CAAsC,MAAuB,EAAE,GAAiB;IAClG,MAAM,IAAI,GAAG,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC;IAE1B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAgB,CAAC,CAAC,CAAC;IAEzF,MAAM,YAAY,GAAG,IAAA,oBAAY,EAAC;QAChC,GAAG,MAAM;QACT,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"pick.js","sourceRoot":"","sources":["../../../source/schema/schemas/pick.ts"],"names":[],"mappings":";;;AACA,mDAA8C;AAG9C,oCAAwC;AAExC,SAAgB,IAAI,CAAsC,MAAuB,EAAE,GAAiB;IAClG,MAAM,IAAI,GAAG,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC;IAE1B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAgB,CAAC,CAAC,CAAC;IAEzF,MAAM,YAAY,GAAG,IAAA,oBAAY,EAAC;QAChC,GAAG,MAAM;QACT,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,CAA8B;KAC3E,CAAC,CAAC;IAEH,OAAO,YAAmD,CAAC;AAC7D,CAAC;AAZD,oBAYC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type {
|
|
3
|
-
export declare function readableStream():
|
|
2
|
+
import type { TypeSchema } from '../types';
|
|
3
|
+
export declare function readableStream(): TypeSchema<globalThis.ReadableStream>;
|
|
4
4
|
export declare function ReadableStream(): Decorator<'property' | 'accessor'>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.ReadableStream = exports.readableStream = void 0;
|
|
4
5
|
const decorators_1 = require("../decorators");
|
|
5
6
|
const types_1 = require("../types");
|
|
6
7
|
function readableStream() {
|
|
7
|
-
return (0, types_1.
|
|
8
|
-
type: globalThis.ReadableStream
|
|
9
|
-
});
|
|
8
|
+
return (0, types_1.typeSchema)(globalThis.ReadableStream);
|
|
10
9
|
}
|
|
11
10
|
exports.readableStream = readableStream;
|
|
12
11
|
function ReadableStream() {
|
|
13
|
-
return (0, decorators_1.
|
|
12
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(readableStream());
|
|
14
13
|
}
|
|
15
14
|
exports.ReadableStream = ReadableStream;
|
|
16
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":";;;
|
|
1
|
+
{"version":3,"file":"readable-stream.js","sourceRoot":"","sources":["../../../source/schema/schemas/readable-stream.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAExE,oCAAsC;AAEtC,SAAgB,cAAc;IAC5B,OAAO,IAAA,kBAAU,EAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AAC/C,CAAC;AAFD,wCAEC;AAED,SAAgB,cAAc;IAC5B,OAAO,IAAA,oDAAuC,EAAC,cAAc,EAAE,CAAC,CAAC;AACnE,CAAC;AAFD,wCAEC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Record, TypedOmit } from "../../types";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare
|
|
1
|
+
import type { OneOrMany, Record, TypedOmit } from "../../types";
|
|
2
|
+
import type { Schema } from '../schema';
|
|
3
|
+
import type { ObjectSchema } from '../types';
|
|
4
|
+
export declare type RecordOptions<T extends Record = Record> = TypedOmit<ObjectSchema<T>, 'properties' | 'allowUnknownProperties' | 'mask'>;
|
|
5
|
+
export declare function record<T, O>(valueType: OneOrMany<Schema<T, O>>, options?: RecordOptions): ObjectSchema<Record<any, O>>;
|
package/schema/schemas/record.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.record = void 0;
|
|
5
5
|
const types_1 = require("../types");
|
|
6
|
-
function record(
|
|
6
|
+
function record(valueType, options) {
|
|
7
7
|
return (0, types_1.objectSchema)({
|
|
8
8
|
properties: {},
|
|
9
|
-
allowUnknownProperties:
|
|
9
|
+
allowUnknownProperties: valueType,
|
|
10
10
|
...options
|
|
11
11
|
});
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../../source/schema/schemas/record.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../../source/schema/schemas/record.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAKzD,oCAAwC;AAIxC,SAAgB,MAAM,CAAO,SAAkC,EAAE,OAAuB;IACtF,OAAO,IAAA,oBAAY,EAAC;QAClB,UAAU,EAAE,EAAE;QACd,sBAAsB,EAAE,SAAS;QACjC,GAAG,OAAO;KACX,CAAiB,CAAC;AACrB,CAAC;AAND,wBAMC"}
|
package/schema/schemas/regexp.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.RegExp = exports.regexp = void 0;
|
|
4
5
|
const decorators_1 = require("../decorators");
|
|
5
6
|
const types_1 = require("../types");
|
|
6
7
|
function regexp(options = {}) {
|
|
7
|
-
return (0, types_1.valueSchema)({
|
|
8
|
-
type: globalThis.RegExp,
|
|
8
|
+
return (0, types_1.valueSchema)((0, types_1.typeSchema)(globalThis.RegExp), {
|
|
9
9
|
coerce: options.coerce
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
exports.regexp = regexp;
|
|
13
13
|
function RegExp(options) {
|
|
14
|
-
return (0, decorators_1.
|
|
14
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(regexp(options));
|
|
15
15
|
}
|
|
16
16
|
exports.RegExp = RegExp;
|
|
17
17
|
//# sourceMappingURL=regexp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regexp.js","sourceRoot":"","sources":["../../../source/schema/schemas/regexp.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"regexp.js","sourceRoot":"","sources":["../../../source/schema/schemas/regexp.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAGxE,oCAAmD;AAInD,SAAgB,MAAM,CAAC,UAA+B,EAAE;IACtD,OAAO,IAAA,mBAAW,EAAC,IAAA,kBAAU,EAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAChD,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;AACL,CAAC;AAJD,wBAIC;AAED,SAAgB,MAAM,CAAC,OAA6B;IAClD,OAAO,IAAA,oDAAuC,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wBAEC"}
|
package/schema/schemas/string.js
CHANGED
|
@@ -29,8 +29,7 @@ function string(options = {}) {
|
|
|
29
29
|
if ((0, type_guards_1.isDefined)(options.uppercase)) {
|
|
30
30
|
transformers.push(new transformers_1.UppercaseTransformer());
|
|
31
31
|
}
|
|
32
|
-
return (0, types_1.valueSchema)({
|
|
33
|
-
type: globalThis.String,
|
|
32
|
+
return (0, types_1.valueSchema)((0, types_1.typeSchema)(globalThis.String), {
|
|
34
33
|
coerce: options.coerce,
|
|
35
34
|
valueConstraints: constraints,
|
|
36
35
|
transformers
|
|
@@ -38,7 +37,7 @@ function string(options = {}) {
|
|
|
38
37
|
}
|
|
39
38
|
exports.string = string;
|
|
40
39
|
function String(options) {
|
|
41
|
-
return (0, decorators_1.
|
|
40
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(string(options));
|
|
42
41
|
}
|
|
43
42
|
exports.String = String;
|
|
44
43
|
//# sourceMappingURL=string.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../source/schema/schemas/string.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,gDAAqG;AACrG,
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../source/schema/schemas/string.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,gDAAqG;AACrG,8CAAwE;AACxE,kDAA8F;AAE9F,oCAAmD;AA4BnD,SAAgB,MAAM,CAAC,UAAyB,EAAE;IAChD,MAAM,WAAW,GAA4B,EAAE,CAAC;IAChD,MAAM,YAAY,GAA6B,EAAE,CAAC;IAElD,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,WAAW,CAAC,IAAI,CAAC,IAAI,qCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KACtE;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,WAAW,CAAC,IAAI,CAAC,IAAI,qCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KACtE;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,WAAW,CAAC,IAAI,CAAC,IAAI,+BAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;KACvE;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,EAAC,IAAA,kBAAU,EAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAChD,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,gBAAgB,EAAE,WAAW;QAC7B,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAlCD,wBAkCC;AAED,SAAgB,MAAM,CAAC,OAAuB;IAC5C,OAAO,IAAA,oDAAuC,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wBAEC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { OneOrMany } from "../../types";
|
|
1
|
+
import type { AbstractConstructor, OneOrMany } from "../../types";
|
|
2
|
+
import type { Schema } from '../schema';
|
|
2
3
|
import type { GenericTransformFunction } from '../transformers/generic';
|
|
3
|
-
import type {
|
|
4
|
-
export declare function transform<T>(schema:
|
|
4
|
+
import type { ValueSchema, ValueType } from '../types';
|
|
5
|
+
export declare function transform<T, O, TransformOutput>(schema: OneOrMany<Schema<T, O>>, sourceType: OneOrMany<ValueType<T>>, targetType: AbstractConstructor<TransformOutput>, transformFunction: GenericTransformFunction<O, TransformOutput>): ValueSchema<TransformOutput>;
|
|
@@ -4,11 +4,9 @@ exports.transform = void 0;
|
|
|
4
4
|
const generic_1 = require("../transformers/generic");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
function transform(schema, sourceType, targetType, transformFunction) {
|
|
7
|
-
return (0, types_1.valueSchema)({
|
|
8
|
-
type: schema,
|
|
7
|
+
return (0, types_1.valueSchema)(schema, {
|
|
9
8
|
transformers: new generic_1.GenericTransformer(sourceType, targetType, transformFunction)
|
|
10
9
|
});
|
|
11
10
|
}
|
|
12
11
|
exports.transform = transform;
|
|
13
|
-
/* decorator is in file of GenericTransformer */
|
|
14
12
|
//# sourceMappingURL=transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../source/schema/schemas/transform.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../source/schema/schemas/transform.ts"],"names":[],"mappings":";;;AAGA,qDAA6D;AAE7D,oCAAuC;AAEvC,SAAgB,SAAS,CAAwB,MAA+B,EAAE,UAAmC,EAAE,UAAgD,EAAE,iBAA+D;IACtO,OAAO,IAAA,mBAAW,EAAC,MAAM,EAAE;QACzB,YAAY,EAAE,IAAI,4BAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB,CAAC;KAChF,CAAqB,CAAC;AACzB,CAAC;AAJD,8BAIC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type {
|
|
3
|
-
import type { Coercible } from '../types';
|
|
2
|
+
import type { Coercible, ValueSchema } from '../types';
|
|
4
3
|
export declare type Uint8ArraySchemaOptions = Coercible & {
|
|
5
4
|
minimumLength?: number;
|
|
6
5
|
maximumLength?: number;
|
|
7
6
|
};
|
|
8
|
-
export declare function uint8Array(options?: Uint8ArraySchemaOptions):
|
|
7
|
+
export declare function uint8Array(options?: Uint8ArraySchemaOptions): ValueSchema<globalThis.Uint8Array>;
|
|
9
8
|
export declare function Uint8Array(options?: Uint8ArraySchemaOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.Uint8Array = exports.uint8Array = void 0;
|
|
4
5
|
const type_guards_1 = require("../../utils/type-guards");
|
|
5
6
|
const uint8_array_coercer_1 = require("../coercers/uint8-array.coercer");
|
|
6
7
|
const maximum_length_1 = require("../constraints/maximum-length");
|
|
7
8
|
const minimum_length_1 = require("../constraints/minimum-length");
|
|
8
|
-
const
|
|
9
|
+
const utils_1 = require("../decorators/utils");
|
|
9
10
|
const types_1 = require("../types");
|
|
10
11
|
function uint8Array(options = {}) {
|
|
11
12
|
const constraints = [];
|
|
@@ -15,15 +16,14 @@ function uint8Array(options = {}) {
|
|
|
15
16
|
if ((0, type_guards_1.isDefined)(options.maximumLength)) {
|
|
16
17
|
constraints.push(new maximum_length_1.MaximumLengthConstraint(options.maximumLength));
|
|
17
18
|
}
|
|
18
|
-
return (0, types_1.valueSchema)({
|
|
19
|
-
type: globalThis.Uint8Array,
|
|
19
|
+
return (0, types_1.valueSchema)((0, types_1.typeSchema)(globalThis.Uint8Array), {
|
|
20
20
|
coercers: (options.coerce == true) ? uint8_array_coercer_1.uint8ArrayCoercer : undefined,
|
|
21
21
|
valueConstraints: constraints
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
exports.uint8Array = uint8Array;
|
|
25
25
|
function Uint8Array(options) {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, utils_1.createSchemaPropertyDecoratorFromSchema)(uint8Array(options));
|
|
27
27
|
}
|
|
28
28
|
exports.Uint8Array = Uint8Array;
|
|
29
29
|
//# sourceMappingURL=uint8-array.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8-array.js","sourceRoot":"","sources":["../../../source/schema/schemas/uint8-array.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"uint8-array.js","sourceRoot":"","sources":["../../../source/schema/schemas/uint8-array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,yEAAoE;AACpE,kEAAwE;AACxE,kEAAwE;AACxE,+CAA8E;AAE9E,oCAAmD;AAOnD,SAAgB,UAAU,CAAC,UAAmC,EAAE;IAC9D,MAAM,WAAW,GAA4B,EAAE,CAAC;IAEhD,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,WAAW,CAAC,IAAI,CAAC,IAAI,wCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KACtE;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,WAAW,CAAC,IAAI,CAAC,IAAI,wCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KACtE;IAED,OAAO,IAAA,mBAAW,EAAC,IAAA,kBAAU,EAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QACpD,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,uCAAiB,CAAC,CAAC,CAAC,SAAS;QAClE,gBAAgB,EAAE,WAAW;KAC9B,CAAC,CAAC;AACL,CAAC;AAfD,gCAeC;AAED,SAAgB,UAAU,CAAC,OAAiC;IAC1D,OAAO,IAAA,+CAAuC,EAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC;AAFD,gCAEC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare function union<
|
|
5
|
-
export declare function
|
|
2
|
+
import type { Schema } from '../schema';
|
|
3
|
+
import type { ValueSchema } from '../types';
|
|
4
|
+
export declare function union<T1, O1, T2, O2>(schema1: Schema<T1, O1>, schema2: Schema<T2, O2>): ValueSchema<T1 | T2, O1 | O2>;
|
|
5
|
+
export declare function union<T1, O1, T2, O2, T3, O3>(schema1: Schema<T1, O1>, schema2: Schema<T2, O2>, schema3: Schema<T3, O3>): ValueSchema<T1 | T2 | T3, O1 | O2 | O3>;
|
|
6
|
+
export declare function union<T1, O1, T2, O2, T3, O3, T4, O4>(schema1: Schema<T1, O1>, schema2: Schema<T2, O2>, schema3: Schema<T3, O3>, schema4: Schema<T4, O4>): ValueSchema<T1 | T2 | T3 | T4, O1 | O2 | O3 | O4>;
|
|
7
|
+
export declare function union<T1, O1, T2, O2, T3, O3, T4, O4, T5, O5>(schema1: Schema<T1, O1>, schema2: Schema<T2, O2>, schema3: Schema<T3, O3>, schema4: Schema<T4, O4>, schema5: Schema<T5, O5>): ValueSchema<T1 | T2 | T3 | T4 | T5, O1 | O2 | O3 | O4 | O5>;
|
|
8
|
+
export declare function union<T1, O1, T2, O2, T3, O3, T4, O4, T5, O5, T6, O6>(schema1: Schema<T1, O1>, schema2: Schema<T2, O2>, schema3: Schema<T3, O3>, schema4: Schema<T4, O4>, schema5: Schema<T5, O5>, schema6: Schema<T6>): ValueSchema<T1 | T2 | T3 | T4 | T5 | T6, O1 | O2 | O3 | O4 | O5 | O6>;
|
|
9
|
+
export declare function union(...schemas: Schema[]): ValueSchema;
|
|
10
|
+
export declare function Union(...schemas: Schema[]): Decorator<'property' | 'accessor'>;
|
package/schema/schemas/union.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.Union = exports.union = void 0;
|
|
5
|
+
const type_guards_1 = require("../../utils/type-guards");
|
|
4
6
|
const decorators_1 = require("../decorators");
|
|
5
7
|
const types_1 = require("../types");
|
|
6
8
|
function union(...schemas) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
9
|
+
(0, type_guards_1.assert)(schemas.length >= 2, 'Assign requires at least 2 schemas.');
|
|
10
|
+
return (0, types_1.valueSchema)(schemas);
|
|
10
11
|
}
|
|
11
12
|
exports.union = union;
|
|
12
13
|
function Union(...schemas) {
|
|
13
|
-
return (0, decorators_1.
|
|
14
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(union(...schemas));
|
|
14
15
|
}
|
|
15
16
|
exports.Union = Union;
|
|
16
17
|
//# sourceMappingURL=union.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../source/schema/schemas/union.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../source/schema/schemas/union.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAA6C;AAC7C,8CAAwE;AAGxE,oCAAuC;AAQvC,SAAgB,KAAK,CAAC,GAAG,OAAiB;IACxC,IAAA,oBAAM,EAAC,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,qCAAqC,CAAC,CAAC;IACnE,OAAO,IAAA,mBAAW,EAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAHD,sBAGC;AAED,SAAgB,KAAK,CAAC,GAAG,OAAiB;IACxC,OAAO,IAAA,oDAAuC,EAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;AACpE,CAAC;AAFD,sBAEC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type {
|
|
3
|
-
export declare function unknown():
|
|
2
|
+
import type { TypeSchema } from '../types';
|
|
3
|
+
export declare function unknown(): TypeSchema<unknown>;
|
|
4
4
|
export declare function Unknwon(): Decorator<'property' | 'accessor'>;
|
|
@@ -5,11 +5,11 @@ exports.Unknwon = exports.unknown = void 0;
|
|
|
5
5
|
const decorators_1 = require("../decorators");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function unknown() {
|
|
8
|
-
return (0, types_1.
|
|
8
|
+
return (0, types_1.typeSchema)('any');
|
|
9
9
|
}
|
|
10
10
|
exports.unknown = unknown;
|
|
11
11
|
function Unknwon() {
|
|
12
|
-
return (0, decorators_1.
|
|
12
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(unknown());
|
|
13
13
|
}
|
|
14
14
|
exports.Unknwon = Unknwon;
|
|
15
15
|
//# sourceMappingURL=unknown.js.map
|