@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,114 @@
|
|
|
1
|
+
import { bulkhead, circuitBreaker, ConsecutiveBreaker, ExponentialBackoff, handleWhen, retry, wrap, } from 'cockatiel';
|
|
2
|
+
import { AppError } from '../../domain';
|
|
3
|
+
import { Guards, RESILIENCE_DEFAULTS } from '../../shared';
|
|
4
|
+
import { ServiceResilience } from '../resiliences/resilience.service';
|
|
5
|
+
/**
|
|
6
|
+
* @description Factory class responsible for creating instances of ServiceResilience based on the provided configuration. It implements the IFactory interface, allowing for easy integration with dependency injection systems. The factory encapsulates the creation logic for the ServiceResilience, including the initialization of the underlying resilience policies with the specified configuration options such as retry, circuit breaker, and bulkhead. This design promotes separation of concerns and allows for flexibility in managing ServiceResilience instances across the application.
|
|
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 class CockatielResilienceFactory {
|
|
14
|
+
create(config) {
|
|
15
|
+
const message = 'The resilience configuration provided is invalid. Please ensure that all values are non-negative numbers.';
|
|
16
|
+
const normalizedConfig = {
|
|
17
|
+
retry: {
|
|
18
|
+
attempts: this.checkConfigValue(config.retry.attempts, RESILIENCE_DEFAULTS.RETRY.ATTEMPTS, message),
|
|
19
|
+
baseDelayMs: this.checkConfigValue(config.retry.baseDelayMs, RESILIENCE_DEFAULTS.RETRY.BASE_DELAY_MS, message),
|
|
20
|
+
maxDelayMs: this.checkConfigValue(config.retry.maxDelayMs, RESILIENCE_DEFAULTS.RETRY.MAX_DELAY_MS, message),
|
|
21
|
+
},
|
|
22
|
+
circuitBreaker: {
|
|
23
|
+
consecutiveFailures: this.checkConfigValue(config.circuitBreaker.consecutiveFailures, RESILIENCE_DEFAULTS.CIRCUIT_BREAKER.CONSECUTIVE_FAILURES, message),
|
|
24
|
+
halfOpenTimeoutMs: this.checkConfigValue(config.circuitBreaker.halfOpenTimeoutMs, RESILIENCE_DEFAULTS.CIRCUIT_BREAKER.HALF_OPEN_TIMEOUT_MS, message),
|
|
25
|
+
},
|
|
26
|
+
bulkhead: {
|
|
27
|
+
maxConcurrent: this.checkConfigValue(config.bulkhead.maxConcurrent, RESILIENCE_DEFAULTS.BULKHEAD.MAX_CONCURRENT, message),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const retryPolicy = retry(handleWhen((error) => this.isTransientAndIdempotent(error)), {
|
|
31
|
+
maxAttempts: normalizedConfig.retry.attempts,
|
|
32
|
+
backoff: new ExponentialBackoff({
|
|
33
|
+
initialDelay: normalizedConfig.retry.baseDelayMs,
|
|
34
|
+
maxDelay: normalizedConfig.retry.maxDelayMs,
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
const circuitBreakerPolicy = circuitBreaker(handleWhen((error) => this.isTransientError(error)), {
|
|
38
|
+
breaker: new ConsecutiveBreaker(normalizedConfig.circuitBreaker.consecutiveFailures),
|
|
39
|
+
halfOpenAfter: normalizedConfig.circuitBreaker.halfOpenTimeoutMs,
|
|
40
|
+
});
|
|
41
|
+
const bulkheadPolicy = bulkhead(normalizedConfig.bulkhead.maxConcurrent);
|
|
42
|
+
return new ServiceResilience(wrap(bulkheadPolicy, circuitBreakerPolicy, retryPolicy));
|
|
43
|
+
}
|
|
44
|
+
isTransientError(error) {
|
|
45
|
+
if (!Guards.isDefined(error) || !Guards.isObject(error))
|
|
46
|
+
return false;
|
|
47
|
+
let status;
|
|
48
|
+
let isNetworkError = false;
|
|
49
|
+
if (error instanceof AppError) {
|
|
50
|
+
status = error.status;
|
|
51
|
+
const cause = error.cause;
|
|
52
|
+
if (Guards.isDefined(cause) && Guards.isString(cause.code)) {
|
|
53
|
+
isNetworkError = [
|
|
54
|
+
'ECONNABORTED',
|
|
55
|
+
'ECONNRESET',
|
|
56
|
+
'ETIMEDOUT',
|
|
57
|
+
'ENOTFOUND',
|
|
58
|
+
'ECONNREFUSED',
|
|
59
|
+
].includes(cause.code.toUpperCase());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const err = error;
|
|
64
|
+
status = err.status;
|
|
65
|
+
if (Guards.isString(err.code)) {
|
|
66
|
+
isNetworkError = [
|
|
67
|
+
'ECONNABORTED',
|
|
68
|
+
'ECONNRESET',
|
|
69
|
+
'ETIMEDOUT',
|
|
70
|
+
'ENOTFOUND',
|
|
71
|
+
'ECONNREFUSED',
|
|
72
|
+
].includes(err.code.toUpperCase());
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (isNetworkError)
|
|
76
|
+
return true;
|
|
77
|
+
if (Guards.isDefined(status)) {
|
|
78
|
+
// 408 Request Timeout, 429 Too Many Requests, and Server Errors (5xx)
|
|
79
|
+
return status === 408 || status === 429 || (status >= 500 && status < 600);
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
isTransientAndIdempotent(error) {
|
|
84
|
+
if (!this.isTransientError(error))
|
|
85
|
+
return false;
|
|
86
|
+
let method;
|
|
87
|
+
if (error instanceof AppError) {
|
|
88
|
+
const cause = error.cause;
|
|
89
|
+
if (Guards.isDefined(cause) &&
|
|
90
|
+
Guards.isDefined(cause.config) &&
|
|
91
|
+
Guards.isString(cause.config.method)) {
|
|
92
|
+
method = cause.config.method.toUpperCase();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const err = error;
|
|
97
|
+
if (Guards.isDefined(err.config) && Guards.isString(err.config.method)) {
|
|
98
|
+
method = err.config.method.toUpperCase();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (Guards.isNullOrEmpty(method))
|
|
102
|
+
return false;
|
|
103
|
+
const idempotentMethods = ['GET', 'PUT', 'DELETE', 'HEAD', 'OPTIONS'];
|
|
104
|
+
return idempotentMethods.includes(method);
|
|
105
|
+
}
|
|
106
|
+
checkConfigValue(value, defaultValue, message) {
|
|
107
|
+
if (Guards.isDefined(value)) {
|
|
108
|
+
Guards.throwIfNegative(value, message);
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
return defaultValue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=cockatiel-resilience.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockatiel-resilience.factory.js","sourceRoot":"","sources":["../../../src/infrastructure/factories/cockatiel-resilience.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,KAAK,EACL,IAAI,GACL,MAAM,WAAW,CAAA;AAGlB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAUrE;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA0B;IAC9B,MAAM,CAAC,MAAwB;QACpC,MAAM,OAAO,GACX,2GAA2G,CAAA;QAC7G,MAAM,gBAAgB,GAAG;YACvB,KAAK,EAAE;gBACL,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAC7B,MAAM,CAAC,KAAK,CAAC,QAAQ,EACrB,mBAAmB,CAAC,KAAK,CAAC,QAAQ,EAClC,OAAO,CACR;gBACD,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAChC,MAAM,CAAC,KAAK,CAAC,WAAW,EACxB,mBAAmB,CAAC,KAAK,CAAC,aAAa,EACvC,OAAO,CACR;gBACD,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAC/B,MAAM,CAAC,KAAK,CAAC,UAAU,EACvB,mBAAmB,CAAC,KAAK,CAAC,YAAY,EACtC,OAAO,CACR;aACF;YACD,cAAc,EAAE;gBACd,mBAAmB,EAAE,IAAI,CAAC,gBAAgB,CACxC,MAAM,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C,CAAA;YACtC,OAAO,KAAK,CAAA;QACd,CAAC;QACD,OAAO,YAAY,CAAA;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.http.test.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/http/__tests__/axios.http.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { AppError } from '../../../domain';
|
|
4
|
+
import { ERROR_CODES, STATUS_CODES } from '../../../shared';
|
|
5
|
+
import { AxiosHttpClient } from '../axios.http';
|
|
6
|
+
function makeAxiosResponse(overrides = {}) {
|
|
7
|
+
return {
|
|
8
|
+
data: undefined,
|
|
9
|
+
status: STATUS_CODES.OK,
|
|
10
|
+
statusText: 'OK',
|
|
11
|
+
headers: {},
|
|
12
|
+
config: { headers: {} },
|
|
13
|
+
request: {},
|
|
14
|
+
...overrides,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function makeRequestMock() {
|
|
18
|
+
return vi.fn();
|
|
19
|
+
}
|
|
20
|
+
function makeClient(requestMock) {
|
|
21
|
+
return {
|
|
22
|
+
get: vi.fn((url, config) => requestMock({ ...config, url, method: 'GET', data: undefined })),
|
|
23
|
+
post: vi.fn((url, data, config) => requestMock({ ...config, url, method: 'POST', data })),
|
|
24
|
+
put: vi.fn((url, data, config) => requestMock({ ...config, url, method: 'PUT', data })),
|
|
25
|
+
patch: vi.fn((url, data, config) => requestMock({ ...config, url, method: 'PATCH', data })),
|
|
26
|
+
delete: vi.fn((url, config) => requestMock({ ...config, url, method: 'DELETE', data: undefined })),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
describe('AxiosHttpClient', () => {
|
|
30
|
+
it('get calls axios request and returns normalized response for 2xx status', async () => {
|
|
31
|
+
const requestMock = makeRequestMock();
|
|
32
|
+
requestMock.mockResolvedValue(makeAxiosResponse({
|
|
33
|
+
status: STATUS_CODES.OK,
|
|
34
|
+
headers: { 'x-id': ['a', 'b'], 'x-count': 2 },
|
|
35
|
+
data: { id: '1' },
|
|
36
|
+
}));
|
|
37
|
+
const client = new AxiosHttpClient(makeClient(requestMock));
|
|
38
|
+
const signal = new AbortController().signal;
|
|
39
|
+
const response = await client.get('/users', {
|
|
40
|
+
headers: { authorization: 'Bearer token' },
|
|
41
|
+
query: { page: 1 },
|
|
42
|
+
signal,
|
|
43
|
+
timeoutMs: 900,
|
|
44
|
+
});
|
|
45
|
+
expect(requestMock).toHaveBeenCalledTimes(1);
|
|
46
|
+
const sentConfig = requestMock.mock.calls[0][0];
|
|
47
|
+
expect(sentConfig).toMatchObject({
|
|
48
|
+
url: '/users',
|
|
49
|
+
method: 'GET',
|
|
50
|
+
headers: { authorization: 'Bearer token' },
|
|
51
|
+
params: { page: 1 },
|
|
52
|
+
data: undefined,
|
|
53
|
+
signal,
|
|
54
|
+
timeout: 900,
|
|
55
|
+
});
|
|
56
|
+
expect(sentConfig.validateStatus(500)).toBe(true);
|
|
57
|
+
expect(response).toEqual({
|
|
58
|
+
status: STATUS_CODES.OK,
|
|
59
|
+
ok: true,
|
|
60
|
+
headers: { 'x-id': 'a,b', 'x-count': '2' },
|
|
61
|
+
data: { id: '1' },
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
it('throws AppError when axios returns status >= 400', async () => {
|
|
65
|
+
const requestMock = makeRequestMock();
|
|
66
|
+
requestMock.mockResolvedValue(makeAxiosResponse({
|
|
67
|
+
status: STATUS_CODES.BAD_REQUEST,
|
|
68
|
+
data: { message: 'bad request' },
|
|
69
|
+
}));
|
|
70
|
+
const client = new AxiosHttpClient(makeClient(requestMock));
|
|
71
|
+
await expect(client.get('/users', undefined)).rejects.toMatchObject({
|
|
72
|
+
name: 'AxiosHttpClientException',
|
|
73
|
+
code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
74
|
+
status: STATUS_CODES.BAD_REQUEST,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
it('throws AppError when axios response status is undefined', async () => {
|
|
78
|
+
const requestMock = makeRequestMock();
|
|
79
|
+
requestMock.mockResolvedValue(makeAxiosResponse({
|
|
80
|
+
status: undefined,
|
|
81
|
+
}));
|
|
82
|
+
const client = new AxiosHttpClient(makeClient(requestMock));
|
|
83
|
+
await expect(client.get('/users', undefined)).rejects.toMatchObject({
|
|
84
|
+
name: 'AxiosHttpClientException',
|
|
85
|
+
code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
86
|
+
status: undefined,
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
it('maps AxiosError with response status to AppError preserving status', async () => {
|
|
90
|
+
const requestMock = makeRequestMock();
|
|
91
|
+
requestMock.mockRejectedValue(new AxiosError('network failed', undefined, undefined, undefined, makeAxiosResponse({ status: STATUS_CODES.SERVICE_UNAVAILABLE })));
|
|
92
|
+
const client = new AxiosHttpClient(makeClient(requestMock));
|
|
93
|
+
await expect(client.get('/users', undefined)).rejects.toMatchObject({
|
|
94
|
+
name: 'AxiosHttpClient.get',
|
|
95
|
+
code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
96
|
+
status: STATUS_CODES.SERVICE_UNAVAILABLE,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
it('maps generic thrown error to AppError with internal server error status', async () => {
|
|
100
|
+
const requestMock = makeRequestMock();
|
|
101
|
+
requestMock.mockRejectedValue(new Error('boom'));
|
|
102
|
+
const client = new AxiosHttpClient(makeClient(requestMock));
|
|
103
|
+
await expect(client.get('/users', undefined)).rejects.toMatchObject({
|
|
104
|
+
name: 'AxiosHttpClient.get',
|
|
105
|
+
code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
106
|
+
status: STATUS_CODES.INTERNAL_SERVER_ERROR,
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
it('throws aborted AppError before calling axios when signal is already aborted', async () => {
|
|
110
|
+
const requestMock = makeRequestMock();
|
|
111
|
+
const client = new AxiosHttpClient(makeClient(requestMock));
|
|
112
|
+
const controller = new AbortController();
|
|
113
|
+
controller.abort();
|
|
114
|
+
await expect(client.get('/users', {
|
|
115
|
+
headers: undefined,
|
|
116
|
+
query: undefined,
|
|
117
|
+
signal: controller.signal,
|
|
118
|
+
timeoutMs: undefined,
|
|
119
|
+
})).rejects.toMatchObject({
|
|
120
|
+
code: ERROR_CODES.ABORTED,
|
|
121
|
+
status: STATUS_CODES.ABORTED,
|
|
122
|
+
name: 'AxiosHttpClient.get',
|
|
123
|
+
});
|
|
124
|
+
expect(requestMock).not.toHaveBeenCalled();
|
|
125
|
+
});
|
|
126
|
+
it('post, put, patch and delete build requests with the expected method/body/options', async () => {
|
|
127
|
+
const requestMock = makeRequestMock();
|
|
128
|
+
requestMock.mockResolvedValue(makeAxiosResponse({ data: { ok: true } }));
|
|
129
|
+
const client = new AxiosHttpClient(makeClient(requestMock));
|
|
130
|
+
const options = {
|
|
131
|
+
headers: { authorization: 'Bearer token' },
|
|
132
|
+
query: { include: true },
|
|
133
|
+
signal: undefined,
|
|
134
|
+
timeoutMs: 250,
|
|
135
|
+
};
|
|
136
|
+
await client.post('/items', { a: 1 }, options);
|
|
137
|
+
await client.put('/items/1', { b: 2 }, options);
|
|
138
|
+
await client.patch('/items/1', { c: 3 }, options);
|
|
139
|
+
await client.delete('/items/1', options);
|
|
140
|
+
expect(requestMock).toHaveBeenCalledTimes(4);
|
|
141
|
+
const firstConfig = requestMock.mock.calls[0][0];
|
|
142
|
+
expect(firstConfig).toMatchObject({
|
|
143
|
+
url: '/items',
|
|
144
|
+
method: 'POST',
|
|
145
|
+
headers: options.headers,
|
|
146
|
+
params: options.query,
|
|
147
|
+
data: { a: 1 },
|
|
148
|
+
signal: options.signal,
|
|
149
|
+
timeout: options.timeoutMs,
|
|
150
|
+
});
|
|
151
|
+
const secondConfig = requestMock.mock.calls[1][0];
|
|
152
|
+
expect(secondConfig).toMatchObject({
|
|
153
|
+
url: '/items/1',
|
|
154
|
+
method: 'PUT',
|
|
155
|
+
headers: options.headers,
|
|
156
|
+
params: options.query,
|
|
157
|
+
data: { b: 2 },
|
|
158
|
+
signal: options.signal,
|
|
159
|
+
timeout: options.timeoutMs,
|
|
160
|
+
});
|
|
161
|
+
const thirdConfig = requestMock.mock.calls[2][0];
|
|
162
|
+
expect(thirdConfig).toMatchObject({
|
|
163
|
+
url: '/items/1',
|
|
164
|
+
method: 'PATCH',
|
|
165
|
+
headers: options.headers,
|
|
166
|
+
params: options.query,
|
|
167
|
+
data: { c: 3 },
|
|
168
|
+
signal: options.signal,
|
|
169
|
+
timeout: options.timeoutMs,
|
|
170
|
+
});
|
|
171
|
+
const fourthConfig = requestMock.mock.calls[3][0];
|
|
172
|
+
expect(fourthConfig).toMatchObject({
|
|
173
|
+
url: '/items/1',
|
|
174
|
+
method: 'DELETE',
|
|
175
|
+
headers: options.headers,
|
|
176
|
+
params: options.query,
|
|
177
|
+
data: undefined,
|
|
178
|
+
signal: options.signal,
|
|
179
|
+
timeout: options.timeoutMs,
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
it('rethrows existing AppError from request path without remapping', async () => {
|
|
183
|
+
const requestMock = makeRequestMock();
|
|
184
|
+
const appError = AppError.create({
|
|
185
|
+
code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
186
|
+
message: 'errors.external_service_error',
|
|
187
|
+
status: STATUS_CODES.BAD_REQUEST,
|
|
188
|
+
name: 'AxiosHttpClientException',
|
|
189
|
+
cause: undefined,
|
|
190
|
+
});
|
|
191
|
+
requestMock.mockRejectedValue(appError);
|
|
192
|
+
const client = new AxiosHttpClient(makeClient(requestMock));
|
|
193
|
+
await expect(client.get('/users', undefined)).rejects.toBe(appError);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
//# sourceMappingURL=axios.http.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.http.test.js","sourceRoot":"","sources":["../../../../src/infrastructure/http/__tests__/axios.http.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAa/C,SAAS,iBAAiB,CAAI,YAAuC,EAAE;IACrE,OAAO;QACL,IAAI,EAAE,SAAc;QACpB,MAAM,EAAE,YAAY,CAAC,EAAE;QACvB,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAgC;QACrD,OAAO,EAAE,EAAE;QACX,GAAG,SAAS;KACb,CAAA;AACH,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,EAAE,CAAC,EAAE,EAAwD,CAAA;AACtE,CAAC;AAED,SAAS,UAAU,CAAC,WAA+C;IACjE,OAAO;QACL,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,MAA0B,EAAE,EAAE,CACrD,WAAW,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAChE;QACD,IAAI,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AAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAA0B,CAAA;QAC1E,MAAM,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC;YACjC,GAAG,EAAE,UAAU;YACf,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,KAAK;YACrB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,SAAS;SAC3B,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;QAC9E,MAAM,WAAW,GAAG,eAAe,EAAE,CAAA;QACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC;YAC/B,IAAI,EAAE,WAAW,CAAC,sBAAsB;YACxC,OAAO,EAAE,+BAA+B;YACxC,MAAM,EAAE,YAAY,CAAC,WAAW;YAChC,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;QACF,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAA;QAEvC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAA;QAE3D,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IAllowOrigin } from '../../../../../xeno-shared/dist/domain';
|
|
2
|
+
import { type Optional } from '../../../../../xeno-shared/dist/shared';
|
|
3
|
+
export declare class AllowOrigin implements IAllowOrigin {
|
|
4
|
+
private readonly _list;
|
|
5
|
+
constructor(_list: string[]);
|
|
6
|
+
isAllowed(origin: Optional<string>): boolean;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=allow-origin.http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allow-origin.http.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/http/allow-origin.http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEhD,qBAAa,WAAY,YAAW,YAAY;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM,EAAE;IAErC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO;CAKpD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Guards } from '../../shared';
|
|
2
|
+
export class AllowOrigin {
|
|
3
|
+
_list;
|
|
4
|
+
constructor(_list) {
|
|
5
|
+
this._list = _list;
|
|
6
|
+
}
|
|
7
|
+
isAllowed(origin) {
|
|
8
|
+
if (Guards.isNullOrEmpty(origin))
|
|
9
|
+
return false;
|
|
10
|
+
return this._list.includes(origin.trim().toLowerCase());
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=allow-origin.http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allow-origin.http.js","sourceRoot":"","sources":["../../../src/infrastructure/http/allow-origin.http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAA;AAEhD,MAAM,OAAO,WAAW;IACO;IAA7B,YAA6B,KAAe;QAAf,UAAK,GAAL,KAAK,CAAU;IAAG,CAAC;IAEzC,SAAS,CAAC,MAAwB;QACvC,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAA;QAE9C,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
import type { IHttpClient } from '../../domain';
|
|
3
|
+
import type { HttpOptions, HttpRequest, HttpResponse, Optional } from '../../shared';
|
|
4
|
+
export declare class AxiosHttpClient implements IHttpClient {
|
|
5
|
+
private readonly _client;
|
|
6
|
+
constructor(_client: AxiosInstance);
|
|
7
|
+
private executInAsync;
|
|
8
|
+
get<TResponse = unknown>(url: string, options?: Optional<Omit<HttpRequest<never>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
9
|
+
post<TResponse = unknown, TBody = unknown>(url: string, body?: Optional<TBody>, options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
10
|
+
put<TResponse = unknown, TBody = unknown>(url: string, body?: Optional<TBody>, options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
11
|
+
patch<TResponse = unknown, TBody = unknown>(url: string, body?: Optional<TBody>, options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
12
|
+
delete<TResponse = unknown>(url: string, options?: Optional<Omit<HttpRequest<never>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
13
|
+
private buildConfig;
|
|
14
|
+
private handleResponse;
|
|
15
|
+
private handleError;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=axios.http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.http.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/http/axios.http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAqC,MAAM,OAAO,CAAA;AAG7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EAAE,W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C,SAAS,GAAG,OAAO,EACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,CAAC,GACxD,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAUnC,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,WAAW;CAgBpB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
import { AppError } from '../../domain';
|
|
3
|
+
import { ERROR_CODE_MESSAGES, ERROR_CODES, Guards, HttpHelper, STATUS_CODES } from '../../shared';
|
|
4
|
+
export class AxiosHttpClient {
|
|
5
|
+
_client;
|
|
6
|
+
constructor(_client) {
|
|
7
|
+
this._client = _client;
|
|
8
|
+
}
|
|
9
|
+
async executInAsync(callback, opts) {
|
|
10
|
+
AppError.throwIfAborted(opts.signal, opts.name);
|
|
11
|
+
try {
|
|
12
|
+
return await callback();
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
this.handleError(error, 'AxiosHttpClient.get');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async get(url, options) {
|
|
19
|
+
return await this.executInAsync(async () => {
|
|
20
|
+
const response = await this._client.get(url, this.buildConfig(options));
|
|
21
|
+
return this.handleResponse(response);
|
|
22
|
+
}, { signal: options?.signal, name: 'AxiosHttpClient.get' });
|
|
23
|
+
}
|
|
24
|
+
async post(url, body, options) {
|
|
25
|
+
return await this.executInAsync(async () => {
|
|
26
|
+
const response = await this._client.post(url, body, this.buildConfig(options));
|
|
27
|
+
return this.handleResponse(response);
|
|
28
|
+
}, { signal: options?.signal, name: 'AxiosHttpClient.post' });
|
|
29
|
+
}
|
|
30
|
+
async put(url, body, options) {
|
|
31
|
+
return await this.executInAsync(async () => {
|
|
32
|
+
const response = await this._client.put(url, body, this.buildConfig(options));
|
|
33
|
+
return this.handleResponse(response);
|
|
34
|
+
}, { signal: options?.signal, name: 'AxiosHttpClient.put' });
|
|
35
|
+
}
|
|
36
|
+
async patch(url, body, options) {
|
|
37
|
+
return await this.executInAsync(async () => {
|
|
38
|
+
const response = await this._client.patch(url, body, this.buildConfig(options));
|
|
39
|
+
return this.handleResponse(response);
|
|
40
|
+
}, { signal: options?.signal, name: 'AxiosHttpClient.patch' });
|
|
41
|
+
}
|
|
42
|
+
async delete(url, options) {
|
|
43
|
+
return await this.executInAsync(async () => {
|
|
44
|
+
const response = await this._client.delete(url, this.buildConfig(options));
|
|
45
|
+
return this.handleResponse(response);
|
|
46
|
+
}, { signal: options?.signal, name: 'AxiosHttpClient.delete' });
|
|
47
|
+
}
|
|
48
|
+
buildConfig(options) {
|
|
49
|
+
return {
|
|
50
|
+
headers: options?.headers,
|
|
51
|
+
params: options?.query,
|
|
52
|
+
signal: options?.signal,
|
|
53
|
+
timeout: options?.timeoutMs,
|
|
54
|
+
validateStatus: () => true,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
handleResponse(response) {
|
|
58
|
+
if (!Guards.isDefined(response.status) || response.status >= 400) {
|
|
59
|
+
AppError.throw({
|
|
60
|
+
code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
61
|
+
message: ERROR_CODE_MESSAGES[ERROR_CODES.EXTERNAL_SERVICE_ERROR],
|
|
62
|
+
status: response.status,
|
|
63
|
+
name: 'AxiosHttpClientException',
|
|
64
|
+
cause: new AxiosError(`Request failed with status code ${response.status}`, undefined, response.config, response.request, response),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
status: response.status,
|
|
69
|
+
ok: response.status >= 200 && response.status < 300,
|
|
70
|
+
headers: HttpHelper.normalizeHeaders(response.headers),
|
|
71
|
+
data: response.data,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
handleError(error, name) {
|
|
75
|
+
if (error instanceof AppError)
|
|
76
|
+
throw error;
|
|
77
|
+
const status = error instanceof AxiosError && Guards.isDefined(error.response)
|
|
78
|
+
? error.response.status
|
|
79
|
+
: STATUS_CODES.INTERNAL_SERVER_ERROR;
|
|
80
|
+
AppError.throw({
|
|
81
|
+
code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
82
|
+
message: ERROR_CODE_MESSAGES[ERROR_CODES.EXTERNAL_SERVICE_ERROR],
|
|
83
|
+
status,
|
|
84
|
+
name,
|
|
85
|
+
cause: error,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=axios.http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.http.js","sourceRoot":"","sources":["../../../src/infrastructure/http/axios.http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGlC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE7F,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;IAAG,CAAC;IAE/C,KAAK,CAAC,aAAa,CACzB,QAAgD,EAChD,IAAqD;QAErD,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QAE/C,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,EAAE,CAAA;QACzB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,GAAG,CACd,GAAW,EACX,OAAyD;QAEzD,OAAO,MAAM,IAAI,CAAC,aAAa,CAC7B,KAAK,IAAI,EAAE;YACT,MAAM,QAAQ,GAA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CAAC;gBAChE,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,IAAI,EAAE,0BAA0B;gBAChC,KAAK,EAAE,IAAI,UAAU,CACnB,mCAAmC,QAAQ,CAAC,MAAM,EAAE,EACpD,SAAS,EACT,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,OAAO,EAChB,QAAQ,CACT;aACF,CAAC,CAAA;QACJ,CAAC;QAED,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,EAAE,EAAE,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG;YACnD,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC;YACtD,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAA;IACH,CAAC;IAEO,WAAW,CAAC,KAAc,EAAE,IAAY;QAC9C,IAAI,KAAK,YAAY,QAAQ;YAAE,MAAM,KAAK,CAAA;QAE1C,MAAM,MAAM,GACV,KAAK,YAAY,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC7D,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM;YACvB,CAAC,CAAC,YAAY,CAAC,qBAAqB,CAAA;QAExC,QAAQ,CAAC,KAAK,CAAC;YACb,IAAI,EAAE,WAAW,CAAC,sBAAsB;YACxC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,sBAAsB,CAAC;YAChE,MAAM;YACN,IAAI;YACJ,KAAK,EAAE,KAAK;SACb,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/infrastructure/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/infrastructure/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { User } from '@supabase/supabase-js';
|
|
2
|
+
import type { AuthClaims, IBaseMapper } from '@xeno-js/shared';
|
|
3
|
+
/**
|
|
4
|
+
* @description SupabaseClaimsMapper is responsible for mapping authentication claims (AuthClaims) to an Identity object. This mapper takes the claims extracted from a token (such as a JWT) and transforms them into a structured Identity that can be used throughout the application for authentication and authorization purposes. The mapping includes parsing the user ID and tenant ID from the claims, as well as extracting roles and permissions.
|
|
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 SupabaseClaimsMapper implements IBaseMapper<User, AuthClaims> {
|
|
13
|
+
map(user: User): AuthClaims;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=supabase-claims.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supabase-claims.mapper.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/mappers/supabase-claims.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG9D;;;;;;;;KAQK;AACL,qBAAa,oBAAqB,YAAW,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC;IACjE,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU;CAkBnC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Guards } from '@xeno-js/shared';
|
|
2
|
+
/**
|
|
3
|
+
* @description SupabaseClaimsMapper is responsible for mapping authentication claims (AuthClaims) to an Identity object. This mapper takes the claims extracted from a token (such as a JWT) and transforms them into a structured Identity that can be used throughout the application for authentication and authorization purposes. The mapping includes parsing the user ID and tenant ID from the claims, as well as extracting roles and permissions.
|
|
4
|
+
|
|
5
|
+
*
|
|
6
|
+
* @author Xeno
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @since 2025-09-30
|
|
9
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
10
|
+
*/
|
|
11
|
+
export class SupabaseClaimsMapper {
|
|
12
|
+
map(user) {
|
|
13
|
+
const appMetadata = user.app_metadata ?? {};
|
|
14
|
+
return {
|
|
15
|
+
sub: user.id,
|
|
16
|
+
email: user.email,
|
|
17
|
+
name: Guards.isString(user.user_metadata?.['name'])
|
|
18
|
+
? user.user_metadata?.['name']
|
|
19
|
+
: undefined,
|
|
20
|
+
tenantId: Guards.isString(appMetadata?.['tenant_id'])
|
|
21
|
+
? appMetadata?.['tenant_id']
|
|
22
|
+
: undefined,
|
|
23
|
+
roles: Guards.isArray(appMetadata['roles']) ? appMetadata['roles'] : undefined,
|
|
24
|
+
permissions: Guards.isArray(appMetadata['permissions'])
|
|
25
|
+
? appMetadata['permissions']
|
|
26
|
+
: undefined,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=supabase-claims.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supabase-claims.mapper.js","sourceRoot":"","sources":["../../../src/infrastructure/mappers/supabase-claims.mapper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC;;;;;;;;KAQK;AACL,MAAM,OAAO,oBAAoB;IACxB,GAAG,CAAC,IAAU;QACnB,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,CAAA;QAE3C,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,EAAE;YACZ,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC;gBACjD,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC;gBAC9B,CAAC,CAAC,SAAS;YACb,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,CAAC;gBACnD,CAAC,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC;gBAC5B,CAAC,CAAC,SAAS;YACb,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAE,WAAW,CAAC,OAAO,CAAc,CAAC,CAAC,CAAC,SAAS;YAC5F,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;gBACrD,CAAC,CAAE,WAAW,CAAC,aAAa,CAAc;gBAC1C,CAAC,CAAC,SAAS;SACd,CAAA;IACH,CAAC;CACF"}
|