@tstdl/base 0.78.0-beta7 → 0.78.0-beta70
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 +38 -16
- package/api/client/client.js.map +1 -1
- package/api/response.js +3 -2
- package/api/response.js.map +1 -1
- package/api/server/api-controller.js +1 -1
- package/api/server/api-controller.js.map +1 -1
- package/api/server/gateway.d.ts +15 -3
- package/api/server/gateway.js +53 -37
- package/api/server/gateway.js.map +1 -1
- package/api/server/middlewares/allowed-methods.middleware.js +1 -1
- package/api/server/middlewares/allowed-methods.middleware.js.map +1 -1
- package/api/server/middlewares/cors.middleware.d.ts +6 -4
- package/api/server/middlewares/cors.middleware.js +30 -30
- package/api/server/middlewares/cors.middleware.js.map +1 -1
- package/api/types.d.ts +36 -14
- 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.d.ts +2 -0
- package/application/application.js +3 -0
- package/application/application.js.map +1 -1
- package/collections/awaitable/awaitable-list.js +7 -7
- package/collections/awaitable/awaitable-list.js.map +1 -1
- package/collections/observable/observable-array.js +1 -1
- package/collections/observable/observable-array.js.map +1 -1
- package/collections/observable/observable-list-base.js +2 -2
- package/collections/observable/observable-list-base.js.map +1 -1
- package/collections/observable/observable-sorted-array-list.js +3 -3
- package/collections/observable/observable-sorted-array-list.js.map +1 -1
- package/collections/sorted-array-list.js +3 -3
- package/collections/sorted-array-list.js.map +1 -1
- package/collections/sorted-map.js +1 -1
- package/collections/sorted-map.js.map +1 -1
- package/container/container.js +19 -21
- package/container/container.js.map +1 -1
- package/container/decorators.d.ts +1 -1
- package/container/decorators.js.map +1 -1
- package/container/resolve-chain.d.ts +2 -1
- package/container/resolve-chain.js +6 -2
- package/container/resolve-chain.js.map +1 -1
- package/core.js +1 -1
- package/core.js.map +1 -1
- package/css/theme/theme.service.js.map +1 -1
- package/data-structures/index-out-of-bounds.error.d.ts +1 -1
- package/data-structures/index-out-of-bounds.error.js +2 -2
- package/data-structures/index-out-of-bounds.error.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 +2 -2
- package/data-structures/sorted-array-list.js.map +1 -1
- package/database/mongo/classes.js.map +1 -1
- package/database/mongo/mongo-base.repository.js +3 -3
- 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/distributed-loop/distributed-loop.js.map +1 -1
- package/distributed-loop/provider.js.map +1 -1
- package/environment.d.ts +10 -0
- package/environment.js +26 -0
- package/environment.js.map +1 -0
- package/error/custom.error.d.ts +7 -3
- package/error/custom.error.js +17 -8
- package/error/custom.error.js.map +1 -1
- package/error/index.d.ts +1 -0
- package/error/index.js +1 -0
- package/error/index.js.map +1 -1
- package/error/max-bytes-exceeded.error.d.ts +1 -0
- package/error/max-bytes-exceeded.error.js +3 -0
- package/error/max-bytes-exceeded.error.js.map +1 -1
- package/error/not-implemented.error.js +1 -1
- package/error/not-implemented.error.js.map +1 -1
- package/error/not-supported.error.d.ts +7 -0
- package/error/not-supported.error.js +17 -0
- package/error/not-supported.error.js.map +1 -0
- package/error/unsupported-media-type.error.js +1 -1
- package/error/unsupported-media-type.error.js.map +1 -1
- package/examples/api/basic-overview.js +17 -25
- package/examples/api/basic-overview.js.map +1 -1
- package/examples/api/streaming.d.ts +1 -0
- package/examples/api/streaming.js +79 -0
- package/examples/api/streaming.js.map +1 -0
- package/examples/mail/basic.js +12 -7
- package/examples/mail/basic.js.map +1 -1
- package/examples/mail/templates/hello-name.d.ts +2 -0
- package/examples/mail/templates/hello-name.js +11 -0
- package/examples/mail/templates/hello-name.js.map +1 -0
- package/examples/pdf/basic.js +8 -5
- package/examples/pdf/basic.js.map +1 -1
- package/examples/pdf/templates/hello-name.d.ts +1 -4
- package/examples/pdf/templates/hello-name.js +30 -4
- package/examples/pdf/templates/hello-name.js.map +1 -1
- package/examples/reflection/basic.js +1 -1
- package/examples/reflection/basic.js.map +1 -1
- package/examples/template/basic.d.ts +1 -0
- package/examples/template/basic.js +25 -0
- package/examples/template/basic.js.map +1 -0
- package/examples/template/templates/hello-name.d.ts +2 -0
- package/examples/template/templates/hello-name.js +23 -0
- package/examples/template/templates/hello-name.js.map +1 -0
- package/http/client/adapters/undici-http-client.adapter.d.ts +1 -2
- package/http/client/adapters/undici-http-client.adapter.js +10 -12
- package/http/client/adapters/undici-http-client.adapter.js.map +1 -1
- package/http/client/http-client-request.d.ts +24 -14
- package/http/client/http-client-request.js +4 -2
- package/http/client/http-client-request.js.map +1 -1
- package/http/client/http-client-response.d.ts +10 -12
- package/http/client/http-client-response.js +5 -1
- package/http/client/http-client-response.js.map +1 -1
- package/http/client/http-client.adapter.d.ts +1 -2
- package/http/client/http-client.adapter.js.map +1 -1
- package/http/client/http-client.d.ts +30 -31
- package/http/client/http-client.js +107 -74
- package/http/client/http-client.js.map +1 -1
- package/http/http-body.d.ts +19 -0
- package/http/http-body.js +52 -0
- package/http/http-body.js.map +1 -0
- package/http/http-headers.d.ts +3 -0
- package/http/http-headers.js +6 -0
- package/http/http-headers.js.map +1 -1
- package/http/http-value-map.js +2 -2
- package/http/http-value-map.js.map +1 -1
- package/http/http.error.d.ts +5 -2
- package/http/http.error.js +27 -5
- package/http/http.error.js.map +1 -1
- package/http/index.d.ts +2 -0
- package/http/index.js +2 -0
- package/http/index.js.map +1 -1
- package/http/server/http-server-request.d.ts +5 -10
- package/http/server/http-server-request.js +3 -30
- package/http/server/http-server-request.js.map +1 -1
- package/http/server/http-server-response.d.ts +4 -4
- package/http/server/node/node-http-server.js +2 -1
- package/http/server/node/node-http-server.js.map +1 -1
- package/http/types.d.ts +1 -11
- package/http/types.js +1 -2
- package/http/types.js.map +1 -1
- package/http/utils.d.ts +15 -0
- package/http/utils.js +113 -0
- package/http/utils.js.map +1 -0
- package/image-service/image-service.js.map +1 -1
- package/image-service/imgproxy/imgproxy-image-service.js.map +1 -1
- package/json-path/json-path.d.ts +8 -5
- package/json-path/json-path.js +15 -1
- package/json-path/json-path.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 +1 -1
- package/logger/console/logger.js.map +1 -1
- package/logger/logger.d.ts +2 -2
- package/mail/clients/nodemailer.mail-client.js.map +1 -1
- package/mail/index.d.ts +0 -3
- package/mail/index.js +0 -3
- package/mail/index.js.map +1 -1
- package/mail/mail.service.d.ts +3 -5
- package/mail/mail.service.js +8 -14
- package/mail/mail.service.js.map +1 -1
- package/mail/models/mail-template.model.d.ts +11 -10
- package/mail/models/mail-template.model.js +7 -0
- package/mail/models/mail-template.model.js.map +1 -1
- package/mail/module.d.ts +1 -5
- package/mail/module.js +2 -11
- package/mail/module.js.map +1 -1
- package/mail/repositories/mongo-mail-log.repository.js.map +1 -1
- package/mail/tokens.d.ts +0 -3
- package/mail/tokens.js +1 -2
- package/mail/tokens.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.d.ts +2 -1
- package/openid-connect/oidc-configuration.service.js +5 -3
- package/openid-connect/oidc-configuration.service.js.map +1 -1
- package/openid-connect/oidc.service-model.d.ts +11 -3
- package/openid-connect/oidc.service.d.ts +6 -3
- package/openid-connect/oidc.service.js +72 -25
- package/openid-connect/oidc.service.js.map +1 -1
- package/package.json +12 -11
- package/pdf/pdf.service.d.ts +91 -12
- package/pdf/pdf.service.js +209 -29
- package/pdf/pdf.service.js.map +1 -1
- package/pool/pool.d.ts +6 -1
- package/pool/pool.js +4 -1
- package/pool/pool.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 +1 -1
- 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/require.d.ts +1 -0
- package/require.js +9 -0
- package/require.js.map +1 -0
- package/rpc/endpoints/message-port.rpc-endpoint.d.ts +19 -0
- package/rpc/endpoints/message-port.rpc-endpoint.js +34 -0
- package/rpc/endpoints/message-port.rpc-endpoint.js.map +1 -0
- package/rpc/index.d.ts +4 -0
- package/rpc/index.js +21 -0
- package/rpc/index.js.map +1 -0
- package/rpc/model.d.ts +72 -0
- package/rpc/model.js +13 -0
- package/rpc/model.js.map +1 -0
- package/rpc/rpc-endpoint.d.ts +11 -0
- package/rpc/rpc-endpoint.js +23 -0
- package/rpc/rpc-endpoint.js.map +1 -0
- package/rpc/rpc-error.d.ts +8 -0
- package/rpc/rpc-error.js +26 -0
- package/rpc/rpc-error.js.map +1 -0
- package/rpc/rpc.d.ts +19 -0
- package/rpc/rpc.js +263 -0
- package/rpc/rpc.js.map +1 -0
- package/schema/array-constraints/maximum-length.d.ts +2 -2
- 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.d.ts +2 -2
- package/schema/array-constraints/minimum-length.js +2 -2
- package/schema/array-constraints/minimum-length.js.map +1 -1
- package/schema/coercers/boolean.coercer.d.ts +2 -2
- package/schema/coercers/boolean.coercer.js +2 -2
- package/schema/coercers/boolean.coercer.js.map +1 -1
- package/schema/coercers/date.coercer.d.ts +2 -2
- package/schema/coercers/date.coercer.js +2 -2
- package/schema/coercers/date.coercer.js.map +1 -1
- package/schema/coercers/number.coercer.d.ts +3 -3
- package/schema/coercers/number.coercer.js +2 -2
- package/schema/coercers/number.coercer.js.map +1 -1
- package/schema/coercers/regexp.coercer.d.ts +2 -2
- package/schema/coercers/regexp.coercer.js +2 -2
- package/schema/coercers/regexp.coercer.js.map +1 -1
- package/schema/coercers/string.coercer.d.ts +3 -3
- package/schema/coercers/string.coercer.js +2 -2
- package/schema/coercers/string.coercer.js.map +1 -1
- package/schema/coercers/uint8-array.coercer.js +2 -2
- package/schema/coercers/uint8-array.coercer.js.map +1 -1
- package/schema/constraints/enumeration.d.ts +5 -5
- package/schema/constraints/enumeration.js +6 -6
- package/schema/constraints/enumeration.js.map +1 -1
- package/schema/constraints/generic.d.ts +2 -2
- package/schema/constraints/generic.js +2 -2
- package/schema/constraints/generic.js.map +1 -1
- package/schema/constraints/integer.d.ts +2 -2
- package/schema/constraints/integer.js +2 -2
- package/schema/constraints/integer.js.map +1 -1
- package/schema/constraints/literal.d.ts +2 -2
- package/schema/constraints/literal.js +2 -2
- package/schema/constraints/literal.js.map +1 -1
- package/schema/constraints/maximum-date.d.ts +2 -2
- package/schema/constraints/maximum-date.js +2 -2
- package/schema/constraints/maximum-date.js.map +1 -1
- package/schema/constraints/maximum-length.d.ts +3 -3
- package/schema/constraints/maximum-length.js +2 -2
- package/schema/constraints/maximum-length.js.map +1 -1
- package/schema/constraints/maximum.d.ts +2 -2
- package/schema/constraints/maximum.js +2 -2
- package/schema/constraints/maximum.js.map +1 -1
- package/schema/constraints/minimum-date.d.ts +2 -2
- package/schema/constraints/minimum-date.js +2 -2
- package/schema/constraints/minimum-date.js.map +1 -1
- package/schema/constraints/minimum-length.d.ts +3 -3
- package/schema/constraints/minimum-length.js +2 -2
- package/schema/constraints/minimum-length.js.map +1 -1
- package/schema/constraints/minimum.d.ts +2 -2
- package/schema/constraints/minimum.js +2 -2
- package/schema/constraints/minimum.js.map +1 -1
- package/schema/constraints/pattern.d.ts +2 -2
- package/schema/constraints/pattern.js +2 -2
- package/schema/constraints/pattern.js.map +1 -1
- package/schema/decorators/optional.d.ts +3 -1
- package/schema/decorators/optional.js +2 -2
- package/schema/decorators/optional.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 +8 -4
- package/schema/decorators/utils.js.map +1 -1
- package/schema/schema.d.ts +4 -10
- package/schema/schema.error.d.ts +6 -5
- package/schema/schema.error.js +13 -10
- package/schema/schema.error.js.map +1 -1
- package/schema/schema.js +110 -104
- package/schema/schema.js.map +1 -1
- package/schema/schemas/array.d.ts +3 -3
- package/schema/schemas/array.js.map +1 -1
- package/schema/schemas/assign.d.ts +6 -6
- package/schema/schemas/assign.js +3 -1
- package/schema/schemas/assign.js.map +1 -1
- package/schema/schemas/constraint.d.ts +3 -2
- package/schema/schemas/constraint.js.map +1 -1
- package/schema/schemas/defaulted.d.ts +2 -2
- package/schema/schemas/defaulted.js.map +1 -1
- package/schema/schemas/index.d.ts +2 -1
- package/schema/schemas/index.js +2 -1
- package/schema/schemas/index.js.map +1 -1
- package/schema/schemas/nullable.d.ts +2 -2
- package/schema/schemas/nullable.js.map +1 -1
- package/schema/schemas/number.d.ts +1 -1
- package/schema/schemas/number.js.map +1 -1
- package/schema/schemas/omit.d.ts +4 -0
- package/schema/schemas/{exclude.js → omit.js} +8 -6
- package/schema/schemas/omit.js.map +1 -0
- package/schema/schemas/optional.d.ts +3 -2
- package/schema/schemas/optional.js.map +1 -1
- package/schema/schemas/partial.d.ts +4 -0
- package/schema/schemas/partial.js +22 -0
- package/schema/schemas/partial.js.map +1 -0
- package/schema/schemas/pick.d.ts +2 -2
- package/schema/schemas/pick.js +3 -1
- package/schema/schemas/pick.js.map +1 -1
- package/schema/schemas/record.d.ts +2 -2
- package/schema/schemas/record.js.map +1 -1
- package/schema/schemas/union.d.ts +4 -9
- package/schema/schemas/union.js.map +1 -1
- package/schema/types.d.ts +30 -20
- package/schema/types.js +21 -8
- package/schema/types.js.map +1 -1
- package/schema/utils/schema.d.ts +6 -1
- package/schema/utils/schema.js +60 -4
- package/schema/utils/schema.js.map +1 -1
- package/schema/utils/value-type.d.ts +5 -3
- package/schema/utils/value-type.js +23 -8
- package/schema/utils/value-type.js.map +1 -1
- package/search-index/elastic/config.js.map +1 -1
- package/search-index/elastic/model/index-mapping.d.ts +2 -1
- package/search-index/elastic/model/index-mapping.js.map +1 -1
- package/search-index/elastic/search-index.js +5 -4
- package/search-index/elastic/search-index.js.map +1 -1
- package/search-index/error.d.ts +1 -1
- package/search-index/error.js +2 -2
- package/search-index/error.js.map +1 -1
- package/serializer/handlers/register.d.ts +2 -2
- package/serializer/handlers/register.js +6 -2
- package/serializer/handlers/register.js.map +1 -1
- package/serializer/serializable.d.ts +11 -8
- package/serializer/serializable.js +13 -4
- package/serializer/serializable.js.map +1 -1
- package/serializer/serializer.js +21 -8
- package/serializer/serializer.js.map +1 -1
- package/serializer/types.d.ts +21 -6
- package/serializer/types.js +2 -1
- package/serializer/types.js.map +1 -1
- package/supports.d.ts +5 -0
- package/supports.js +9 -0
- package/supports.js.map +1 -0
- package/templates/index.d.ts +2 -0
- package/templates/index.js +2 -0
- package/templates/index.js.map +1 -1
- package/templates/module.d.ts +3 -1
- package/templates/module.js +31 -8
- package/templates/module.js.map +1 -1
- package/templates/providers/file.provider-template.d.ts +16 -0
- package/templates/providers/{file-template.provider.js → file.provider-template.js} +22 -15
- package/templates/providers/file.provider-template.js.map +1 -0
- package/templates/providers/memory.template-provider.d.ts +8 -0
- package/templates/providers/{memory-template.provider.base.js → memory.template-provider.js} +8 -6
- package/templates/providers/memory.template-provider.js.map +1 -0
- package/templates/renderers/handlebars.template-renderer.d.ts +38 -6
- package/templates/renderers/handlebars.template-renderer.js +70 -3
- package/templates/renderers/handlebars.template-renderer.js.map +1 -1
- package/templates/renderers/mjml.template-renderer.d.ts +6 -6
- package/templates/renderers/mjml.template-renderer.js +8 -9
- package/templates/renderers/mjml.template-renderer.js.map +1 -1
- package/templates/renderers/string.template-renderer.d.ts +8 -0
- package/{mail/template-providers/memory-mail-template.provider.js → templates/renderers/string.template-renderer.js} +13 -7
- package/templates/renderers/string.template-renderer.js.map +1 -0
- package/templates/resolvers/file.template-resolver.d.ts +23 -0
- package/templates/resolvers/file.template-resolver.js +63 -0
- package/templates/resolvers/file.template-resolver.js.map +1 -0
- package/templates/resolvers/string.template-resolver.d.ts +13 -0
- package/templates/resolvers/string.template-resolver.js +44 -0
- package/templates/resolvers/string.template-resolver.js.map +1 -0
- package/templates/template-renderer.provider.js +7 -19
- package/templates/template-renderer.provider.js.map +1 -1
- package/templates/template-resolver.provider.d.ts +8 -0
- package/templates/template-resolver.provider.js +48 -0
- package/templates/template-resolver.provider.js.map +1 -0
- package/templates/template.model.d.ts +15 -4
- package/templates/template.model.js +50 -0
- package/templates/template.model.js.map +1 -1
- package/templates/template.renderer.d.ts +14 -3
- package/templates/template.renderer.js +3 -0
- package/templates/template.renderer.js.map +1 -1
- package/templates/template.resolver.d.ts +5 -0
- package/templates/template.resolver.js +7 -0
- package/templates/template.resolver.js.map +1 -0
- package/templates/template.service.d.ts +10 -4
- package/templates/template.service.js +19 -6
- package/templates/template.service.js.map +1 -1
- package/templates/tokens.d.ts +3 -2
- package/templates/tokens.js +2 -1
- package/templates/tokens.js.map +1 -1
- package/threading/index.d.ts +2 -0
- package/threading/index.js +19 -0
- package/threading/index.js.map +1 -0
- package/threading/thread-pool.d.ts +19 -0
- package/threading/thread-pool.js +50 -0
- package/threading/thread-pool.js.map +1 -0
- package/threading/thread-worker.d.ts +3 -0
- package/threading/thread-worker.js +9 -0
- package/threading/thread-worker.js.map +1 -0
- package/types.d.ts +27 -9
- package/utils/alphabet.d.ts +3 -1
- package/utils/alphabet.js +2 -0
- package/utils/alphabet.js.map +1 -1
- package/utils/array/array.d.ts +1 -2
- package/utils/array/array.js.map +1 -1
- package/utils/base64.js +3 -2
- package/utils/base64.js.map +1 -1
- package/utils/binary.js +3 -2
- package/utils/binary.js.map +1 -1
- package/utils/clone.js +4 -0
- package/utils/clone.js.map +1 -1
- package/utils/compression.d.ts +19 -15
- package/utils/compression.js +43 -10
- package/utils/compression.js.map +1 -1
- package/utils/encoding.d.ts +10 -0
- package/utils/encoding.js +20 -4
- package/utils/encoding.js.map +1 -1
- package/utils/enum.d.ts +5 -8
- package/utils/enum.js +15 -13
- package/utils/enum.js.map +1 -1
- package/utils/function/memoize.js +4 -4
- package/utils/function/memoize.js.map +1 -1
- package/utils/helpers.d.ts +0 -2
- package/utils/helpers.js +3 -14
- package/utils/helpers.js.map +1 -1
- package/utils/image.js +2 -2
- package/utils/image.js.map +1 -1
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
- package/utils/index.js.map +1 -1
- package/utils/object/decycle.js +10 -21
- package/utils/object/decycle.js.map +1 -1
- package/utils/object/dereference.d.ts +7 -5
- package/utils/object/dereference.js +4 -4
- package/utils/object/dereference.js.map +1 -1
- package/utils/object/forward-ref.js +3 -19
- package/utils/object/forward-ref.js.map +1 -1
- package/utils/object/merge.js +3 -3
- package/utils/object/merge.js.map +1 -1
- package/utils/object/object.js +3 -3
- package/utils/object/object.js.map +1 -1
- package/utils/object/property-name.d.ts +2 -2
- package/utils/proxy.d.ts +6 -0
- package/utils/proxy.js +21 -0
- package/utils/proxy.js.map +1 -0
- package/utils/stream/finalize-stream.d.ts +1 -0
- package/utils/stream/finalize-stream.js +38 -0
- package/utils/stream/finalize-stream.js.map +1 -0
- package/utils/stream/index.d.ts +4 -3
- package/utils/stream/index.js +4 -3
- package/utils/stream/index.js.map +1 -1
- package/utils/stream/readable-stream-adapter.d.ts +5 -0
- package/utils/stream/readable-stream-adapter.js +45 -0
- package/utils/stream/readable-stream-adapter.js.map +1 -0
- package/utils/stream/readable-stream-from-promise.d.ts +1 -0
- package/utils/stream/readable-stream-from-promise.js +12 -0
- package/utils/stream/readable-stream-from-promise.js.map +1 -0
- package/utils/stream/size-limited-stream.d.ts +2 -0
- package/utils/stream/size-limited-stream.js +18 -0
- package/utils/stream/size-limited-stream.js.map +1 -0
- package/utils/stream/stream-reader.d.ts +2 -1
- package/utils/stream/stream-reader.js +7 -10
- package/utils/stream/stream-reader.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 +34 -16
- package/utils/type-guards.js +112 -75
- 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/http/client/adapters/got-http-client.adapter.d.ts +0 -10
- package/http/client/adapters/got-http-client.adapter.js +0 -141
- package/http/client/adapters/got-http-client.adapter.js.map +0 -1
- package/http/client/adapters/utils.d.ts +0 -11
- package/http/client/adapters/utils.js +0 -79
- package/http/client/adapters/utils.js.map +0 -1
- package/mail/mail-template-renderer.provider.d.ts +0 -8
- package/mail/mail-template-renderer.provider.js +0 -60
- package/mail/mail-template-renderer.provider.js.map +0 -1
- package/mail/mail-template.provider.d.ts +0 -4
- package/mail/mail-template.provider.js +0 -7
- package/mail/mail-template.provider.js.map +0 -1
- package/mail/mail-template.renderer.d.ts +0 -10
- package/mail/mail-template.renderer.js +0 -7
- package/mail/mail-template.renderer.js.map +0 -1
- package/mail/template-providers/file-mail-template.provider.d.ts +0 -24
- package/mail/template-providers/file-mail-template.provider.js +0 -51
- package/mail/template-providers/file-mail-template.provider.js.map +0 -1
- package/mail/template-providers/memory-mail-template.provider.d.ts +0 -6
- package/mail/template-providers/memory-mail-template.provider.js.map +0 -1
- package/mail/template-renderers/handlebars.mail-template-renderer.d.ts +0 -13
- package/mail/template-renderers/handlebars.mail-template-renderer.js +0 -49
- package/mail/template-renderers/handlebars.mail-template-renderer.js.map +0 -1
- package/mail/template-renderers/mjml.mail-template-renderer.d.ts +0 -14
- package/mail/template-renderers/mjml.mail-template-renderer.js +0 -63
- package/mail/template-renderers/mjml.mail-template-renderer.js.map +0 -1
- package/schema/schemas/exclude.d.ts +0 -4
- package/schema/schemas/exclude.js.map +0 -1
- package/templates/providers/file-template.provider.base.d.ts +0 -12
- package/templates/providers/file-template.provider.base.js +0 -50
- package/templates/providers/file-template.provider.base.js.map +0 -1
- package/templates/providers/file-template.provider.d.ts +0 -22
- package/templates/providers/file-template.provider.js.map +0 -1
- package/templates/providers/memory-template.provider.base.d.ts +0 -9
- package/templates/providers/memory-template.provider.base.js.map +0 -1
- package/templates/providers/memory-template.provider.d.ts +0 -4
- package/templates/providers/memory-template.provider.js +0 -18
- package/templates/providers/memory-template.provider.js.map +0 -1
- package/utils/stream/async-iterable-readable.d.ts +0 -13
- package/utils/stream/async-iterable-readable.js +0 -40
- package/utils/stream/async-iterable-readable.js.map +0 -1
- package/utils/stream/async-writable-stream.d.ts +0 -16
- package/utils/stream/async-writable-stream.js +0 -41
- package/utils/stream/async-writable-stream.js.map +0 -1
- package/utils/stream/typed-readable.d.ts +0 -58
- package/utils/stream/typed-readable.js +0 -9
- package/utils/stream/typed-readable.js.map +0 -1
|
@@ -11,9 +11,9 @@ class ArrayMaximumLengthConstraint extends types_1.SchemaArrayConstraint {
|
|
|
11
11
|
this.maximumLength = maximumLength;
|
|
12
12
|
this.expects = `a maximum array length of ${this.maximumLength}`;
|
|
13
13
|
}
|
|
14
|
-
validate(value, path) {
|
|
14
|
+
validate(value, path, context) {
|
|
15
15
|
if (value.length > this.maximumLength) {
|
|
16
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path) };
|
|
16
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path, { fast: context.options.fastErrors }) };
|
|
17
17
|
}
|
|
18
18
|
return { valid: true };
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maximum-length.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/maximum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,4BAA6B,SAAQ,6BAAqB;IAKrE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,KAAY,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"maximum-length.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/maximum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,4BAA6B,SAAQ,6BAAqB;IAKrE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,KAAY,EAAE,IAAc,EAAE,OAA0B;QAC/D,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC5J;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAnBD,oEAmBC;AAED,SAAgB,kBAAkB,CAAC,aAAqB;IACtD,OAAO,IAAA,iDAAoC,EAAC,IAAI,4BAA4B,CAAC,aAAa,CAAC,CAAC,CAAC;AAC/F,CAAC;AAFD,gDAEC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
2
|
import type { Decorator } from "../../reflection";
|
|
3
|
-
import type { ConstraintResult } from '../types';
|
|
3
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
4
4
|
import { SchemaArrayConstraint } from '../types';
|
|
5
5
|
export declare class MinimumArrayLengthConstraint extends SchemaArrayConstraint {
|
|
6
6
|
private readonly minimumLength;
|
|
7
7
|
readonly expects: string;
|
|
8
8
|
constructor(minimumLength: number);
|
|
9
|
-
validate(value: any[], path: JsonPath): ConstraintResult;
|
|
9
|
+
validate(value: any[], path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
10
10
|
}
|
|
11
11
|
export declare function MinimumArrayLength(minimumLength: number): Decorator<'property' | 'accessor'>;
|
|
@@ -11,9 +11,9 @@ class MinimumArrayLengthConstraint extends types_1.SchemaArrayConstraint {
|
|
|
11
11
|
this.minimumLength = minimumLength;
|
|
12
12
|
this.expects = `a minimum array length of ${this.minimumLength}`;
|
|
13
13
|
}
|
|
14
|
-
validate(value, path) {
|
|
14
|
+
validate(value, path, context) {
|
|
15
15
|
if (value.length < this.minimumLength) {
|
|
16
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path) };
|
|
16
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path, { fast: context.options.fastErrors }) };
|
|
17
17
|
}
|
|
18
18
|
return { valid: true };
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minimum-length.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/minimum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,4BAA6B,SAAQ,6BAAqB;IAKrE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,KAAY,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"minimum-length.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/minimum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,4BAA6B,SAAQ,6BAAqB;IAKrE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,KAAY,EAAE,IAAc,EAAE,OAA0B;QAC/D,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC5J;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAnBD,oEAmBC;AAED,SAAgB,kBAAkB,CAAC,aAAqB;IACtD,OAAO,IAAA,iDAAoC,EAAC,IAAI,4BAA4B,CAAC,aAAa,CAAC,CAAC,CAAC;AAC/F,CAAC;AAFD,gDAEC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path";
|
|
2
|
-
import type { CoerceResult } from '../types';
|
|
2
|
+
import type { CoercerContext, CoerceResult } from '../types';
|
|
3
3
|
import { SchemaValueCoercer } from '../types';
|
|
4
4
|
export declare class BooleanCoercer extends SchemaValueCoercer {
|
|
5
5
|
readonly sourceType: (NumberConstructor | StringConstructor | BigIntConstructor)[];
|
|
6
6
|
readonly targetType: BooleanConstructor;
|
|
7
|
-
coerce(value: number | string | bigint, path: JsonPath): CoerceResult;
|
|
7
|
+
coerce(value: number | string | bigint, path: JsonPath, context: CoercerContext): CoerceResult;
|
|
8
8
|
}
|
|
9
9
|
export declare const booleanCoercer: BooleanCoercer;
|
|
@@ -10,7 +10,7 @@ class BooleanCoercer extends types_1.SchemaValueCoercer {
|
|
|
10
10
|
this.sourceType = [Number, String, BigInt];
|
|
11
11
|
this.targetType = Boolean;
|
|
12
12
|
}
|
|
13
|
-
coerce(value, path) {
|
|
13
|
+
coerce(value, path, context) {
|
|
14
14
|
const normalizedValue = (0, type_guards_1.isString)(value) ? value.toLowerCase() : value;
|
|
15
15
|
switch (normalizedValue) {
|
|
16
16
|
case 1:
|
|
@@ -26,7 +26,7 @@ class BooleanCoercer extends types_1.SchemaValueCoercer {
|
|
|
26
26
|
case 'no':
|
|
27
27
|
return { success: true, value: false };
|
|
28
28
|
default:
|
|
29
|
-
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Boolean, value.toString(), path) };
|
|
29
|
+
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Boolean, value.toString(), path, undefined, { fast: context.options.fastErrors }) };
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/boolean.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA+C;AAC/C,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,cAAe,SAAQ,0BAAkB;IAAtD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAU,GAAG,OAAO,CAAC;IAwBhC,CAAC;IAtBC,MAAM,CAAC,KAA+B,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"boolean.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/boolean.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA+C;AAC/C,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,cAAe,SAAQ,0BAAkB;IAAtD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAU,GAAG,OAAO,CAAC;IAwBhC,CAAC;IAtBC,MAAM,CAAC,KAA+B,EAAE,IAAc,EAAE,OAAuB;QAC7E,MAAM,eAAe,GAAG,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAEtE,QAAQ,eAAe,EAAE;YACvB,KAAK,CAAC,CAAC;YACP,KAAK,EAAE,CAAC;YACR,KAAK,MAAM,CAAC;YACZ,KAAK,GAAG,CAAC;YACT,KAAK,KAAK;gBACR,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YAExC,KAAK,CAAC,CAAC;YACP,KAAK,EAAE,CAAC;YACR,KAAK,OAAO,CAAC;YACb,KAAK,GAAG,CAAC;YACT,KAAK,IAAI;gBACP,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;YAEzC;gBACE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAClJ;IACH,CAAC;CACF;AA1BD,wCA0BC;AAEY,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path";
|
|
2
|
-
import type { CoerceResult } from '../types';
|
|
2
|
+
import type { CoercerContext, CoerceResult } from '../types';
|
|
3
3
|
import { SchemaValueCoercer } from '../types';
|
|
4
4
|
export declare class DateCoercer extends SchemaValueCoercer {
|
|
5
5
|
readonly sourceType: (NumberConstructor | StringConstructor | BigIntConstructor)[];
|
|
6
6
|
readonly targetType: DateConstructor;
|
|
7
|
-
coerce(value: number | string | bigint, path: JsonPath): CoerceResult;
|
|
7
|
+
coerce(value: number | string | bigint, path: JsonPath, context: CoercerContext): CoerceResult;
|
|
8
8
|
}
|
|
9
9
|
export declare const dateCoercer: DateCoercer;
|
|
@@ -10,11 +10,11 @@ class DateCoercer extends types_1.SchemaValueCoercer {
|
|
|
10
10
|
this.sourceType = [Number, String, BigInt];
|
|
11
11
|
this.targetType = Date;
|
|
12
12
|
}
|
|
13
|
-
coerce(value, path) {
|
|
13
|
+
coerce(value, path, context) {
|
|
14
14
|
const parseValue = (0, type_guards_1.isBigInt)(value) ? Number(value) : value;
|
|
15
15
|
const date = new Date(parseValue);
|
|
16
16
|
if (Number.isNaN(date.getTime())) {
|
|
17
|
-
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path) };
|
|
17
|
+
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path, undefined, { fast: context.options.fastErrors }) };
|
|
18
18
|
}
|
|
19
19
|
return { success: true, value: date };
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/date.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA+C;AAC/C,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,WAAY,SAAQ,0BAAkB;IAAnD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAU,GAAG,IAAI,CAAC;IAY7B,CAAC;IAVC,MAAM,CAAC,KAA+B,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"date.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/date.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA+C;AAC/C,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,WAAY,SAAQ,0BAAkB;IAAnD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAU,GAAG,IAAI,CAAC;IAY7B,CAAC;IAVC,MAAM,CAAC,KAA+B,EAAE,IAAc,EAAE,OAAuB;QAC7E,MAAM,UAAU,GAAG,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC3D,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;QAElC,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;YAChC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxJ;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACxC,CAAC;CACF;AAdD,kCAcC;AACY,QAAA,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path";
|
|
2
|
-
import type { CoerceResult } from '../types';
|
|
2
|
+
import type { CoercerContext, CoerceResult } from '../types';
|
|
3
3
|
import { SchemaValueCoercer } from '../types';
|
|
4
4
|
export declare class NumberCoercer extends SchemaValueCoercer {
|
|
5
|
-
readonly sourceType: (
|
|
5
|
+
readonly sourceType: (BooleanConstructor | StringConstructor | BigIntConstructor)[];
|
|
6
6
|
readonly targetType: NumberConstructor;
|
|
7
|
-
coerce(value: string | bigint | boolean, path: JsonPath): CoerceResult;
|
|
7
|
+
coerce(value: string | bigint | boolean, path: JsonPath, context: CoercerContext): CoerceResult;
|
|
8
8
|
}
|
|
9
9
|
export declare const numberCoercer: NumberCoercer;
|
|
@@ -9,10 +9,10 @@ class NumberCoercer extends types_1.SchemaValueCoercer {
|
|
|
9
9
|
this.sourceType = [String, BigInt, Boolean];
|
|
10
10
|
this.targetType = Number;
|
|
11
11
|
}
|
|
12
|
-
coerce(value, path) {
|
|
12
|
+
coerce(value, path, context) {
|
|
13
13
|
const result = Number(value);
|
|
14
14
|
if (Number.isNaN(result)) {
|
|
15
|
-
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path, 'Value is not a number.') };
|
|
15
|
+
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path, 'Value is not a number.', { fast: context.options.fastErrors }) };
|
|
16
16
|
}
|
|
17
17
|
return { success: true, value: result };
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/number.coercer.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAArD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,eAAU,GAAG,MAAM,CAAC;IAW/B,CAAC;IATC,MAAM,CAAC,KAAgC,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"number.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/number.coercer.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAArD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,eAAU,GAAG,MAAM,CAAC;IAW/B,CAAC;IATC,MAAM,CAAC,KAAgC,EAAE,IAAc,EAAE,OAAuB;QAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;YACxB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACvK;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;CACF;AAbD,sCAaC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
-
import type { CoerceResult } from '../types';
|
|
2
|
+
import type { CoercerContext, CoerceResult } from '../types';
|
|
3
3
|
import { SchemaValueCoercer } from '../types';
|
|
4
4
|
export declare class RegExpCoercer extends SchemaValueCoercer {
|
|
5
5
|
readonly sourceType: StringConstructor;
|
|
6
6
|
readonly targetType: RegExpConstructor;
|
|
7
7
|
readonly flags: string | undefined;
|
|
8
8
|
constructor(flags?: string);
|
|
9
|
-
coerce(value: string, path: JsonPath): CoerceResult;
|
|
9
|
+
coerce(value: string, path: JsonPath, context: CoercerContext): CoerceResult;
|
|
10
10
|
}
|
|
11
11
|
export declare const regExpCoercer: RegExpCoercer;
|
|
@@ -10,12 +10,12 @@ class RegExpCoercer extends types_1.SchemaValueCoercer {
|
|
|
10
10
|
this.targetType = RegExp;
|
|
11
11
|
this.flags = flags;
|
|
12
12
|
}
|
|
13
|
-
coerce(value, path) {
|
|
13
|
+
coerce(value, path, context) {
|
|
14
14
|
try {
|
|
15
15
|
return { success: true, value: RegExp(value, this.flags) };
|
|
16
16
|
}
|
|
17
17
|
catch (error) {
|
|
18
|
-
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid regexp pattern', path, error.message) };
|
|
18
|
+
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid regexp pattern', path, error.message, { fast: context.options.fastErrors }) };
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regexp.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/regexp.coercer.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAKnD,YAAY,QAAgB,GAAG;QAC7B,KAAK,EAAE,CAAC;QALD,eAAU,GAAG,MAAM,CAAC;QACpB,eAAU,GAAG,MAAM,CAAC;QAM3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"regexp.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/regexp.coercer.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAKnD,YAAY,QAAgB,GAAG;QAC7B,KAAK,EAAE,CAAC;QALD,eAAU,GAAG,MAAM,CAAC;QACpB,eAAU,GAAG,MAAM,CAAC;QAM3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,IAAc,EAAE,OAAuB;QAC3D,IAAI;YACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;SAC5D;QACD,OAAO,KAAK,EAAE;YACZ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,wBAAwB,EAAE,IAAI,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC/K;IACH,CAAC;CACF;AAnBD,sCAmBC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path";
|
|
2
|
-
import type { CoerceResult } from '../types';
|
|
2
|
+
import type { CoercerContext, CoerceResult } from '../types';
|
|
3
3
|
import { SchemaValueCoercer } from '../types';
|
|
4
4
|
export declare class StringCoercer extends SchemaValueCoercer {
|
|
5
|
-
readonly sourceType: (
|
|
5
|
+
readonly sourceType: (DateConstructor | NumberConstructor | BooleanConstructor | BigIntConstructor)[];
|
|
6
6
|
readonly targetType: StringConstructor;
|
|
7
|
-
coerce(value: number | boolean | bigint | Date, path: JsonPath): CoerceResult;
|
|
7
|
+
coerce(value: number | boolean | bigint | Date, path: JsonPath, context: CoercerContext): CoerceResult;
|
|
8
8
|
}
|
|
9
9
|
export declare const stringCoercer: StringCoercer;
|
|
@@ -10,9 +10,9 @@ class StringCoercer extends types_1.SchemaValueCoercer {
|
|
|
10
10
|
this.sourceType = [Number, Boolean, BigInt, Date];
|
|
11
11
|
this.targetType = String;
|
|
12
12
|
}
|
|
13
|
-
coerce(value, path) {
|
|
13
|
+
coerce(value, path, context) {
|
|
14
14
|
if ((0, type_guards_1.isDate)(value) && !(0, type_guards_1.isValidDate)(value)) {
|
|
15
|
-
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid date', path) };
|
|
15
|
+
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid date', path, undefined, { fast: context.options.fastErrors }) };
|
|
16
16
|
}
|
|
17
17
|
return { success: true, value: value.toString() };
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/string.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA0D;AAC1D,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAArD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC7C,eAAU,GAAG,MAAM,CAAC;IAS/B,CAAC;IAPC,MAAM,CAAC,KAAuC,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"string.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/string.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA0D;AAC1D,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAArD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC7C,eAAU,GAAG,MAAM,CAAC;IAS/B,CAAC;IAPC,MAAM,CAAC,KAAuC,EAAE,IAAc,EAAE,OAAuB;QACrF,IAAI,IAAA,oBAAM,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE;YACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACtJ;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpD,CAAC;CACF;AAXD,sCAWC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -14,9 +14,9 @@ class Uint8ArrayCoercer extends types_1.SchemaValueCoercer {
|
|
|
14
14
|
this.targetType = Uint8Array;
|
|
15
15
|
}
|
|
16
16
|
coerce(value, path, { options }) {
|
|
17
|
-
const testResult = schema_1.
|
|
17
|
+
const testResult = (0, schema_1.testWithFastError)(byteNumberArraySchema, value, options, path);
|
|
18
18
|
if (!testResult.valid) {
|
|
19
|
-
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Uint8Array, Array, path, undefined, { inner: testResult.error }) };
|
|
19
|
+
return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Uint8Array, Array, path, undefined, { inner: testResult.error, fast: options.fastErrors }) };
|
|
20
20
|
}
|
|
21
21
|
return { success: true, value: Uint8Array.from(testResult.value) };
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8-array.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/uint8-array.coercer.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"uint8-array.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/uint8-array.coercer.ts"],"names":[],"mappings":";;;AACA,sCAA8C;AAC9C,kDAA8C;AAC9C,4CAAyC;AACzC,8CAA2C;AAE3C,oCAA8C;AAE9C,MAAM,qBAAqB,GAAG,IAAA,aAAK,EAAC,IAAA,eAAM,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAEzF,MAAa,iBAAkB,SAAQ,0BAAkB;IAAzD;;QACW,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,UAAU,CAAC;IAWnC,CAAC;IATC,MAAM,CAAC,KAAY,EAAE,IAAc,EAAE,EAAE,OAAO,EAAkB;QAC9D,MAAM,UAAU,GAAG,IAAA,0BAAiB,EAAC,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAElF,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;YACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACzJ;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;IACrE,CAAC;CACF;AAbD,8CAaC;AAEY,QAAA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
-
import type { Enumeration
|
|
3
|
-
import type { ConstraintResult } from '../types';
|
|
2
|
+
import type { Enumeration, OneOrMany } from "../../types";
|
|
3
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
4
4
|
import { SchemaValueConstraint } from '../types';
|
|
5
5
|
export declare class EnumerationConstraint extends SchemaValueConstraint {
|
|
6
6
|
private readonly allowedValuesSet;
|
|
7
7
|
private readonly allowedValuesString;
|
|
8
|
-
readonly enumeration:
|
|
8
|
+
readonly enumeration: Enumeration;
|
|
9
9
|
readonly suitableTypes: SchemaValueConstraint['suitableTypes'];
|
|
10
10
|
readonly expects: OneOrMany<string>;
|
|
11
|
-
constructor(enumeration:
|
|
12
|
-
validate(value: number, path: JsonPath): ConstraintResult;
|
|
11
|
+
constructor(enumeration: Enumeration);
|
|
12
|
+
validate(value: number, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
13
13
|
}
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.EnumerationConstraint = void 0;
|
|
5
|
-
const
|
|
5
|
+
const enum_1 = require("../../utils/enum");
|
|
6
6
|
const iterable_helpers_1 = require("../../utils/iterable-helpers");
|
|
7
7
|
const type_guards_1 = require("../../utils/type-guards");
|
|
8
8
|
const schema_error_1 = require("../schema.error");
|
|
9
9
|
const types_1 = require("../types");
|
|
10
|
-
const
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
11
|
class EnumerationConstraint extends types_1.SchemaValueConstraint {
|
|
12
12
|
constructor(enumeration) {
|
|
13
13
|
super();
|
|
14
14
|
this.enumeration = enumeration;
|
|
15
|
-
const allowedValues = (0, type_guards_1.isArray)(enumeration) ? enumeration : (0,
|
|
15
|
+
const allowedValues = (0, type_guards_1.isArray)(enumeration) ? enumeration : (0, enum_1.enumValues)(enumeration);
|
|
16
16
|
this.allowedValuesSet = new Set(allowedValues);
|
|
17
17
|
this.allowedValuesString = allowedValues.map((value) => ((0, type_guards_1.isString)(value) ? `"${value}"` : value)).join(', ');
|
|
18
|
-
this.suitableTypes = [...(0, iterable_helpers_1.distinct)(allowedValues.map((value) => (0,
|
|
18
|
+
this.suitableTypes = [...(0, iterable_helpers_1.distinct)(allowedValues.map((value) => (0, utils_1.getValueType)(value)))];
|
|
19
19
|
this.expects = `one of [${this.allowedValuesString}]`;
|
|
20
20
|
}
|
|
21
|
-
validate(value, path) {
|
|
21
|
+
validate(value, path, context) {
|
|
22
22
|
if (!this.allowedValuesSet.has(value)) {
|
|
23
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
|
|
23
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path, { fast: context.options.fastErrors }) };
|
|
24
24
|
}
|
|
25
25
|
return { valid: true };
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumeration.js","sourceRoot":"","sources":["../../../source/schema/constraints/enumeration.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,
|
|
1
|
+
{"version":3,"file":"enumeration.js","sourceRoot":"","sources":["../../../source/schema/constraints/enumeration.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,2CAA0C;AAC1C,mEAAoD;AACpD,yDAAwD;AACxD,kDAA8C;AAE9C,oCAAiD;AACjD,oCAAwC;AAExC,MAAa,qBAAsB,SAAQ,6BAAqB;IAQ9D,YAAY,WAAwB;QAClC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,MAAM,aAAa,GAAG,IAAA,qBAAO,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,iBAAU,EAAC,WAAW,CAAC,CAAC;QACnF,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;QAC/C,IAAI,CAAC,mBAAmB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7G,IAAI,CAAC,aAAa,GAAG,CAAC,GAAG,IAAA,2BAAQ,EAAC,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,IAAI,CAAC,OAAO,GAAG,WAAW,IAAI,CAAC,mBAAmB,GAAG,CAAC;IACxD,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc,EAAE,OAA0B;QAChE,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxI;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AA5BD,sDA4BC"}
|
|
@@ -2,7 +2,7 @@ import type { JsonPath } from "../../json-path/json-path";
|
|
|
2
2
|
import type { Decorator } from "../../reflection";
|
|
3
3
|
import type { OneOrMany } from "../../types";
|
|
4
4
|
import { SchemaError } from '../schema.error';
|
|
5
|
-
import type { ConstraintResult } from '../types';
|
|
5
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
6
6
|
import { SchemaValueConstraint } from '../types';
|
|
7
7
|
export declare type GenericConstraintResult = {
|
|
8
8
|
success: true;
|
|
@@ -17,6 +17,6 @@ export declare class GenericConstraint<T> extends SchemaValueConstraint {
|
|
|
17
17
|
readonly expects: OneOrMany<string>;
|
|
18
18
|
readonly constraintFunction: GenericConstraintFunction<T>;
|
|
19
19
|
constructor(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>);
|
|
20
|
-
validate(value: T, path: JsonPath): ConstraintResult;
|
|
20
|
+
validate(value: T, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
21
21
|
}
|
|
22
22
|
export declare function Constraint<T>(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>): Decorator<'property' | 'accessor'>;
|
|
@@ -13,12 +13,12 @@ class GenericConstraint extends types_1.SchemaValueConstraint {
|
|
|
13
13
|
this.constraintFunction = constraintFunction;
|
|
14
14
|
this.expects = expects;
|
|
15
15
|
}
|
|
16
|
-
validate(value, path) {
|
|
16
|
+
validate(value, path, context) {
|
|
17
17
|
const result = this.constraintFunction(value, path);
|
|
18
18
|
if ((0, type_guards_1.isBoolean)(result)) {
|
|
19
19
|
return result
|
|
20
20
|
? { valid: true }
|
|
21
|
-
: { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, 'invalid value', path) };
|
|
21
|
+
: { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, 'invalid value', path, { fast: context.options.fastErrors }) };
|
|
22
22
|
}
|
|
23
23
|
return result;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../source/schema/constraints/generic.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAKzD,yDAAgD;AAChD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAQjD,MAAa,iBAAqB,SAAQ,6BAAqB;IAK7D,YAAY,kBAAgD,EAAE,UAA6B,aAAa;QACtG,KAAK,EAAE,CAAC;QALD,kBAAa,GAAG,MAAM,CAAC;QAO9B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,KAAQ,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../source/schema/constraints/generic.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAKzD,yDAAgD;AAChD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAQjD,MAAa,iBAAqB,SAAQ,6BAAqB;IAK7D,YAAY,kBAAgD,EAAE,UAA6B,aAAa;QACtG,KAAK,EAAE,CAAC;QALD,kBAAa,GAAG,MAAM,CAAC;QAO9B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,KAAQ,EAAE,IAAc,EAAE,OAA0B;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAEpD,IAAI,IAAA,uBAAS,EAAC,MAAM,CAAC,EAAE;YACrB,OAAO,MAAM;gBACX,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;gBACjB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACpI;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAvBD,8CAuBC;AAED,SAAgB,UAAU,CAAI,kBAAgD,EAAE,OAA2B;IACzG,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACtE,OAAO,IAAA,iDAAoC,EAAC,UAAU,CAAC,CAAC;AAC1D,CAAC;AAHD,gCAGC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
2
|
import type { Decorator } from "../../reflection";
|
|
3
|
-
import type { ConstraintResult } from '../types';
|
|
3
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
4
4
|
import { SchemaValueConstraint } from '../types';
|
|
5
5
|
export declare class IntegerConstraint extends SchemaValueConstraint {
|
|
6
6
|
readonly suitableTypes: NumberConstructor;
|
|
7
7
|
readonly expects: string;
|
|
8
8
|
constructor();
|
|
9
|
-
validate(value: number, path: JsonPath): ConstraintResult;
|
|
9
|
+
validate(value: number, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
10
10
|
}
|
|
11
11
|
export declare const integerConstraint: IntegerConstraint;
|
|
12
12
|
export declare function Integer(): Decorator<'property' | 'accessor'>;
|
|
@@ -11,9 +11,9 @@ class IntegerConstraint extends types_1.SchemaValueConstraint {
|
|
|
11
11
|
this.suitableTypes = Number;
|
|
12
12
|
this.expects = 'an integer';
|
|
13
13
|
}
|
|
14
|
-
validate(value, path) {
|
|
14
|
+
validate(value, path, context) {
|
|
15
15
|
if (!Number.isInteger(value)) {
|
|
16
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
|
|
16
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path, { fast: context.options.fastErrors }) };
|
|
17
17
|
}
|
|
18
18
|
return { valid: true };
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integer.js","sourceRoot":"","sources":["../../../source/schema/constraints/integer.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAI1D;QACE,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9B,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"integer.js","sourceRoot":"","sources":["../../../source/schema/constraints/integer.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAI1D;QACE,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9B,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc,EAAE,OAA0B;QAChE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;YAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxI;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAjBD,8CAiBC;AAEY,QAAA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAEzD,SAAgB,OAAO;IACrB,OAAO,IAAA,4CAAoC,EAAC,yBAAiB,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC;AAFD,0BAEC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
-
import type { ConstraintResult } from '../types';
|
|
2
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
3
3
|
import { SchemaValueConstraint } from '../types';
|
|
4
4
|
export declare class LiteralConstraint extends SchemaValueConstraint {
|
|
5
5
|
readonly literal: any;
|
|
6
6
|
readonly suitableTypes: SchemaValueConstraint['suitableTypes'];
|
|
7
7
|
readonly expects: string;
|
|
8
8
|
constructor(literal: any);
|
|
9
|
-
validate(value: any, path: JsonPath): ConstraintResult;
|
|
9
|
+
validate(value: any, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
10
10
|
}
|
|
@@ -14,10 +14,10 @@ class LiteralConstraint extends types_1.SchemaValueConstraint {
|
|
|
14
14
|
const literalName = (0, type_guards_1.isPrimitive)(literal) ? String(literal) : (0, utils_1.getValueTypeName)(this.suitableTypes);
|
|
15
15
|
this.expects = `literal ${literalName}`;
|
|
16
16
|
}
|
|
17
|
-
validate(value, path) {
|
|
17
|
+
validate(value, path, context) {
|
|
18
18
|
if (value !== this.literal) {
|
|
19
19
|
const valueType = (0, utils_1.getValueType)(value);
|
|
20
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, (0, utils_1.getValueTypeName)(valueType), path) };
|
|
20
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, (0, utils_1.getValueTypeName)(valueType), path, { fast: context.options.fastErrors }) };
|
|
21
21
|
}
|
|
22
22
|
return { valid: true };
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal.js","sourceRoot":"","sources":["../../../source/schema/constraints/literal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAkD;AAClD,kDAA8C;AAE9C,oCAAiD;AACjD,oCAA0D;AAE1D,MAAa,iBAAkB,SAAQ,6BAAqB;IAK1D,YAAY,OAAY;QACtB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,aAAa,GAAG,IAAA,oBAAY,EAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,WAAW,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,wBAAgB,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClG,IAAI,CAAC,OAAO,GAAG,WAAW,WAAW,EAAE,CAAC;IAC1C,CAAC;IAED,QAAQ,CAAC,KAAU,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"literal.js","sourceRoot":"","sources":["../../../source/schema/constraints/literal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAkD;AAClD,kDAA8C;AAE9C,oCAAiD;AACjD,oCAA0D;AAE1D,MAAa,iBAAkB,SAAQ,6BAAqB;IAK1D,YAAY,OAAY;QACtB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,aAAa,GAAG,IAAA,oBAAY,EAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,WAAW,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,wBAAgB,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClG,IAAI,CAAC,OAAO,GAAG,WAAW,WAAW,EAAE,CAAC;IAC1C,CAAC;IAED,QAAQ,CAAC,KAAU,EAAE,IAAc,EAAE,OAA0B;QAC7D,IAAI,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE;YAC1B,MAAM,SAAS,GAAG,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;YACtC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAA,wBAAgB,EAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACnJ;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAvBD,8CAuBC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
2
|
import type { Decorator } from "../../reflection";
|
|
3
|
-
import type { ConstraintResult } from '../types';
|
|
3
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
4
4
|
import { SchemaValueConstraint } from '../types';
|
|
5
5
|
export declare class MaximumDateConstraint extends SchemaValueConstraint {
|
|
6
6
|
private readonly maximum;
|
|
7
7
|
readonly suitableTypes: NumberConstructor;
|
|
8
8
|
readonly expects: string;
|
|
9
9
|
constructor(maximum: Date | number);
|
|
10
|
-
validate(value: Date, path: JsonPath): ConstraintResult;
|
|
10
|
+
validate(value: Date, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
11
11
|
}
|
|
12
12
|
export declare function MaximumDate(maximum: number): Decorator<'property' | 'accessor'>;
|
|
@@ -14,9 +14,9 @@ class MaximumDateConstraint extends types_1.SchemaValueConstraint {
|
|
|
14
14
|
this.expects = `<= ${this.maximum.toISOString()}`;
|
|
15
15
|
(0, type_guards_1.assertValidDate)(this.maximum);
|
|
16
16
|
}
|
|
17
|
-
validate(value, path) {
|
|
17
|
+
validate(value, path, context) {
|
|
18
18
|
if (value > this.maximum) {
|
|
19
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path) };
|
|
19
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path, { fast: context.options.fastErrors }) };
|
|
20
20
|
}
|
|
21
21
|
return { valid: true };
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maximum-date.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum-date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAgE;AAChE,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,qBAAsB,SAAQ,6BAAqB;IAM9D,YAAY,OAAsB;QAChC,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,IAAA,sBAAQ,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QAElD,IAAA,6BAAe,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ,CAAC,KAAW,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"maximum-date.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum-date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAgE;AAChE,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,qBAAsB,SAAQ,6BAAqB;IAM9D,YAAY,OAAsB;QAChC,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,IAAA,sBAAQ,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QAElD,IAAA,6BAAe,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ,CAAC,KAAW,EAAE,IAAc,EAAE,OAA0B;QAC9D,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC3I;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAtBD,sDAsBC;AAED,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAO,IAAA,iDAAoC,EAAC,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAClH,CAAC;AAFD,kCAEC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
2
|
import type { Decorator } from "../../reflection";
|
|
3
|
-
import type { ConstraintResult } from '../types';
|
|
3
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
4
4
|
import { SchemaValueConstraint } from '../types';
|
|
5
5
|
export declare class MaximumLengthConstraint extends SchemaValueConstraint {
|
|
6
6
|
private readonly maximumLength;
|
|
7
|
-
readonly suitableTypes: (ArrayConstructor |
|
|
7
|
+
readonly suitableTypes: (ArrayConstructor | Uint8ArrayConstructor | StringConstructor | Int8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | BigInt64ArrayConstructor | BigUint64ArrayConstructor | ArrayBufferConstructor)[];
|
|
8
8
|
readonly expects: string;
|
|
9
9
|
constructor(maximumLength: number);
|
|
10
|
-
validate(value: string, path: JsonPath): ConstraintResult;
|
|
10
|
+
validate(value: string, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
11
11
|
}
|
|
12
12
|
export declare function MaximumLength(maximumLength: number): Decorator<'property' | 'accessor'>;
|
|
@@ -13,10 +13,10 @@ class MaximumLengthConstraint extends types_1.SchemaValueConstraint {
|
|
|
13
13
|
this.maximumLength = maximumLength;
|
|
14
14
|
this.expects = `a maximum length of ${this.maximumLength}`;
|
|
15
15
|
}
|
|
16
|
-
validate(value, path) {
|
|
16
|
+
validate(value, path, context) {
|
|
17
17
|
const length = (0, type_guards_1.isArrayBuffer)(value) ? value.byteLength : value.length;
|
|
18
18
|
if (length > this.maximumLength) {
|
|
19
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `a length of ${length}`, path) };
|
|
19
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `a length of ${length}`, path, { fast: context.options.fastErrors }) };
|
|
20
20
|
}
|
|
21
21
|
return { valid: true };
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maximum-length.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAoD;AACpD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,uBAAwB,SAAQ,6BAAqB;IAMhE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QAM3M,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,uBAAuB,IAAI,CAAC,aAAa,EAAE,CAAC;IAC7D,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"maximum-length.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAoD;AACpD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,uBAAwB,SAAQ,6BAAqB;IAMhE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QAM3M,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,uBAAuB,IAAI,CAAC,aAAa,EAAE,CAAC;IAC7D,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc,EAAE,OAA0B;QAChE,MAAM,MAAM,GAAG,IAAA,2BAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;QAEtE,IAAI,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC/I;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAtBD,0DAsBC;AAED,SAAgB,aAAa,CAAC,aAAqB;IACjD,OAAO,IAAA,4CAAoC,EAAC,IAAI,uBAAuB,CAAC,aAAa,CAAC,CAAC,CAAC;AAC1F,CAAC;AAFD,sCAEC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
2
|
import type { Decorator } from "../../reflection";
|
|
3
|
-
import type { ConstraintResult } from '../types';
|
|
3
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
4
4
|
import { SchemaValueConstraint } from '../types';
|
|
5
5
|
export declare class MaximumConstraint extends SchemaValueConstraint {
|
|
6
6
|
private readonly maximum;
|
|
7
7
|
readonly suitableTypes: NumberConstructor;
|
|
8
8
|
readonly expects: string;
|
|
9
9
|
constructor(maximum: number);
|
|
10
|
-
validate(value: number, path: JsonPath): ConstraintResult;
|
|
10
|
+
validate(value: number, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
11
11
|
}
|
|
12
12
|
export declare function Maximum(maximum: number): Decorator<'property' | 'accessor'>;
|
|
@@ -12,9 +12,9 @@ class MaximumConstraint extends types_1.SchemaValueConstraint {
|
|
|
12
12
|
this.maximum = maximum;
|
|
13
13
|
this.expects = `<= ${this.maximum}`;
|
|
14
14
|
}
|
|
15
|
-
validate(value, path) {
|
|
15
|
+
validate(value, path, context) {
|
|
16
16
|
if (value > this.maximum) {
|
|
17
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
|
|
17
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path, { fast: context.options.fastErrors }) };
|
|
18
18
|
}
|
|
19
19
|
return { valid: true };
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maximum.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAM1D,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"maximum.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAM1D,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc,EAAE,OAA0B;QAChE,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxI;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AApBD,8CAoBC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAA,iDAAoC,EAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC9G,CAAC;AAFD,0BAEC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
2
|
import type { Decorator } from "../../reflection";
|
|
3
|
-
import type { ConstraintResult } from '../types';
|
|
3
|
+
import type { ConstraintContext, ConstraintResult } from '../types';
|
|
4
4
|
import { SchemaValueConstraint } from '../types';
|
|
5
5
|
export declare class MinimumDateConstraint extends SchemaValueConstraint {
|
|
6
6
|
private readonly minimum;
|
|
7
7
|
readonly suitableTypes: NumberConstructor;
|
|
8
8
|
readonly expects: string;
|
|
9
9
|
constructor(minimum: Date | number);
|
|
10
|
-
validate(value: Date, path: JsonPath): ConstraintResult;
|
|
10
|
+
validate(value: Date, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
11
11
|
}
|
|
12
12
|
export declare function MinimumDate(minimum: number): Decorator<'property' | 'accessor'>;
|
|
@@ -14,9 +14,9 @@ class MinimumDateConstraint extends types_1.SchemaValueConstraint {
|
|
|
14
14
|
this.expects = `>= ${this.minimum.toISOString()}`;
|
|
15
15
|
(0, type_guards_1.assertValidDate)(this.minimum);
|
|
16
16
|
}
|
|
17
|
-
validate(value, path) {
|
|
17
|
+
validate(value, path, context) {
|
|
18
18
|
if (value > this.minimum) {
|
|
19
|
-
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path) };
|
|
19
|
+
return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path, { fast: context.options.fastErrors }) };
|
|
20
20
|
}
|
|
21
21
|
return { valid: true };
|
|
22
22
|
}
|