@forklaunch/core 0.2.6 → 0.2.7
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/lib/jest.config.d.ts.map +1 -1
- package/lib/jest.config.js +0 -2
- package/lib/src/http/guards/isForklaunchRouter.d.ts +4 -0
- package/lib/src/http/guards/isForklaunchRouter.d.ts.map +1 -0
- package/lib/src/http/guards/isForklaunchRouter.js +7 -0
- package/lib/src/http/guards/isTypedHandler.d.ts +1 -1
- package/lib/src/http/guards/isTypedHandler.d.ts.map +1 -1
- package/lib/src/http/handlers/typedAuthHandler.d.ts +5 -0
- package/lib/src/http/handlers/typedAuthHandler.d.ts.map +1 -0
- package/lib/src/http/handlers/typedAuthHandler.js +3 -0
- package/lib/src/http/handlers/typedHandler.d.ts +0 -6
- package/lib/src/http/handlers/typedHandler.d.ts.map +1 -1
- package/lib/src/http/index.d.ts +2 -0
- package/lib/src/http/index.d.ts.map +1 -1
- package/lib/src/http/index.js +2 -0
- package/lib/src/http/middleware/request/auth.middleware.d.ts +3 -18
- package/lib/src/http/middleware/request/auth.middleware.d.ts.map +1 -1
- package/lib/src/http/middleware/request/auth.middleware.js +104 -69
- package/lib/src/http/openApiV3Generator/openApiV3Generator.js +1 -1
- package/lib/src/http/router/expressLikeRouter.d.ts.map +1 -1
- package/lib/src/http/router/expressLikeRouter.js +4 -23
- package/lib/src/http/types/apiDefinition.types.d.ts +36 -13
- package/lib/src/http/types/apiDefinition.types.d.ts.map +1 -1
- package/lib/src/http/types/contractDetails.types.d.ts +53 -11
- package/lib/src/http/types/contractDetails.types.d.ts.map +1 -1
- package/lib/src/http/types/expressLikeRouter.types.d.ts +1 -1
- package/lib/src/http/types/expressLikeRouter.types.d.ts.map +1 -1
- package/lib/src/http/types/typedHandler.types.d.ts +10 -0
- package/lib/src/http/types/typedHandler.types.d.ts.map +1 -0
- package/lib/tests/expressLikeRouterInstantiation.test.js +47 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -15
- package/LICENSE +0 -21
- package/lib/dist/cache/index.d.ts +0 -4
- package/lib/dist/cache/index.d.ts.map +0 -1
- package/lib/dist/cache/index.js +0 -3
- package/lib/dist/cache/interfaces/ttlCache.interface.d.ts +0 -2
- package/lib/dist/cache/interfaces/ttlCache.interface.d.ts.map +0 -1
- package/lib/dist/cache/redisTtlCache.d.ts +0 -353
- package/lib/dist/cache/redisTtlCache.d.ts.map +0 -1
- package/lib/dist/cache/redisTtlCache.js +0 -98
- package/lib/dist/cache/types/ttlCacheRecord.types.d.ts +0 -2
- package/lib/dist/cache/types/ttlCacheRecord.types.d.ts.map +0 -1
- package/lib/dist/cache/types/ttlCacheRecord.types.js +0 -1
- package/lib/dist/controllers/index.d.ts +0 -2
- package/lib/dist/controllers/index.d.ts.map +0 -1
- package/lib/dist/controllers/index.js +0 -1
- package/lib/dist/controllers/interfaces/controller.interface.d.ts +0 -2
- package/lib/dist/controllers/interfaces/controller.interface.d.ts.map +0 -1
- package/lib/dist/controllers/interfaces/controller.interface.js +0 -1
- package/lib/dist/database/index.d.ts +0 -2
- package/lib/dist/database/index.d.ts.map +0 -1
- package/lib/dist/database/index.js +0 -1
- package/lib/dist/database/mikro/models/entities/base.entity.d.ts +0 -26
- package/lib/dist/database/mikro/models/entities/base.entity.d.ts.map +0 -1
- package/lib/dist/database/mikro/models/entities/base.entity.js +0 -46
- package/lib/dist/entityMapper/index.d.ts +0 -3
- package/lib/dist/entityMapper/index.d.ts.map +0 -1
- package/lib/dist/entityMapper/index.js +0 -2
- package/lib/dist/entityMapper/interfaces/entityMapper.interface.d.ts +0 -2
- package/lib/dist/entityMapper/interfaces/entityMapper.interface.d.ts.map +0 -1
- package/lib/dist/entityMapper/interfaces/entityMapper.interface.js +0 -1
- package/lib/dist/entityMapper/models/baseEntityMapper.model.d.ts +0 -63
- package/lib/dist/entityMapper/models/baseEntityMapper.model.d.ts.map +0 -1
- package/lib/dist/entityMapper/models/baseEntityMapper.model.js +0 -75
- package/lib/dist/entityMapper/models/requestEntityMapper.model.d.ts +0 -58
- package/lib/dist/entityMapper/models/requestEntityMapper.model.d.ts.map +0 -1
- package/lib/dist/entityMapper/models/requestEntityMapper.model.js +0 -70
- package/lib/dist/entityMapper/models/responseEntityMapper.model.d.ts +0 -56
- package/lib/dist/entityMapper/models/responseEntityMapper.model.d.ts.map +0 -1
- package/lib/dist/entityMapper/models/responseEntityMapper.model.js +0 -65
- package/lib/dist/entityMapper/types/entityMapper.types.d.ts +0 -2
- package/lib/dist/entityMapper/types/entityMapper.types.d.ts.map +0 -1
- package/lib/dist/entityMapper/types/entityMapper.types.js +0 -1
- package/lib/dist/http/guards/isHttpContractDetails.d.ts +0 -5
- package/lib/dist/http/guards/isHttpContractDetails.d.ts.map +0 -1
- package/lib/dist/http/guards/isHttpContractDetails.js +0 -6
- package/lib/dist/http/guards/isResponseShape.d.ts +0 -2
- package/lib/dist/http/guards/isResponseShape.d.ts.map +0 -1
- package/lib/dist/http/guards/isResponseShape.js +0 -7
- package/lib/dist/http/index.d.ts +0 -6
- package/lib/dist/http/index.d.ts.map +0 -1
- package/lib/dist/http/index.js +0 -5
- package/lib/dist/http/interfaces/expressLikeApplication.interface.d.ts +0 -12
- package/lib/dist/http/interfaces/expressLikeApplication.interface.d.ts.map +0 -1
- package/lib/dist/http/interfaces/expressLikeApplication.interface.js +0 -14
- package/lib/dist/http/interfaces/expressLikeRouter.interface.d.ts +0 -103
- package/lib/dist/http/interfaces/expressLikeRouter.interface.d.ts.map +0 -1
- package/lib/dist/http/interfaces/expressLikeRouter.interface.js +0 -336
- package/lib/dist/http/interfaces/index.d.ts +0 -3
- package/lib/dist/http/interfaces/index.d.ts.map +0 -1
- package/lib/dist/http/interfaces/index.js +0 -2
- package/lib/dist/http/middleware/index.d.ts +0 -3
- package/lib/dist/http/middleware/index.d.ts.map +0 -1
- package/lib/dist/http/middleware/index.js +0 -2
- package/lib/dist/http/middleware/request.middleware.d.ts +0 -69
- package/lib/dist/http/middleware/request.middleware.d.ts.map +0 -1
- package/lib/dist/http/middleware/request.middleware.js +0 -210
- package/lib/dist/http/middleware/response.middleware.d.ts +0 -27
- package/lib/dist/http/middleware/response.middleware.d.ts.map +0 -1
- package/lib/dist/http/middleware/response.middleware.js +0 -52
- package/lib/dist/http/openApiV3Generator/index.d.ts +0 -2
- package/lib/dist/http/openApiV3Generator/index.d.ts.map +0 -1
- package/lib/dist/http/openApiV3Generator/index.js +0 -1
- package/lib/dist/http/openApiV3Generator/openApiV3Generator.d.ts +0 -11
- package/lib/dist/http/openApiV3Generator/openApiV3Generator.d.ts.map +0 -1
- package/lib/dist/http/openApiV3Generator/openApiV3Generator.js +0 -167
- package/lib/dist/http/types/apiDefinition.types.d.ts +0 -2
- package/lib/dist/http/types/apiDefinition.types.d.ts.map +0 -1
- package/lib/dist/http/types/apiDefinition.types.js +0 -1
- package/lib/dist/http/types/contractDetails.types.d.ts +0 -2
- package/lib/dist/http/types/contractDetails.types.d.ts.map +0 -1
- package/lib/dist/http/types/contractDetails.types.js +0 -1
- package/lib/dist/http/types/index.d.ts +0 -4
- package/lib/dist/http/types/index.d.ts.map +0 -1
- package/lib/dist/http/types/index.js +0 -3
- package/lib/dist/http/types/router.types.d.ts +0 -2
- package/lib/dist/http/types/router.types.d.ts.map +0 -1
- package/lib/dist/http/types/router.types.js +0 -1
- package/lib/dist/http/utils/enrichExpressLikeSend.d.ts +0 -28
- package/lib/dist/http/utils/enrichExpressLikeSend.d.ts.map +0 -1
- package/lib/dist/http/utils/enrichExpressLikeSend.js +0 -50
- package/lib/dist/http/utils/httpStatusCodes.d.ts +0 -986
- package/lib/dist/http/utils/httpStatusCodes.d.ts.map +0 -1
- package/lib/dist/http/utils/httpStatusCodes.js +0 -1039
- package/lib/dist/http/utils/index.d.ts +0 -3
- package/lib/dist/http/utils/index.d.ts.map +0 -1
- package/lib/dist/http/utils/index.js +0 -2
- package/lib/dist/index.d.ts +0 -7
- package/lib/dist/index.d.ts.map +0 -1
- package/lib/dist/index.js +0 -6
- package/lib/dist/jest.config.d.ts +0 -15
- package/lib/dist/jest.config.d.ts.map +0 -1
- package/lib/dist/jest.config.js +0 -21
- package/lib/dist/lib/index.d.ts +0 -7
- package/lib/dist/lib/index.d.ts.map +0 -1
- package/lib/dist/lib/index.js +0 -6
- package/lib/dist/lib/jest.config.d.ts +0 -15
- package/lib/dist/lib/jest.config.d.ts.map +0 -1
- package/lib/dist/lib/jest.config.js +0 -21
- package/lib/dist/lib/src/cache/index.d.ts +0 -4
- package/lib/dist/lib/src/cache/index.d.ts.map +0 -1
- package/lib/dist/lib/src/cache/index.js +0 -3
- package/lib/dist/lib/src/cache/interfaces/ttlCache.interface.d.ts +0 -2
- package/lib/dist/lib/src/cache/interfaces/ttlCache.interface.d.ts.map +0 -1
- package/lib/dist/lib/src/cache/interfaces/ttlCache.interface.js +0 -1
- package/lib/dist/lib/src/cache/redisTtlCache.d.ts +0 -353
- package/lib/dist/lib/src/cache/redisTtlCache.d.ts.map +0 -1
- package/lib/dist/lib/src/cache/redisTtlCache.js +0 -98
- package/lib/dist/lib/src/cache/types/ttlCacheRecord.types.d.ts +0 -2
- package/lib/dist/lib/src/cache/types/ttlCacheRecord.types.d.ts.map +0 -1
- package/lib/dist/lib/src/cache/types/ttlCacheRecord.types.js +0 -1
- package/lib/dist/lib/src/controllers/index.d.ts +0 -2
- package/lib/dist/lib/src/controllers/index.d.ts.map +0 -1
- package/lib/dist/lib/src/controllers/index.js +0 -1
- package/lib/dist/lib/src/controllers/interfaces/controller.interface.d.ts +0 -2
- package/lib/dist/lib/src/controllers/interfaces/controller.interface.d.ts.map +0 -1
- package/lib/dist/lib/src/controllers/interfaces/controller.interface.js +0 -1
- package/lib/dist/lib/src/database/index.d.ts +0 -2
- package/lib/dist/lib/src/database/index.d.ts.map +0 -1
- package/lib/dist/lib/src/database/index.js +0 -1
- package/lib/dist/lib/src/database/mikro/models/entities/base.entity.d.ts +0 -26
- package/lib/dist/lib/src/database/mikro/models/entities/base.entity.d.ts.map +0 -1
- package/lib/dist/lib/src/database/mikro/models/entities/base.entity.js +0 -46
- package/lib/dist/lib/src/domainMapper/index.d.ts +0 -3
- package/lib/dist/lib/src/domainMapper/index.d.ts.map +0 -1
- package/lib/dist/lib/src/domainMapper/index.js +0 -2
- package/lib/dist/lib/src/domainMapper/interfaces/dtoMapper.interface.d.ts +0 -2
- package/lib/dist/lib/src/domainMapper/interfaces/dtoMapper.interface.d.ts.map +0 -1
- package/lib/dist/lib/src/domainMapper/interfaces/dtoMapper.interface.js +0 -1
- package/lib/dist/lib/src/domainMapper/models/baseDtoMapper.model.d.ts +0 -63
- package/lib/dist/lib/src/domainMapper/models/baseDtoMapper.model.d.ts.map +0 -1
- package/lib/dist/lib/src/domainMapper/models/baseDtoMapper.model.js +0 -75
- package/lib/dist/lib/src/domainMapper/models/requestDtoMapper.model.d.ts +0 -58
- package/lib/dist/lib/src/domainMapper/models/requestDtoMapper.model.d.ts.map +0 -1
- package/lib/dist/lib/src/domainMapper/models/requestDtoMapper.model.js +0 -70
- package/lib/dist/lib/src/domainMapper/models/responseDtoMapper.model.d.ts +0 -56
- package/lib/dist/lib/src/domainMapper/models/responseDtoMapper.model.d.ts.map +0 -1
- package/lib/dist/lib/src/domainMapper/models/responseDtoMapper.model.js +0 -65
- package/lib/dist/lib/src/domainMapper/types/dtoMapper.types.d.ts +0 -2
- package/lib/dist/lib/src/domainMapper/types/dtoMapper.types.d.ts.map +0 -1
- package/lib/dist/lib/src/domainMapper/types/dtoMapper.types.js +0 -1
- package/lib/dist/lib/src/dtoMapper/index.d.ts +0 -3
- package/lib/dist/lib/src/dtoMapper/index.d.ts.map +0 -1
- package/lib/dist/lib/src/dtoMapper/index.js +0 -2
- package/lib/dist/lib/src/dtoMapper/interfaces/dtoMapper.interface.d.ts +0 -2
- package/lib/dist/lib/src/dtoMapper/interfaces/dtoMapper.interface.d.ts.map +0 -1
- package/lib/dist/lib/src/dtoMapper/interfaces/dtoMapper.interface.js +0 -1
- package/lib/dist/lib/src/dtoMapper/models/baseDtoMapper.model.d.ts +0 -63
- package/lib/dist/lib/src/dtoMapper/models/baseDtoMapper.model.d.ts.map +0 -1
- package/lib/dist/lib/src/dtoMapper/models/baseDtoMapper.model.js +0 -75
- package/lib/dist/lib/src/dtoMapper/models/requestDtoMapper.model.d.ts +0 -58
- package/lib/dist/lib/src/dtoMapper/models/requestDtoMapper.model.d.ts.map +0 -1
- package/lib/dist/lib/src/dtoMapper/models/requestDtoMapper.model.js +0 -70
- package/lib/dist/lib/src/dtoMapper/models/responseDtoMapper.model.d.ts +0 -56
- package/lib/dist/lib/src/dtoMapper/models/responseDtoMapper.model.d.ts.map +0 -1
- package/lib/dist/lib/src/dtoMapper/models/responseDtoMapper.model.js +0 -65
- package/lib/dist/lib/src/dtoMapper/types/dtoMapper.types.d.ts +0 -2
- package/lib/dist/lib/src/dtoMapper/types/dtoMapper.types.d.ts.map +0 -1
- package/lib/dist/lib/src/dtoMapper/types/dtoMapper.types.js +0 -1
- package/lib/dist/lib/src/http/application/expressLikeApplication.d.ts +0 -18
- package/lib/dist/lib/src/http/application/expressLikeApplication.d.ts.map +0 -1
- package/lib/dist/lib/src/http/application/expressLikeApplication.js +0 -20
- package/lib/dist/lib/src/http/guards/isHttpContractDetails.d.ts +0 -5
- package/lib/dist/lib/src/http/guards/isHttpContractDetails.d.ts.map +0 -1
- package/lib/dist/lib/src/http/guards/isHttpContractDetails.js +0 -6
- package/lib/dist/lib/src/http/guards/isResponseShape.d.ts +0 -2
- package/lib/dist/lib/src/http/guards/isResponseShape.d.ts.map +0 -1
- package/lib/dist/lib/src/http/guards/isResponseShape.js +0 -7
- package/lib/dist/lib/src/http/handler/typedHandler.d.ts +0 -21
- package/lib/dist/lib/src/http/handler/typedHandler.d.ts.map +0 -1
- package/lib/dist/lib/src/http/handler/typedHandler.js +0 -25
- package/lib/dist/lib/src/http/index.d.ts +0 -11
- package/lib/dist/lib/src/http/index.d.ts.map +0 -1
- package/lib/dist/lib/src/http/index.js +0 -10
- package/lib/dist/lib/src/http/interfaces/expressLikeApplication.interface.d.ts +0 -12
- package/lib/dist/lib/src/http/interfaces/expressLikeApplication.interface.d.ts.map +0 -1
- package/lib/dist/lib/src/http/interfaces/expressLikeApplication.interface.js +0 -14
- package/lib/dist/lib/src/http/interfaces/expressLikeRouter.interface.d.ts +0 -2
- package/lib/dist/lib/src/http/interfaces/expressLikeRouter.interface.d.ts.map +0 -1
- package/lib/dist/lib/src/http/interfaces/expressLikeRouter.interface.js +0 -1
- package/lib/dist/lib/src/http/interfaces/index.d.ts +0 -3
- package/lib/dist/lib/src/http/interfaces/index.d.ts.map +0 -1
- package/lib/dist/lib/src/http/interfaces/index.js +0 -2
- package/lib/dist/lib/src/http/middleware/index.d.ts +0 -3
- package/lib/dist/lib/src/http/middleware/index.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/index.js +0 -2
- package/lib/dist/lib/src/http/middleware/request/auth.middleware.d.ts +0 -27
- package/lib/dist/lib/src/http/middleware/request/auth.middleware.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/request/auth.middleware.js +0 -107
- package/lib/dist/lib/src/http/middleware/request/cors.middleware.d.ts +0 -9
- package/lib/dist/lib/src/http/middleware/request/cors.middleware.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/request/cors.middleware.js +0 -15
- package/lib/dist/lib/src/http/middleware/request/createContext.middleware.d.ts +0 -12
- package/lib/dist/lib/src/http/middleware/request/createContext.middleware.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/request/createContext.middleware.js +0 -26
- package/lib/dist/lib/src/http/middleware/request/enrichDetails.middleware.d.ts +0 -12
- package/lib/dist/lib/src/http/middleware/request/enrichDetails.middleware.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/request/enrichDetails.middleware.js +0 -19
- package/lib/dist/lib/src/http/middleware/request/parse.middleware.d.ts +0 -13
- package/lib/dist/lib/src/http/middleware/request/parse.middleware.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/request/parse.middleware.js +0 -43
- package/lib/dist/lib/src/http/middleware/request.middleware.d.ts +0 -69
- package/lib/dist/lib/src/http/middleware/request.middleware.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/request.middleware.js +0 -210
- package/lib/dist/lib/src/http/middleware/response/parse.middleware.d.ts +0 -27
- package/lib/dist/lib/src/http/middleware/response/parse.middleware.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/response/parse.middleware.js +0 -52
- package/lib/dist/lib/src/http/middleware/response.middleware.d.ts +0 -27
- package/lib/dist/lib/src/http/middleware/response.middleware.d.ts.map +0 -1
- package/lib/dist/lib/src/http/middleware/response.middleware.js +0 -52
- package/lib/dist/lib/src/http/openApiV3Generator/index.d.ts +0 -2
- package/lib/dist/lib/src/http/openApiV3Generator/index.d.ts.map +0 -1
- package/lib/dist/lib/src/http/openApiV3Generator/index.js +0 -1
- package/lib/dist/lib/src/http/openApiV3Generator/openApiV3Generator.d.ts +0 -11
- package/lib/dist/lib/src/http/openApiV3Generator/openApiV3Generator.d.ts.map +0 -1
- package/lib/dist/lib/src/http/openApiV3Generator/openApiV3Generator.js +0 -167
- package/lib/dist/lib/src/http/router/expressLikeRouter.d.ts +0 -89
- package/lib/dist/lib/src/http/router/expressLikeRouter.d.ts.map +0 -1
- package/lib/dist/lib/src/http/router/expressLikeRouter.js +0 -322
- package/lib/dist/lib/src/http/types/apiDefinition.types.d.ts +0 -2
- package/lib/dist/lib/src/http/types/apiDefinition.types.d.ts.map +0 -1
- package/lib/dist/lib/src/http/types/apiDefinition.types.js +0 -1
- package/lib/dist/lib/src/http/types/contractDetails.types.d.ts +0 -2
- package/lib/dist/lib/src/http/types/contractDetails.types.d.ts.map +0 -1
- package/lib/dist/lib/src/http/types/contractDetails.types.js +0 -1
- package/lib/dist/lib/src/http/types/index.d.ts +0 -4
- package/lib/dist/lib/src/http/types/index.d.ts.map +0 -1
- package/lib/dist/lib/src/http/types/index.js +0 -3
- package/lib/dist/lib/src/http/types/router.types.d.ts +0 -2
- package/lib/dist/lib/src/http/types/router.types.d.ts.map +0 -1
- package/lib/dist/lib/src/http/types/router.types.js +0 -1
- package/lib/dist/lib/src/http/utils/enrichExpressLikeSend.d.ts +0 -28
- package/lib/dist/lib/src/http/utils/enrichExpressLikeSend.d.ts.map +0 -1
- package/lib/dist/lib/src/http/utils/enrichExpressLikeSend.js +0 -50
- package/lib/dist/lib/src/http/utils/httpStatusCodes.d.ts +0 -986
- package/lib/dist/lib/src/http/utils/httpStatusCodes.d.ts.map +0 -1
- package/lib/dist/lib/src/http/utils/httpStatusCodes.js +0 -1039
- package/lib/dist/lib/src/http/utils/index.d.ts +0 -3
- package/lib/dist/lib/src/http/utils/index.d.ts.map +0 -1
- package/lib/dist/lib/src/http/utils/index.js +0 -2
- package/lib/dist/lib/src/services/index.d.ts +0 -2
- package/lib/dist/lib/src/services/index.d.ts.map +0 -1
- package/lib/dist/lib/src/services/index.js +0 -1
- package/lib/dist/lib/src/services/interfaces/baseService.d.ts +0 -2
- package/lib/dist/lib/src/services/interfaces/baseService.d.ts.map +0 -1
- package/lib/dist/lib/src/services/interfaces/baseService.js +0 -1
- package/lib/dist/lib/tests/dtoMapper.test.d.ts +0 -2
- package/lib/dist/lib/tests/dtoMapper.test.d.ts.map +0 -1
- package/lib/dist/lib/tests/dtoMapper.test.js +0 -172
- package/lib/dist/lib/tests/entityMapper.test.d.ts +0 -2
- package/lib/dist/lib/tests/entityMapper.test.d.ts.map +0 -1
- package/lib/dist/lib/tests/entityMapper.test.js +0 -172
- package/lib/dist/lib/tests/expressLikeRouter.test.d.ts +0 -2
- package/lib/dist/lib/tests/expressLikeRouter.test.d.ts.map +0 -1
- package/lib/dist/lib/tests/expressLikeRouter.test.js +0 -3
- package/lib/dist/lib/tests/http.middleware.test.d.ts +0 -2
- package/lib/dist/lib/tests/http.middleware.test.d.ts.map +0 -1
- package/lib/dist/lib/tests/http.middleware.test.js +0 -95
- package/lib/dist/lib/tests/openApiV3Generator.test.d.ts +0 -2
- package/lib/dist/lib/tests/openApiV3Generator.test.d.ts.map +0 -1
- package/lib/dist/lib/tests/openApiV3Generator.test.js +0 -66
- package/lib/dist/lib/tests/redisTtlCache.test.d.ts +0 -2
- package/lib/dist/lib/tests/redisTtlCache.test.d.ts.map +0 -1
- package/lib/dist/lib/tests/redisTtlCache.test.js +0 -49
- package/lib/dist/lib/tests/typedHandler.test.d.ts +0 -2
- package/lib/dist/lib/tests/typedHandler.test.d.ts.map +0 -1
- package/lib/dist/lib/tests/typedHandler.test.js +0 -3
- package/lib/dist/lib/vitest.config.d.ts +0 -3
- package/lib/dist/lib/vitest.config.d.ts.map +0 -1
- package/lib/dist/lib/vitest.config.js +0 -7
- package/lib/dist/services/index.d.ts +0 -2
- package/lib/dist/services/index.d.ts.map +0 -1
- package/lib/dist/services/index.js +0 -1
- package/lib/dist/services/interfaces/baseService.d.ts +0 -2
- package/lib/dist/services/interfaces/baseService.d.ts.map +0 -1
- package/lib/dist/services/interfaces/baseService.js +0 -1
- package/lib/dist/tests/entityMapper.test.d.ts +0 -2
- package/lib/dist/tests/entityMapper.test.d.ts.map +0 -1
- package/lib/dist/tests/entityMapper.test.js +0 -171
- package/lib/dist/tests/http.middleware.test.d.ts +0 -2
- package/lib/dist/tests/http.middleware.test.d.ts.map +0 -1
- package/lib/dist/tests/http.middleware.test.js +0 -93
- package/lib/dist/tests/openApiV3Generator.test.d.ts +0 -2
- package/lib/dist/tests/openApiV3Generator.test.d.ts.map +0 -1
- package/lib/dist/tests/openApiV3Generator.test.js +0 -66
- package/lib/dist/tests/redisTtlCache.test.d.ts +0 -2
- package/lib/dist/tests/redisTtlCache.test.d.ts.map +0 -1
- package/lib/dist/tests/redisTtlCache.test.js +0 -49
- package/lib/index.d.ts +0 -7
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -7
- package/lib/src/domainMapper/index.d.ts +0 -3
- package/lib/src/domainMapper/index.d.ts.map +0 -1
- package/lib/src/domainMapper/index.js +0 -2
- package/lib/src/domainMapper/interfaces/dtoMapper.interface.d.ts +0 -18
- package/lib/src/domainMapper/interfaces/dtoMapper.interface.d.ts.map +0 -1
- package/lib/src/domainMapper/interfaces/dtoMapper.interface.js +0 -1
- package/lib/src/domainMapper/models/baseDtoMapper.model.d.ts +0 -72
- package/lib/src/domainMapper/models/baseDtoMapper.model.d.ts.map +0 -1
- package/lib/src/domainMapper/models/baseDtoMapper.model.js +0 -75
- package/lib/src/domainMapper/models/requestDtoMapper.model.d.ts +0 -68
- package/lib/src/domainMapper/models/requestDtoMapper.model.d.ts.map +0 -1
- package/lib/src/domainMapper/models/requestDtoMapper.model.js +0 -70
- package/lib/src/domainMapper/models/responseDtoMapper.model.d.ts +0 -67
- package/lib/src/domainMapper/models/responseDtoMapper.model.d.ts.map +0 -1
- package/lib/src/domainMapper/models/responseDtoMapper.model.js +0 -65
- package/lib/src/domainMapper/types/dtoMapper.types.d.ts +0 -9
- package/lib/src/domainMapper/types/dtoMapper.types.d.ts.map +0 -1
- package/lib/src/domainMapper/types/dtoMapper.types.js +0 -1
- package/lib/src/http/handler/typedHandler.d.ts +0 -24
- package/lib/src/http/handler/typedHandler.d.ts.map +0 -1
- package/lib/src/http/handler/typedHandler.js +0 -25
- package/lib/src/http/interfaces/expressLikeApplication.interface.d.ts +0 -16
- package/lib/src/http/interfaces/expressLikeApplication.interface.d.ts.map +0 -1
- package/lib/src/http/interfaces/expressLikeApplication.interface.js +0 -14
- package/lib/src/http/interfaces/index.d.ts +0 -3
- package/lib/src/http/interfaces/index.d.ts.map +0 -1
- package/lib/src/http/interfaces/index.js +0 -2
- package/lib/src/http/middleware/index.d.ts +0 -3
- package/lib/src/http/middleware/index.d.ts.map +0 -1
- package/lib/src/http/middleware/index.js +0 -2
- package/lib/src/http/middleware/request.middleware.d.ts +0 -73
- package/lib/src/http/middleware/request.middleware.d.ts.map +0 -1
- package/lib/src/http/middleware/request.middleware.js +0 -210
- package/lib/src/http/middleware/response.middleware.d.ts +0 -31
- package/lib/src/http/middleware/response.middleware.d.ts.map +0 -1
- package/lib/src/http/middleware/response.middleware.js +0 -52
- package/lib/src/http/openApiV3Generator/index.d.ts +0 -2
- package/lib/src/http/openApiV3Generator/index.d.ts.map +0 -1
- package/lib/src/http/openApiV3Generator/index.js +0 -1
- package/lib/src/http/types/index.d.ts +0 -4
- package/lib/src/http/types/index.d.ts.map +0 -1
- package/lib/src/http/types/index.js +0 -3
- package/lib/src/http/utils/index.d.ts +0 -3
- package/lib/src/http/utils/index.d.ts.map +0 -1
- package/lib/src/http/utils/index.js +0 -2
- package/lib/tests/entityMapper.test.d.ts +0 -2
- package/lib/tests/entityMapper.test.d.ts.map +0 -1
- package/lib/tests/entityMapper.test.js +0 -168
- package/lib/tests/expressLikeRouter.test.d.ts +0 -2
- package/lib/tests/expressLikeRouter.test.d.ts.map +0 -1
- package/lib/tests/expressLikeRouter.test.js +0 -3
- /package/lib/{dist/cache/interfaces/ttlCache.interface.js → src/http/types/typedHandler.types.js} +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dist/services/index.js"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './interfaces/baseService';
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"baseService.d.ts","sourceRoot":"","sources":["../../../../dist/services/interfaces/baseService.js"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"entityMapper.test.d.ts","sourceRoot":"","sources":["../../../dist/tests/entityMapper.test.js"],"names":[],"mappings":""}
|
@@ -1,171 +0,0 @@
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
4
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else
|
6
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
7
|
-
if (d = decorators[i])
|
8
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
10
|
-
};
|
11
|
-
import { TypeboxSchemaValidator, number, string } from '@forklaunch/validator/typebox';
|
12
|
-
import { Property } from '@mikro-orm/core';
|
13
|
-
import { BaseEntity } from '../database/mikro/models/entities/base.entity';
|
14
|
-
import { RequestEntityMapper } from '../entityMapper/models/requestEntityMapper.model';
|
15
|
-
import { ResponseEntityMapper } from '../entityMapper/models/responseEntityMapper.model';
|
16
|
-
class TestEntity extends BaseEntity {
|
17
|
-
name;
|
18
|
-
age;
|
19
|
-
}
|
20
|
-
__decorate([
|
21
|
-
Property()
|
22
|
-
], TestEntity.prototype, "name", void 0);
|
23
|
-
__decorate([
|
24
|
-
Property()
|
25
|
-
], TestEntity.prototype, "age", void 0);
|
26
|
-
class TestRequestEntityMapper extends RequestEntityMapper {
|
27
|
-
schema = {
|
28
|
-
id: string,
|
29
|
-
name: string,
|
30
|
-
age: number
|
31
|
-
};
|
32
|
-
toEntity(...additionalArgs) {
|
33
|
-
const entity = new TestEntity();
|
34
|
-
entity.id = this.dto.id;
|
35
|
-
entity.name = this.dto.name;
|
36
|
-
entity.age = this.dto.age;
|
37
|
-
return entity;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
class TestResponseEntityMapper extends ResponseEntityMapper {
|
41
|
-
schema = {
|
42
|
-
id: string,
|
43
|
-
name: string,
|
44
|
-
age: number
|
45
|
-
};
|
46
|
-
fromEntity(entity) {
|
47
|
-
this.dto = {
|
48
|
-
id: entity.id,
|
49
|
-
name: entity.name,
|
50
|
-
age: entity.age
|
51
|
-
};
|
52
|
-
return this;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
function extractNonTimeBasedEntityFields(entity) {
|
56
|
-
entity.createdAt = new Date(0);
|
57
|
-
entity.updatedAt = new Date(0);
|
58
|
-
return entity;
|
59
|
-
}
|
60
|
-
describe('Request Entity Mapper Test', () => {
|
61
|
-
let TestRequestEM;
|
62
|
-
beforeAll(() => {
|
63
|
-
TestRequestEM = new TestRequestEntityMapper(new TypeboxSchemaValidator());
|
64
|
-
});
|
65
|
-
test('Schema Equality', async () => {
|
66
|
-
expect(TestRequestEM.schema).toEqual(TestRequestEntityMapper.schema());
|
67
|
-
});
|
68
|
-
test('From JSON', async () => {
|
69
|
-
const json = {
|
70
|
-
id: '123',
|
71
|
-
name: 'test',
|
72
|
-
age: 1
|
73
|
-
};
|
74
|
-
const responseEM = TestRequestEM.fromJson(json);
|
75
|
-
const staticEM = TestRequestEntityMapper.fromJson(new TypeboxSchemaValidator(), json);
|
76
|
-
const expectedDto = {
|
77
|
-
id: '123',
|
78
|
-
name: 'test',
|
79
|
-
age: 1
|
80
|
-
};
|
81
|
-
expect(staticEM.dto).toEqual(expectedDto);
|
82
|
-
expect(responseEM.dto).toEqual(expectedDto);
|
83
|
-
expect(responseEM.dto).toEqual(staticEM.dto);
|
84
|
-
});
|
85
|
-
test('Deserialization Equality', async () => {
|
86
|
-
const json = {
|
87
|
-
id: '123',
|
88
|
-
name: 'test',
|
89
|
-
age: 1
|
90
|
-
};
|
91
|
-
const entity = extractNonTimeBasedEntityFields(TestRequestEM.deserializeJsonToEntity(json));
|
92
|
-
const objectEntity = extractNonTimeBasedEntityFields(TestRequestEM.fromJson(json).toEntity());
|
93
|
-
const staticEntity = extractNonTimeBasedEntityFields(TestRequestEntityMapper.deserializeJsonToEntity(new TypeboxSchemaValidator(), json));
|
94
|
-
let expectedEntity = new TestEntity();
|
95
|
-
expectedEntity.id = '123';
|
96
|
-
expectedEntity.name = 'test';
|
97
|
-
expectedEntity.age = 1;
|
98
|
-
expectedEntity = extractNonTimeBasedEntityFields(expectedEntity);
|
99
|
-
expect(entity).toEqual(expectedEntity);
|
100
|
-
expect(objectEntity).toEqual(expectedEntity);
|
101
|
-
expect(staticEntity).toEqual(expectedEntity);
|
102
|
-
expect(entity).toEqual(objectEntity);
|
103
|
-
expect(entity).toEqual(staticEntity);
|
104
|
-
expect(staticEntity).toEqual(expectedEntity);
|
105
|
-
expect(staticEntity).toEqual(objectEntity);
|
106
|
-
});
|
107
|
-
test('Serialization Failure', async () => {
|
108
|
-
const json = {
|
109
|
-
id: '123',
|
110
|
-
name: 'test'
|
111
|
-
};
|
112
|
-
// @ts-expect-error
|
113
|
-
expect(() => TestRequestEM.fromJson(json)).toThrow();
|
114
|
-
expect(() =>
|
115
|
-
// @ts-expect-error
|
116
|
-
TestRequestEntityMapper.fromJson(new TypeboxSchemaValidator(), json)).toThrow();
|
117
|
-
});
|
118
|
-
});
|
119
|
-
describe('Response Entity Mapper Test', () => {
|
120
|
-
let TestResponseEM;
|
121
|
-
beforeAll(() => {
|
122
|
-
TestResponseEM = new TestResponseEntityMapper(new TypeboxSchemaValidator());
|
123
|
-
});
|
124
|
-
test('Schema Equality', async () => {
|
125
|
-
expect(TestResponseEM.schema).toEqual(TestResponseEntityMapper.schema());
|
126
|
-
});
|
127
|
-
test('From Entity', async () => {
|
128
|
-
const entity = new TestEntity();
|
129
|
-
entity.id = '123';
|
130
|
-
entity.name = 'test';
|
131
|
-
entity.age = 1;
|
132
|
-
const responseEM = TestResponseEM.fromEntity(entity);
|
133
|
-
const staticEM = TestResponseEntityMapper.fromEntity(new TypeboxSchemaValidator(), entity);
|
134
|
-
const expectedDto = {
|
135
|
-
id: '123',
|
136
|
-
name: 'test',
|
137
|
-
age: 1
|
138
|
-
};
|
139
|
-
expect(staticEM.dto).toEqual(expectedDto);
|
140
|
-
expect(responseEM.dto).toEqual(expectedDto);
|
141
|
-
expect(responseEM.dto).toEqual(staticEM.dto);
|
142
|
-
});
|
143
|
-
test('Serialization Equality', async () => {
|
144
|
-
const entity = new TestEntity();
|
145
|
-
entity.id = '123';
|
146
|
-
entity.name = 'test';
|
147
|
-
entity.age = 1;
|
148
|
-
const json = TestResponseEM.serializeEntityToJson(entity);
|
149
|
-
const objectJson = TestResponseEM.fromEntity(entity).toJson();
|
150
|
-
const staticJson = TestResponseEntityMapper.serializeEntityToJson(new TypeboxSchemaValidator(), entity);
|
151
|
-
const expectedJson = {
|
152
|
-
id: '123',
|
153
|
-
name: 'test',
|
154
|
-
age: 1
|
155
|
-
};
|
156
|
-
expect(json).toEqual(expectedJson);
|
157
|
-
expect(objectJson).toEqual(expectedJson);
|
158
|
-
expect(staticJson).toEqual(expectedJson);
|
159
|
-
expect(json).toEqual(objectJson);
|
160
|
-
expect(json).toEqual(staticJson);
|
161
|
-
expect(staticJson).toEqual(expectedJson);
|
162
|
-
expect(staticJson).toEqual(objectJson);
|
163
|
-
});
|
164
|
-
test('Serialization Failure', async () => {
|
165
|
-
const entity = new TestEntity();
|
166
|
-
entity.id = '123';
|
167
|
-
entity.name = 'test';
|
168
|
-
expect(() => TestResponseEM.fromEntity(entity).toJson()).toThrow();
|
169
|
-
expect(() => TestResponseEntityMapper.fromEntity(new TypeboxSchemaValidator(), entity).toJson()).toThrow();
|
170
|
-
});
|
171
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"http.middleware.test.d.ts","sourceRoot":"","sources":["../../../dist/tests/http.middleware.test.js"],"names":[],"mappings":""}
|
@@ -1,93 +0,0 @@
|
|
1
|
-
import { literal, mockSchemaValidator, optional, union } from '@forklaunch/validator/tests/mockSchemaValidator';
|
2
|
-
import { createRequestContext, enrichRequestDetails, parseResponse } from '../http';
|
3
|
-
describe('Http Middleware Tests', () => {
|
4
|
-
let contractDetails;
|
5
|
-
let req;
|
6
|
-
let res;
|
7
|
-
const nextFunction = (err) => {
|
8
|
-
expect(err).toBeFalsy();
|
9
|
-
};
|
10
|
-
const testSchema = {
|
11
|
-
test: union(['a', optional(literal('test'))])
|
12
|
-
};
|
13
|
-
beforeAll(() => {
|
14
|
-
contractDetails = {
|
15
|
-
name: 'Test Contract',
|
16
|
-
summary: 'Test Contract Summary',
|
17
|
-
body: testSchema,
|
18
|
-
params: testSchema,
|
19
|
-
requestHeaders: testSchema,
|
20
|
-
query: testSchema,
|
21
|
-
responses: {
|
22
|
-
200: testSchema
|
23
|
-
}
|
24
|
-
};
|
25
|
-
req = {
|
26
|
-
method: 'POST',
|
27
|
-
context: {},
|
28
|
-
contractDetails: {},
|
29
|
-
schemaValidator: {},
|
30
|
-
params: testSchema,
|
31
|
-
headers: testSchema,
|
32
|
-
body: testSchema,
|
33
|
-
query: testSchema,
|
34
|
-
requestSchema: testSchema
|
35
|
-
};
|
36
|
-
res = {
|
37
|
-
bodyData: {},
|
38
|
-
statusCode: 200,
|
39
|
-
getHeaders: () => ({ 'x-correlation-id': '123' }),
|
40
|
-
setHeader: () => { },
|
41
|
-
status: () => ({
|
42
|
-
json: () => true,
|
43
|
-
jsonp: () => true,
|
44
|
-
send: () => { }
|
45
|
-
}),
|
46
|
-
end: () => { },
|
47
|
-
headersSent: false,
|
48
|
-
locals: {},
|
49
|
-
cors: true,
|
50
|
-
responseSchemas: {
|
51
|
-
headers: testSchema,
|
52
|
-
responses: {
|
53
|
-
200: testSchema
|
54
|
-
}
|
55
|
-
}
|
56
|
-
};
|
57
|
-
});
|
58
|
-
test('Create Request Context', async () => {
|
59
|
-
req.context = {};
|
60
|
-
req.schemaValidator = {};
|
61
|
-
createRequestContext(mockSchemaValidator)(req, res, nextFunction);
|
62
|
-
expect(req.context.correlationId).not.toBe('123');
|
63
|
-
expect(req.schemaValidator).toBe(mockSchemaValidator);
|
64
|
-
});
|
65
|
-
test('Enrich Request Details', async () => {
|
66
|
-
req.contractDetails = {};
|
67
|
-
enrichRequestDetails(contractDetails, testSchema, {
|
68
|
-
headers: testSchema,
|
69
|
-
responses: {
|
70
|
-
200: testSchema
|
71
|
-
}
|
72
|
-
})(req, res, nextFunction);
|
73
|
-
expect(req.contractDetails).toEqual(contractDetails);
|
74
|
-
});
|
75
|
-
// test('Validate Request Params', async () => {
|
76
|
-
// parseRequestParams(req, res, nextFunction);
|
77
|
-
// });
|
78
|
-
// test('Validate Request Headers', async () => {
|
79
|
-
// parseReqHeaders(req, res, nextFunction);
|
80
|
-
// });
|
81
|
-
// test('Validate Request Body', async () => {
|
82
|
-
// parseRequestBody(req, res, nextFunction);
|
83
|
-
// });
|
84
|
-
// test('Validate Request Query Params', async () => {
|
85
|
-
// parseRequestQuery(req, res, nextFunction);
|
86
|
-
// });
|
87
|
-
test('Validate Response', async () => {
|
88
|
-
parseResponse(req, res, nextFunction);
|
89
|
-
});
|
90
|
-
// Not supported yet
|
91
|
-
// test('Validate Auth', async () => {
|
92
|
-
// });
|
93
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"openApiV3Generator.test.d.ts","sourceRoot":"","sources":["../../../dist/tests/openApiV3Generator.test.js"],"names":[],"mappings":""}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { literal, mockSchemaValidator, optional, union } from '@forklaunch/validator/tests/mockSchemaValidator';
|
2
|
-
import { generateSwaggerDocument } from '../http/openApiV3Generator';
|
3
|
-
describe('OpenApiV3Generator Tests', () => {
|
4
|
-
const testSchema = {
|
5
|
-
test: union(['a', optional(literal('test'))])
|
6
|
-
};
|
7
|
-
test('Generate OpenApiV3', async () => {
|
8
|
-
const generatedOpenApiSpec = generateSwaggerDocument(mockSchemaValidator, 8000, [
|
9
|
-
{
|
10
|
-
basePath: '/api',
|
11
|
-
routes: [
|
12
|
-
{
|
13
|
-
basePath: '/test',
|
14
|
-
path: '/',
|
15
|
-
method: 'get',
|
16
|
-
contractDetails: {
|
17
|
-
name: 'Test Contract',
|
18
|
-
summary: 'Test Contract Summary',
|
19
|
-
body: testSchema,
|
20
|
-
params: testSchema,
|
21
|
-
requestHeaders: testSchema,
|
22
|
-
query: testSchema,
|
23
|
-
responses: {
|
24
|
-
200: testSchema
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
]
|
29
|
-
}
|
30
|
-
]);
|
31
|
-
expect(generatedOpenApiSpec).toEqual({
|
32
|
-
openapi: '3.1.0',
|
33
|
-
info: { title: '', version: '1.0.0' },
|
34
|
-
components: {
|
35
|
-
securitySchemes: {
|
36
|
-
bearer: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' }
|
37
|
-
}
|
38
|
-
},
|
39
|
-
tags: [{ name: 'Api', description: 'Api Operations' }],
|
40
|
-
servers: [{ url: 'http://localhost:8000' }],
|
41
|
-
paths: {
|
42
|
-
'/api': {
|
43
|
-
get: {
|
44
|
-
tags: ['Api'],
|
45
|
-
summary: 'Test Contract: Test Contract Summary',
|
46
|
-
parameters: [
|
47
|
-
{ name: 'test', in: 'path' },
|
48
|
-
{ name: 'test', in: 'header' },
|
49
|
-
{ name: 'test', in: 'query' }
|
50
|
-
],
|
51
|
-
responses: {
|
52
|
-
'200': {
|
53
|
-
description: 'OK',
|
54
|
-
content: { 'application/json': { schema: {} } }
|
55
|
-
}
|
56
|
-
},
|
57
|
-
requestBody: {
|
58
|
-
required: true,
|
59
|
-
content: { 'application/json': { schema: {} } }
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
});
|
65
|
-
});
|
66
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"redisTtlCache.test.d.ts","sourceRoot":"","sources":["../../../dist/tests/redisTtlCache.test.js"],"names":[],"mappings":""}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { GenericContainer } from 'testcontainers';
|
2
|
-
import { RedisTtlCache } from '../cache/redisTtlCache';
|
3
|
-
describe('RedisTtlCache', () => {
|
4
|
-
let container;
|
5
|
-
let cache;
|
6
|
-
let key;
|
7
|
-
let value;
|
8
|
-
let ttlMilliseconds;
|
9
|
-
beforeAll(async () => {
|
10
|
-
container = await new GenericContainer('redis')
|
11
|
-
.withExposedPorts(6379)
|
12
|
-
.start();
|
13
|
-
cache = new RedisTtlCache(5000, {
|
14
|
-
url: `redis://${container.getHost()}:${container.getMappedPort(6379)}`
|
15
|
-
});
|
16
|
-
key = 'testKey';
|
17
|
-
value = { data: 'testValue' };
|
18
|
-
ttlMilliseconds = 1000;
|
19
|
-
}, 30000);
|
20
|
-
afterAll(async () => {
|
21
|
-
await cache.disconnect();
|
22
|
-
await container.stop();
|
23
|
-
});
|
24
|
-
it('PutRecord', async () => {
|
25
|
-
await cache.putRecord({ key, value, ttlMilliseconds });
|
26
|
-
});
|
27
|
-
test('Read Record', async () => {
|
28
|
-
const storedValue = await cache.readRecord(key);
|
29
|
-
expect(storedValue).toEqual({
|
30
|
-
key,
|
31
|
-
ttlMilliseconds,
|
32
|
-
value
|
33
|
-
});
|
34
|
-
});
|
35
|
-
test('Peek Record', async () => {
|
36
|
-
const exists = await cache.peekRecord(key);
|
37
|
-
expect(exists).toBeTruthy();
|
38
|
-
});
|
39
|
-
test('Delete Record', async () => {
|
40
|
-
await cache.deleteRecord(key);
|
41
|
-
const existsAfterDelete = await cache.peekRecord(key);
|
42
|
-
expect(existsAfterDelete).toBeFalsy();
|
43
|
-
});
|
44
|
-
test('Check No Record', async () => {
|
45
|
-
await Promise.resolve(setTimeout(async () => { }, ttlMilliseconds));
|
46
|
-
const existsAfterTtl = await cache.peekRecord(key);
|
47
|
-
expect(existsAfterTtl).toBeFalsy();
|
48
|
-
});
|
49
|
-
});
|
package/lib/index.d.ts
DELETED
package/lib/index.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
package/lib/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domainMapper/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC"}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { AnySchemaValidator } from '@forklaunch/validator';
|
2
|
-
/**
|
3
|
-
* Interface representing a constructor for an entity mapper.
|
4
|
-
*
|
5
|
-
* @template T - The type of the entity mapper.
|
6
|
-
* @template SV - The type of the schema validator.
|
7
|
-
* @interface DtoMapperConstructor
|
8
|
-
*/
|
9
|
-
export interface DtoMapperConstructor<T, SV extends AnySchemaValidator> {
|
10
|
-
/**
|
11
|
-
* Creates a new instance of the entity mapper.
|
12
|
-
*
|
13
|
-
* @param {AnySchemaValidator} schemaValidator - The arguments to pass to the constructor.
|
14
|
-
* @returns {T} - A new instance of the entity mapper.
|
15
|
-
*/
|
16
|
-
new (schemaValidator: SV): T;
|
17
|
-
}
|
18
|
-
//# sourceMappingURL=dtoMapper.interface.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"dtoMapper.interface.d.ts","sourceRoot":"","sources":["../../../../src/domainMapper/interfaces/dtoMapper.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,EAAE,EAAE,SAAS,kBAAkB;IACpE;;;;;OAKG;IACH,KAAK,eAAe,EAAE,EAAE,GAAG,CAAC,CAAC;CAC9B"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,72 +0,0 @@
|
|
1
|
-
import { AnySchemaValidator, Schema, SchemaValidator } from '@forklaunch/validator';
|
2
|
-
import { DtoMapperConstructor } from '../interfaces/dtoMapper.interface';
|
3
|
-
import { DtoMapperSchemaValidatorObject } from '../types/dtoMapper.types';
|
4
|
-
/**
|
5
|
-
* Constructs an instance of a T.
|
6
|
-
*
|
7
|
-
* @template T - A type that extends BaseDtoMapper.
|
8
|
-
* @template SV - A type that extends AnySchemaValidator.
|
9
|
-
* @param {DtoMapperConstructor<T, SV>} self - The constructor of the T.
|
10
|
-
* @param {SV} [schemaValidator] - The optional schema validator.
|
11
|
-
* @returns {T} - An instance of the T.
|
12
|
-
*/
|
13
|
-
export declare function construct<T, SV extends AnySchemaValidator>(self: DtoMapperConstructor<T, SV>, schemaValidator?: SV): T;
|
14
|
-
/**
|
15
|
-
* Abstract class representing a base entity mapper.
|
16
|
-
*
|
17
|
-
* @template SV - A type that extends AnySchemaValidator.
|
18
|
-
*/
|
19
|
-
export declare abstract class BaseDtoMapper<SV extends AnySchemaValidator> {
|
20
|
-
/**
|
21
|
-
* The schema validator exact type.
|
22
|
-
* @type {SV}
|
23
|
-
* @protected
|
24
|
-
*/
|
25
|
-
_SV: SV;
|
26
|
-
/**
|
27
|
-
* The schema validator as a general type.
|
28
|
-
* @type {SchemaValidator}
|
29
|
-
* @protected
|
30
|
-
*/
|
31
|
-
protected schemaValidator: SchemaValidator;
|
32
|
-
/**
|
33
|
-
* The schema definition.
|
34
|
-
* @type {DtoMapperSchemaValidatorObject<SV>}
|
35
|
-
* @abstract
|
36
|
-
*/
|
37
|
-
abstract schema: DtoMapperSchemaValidatorObject<SV>;
|
38
|
-
/**
|
39
|
-
* The Data Transfer Object (DTO).
|
40
|
-
* @type {Schema<this['schema'], SV>}
|
41
|
-
*/
|
42
|
-
_dto: Schema<this['schema'], SV>;
|
43
|
-
/**
|
44
|
-
* Creates an instance of BaseDtoMapper.
|
45
|
-
*
|
46
|
-
* @param {SV} schemaValidator - The schema provider.
|
47
|
-
*/
|
48
|
-
constructor(schemaValidator: SV);
|
49
|
-
/**
|
50
|
-
* Validates and sets the Data Transfer Object (DTO).
|
51
|
-
*
|
52
|
-
* @param {this['_dto']} dto - The Data Transfer Object (DTO).
|
53
|
-
* @throws {Error} - Throws an error if the DTO is invalid.
|
54
|
-
*/
|
55
|
-
set dto(_dto: this['_dto']);
|
56
|
-
/**
|
57
|
-
* Validates and gets the Data Transfer Object (DTO).
|
58
|
-
*
|
59
|
-
* @returns {this['_dto']} - The Data Transfer Object (DTO).
|
60
|
-
*/
|
61
|
-
get dto(): this['_dto'];
|
62
|
-
/**
|
63
|
-
* Gets the schema of a T.
|
64
|
-
*
|
65
|
-
* @template T - A type that extends BaseDtoMapper.
|
66
|
-
* @template SV - A type that extends AnySchemaValidator.
|
67
|
-
* @param {DtoMapperConstructor<T, SV>} this - The constructor of the T.
|
68
|
-
* @returns {T['schema']} - The schema of the T.
|
69
|
-
*/
|
70
|
-
static schema<T extends BaseDtoMapper<SV>, SV extends AnySchemaValidator>(this: DtoMapperConstructor<T, SV>): T['schema'];
|
71
|
-
}
|
72
|
-
//# sourceMappingURL=baseDtoMapper.model.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"baseDtoMapper.model.d.ts","sourceRoot":"","sources":["../../../../src/domainMapper/models/baseDtoMapper.model.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAAE,SAAS,kBAAkB,EACxD,IAAI,EAAE,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,EACjC,eAAe,CAAC,EAAE,EAAE,GACnB,CAAC,CAEH;AAED;;;;GAIG;AACH,8BAAsB,aAAa,CAAC,EAAE,SAAS,kBAAkB;IAC/D;;;;OAIG;IACH,GAAG,EAAG,EAAE,CAAC;IAET;;;;OAIG;IACH,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAE3C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,8BAA8B,CAAC,EAAE,CAAC,CAAC;IAEpD;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAG9B;IAEF;;;;OAIG;gBACS,eAAe,EAAE,EAAE;IAI/B;;;;;OAKG;IACH,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAUzB;IAED;;;;OAIG;IACH,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAEtB;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,kBAAkB,EACtE,IAAI,EAAE,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,GAChC,CAAC,CAAC,QAAQ,CAAC;CAGf"}
|
@@ -1,75 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Constructs an instance of a T.
|
3
|
-
*
|
4
|
-
* @template T - A type that extends BaseDtoMapper.
|
5
|
-
* @template SV - A type that extends AnySchemaValidator.
|
6
|
-
* @param {DtoMapperConstructor<T, SV>} self - The constructor of the T.
|
7
|
-
* @param {SV} [schemaValidator] - The optional schema validator.
|
8
|
-
* @returns {T} - An instance of the T.
|
9
|
-
*/
|
10
|
-
export function construct(self, schemaValidator) {
|
11
|
-
return new self(schemaValidator || {});
|
12
|
-
}
|
13
|
-
/**
|
14
|
-
* Abstract class representing a base entity mapper.
|
15
|
-
*
|
16
|
-
* @template SV - A type that extends AnySchemaValidator.
|
17
|
-
*/
|
18
|
-
export class BaseDtoMapper {
|
19
|
-
/**
|
20
|
-
* The schema validator exact type.
|
21
|
-
* @type {SV}
|
22
|
-
* @protected
|
23
|
-
*/
|
24
|
-
_SV;
|
25
|
-
/**
|
26
|
-
* The schema validator as a general type.
|
27
|
-
* @type {SchemaValidator}
|
28
|
-
* @protected
|
29
|
-
*/
|
30
|
-
schemaValidator;
|
31
|
-
/**
|
32
|
-
* The Data Transfer Object (DTO).
|
33
|
-
* @type {Schema<this['schema'], SV>}
|
34
|
-
*/
|
35
|
-
_dto = {};
|
36
|
-
/**
|
37
|
-
* Creates an instance of BaseDtoMapper.
|
38
|
-
*
|
39
|
-
* @param {SV} schemaValidator - The schema provider.
|
40
|
-
*/
|
41
|
-
constructor(schemaValidator) {
|
42
|
-
this.schemaValidator = schemaValidator;
|
43
|
-
}
|
44
|
-
/**
|
45
|
-
* Validates and sets the Data Transfer Object (DTO).
|
46
|
-
*
|
47
|
-
* @param {this['_dto']} dto - The Data Transfer Object (DTO).
|
48
|
-
* @throws {Error} - Throws an error if the DTO is invalid.
|
49
|
-
*/
|
50
|
-
set dto(_dto) {
|
51
|
-
if (!this.schemaValidator.validate(this.schemaValidator.schemify(this.schema), _dto)) {
|
52
|
-
throw new Error('Invalid DTO');
|
53
|
-
}
|
54
|
-
this._dto = _dto;
|
55
|
-
}
|
56
|
-
/**
|
57
|
-
* Validates and gets the Data Transfer Object (DTO).
|
58
|
-
*
|
59
|
-
* @returns {this['_dto']} - The Data Transfer Object (DTO).
|
60
|
-
*/
|
61
|
-
get dto() {
|
62
|
-
return this._dto;
|
63
|
-
}
|
64
|
-
/**
|
65
|
-
* Gets the schema of a T.
|
66
|
-
*
|
67
|
-
* @template T - A type that extends BaseDtoMapper.
|
68
|
-
* @template SV - A type that extends AnySchemaValidator.
|
69
|
-
* @param {DtoMapperConstructor<T, SV>} this - The constructor of the T.
|
70
|
-
* @returns {T['schema']} - The schema of the T.
|
71
|
-
*/
|
72
|
-
static schema() {
|
73
|
-
return construct(this).schema;
|
74
|
-
}
|
75
|
-
}
|