@xeno-js/shared 0.1.0
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/LICENSE +15 -0
- package/README.md +274 -0
- package/dist/application/cqrs/command/command.d.ts +8 -0
- package/dist/application/cqrs/command/command.d.ts.map +1 -0
- package/dist/application/cqrs/command/command.js +9 -0
- package/dist/application/cqrs/command/command.js.map +1 -0
- package/dist/application/cqrs/command/index.d.ts +2 -0
- package/dist/application/cqrs/command/index.d.ts.map +1 -0
- package/dist/application/cqrs/command/index.js +2 -0
- package/dist/application/cqrs/command/index.js.map +1 -0
- package/dist/application/cqrs/index.d.ts +3 -0
- package/dist/application/cqrs/index.d.ts.map +1 -0
- package/dist/application/cqrs/index.js +3 -0
- package/dist/application/cqrs/index.js.map +1 -0
- package/dist/application/cqrs/query/index.d.ts +2 -0
- package/dist/application/cqrs/query/index.d.ts.map +1 -0
- package/dist/application/cqrs/query/index.js +2 -0
- package/dist/application/cqrs/query/index.js.map +1 -0
- package/dist/application/cqrs/query/query.d.ts +9 -0
- package/dist/application/cqrs/query/query.d.ts.map +1 -0
- package/dist/application/cqrs/query/query.js +11 -0
- package/dist/application/cqrs/query/query.js.map +1 -0
- package/dist/application/index.d.ts +3 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +3 -0
- package/dist/application/index.js.map +1 -0
- package/dist/application/loggers/__tests__/base.logger.test.d.ts +2 -0
- package/dist/application/loggers/__tests__/base.logger.test.d.ts.map +1 -0
- package/dist/application/loggers/__tests__/base.logger.test.js +132 -0
- package/dist/application/loggers/__tests__/base.logger.test.js.map +1 -0
- package/dist/application/loggers/base.logger.d.ts +48 -0
- package/dist/application/loggers/base.logger.d.ts.map +1 -0
- package/dist/application/loggers/base.logger.js +68 -0
- package/dist/application/loggers/base.logger.js.map +1 -0
- package/dist/application/loggers/index.d.ts +2 -0
- package/dist/application/loggers/index.d.ts.map +1 -0
- package/dist/application/loggers/index.js +2 -0
- package/dist/application/loggers/index.js.map +1 -0
- package/dist/domain/config/auth.config.d.ts +14 -0
- package/dist/domain/config/auth.config.d.ts.map +1 -0
- package/dist/domain/config/auth.config.js +2 -0
- package/dist/domain/config/auth.config.js.map +1 -0
- package/dist/domain/config/cache.config.d.ts +92 -0
- package/dist/domain/config/cache.config.d.ts.map +1 -0
- package/dist/domain/config/cache.config.js +2 -0
- package/dist/domain/config/cache.config.js.map +1 -0
- package/dist/domain/config/db.config.d.ts +29 -0
- package/dist/domain/config/db.config.d.ts.map +1 -0
- package/dist/domain/config/db.config.js +2 -0
- package/dist/domain/config/db.config.js.map +1 -0
- package/dist/domain/config/http.config.d.ts +148 -0
- package/dist/domain/config/http.config.d.ts.map +1 -0
- package/dist/domain/config/http.config.js +2 -0
- package/dist/domain/config/http.config.js.map +1 -0
- package/dist/domain/config/index.d.ts +5 -0
- package/dist/domain/config/index.d.ts.map +1 -0
- package/dist/domain/config/index.js +2 -0
- package/dist/domain/config/index.js.map +1 -0
- package/dist/domain/config/resilience.config.d.ts +94 -0
- package/dist/domain/config/resilience.config.d.ts.map +1 -0
- package/dist/domain/config/resilience.config.js +2 -0
- package/dist/domain/config/resilience.config.js.map +1 -0
- package/dist/domain/contracts/cache/icache.contracts.d.ts +93 -0
- package/dist/domain/contracts/cache/icache.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/cache/icache.contracts.js +2 -0
- package/dist/domain/contracts/cache/icache.contracts.js.map +1 -0
- package/dist/domain/contracts/cache/ikey-builder.contracts.d.ts +34 -0
- package/dist/domain/contracts/cache/ikey-builder.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/cache/ikey-builder.contracts.js +2 -0
- package/dist/domain/contracts/cache/ikey-builder.contracts.js.map +1 -0
- package/dist/domain/contracts/cache/index.d.ts +3 -0
- package/dist/domain/contracts/cache/index.d.ts.map +1 -0
- package/dist/domain/contracts/cache/index.js +2 -0
- package/dist/domain/contracts/cache/index.js.map +1 -0
- package/dist/domain/contracts/configuration/iconfiguration.contracts.d.ts +61 -0
- package/dist/domain/contracts/configuration/iconfiguration.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/configuration/iconfiguration.contracts.js +2 -0
- package/dist/domain/contracts/configuration/iconfiguration.contracts.js.map +1 -0
- package/dist/domain/contracts/configuration/index.d.ts +2 -0
- package/dist/domain/contracts/configuration/index.d.ts.map +1 -0
- package/dist/domain/contracts/configuration/index.js +2 -0
- package/dist/domain/contracts/configuration/index.js.map +1 -0
- package/dist/domain/contracts/context/context_types/identity-context.types.d.ts +63 -0
- package/dist/domain/contracts/context/context_types/identity-context.types.d.ts.map +1 -0
- package/dist/domain/contracts/context/context_types/identity-context.types.js +2 -0
- package/dist/domain/contracts/context/context_types/identity-context.types.js.map +1 -0
- package/dist/domain/contracts/context/context_types/index.d.ts +6 -0
- package/dist/domain/contracts/context/context_types/index.d.ts.map +1 -0
- package/dist/domain/contracts/context/context_types/index.js +2 -0
- package/dist/domain/contracts/context/context_types/index.js.map +1 -0
- package/dist/domain/contracts/context/context_types/messaging-context.types.d.ts +70 -0
- package/dist/domain/contracts/context/context_types/messaging-context.types.d.ts.map +1 -0
- package/dist/domain/contracts/context/context_types/messaging-context.types.js +2 -0
- package/dist/domain/contracts/context/context_types/messaging-context.types.js.map +1 -0
- package/dist/domain/contracts/context/context_types/network-context.types.d.ts +82 -0
- package/dist/domain/contracts/context/context_types/network-context.types.d.ts.map +1 -0
- package/dist/domain/contracts/context/context_types/network-context.types.js +2 -0
- package/dist/domain/contracts/context/context_types/network-context.types.js.map +1 -0
- package/dist/domain/contracts/context/context_types/request-context.types.d.ts +48 -0
- package/dist/domain/contracts/context/context_types/request-context.types.d.ts.map +1 -0
- package/dist/domain/contracts/context/context_types/request-context.types.js +2 -0
- package/dist/domain/contracts/context/context_types/request-context.types.js.map +1 -0
- package/dist/domain/contracts/context/context_types/tracing-context.types.d.ts +54 -0
- package/dist/domain/contracts/context/context_types/tracing-context.types.d.ts.map +1 -0
- package/dist/domain/contracts/context/context_types/tracing-context.types.js +2 -0
- package/dist/domain/contracts/context/context_types/tracing-context.types.js.map +1 -0
- package/dist/domain/contracts/context/index.d.ts +3 -0
- package/dist/domain/contracts/context/index.d.ts.map +1 -0
- package/dist/domain/contracts/context/index.js +2 -0
- package/dist/domain/contracts/context/index.js.map +1 -0
- package/dist/domain/contracts/context/irequest-context.contracts.d.ts +68 -0
- package/dist/domain/contracts/context/irequest-context.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/context/irequest-context.contracts.js +2 -0
- package/dist/domain/contracts/context/irequest-context.contracts.js.map +1 -0
- package/dist/domain/contracts/controllers/icontroller.contracts.d.ts +25 -0
- package/dist/domain/contracts/controllers/icontroller.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/controllers/icontroller.contracts.js +2 -0
- package/dist/domain/contracts/controllers/icontroller.contracts.js.map +1 -0
- package/dist/domain/contracts/controllers/index.d.ts +2 -0
- package/dist/domain/contracts/controllers/index.d.ts.map +1 -0
- package/dist/domain/contracts/controllers/index.js +2 -0
- package/dist/domain/contracts/controllers/index.js.map +1 -0
- package/dist/domain/contracts/cqrs/cqrs_types/icommand.types.d.ts +30 -0
- package/dist/domain/contracts/cqrs/cqrs_types/icommand.types.d.ts.map +1 -0
- package/dist/domain/contracts/cqrs/cqrs_types/icommand.types.js +2 -0
- package/dist/domain/contracts/cqrs/cqrs_types/icommand.types.js.map +1 -0
- package/dist/domain/contracts/cqrs/cqrs_types/index.d.ts +4 -0
- package/dist/domain/contracts/cqrs/cqrs_types/index.d.ts.map +1 -0
- package/dist/domain/contracts/cqrs/cqrs_types/index.js +2 -0
- package/dist/domain/contracts/cqrs/cqrs_types/index.js.map +1 -0
- package/dist/domain/contracts/cqrs/cqrs_types/iquery.types.d.ts +32 -0
- package/dist/domain/contracts/cqrs/cqrs_types/iquery.types.d.ts.map +1 -0
- package/dist/domain/contracts/cqrs/cqrs_types/iquery.types.js +2 -0
- package/dist/domain/contracts/cqrs/cqrs_types/iquery.types.js.map +1 -0
- package/dist/domain/contracts/cqrs/cqrs_types/irequest.types.d.ts +30 -0
- package/dist/domain/contracts/cqrs/cqrs_types/irequest.types.d.ts.map +1 -0
- package/dist/domain/contracts/cqrs/cqrs_types/irequest.types.js +2 -0
- package/dist/domain/contracts/cqrs/cqrs_types/irequest.types.js.map +1 -0
- package/dist/domain/contracts/cqrs/ihandler.contracts.d.ts +30 -0
- package/dist/domain/contracts/cqrs/ihandler.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/cqrs/ihandler.contracts.js +2 -0
- package/dist/domain/contracts/cqrs/ihandler.contracts.js.map +1 -0
- package/dist/domain/contracts/cqrs/imediator.contracts.d.ts +41 -0
- package/dist/domain/contracts/cqrs/imediator.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/cqrs/imediator.contracts.js +2 -0
- package/dist/domain/contracts/cqrs/imediator.contracts.js.map +1 -0
- package/dist/domain/contracts/cqrs/index.d.ts +5 -0
- package/dist/domain/contracts/cqrs/index.d.ts.map +1 -0
- package/dist/domain/contracts/cqrs/index.js +2 -0
- package/dist/domain/contracts/cqrs/index.js.map +1 -0
- package/dist/domain/contracts/cqrs/ipipeline-behavior.contracts.d.ts +42 -0
- package/dist/domain/contracts/cqrs/ipipeline-behavior.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/cqrs/ipipeline-behavior.contracts.js +2 -0
- package/dist/domain/contracts/cqrs/ipipeline-behavior.contracts.js.map +1 -0
- package/dist/domain/contracts/datasources/index.d.ts +4 -0
- package/dist/domain/contracts/datasources/index.d.ts.map +1 -0
- package/dist/domain/contracts/datasources/index.js +2 -0
- package/dist/domain/contracts/datasources/index.js.map +1 -0
- package/dist/domain/contracts/datasources/iread-datasource.contracts.d.ts +41 -0
- package/dist/domain/contracts/datasources/iread-datasource.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/datasources/iread-datasource.contracts.js +2 -0
- package/dist/domain/contracts/datasources/iread-datasource.contracts.js.map +1 -0
- package/dist/domain/contracts/datasources/iremote-datasource.contracts.d.ts +73 -0
- package/dist/domain/contracts/datasources/iremote-datasource.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/datasources/iremote-datasource.contracts.js +2 -0
- package/dist/domain/contracts/datasources/iremote-datasource.contracts.js.map +1 -0
- package/dist/domain/contracts/datasources/iwrite-datasource.contracts.d.ts +82 -0
- package/dist/domain/contracts/datasources/iwrite-datasource.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/datasources/iwrite-datasource.contracts.js +2 -0
- package/dist/domain/contracts/datasources/iwrite-datasource.contracts.js.map +1 -0
- package/dist/domain/contracts/disposables/idisposable.contracts.d.ts +23 -0
- package/dist/domain/contracts/disposables/idisposable.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/disposables/idisposable.contracts.js +6 -0
- package/dist/domain/contracts/disposables/idisposable.contracts.js.map +1 -0
- package/dist/domain/contracts/disposables/index.d.ts +2 -0
- package/dist/domain/contracts/disposables/index.d.ts.map +1 -0
- package/dist/domain/contracts/disposables/index.js +2 -0
- package/dist/domain/contracts/disposables/index.js.map +1 -0
- package/dist/domain/contracts/factories/ifactory.contracts.d.ts +29 -0
- package/dist/domain/contracts/factories/ifactory.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/factories/ifactory.contracts.js +2 -0
- package/dist/domain/contracts/factories/ifactory.contracts.js.map +1 -0
- package/dist/domain/contracts/factories/index.d.ts +2 -0
- package/dist/domain/contracts/factories/index.d.ts.map +1 -0
- package/dist/domain/contracts/factories/index.js +2 -0
- package/dist/domain/contracts/factories/index.js.map +1 -0
- package/dist/domain/contracts/gate_keepers/igate-keeper.contracts.d.ts +27 -0
- package/dist/domain/contracts/gate_keepers/igate-keeper.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/gate_keepers/igate-keeper.contracts.js +2 -0
- package/dist/domain/contracts/gate_keepers/igate-keeper.contracts.js.map +1 -0
- package/dist/domain/contracts/gate_keepers/index.d.ts +2 -0
- package/dist/domain/contracts/gate_keepers/index.d.ts.map +1 -0
- package/dist/domain/contracts/gate_keepers/index.js +2 -0
- package/dist/domain/contracts/gate_keepers/index.js.map +1 -0
- package/dist/domain/contracts/http/iallow-origin.contracts.d.ts +1 -0
- package/dist/domain/contracts/http/iallow-origin.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/http/iallow-origin.contracts.js +2 -0
- package/dist/domain/contracts/http/iallow-origin.contracts.js.map +1 -0
- package/dist/domain/contracts/http/ihttp-client.contracts.d.ts +81 -0
- package/dist/domain/contracts/http/ihttp-client.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/http/ihttp-client.contracts.js +2 -0
- package/dist/domain/contracts/http/ihttp-client.contracts.js.map +1 -0
- package/dist/domain/contracts/http/index.d.ts +2 -0
- package/dist/domain/contracts/http/index.d.ts.map +1 -0
- package/dist/domain/contracts/http/index.js +2 -0
- package/dist/domain/contracts/http/index.js.map +1 -0
- package/dist/domain/contracts/idempotency/idempotency-store.contracts.d.ts +71 -0
- package/dist/domain/contracts/idempotency/idempotency-store.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/idempotency/idempotency-store.contracts.js +2 -0
- package/dist/domain/contracts/idempotency/idempotency-store.contracts.js.map +1 -0
- package/dist/domain/contracts/idempotency/index.d.ts +2 -0
- package/dist/domain/contracts/idempotency/index.d.ts.map +1 -0
- package/dist/domain/contracts/idempotency/index.js +2 -0
- package/dist/domain/contracts/idempotency/index.js.map +1 -0
- package/dist/domain/contracts/index.d.ts +22 -0
- package/dist/domain/contracts/index.d.ts.map +1 -0
- package/dist/domain/contracts/index.js +2 -0
- package/dist/domain/contracts/index.js.map +1 -0
- package/dist/domain/contracts/loggers/ilogger-client.contracts.d.ts +27 -0
- package/dist/domain/contracts/loggers/ilogger-client.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/loggers/ilogger-client.contracts.js +2 -0
- package/dist/domain/contracts/loggers/ilogger-client.contracts.js.map +1 -0
- package/dist/domain/contracts/loggers/ilogger.contracts.d.ts +62 -0
- package/dist/domain/contracts/loggers/ilogger.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/loggers/ilogger.contracts.js +2 -0
- package/dist/domain/contracts/loggers/ilogger.contracts.js.map +1 -0
- package/dist/domain/contracts/loggers/index.d.ts +3 -0
- package/dist/domain/contracts/loggers/index.d.ts.map +1 -0
- package/dist/domain/contracts/loggers/index.js +2 -0
- package/dist/domain/contracts/loggers/index.js.map +1 -0
- package/dist/domain/contracts/mappers/ibase-mapper.contracts.d.ts +33 -0
- package/dist/domain/contracts/mappers/ibase-mapper.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/mappers/ibase-mapper.contracts.js +2 -0
- package/dist/domain/contracts/mappers/ibase-mapper.contracts.js.map +1 -0
- package/dist/domain/contracts/mappers/imapper.contracts.d.ts +53 -0
- package/dist/domain/contracts/mappers/imapper.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/mappers/imapper.contracts.js +2 -0
- package/dist/domain/contracts/mappers/imapper.contracts.js.map +1 -0
- package/dist/domain/contracts/mappers/index.d.ts +3 -0
- package/dist/domain/contracts/mappers/index.d.ts.map +1 -0
- package/dist/domain/contracts/mappers/index.js +2 -0
- package/dist/domain/contracts/mappers/index.js.map +1 -0
- package/dist/domain/contracts/middlewares/imiddleware.contracts.d.ts +34 -0
- package/dist/domain/contracts/middlewares/imiddleware.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/middlewares/imiddleware.contracts.js +2 -0
- package/dist/domain/contracts/middlewares/imiddleware.contracts.js.map +1 -0
- package/dist/domain/contracts/middlewares/index.d.ts +2 -0
- package/dist/domain/contracts/middlewares/index.d.ts.map +1 -0
- package/dist/domain/contracts/middlewares/index.js +2 -0
- package/dist/domain/contracts/middlewares/index.js.map +1 -0
- package/dist/domain/contracts/policies/index.d.ts +2 -0
- package/dist/domain/contracts/policies/index.d.ts.map +1 -0
- package/dist/domain/contracts/policies/index.js +2 -0
- package/dist/domain/contracts/policies/index.js.map +1 -0
- package/dist/domain/contracts/policies/ipolicy-registry.contracts.d.ts +38 -0
- package/dist/domain/contracts/policies/ipolicy-registry.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/policies/ipolicy-registry.contracts.js +2 -0
- package/dist/domain/contracts/policies/ipolicy-registry.contracts.js.map +1 -0
- package/dist/domain/contracts/repositories/index.d.ts +3 -0
- package/dist/domain/contracts/repositories/index.d.ts.map +1 -0
- package/dist/domain/contracts/repositories/index.js +2 -0
- package/dist/domain/contracts/repositories/index.js.map +1 -0
- package/dist/domain/contracts/repositories/iread-dao.contracts.d.ts +41 -0
- package/dist/domain/contracts/repositories/iread-dao.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/repositories/iread-dao.contracts.js +2 -0
- package/dist/domain/contracts/repositories/iread-dao.contracts.js.map +1 -0
- package/dist/domain/contracts/repositories/irepository.contracts.d.ts +95 -0
- package/dist/domain/contracts/repositories/irepository.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/repositories/irepository.contracts.js +2 -0
- package/dist/domain/contracts/repositories/irepository.contracts.js.map +1 -0
- package/dist/domain/contracts/services/auth/iauth-service.contracts.d.ts +71 -0
- package/dist/domain/contracts/services/auth/iauth-service.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/services/auth/iauth-service.contracts.js +2 -0
- package/dist/domain/contracts/services/auth/iauth-service.contracts.js.map +1 -0
- package/dist/domain/contracts/services/auth/index.d.ts +2 -0
- package/dist/domain/contracts/services/auth/index.d.ts.map +1 -0
- package/dist/domain/contracts/services/auth/index.js +2 -0
- package/dist/domain/contracts/services/auth/index.js.map +1 -0
- package/dist/domain/contracts/services/concurrency/concurrency-service.contracts.d.ts +25 -0
- package/dist/domain/contracts/services/concurrency/concurrency-service.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/services/concurrency/concurrency-service.contracts.js +2 -0
- package/dist/domain/contracts/services/concurrency/concurrency-service.contracts.js.map +1 -0
- package/dist/domain/contracts/services/concurrency/index.d.ts +2 -0
- package/dist/domain/contracts/services/concurrency/index.d.ts.map +1 -0
- package/dist/domain/contracts/services/concurrency/index.js +2 -0
- package/dist/domain/contracts/services/concurrency/index.js.map +1 -0
- package/dist/domain/contracts/services/extractors/iextractor-service.contracts.d.ts +24 -0
- package/dist/domain/contracts/services/extractors/iextractor-service.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/services/extractors/iextractor-service.contracts.js +2 -0
- package/dist/domain/contracts/services/extractors/iextractor-service.contracts.js.map +1 -0
- package/dist/domain/contracts/services/extractors/index.d.ts +2 -0
- package/dist/domain/contracts/services/extractors/index.d.ts.map +1 -0
- package/dist/domain/contracts/services/extractors/index.js +2 -0
- package/dist/domain/contracts/services/extractors/index.js.map +1 -0
- package/dist/domain/contracts/services/index.d.ts +6 -0
- package/dist/domain/contracts/services/index.d.ts.map +1 -0
- package/dist/domain/contracts/services/index.js +2 -0
- package/dist/domain/contracts/services/index.js.map +1 -0
- package/dist/domain/contracts/services/resiliences/index.d.ts +2 -0
- package/dist/domain/contracts/services/resiliences/index.d.ts.map +1 -0
- package/dist/domain/contracts/services/resiliences/index.js +2 -0
- package/dist/domain/contracts/services/resiliences/index.js.map +1 -0
- package/dist/domain/contracts/services/resiliences/iresilience-service.contracts.d.ts +26 -0
- package/dist/domain/contracts/services/resiliences/iresilience-service.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/services/resiliences/iresilience-service.contracts.js +2 -0
- package/dist/domain/contracts/services/resiliences/iresilience-service.contracts.js.map +1 -0
- package/dist/domain/contracts/services/validators/index.d.ts +2 -0
- package/dist/domain/contracts/services/validators/index.d.ts.map +1 -0
- package/dist/domain/contracts/services/validators/index.js +2 -0
- package/dist/domain/contracts/services/validators/index.js.map +1 -0
- package/dist/domain/contracts/services/validators/ivalidator-service.contracts.d.ts +38 -0
- package/dist/domain/contracts/services/validators/ivalidator-service.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/services/validators/ivalidator-service.contracts.js +2 -0
- package/dist/domain/contracts/services/validators/ivalidator-service.contracts.js.map +1 -0
- package/dist/domain/contracts/specifications/index.d.ts +2 -0
- package/dist/domain/contracts/specifications/index.d.ts.map +1 -0
- package/dist/domain/contracts/specifications/index.js +2 -0
- package/dist/domain/contracts/specifications/index.js.map +1 -0
- package/dist/domain/contracts/specifications/ispecification.contracts.d.ts +58 -0
- package/dist/domain/contracts/specifications/ispecification.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/specifications/ispecification.contracts.js +2 -0
- package/dist/domain/contracts/specifications/ispecification.contracts.js.map +1 -0
- package/dist/domain/contracts/storage/index.d.ts +2 -0
- package/dist/domain/contracts/storage/index.d.ts.map +1 -0
- package/dist/domain/contracts/storage/index.js +2 -0
- package/dist/domain/contracts/storage/index.js.map +1 -0
- package/dist/domain/contracts/storage/istorage.contracts.d.ts +6 -0
- package/dist/domain/contracts/storage/istorage.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/storage/istorage.contracts.js +2 -0
- package/dist/domain/contracts/storage/istorage.contracts.js.map +1 -0
- package/dist/domain/contracts/strategies/index.d.ts +2 -0
- package/dist/domain/contracts/strategies/index.d.ts.map +1 -0
- package/dist/domain/contracts/strategies/index.js +2 -0
- package/dist/domain/contracts/strategies/index.js.map +1 -0
- package/dist/domain/contracts/strategies/istrategy.contracts.d.ts +25 -0
- package/dist/domain/contracts/strategies/istrategy.contracts.d.ts.map +1 -0
- package/dist/domain/contracts/strategies/istrategy.contracts.js +2 -0
- package/dist/domain/contracts/strategies/istrategy.contracts.js.map +1 -0
- package/dist/domain/contracts/transaction/index.d.ts +3 -0
- package/dist/domain/contracts/transaction/index.d.ts.map +1 -0
- package/dist/domain/contracts/transaction/index.js +2 -0
- package/dist/domain/contracts/transaction/index.js.map +1 -0
- package/dist/domain/contracts/transaction/itransaction-state.types.d.ts +44 -0
- package/dist/domain/contracts/transaction/itransaction-state.types.d.ts.map +1 -0
- package/dist/domain/contracts/transaction/itransaction-state.types.js +2 -0
- package/dist/domain/contracts/transaction/itransaction-state.types.js.map +1 -0
- package/dist/domain/contracts/transaction/iunit-of-work.types.d.ts +25 -0
- package/dist/domain/contracts/transaction/iunit-of-work.types.d.ts.map +1 -0
- package/dist/domain/contracts/transaction/iunit-of-work.types.js +2 -0
- package/dist/domain/contracts/transaction/iunit-of-work.types.js.map +1 -0
- package/dist/domain/entities/__tests__/entity.test.d.ts +2 -0
- package/dist/domain/entities/__tests__/entity.test.d.ts.map +1 -0
- package/dist/domain/entities/__tests__/entity.test.js +53 -0
- package/dist/domain/entities/__tests__/entity.test.js.map +1 -0
- package/dist/domain/entities/entity.d.ts +43 -0
- package/dist/domain/entities/entity.d.ts.map +1 -0
- package/dist/domain/entities/entity.js +55 -0
- package/dist/domain/entities/entity.js.map +1 -0
- package/dist/domain/entities/ientity.contracts.d.ts +43 -0
- package/dist/domain/entities/ientity.contracts.d.ts.map +1 -0
- package/dist/domain/entities/ientity.contracts.js +2 -0
- package/dist/domain/entities/ientity.contracts.js.map +1 -0
- package/dist/domain/entities/index.d.ts +3 -0
- package/dist/domain/entities/index.d.ts.map +1 -0
- package/dist/domain/entities/index.js +2 -0
- package/dist/domain/entities/index.js.map +1 -0
- package/dist/domain/errors/__tests__/app-error.test.d.ts +2 -0
- package/dist/domain/errors/__tests__/app-error.test.d.ts.map +1 -0
- package/dist/domain/errors/__tests__/app-error.test.js +94 -0
- package/dist/domain/errors/__tests__/app-error.test.js.map +1 -0
- package/dist/domain/errors/app-error.d.ts +243 -0
- package/dist/domain/errors/app-error.d.ts.map +1 -0
- package/dist/domain/errors/app-error.js +259 -0
- package/dist/domain/errors/app-error.js.map +1 -0
- package/dist/domain/errors/index.d.ts +2 -0
- package/dist/domain/errors/index.d.ts.map +1 -0
- package/dist/domain/errors/index.js +2 -0
- package/dist/domain/errors/index.js.map +1 -0
- package/dist/domain/index.d.ts +8 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +6 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/results/__tests__/result.test.d.ts +2 -0
- package/dist/domain/results/__tests__/result.test.d.ts.map +1 -0
- package/dist/domain/results/__tests__/result.test.js +109 -0
- package/dist/domain/results/__tests__/result.test.js.map +1 -0
- package/dist/domain/results/index.d.ts +3 -0
- package/dist/domain/results/index.d.ts.map +1 -0
- package/dist/domain/results/index.js +2 -0
- package/dist/domain/results/index.js.map +1 -0
- package/dist/domain/results/result.d.ts +125 -0
- package/dist/domain/results/result.d.ts.map +1 -0
- package/dist/domain/results/result.js +144 -0
- package/dist/domain/results/result.js.map +1 -0
- package/dist/domain/results/result.types.d.ts +15 -0
- package/dist/domain/results/result.types.d.ts.map +1 -0
- package/dist/domain/results/result.types.js +2 -0
- package/dist/domain/results/result.types.js.map +1 -0
- package/dist/domain/unique_id/__tests__/unique-id.test.d.ts +2 -0
- package/dist/domain/unique_id/__tests__/unique-id.test.d.ts.map +1 -0
- package/dist/domain/unique_id/__tests__/unique-id.test.js +29 -0
- package/dist/domain/unique_id/__tests__/unique-id.test.js.map +1 -0
- package/dist/domain/unique_id/index.d.ts +2 -0
- package/dist/domain/unique_id/index.d.ts.map +1 -0
- package/dist/domain/unique_id/index.js +2 -0
- package/dist/domain/unique_id/index.js.map +1 -0
- package/dist/domain/unique_id/unique-id.d.ts +72 -0
- package/dist/domain/unique_id/unique-id.d.ts.map +1 -0
- package/dist/domain/unique_id/unique-id.js +87 -0
- package/dist/domain/unique_id/unique-id.js.map +1 -0
- package/dist/domain/value_objects/__tests__/value-object.test.d.ts +2 -0
- package/dist/domain/value_objects/__tests__/value-object.test.d.ts.map +1 -0
- package/dist/domain/value_objects/__tests__/value-object.test.js +43 -0
- package/dist/domain/value_objects/__tests__/value-object.test.js.map +1 -0
- package/dist/domain/value_objects/index.d.ts +3 -0
- package/dist/domain/value_objects/index.d.ts.map +1 -0
- package/dist/domain/value_objects/index.js +2 -0
- package/dist/domain/value_objects/index.js.map +1 -0
- package/dist/domain/value_objects/ivalue-object.contracts.d.ts +46 -0
- package/dist/domain/value_objects/ivalue-object.contracts.d.ts.map +1 -0
- package/dist/domain/value_objects/ivalue-object.contracts.js +2 -0
- package/dist/domain/value_objects/ivalue-object.contracts.js.map +1 -0
- package/dist/domain/value_objects/value-object.d.ts +26 -0
- package/dist/domain/value_objects/value-object.d.ts.map +1 -0
- package/dist/domain/value_objects/value-object.js +37 -0
- package/dist/domain/value_objects/value-object.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/auth/__tests__/supabase-auth.service.test.d.ts +2 -0
- package/dist/infrastructure/auth/__tests__/supabase-auth.service.test.d.ts.map +1 -0
- package/dist/infrastructure/auth/__tests__/supabase-auth.service.test.js +128 -0
- package/dist/infrastructure/auth/__tests__/supabase-auth.service.test.js.map +1 -0
- package/dist/infrastructure/auth/index.d.ts +3 -0
- package/dist/infrastructure/auth/index.d.ts.map +1 -0
- package/dist/infrastructure/auth/index.js +3 -0
- package/dist/infrastructure/auth/index.js.map +1 -0
- package/dist/infrastructure/auth/storage/cookie.storage.d.ts +4 -0
- package/dist/infrastructure/auth/storage/cookie.storage.d.ts.map +1 -0
- package/dist/infrastructure/auth/storage/cookie.storage.js +31 -0
- package/dist/infrastructure/auth/storage/cookie.storage.js.map +1 -0
- package/dist/infrastructure/auth/storage/index.d.ts +4 -0
- package/dist/infrastructure/auth/storage/index.d.ts.map +1 -0
- package/dist/infrastructure/auth/storage/index.js +4 -0
- package/dist/infrastructure/auth/storage/index.js.map +1 -0
- package/dist/infrastructure/auth/storage/memory.storage.d.ts +3 -0
- package/dist/infrastructure/auth/storage/memory.storage.d.ts.map +1 -0
- package/dist/infrastructure/auth/storage/memory.storage.js +14 -0
- package/dist/infrastructure/auth/storage/memory.storage.js.map +1 -0
- package/dist/infrastructure/auth/storage/storage.utils.d.ts +10 -0
- package/dist/infrastructure/auth/storage/storage.utils.d.ts.map +1 -0
- package/dist/infrastructure/auth/storage/storage.utils.js +22 -0
- package/dist/infrastructure/auth/storage/storage.utils.js.map +1 -0
- package/dist/infrastructure/auth/supabase-auth.service.d.ts +31 -0
- package/dist/infrastructure/auth/supabase-auth.service.d.ts.map +1 -0
- package/dist/infrastructure/auth/supabase-auth.service.js +90 -0
- package/dist/infrastructure/auth/supabase-auth.service.js.map +1 -0
- package/dist/infrastructure/cache/__tests__/in-memory.cache.test.d.ts +2 -0
- package/dist/infrastructure/cache/__tests__/in-memory.cache.test.d.ts.map +1 -0
- package/dist/infrastructure/cache/__tests__/in-memory.cache.test.js +69 -0
- package/dist/infrastructure/cache/__tests__/in-memory.cache.test.js.map +1 -0
- package/dist/infrastructure/cache/in-memory.cache.d.ts +34 -0
- package/dist/infrastructure/cache/in-memory.cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/in-memory.cache.js +66 -0
- package/dist/infrastructure/cache/in-memory.cache.js.map +1 -0
- package/dist/infrastructure/cache/index.d.ts +3 -0
- package/dist/infrastructure/cache/index.d.ts.map +1 -0
- package/dist/infrastructure/cache/index.js +3 -0
- package/dist/infrastructure/cache/index.js.map +1 -0
- package/dist/infrastructure/cache/key-builder.cache.d.ts +25 -0
- package/dist/infrastructure/cache/key-builder.cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/key-builder.cache.js +39 -0
- package/dist/infrastructure/cache/key-builder.cache.js.map +1 -0
- package/dist/infrastructure/datasources/__tests__/remote.datasource.test.d.ts +2 -0
- package/dist/infrastructure/datasources/__tests__/remote.datasource.test.d.ts.map +1 -0
- package/dist/infrastructure/datasources/__tests__/remote.datasource.test.js +176 -0
- package/dist/infrastructure/datasources/__tests__/remote.datasource.test.js.map +1 -0
- package/dist/infrastructure/datasources/index.d.ts +2 -0
- package/dist/infrastructure/datasources/index.d.ts.map +1 -0
- package/dist/infrastructure/datasources/index.js +2 -0
- package/dist/infrastructure/datasources/index.js.map +1 -0
- package/dist/infrastructure/datasources/remote.datasource.d.ts +43 -0
- package/dist/infrastructure/datasources/remote.datasource.d.ts.map +1 -0
- package/dist/infrastructure/datasources/remote.datasource.js +111 -0
- package/dist/infrastructure/datasources/remote.datasource.js.map +1 -0
- package/dist/infrastructure/factories/axios.factory.d.ts +15 -0
- package/dist/infrastructure/factories/axios.factory.d.ts.map +1 -0
- package/dist/infrastructure/factories/axios.factory.js +26 -0
- package/dist/infrastructure/factories/axios.factory.js.map +1 -0
- package/dist/infrastructure/factories/cockatiel-resilience.factory.d.ts +16 -0
- package/dist/infrastructure/factories/cockatiel-resilience.factory.d.ts.map +1 -0
- package/dist/infrastructure/factories/cockatiel-resilience.factory.js +114 -0
- package/dist/infrastructure/factories/cockatiel-resilience.factory.js.map +1 -0
- package/dist/infrastructure/factories/index.d.ts +2 -0
- package/dist/infrastructure/factories/index.d.ts.map +1 -0
- package/dist/infrastructure/factories/index.js +2 -0
- package/dist/infrastructure/factories/index.js.map +1 -0
- package/dist/infrastructure/http/__tests__/axios.http.test.d.ts +2 -0
- package/dist/infrastructure/http/__tests__/axios.http.test.d.ts.map +1 -0
- package/dist/infrastructure/http/__tests__/axios.http.test.js +196 -0
- package/dist/infrastructure/http/__tests__/axios.http.test.js.map +1 -0
- package/dist/infrastructure/http/allow-origin.http.d.ts +8 -0
- package/dist/infrastructure/http/allow-origin.http.d.ts.map +1 -0
- package/dist/infrastructure/http/allow-origin.http.js +13 -0
- package/dist/infrastructure/http/allow-origin.http.js.map +1 -0
- package/dist/infrastructure/http/axios.http.d.ts +17 -0
- package/dist/infrastructure/http/axios.http.d.ts.map +1 -0
- package/dist/infrastructure/http/axios.http.js +89 -0
- package/dist/infrastructure/http/axios.http.js.map +1 -0
- package/dist/infrastructure/http/index.d.ts +2 -0
- package/dist/infrastructure/http/index.d.ts.map +1 -0
- package/dist/infrastructure/http/index.js +2 -0
- package/dist/infrastructure/http/index.js.map +1 -0
- package/dist/infrastructure/index.d.ts +7 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +7 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/infrastructure/mappers/index.d.ts +3 -0
- package/dist/infrastructure/mappers/index.d.ts.map +1 -0
- package/dist/infrastructure/mappers/index.js +3 -0
- package/dist/infrastructure/mappers/index.js.map +1 -0
- package/dist/infrastructure/mappers/supabase-claims.mapper.d.ts +15 -0
- package/dist/infrastructure/mappers/supabase-claims.mapper.d.ts.map +1 -0
- package/dist/infrastructure/mappers/supabase-claims.mapper.js +30 -0
- package/dist/infrastructure/mappers/supabase-claims.mapper.js.map +1 -0
- package/dist/infrastructure/mappers/supabase-session.mapper.d.ts +8 -0
- package/dist/infrastructure/mappers/supabase-session.mapper.d.ts.map +1 -0
- package/dist/infrastructure/mappers/supabase-session.mapper.js +16 -0
- package/dist/infrastructure/mappers/supabase-session.mapper.js.map +1 -0
- package/dist/infrastructure/resiliences/__tests__/resilience.service.test.d.ts +2 -0
- package/dist/infrastructure/resiliences/__tests__/resilience.service.test.d.ts.map +1 -0
- package/dist/infrastructure/resiliences/__tests__/resilience.service.test.js +47 -0
- package/dist/infrastructure/resiliences/__tests__/resilience.service.test.js.map +1 -0
- package/dist/infrastructure/resiliences/index.d.ts +2 -0
- package/dist/infrastructure/resiliences/index.d.ts.map +1 -0
- package/dist/infrastructure/resiliences/index.js +2 -0
- package/dist/infrastructure/resiliences/index.js.map +1 -0
- package/dist/infrastructure/resiliences/resilience.service.d.ts +18 -0
- package/dist/infrastructure/resiliences/resilience.service.d.ts.map +1 -0
- package/dist/infrastructure/resiliences/resilience.service.js +21 -0
- package/dist/infrastructure/resiliences/resilience.service.js.map +1 -0
- package/dist/infrastructure/validators/__tests__/schema-zod.utils.test.d.ts +2 -0
- package/dist/infrastructure/validators/__tests__/schema-zod.utils.test.d.ts.map +1 -0
- package/dist/infrastructure/validators/__tests__/schema-zod.utils.test.js +68 -0
- package/dist/infrastructure/validators/__tests__/schema-zod.utils.test.js.map +1 -0
- package/dist/infrastructure/validators/__tests__/zod.validator.test.d.ts +2 -0
- package/dist/infrastructure/validators/__tests__/zod.validator.test.d.ts.map +1 -0
- package/dist/infrastructure/validators/__tests__/zod.validator.test.js +72 -0
- package/dist/infrastructure/validators/__tests__/zod.validator.test.js.map +1 -0
- package/dist/infrastructure/validators/base-schema.constant.d.ts +30 -0
- package/dist/infrastructure/validators/base-schema.constant.d.ts.map +1 -0
- package/dist/infrastructure/validators/base-schema.constant.js +41 -0
- package/dist/infrastructure/validators/base-schema.constant.js.map +1 -0
- package/dist/infrastructure/validators/constants/zod.constant.d.ts +24 -0
- package/dist/infrastructure/validators/constants/zod.constant.d.ts.map +1 -0
- package/dist/infrastructure/validators/constants/zod.constant.js +23 -0
- package/dist/infrastructure/validators/constants/zod.constant.js.map +1 -0
- package/dist/infrastructure/validators/index.d.ts +3 -0
- package/dist/infrastructure/validators/index.d.ts.map +1 -0
- package/dist/infrastructure/validators/index.js +3 -0
- package/dist/infrastructure/validators/index.js.map +1 -0
- package/dist/infrastructure/validators/schema-zod.utils.d.ts +27 -0
- package/dist/infrastructure/validators/schema-zod.utils.d.ts.map +1 -0
- package/dist/infrastructure/validators/schema-zod.utils.js +27 -0
- package/dist/infrastructure/validators/schema-zod.utils.js.map +1 -0
- package/dist/infrastructure/validators/zod.validator.d.ts +31 -0
- package/dist/infrastructure/validators/zod.validator.d.ts.map +1 -0
- package/dist/infrastructure/validators/zod.validator.js +53 -0
- package/dist/infrastructure/validators/zod.validator.js.map +1 -0
- package/dist/shared/constants/concurrency.constants.d.ts +42 -0
- package/dist/shared/constants/concurrency.constants.d.ts.map +1 -0
- package/dist/shared/constants/concurrency.constants.js +42 -0
- package/dist/shared/constants/concurrency.constants.js.map +1 -0
- package/dist/shared/constants/error.constants.d.ts +272 -0
- package/dist/shared/constants/error.constants.d.ts.map +1 -0
- package/dist/shared/constants/error.constants.js +278 -0
- package/dist/shared/constants/error.constants.js.map +1 -0
- package/dist/shared/constants/guest.constants.d.ts +52 -0
- package/dist/shared/constants/guest.constants.d.ts.map +1 -0
- package/dist/shared/constants/guest.constants.js +53 -0
- package/dist/shared/constants/guest.constants.js.map +1 -0
- package/dist/shared/constants/idempotency.constants.d.ts +72 -0
- package/dist/shared/constants/idempotency.constants.d.ts.map +1 -0
- package/dist/shared/constants/idempotency.constants.js +72 -0
- package/dist/shared/constants/idempotency.constants.js.map +1 -0
- package/dist/shared/constants/index.d.ts +11 -0
- package/dist/shared/constants/index.d.ts.map +1 -0
- package/dist/shared/constants/index.js +11 -0
- package/dist/shared/constants/index.js.map +1 -0
- package/dist/shared/constants/log-level.constants.d.ts +64 -0
- package/dist/shared/constants/log-level.constants.d.ts.map +1 -0
- package/dist/shared/constants/log-level.constants.js +89 -0
- package/dist/shared/constants/log-level.constants.js.map +1 -0
- package/dist/shared/constants/pagination.constants.d.ts +70 -0
- package/dist/shared/constants/pagination.constants.d.ts.map +1 -0
- package/dist/shared/constants/pagination.constants.js +88 -0
- package/dist/shared/constants/pagination.constants.js.map +1 -0
- package/dist/shared/constants/request.constants.d.ts +34 -0
- package/dist/shared/constants/request.constants.d.ts.map +1 -0
- package/dist/shared/constants/request.constants.js +26 -0
- package/dist/shared/constants/request.constants.js.map +1 -0
- package/dist/shared/constants/resilience.constants.d.ts +89 -0
- package/dist/shared/constants/resilience.constants.d.ts.map +1 -0
- package/dist/shared/constants/resilience.constants.js +89 -0
- package/dist/shared/constants/resilience.constants.js.map +1 -0
- package/dist/shared/constants/roles.constants.d.ts +84 -0
- package/dist/shared/constants/roles.constants.d.ts.map +1 -0
- package/dist/shared/constants/roles.constants.js +68 -0
- package/dist/shared/constants/roles.constants.js.map +1 -0
- package/dist/shared/constants/tokens.constants.d.ts +373 -0
- package/dist/shared/constants/tokens.constants.d.ts.map +1 -0
- package/dist/shared/constants/tokens.constants.js +373 -0
- package/dist/shared/constants/tokens.constants.js.map +1 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +3 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/types/api-response.types.d.ts +185 -0
- package/dist/shared/types/api-response.types.d.ts.map +1 -0
- package/dist/shared/types/api-response.types.js +2 -0
- package/dist/shared/types/api-response.types.js.map +1 -0
- package/dist/shared/types/auth-policy.types.d.ts +48 -0
- package/dist/shared/types/auth-policy.types.d.ts.map +1 -0
- package/dist/shared/types/auth-policy.types.js +2 -0
- package/dist/shared/types/auth-policy.types.js.map +1 -0
- package/dist/shared/types/auth.types.d.ts +106 -0
- package/dist/shared/types/auth.types.d.ts.map +1 -0
- package/dist/shared/types/auth.types.js +2 -0
- package/dist/shared/types/auth.types.js.map +1 -0
- package/dist/shared/types/cache.types.d.ts +64 -0
- package/dist/shared/types/cache.types.d.ts.map +1 -0
- package/dist/shared/types/cache.types.js +2 -0
- package/dist/shared/types/cache.types.js.map +1 -0
- package/dist/shared/types/common.types.d.ts +213 -0
- package/dist/shared/types/common.types.d.ts.map +1 -0
- package/dist/shared/types/common.types.js +3 -0
- package/dist/shared/types/common.types.js.map +1 -0
- package/dist/shared/types/http.types.d.ts +188 -0
- package/dist/shared/types/http.types.d.ts.map +1 -0
- package/dist/shared/types/http.types.js +2 -0
- package/dist/shared/types/http.types.js.map +1 -0
- package/dist/shared/types/index.d.ts +10 -0
- package/dist/shared/types/index.d.ts.map +1 -0
- package/dist/shared/types/index.js +2 -0
- package/dist/shared/types/index.js.map +1 -0
- package/dist/shared/types/injection-token.types.d.ts +38 -0
- package/dist/shared/types/injection-token.types.d.ts.map +1 -0
- package/dist/shared/types/injection-token.types.js +2 -0
- package/dist/shared/types/injection-token.types.js.map +1 -0
- package/dist/shared/types/metadata.types.d.ts +150 -0
- package/dist/shared/types/metadata.types.d.ts.map +1 -0
- package/dist/shared/types/metadata.types.js +2 -0
- package/dist/shared/types/metadata.types.js.map +1 -0
- package/dist/shared/types/pagination.types.d.ts +88 -0
- package/dist/shared/types/pagination.types.d.ts.map +1 -0
- package/dist/shared/types/pagination.types.js +3 -0
- package/dist/shared/types/pagination.types.js.map +1 -0
- package/dist/shared/utils/__tests__/date.utils.test.d.ts +2 -0
- package/dist/shared/utils/__tests__/date.utils.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/date.utils.test.js +97 -0
- package/dist/shared/utils/__tests__/date.utils.test.js.map +1 -0
- package/dist/shared/utils/__tests__/guards.utils.test.d.ts +2 -0
- package/dist/shared/utils/__tests__/guards.utils.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/guards.utils.test.js +324 -0
- package/dist/shared/utils/__tests__/guards.utils.test.js.map +1 -0
- package/dist/shared/utils/__tests__/guid.utils.test.d.ts +2 -0
- package/dist/shared/utils/__tests__/guid.utils.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/guid.utils.test.js +97 -0
- package/dist/shared/utils/__tests__/guid.utils.test.js.map +1 -0
- package/dist/shared/utils/__tests__/http.utils.test.d.ts +2 -0
- package/dist/shared/utils/__tests__/http.utils.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/http.utils.test.js +230 -0
- package/dist/shared/utils/__tests__/http.utils.test.js.map +1 -0
- package/dist/shared/utils/__tests__/math.utils.test.d.ts +2 -0
- package/dist/shared/utils/__tests__/math.utils.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/math.utils.test.js +93 -0
- package/dist/shared/utils/__tests__/math.utils.test.js.map +1 -0
- package/dist/shared/utils/__tests__/promise.utils.test.d.ts +2 -0
- package/dist/shared/utils/__tests__/promise.utils.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/promise.utils.test.js +101 -0
- package/dist/shared/utils/__tests__/promise.utils.test.js.map +1 -0
- package/dist/shared/utils/__tests__/string.utils.test.d.ts +2 -0
- package/dist/shared/utils/__tests__/string.utils.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/string.utils.test.js +153 -0
- package/dist/shared/utils/__tests__/string.utils.test.js.map +1 -0
- package/dist/shared/utils/abort.utils.d.ts +34 -0
- package/dist/shared/utils/abort.utils.d.ts.map +1 -0
- package/dist/shared/utils/abort.utils.js +55 -0
- package/dist/shared/utils/abort.utils.js.map +1 -0
- package/dist/shared/utils/date.utils.d.ts +75 -0
- package/dist/shared/utils/date.utils.d.ts.map +1 -0
- package/dist/shared/utils/date.utils.js +88 -0
- package/dist/shared/utils/date.utils.js.map +1 -0
- package/dist/shared/utils/enumerable.utils.d.ts +43 -0
- package/dist/shared/utils/enumerable.utils.d.ts.map +1 -0
- package/dist/shared/utils/enumerable.utils.js +52 -0
- package/dist/shared/utils/enumerable.utils.js.map +1 -0
- package/dist/shared/utils/guards.utils.d.ts +245 -0
- package/dist/shared/utils/guards.utils.d.ts.map +1 -0
- package/dist/shared/utils/guards.utils.js +308 -0
- package/dist/shared/utils/guards.utils.js.map +1 -0
- package/dist/shared/utils/guid.utils.d.ts +73 -0
- package/dist/shared/utils/guid.utils.d.ts.map +1 -0
- package/dist/shared/utils/guid.utils.js +89 -0
- package/dist/shared/utils/guid.utils.js.map +1 -0
- package/dist/shared/utils/http.utils.d.ts +75 -0
- package/dist/shared/utils/http.utils.d.ts.map +1 -0
- package/dist/shared/utils/http.utils.js +144 -0
- package/dist/shared/utils/http.utils.js.map +1 -0
- package/dist/shared/utils/index.d.ts +11 -0
- package/dist/shared/utils/index.d.ts.map +1 -0
- package/dist/shared/utils/index.js +11 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/math.utils.d.ts +79 -0
- package/dist/shared/utils/math.utils.d.ts.map +1 -0
- package/dist/shared/utils/math.utils.js +97 -0
- package/dist/shared/utils/math.utils.js.map +1 -0
- package/dist/shared/utils/promise.utils.d.ts +40 -0
- package/dist/shared/utils/promise.utils.d.ts.map +1 -0
- package/dist/shared/utils/promise.utils.js +45 -0
- package/dist/shared/utils/promise.utils.js.map +1 -0
- package/dist/shared/utils/sanitize.utils.d.ts +39 -0
- package/dist/shared/utils/sanitize.utils.d.ts.map +1 -0
- package/dist/shared/utils/sanitize.utils.js +67 -0
- package/dist/shared/utils/sanitize.utils.js.map +1 -0
- package/dist/shared/utils/string.utils.d.ts +102 -0
- package/dist/shared/utils/string.utils.d.ts.map +1 -0
- package/dist/shared/utils/string.utils.js +157 -0
- package/dist/shared/utils/string.utils.js.map +1 -0
- package/package.json +111 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Session as SupabaseSession, User } from '@supabase/supabase-js';
|
|
2
|
+
import type { AuthClaims, IBaseMapper, Session } from '@xeno-js/shared';
|
|
3
|
+
export declare class SupabaseSessionMapper implements IBaseMapper<SupabaseSession, Session> {
|
|
4
|
+
private readonly _claimsMapper;
|
|
5
|
+
constructor(_claimsMapper: IBaseMapper<User, AuthClaims>);
|
|
6
|
+
map(source: SupabaseSession): Session;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=supabase-session.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supabase-session.mapper.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/mappers/supabase-session.mapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEvE,qBAAa,qBAAsB,YAAW,WAAW,CAAC,eAAe,EAAE,OAAO,CAAC;IACrE,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC;IAElE,GAAG,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO;CAS7C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class SupabaseSessionMapper {
|
|
2
|
+
_claimsMapper;
|
|
3
|
+
constructor(_claimsMapper) {
|
|
4
|
+
this._claimsMapper = _claimsMapper;
|
|
5
|
+
}
|
|
6
|
+
map(source) {
|
|
7
|
+
const claims = this._claimsMapper.map(source.user);
|
|
8
|
+
return {
|
|
9
|
+
accessToken: source.access_token,
|
|
10
|
+
refreshToken: source.refresh_token,
|
|
11
|
+
expiresAt: source.expires_at,
|
|
12
|
+
user: claims,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=supabase-session.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supabase-session.mapper.js","sourceRoot":"","sources":["../../../src/infrastructure/mappers/supabase-session.mapper.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,qBAAqB;IACH;IAA7B,YAA6B,aAA4C;QAA5C,kBAAa,GAAb,aAAa,CAA+B;IAAG,CAAC;IAEtE,GAAG,CAAC,MAAuB;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAClD,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,YAAY;YAChC,YAAY,EAAE,MAAM,CAAC,aAAa;YAClC,SAAS,EAAE,MAAM,CAAC,UAAU;YAC5B,IAAI,EAAE,MAAM;SACb,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resilience.service.test.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/resiliences/__tests__/resilience.service.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { AppError } from '../../../domain';
|
|
3
|
+
import { ServiceResilience } from '../resilience.service';
|
|
4
|
+
describe('ServiceResilience', () => {
|
|
5
|
+
it('executes the operation through policy and returns its result', async () => {
|
|
6
|
+
const signal = new AbortController().signal;
|
|
7
|
+
const operation = vi.fn().mockResolvedValue('ok');
|
|
8
|
+
const executeMock = vi.fn(async (handler) => handler());
|
|
9
|
+
const policy = { execute: executeMock };
|
|
10
|
+
const service = new ServiceResilience(policy);
|
|
11
|
+
const result = await service.execute(operation, signal);
|
|
12
|
+
expect(result).toBe('ok');
|
|
13
|
+
expect(operation).toHaveBeenCalledOnce();
|
|
14
|
+
expect(executeMock).toHaveBeenCalledOnce();
|
|
15
|
+
expect(executeMock).toHaveBeenCalledWith(expect.any(Function), signal);
|
|
16
|
+
});
|
|
17
|
+
it('throws AppError when signal is already aborted and does not call policy', async () => {
|
|
18
|
+
const controller = new AbortController();
|
|
19
|
+
controller.abort();
|
|
20
|
+
const executeMock = vi.fn();
|
|
21
|
+
const policy = { execute: executeMock };
|
|
22
|
+
const service = new ServiceResilience(policy);
|
|
23
|
+
const execution = service.execute(async () => 'never', controller.signal);
|
|
24
|
+
await expect(execution).rejects.toBeInstanceOf(AppError);
|
|
25
|
+
await expect(execution).rejects.toMatchObject({ name: 'ServiceResilience.execute' });
|
|
26
|
+
expect(executeMock).not.toHaveBeenCalled();
|
|
27
|
+
});
|
|
28
|
+
it('propagates operation errors returned by policy execution', async () => {
|
|
29
|
+
const failure = new Error('boom');
|
|
30
|
+
const operation = vi.fn().mockRejectedValue(failure);
|
|
31
|
+
const executeMock = vi.fn(async (handler) => handler());
|
|
32
|
+
const policy = { execute: executeMock };
|
|
33
|
+
const service = new ServiceResilience(policy);
|
|
34
|
+
await expect(service.execute(operation, undefined)).rejects.toThrow('boom');
|
|
35
|
+
expect(operation).toHaveBeenCalledOnce();
|
|
36
|
+
});
|
|
37
|
+
it('checks abort status with the expected context name', async () => {
|
|
38
|
+
const throwIfAbortedSpy = vi.spyOn(AppError, 'throwIfAborted');
|
|
39
|
+
const executeMock = vi.fn(async (handler) => handler());
|
|
40
|
+
const policy = { execute: executeMock };
|
|
41
|
+
const service = new ServiceResilience(policy);
|
|
42
|
+
await service.execute(async () => 'ok', undefined);
|
|
43
|
+
expect(throwIfAbortedSpy).toHaveBeenCalledWith(undefined, 'ServiceResilience.execute');
|
|
44
|
+
throwIfAbortedSpy.mockRestore();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=resilience.service.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resilience.service.test.js","sourceRoot":"","sources":["../../../../src/infrastructure/resiliences/__tests__/resilience.service.test.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EAAE,CAAC,oDAAoD,EAAE,KAAK,IAAI,EAAE;QAClE,MAAM,iBAAiB,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;QAC9D,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,OAA8B,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAA;QAC9E,MAAM,MAAM,GAAG,EAAE,OAAO,EAAE,WAAW,EAAwB,CAAA;QAE7D,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;QAE7C,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QAElD,MAAM,CAAC,iBAAiB,CAAC,CAAC,oBAAoB,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAA;QAEtF,iBAAiB,CAAC,WAAW,EAAE,CAAA;IACjC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/resiliences/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/resiliences/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IPolicy } from 'cockatiel';
|
|
2
|
+
import type { IServiceResilience } from '../../domain';
|
|
3
|
+
import type { Optional } from '../../shared';
|
|
4
|
+
/**
|
|
5
|
+
* @description The ServiceResilience class implements the IServiceResilience interface, providing a concrete implementation of resilience features for service calls. This class is designed to enhance the reliability of service interactions by automatically handling transient faults and preventing cascading failures in distributed systems. The execute method allows for the execution of asynchronous operations with built-in support for retries, timeouts, and circuit breakers, ensuring that service calls are more resilient to failures and can recover gracefully from errors.
|
|
6
|
+
|
|
7
|
+
*
|
|
8
|
+
* @author Xeno
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
* @since 2025-09-30
|
|
11
|
+
* @link https://github.com/Mattia-Carcione/xeno-js
|
|
12
|
+
*/
|
|
13
|
+
export declare class ServiceResilience implements IServiceResilience {
|
|
14
|
+
private readonly policy;
|
|
15
|
+
constructor(policy: IPolicy);
|
|
16
|
+
execute<T>(operation: () => Promise<T>, signal: Optional<AbortSignal>): Promise<T>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=resilience.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resilience.service.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/resiliences/resilience.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC;;;;;;;;KAQK;AACL,qBAAa,iBAAkB,YAAW,kBAAkB;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,OAAO;IAE/B,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAKhG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AppError } from '../../domain';
|
|
2
|
+
/**
|
|
3
|
+
* @description The ServiceResilience class implements the IServiceResilience interface, providing a concrete implementation of resilience features for service calls. This class is designed to enhance the reliability of service interactions by automatically handling transient faults and preventing cascading failures in distributed systems. The execute method allows for the execution of asynchronous operations with built-in support for retries, timeouts, and circuit breakers, ensuring that service calls are more resilient to failures and can recover gracefully from errors.
|
|
4
|
+
|
|
5
|
+
*
|
|
6
|
+
* @author Xeno
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @since 2025-09-30
|
|
9
|
+
* @link https://github.com/Mattia-Carcione/xeno-js
|
|
10
|
+
*/
|
|
11
|
+
export class ServiceResilience {
|
|
12
|
+
policy;
|
|
13
|
+
constructor(policy) {
|
|
14
|
+
this.policy = policy;
|
|
15
|
+
}
|
|
16
|
+
async execute(operation, signal) {
|
|
17
|
+
AppError.throwIfAborted(signal, 'ServiceResilience.execute');
|
|
18
|
+
return this.policy.execute(() => operation(), signal);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=resilience.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resilience.service.js","sourceRoot":"","sources":["../../../src/infrastructure/resiliences/resilience.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGnC;;;;;;;;KAQK;AACL,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;IAEzC,KAAK,CAAC,OAAO,CAAI,SAA2B,EAAE,MAA6B;QAChF,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAA;QAE5D,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC,CAAA;IACvD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-zod.utils.test.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/validators/__tests__/schema-zod.utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ZodUtils } from '../schema-zod.utils';
|
|
4
|
+
describe('ZodUtils', () => {
|
|
5
|
+
describe('createCommandSchema', () => {
|
|
6
|
+
it('extends the command schema with additional properties', () => {
|
|
7
|
+
const schema = ZodUtils.createCommandSchema({
|
|
8
|
+
userId: z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
const result = schema.safeParse({
|
|
11
|
+
intent: 'create-user',
|
|
12
|
+
type: 'COMMAND',
|
|
13
|
+
userId: '550e8400-e29b-41d4-a716-446655440000',
|
|
14
|
+
});
|
|
15
|
+
expect(result.success).toBe(true);
|
|
16
|
+
if (result.success) {
|
|
17
|
+
expect(result.data.userId).toBe('550e8400-e29b-41d4-a716-446655440000');
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
it('keeps the base command constraints', () => {
|
|
21
|
+
const schema = ZodUtils.createCommandSchema({
|
|
22
|
+
userId: z.string(),
|
|
23
|
+
});
|
|
24
|
+
expect(schema.safeParse({ userId: 'user-1', type: 'COMMAND' }).success).toBe(false);
|
|
25
|
+
expect(schema.safeParse({ intent: '', type: 'COMMAND', userId: 'user-1' }).success).toBe(false);
|
|
26
|
+
expect(schema.safeParse({ intent: 'create-user', type: 'QUERY', userId: 'user-1' }).success).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe('createQuerySchema', () => {
|
|
30
|
+
it('extends the query schema and preserves cache options', () => {
|
|
31
|
+
const schema = ZodUtils.createQuerySchema({
|
|
32
|
+
userId: z.string().uuid(),
|
|
33
|
+
});
|
|
34
|
+
const result = schema.safeParse({
|
|
35
|
+
intent: 'get-user',
|
|
36
|
+
type: 'QUERY',
|
|
37
|
+
userId: '550e8400-e29b-41d4-a716-446655440000',
|
|
38
|
+
cacheOptions: {
|
|
39
|
+
cacheKey: 'user:1',
|
|
40
|
+
ttl: 60,
|
|
41
|
+
bypassCache: false,
|
|
42
|
+
consistentRead: true,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
expect(result.success).toBe(true);
|
|
46
|
+
if (result.success) {
|
|
47
|
+
expect(result.data.cacheOptions).toEqual({
|
|
48
|
+
cacheKey: 'user:1',
|
|
49
|
+
ttl: 60,
|
|
50
|
+
bypassCache: false,
|
|
51
|
+
consistentRead: true,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
it('rejects invalid required cache options', () => {
|
|
56
|
+
const schema = ZodUtils.createQuerySchema({
|
|
57
|
+
userId: z.string(),
|
|
58
|
+
});
|
|
59
|
+
expect(schema.safeParse({
|
|
60
|
+
intent: 'get-user',
|
|
61
|
+
type: 'COMMAND',
|
|
62
|
+
userId: 'user-1',
|
|
63
|
+
cacheOptions: { cacheKey: '' },
|
|
64
|
+
}).success).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=schema-zod.utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-zod.utils.test.js","sourceRoot":"","sources":["../../../../src/infrastructure/validators/__tests__/schema-zod.utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAC/D,MAAM,MAAM,GAAG,QAAQ,CAAC,mBAAmB,CAAC;gBAC1C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;aAC1B,CAAC,CAAA;YAEF,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;gBAC9B,MAAM,EAAE,aAAa;gBACrB,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,sCAAsC;aAC/C,CAAC,CAAA;YAEF,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AAS,CAAC;gBAC9B,MAAM,EAAE,UAAU;gBAClB,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,sCAAsC;gBAC9C,YAAY,EAAE;oBACZ,QAAQ,EAAE,QAAQ;oBAClB,GAAG,EAAE,EAAE;oBACP,WAAW,EAAE,KAAK;oBAClB,cAAc,EAAE,IAAI;iBACrB;aACF,CAAC,CAAA;YAEF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACjC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC;oBACvC,QAAQ,EAAE,QAAQ;oBAClB,GAAG,EAAE,EAAE;oBACP,WAAW,EAAE,KAAK;oBAClB,cAAc,EAAE,IAAI;iBACrB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,MAAM,GAAG,QAAQ,CAAC,iBAAiB,CAAC;gBACxC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;aACnB,CAAC,CAAA;YAEF,MAAM,CACJ,MAAM,CAAC,SAAS,CAAC;gBACf,MAAM,EAAE,UAAU;gBAClB,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,QAAQ;gBAChB,YAAY,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;aAC/B,CAAC,CAAC,OAAO,CACX,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACf,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.validator.test.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/validators/__tests__/zod.validator.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ERROR_CODE_MESSAGES, ERROR_CODES, STATUS_CODES } from '../../../shared';
|
|
4
|
+
import { ZodValidatorService } from '../zod.validator';
|
|
5
|
+
describe('ZodValidatorService', () => {
|
|
6
|
+
let mockLogger;
|
|
7
|
+
let sut;
|
|
8
|
+
const fnLogger = vi.fn();
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
vi.clearAllMocks();
|
|
11
|
+
mockLogger = {
|
|
12
|
+
info: fnLogger,
|
|
13
|
+
warn: fnLogger,
|
|
14
|
+
debug: fnLogger,
|
|
15
|
+
error: fnLogger
|
|
16
|
+
};
|
|
17
|
+
sut = new ZodValidatorService(new Map(), mockLogger);
|
|
18
|
+
});
|
|
19
|
+
describe('addSchema', () => {
|
|
20
|
+
it('adds a schema to the registry and allows subsequent validation', async () => {
|
|
21
|
+
const service = sut;
|
|
22
|
+
service.addSchema('user', z.object({ name: z.string() }));
|
|
23
|
+
const result = await service.validate('user', { name: 'Alice' });
|
|
24
|
+
expect(result.isOk()).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
describe('validate', () => {
|
|
28
|
+
it('returns Result.ok(true) when data is valid for schema', async () => {
|
|
29
|
+
const schema = z.object({ name: z.string().min(3) });
|
|
30
|
+
const service = sut;
|
|
31
|
+
service.addSchema('user', schema);
|
|
32
|
+
const result = await service.validate('user', { name: 'Alice' });
|
|
33
|
+
expect(result.isOk()).toBe(true);
|
|
34
|
+
expect(result.getValueOrThrow()).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
it('returns Result.ok(true) when schema key is missing', async () => {
|
|
37
|
+
const service = sut;
|
|
38
|
+
const result = await service.validate('missing', { any: 'value' });
|
|
39
|
+
expect(result.isOk()).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
it('returns.VALIDATION_FAILED and formats both path and root issues', async () => {
|
|
42
|
+
const schema = z
|
|
43
|
+
.object({
|
|
44
|
+
name: z.string().min(3),
|
|
45
|
+
})
|
|
46
|
+
.superRefine((_value, ctx) => {
|
|
47
|
+
ctx.addIssue({
|
|
48
|
+
code: z.ZodIssueCode.custom,
|
|
49
|
+
path: [],
|
|
50
|
+
message: 'root issue',
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
const service = sut;
|
|
54
|
+
service.addSchema('user', schema);
|
|
55
|
+
const result = await service.validate('user', { name: 'a' });
|
|
56
|
+
expect(result.isOk()).toBe(false);
|
|
57
|
+
const error = result.getErrorOrThrow();
|
|
58
|
+
expect(error.code).toBe(ERROR_CODES.VALIDATION_FAILED);
|
|
59
|
+
expect(error.message).toBe(ERROR_CODE_MESSAGES[ERROR_CODES.VALIDATION_FAILED]);
|
|
60
|
+
expect(error.status).toBe(STATUS_CODES.BAD_REQUEST);
|
|
61
|
+
expect(error.name).toBe('ZodValidatorService');
|
|
62
|
+
expect(error.cause).toBeInstanceOf(Error);
|
|
63
|
+
if (error.cause instanceof Error) {
|
|
64
|
+
expect(error.cause.message).toContain('Validation failed for schema:');
|
|
65
|
+
expect(error.cause.message).toContain('[name]');
|
|
66
|
+
expect(error.cause.message).toContain('[root] root issue');
|
|
67
|
+
expect(error.cause.message).toContain(', ');
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=zod.validator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.validator.test.js","sourceRoot":"","sources":["../../../../src/infrastructure/validators/__tests__/zod.validator.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEzE,OAAO,EA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
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* @description Base schema for any Request
|
|
4
|
+
* @author Xeno
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @since 2025-09-30
|
|
7
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
8
|
+
*/
|
|
9
|
+
export declare const baseCommandZodSchema: z.ZodObject<{
|
|
10
|
+
intent: z.ZodString;
|
|
11
|
+
type: z.ZodLiteral<"COMMAND">;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
/**
|
|
14
|
+
* @description Base schema for any Query
|
|
15
|
+
* @author Xeno
|
|
16
|
+
* @version 1.0.0
|
|
17
|
+
* @since 2025-09-30
|
|
18
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
19
|
+
*/
|
|
20
|
+
export declare const baseQueryZodSchema: z.ZodObject<{
|
|
21
|
+
intent: z.ZodString;
|
|
22
|
+
type: z.ZodLiteral<"QUERY">;
|
|
23
|
+
cacheOptions: z.ZodObject<{
|
|
24
|
+
cacheKey: z.ZodString;
|
|
25
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
bypassCache: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
consistentRead: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
//# sourceMappingURL=base-schema.constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-schema.constant.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validators/base-schema.constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAA;AAqBF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;iBAE7B,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { REQUEST_TYPE } from '../../shared';
|
|
3
|
+
/**
|
|
4
|
+
* @description Base schema for any Request
|
|
5
|
+
* @author Xeno
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @since 2025-09-30
|
|
8
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
9
|
+
*/
|
|
10
|
+
export const baseCommandZodSchema = z.object({
|
|
11
|
+
intent: z.string().min(1, 'Intent is required'),
|
|
12
|
+
type: z.literal(REQUEST_TYPE.COMMAND),
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* @description Base schema for any Command
|
|
16
|
+
* @author Xeno
|
|
17
|
+
* @version 1.0.0
|
|
18
|
+
* @since 2025-09-30
|
|
19
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
20
|
+
*/
|
|
21
|
+
const queryZodSchema = z.object({
|
|
22
|
+
intent: z.string().min(1, 'Intent is required'),
|
|
23
|
+
type: z.literal(REQUEST_TYPE.QUERY),
|
|
24
|
+
});
|
|
25
|
+
const cacheableOptionsZodSchema = z.object({
|
|
26
|
+
cacheKey: z.string().min(1, 'Cache key is required'),
|
|
27
|
+
ttl: z.number().int().positive().optional(),
|
|
28
|
+
bypassCache: z.boolean().optional(),
|
|
29
|
+
consistentRead: z.boolean().optional(),
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* @description Base schema for any Query
|
|
33
|
+
* @author Xeno
|
|
34
|
+
* @version 1.0.0
|
|
35
|
+
* @since 2025-09-30
|
|
36
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
37
|
+
*/
|
|
38
|
+
export const baseQueryZodSchema = queryZodSchema.extend({
|
|
39
|
+
cacheOptions: cacheableOptionsZodSchema,
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=base-schema.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-schema.constant.js","sourceRoot":"","sources":["../../../src/infrastructure/validators/base-schema.constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;CACtC,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC;CACpC,CAAC,CAAA;AAEF,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IACpD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC3C,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC,MAAM,CAAC;IACtD,YAAY,EAAE,yBAAyB;CACxC,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* BaseRequestSchema defines the structure of a base request object.
|
|
4
|
+
* It includes the intent of the request and the type of request (either COMMAND or QUERY).
|
|
5
|
+
*/
|
|
6
|
+
export declare const BaseRequestSchema: z.ZodObject<{
|
|
7
|
+
intent: z.ZodString;
|
|
8
|
+
type: z.ZodEnum<{
|
|
9
|
+
COMMAND: "COMMAND";
|
|
10
|
+
QUERY: "QUERY";
|
|
11
|
+
}>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
/**
|
|
14
|
+
* CacheOptionsSchema defines the structure of cache options for a request.
|
|
15
|
+
* It includes the cache key, time-to-live (ttl), bypass cache flag, consistent read flag, and user-scoped flag.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CacheOptionsSchema: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
cacheKey: z.ZodString;
|
|
19
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
bypassCache: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
consistentRead: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
isUserScoped: z.ZodBoolean;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
//# sourceMappingURL=zod.constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.constant.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/validators/constants/zod.constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;iBAG5B,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;kBAQlB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* BaseRequestSchema defines the structure of a base request object.
|
|
4
|
+
* It includes the intent of the request and the type of request (either COMMAND or QUERY).
|
|
5
|
+
*/
|
|
6
|
+
export const BaseRequestSchema = z.object({
|
|
7
|
+
intent: z.string(),
|
|
8
|
+
type: z.enum(['COMMAND', 'QUERY']),
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* CacheOptionsSchema defines the structure of cache options for a request.
|
|
12
|
+
* It includes the cache key, time-to-live (ttl), bypass cache flag, consistent read flag, and user-scoped flag.
|
|
13
|
+
*/
|
|
14
|
+
export const CacheOptionsSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
cacheKey: z.string(),
|
|
17
|
+
ttl: z.number().optional(),
|
|
18
|
+
bypassCache: z.boolean().optional(),
|
|
19
|
+
consistentRead: z.boolean().optional(),
|
|
20
|
+
isUserScoped: z.boolean(),
|
|
21
|
+
})
|
|
22
|
+
.optional();
|
|
23
|
+
//# sourceMappingURL=zod.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.constant.js","sourceRoot":"","sources":["../../../../src/infrastructure/validators/constants/zod.constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACtC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;CAC1B,CAAC;KACD,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* @description Utility functions for creating Zod schemas for commands and queries.
|
|
4
|
+
* @author Xeno
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @since 2025-09-30
|
|
7
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
8
|
+
*/
|
|
9
|
+
export declare const ZodUtils: Readonly<{
|
|
10
|
+
/**
|
|
11
|
+
* @description Creates a Zod schema for a command by extending the base command schema with additional properties.
|
|
12
|
+
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
13
|
+
* @returns A Zod schema for the command.
|
|
14
|
+
*/
|
|
15
|
+
createCommandSchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
16
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
/**
|
|
19
|
+
* @description Creates a Zod schema for a query by extending the base query schema with additional properties.
|
|
20
|
+
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
21
|
+
* @returns A Zod schema for the query.
|
|
22
|
+
*/
|
|
23
|
+
createQuerySchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
24
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=schema-zod.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-zod.utils.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validators/schema-zod.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAI5B;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ;IACnB;;;;OAIG;4CACqC,CAAC,CAAC,WAAW;;;IAGrD;;;;OAIG;0CACmC,CAAC,CAAC,WAAW;;;EAGnD,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { baseCommandZodSchema, baseQueryZodSchema } from './base-schema.constant';
|
|
2
|
+
/**
|
|
3
|
+
* @description Utility functions for creating Zod schemas for commands and queries.
|
|
4
|
+
* @author Xeno
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @since 2025-09-30
|
|
7
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
8
|
+
*/
|
|
9
|
+
export const ZodUtils = Object.freeze({
|
|
10
|
+
/**
|
|
11
|
+
* @description Creates a Zod schema for a command by extending the base command schema with additional properties.
|
|
12
|
+
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
13
|
+
* @returns A Zod schema for the command.
|
|
14
|
+
*/
|
|
15
|
+
createCommandSchema: (additionalSchema) => {
|
|
16
|
+
return baseCommandZodSchema.extend(additionalSchema).strict();
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* @description Creates a Zod schema for a query by extending the base query schema with additional properties.
|
|
20
|
+
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
21
|
+
* @returns A Zod schema for the query.
|
|
22
|
+
*/
|
|
23
|
+
createQuerySchema: (additionalSchema) => {
|
|
24
|
+
return baseQueryZodSchema.extend(additionalSchema).strict();
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=schema-zod.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-zod.utils.js","sourceRoot":"","sources":["../../../src/infrastructure/validators/schema-zod.utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEjF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,gBAA+B,EAAE,EAAE;QACvD,OAAO,oBAAoB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,MAAM,EAAE,CAAA;IAC/D,CAAC;IACD;;;;OAIG;IACH,iBAAiB,EAAE,CAAC,gBAA+B,EAAE,EAAE;QACrD,OAAO,kBAAkB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,MAAM,EAAE,CAAA;IAC7D,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ZodType } from 'zod';
|
|
2
|
+
import type { ILogger, IValidatorService, ResultType } from '../../domain';
|
|
3
|
+
/**
|
|
4
|
+
* @description Implementation of the IValidatorService interface using Zod schemas for validation. This service maintains a registry of Zod schemas identified by unique keys and provides methods to check for the existence of a schema and to validate data against a specified schema. The validate method returns a ResultType indicating success or failure, with detailed error information in case of validation failure, including formatted error messages from Zod.
|
|
5
|
+
|
|
6
|
+
*
|
|
7
|
+
* @author Xeno
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
* @since 2025-09-30
|
|
10
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
11
|
+
*/
|
|
12
|
+
export declare class ZodValidatorService implements IValidatorService {
|
|
13
|
+
private readonly _cache;
|
|
14
|
+
private readonly _logger;
|
|
15
|
+
/**
|
|
16
|
+
* @description Constructs a new instance of the ZodValidatorService class, which takes an ICache instance as a parameter. This cache is used to store and manage the validation schemas that will be applied to incoming data. The constructor initializes the service with the provided cache, allowing it to perform validation checks based on the cached schemas when the validate method is called.
|
|
17
|
+
*
|
|
18
|
+
* @param _cache An instance of ICache used to store and retrieve Zod schemas. This cache is essential for the operation of the validator service, as it allows it to look up and apply the correct schema for validating incoming data.
|
|
19
|
+
* @param _logger An instance of ILogger used to log warning when schema was not found.
|
|
20
|
+
*
|
|
21
|
+
* @author Xeno
|
|
22
|
+
* @version 1.0.0
|
|
23
|
+
* @since 2025-09-30
|
|
24
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
25
|
+
*/
|
|
26
|
+
constructor(_cache: Map<string, ZodType> | undefined, _logger: ILogger);
|
|
27
|
+
private static formatIssue;
|
|
28
|
+
addSchema(key: string, schema: ZodType): void;
|
|
29
|
+
validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=zod.validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.validator.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validators/zod.validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,KAAK,CAAA;AAExC,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAItE;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,iBAAiB;IAazD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAb1B;;;;;;;;;;OAUG;gBAEgB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,EACxC,OAAO,EAAE,OAAO;IAGnC,OAAO,CAAC,MAAM,CAAC,WAAW;IAMnB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAIvC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;CAwB7E"}
|