@tstdl/base 0.78.0-beta3 → 0.78.0-beta32
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 +22 -9
- 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/application/application.js.map +1 -1
- package/container/container.js.map +1 -1
- package/container/decorators.d.ts +1 -1
- package/container/decorators.js.map +1 -1
- package/css/theme/theme.service.js.map +1 -1
- package/data-structures/iterable-weak-map.js +1 -1
- package/data-structures/iterable-weak-map.js.map +1 -1
- package/data-structures/linked-list.js.map +1 -1
- package/data-structures/sorted-array-list.js.map +1 -1
- package/database/mongo/classes.js.map +1 -1
- package/database/mongo/mongo-entity-repository.js +2 -2
- package/database/mongo/mongo-entity-repository.js.map +1 -1
- package/distributed-loop/distributed-loop.js.map +1 -1
- package/distributed-loop/provider.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 +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/examples/pdf/templates/hello-name.d.ts +1 -4
- package/examples/reflection/basic.js +1 -1
- package/examples/reflection/basic.js.map +1 -1
- package/http/client/adapters/got-http-client.adapter.js.map +1 -1
- package/http/client/adapters/undici-http-client.adapter.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-request.d.ts +13 -3
- package/http/client/http-client-request.js +4 -0
- package/http/client/http-client-request.js.map +1 -1
- package/http/client/http-client.js +29 -12
- package/http/client/http-client.js.map +1 -1
- package/http/http-headers.d.ts +2 -0
- package/http/http-headers.js +6 -0
- package/http/http-headers.js.map +1 -1
- package/http/server/node/node-http-server.js.map +1 -1
- package/image-service/image-service.js.map +1 -1
- package/image-service/imgproxy/imgproxy-image-service.js.map +1 -1
- package/key-value-store/mongo/mongo-key-value-store.provider.js.map +1 -1
- package/key-value-store/mongo/mongo-key-value.repository.js.map +1 -1
- package/key-value-store/mongo/mongo-key-value.store.js.map +1 -1
- package/lock/mongo/lock.js.map +1 -1
- package/lock/mongo/mongo-lock-repository.js.map +1 -1
- package/lock/mongo/provider.js.map +1 -1
- package/logger/console/logger.js.map +1 -1
- package/mail/clients/nodemailer.mail-client.js.map +1 -1
- package/mail/mail-template-renderer.provider.js.map +1 -1
- package/mail/mail.service.js.map +1 -1
- package/mail/repositories/mongo-mail-log.repository.js.map +1 -1
- package/mail/template-providers/file-mail-template.provider.js.map +1 -1
- package/mail/template-providers/memory-mail-template.provider.js.map +1 -1
- package/mail/template-renderers/handlebars.mail-template-renderer.js.map +1 -1
- package/mail/template-renderers/mjml.mail-template-renderer.js.map +1 -1
- package/message-bus/local/local-message-bus-provider.js.map +1 -1
- package/message-bus/local/local-message-bus.js.map +1 -1
- package/migration/migrator.js.map +1 -1
- package/migration/mongo/migration-state-repository.js.map +1 -1
- package/module/modules/web-server.module.js.map +1 -1
- package/object-storage/s3/s3.object-storage-provider.js.map +1 -1
- package/object-storage/s3/s3.object-storage.js.map +1 -1
- package/openid-connect/cached-oidc-configuration.service.js.map +1 -1
- package/openid-connect/mongo-oidc-state.repository.js.map +1 -1
- package/openid-connect/oidc-configuration.service.js.map +1 -1
- package/openid-connect/oidc.service-model.d.ts +10 -2
- package/openid-connect/oidc.service.d.ts +1 -1
- package/openid-connect/oidc.service.js +50 -14
- package/openid-connect/oidc.service.js.map +1 -1
- package/package.json +5 -6
- package/pdf/pdf.service.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/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.map +1 -1
- package/queue/mongo/queue.js.map +1 -1
- package/queue/mongo/queue.provider.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 +8 -8
- 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 -3
- 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 +2 -2
- package/schema/decorators/array.js +1 -1
- package/schema/decorators/array.js.map +1 -1
- package/schema/decorators/defaulted.d.ts +2 -2
- package/schema/decorators/defaulted.js +1 -1
- package/schema/decorators/defaulted.js.map +1 -1
- package/schema/decorators/property.d.ts +1 -1
- package/schema/decorators/property.js +3 -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 -10
- 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 +131 -164
- 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 +2 -1
- 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/boolean.js +2 -3
- package/schema/schemas/boolean.js.map +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 +3 -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 +3 -2
- 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 +2 -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.js +1 -1
- package/schema/schemas/optional.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 +3 -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 +3 -2
- package/schema/schemas/transform.js +1 -2
- 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 -8
- package/schema/schemas/union.js +2 -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 +4 -4
- package/schema/transformers/generic.js.map +1 -1
- package/schema/transformers/lowercase.js +1 -1
- package/schema/transformers/lowercase.js.map +1 -1
- package/schema/transformers/trim.js +1 -1
- package/schema/transformers/trim.js.map +1 -1
- package/schema/transformers/uppercase.js +1 -1
- package/schema/transformers/uppercase.js.map +1 -1
- package/schema/types.d.ts +53 -40
- package/schema/types.js +49 -34
- package/schema/types.js.map +1 -1
- package/schema/utils/schema.d.ts +13 -5
- package/schema/utils/schema.js +88 -28
- package/schema/utils/schema.js.map +1 -1
- package/schema/utils/value-type.d.ts +3 -1
- package/schema/utils/value-type.js +22 -2
- package/schema/utils/value-type.js.map +1 -1
- package/search-index/elastic/config.js.map +1 -1
- package/serializer/serializable.d.ts +4 -4
- package/serializer/serializable.js.map +1 -1
- package/templates/providers/file-template.provider.base.d.ts +1 -1
- package/templates/providers/file-template.provider.d.ts +2 -2
- package/templates/providers/file-template.provider.js.map +1 -1
- package/templates/providers/memory-template.provider.base.js.map +1 -1
- package/templates/providers/memory-template.provider.js.map +1 -1
- package/templates/renderers/handlebars.template-renderer.d.ts +7 -0
- package/templates/renderers/handlebars.template-renderer.js +23 -2
- package/templates/renderers/handlebars.template-renderer.js.map +1 -1
- package/templates/renderers/mjml.template-renderer.js.map +1 -1
- package/templates/template-renderer.provider.js.map +1 -1
- package/templates/template.model.d.ts +1 -0
- package/templates/template.model.js +5 -0
- package/templates/template.model.js.map +1 -1
- package/templates/template.service.js +2 -2
- package/templates/template.service.js.map +1 -1
- package/types.d.ts +6 -4
- 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/clone.js +4 -0
- package/utils/clone.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/enum.js.map +1 -1
- package/utils/function/memoize.js +2 -2
- package/utils/function/memoize.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/object/property-name.d.ts +2 -2
- 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 +13 -1
- package/utils/type-guards.js +29 -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
package/schema/schemas/array.js
CHANGED
|
@@ -13,8 +13,7 @@ function array(innerValues, options = {}) {
|
|
|
13
13
|
if ((0, type_guards_1.isDefined)(options.maximumLength)) {
|
|
14
14
|
arrayConstraints.push(new array_constraints_1.ArrayMaximumLengthConstraint(options.maximumLength));
|
|
15
15
|
}
|
|
16
|
-
return (0, types_1.valueSchema)({
|
|
17
|
-
type: innerValues,
|
|
16
|
+
return (0, types_1.valueSchema)((0, types_1.valueTypesOrSchemasToSchemas)(innerValues), {
|
|
18
17
|
array: true,
|
|
19
18
|
coerce: options.coerce,
|
|
20
19
|
arrayConstraints
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/schema/schemas/array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,4DAAoE;
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/schema/schemas/array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,4DAAoE;AAGpE,oCAAqE;AAUrE,SAAgB,KAAK,CAAW,WAAgD,EAAE,UAAwB,EAAE;IAC1G,MAAM,gBAAgB,GAA4B,EAAE,CAAC;IAErD,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,gDAA4B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAChF;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,gDAA4B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAChF;IAED,OAAO,IAAA,mBAAW,EAAM,IAAA,oCAA4B,EAAC,WAAW,CAAC,EAAE;QACjE,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAhBD,sBAgBC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Record } from "../../types";
|
|
2
2
|
import type { Merge } from 'type-fest';
|
|
3
3
|
import type { ObjectSchema } from '../types';
|
|
4
|
-
export declare function assign<T1
|
|
5
|
-
export declare function assign<T1
|
|
6
|
-
export declare function assign<T1
|
|
7
|
-
export declare function assign<T1
|
|
8
|
-
export declare function assign<T1
|
|
4
|
+
export declare function assign<T1, O1, T2, O2>(schema1: ObjectSchema<T1, O1>, schema2: ObjectSchema<T2, O2>): ObjectSchema<Merge<T1, T2>, Merge<O1, O2>>;
|
|
5
|
+
export declare function assign<T1, O1, T2, O2, T3, O3>(schema1: ObjectSchema<T1, O1>, schema2: ObjectSchema<T2, O2>, schema3: ObjectSchema<T3, O3>): ObjectSchema<Merge<Merge<T1, T2>, T3>, Merge<Merge<O1, O2>, O3>>;
|
|
6
|
+
export declare function assign<T1, O1, T2, O2, T3, O3, T4, O4>(schema1: ObjectSchema<T1, O1>, schema2: ObjectSchema<T2, O2>, schema3: ObjectSchema<T3, O3>, schema4: ObjectSchema<T4, O4>): ObjectSchema<Merge<Merge<Merge<T1, T2>, T3>, T4>, Merge<Merge<Merge<O1, O2>, O3>, O4>>;
|
|
7
|
+
export declare function assign<T1, O1, T2, O2, T3, O3, T4, O4, T6, O6>(schema1: ObjectSchema<T1, O1>, schema2: ObjectSchema<T2, O2>, schema3: ObjectSchema<T3, O3>, schema4: ObjectSchema<T4, O4>, schema5: ObjectSchema<T6, O6>): ObjectSchema<Merge<Merge<Merge<Merge<T1, T2>, T3>, T4>, T6>, Merge<Merge<Merge<Merge<O1, O2>, O3>, O4>, O6>>;
|
|
8
|
+
export declare function assign<T1, O1, T2, O2, T3, O3, T4, O4, T6, O6, T7 extends Record, O7 extends Record>(schema1: ObjectSchema<T1, O1>, schema2: ObjectSchema<T2, O2>, schema3: ObjectSchema<T3, O3>, schema4: ObjectSchema<T4, O4>, schema5: ObjectSchema<T6, O6>, schema6: ObjectSchema<T7, O7>): ObjectSchema<Merge<Merge<Merge<Merge<Merge<T1, T2>, T3>, T4>, T6>, T7>, Merge<Merge<Merge<Merge<Merge<O1, O2>, O3>, O4>, O6>, O7>>;
|
|
@@ -5,14 +5,13 @@ exports.Boolean = exports.boolean = void 0;
|
|
|
5
5
|
const decorators_1 = require("../decorators");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function boolean(options = {}) {
|
|
8
|
-
return (0, types_1.valueSchema)({
|
|
9
|
-
type: globalThis.Boolean,
|
|
8
|
+
return (0, types_1.valueSchema)((0, types_1.typeSchema)(globalThis.Boolean), {
|
|
10
9
|
coerce: options.coerce
|
|
11
10
|
});
|
|
12
11
|
}
|
|
13
12
|
exports.boolean = boolean;
|
|
14
13
|
function Boolean(options) {
|
|
15
|
-
return (0, decorators_1.
|
|
14
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(boolean(options));
|
|
16
15
|
}
|
|
17
16
|
exports.Boolean = Boolean;
|
|
18
17
|
//# sourceMappingURL=boolean.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../source/schema/schemas/boolean.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../source/schema/schemas/boolean.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,8CAAwE;AAExE,oCAAmD;AAInD,SAAgB,OAAO,CAAC,UAA0B,EAAE;IAClD,OAAO,IAAA,mBAAW,EAAU,IAAA,kBAAU,EAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC1D,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;AACL,CAAC;AAJD,0BAIC;AAED,SAAgB,OAAO,CAAC,OAAwB;IAC9C,OAAO,IAAA,oDAAuC,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC;AAFD,0BAEC"}
|
|
@@ -4,8 +4,7 @@ exports.constraint = void 0;
|
|
|
4
4
|
const generic_1 = require("../constraints/generic");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
function constraint(schema, constraintFunction, expects) {
|
|
7
|
-
return (0, types_1.valueSchema)({
|
|
8
|
-
type: schema,
|
|
7
|
+
return (0, types_1.valueSchema)(schema, {
|
|
9
8
|
valueConstraints: new generic_1.GenericConstraint(constraintFunction, expects)
|
|
10
9
|
});
|
|
11
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraint.js","sourceRoot":"","sources":["../../../source/schema/schemas/constraint.ts"],"names":[],"mappings":";;;AAEA,oDAA2D;AAE3D,oCAAuC;AAEvC,SAAgB,UAAU,CAAO,MAAoB,EAAE,kBAAgD,EAAE,OAA2B;IAClI,OAAO,IAAA,mBAAW,EAAC
|
|
1
|
+
{"version":3,"file":"constraint.js","sourceRoot":"","sources":["../../../source/schema/schemas/constraint.ts"],"names":[],"mappings":";;;AAEA,oDAA2D;AAE3D,oCAAuC;AAEvC,SAAgB,UAAU,CAAO,MAAoB,EAAE,kBAAgD,EAAE,OAA2B;IAClI,OAAO,IAAA,mBAAW,EAAC,MAAM,EAAE;QACzB,gBAAgB,EAAE,IAAI,2BAAiB,CAAC,kBAAkB,EAAE,OAAO,CAAC;KACrE,CAAC,CAAC;AACL,CAAC;AAJD,gCAIC;AAED,+CAA+C"}
|
package/schema/schemas/date.js
CHANGED
|
@@ -14,15 +14,14 @@ function date(options = {}) {
|
|
|
14
14
|
if ((0, type_guards_1.isDefined)(options.maximum)) {
|
|
15
15
|
constraints.push(new constraints_1.MaximumDateConstraint(options.maximum));
|
|
16
16
|
}
|
|
17
|
-
return (0, types_1.valueSchema)({
|
|
18
|
-
type: globalThis.Date,
|
|
17
|
+
return (0, types_1.valueSchema)((0, types_1.typeSchema)(globalThis.Date), {
|
|
19
18
|
coerce: options.coerce,
|
|
20
19
|
valueConstraints: constraints
|
|
21
20
|
});
|
|
22
21
|
}
|
|
23
22
|
exports.date = date;
|
|
24
23
|
function Date(options) {
|
|
25
|
-
return (0, decorators_1.
|
|
24
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(date(options));
|
|
26
25
|
}
|
|
27
26
|
exports.Date = Date;
|
|
28
27
|
//# sourceMappingURL=date.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../source/schema/schemas/date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,gDAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../source/schema/schemas/date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAgD;AAChD,gDAA8E;AAC9E,8CAAwE;AAExE,oCAAmD;AAOnD,SAAgB,IAAI,CAAC,UAAuB,EAAE;IAC5C,MAAM,WAAW,GAA4B,EAAE,CAAC;IAEhD,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,mCAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC9D;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,mCAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC9D;IAED,OAAO,IAAA,mBAAW,EAAC,IAAA,kBAAU,EAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAC9C,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,gBAAgB,EAAE,WAAW;KAC9B,CAAC,CAAC;AACL,CAAC;AAfD,oBAeC;AAED,SAAgB,IAAI,CAAC,OAAqB;IACxC,OAAO,IAAA,oDAAuC,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAChE,CAAC;AAFD,oBAEC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { OneOrMany } from "../../types";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
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;;;AAGzD,0CAAkD;
|
|
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"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { Schema } from '../schema';
|
|
2
|
+
import type { ValueSchema } from '../types';
|
|
3
|
+
export declare function nullable<T, O>(schema: Schema<T, O>): ValueSchema<T | null, O | null>;
|
|
@@ -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":";;;
|
|
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,8 +19,7 @@ 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
|
-
type: globalThis.Number,
|
|
22
|
+
return (0, types_1.valueSchema)((0, types_1.typeSchema)(globalThis.Number), {
|
|
24
23
|
array: false,
|
|
25
24
|
optional: false,
|
|
26
25
|
nullable: false,
|
|
@@ -30,7 +29,7 @@ function number(options = {}) {
|
|
|
30
29
|
}
|
|
31
30
|
exports.number = number;
|
|
32
31
|
function Number(options) {
|
|
33
|
-
return (0, decorators_1.
|
|
32
|
+
return (0, decorators_1.createSchemaPropertyDecoratorFromSchema)(number(options));
|
|
34
33
|
}
|
|
35
34
|
exports.Number = Number;
|
|
36
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
|
|
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"}
|
|
@@ -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,CAAO,MAAoB;IACjD,OAAO,IAAA,mBAAW,EAAC,
|
|
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,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
1
|
import type { OneOrMany, Record, TypedOmit } from "../../types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Schema } from '../schema';
|
|
3
|
+
import type { ObjectSchema } from '../types';
|
|
3
4
|
export declare type RecordOptions<T extends Record = Record> = TypedOmit<ObjectSchema<T>, 'properties' | 'allowUnknownProperties' | 'mask'>;
|
|
4
|
-
export declare function record<T, O>(valueType: OneOrMany<
|
|
5
|
+
export declare function record<T, O>(valueType: OneOrMany<Schema<T, O>>, options?: RecordOptions): ObjectSchema<Record<any, O>>;
|
|
@@ -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
4
|
import type { ValueSchema, ValueType } from '../types';
|
|
4
|
-
export declare function transform<T, O, TransformOutput>(schema: OneOrMany<
|
|
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,8 +4,7 @@ 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
|
}
|
|
@@ -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
|