@axiumine/koa-utils 4.0.1
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 +236 -0
- package/README.md +183 -0
- package/dist/dataSources/MariaDB.d.mts +4 -0
- package/dist/dataSources/MariaDB.mjs +75 -0
- package/dist/dataSources/MariaDB.mjs.map +1 -0
- package/dist/dataSources/MongoDB.d.mts +2 -0
- package/dist/dataSources/MongoDB.mjs +36 -0
- package/dist/dataSources/MongoDB.mjs.map +1 -0
- package/dist/dataSources/PostgreSQL.d.mts +17 -0
- package/dist/dataSources/PostgreSQL.mjs +111 -0
- package/dist/dataSources/PostgreSQL.mjs.map +1 -0
- package/dist/dataSources/Redis.d.mts +4629 -0
- package/dist/dataSources/Redis.mjs +46 -0
- package/dist/dataSources/Redis.mjs.map +1 -0
- package/dist/email/SocketLabsLib.d.mts +110 -0
- package/dist/email/SocketLabsLib.mjs +379 -0
- package/dist/email/SocketLabsLib.mjs.map +1 -0
- package/dist/files/IUploadTemp.d.mts +4 -0
- package/dist/files/IUploadTemp.mjs +2 -0
- package/dist/files/IUploadTemp.mjs.map +1 -0
- package/dist/files/checkForNSFW.d.mts +1 -0
- package/dist/files/checkForNSFW.mjs +22 -0
- package/dist/files/checkForNSFW.mjs.map +1 -0
- package/dist/files/fileConst.d.mts +7 -0
- package/dist/files/fileConst.mjs +4 -0
- package/dist/files/fileConst.mjs.map +1 -0
- package/dist/files/moveFileStaticDomain.d.mts +8 -0
- package/dist/files/moveFileStaticDomain.mjs +17 -0
- package/dist/files/moveFileStaticDomain.mjs.map +1 -0
- package/dist/files/moveImageFile.d.mts +1 -0
- package/dist/files/moveImageFile.mjs +11 -0
- package/dist/files/moveImageFile.mjs.map +1 -0
- package/dist/files/moveTempFile.d.mts +7 -0
- package/dist/files/moveTempFile.mjs +23 -0
- package/dist/files/moveTempFile.mjs.map +1 -0
- package/dist/files/reEncodeToJpeg.d.mts +1 -0
- package/dist/files/reEncodeToJpeg.mjs +5 -0
- package/dist/files/reEncodeToJpeg.mjs.map +1 -0
- package/dist/files/reEncodeToPng.d.mts +1 -0
- package/dist/files/reEncodeToPng.mjs +5 -0
- package/dist/files/reEncodeToPng.mjs.map +1 -0
- package/dist/files/reEncodeToWebp.d.mts +1 -0
- package/dist/files/reEncodeToWebp.mjs +5 -0
- package/dist/files/reEncodeToWebp.mjs.map +1 -0
- package/dist/files/scanVirus.d.mts +29 -0
- package/dist/files/scanVirus.mjs +60 -0
- package/dist/files/scanVirus.mjs.map +1 -0
- package/dist/files/storeUploadAsTemp.d.mts +3 -0
- package/dist/files/storeUploadAsTemp.mjs +74 -0
- package/dist/files/storeUploadAsTemp.mjs.map +1 -0
- package/dist/files/uploadTempImage.d.mts +8 -0
- package/dist/files/uploadTempImage.mjs +42 -0
- package/dist/files/uploadTempImage.mjs.map +1 -0
- package/dist/files/uploadTempPdf.d.mts +8 -0
- package/dist/files/uploadTempPdf.mjs +42 -0
- package/dist/files/uploadTempPdf.mjs.map +1 -0
- package/dist/files/validateExtension.d.mts +6 -0
- package/dist/files/validateExtension.mjs +11 -0
- package/dist/files/validateExtension.mjs.map +1 -0
- package/dist/files/validateJpgPngExtension.d.mts +1 -0
- package/dist/files/validateJpgPngExtension.mjs +9 -0
- package/dist/files/validateJpgPngExtension.mjs.map +1 -0
- package/dist/files/validateMimeType.d.mts +6 -0
- package/dist/files/validateMimeType.mjs +18 -0
- package/dist/files/validateMimeType.mjs.map +1 -0
- package/dist/files/validateMimeTypeImages.d.mts +5 -0
- package/dist/files/validateMimeTypeImages.mjs +9 -0
- package/dist/files/validateMimeTypeImages.mjs.map +1 -0
- package/dist/files/validateMimeTypePdf.d.mts +5 -0
- package/dist/files/validateMimeTypePdf.mjs +9 -0
- package/dist/files/validateMimeTypePdf.mjs.map +1 -0
- package/dist/files/validatePdfExtension.d.mts +1 -0
- package/dist/files/validatePdfExtension.mjs +9 -0
- package/dist/files/validatePdfExtension.mjs.map +1 -0
- package/dist/graphQL/models/MongoDB/UserBase.d.mts +61 -0
- package/dist/graphQL/models/MongoDB/UserBase.mjs +112 -0
- package/dist/graphQL/models/MongoDB/UserBase.mjs.map +1 -0
- package/dist/graphQL/models/MongoDB/log/DevStatsGraphQLCalls.d.mts +25 -0
- package/dist/graphQL/models/MongoDB/log/DevStatsGraphQLCalls.mjs +36 -0
- package/dist/graphQL/models/MongoDB/log/DevStatsGraphQLCalls.mjs.map +1 -0
- package/dist/graphQL/models/MongoDB/log/LogGlobalError.d.mts +16 -0
- package/dist/graphQL/models/MongoDB/log/LogGlobalError.mjs +25 -0
- package/dist/graphQL/models/MongoDB/log/LogGlobalError.mjs.map +1 -0
- package/dist/graphQL/models/MongoDB/log/LogStatsGraphql.d.mts +18 -0
- package/dist/graphQL/models/MongoDB/log/LogStatsGraphql.mjs +33 -0
- package/dist/graphQL/models/MongoDB/log/LogStatsGraphql.mjs.map +1 -0
- package/dist/graphQL/models/MongoDB/log/LogThrow.d.mts +17 -0
- package/dist/graphQL/models/MongoDB/log/LogThrow.mjs +28 -0
- package/dist/graphQL/models/MongoDB/log/LogThrow.mjs.map +1 -0
- package/dist/graphQL/schema/GraphQLInput/GraphQLInputLogin.d.mts +2 -0
- package/dist/graphQL/schema/GraphQLInput/GraphQLInputLogin.mjs +9 -0
- package/dist/graphQL/schema/GraphQLInput/GraphQLInputLogin.mjs.map +1 -0
- package/dist/graphQL/schema/context/IContextAuthenticatedResource.d.mts +16 -0
- package/dist/graphQL/schema/context/IContextAuthenticatedResource.mjs +2 -0
- package/dist/graphQL/schema/context/IContextAuthenticatedResource.mjs.map +1 -0
- package/dist/graphQL/schema/context/IContextKoaErrorHandler.d.mts +11 -0
- package/dist/graphQL/schema/context/IContextKoaErrorHandler.mjs +2 -0
- package/dist/graphQL/schema/context/IContextKoaErrorHandler.mjs.map +1 -0
- package/dist/graphQL/schema/context/IContextLogin.d.mts +4 -0
- package/dist/graphQL/schema/context/IContextLogin.mjs +2 -0
- package/dist/graphQL/schema/context/IContextLogin.mjs.map +1 -0
- package/dist/graphQL/schema/context/IContextLogout.d.mts +18 -0
- package/dist/graphQL/schema/context/IContextLogout.mjs +2 -0
- package/dist/graphQL/schema/context/IContextLogout.mjs.map +1 -0
- package/dist/graphQL/schema/context/IContextRefresh.d.mts +19 -0
- package/dist/graphQL/schema/context/IContextRefresh.mjs +2 -0
- package/dist/graphQL/schema/context/IContextRefresh.mjs.map +1 -0
- package/dist/graphQL/schema/context/TCommonHeaders.d.mts +15 -0
- package/dist/graphQL/schema/context/TCommonHeaders.mjs +2 -0
- package/dist/graphQL/schema/context/TCommonHeaders.mjs.map +1 -0
- package/dist/graphQL/schema/interfaces/IFindAndUpdate.d.mts +16 -0
- package/dist/graphQL/schema/interfaces/IFindAndUpdate.mjs +2 -0
- package/dist/graphQL/schema/interfaces/IFindAndUpdate.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/emailChangeHashVerify.d.mts +22 -0
- package/dist/graphQL/schema/mutations/emailChangeHashVerify.mjs +100 -0
- package/dist/graphQL/schema/mutations/emailChangeHashVerify.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/login4Ever.d.mts +22 -0
- package/dist/graphQL/schema/mutations/login4Ever.mjs +60 -0
- package/dist/graphQL/schema/mutations/login4Ever.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/loginAdmin.d.mts +29 -0
- package/dist/graphQL/schema/mutations/loginAdmin.mjs +59 -0
- package/dist/graphQL/schema/mutations/loginAdmin.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/loginRememberme.d.mts +26 -0
- package/dist/graphQL/schema/mutations/loginRememberme.mjs +54 -0
- package/dist/graphQL/schema/mutations/loginRememberme.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/logout.d.mts +7 -0
- package/dist/graphQL/schema/mutations/logout.mjs +33 -0
- package/dist/graphQL/schema/mutations/logout.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/refresh.d.mts +10 -0
- package/dist/graphQL/schema/mutations/refresh.mjs +56 -0
- package/dist/graphQL/schema/mutations/refresh.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/resetPwd.d.mts +19 -0
- package/dist/graphQL/schema/mutations/resetPwd.mjs +90 -0
- package/dist/graphQL/schema/mutations/resetPwd.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/signUp.d.mts +19 -0
- package/dist/graphQL/schema/mutations/signUp.mjs +55 -0
- package/dist/graphQL/schema/mutations/signUp.mjs.map +1 -0
- package/dist/graphQL/schema/mutations/updatePassword.d.mts +23 -0
- package/dist/graphQL/schema/mutations/updatePassword.mjs +71 -0
- package/dist/graphQL/schema/mutations/updatePassword.mjs.map +1 -0
- package/dist/graphQL/schema/types/DeleteType.d.mts +6 -0
- package/dist/graphQL/schema/types/DeleteType.mjs +13 -0
- package/dist/graphQL/schema/types/DeleteType.mjs.map +1 -0
- package/dist/graphQL/schema/types/DoneType.d.mts +2 -0
- package/dist/graphQL/schema/types/DoneType.mjs +10 -0
- package/dist/graphQL/schema/types/DoneType.mjs.map +1 -0
- package/dist/graphQL/schema/types/FindOneAndUpdateType.d.mts +2 -0
- package/dist/graphQL/schema/types/FindOneAndUpdateType.mjs +15 -0
- package/dist/graphQL/schema/types/FindOneAndUpdateType.mjs.map +1 -0
- package/dist/graphQL/schema/types/LoginAppType.d.mts +2 -0
- package/dist/graphQL/schema/types/LoginAppType.mjs +11 -0
- package/dist/graphQL/schema/types/LoginAppType.mjs.map +1 -0
- package/dist/graphQL/schema/types/LoginType.d.mts +2 -0
- package/dist/graphQL/schema/types/LoginType.mjs +9 -0
- package/dist/graphQL/schema/types/LoginType.mjs.map +1 -0
- package/dist/graphQL/schema/types/MidNameType.d.mts +5 -0
- package/dist/graphQL/schema/types/MidNameType.mjs +12 -0
- package/dist/graphQL/schema/types/MidNameType.mjs.map +1 -0
- package/dist/graphQL/schema/types/OnlyIdType.d.mts +2 -0
- package/dist/graphQL/schema/types/OnlyIdType.mjs +8 -0
- package/dist/graphQL/schema/types/OnlyIdType.mjs.map +1 -0
- package/dist/graphQL/schema/types/RefreshType.d.mts +2 -0
- package/dist/graphQL/schema/types/RefreshType.mjs +10 -0
- package/dist/graphQL/schema/types/RefreshType.mjs.map +1 -0
- package/dist/graphQL/schema/types/RetStatusMexType.d.mts +2 -0
- package/dist/graphQL/schema/types/RetStatusMexType.mjs +9 -0
- package/dist/graphQL/schema/types/RetStatusMexType.mjs.map +1 -0
- package/dist/graphQL/schema/types/RetStatusType.d.mts +2 -0
- package/dist/graphQL/schema/types/RetStatusType.mjs +8 -0
- package/dist/graphQL/schema/types/RetStatusType.mjs.map +1 -0
- package/dist/graphQL/schema/types/SaveType.d.mts +2 -0
- package/dist/graphQL/schema/types/SaveType.mjs +9 -0
- package/dist/graphQL/schema/types/SaveType.mjs.map +1 -0
- package/dist/graphQL/schema/types/SidNameType.d.mts +5 -0
- package/dist/graphQL/schema/types/SidNameType.mjs +12 -0
- package/dist/graphQL/schema/types/SidNameType.mjs.map +1 -0
- package/dist/graphQL/schema/types/SidNomeType.d.mts +5 -0
- package/dist/graphQL/schema/types/SidNomeType.mjs +12 -0
- package/dist/graphQL/schema/types/SidNomeType.mjs.map +1 -0
- package/dist/graphQL/schema/types/UpdateResultType.d.mts +2 -0
- package/dist/graphQL/schema/types/UpdateResultType.mjs +9 -0
- package/dist/graphQL/schema/types/UpdateResultType.mjs.map +1 -0
- package/dist/graphQL/status.d.mts +7 -0
- package/dist/graphQL/status.mjs +8 -0
- package/dist/graphQL/status.mjs.map +1 -0
- package/dist/graphQL/throw/throwAccessTokenExpiredOrDeleted.d.mts +1 -0
- package/dist/graphQL/throw/throwAccessTokenExpiredOrDeleted.mjs +5 -0
- package/dist/graphQL/throw/throwAccessTokenExpiredOrDeleted.mjs.map +1 -0
- package/dist/graphQL/throw/throwAccessTokenRequired.d.mts +1 -0
- package/dist/graphQL/throw/throwAccessTokenRequired.mjs +5 -0
- package/dist/graphQL/throw/throwAccessTokenRequired.mjs.map +1 -0
- package/dist/graphQL/throw/throwAlreadyDone.d.mts +4 -0
- package/dist/graphQL/throw/throwAlreadyDone.mjs +8 -0
- package/dist/graphQL/throw/throwAlreadyDone.mjs.map +1 -0
- package/dist/graphQL/throw/throwAlreadyTakenError.d.mts +1 -0
- package/dist/graphQL/throw/throwAlreadyTakenError.mjs +6 -0
- package/dist/graphQL/throw/throwAlreadyTakenError.mjs.map +1 -0
- package/dist/graphQL/throw/throwConflictError.d.mts +1 -0
- package/dist/graphQL/throw/throwConflictError.mjs +6 -0
- package/dist/graphQL/throw/throwConflictError.mjs.map +1 -0
- package/dist/graphQL/throw/throwErrorWrongUserInput.d.mts +1 -0
- package/dist/graphQL/throw/throwErrorWrongUserInput.mjs +5 -0
- package/dist/graphQL/throw/throwErrorWrongUserInput.mjs.map +1 -0
- package/dist/graphQL/throw/throwForbiddenError.d.mts +1 -0
- package/dist/graphQL/throw/throwForbiddenError.mjs +5 -0
- package/dist/graphQL/throw/throwForbiddenError.mjs.map +1 -0
- package/dist/graphQL/throw/throwGoneError.d.mts +1 -0
- package/dist/graphQL/throw/throwGoneError.mjs +6 -0
- package/dist/graphQL/throw/throwGoneError.mjs.map +1 -0
- package/dist/graphQL/throw/throwGraphQLError.d.mts +1 -0
- package/dist/graphQL/throw/throwGraphQLError.mjs +5 -0
- package/dist/graphQL/throw/throwGraphQLError.mjs.map +1 -0
- package/dist/graphQL/throw/throwInternalError.d.mts +1 -0
- package/dist/graphQL/throw/throwInternalError.mjs +5 -0
- package/dist/graphQL/throw/throwInternalError.mjs.map +1 -0
- package/dist/graphQL/throw/throwMethodNotAllowedError.d.mts +1 -0
- package/dist/graphQL/throw/throwMethodNotAllowedError.mjs +6 -0
- package/dist/graphQL/throw/throwMethodNotAllowedError.mjs.map +1 -0
- package/dist/graphQL/throw/throwMissingMalformedInvalidToken.d.mts +1 -0
- package/dist/graphQL/throw/throwMissingMalformedInvalidToken.mjs +5 -0
- package/dist/graphQL/throw/throwMissingMalformedInvalidToken.mjs.map +1 -0
- package/dist/graphQL/throw/throwNotAcceptableError.d.mts +1 -0
- package/dist/graphQL/throw/throwNotAcceptableError.mjs +6 -0
- package/dist/graphQL/throw/throwNotAcceptableError.mjs.map +1 -0
- package/dist/graphQL/throw/throwNotFoundError.d.mts +1 -0
- package/dist/graphQL/throw/throwNotFoundError.mjs +6 -0
- package/dist/graphQL/throw/throwNotFoundError.mjs.map +1 -0
- package/dist/graphQL/throw/throwNotImplementedError.d.mts +1 -0
- package/dist/graphQL/throw/throwNotImplementedError.mjs +6 -0
- package/dist/graphQL/throw/throwNotImplementedError.mjs.map +1 -0
- package/dist/graphQL/throw/throwPaymentRequiredError.d.mts +1 -0
- package/dist/graphQL/throw/throwPaymentRequiredError.mjs +5 -0
- package/dist/graphQL/throw/throwPaymentRequiredError.mjs.map +1 -0
- package/dist/graphQL/throw/throwPreconditionFailedNoAuthCookie.d.mts +1 -0
- package/dist/graphQL/throw/throwPreconditionFailedNoAuthCookie.mjs +5 -0
- package/dist/graphQL/throw/throwPreconditionFailedNoAuthCookie.mjs.map +1 -0
- package/dist/graphQL/throw/throwPreconditionFailedNoAuthHeader.d.mts +1 -0
- package/dist/graphQL/throw/throwPreconditionFailedNoAuthHeader.mjs +5 -0
- package/dist/graphQL/throw/throwPreconditionFailedNoAuthHeader.mjs.map +1 -0
- package/dist/graphQL/throw/throwRefreshTokenExpiredOrDeleted.d.mts +1 -0
- package/dist/graphQL/throw/throwRefreshTokenExpiredOrDeleted.mjs +5 -0
- package/dist/graphQL/throw/throwRefreshTokenExpiredOrDeleted.mjs.map +1 -0
- package/dist/graphQL/throw/throwRefreshTokenRequired.d.mts +1 -0
- package/dist/graphQL/throw/throwRefreshTokenRequired.mjs +5 -0
- package/dist/graphQL/throw/throwRefreshTokenRequired.mjs.map +1 -0
- package/dist/graphQL/throw/throwRefreshTokenSignatureRequired.d.mts +1 -0
- package/dist/graphQL/throw/throwRefreshTokenSignatureRequired.mjs +5 -0
- package/dist/graphQL/throw/throwRefreshTokenSignatureRequired.mjs.map +1 -0
- package/dist/graphQL/throw/throwTooManyRequestsError.d.mts +1 -0
- package/dist/graphQL/throw/throwTooManyRequestsError.mjs +5 -0
- package/dist/graphQL/throw/throwTooManyRequestsError.mjs.map +1 -0
- package/dist/graphQL/throw/throwUnauthorizedError.d.mts +1 -0
- package/dist/graphQL/throw/throwUnauthorizedError.mjs +5 -0
- package/dist/graphQL/throw/throwUnauthorizedError.mjs.map +1 -0
- package/dist/graphQL/throw/throwUnprocessableContentError.d.mts +1 -0
- package/dist/graphQL/throw/throwUnprocessableContentError.mjs +5 -0
- package/dist/graphQL/throw/throwUnprocessableContentError.mjs.map +1 -0
- package/dist/graphQL/throw/throwUnsupportedMediaTypeError.d.mts +1 -0
- package/dist/graphQL/throw/throwUnsupportedMediaTypeError.mjs +5 -0
- package/dist/graphQL/throw/throwUnsupportedMediaTypeError.mjs.map +1 -0
- package/dist/koa/IFileUpload.d.mts +6 -0
- package/dist/koa/IFileUpload.mjs +2 -0
- package/dist/koa/IFileUpload.mjs.map +1 -0
- package/dist/koa/IKoaError.d.mts +15 -0
- package/dist/koa/IKoaError.mjs +2 -0
- package/dist/koa/IKoaError.mjs.map +1 -0
- package/dist/koa/customFormatErrorFn.d.mts +2 -0
- package/dist/koa/customFormatErrorFn.mjs +10 -0
- package/dist/koa/customFormatErrorFn.mjs.map +1 -0
- package/dist/koa/logRequestToDb.d.mts +3 -0
- package/dist/koa/logRequestToDb.mjs +16 -0
- package/dist/koa/logRequestToDb.mjs.map +1 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.d.mts +4 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.mjs +2 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.mjs.map +1 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/index.d.mts +4 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/index.mjs +36 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/index.mjs.map +1 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.d.mts +3 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs +41 -0
- package/dist/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs.map +1 -0
- package/dist/koa/middleware/authenticatedLogoutHandler/index.d.mts +4 -0
- package/dist/koa/middleware/authenticatedLogoutHandler/index.mjs +69 -0
- package/dist/koa/middleware/authenticatedLogoutHandler/index.mjs.map +1 -0
- package/dist/koa/middleware/authenticatedResourceHandler/index.d.mts +6 -0
- package/dist/koa/middleware/authenticatedResourceHandler/index.mjs +54 -0
- package/dist/koa/middleware/authenticatedResourceHandler/index.mjs.map +1 -0
- package/dist/koa/middleware/debug/index.d.mts +3 -0
- package/dist/koa/middleware/debug/index.mjs +9 -0
- package/dist/koa/middleware/debug/index.mjs.map +1 -0
- package/dist/koa/router/verifyEmail.d.mts +2 -0
- package/dist/koa/router/verifyEmail.mjs +33 -0
- package/dist/koa/router/verifyEmail.mjs.map +1 -0
- package/dist/koa/tdwKoaErrorHandler.d.mts +3 -0
- package/dist/koa/tdwKoaErrorHandler.mjs +52 -0
- package/dist/koa/tdwKoaErrorHandler.mjs.map +1 -0
- package/dist/lib/ArrayLib.d.mts +4 -0
- package/dist/lib/ArrayLib.mjs +9 -0
- package/dist/lib/ArrayLib.mjs.map +1 -0
- package/dist/lib/Constants.d.mts +7 -0
- package/dist/lib/Constants.mjs +8 -0
- package/dist/lib/Constants.mjs.map +1 -0
- package/dist/lib/DateLib.d.mts +9 -0
- package/dist/lib/DateLib.mjs +35 -0
- package/dist/lib/DateLib.mjs.map +1 -0
- package/dist/lib/IAuthorizationDisDel.d.mts +4 -0
- package/dist/lib/IAuthorizationDisDel.mjs +2 -0
- package/dist/lib/IAuthorizationDisDel.mjs.map +1 -0
- package/dist/lib/ICookies.d.mts +13 -0
- package/dist/lib/ICookies.mjs +2 -0
- package/dist/lib/ICookies.mjs.map +1 -0
- package/dist/lib/MariaDB/IMariaDBErr.d.mts +6 -0
- package/dist/lib/MariaDB/IMariaDBErr.mjs +2 -0
- package/dist/lib/MariaDB/IMariaDBErr.mjs.map +1 -0
- package/dist/lib/MariaDB/MariaDBErrType.d.mts +3 -0
- package/dist/lib/MariaDB/MariaDBErrType.mjs +6 -0
- package/dist/lib/MariaDB/MariaDBErrType.mjs.map +1 -0
- package/dist/lib/MariaDB/throwSqlErrors.d.mts +2 -0
- package/dist/lib/MariaDB/throwSqlErrors.mjs +20 -0
- package/dist/lib/MariaDB/throwSqlErrors.mjs.map +1 -0
- package/dist/lib/MongoDB/IMongoDBError.d.mts +12 -0
- package/dist/lib/MongoDB/IMongoDBError.mjs +2 -0
- package/dist/lib/MongoDB/IMongoDBError.mjs.map +1 -0
- package/dist/lib/MongoDB/IOnboarding.d.mts +4 -0
- package/dist/lib/MongoDB/IOnboarding.mjs +2 -0
- package/dist/lib/MongoDB/IOnboarding.mjs.map +1 -0
- package/dist/lib/MongoDB/MongoDBErrType.d.mts +3 -0
- package/dist/lib/MongoDB/MongoDBErrType.mjs +5 -0
- package/dist/lib/MongoDB/MongoDBErrType.mjs.map +1 -0
- package/dist/lib/MongoDB/throwIfMongoErr.d.mts +2 -0
- package/dist/lib/MongoDB/throwIfMongoErr.mjs +13 -0
- package/dist/lib/MongoDB/throwIfMongoErr.mjs.map +1 -0
- package/dist/lib/MongoDB/throwMongoErrors.d.mts +2 -0
- package/dist/lib/MongoDB/throwMongoErrors.mjs +10 -0
- package/dist/lib/MongoDB/throwMongoErrors.mjs.map +1 -0
- package/dist/lib/NumLib.d.mts +10 -0
- package/dist/lib/NumLib.mjs +13 -0
- package/dist/lib/NumLib.mjs.map +1 -0
- package/dist/lib/PostgreSQL/IPostgresError.d.mts +6 -0
- package/dist/lib/PostgreSQL/IPostgresError.mjs +2 -0
- package/dist/lib/PostgreSQL/IPostgresError.mjs.map +1 -0
- package/dist/lib/PostgreSQL/IPostgresErrorCodes.d.mts +3 -0
- package/dist/lib/PostgreSQL/IPostgresErrorCodes.mjs +5 -0
- package/dist/lib/PostgreSQL/IPostgresErrorCodes.mjs.map +1 -0
- package/dist/lib/PostgreSQL/makePostgreSqlLogError.d.mts +2 -0
- package/dist/lib/PostgreSQL/makePostgreSqlLogError.mjs +4 -0
- package/dist/lib/PostgreSQL/makePostgreSqlLogError.mjs.map +1 -0
- package/dist/lib/Redis/RedisBoolean.d.mts +4 -0
- package/dist/lib/Redis/RedisBoolean.mjs +6 -0
- package/dist/lib/Redis/RedisBoolean.mjs.map +1 -0
- package/dist/lib/Redis/buildPrefixedRedisKey.d.mts +9 -0
- package/dist/lib/Redis/buildPrefixedRedisKey.mjs +12 -0
- package/dist/lib/Redis/buildPrefixedRedisKey.mjs.map +1 -0
- package/dist/lib/Redis/fromRedisBooleanValue.d.mts +2 -0
- package/dist/lib/Redis/fromRedisBooleanValue.mjs +5 -0
- package/dist/lib/Redis/fromRedisBooleanValue.mjs.map +1 -0
- package/dist/lib/Redis/toRedisBooleanValue.d.mts +2 -0
- package/dist/lib/Redis/toRedisBooleanValue.mjs +5 -0
- package/dist/lib/Redis/toRedisBooleanValue.mjs.map +1 -0
- package/dist/lib/StringLib.d.mts +46 -0
- package/dist/lib/StringLib.mjs +95 -0
- package/dist/lib/StringLib.mjs.map +1 -0
- package/dist/lib/checkEmailLen.d.mts +1 -0
- package/dist/lib/checkEmailLen.mjs +11 -0
- package/dist/lib/checkEmailLen.mjs.map +1 -0
- package/dist/lib/checkPwdLen.d.mts +1 -0
- package/dist/lib/checkPwdLen.mjs +13 -0
- package/dist/lib/checkPwdLen.mjs.map +1 -0
- package/dist/lib/db/log/hitStat.d.mts +1 -0
- package/dist/lib/db/log/hitStat.mjs +9 -0
- package/dist/lib/db/log/hitStat.mjs.map +1 -0
- package/dist/lib/db/log/logGlobalError.d.mts +6 -0
- package/dist/lib/db/log/logGlobalError.mjs +12 -0
- package/dist/lib/db/log/logGlobalError.mjs.map +1 -0
- package/dist/lib/db/log/logGraphql.d.mts +9 -0
- package/dist/lib/db/log/logGraphql.mjs +27 -0
- package/dist/lib/db/log/logGraphql.mjs.map +1 -0
- package/dist/lib/db/log/logThrow.d.mts +1 -0
- package/dist/lib/db/log/logThrow.mjs +15 -0
- package/dist/lib/db/log/logThrow.mjs.map +1 -0
- package/dist/lib/db/login/ILoginSet.d.mts +7 -0
- package/dist/lib/db/login/ILoginSet.mjs +2 -0
- package/dist/lib/db/login/ILoginSet.mjs.map +1 -0
- package/dist/lib/db/login/ILoginUnset.d.mts +5 -0
- package/dist/lib/db/login/ILoginUnset.mjs +2 -0
- package/dist/lib/db/login/ILoginUnset.mjs.map +1 -0
- package/dist/lib/db/registerNewUser.d.mts +2 -0
- package/dist/lib/db/registerNewUser.mjs +33 -0
- package/dist/lib/db/registerNewUser.mjs.map +1 -0
- package/dist/lib/db/userExist.d.mts +2 -0
- package/dist/lib/db/userExist.mjs +6 -0
- package/dist/lib/db/userExist.mjs.map +1 -0
- package/dist/lib/emailHash.d.mts +1 -0
- package/dist/lib/emailHash.mjs +7 -0
- package/dist/lib/emailHash.mjs.map +1 -0
- package/dist/lib/encryptPassword.d.mts +1 -0
- package/dist/lib/encryptPassword.mjs +6 -0
- package/dist/lib/encryptPassword.mjs.map +1 -0
- package/dist/lib/hash.d.mts +6 -0
- package/dist/lib/hash.mjs +15 -0
- package/dist/lib/hash.mjs.map +1 -0
- package/dist/lib/isSafeRedirectTarget.d.mts +19 -0
- package/dist/lib/isSafeRedirectTarget.mjs +26 -0
- package/dist/lib/isSafeRedirectTarget.mjs.map +1 -0
- package/dist/lib/isSessionBlocked.d.mts +7 -0
- package/dist/lib/isSessionBlocked.mjs +10 -0
- package/dist/lib/isSessionBlocked.mjs.map +1 -0
- package/dist/lib/isValidUuidV4.d.mts +7 -0
- package/dist/lib/isValidUuidV4.mjs +11 -0
- package/dist/lib/isValidUuidV4.mjs.map +1 -0
- package/dist/lib/makeOnboardingData.d.mts +2 -0
- package/dist/lib/makeOnboardingData.mjs +4 -0
- package/dist/lib/makeOnboardingData.mjs.map +1 -0
- package/dist/lib/setLoginCookies.d.mts +2 -0
- package/dist/lib/setLoginCookies.mjs +10 -0
- package/dist/lib/setLoginCookies.mjs.map +1 -0
- package/dist/lib/sleepMs.d.mts +1 -0
- package/dist/lib/sleepMs.mjs +2 -0
- package/dist/lib/sleepMs.mjs.map +1 -0
- package/dist/lib/throwIfNotValidEnumValue.d.mts +1 -0
- package/dist/lib/throwIfNotValidEnumValue.mjs +8 -0
- package/dist/lib/throwIfNotValidEnumValue.mjs.map +1 -0
- package/dist/lib/tokenOptions.d.mts +12 -0
- package/dist/lib/tokenOptions.mjs +17 -0
- package/dist/lib/tokenOptions.mjs.map +1 -0
- package/dist/lib/tokens.d.mts +4 -0
- package/dist/lib/tokens.mjs +22 -0
- package/dist/lib/tokens.mjs.map +1 -0
- package/dist/lib/tryCatchRethrow.d.mts +2 -0
- package/dist/lib/tryCatchRethrow.mjs +20 -0
- package/dist/lib/tryCatchRethrow.mjs.map +1 -0
- package/dist/private/files/_validateMimeType.d.mts +6 -0
- package/dist/private/files/_validateMimeType.mjs +21 -0
- package/dist/private/files/_validateMimeType.mjs.map +1 -0
- package/dist/private/files/assertNoTraversal.d.mts +12 -0
- package/dist/private/files/assertNoTraversal.mjs +17 -0
- package/dist/private/files/assertNoTraversal.mjs.map +1 -0
- package/dist/private/files/reEncode.d.mts +10 -0
- package/dist/private/files/reEncode.mjs +47 -0
- package/dist/private/files/reEncode.mjs.map +1 -0
- package/dist/private/graphQL/Consts.d.mts +2 -0
- package/dist/private/graphQL/Consts.mjs +3 -0
- package/dist/private/graphQL/Consts.mjs.map +1 -0
- package/dist/private/graphQL/models/MongoDB/private/UserAdminKoaUtils.d.mts +58 -0
- package/dist/private/graphQL/models/MongoDB/private/UserAdminKoaUtils.mjs +107 -0
- package/dist/private/graphQL/models/MongoDB/private/UserAdminKoaUtils.mjs.map +1 -0
- package/dist/private/graphQL/schema/context/IContextLog.d.mts +15 -0
- package/dist/private/graphQL/schema/context/IContextLog.mjs +2 -0
- package/dist/private/graphQL/schema/context/IContextLog.mjs.map +1 -0
- package/dist/private/graphQL/schema/context/IContextVerifyEmail.d.mts +7 -0
- package/dist/private/graphQL/schema/context/IContextVerifyEmail.mjs +2 -0
- package/dist/private/graphQL/schema/context/IContextVerifyEmail.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/_buildLoginStatsUpdate.d.mts +19 -0
- package/dist/private/graphQL/schema/mutations/_buildLoginStatsUpdate.mjs +26 -0
- package/dist/private/graphQL/schema/mutations/_buildLoginStatsUpdate.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/_finalizeLoginCheck.d.mts +19 -0
- package/dist/private/graphQL/schema/mutations/_finalizeLoginCheck.mjs +28 -0
- package/dist/private/graphQL/schema/mutations/_finalizeLoginCheck.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/checkUserAdminLoginAuthorization.d.mts +5 -0
- package/dist/private/graphQL/schema/mutations/checkUserAdminLoginAuthorization.mjs +7 -0
- package/dist/private/graphQL/schema/mutations/checkUserAdminLoginAuthorization.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/checkUserLoginAuthorization.d.mts +5 -0
- package/dist/private/graphQL/schema/mutations/checkUserLoginAuthorization.mjs +8 -0
- package/dist/private/graphQL/schema/mutations/checkUserLoginAuthorization.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/infoUserAdminForLogin.d.mts +3 -0
- package/dist/private/graphQL/schema/mutations/infoUserAdminForLogin.mjs +13 -0
- package/dist/private/graphQL/schema/mutations/infoUserAdminForLogin.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/infoUserForLogin.d.mts +3 -0
- package/dist/private/graphQL/schema/mutations/infoUserForLogin.mjs +13 -0
- package/dist/private/graphQL/schema/mutations/infoUserForLogin.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/infoUserForLoginSQL.d.mts +8 -0
- package/dist/private/graphQL/schema/mutations/infoUserForLoginSQL.mjs +16 -0
- package/dist/private/graphQL/schema/mutations/infoUserForLoginSQL.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/setLastLoginSQL.d.mts +1 -0
- package/dist/private/graphQL/schema/mutations/setLastLoginSQL.mjs +27 -0
- package/dist/private/graphQL/schema/mutations/setLastLoginSQL.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/setRedisLoginSession.d.mts +2 -0
- package/dist/private/graphQL/schema/mutations/setRedisLoginSession.mjs +27 -0
- package/dist/private/graphQL/schema/mutations/setRedisLoginSession.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/updateAdminLoginStats.d.mts +2 -0
- package/dist/private/graphQL/schema/mutations/updateAdminLoginStats.mjs +7 -0
- package/dist/private/graphQL/schema/mutations/updateAdminLoginStats.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/updateLoginStats4ever.d.mts +2 -0
- package/dist/private/graphQL/schema/mutations/updateLoginStats4ever.mjs +18 -0
- package/dist/private/graphQL/schema/mutations/updateLoginStats4ever.mjs.map +1 -0
- package/dist/private/graphQL/schema/mutations/updateLoginStatsRememberme.d.mts +2 -0
- package/dist/private/graphQL/schema/mutations/updateLoginStatsRememberme.mjs +7 -0
- package/dist/private/graphQL/schema/mutations/updateLoginStatsRememberme.mjs.map +1 -0
- package/dist/private/lib/access/Constants.d.mts +2 -0
- package/dist/private/lib/access/Constants.mjs +4 -0
- package/dist/private/lib/access/Constants.mjs.map +1 -0
- package/dist/private/lib/access/assertVerifyEmailAllowed.d.mts +36 -0
- package/dist/private/lib/access/assertVerifyEmailAllowed.mjs +45 -0
- package/dist/private/lib/access/assertVerifyEmailAllowed.mjs.map +1 -0
- package/dist/private/lib/access/db/confirmNewEmail.d.mts +2 -0
- package/dist/private/lib/access/db/confirmNewEmail.mjs +13 -0
- package/dist/private/lib/access/db/confirmNewEmail.mjs.map +1 -0
- package/dist/private/lib/access/db/deleteUserByEmail.d.mts +1 -0
- package/dist/private/lib/access/db/deleteUserByEmail.mjs +8 -0
- package/dist/private/lib/access/db/deleteUserByEmail.mjs.map +1 -0
- package/dist/private/lib/access/db/enableEmailAccess.d.mts +2 -0
- package/dist/private/lib/access/db/enableEmailAccess.mjs +17 -0
- package/dist/private/lib/access/db/enableEmailAccess.mjs.map +1 -0
- package/dist/private/lib/access/db/getResetPwd.d.mts +7 -0
- package/dist/private/lib/access/db/getResetPwd.mjs +24 -0
- package/dist/private/lib/access/db/getResetPwd.mjs.map +1 -0
- package/dist/private/lib/access/db/incReqTimes.d.mts +2 -0
- package/dist/private/lib/access/db/incReqTimes.mjs +5 -0
- package/dist/private/lib/access/db/incReqTimes.mjs.map +1 -0
- package/dist/private/lib/access/db/removeResetReq.d.mts +2 -0
- package/dist/private/lib/access/db/removeResetReq.mjs +7 -0
- package/dist/private/lib/access/db/removeResetReq.mjs.map +1 -0
- package/dist/private/lib/access/db/saveResetReq.d.mts +2 -0
- package/dist/private/lib/access/db/saveResetReq.mjs +17 -0
- package/dist/private/lib/access/db/saveResetReq.mjs.map +1 -0
- package/dist/private/lib/access/db/setEmailHash.d.mts +2 -0
- package/dist/private/lib/access/db/setEmailHash.mjs +16 -0
- package/dist/private/lib/access/db/setEmailHash.mjs.map +1 -0
- package/dist/private/lib/access/db/updatePasswordDb.d.mts +2 -0
- package/dist/private/lib/access/db/updatePasswordDb.mjs +8 -0
- package/dist/private/lib/access/db/updatePasswordDb.mjs.map +1 -0
- package/dist/private/lib/access/db/userData4VerifyEmail.d.mts +3 -0
- package/dist/private/lib/access/db/userData4VerifyEmail.mjs +16 -0
- package/dist/private/lib/access/db/userData4VerifyEmail.mjs.map +1 -0
- package/dist/private/lib/access/handleBadDB.d.mts +1 -0
- package/dist/private/lib/access/handleBadDB.mjs +9 -0
- package/dist/private/lib/access/handleBadDB.mjs.map +1 -0
- package/dist/private/lib/access/handleIfAccountDeleted.d.mts +1 -0
- package/dist/private/lib/access/handleIfAccountDeleted.mjs +10 -0
- package/dist/private/lib/access/handleIfAccountDeleted.mjs.map +1 -0
- package/dist/private/lib/access/handleIfAccountDisabled.d.mts +1 -0
- package/dist/private/lib/access/handleIfAccountDisabled.mjs +10 -0
- package/dist/private/lib/access/handleIfAccountDisabled.mjs.map +1 -0
- package/dist/private/lib/access/handleIfEmailAlreadyValid.d.mts +1 -0
- package/dist/private/lib/access/handleIfEmailAlreadyValid.mjs +10 -0
- package/dist/private/lib/access/handleIfEmailAlreadyValid.mjs.map +1 -0
- package/dist/private/lib/access/handleIfHashBad.d.mts +14 -0
- package/dist/private/lib/access/handleIfHashBad.mjs +17 -0
- package/dist/private/lib/access/handleIfHashBad.mjs.map +1 -0
- package/dist/private/lib/access/handleIfMoreThan3DaysPassed.d.mts +1 -0
- package/dist/private/lib/access/handleIfMoreThan3DaysPassed.mjs +23 -0
- package/dist/private/lib/access/handleIfMoreThan3DaysPassed.mjs.map +1 -0
- package/dist/private/lib/access/handleIfTooMuchRequestsTimes.d.mts +1 -0
- package/dist/private/lib/access/handleIfTooMuchRequestsTimes.mjs +13 -0
- package/dist/private/lib/access/handleIfTooMuchRequestsTimes.mjs.map +1 -0
- package/dist/private/lib/makeBodyJson.d.mts +1 -0
- package/dist/private/lib/makeBodyJson.mjs +7 -0
- package/dist/private/lib/makeBodyJson.mjs.map +1 -0
- package/dist/private/lib/verifyIntrospectionCode.d.mts +9 -0
- package/dist/private/lib/verifyIntrospectionCode.mjs +28 -0
- package/dist/private/lib/verifyIntrospectionCode.mjs.map +1 -0
- package/package.json +709 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { SocketLabsLib } from "../../../email/SocketLabsLib.mjs";
|
|
2
|
+
import { checkEmailLen } from "../../../lib/checkEmailLen.mjs";
|
|
3
|
+
import { EMAIL_HASH_LEN } from "../../../lib/Constants.mjs";
|
|
4
|
+
import { DateLib } from "../../../lib/DateLib.mjs";
|
|
5
|
+
import { StringLib } from "../../../lib/StringLib.mjs";
|
|
6
|
+
import { tryCatchRethrow } from "../../../lib/tryCatchRethrow.mjs";
|
|
7
|
+
import { getResetPwd } from "../../../private/lib/access/db/getResetPwd.mjs";
|
|
8
|
+
import { saveResetReq } from "../../../private/lib/access/db/saveResetReq.mjs";
|
|
9
|
+
import { throwTooManyRequestsError } from "../../throw/throwTooManyRequestsError.mjs";
|
|
10
|
+
import { GraphQLBoolean, GraphQLNonNull, GraphQLString } from 'graphql';
|
|
11
|
+
import mongoose from 'mongoose';
|
|
12
|
+
/**
|
|
13
|
+
* Take the user email and send an email with a link for change the password.
|
|
14
|
+
* for privacy, true is returned if given email do not exist
|
|
15
|
+
*/
|
|
16
|
+
export const resetPwd = {
|
|
17
|
+
description: 'send reset password link',
|
|
18
|
+
type: new GraphQLNonNull(GraphQLBoolean),
|
|
19
|
+
args: {
|
|
20
|
+
email: { type: new GraphQLNonNull(GraphQLString) }
|
|
21
|
+
},
|
|
22
|
+
async resolve(_, args) {
|
|
23
|
+
const { email } = args;
|
|
24
|
+
const uEmail = email.toLowerCase().trim();
|
|
25
|
+
checkEmailLen(uEmail);
|
|
26
|
+
const session = await mongoose.startSession();
|
|
27
|
+
try {
|
|
28
|
+
await session.withTransaction(async () => {
|
|
29
|
+
// console.debug('email exists ?')
|
|
30
|
+
// email exists? -> retrieve whether there have already been reset requests -> return 4xx ??
|
|
31
|
+
const resetPwdVal = await getResetPwd(session, uEmail);
|
|
32
|
+
// don't reveal that the email doesn't exist, for privacy
|
|
33
|
+
if (resetPwdVal === null)
|
|
34
|
+
return;
|
|
35
|
+
// console.debug("the email exists")
|
|
36
|
+
// ok, email exists
|
|
37
|
+
// -> wait 10 minutes from the last password reset request
|
|
38
|
+
// if a password request already exists, read the date in seconds.
|
|
39
|
+
const lastReq = typeof resetPwdVal.resetDateReq !== 'undefined' ? new Date('' + resetPwdVal.resetDateReq) : null;
|
|
40
|
+
// request already made previously?
|
|
41
|
+
// send a new email with the recovery link if it was sent less than 10 minutes ago
|
|
42
|
+
let elapsedMin = 0;
|
|
43
|
+
const nowDt = new Date();
|
|
44
|
+
let calculateHash = false;
|
|
45
|
+
if (lastReq !== null) {
|
|
46
|
+
// console.debug('reset request already made')
|
|
47
|
+
elapsedMin = DateLib.minElapsed(lastReq);
|
|
48
|
+
// console.debug('previous pwd reset request: ' + lastReq + ' it is now ' + now + ' and ' + elapsedMin + ' minutes have passed')
|
|
49
|
+
// if a password reset request has already been made, at least 10 minutes must have passed
|
|
50
|
+
if (elapsedMin < 10) {
|
|
51
|
+
// console.debug('last req < 10 min')
|
|
52
|
+
// Don't reveal that the email was found and
|
|
53
|
+
elapsedMin = 10 - elapsedMin;
|
|
54
|
+
/* c8 ignore next -- defensive: 10-elapsedMin is always >= 0 inside this branch */
|
|
55
|
+
if (elapsedMin < 0)
|
|
56
|
+
elapsedMin = 1; // to round up the seconds of the last minute, set minute = 1
|
|
57
|
+
// console.debug('wait ' + message + ' min ' + uEmail)
|
|
58
|
+
throw throwTooManyRequestsError(elapsedMin.toString());
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// ok, more than 10 minutes, so generate hash for new email
|
|
62
|
+
calculateHash = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
//console.debug('first reset request')
|
|
67
|
+
calculateHash = true;
|
|
68
|
+
}
|
|
69
|
+
if (calculateHash) {
|
|
70
|
+
// generate hash for password reset
|
|
71
|
+
const StrObj = new StringLib();
|
|
72
|
+
const hash = StrObj.randomString(EMAIL_HASH_LEN);
|
|
73
|
+
// set hash and current reset date
|
|
74
|
+
await saveResetReq(session, resetPwdVal._id, nowDt, hash);
|
|
75
|
+
// send email with new hash, last request > 10 minutes ago
|
|
76
|
+
const SocketLabsObj = new SocketLabsLib();
|
|
77
|
+
await SocketLabsObj.sendEmailReset(uEmail, hash, resetPwdVal.name);
|
|
78
|
+
} // calculateHash & sendEmail
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
tryCatchRethrow(e);
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
await session.endSession();
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=resetPwd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resetPwd.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/resetPwd.mts"],"names":[],"mappings":"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","sourcesContent":["import { SocketLabsLib } from '@email/SocketLabsLib.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { EMAIL_HASH_LEN } from '@lib/Constants.mjs'\nimport { DateLib } from '@lib/DateLib.mjs'\nimport { StringLib } from '@lib/StringLib.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { getResetPwd } from '@private/lib/access/db/getResetPwd.mjs'\nimport { saveResetReq } from '@private/lib/access/db/saveResetReq.mjs'\nimport { throwTooManyRequestsError } from '@throw/throwTooManyRequestsError.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\ninterface IArgs {\n\temail: string\n}\n\n/**\n * Take the user email and send an email with a link for change the password.\n * for privacy, true is returned if given email do not exist\n */\nexport const resetPwd = {\n\tdescription: 'send reset password link',\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: IArgs) {\n\t\tconst { email } = args\n\n\t\tconst uEmail = email.toLowerCase().trim()\n\t\tcheckEmailLen(uEmail)\n\n\t\tconst session = await mongoose.startSession()\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t// console.debug('email exists ?')\n\t\t\t\t// email exists? -> retrieve whether there have already been reset requests -> return 4xx ??\n\t\t\t\tconst resetPwdVal = await getResetPwd(session, uEmail)\n\n\t\t\t\t// don't reveal that the email doesn't exist, for privacy\n\t\t\t\tif (resetPwdVal === null) return\n\t\t\t\t// console.debug(\"the email exists\")\n\n\t\t\t\t// ok, email exists\n\n\t\t\t\t// -> wait 10 minutes from the last password reset request\n\n\t\t\t\t// if a password request already exists, read the date in seconds.\n\t\t\t\tconst lastReq = typeof resetPwdVal.resetDateReq !== 'undefined' ? new Date('' + resetPwdVal.resetDateReq) : null\n\n\t\t\t\t// request already made previously?\n\t\t\t\t// send a new email with the recovery link if it was sent less than 10 minutes ago\n\t\t\t\tlet elapsedMin = 0\n\t\t\t\tconst nowDt = new Date()\n\n\t\t\t\tlet calculateHash = false\n\t\t\t\tif (lastReq !== null) {\n\t\t\t\t\t// console.debug('reset request already made')\n\t\t\t\t\telapsedMin = DateLib.minElapsed(lastReq)\n\n\t\t\t\t\t// console.debug('previous pwd reset request: ' + lastReq + ' it is now ' + now + ' and ' + elapsedMin + ' minutes have passed')\n\t\t\t\t\t// if a password reset request has already been made, at least 10 minutes must have passed\n\t\t\t\t\tif (elapsedMin < 10) {\n\t\t\t\t\t\t// console.debug('last req < 10 min')\n\t\t\t\t\t\t// Don't reveal that the email was found and\n\t\t\t\t\t\telapsedMin = 10 - elapsedMin\n\t\t\t\t\t\t/* c8 ignore next -- defensive: 10-elapsedMin is always >= 0 inside this branch */\n\t\t\t\t\t\tif (elapsedMin < 0) elapsedMin = 1 // to round up the seconds of the last minute, set minute = 1\n\t\t\t\t\t\t// console.debug('wait ' + message + ' min ' + uEmail)\n\t\t\t\t\t\tthrow throwTooManyRequestsError(elapsedMin.toString())\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// ok, more than 10 minutes, so generate hash for new email\n\t\t\t\t\t\tcalculateHash = true\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//console.debug('first reset request')\n\t\t\t\t\tcalculateHash = true\n\t\t\t\t}\n\n\t\t\t\tif (calculateHash) {\n\t\t\t\t\t// generate hash for password reset\n\t\t\t\t\tconst StrObj = new StringLib()\n\t\t\t\t\tconst hash = StrObj.randomString(EMAIL_HASH_LEN)\n\n\t\t\t\t\t// set hash and current reset date\n\t\t\t\t\tawait saveResetReq(session, resetPwdVal._id, nowDt, hash)\n\n\t\t\t\t\t// send email with new hash, last request > 10 minutes ago\n\t\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\t\tawait SocketLabsObj.sendEmailReset(uEmail, hash, resetPwdVal.name)\n\t\t\t\t} // calculateHash & sendEmail\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\treturn true\n\t}\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GraphQLNonNull } from 'graphql';
|
|
2
|
+
interface IArgs {
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const signUp: {
|
|
7
|
+
description: string;
|
|
8
|
+
type: GraphQLNonNull<import("graphql").GraphQLScalarType<boolean, boolean>>;
|
|
9
|
+
args: {
|
|
10
|
+
email: {
|
|
11
|
+
type: GraphQLNonNull<import("graphql").GraphQLScalarType<string, string>>;
|
|
12
|
+
};
|
|
13
|
+
password: {
|
|
14
|
+
type: GraphQLNonNull<import("graphql").GraphQLScalarType<string, string>>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
resolve(_: unknown, args: IArgs): Promise<boolean>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SocketLabsLib } from "../../../email/SocketLabsLib.mjs";
|
|
2
|
+
import { checkEmailLen } from "../../../lib/checkEmailLen.mjs";
|
|
3
|
+
import { checkPwdLen } from "../../../lib/checkPwdLen.mjs";
|
|
4
|
+
import { registerNewUser } from "../../../lib/db/registerNewUser.mjs";
|
|
5
|
+
import { userExist } from "../../../lib/db/userExist.mjs";
|
|
6
|
+
import { tryCatchRethrow } from "../../../lib/tryCatchRethrow.mjs";
|
|
7
|
+
import { throwConflictError } from "../../throw/throwConflictError.mjs";
|
|
8
|
+
import { GraphQLBoolean, GraphQLNonNull, GraphQLString } from 'graphql';
|
|
9
|
+
import mongoose from 'mongoose';
|
|
10
|
+
export const signUp = {
|
|
11
|
+
description: 'Sign Up',
|
|
12
|
+
type: new GraphQLNonNull(GraphQLBoolean),
|
|
13
|
+
args: {
|
|
14
|
+
email: { type: new GraphQLNonNull(GraphQLString) },
|
|
15
|
+
password: { type: new GraphQLNonNull(GraphQLString) }
|
|
16
|
+
},
|
|
17
|
+
async resolve(_, args) {
|
|
18
|
+
const { email, password } = args;
|
|
19
|
+
const uEmail = email.toLowerCase().trim();
|
|
20
|
+
checkEmailLen(uEmail);
|
|
21
|
+
checkPwdLen(password);
|
|
22
|
+
const session = await mongoose.startSession();
|
|
23
|
+
let uExist = false;
|
|
24
|
+
try {
|
|
25
|
+
await session.withTransaction(async () => {
|
|
26
|
+
/********************************************
|
|
27
|
+
* First, search if the user does not exist
|
|
28
|
+
*/
|
|
29
|
+
uExist = await userExist(uEmail, session);
|
|
30
|
+
if (uExist) {
|
|
31
|
+
const SocketLabsObj = new SocketLabsLib();
|
|
32
|
+
await SocketLabsObj.emailAlreadyValid(uEmail);
|
|
33
|
+
throw throwConflictError();
|
|
34
|
+
}
|
|
35
|
+
/*********************************************
|
|
36
|
+
* ok, new user. create user obj for DB. generate hash password
|
|
37
|
+
*/
|
|
38
|
+
const hashConfirmEmail = await registerNewUser(uEmail, password, session);
|
|
39
|
+
/************************************
|
|
40
|
+
* send email
|
|
41
|
+
*/
|
|
42
|
+
const SocketLabsObj = new SocketLabsLib();
|
|
43
|
+
await SocketLabsObj.sendEmailVerify(uEmail, hashConfirmEmail);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
tryCatchRethrow(e);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
await session.endSession();
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=signUp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signUp.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/signUp.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,yCAAgC;AACxD,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,WAAW,EAAE,qCAA4B;AAClD,OAAO,EAAE,eAAe,EAAE,4CAAmC;AAC7D,OAAO,EAAE,SAAS,EAAE,sCAA6B;AACjD,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,2CAAqC;AAClE,OAAO,EAAE,cAAc,EAAgB,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,QAAQ,MAAM,UAAU,CAAA;AAO/B,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,WAAW,EAAE,SAAS;IACtB,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC;IACxC,IAAI,EAAE;QACL,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QAClD,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACrD;IACD,KAAK,CAAC,OAAO,CAAC,CAAU,EAAE,IAAW;QACpC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;QAEhC,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAA;QACzC,aAAa,CAAC,MAAM,CAAC,CAAA;QACrB,WAAW,CAAC,QAAQ,CAAC,CAAA;QAErB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,CAAA;QAC7C,IAAI,MAAM,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC;YACJ,MAAM,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE;gBACxC;;mBAEG;gBACH,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBACzC,IAAI,MAAM,EAAE,CAAC;oBACZ,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA;oBACzC,MAAM,aAAa,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;oBAC7C,MAAM,kBAAkB,EAAE,CAAA;gBAC3B,CAAC;gBAED;;mBAEG;gBACH,MAAM,gBAAgB,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;gBAEzE;;mBAEG;gBACH,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA;gBACzC,MAAM,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;YAC9D,CAAC,CAAC,CAAA;QACH,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACrB,eAAe,CAAC,CAAyB,CAAC,CAAA;QAC3C,CAAC;gBAAS,CAAC;YACV,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;QAC3B,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC;CACD,CAAA","sourcesContent":["import { SocketLabsLib } from '@email/SocketLabsLib.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { checkPwdLen } from '@lib/checkPwdLen.mjs'\nimport { registerNewUser } from '@lib/db/registerNewUser.mjs'\nimport { userExist } from '@lib/db/userExist.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { throwConflictError } from '@throw/throwConflictError.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\ninterface IArgs {\n\temail: string\n\tpassword: string\n}\n\nexport const signUp = {\n\tdescription: 'Sign Up',\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: IArgs) {\n\t\tconst { email, password } = args\n\n\t\tconst uEmail = email.toLowerCase().trim()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\tconst session = await mongoose.startSession()\n\t\tlet uExist = false\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t/********************************************\n\t\t\t\t * First, search if the user does not exist\n\t\t\t\t */\n\t\t\t\tuExist = await userExist(uEmail, session)\n\t\t\t\tif (uExist) {\n\t\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\t\tawait SocketLabsObj.emailAlreadyValid(uEmail)\n\t\t\t\t\tthrow throwConflictError()\n\t\t\t\t}\n\n\t\t\t\t/*********************************************\n\t\t\t\t * ok, new user. create user obj for DB. generate hash password\n\t\t\t\t */\n\t\t\t\tconst hashConfirmEmail = await registerNewUser(uEmail, password, session)\n\n\t\t\t\t/************************************\n\t\t\t\t * send email\n\t\t\t\t */\n\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\tawait SocketLabsObj.sendEmailVerify(uEmail, hashConfirmEmail)\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\treturn true\n\t}\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GraphQLNonNull } from 'graphql';
|
|
2
|
+
interface IArgs {
|
|
3
|
+
email: string;
|
|
4
|
+
hash: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const updatePassword: {
|
|
8
|
+
description: string;
|
|
9
|
+
type: GraphQLNonNull<import("graphql").GraphQLScalarType<boolean, boolean>>;
|
|
10
|
+
args: {
|
|
11
|
+
email: {
|
|
12
|
+
type: GraphQLNonNull<import("graphql").GraphQLScalarType<string, string>>;
|
|
13
|
+
};
|
|
14
|
+
hash: {
|
|
15
|
+
type: GraphQLNonNull<import("graphql").GraphQLScalarType<string, string>>;
|
|
16
|
+
};
|
|
17
|
+
password: {
|
|
18
|
+
type: GraphQLNonNull<import("graphql").GraphQLScalarType<string, string>>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
resolve(_: unknown, args: IArgs): Promise<boolean>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { SocketLabsLib } from "../../../email/SocketLabsLib.mjs";
|
|
2
|
+
import { checkEmailLen } from "../../../lib/checkEmailLen.mjs";
|
|
3
|
+
import { checkPwdLen } from "../../../lib/checkPwdLen.mjs";
|
|
4
|
+
import { DateLib } from "../../../lib/DateLib.mjs";
|
|
5
|
+
import { tryCatchRethrow } from "../../../lib/tryCatchRethrow.mjs";
|
|
6
|
+
import { getResetPwd } from "../../../private/lib/access/db/getResetPwd.mjs";
|
|
7
|
+
import removeResetReq from "../../../private/lib/access/db/removeResetReq.mjs";
|
|
8
|
+
import updatePasswordDb from "../../../private/lib/access/db/updatePasswordDb.mjs";
|
|
9
|
+
import { throwForbiddenError } from "../../throw/throwForbiddenError.mjs";
|
|
10
|
+
import { throwInternalError } from "../../throw/throwInternalError.mjs";
|
|
11
|
+
import { GraphQLBoolean, GraphQLNonNull, GraphQLString } from 'graphql';
|
|
12
|
+
import mongoose from 'mongoose';
|
|
13
|
+
export const updatePassword = {
|
|
14
|
+
description: "changes the user's password",
|
|
15
|
+
type: new GraphQLNonNull(GraphQLBoolean),
|
|
16
|
+
args: {
|
|
17
|
+
email: { type: new GraphQLNonNull(GraphQLString) },
|
|
18
|
+
hash: { type: new GraphQLNonNull(GraphQLString) },
|
|
19
|
+
password: { type: new GraphQLNonNull(GraphQLString) }
|
|
20
|
+
},
|
|
21
|
+
async resolve(_, args) {
|
|
22
|
+
const { email, hash, password } = args;
|
|
23
|
+
const uEmail = email.trim().toLowerCase();
|
|
24
|
+
checkEmailLen(uEmail);
|
|
25
|
+
checkPwdLen(password);
|
|
26
|
+
const session = await mongoose.startSession();
|
|
27
|
+
try {
|
|
28
|
+
await session.withTransaction(async () => {
|
|
29
|
+
const resetPwd = await getResetPwd(session, uEmail);
|
|
30
|
+
// check if email is present in db
|
|
31
|
+
if (resetPwd === null) {
|
|
32
|
+
throw throwForbiddenError(); // don't reveal whether the email is present, for privacy
|
|
33
|
+
}
|
|
34
|
+
// console.debug('--email present')
|
|
35
|
+
if (resetPwd.resetHash === null) {
|
|
36
|
+
throw throwInternalError();
|
|
37
|
+
}
|
|
38
|
+
/* c8 ignore next 3 -- defensive guard, resetDateReq cannot be null when resetHash is set */
|
|
39
|
+
if (resetPwd.resetDateReq === null) {
|
|
40
|
+
throw throwInternalError(); // throwSoftwareError('resetDateReq missing !')
|
|
41
|
+
}
|
|
42
|
+
// check if hash is missing or invalid
|
|
43
|
+
if (resetPwd.resetHash !== hash) {
|
|
44
|
+
throw throwForbiddenError(); // don't reveal whether the email is present, for privacy
|
|
45
|
+
} // else console.debug('--hash valid')
|
|
46
|
+
// check if the request was made within 1 hour
|
|
47
|
+
const dt1 = new Date('' + resetPwd.resetDateReq);
|
|
48
|
+
if (DateLib.minElapsed(dt1) > 60) {
|
|
49
|
+
throw throwForbiddenError(); // The link is no longer valid
|
|
50
|
+
} // else console.debug('--link valid')
|
|
51
|
+
const update = await updatePasswordDb(session, resetPwd._id, password);
|
|
52
|
+
if (!update) {
|
|
53
|
+
throw throwInternalError(); // "System error while updating the password."
|
|
54
|
+
} // else console.debug('--pwd updated')
|
|
55
|
+
// delete password reset request data from db
|
|
56
|
+
await removeResetReq(session, uEmail);
|
|
57
|
+
// send new password confirmation email
|
|
58
|
+
const SocketLabsObj = new SocketLabsLib();
|
|
59
|
+
await SocketLabsObj.sendConfermaResetPwd(uEmail, resetPwd.name);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
tryCatchRethrow(e);
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
await session.endSession();
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=updatePassword.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatePassword.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/updatePassword.mts"],"names":[],"mappings":"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","sourcesContent":["import { SocketLabsLib } from '@email/SocketLabsLib.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { checkPwdLen } from '@lib/checkPwdLen.mjs'\nimport { DateLib } from '@lib/DateLib.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { getResetPwd } from '@private/lib/access/db/getResetPwd.mjs'\nimport removeResetReq from '@private/lib/access/db/removeResetReq.mjs'\nimport updatePasswordDb from '@private/lib/access/db/updatePasswordDb.mjs'\nimport { throwForbiddenError } from '@throw/throwForbiddenError.mjs'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\ninterface IArgs {\n\temail: string\n\thash: string\n\tpassword: string\n}\n\nexport const updatePassword = {\n\tdescription: \"changes the user's password\",\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\thash: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: IArgs) {\n\t\tconst { email, hash, password } = args\n\n\t\tconst uEmail = email.trim().toLowerCase()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\tconst session = await mongoose.startSession()\n\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\tconst resetPwd = await getResetPwd(session, uEmail)\n\n\t\t\t\t// check if email is present in db\n\t\t\t\tif (resetPwd === null) {\n\t\t\t\t\tthrow throwForbiddenError() // don't reveal whether the email is present, for privacy\n\t\t\t\t}\n\t\t\t\t// console.debug('--email present')\n\n\t\t\t\tif (resetPwd.resetHash === null) {\n\t\t\t\t\tthrow throwInternalError()\n\t\t\t\t}\n\t\t\t\t/* c8 ignore next 3 -- defensive guard, resetDateReq cannot be null when resetHash is set */\n\t\t\t\tif (resetPwd.resetDateReq === null) {\n\t\t\t\t\tthrow throwInternalError() // throwSoftwareError('resetDateReq missing !')\n\t\t\t\t}\n\n\t\t\t\t// check if hash is missing or invalid\n\t\t\t\tif (resetPwd.resetHash !== hash) {\n\t\t\t\t\tthrow throwForbiddenError() // don't reveal whether the email is present, for privacy\n\t\t\t\t} // else console.debug('--hash valid')\n\n\t\t\t\t// check if the request was made within 1 hour\n\t\t\t\tconst dt1 = new Date('' + resetPwd.resetDateReq)\n\t\t\t\tif (DateLib.minElapsed(dt1) > 60) {\n\t\t\t\t\tthrow throwForbiddenError() // The link is no longer valid\n\t\t\t\t} // else console.debug('--link valid')\n\n\t\t\t\tconst update = await updatePasswordDb(session, resetPwd._id, password)\n\t\t\t\tif (!update) {\n\t\t\t\t\tthrow throwInternalError() // \"System error while updating the password.\"\n\t\t\t\t} // else console.debug('--pwd updated')\n\n\t\t\t\t// delete password reset request data from db\n\t\t\t\tawait removeResetReq(session, uEmail)\n\n\t\t\t\t// send new password confirmation email\n\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\tawait SocketLabsObj.sendConfermaResetPwd(uEmail, resetPwd.name)\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\treturn true\n\t}\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphQLBoolean, GraphQLInt, GraphQLObjectType } from 'graphql';
|
|
2
|
+
export const DeleteType = new GraphQLObjectType({
|
|
3
|
+
name: 'DeleteType',
|
|
4
|
+
fields: () => ({
|
|
5
|
+
acknowledged: { type: GraphQLBoolean },
|
|
6
|
+
deletedCount: { type: GraphQLInt }
|
|
7
|
+
})
|
|
8
|
+
});
|
|
9
|
+
export const RET_DEL_ROLLBACK = {
|
|
10
|
+
acknowledged: false,
|
|
11
|
+
deletedCount: 0
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=DeleteType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/DeleteType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEvE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC;IAC/C,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,YAAY,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;QACtC,YAAY,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;KAClC,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,CAAC;CACf,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLInt, GraphQLObjectType } from 'graphql'\n\nexport const DeleteType = new GraphQLObjectType({\n\tname: 'DeleteType',\n\tfields: () => ({\n\t\tacknowledged: { type: GraphQLBoolean },\n\t\tdeletedCount: { type: GraphQLInt }\n\t})\n})\n\nexport const RET_DEL_ROLLBACK = {\n\tacknowledged: false,\n\tdeletedCount: 0\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GraphQLBoolean, GraphQLID, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
export const DoneType = new GraphQLObjectType({
|
|
3
|
+
name: 'DoneType',
|
|
4
|
+
fields: () => ({
|
|
5
|
+
done: { type: new GraphQLNonNull(GraphQLBoolean) },
|
|
6
|
+
message: { type: new GraphQLNonNull(GraphQLString) },
|
|
7
|
+
_id: { type: GraphQLID }
|
|
8
|
+
})
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=DoneType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DoneType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/DoneType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAErG,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC;IAC7C,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE;QAClD,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QACpD,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KACxB,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLID, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\nexport const DoneType = new GraphQLObjectType({\n\tname: 'DoneType',\n\tfields: () => ({\n\t\tdone: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\tmessage: { type: new GraphQLNonNull(GraphQLString) },\n\t\t_id: { type: GraphQLID }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType } from 'graphql';
|
|
2
|
+
const FindOneAndUpdateDetailType = new GraphQLObjectType({
|
|
3
|
+
name: 'FindOneAndUpdateDetailType',
|
|
4
|
+
fields: () => ({
|
|
5
|
+
updatedExisting: { type: new GraphQLNonNull(GraphQLBoolean) }
|
|
6
|
+
})
|
|
7
|
+
});
|
|
8
|
+
// I ignore the other data
|
|
9
|
+
export const FindOneAndUpdateType = new GraphQLObjectType({
|
|
10
|
+
name: 'FindOneAndUpdateType',
|
|
11
|
+
fields: () => ({
|
|
12
|
+
lastErrorObject: { type: new GraphQLNonNull(FindOneAndUpdateDetailType) }
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=FindOneAndUpdateType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindOneAndUpdateType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/FindOneAndUpdateType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3E,MAAM,0BAA0B,GAAG,IAAI,iBAAiB,CAAC;IACxD,IAAI,EAAE,4BAA4B;IAClC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,eAAe,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE;KAC7D,CAAC;CACF,CAAC,CAAA;AAEF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,iBAAiB,CAAC;IACzD,IAAI,EAAE,sBAAsB;IAC5B,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,eAAe,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,0BAA0B,CAAC,EAAE;KACzE,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType } from 'graphql'\n\nconst FindOneAndUpdateDetailType = new GraphQLObjectType({\n\tname: 'FindOneAndUpdateDetailType',\n\tfields: () => ({\n\t\tupdatedExisting: { type: new GraphQLNonNull(GraphQLBoolean) }\n\t})\n})\n\n// I ignore the other data\nexport const FindOneAndUpdateType = new GraphQLObjectType({\n\tname: 'FindOneAndUpdateType',\n\tfields: () => ({\n\t\tlastErrorObject: { type: new GraphQLNonNull(FindOneAndUpdateDetailType) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
// returns null id if it fails to save
|
|
3
|
+
export const LoginAppType = new GraphQLObjectType({
|
|
4
|
+
name: 'LoginAppType',
|
|
5
|
+
fields: () => ({
|
|
6
|
+
accessToken: { type: new GraphQLNonNull(GraphQLString) },
|
|
7
|
+
onboardingStep: { type: new GraphQLNonNull(GraphQLString) },
|
|
8
|
+
onboardingDone: { type: new GraphQLNonNull(GraphQLBoolean) }
|
|
9
|
+
})
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=LoginAppType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginAppType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/LoginAppType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1F,sCAAsC;AACtC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,iBAAiB,CAAC;IACjD,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QACxD,cAAc,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QAC3D,cAAc,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE;KAC5D,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n// returns null id if it fails to save\nexport const LoginAppType = new GraphQLObjectType({\n\tname: 'LoginAppType',\n\tfields: () => ({\n\t\taccessToken: { type: new GraphQLNonNull(GraphQLString) },\n\t\tonboardingStep: { type: new GraphQLNonNull(GraphQLString) },\n\t\tonboardingDone: { type: new GraphQLNonNull(GraphQLBoolean) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
// returns null id if it fails to save
|
|
3
|
+
export const LoginType = new GraphQLObjectType({
|
|
4
|
+
name: 'LoginType',
|
|
5
|
+
fields: () => ({
|
|
6
|
+
accessToken: { type: new GraphQLNonNull(GraphQLString) }
|
|
7
|
+
})
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=LoginType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/LoginType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1E,sCAAsC;AACtC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC;IAC9C,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACxD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n// returns null id if it fails to save\nexport const LoginType = new GraphQLObjectType({\n\tname: 'LoginType',\n\tfields: () => ({\n\t\taccessToken: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GraphQLID, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* MongoDB _id & name
|
|
4
|
+
*/
|
|
5
|
+
export const MidNameType = new GraphQLObjectType({
|
|
6
|
+
name: 'MidNameType',
|
|
7
|
+
fields: () => ({
|
|
8
|
+
_id: { type: new GraphQLNonNull(GraphQLID) },
|
|
9
|
+
name: { type: new GraphQLNonNull(GraphQLString) }
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=MidNameType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MidNameType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/MidNameType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAErF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE;QAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACjD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLID, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n/**\n * MongoDB _id & name\n */\nexport const MidNameType = new GraphQLObjectType({\n\tname: 'MidNameType',\n\tfields: () => ({\n\t\t_id: { type: new GraphQLNonNull(GraphQLID) },\n\t\tname: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnlyIdType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/OnlyIdType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC;IAC/C,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE;KAC5C,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLID, GraphQLNonNull, GraphQLObjectType } from 'graphql'\n\nexport const OnlyIdType = new GraphQLObjectType({\n\tname: 'OnlyIdType',\n\tfields: () => ({\n\t\t_id: { type: new GraphQLNonNull(GraphQLID) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
// returns null id if it fails to save
|
|
3
|
+
export const RefreshType = new GraphQLObjectType({
|
|
4
|
+
name: 'RefreshType',
|
|
5
|
+
fields: () => ({
|
|
6
|
+
status: { type: new GraphQLNonNull(GraphQLBoolean) },
|
|
7
|
+
accessToken: { type: new GraphQLNonNull(GraphQLString) }
|
|
8
|
+
})
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=RefreshType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/RefreshType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1F,sCAAsC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE;QACpD,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACxD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n// returns null id if it fails to save\nexport const RefreshType = new GraphQLObjectType({\n\tname: 'RefreshType',\n\tfields: () => ({\n\t\tstatus: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\taccessToken: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
export const RetStatusMexType = new GraphQLObjectType({
|
|
3
|
+
name: 'RetStatusMexType',
|
|
4
|
+
fields: () => ({
|
|
5
|
+
status: { type: new GraphQLNonNull(GraphQLString) },
|
|
6
|
+
mex: { type: GraphQLString }
|
|
7
|
+
})
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=RetStatusMexType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RetStatusMexType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/RetStatusMexType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,iBAAiB,CAAC;IACrD,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QACnD,GAAG,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;KAC5B,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\nexport const RetStatusMexType = new GraphQLObjectType({\n\tname: 'RetStatusMexType',\n\tfields: () => ({\n\t\tstatus: { type: new GraphQLNonNull(GraphQLString) },\n\t\tmex: { type: GraphQLString }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
export const RetStatusType = new GraphQLObjectType({
|
|
3
|
+
name: 'RetStatusType',
|
|
4
|
+
fields: () => ({
|
|
5
|
+
status: { type: new GraphQLNonNull(GraphQLString) }
|
|
6
|
+
})
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=RetStatusType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RetStatusType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/RetStatusType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1E,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,iBAAiB,CAAC;IAClD,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACnD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\nexport const RetStatusType = new GraphQLObjectType({\n\tname: 'RetStatusType',\n\tfields: () => ({\n\t\tstatus: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SaveType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/SaveType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEtD,sCAAsC;AACtC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC;IAC7C,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KACxB,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLID, GraphQLObjectType } from 'graphql'\n\n// returns null id if it fails to save\nexport const SaveType = new GraphQLObjectType({\n\tname: 'SaveType',\n\tfields: () => ({\n\t\t_id: { type: GraphQLID }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GraphQLInt, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* MariaDB id & name
|
|
4
|
+
*/
|
|
5
|
+
export const SidNameType = new GraphQLObjectType({
|
|
6
|
+
name: 'SidNameType',
|
|
7
|
+
fields: () => ({
|
|
8
|
+
id: { type: new GraphQLNonNull(GraphQLInt) },
|
|
9
|
+
name: { type: new GraphQLNonNull(GraphQLString) }
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=SidNameType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidNameType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/SidNameType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,UAAU,CAAC,EAAE;QAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACjD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLInt, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n/**\n * MariaDB id & name\n */\nexport const SidNameType = new GraphQLObjectType({\n\tname: 'SidNameType',\n\tfields: () => ({\n\t\tid: { type: new GraphQLNonNull(GraphQLInt) },\n\t\tname: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GraphQLInt, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* MariaDB id & nome
|
|
4
|
+
*/
|
|
5
|
+
export const SidNomeType = new GraphQLObjectType({
|
|
6
|
+
name: 'SidNomeType',
|
|
7
|
+
fields: () => ({
|
|
8
|
+
id: { type: new GraphQLNonNull(GraphQLInt) },
|
|
9
|
+
nome: { type: new GraphQLNonNull(GraphQLString) }
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=SidNomeType.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidNomeType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/SidNomeType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,UAAU,CAAC,EAAE;QAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACjD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLInt, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n/**\n * MariaDB id & nome\n */\nexport const SidNomeType = new GraphQLObjectType({\n\tname: 'SidNomeType',\n\tfields: () => ({\n\t\tid: { type: new GraphQLNonNull(GraphQLInt) },\n\t\tnome: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GraphQLInt, GraphQLNonNull, GraphQLObjectType } from 'graphql'; // returns null id if it fails to save
|
|
2
|
+
// returns null id if it fails to save
|
|
3
|
+
export const UpdateResultType = new GraphQLObjectType({
|
|
4
|
+
name: 'UpdateResultType',
|
|
5
|
+
fields: () => ({
|
|
6
|
+
modifiedCount: { type: new GraphQLNonNull(GraphQLInt) }
|
|
7
|
+
})
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=UpdateResultType.mjs.map
|