@axiumine/koa-utils 5.6.1 → 5.7.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/README.md +33 -5
- package/dist/graphQL/schema/mutations/emailChangeHashVerify.d.mts +7 -0
- package/dist/graphQL/schema/mutations/emailChangeHashVerify.mjs +38 -35
- package/dist/lib/access/accessPaths.d.mts +18 -0
- package/dist/lib/access/createMailThrottle.d.mts +34 -0
- package/dist/lib/access/createMailThrottle.mjs +45 -0
- package/dist/lib/access/createVerifyEmailFlow.d.mts +37 -4
- package/dist/lib/access/createVerifyEmailFlow.mjs +33 -10
- package/dist/lib/access/verifyEmailMailer.d.mts +54 -0
- package/dist/lib/access/verifyEmailMailer.mjs +48 -0
- package/dist/private/lib/access/assertVerifyEmailAllowed.d.mts +13 -1
- package/dist/private/lib/access/assertVerifyEmailAllowed.mjs +7 -4
- package/dist/private/lib/access/db/abandonUser.d.mts +25 -0
- package/dist/private/lib/access/db/abandonUser.mjs +26 -0
- package/dist/private/lib/access/db/deleteUserByEmail.d.mts +7 -0
- package/dist/private/lib/access/db/deleteUserByEmail.mjs +15 -4
- package/dist/private/lib/access/db/enableEmailAccess.d.mts +9 -1
- package/dist/private/lib/access/db/enableEmailAccess.mjs +11 -5
- package/dist/private/lib/access/handleBadDB.d.mts +11 -0
- package/dist/private/lib/access/handleBadDB.mjs +13 -1
- package/dist/private/lib/access/handleIfAccountDeleted.d.mts +16 -1
- package/dist/private/lib/access/handleIfAccountDeleted.mjs +16 -5
- package/dist/private/lib/access/handleIfAccountDisabled.d.mts +15 -1
- package/dist/private/lib/access/handleIfAccountDisabled.mjs +15 -5
- package/dist/private/lib/access/handleIfEmailAlreadyValid.d.mts +18 -1
- package/dist/private/lib/access/handleIfEmailAlreadyValid.mjs +18 -5
- package/dist/private/lib/access/handleIfHashBad.d.mts +5 -1
- package/dist/private/lib/access/handleIfHashBad.mjs +7 -5
- package/dist/private/lib/access/handleIfMoreThan3DaysPassed.d.mts +8 -4
- package/dist/private/lib/access/handleIfMoreThan3DaysPassed.mjs +10 -8
- package/dist/private/lib/access/handleIfTooMuchRequestsTimes.d.mts +7 -4
- package/dist/private/lib/access/handleIfTooMuchRequestsTimes.mjs +9 -8
- package/package.json +68 -18
- package/dist/dataSources/MariaDB.mjs.map +0 -1
- package/dist/dataSources/MongoDB.mjs.map +0 -1
- package/dist/dataSources/PostgreSQL.mjs.map +0 -1
- package/dist/dataSources/Redis.mjs.map +0 -1
- package/dist/email/SocketLabsLib.mjs.map +0 -1
- package/dist/files/IUploadTemp.mjs.map +0 -1
- package/dist/files/checkForNSFW.mjs.map +0 -1
- package/dist/files/fileConst.mjs.map +0 -1
- package/dist/files/moveFileStaticDomain.mjs.map +0 -1
- package/dist/files/moveImageFile.mjs.map +0 -1
- package/dist/files/moveTempFile.mjs.map +0 -1
- package/dist/files/reEncodeToJpeg.mjs.map +0 -1
- package/dist/files/reEncodeToPng.mjs.map +0 -1
- package/dist/files/reEncodeToWebp.mjs.map +0 -1
- package/dist/files/scanVirus.mjs.map +0 -1
- package/dist/files/storeUploadAsTemp.mjs.map +0 -1
- package/dist/files/uploadTempImage.mjs.map +0 -1
- package/dist/files/uploadTempPdf.mjs.map +0 -1
- package/dist/files/validateExtension.mjs.map +0 -1
- package/dist/files/validateJpgPngExtension.mjs.map +0 -1
- package/dist/files/validateMimeType.mjs.map +0 -1
- package/dist/files/validateMimeTypeImages.mjs.map +0 -1
- package/dist/files/validateMimeTypePdf.mjs.map +0 -1
- package/dist/files/validatePdfExtension.mjs.map +0 -1
- package/dist/graphQL/models/MongoDB/UserBase.mjs.map +0 -1
- package/dist/graphQL/models/MongoDB/log/DevStatsGraphQLCalls.mjs.map +0 -1
- package/dist/graphQL/models/MongoDB/log/LogGlobalError.mjs.map +0 -1
- package/dist/graphQL/models/MongoDB/log/LogStatsGraphql.mjs.map +0 -1
- package/dist/graphQL/models/MongoDB/log/LogThrow.mjs.map +0 -1
- package/dist/graphQL/schema/GraphQLInput/GraphQLInputLogin.mjs.map +0 -1
- package/dist/graphQL/schema/context/IContextAuthenticatedResource.mjs.map +0 -1
- package/dist/graphQL/schema/context/IContextKoaErrorHandler.mjs.map +0 -1
- package/dist/graphQL/schema/context/IContextLogin.mjs.map +0 -1
- package/dist/graphQL/schema/context/IContextLogout.mjs.map +0 -1
- package/dist/graphQL/schema/context/IContextRefresh.mjs.map +0 -1
- package/dist/graphQL/schema/context/TCommonHeaders.mjs.map +0 -1
- package/dist/graphQL/schema/interfaces/IFindAndUpdate.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/emailChangeHashVerify.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/login4Ever.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/loginAdmin.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/loginRememberme.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/logout.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/refresh.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/resetPwd.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/signUp.mjs.map +0 -1
- package/dist/graphQL/schema/mutations/updatePassword.mjs.map +0 -1
- package/dist/graphQL/schema/types/DeleteType.mjs.map +0 -1
- package/dist/graphQL/schema/types/DoneType.mjs.map +0 -1
- package/dist/graphQL/schema/types/FindOneAndUpdateType.mjs.map +0 -1
- package/dist/graphQL/schema/types/LoginAppType.mjs.map +0 -1
- package/dist/graphQL/schema/types/LoginType.mjs.map +0 -1
- package/dist/graphQL/schema/types/MidNameType.mjs.map +0 -1
- package/dist/graphQL/schema/types/OnlyIdType.mjs.map +0 -1
- package/dist/graphQL/schema/types/RefreshType.mjs.map +0 -1
- package/dist/graphQL/schema/types/RetStatusMexType.mjs.map +0 -1
- package/dist/graphQL/schema/types/RetStatusType.mjs.map +0 -1
- package/dist/graphQL/schema/types/SaveType.mjs.map +0 -1
- package/dist/graphQL/schema/types/SidNameType.mjs.map +0 -1
- package/dist/graphQL/schema/types/SidNomeType.mjs.map +0 -1
- package/dist/graphQL/schema/types/UpdateResultType.mjs.map +0 -1
- package/dist/graphQL/status.mjs.map +0 -1
- package/dist/graphQL/throw/throwAccessTokenExpiredOrDeleted.mjs.map +0 -1
- package/dist/graphQL/throw/throwAccessTokenRequired.mjs.map +0 -1
- package/dist/graphQL/throw/throwAlreadyDone.mjs.map +0 -1
- package/dist/graphQL/throw/throwAlreadyTakenError.mjs.map +0 -1
- package/dist/graphQL/throw/throwConflictError.mjs.map +0 -1
- package/dist/graphQL/throw/throwErrorWrongUserInput.mjs.map +0 -1
- package/dist/graphQL/throw/throwForbiddenError.mjs.map +0 -1
- package/dist/graphQL/throw/throwGoneError.mjs.map +0 -1
- package/dist/graphQL/throw/throwGraphQLError.mjs.map +0 -1
- package/dist/graphQL/throw/throwInternalError.mjs.map +0 -1
- package/dist/graphQL/throw/throwMethodNotAllowedError.mjs.map +0 -1
- package/dist/graphQL/throw/throwMissingMalformedInvalidToken.mjs.map +0 -1
- package/dist/graphQL/throw/throwNotAcceptableError.mjs.map +0 -1
- package/dist/graphQL/throw/throwNotFoundError.mjs.map +0 -1
- package/dist/graphQL/throw/throwNotImplementedError.mjs.map +0 -1
- package/dist/graphQL/throw/throwPaymentRequiredError.mjs.map +0 -1
- package/dist/graphQL/throw/throwPreconditionFailedNoAuthCookie.mjs.map +0 -1
- package/dist/graphQL/throw/throwPreconditionFailedNoAuthHeader.mjs.map +0 -1
- package/dist/graphQL/throw/throwRefreshTokenExpiredOrDeleted.mjs.map +0 -1
- package/dist/graphQL/throw/throwRefreshTokenRequired.mjs.map +0 -1
- package/dist/graphQL/throw/throwRefreshTokenSignatureRequired.mjs.map +0 -1
- package/dist/graphQL/throw/throwTooManyRequestsError.mjs.map +0 -1
- package/dist/graphQL/throw/throwUnauthorizedError.mjs.map +0 -1
- package/dist/graphQL/throw/throwUnprocessableContentError.mjs.map +0 -1
- package/dist/graphQL/throw/throwUnsupportedMediaTypeError.mjs.map +0 -1
- package/dist/koa/IFileUpload.mjs.map +0 -1
- package/dist/koa/IKoaError.mjs.map +0 -1
- package/dist/koa/customFormatErrorFn.mjs.map +0 -1
- package/dist/koa/logRequestToDb.mjs.map +0 -1
- package/dist/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.mjs.map +0 -1
- package/dist/koa/middleware/authenticatedAuthorizationHandler/index.mjs.map +0 -1
- package/dist/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs.map +0 -1
- package/dist/koa/middleware/authenticatedLogoutHandler/index.mjs.map +0 -1
- package/dist/koa/middleware/authenticatedResourceHandler/index.mjs.map +0 -1
- package/dist/koa/middleware/debug/index.mjs.map +0 -1
- package/dist/koa/router/verifyEmail.mjs.map +0 -1
- package/dist/koa/tdwKoaErrorHandler.mjs.map +0 -1
- package/dist/lib/ArrayLib.mjs.map +0 -1
- package/dist/lib/Constants.mjs.map +0 -1
- package/dist/lib/DateLib.mjs.map +0 -1
- package/dist/lib/IAuthorizationDisDel.mjs.map +0 -1
- package/dist/lib/ICookies.mjs.map +0 -1
- package/dist/lib/MariaDB/IMariaDBErr.mjs.map +0 -1
- package/dist/lib/MariaDB/MariaDBErrType.mjs.map +0 -1
- package/dist/lib/MariaDB/throwSqlErrors.mjs.map +0 -1
- package/dist/lib/MongoDB/IMongoDBError.mjs.map +0 -1
- package/dist/lib/MongoDB/IOnboarding.mjs.map +0 -1
- package/dist/lib/MongoDB/MongoDBErrType.mjs.map +0 -1
- package/dist/lib/MongoDB/throwIfMongoErr.mjs.map +0 -1
- package/dist/lib/MongoDB/throwMongoErrors.mjs.map +0 -1
- package/dist/lib/NumLib.mjs.map +0 -1
- package/dist/lib/PostgreSQL/IPostgresError.mjs.map +0 -1
- package/dist/lib/PostgreSQL/IPostgresErrorCodes.mjs.map +0 -1
- package/dist/lib/PostgreSQL/makePostgreSqlLogError.mjs.map +0 -1
- package/dist/lib/Redis/RedisBoolean.mjs.map +0 -1
- package/dist/lib/Redis/buildPrefixedRedisKey.mjs.map +0 -1
- package/dist/lib/Redis/fromRedisBooleanValue.mjs.map +0 -1
- package/dist/lib/Redis/toRedisBooleanValue.mjs.map +0 -1
- package/dist/lib/StringLib.mjs.map +0 -1
- package/dist/lib/access/accessPaths.mjs.map +0 -1
- package/dist/lib/access/createResetPwdFlow.mjs.map +0 -1
- package/dist/lib/access/createVerifyEmailFlow.mjs.map +0 -1
- package/dist/lib/checkEmailLen.mjs.map +0 -1
- package/dist/lib/checkPwdLen.mjs.map +0 -1
- package/dist/lib/db/log/hitStat.mjs.map +0 -1
- package/dist/lib/db/log/logGlobalError.mjs.map +0 -1
- package/dist/lib/db/log/logGraphql.mjs.map +0 -1
- package/dist/lib/db/log/logThrow.mjs.map +0 -1
- package/dist/lib/db/login/ILoginSet.mjs.map +0 -1
- package/dist/lib/db/login/ILoginUnset.mjs.map +0 -1
- package/dist/lib/db/registerNewUser.mjs.map +0 -1
- package/dist/lib/db/userExist.mjs.map +0 -1
- package/dist/lib/emailHash.mjs.map +0 -1
- package/dist/lib/encryptPassword.mjs.map +0 -1
- package/dist/lib/hash.mjs.map +0 -1
- package/dist/lib/isSafeRedirectTarget.mjs.map +0 -1
- package/dist/lib/isSessionBlocked.mjs.map +0 -1
- package/dist/lib/isValidUuidV4.mjs.map +0 -1
- package/dist/lib/makeOnboardingData.mjs.map +0 -1
- package/dist/lib/setLoginCookies.mjs.map +0 -1
- package/dist/lib/sleepMs.mjs.map +0 -1
- package/dist/lib/throwIfNotValidEnumValue.mjs.map +0 -1
- package/dist/lib/tokenOptions.mjs.map +0 -1
- package/dist/lib/tokens.mjs.map +0 -1
- package/dist/lib/tryCatchRethrow.mjs.map +0 -1
- package/dist/private/files/_validateMimeType.mjs.map +0 -1
- package/dist/private/files/assertNoTraversal.mjs.map +0 -1
- package/dist/private/files/reEncode.mjs.map +0 -1
- package/dist/private/graphQL/Consts.mjs.map +0 -1
- package/dist/private/graphQL/models/MongoDB/private/UserAdminKoaUtils.mjs.map +0 -1
- package/dist/private/graphQL/schema/context/IContextLog.mjs.map +0 -1
- package/dist/private/graphQL/schema/context/IContextVerifyEmail.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/_buildLoginStatsUpdate.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/_finalizeLoginCheck.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/checkUserAdminLoginAuthorization.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/checkUserLoginAuthorization.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/infoUserAdminForLogin.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/infoUserForLogin.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/infoUserForLoginSQL.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/setLastLoginSQL.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/setRedisLoginSession.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/updateAdminLoginStats.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/updateLoginStats4ever.mjs.map +0 -1
- package/dist/private/graphQL/schema/mutations/updateLoginStatsRememberme.mjs.map +0 -1
- package/dist/private/lib/access/Constants.mjs.map +0 -1
- package/dist/private/lib/access/assertVerifyEmailAllowed.mjs.map +0 -1
- package/dist/private/lib/access/db/confirmNewEmail.mjs.map +0 -1
- package/dist/private/lib/access/db/deleteUserByEmail.mjs.map +0 -1
- package/dist/private/lib/access/db/enableEmailAccess.mjs.map +0 -1
- package/dist/private/lib/access/db/getResetPwd.mjs.map +0 -1
- package/dist/private/lib/access/db/incReqTimes.mjs.map +0 -1
- package/dist/private/lib/access/db/removeResetReq.mjs.map +0 -1
- package/dist/private/lib/access/db/saveResetReq.mjs.map +0 -1
- package/dist/private/lib/access/db/setEmailHash.mjs.map +0 -1
- package/dist/private/lib/access/db/updatePasswordDb.mjs.map +0 -1
- package/dist/private/lib/access/db/userData4VerifyEmail.mjs.map +0 -1
- package/dist/private/lib/access/handleBadDB.mjs.map +0 -1
- package/dist/private/lib/access/handleIfAccountDeleted.mjs.map +0 -1
- package/dist/private/lib/access/handleIfAccountDisabled.mjs.map +0 -1
- package/dist/private/lib/access/handleIfEmailAlreadyValid.mjs.map +0 -1
- package/dist/private/lib/access/handleIfHashBad.mjs.map +0 -1
- package/dist/private/lib/access/handleIfMoreThan3DaysPassed.mjs.map +0 -1
- package/dist/private/lib/access/handleIfTooMuchRequestsTimes.mjs.map +0 -1
- package/dist/private/lib/access/pathTools.mjs.map +0 -1
- package/dist/private/lib/makeBodyJson.mjs.map +0 -1
- package/dist/private/lib/verifyIntrospectionCode.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwAccessTokenExpiredOrDeleted.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwAccessTokenExpiredOrDeleted.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,EAAE;IACpD,MAAM,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,8CAA8C,CAAC,CAAA;AAC9F,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwAccessTokenExpiredOrDeleted = () => {\n\tthrow throwGraphQLError(498, 'Invalid Token', 'Access Token is expired or deleted by Admin.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwAccessTokenRequired.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwAccessTokenRequired.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC5C,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,wBAAwB,CAAC,CAAA;AACzE,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwAccessTokenRequired = () => {\n\tthrow throwGraphQLError(499, 'Token Required', 'Access Token Required.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwAlreadyDone.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwAlreadyDone.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACpC,MAAM,iBAAiB,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AACrC,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\n/**\n * this status code do not allow body content\n */\nexport const throwAlreadyDone = () => {\n\tthrow throwGraphQLError(204, '', '')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwAlreadyTakenError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwAlreadyTakenError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAe,6BAA6B,EAAE,EAAE;IACtF,2DAA2D;IAC3D,MAAM,iBAAiB,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;AAC/C,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwAlreadyTakenError = (desc: string = 'You have already done this.') => {\n\t// e.g. sending an email to someone who already received it\n\tthrow throwGraphQLError(409, 'Conflict', desc)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwConflictError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwConflictError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qCAAyC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,6BAA6B,EAAE,EAAE;IAClF,+DAA+D;IAC/D,MAAM,sBAAsB,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC,CAAA","sourcesContent":["import { throwAlreadyTakenError } from '@throw/throwAlreadyTakenError.mjs'\n\nexport const throwConflictError = (desc: string = 'You have already done this.') => {\n\t// e.g. sending an email to someone who has already received it\n\tthrow throwAlreadyTakenError(desc)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwErrorWrongUserInput.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwErrorWrongUserInput.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAE,EAAE;IAC3D,MAAM,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,CAAA;AACrD,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwErrorWrongUserInput = (message: string) => {\n\tthrow throwGraphQLError(400, 'Bad Request', message)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwForbiddenError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwForbiddenError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACvC,MAAM,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AACxD,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwForbiddenError = () => {\n\tthrow throwGraphQLError(403, 'Forbidden', 'Forbidden.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwGoneError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwGoneError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAe,iBAAiB,EAAE,EAAE;IAClE,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC7C,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwGoneError = (desc: string = ERR_MISCONFIGURED) => {\n\tthrow throwGraphQLError(410, ERR_OOPS, desc)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwGraphQLError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwGraphQLError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,cAAsB,EAAE,EAAE,EAAE;IAC5F,MAAM,IAAI,YAAY,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,CAAC,CAAA;AACjF,CAAC,CAAA","sourcesContent":["import { GraphQLError } from 'graphql'\n\nexport const throwGraphQLError = (status: number, title: string, description: string = '') => {\n\tthrow new GraphQLError(title, { extensions: { http: { status }, description } })\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwInternalError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwInternalError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE,EAAE;IACvD,MAAM,iBAAiB,CAAC,GAAG,EAAE,uBAAuB,EAAE,8BAA8B,IAAI,EAAE,CAAC,CAAA;AAC5F,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwInternalError = (desc: string = '') => {\n\tthrow throwGraphQLError(500, 'Internal Server Error', `Error reported to Dev Team.${desc}`)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwMethodNotAllowedError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwMethodNotAllowedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC9C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwMethodNotAllowedError = () => {\n\tthrow throwGraphQLError(405, ERR_OOPS, ERR_MISCONFIGURED)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwMissingMalformedInvalidToken.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwMissingMalformedInvalidToken.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACrD,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,kCAAkC,CAAC,CAAA;AACnF,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwMissingMalformedInvalidToken = () => {\n\tthrow throwGraphQLError(499, 'Token Required', 'Missing/malformed/invalid token.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwNotAcceptableError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwNotAcceptableError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC3C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwNotAcceptableError = () => {\n\tthrow throwGraphQLError(406, ERR_OOPS, ERR_MISCONFIGURED)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwNotFoundError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwNotFoundError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,iBAAiB,EAAE,EAAE;IACtE,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC7C,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwNotFoundError = (desc: string = ERR_MISCONFIGURED) => {\n\tthrow throwGraphQLError(404, ERR_OOPS, desc)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwNotImplementedError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwNotImplementedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC5C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwNotImplementedError = () => {\n\tthrow throwGraphQLError(501, ERR_OOPS, ERR_MISCONFIGURED)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwPaymentRequiredError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwPaymentRequiredError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC7C,MAAM,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,EAAE,mDAAmD,CAAC,CAAA;AACtG,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwPaymentRequiredError = () => {\n\tthrow throwGraphQLError(402, 'Payment Required', 'You must have a subscription to use this feature.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwPreconditionFailedNoAuthCookie.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwPreconditionFailedNoAuthCookie.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,EAAE;IACvD,MAAM,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,EAAE,0BAA0B,CAAC,CAAA;AAChF,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from './throwGraphQLError.mjs'\n\nexport const throwPreconditionFailedNoAuthCookie = () => {\n\tthrow throwGraphQLError(412, 'Precondition Failed', 'No authorization cookie.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwPreconditionFailedNoAuthHeader.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwPreconditionFailedNoAuthHeader.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,EAAE;IACvD,MAAM,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,EAAE,0BAA0B,CAAC,CAAA;AAChF,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from './throwGraphQLError.mjs'\n\nexport const throwPreconditionFailedNoAuthHeader = () => {\n\tthrow throwGraphQLError(412, 'Precondition Failed', 'No authorization header.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwRefreshTokenExpiredOrDeleted.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwRefreshTokenExpiredOrDeleted.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACrD,MAAM,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,+CAA+C,CAAC,CAAA;AAC/F,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwRefreshTokenExpiredOrDeleted = () => {\n\tthrow throwGraphQLError(498, 'Invalid Token', 'Refresh Token is expired or deleted by Admin.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwRefreshTokenRequired.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwRefreshTokenRequired.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC7C,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,yBAAyB,CAAC,CAAA;AAC1E,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwRefreshTokenRequired = () => {\n\tthrow throwGraphQLError(499, 'Token Required', 'Refresh Token Required.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwRefreshTokenSignatureRequired.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwRefreshTokenSignatureRequired.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAAG,EAAE;IACtD,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,mCAAmC,CAAC,CAAA;AACpF,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwRefreshTokenSignatureRequired = () => {\n\tthrow throwGraphQLError(499, 'Token Required', 'Refresh Token Signature Required.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwTooManyRequestsError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwTooManyRequestsError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAe,EAAE,EAAE,EAAE;IAC9D,MAAM,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAA;AACxD,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwTooManyRequestsError = (desc: string = '') => {\n\tthrow throwGraphQLError(429, 'Too Many Requests', desc)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwUnauthorizedError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwUnauthorizedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAe,uBAAuB,EAAE,EAAE;IAChF,MAAM,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,CAAA;AACnD,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwUnauthorizedError = (text: string = 'You are unauthorized.') => {\n\tthrow throwGraphQLError(401, 'Unauthorized', text)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwUnprocessableContentError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwUnprocessableContentError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC7C,MAAc,qEAAqE,EAClF,EAAE;IACH,MAAM,iBAAiB,CAAC,GAAG,EAAE,uBAAuB,EAAE,GAAG,CAAC,CAAA;AAC3D,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwUnprocessableContentError = (\n\ttxt: string = 'We are unable to process the instructions contained in the request.'\n) => {\n\tthrow throwGraphQLError(422, 'Unprocessable Content', txt)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwUnsupportedMediaTypeError.mjs","sourceRoot":"","sources":["../../../src/graphQL/throw/throwUnsupportedMediaTypeError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE;IAClD,MAAM,iBAAiB,CAAC,GAAG,EAAE,wBAAwB,EAAE,uEAAuE,CAAC,CAAA;AAChI,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwUnsupportedMediaTypeError = () => {\n\tthrow throwGraphQLError(415, 'Unsupported Media Type', 'The chosen media type is not supported. Please change the media type.')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IFileUpload.mjs","sourceRoot":"","sources":["../../src/koa/IFileUpload.mts"],"names":[],"mappings":"","sourcesContent":["export interface IFileUpload {\n\tcreateReadStream: () => NodeJS.ReadableStream\n\tfilename: string\n\tmimetype: string\n\tencoding: string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IKoaError.mjs","sourceRoot":"","sources":["../../src/koa/IKoaError.mts"],"names":[],"mappings":"","sourcesContent":["export interface IKoaError {\n\textensions?: {\n\t\thttp?: {\n\t\t\tstatus: number\n\t\t}\n\t\tdescription: string\n\t}\n\tstatus?: number\n\tbody: {\n\t\tdescription: string\n\t}\n\tmessage: string\n\tpath: string\n\tstack: string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customFormatErrorFn.mjs","sourceRoot":"","sources":["../../src/koa/customFormatErrorFn.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAyB,EAAE,EAAE;IAChE,IAAI,GAAG,YAAY,YAAY,EAAE,CAAC;QACjC,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE;YACnC,UAAU,EAAE,GAAG,CAAC,UAAU;SAC1B,CAAC,CAAA;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC,CAAA","sourcesContent":["import { GraphQLError } from 'graphql'\n\nexport const customFormatErrorFn = (err: GraphQLError | Error) => {\n\tif (err instanceof GraphQLError) {\n\t\tthrow new GraphQLError(err.message, {\n\t\t\textensions: err.extensions\n\t\t})\n\t}\n\n\treturn err\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logRequestToDb.mjs","sourceRoot":"","sources":["../../src/koa/logRequestToDb.mts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAgB,EAAE,IAAU;IAChE,MAAM,IAAI,EAAE,CAAA;IAEZ,iDAAiD;AAClD,CAAC","sourcesContent":["import { IContextLog } from '@private/graphQL/schema/context/IContextLog.mjs'\nimport { Next } from 'koa'\n\nexport async function logRequestToDb(ctx: IContextLog, next: Next) {\n\tawait next()\n\n\t// logGraphql(user, operationName, status, msTot)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TCookieRefreshToken.mjs","sourceRoot":"","sources":["../../../../src/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.mts"],"names":[],"mappings":"","sourcesContent":["export type TCookieRefreshToken = {\n\trefresh_token?: string\n\t'refresh_token.sig'?: string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/koa/middleware/authenticatedAuthorizationHandler/index.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,gBAAgB,EAAE,0CAAiC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,yDAAgD;AAClF,OAAO,EAAE,mBAAmB,EAAE,uDAAsC;AACpE,OAAO,EAAE,iCAAiC,EAAE,qEAAoD;AAChG,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAGhC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AAEzE,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,KAAK,EAAE,GAAoB,EAAE,IAAU,EAAE,EAAE;IAC9G;;;OAGG;IAEH,8CAA8C;IAC9C,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC7D,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,iBAAiB,EAAE,CAAC,CAAA;IAC5F,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,EAAE,GAAG,UAAU,EAAE,CAAA,CAAC,mGAAmG;QAErI,6EAA6E;QAC7E,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,MAAM,mBAAmB,EAAE,CAAA;QAC5B,CAAC;QACD,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG;YAChB,GAAG,OAAO;YACV,EAAE,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,YAAY,EAAE,iBAAiB;SAC/B,CAAA;IACF,CAAC;SAAM,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC;QAClF,MAAM,iCAAiC,EAAE,CAAA;IAC1C,CAAC,CAAC,qBAAqB;IAEvB,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { redisClient } from '@dataSources/Redis.mjs'\nimport { isSessionBlocked } from '@lib/isSessionBlocked.mjs'\nimport { verifyIntrospectionCode } from '@private/lib/verifyIntrospectionCode.mjs'\nimport { throwForbiddenError } from '@throw/throwForbiddenError.mjs'\nimport { throwRefreshTokenExpiredOrDeleted } from '@throw/throwRefreshTokenExpiredOrDeleted.mjs'\nimport * as dotenv from 'dotenv'\nimport Keygrip from 'keygrip'\nimport { Next } from 'koa'\nimport { Types } from 'mongoose'\n\nimport { verifySignedRefreshToken } from './verifySignedRefreshToken.mjs'\n\ndotenv.config()\n\nexport const authenticatedAuthorizationHandler = (keys: Keygrip) => async (ctx: IContextRefresh, next: Next) => {\n\t/***************************\n\t * CLIENT:\n\t * - sends opaque token as cookie\n\t */\n\n\t// does the key exist in redis? ok, read redis\n\tconst refreshTokenRedis = verifySignedRefreshToken(ctx, keys)\n\tconst redSession = await redisClient.hGetAll(`${process.env.REDIS_KEY}${refreshTokenRedis}`)\n\tif (Object.keys(redSession).length !== 0) {\n\t\tconst redData = { ...redSession } // For safety, Redis return an object without the default Object.prototype in its prototype chain.\n\n\t\t// is the user reported as blocked within the session? (see isSessionBlocked)\n\t\tif (isSessionBlocked(redData)) {\n\t\t\tthrow throwForbiddenError()\n\t\t}\n\t\tctx.state.user = {\n\t\t\t...redData,\n\t\t\tid: new Types.ObjectId(redData.id),\n\t\t\trefreshToken: refreshTokenRedis\n\t\t}\n\t} else if (!verifyIntrospectionCode(ctx.request.header?.['x-introspectioncode'])) {\n\t\tthrow throwRefreshTokenExpiredOrDeleted()\n\t} // else return next()\n\n\treturn next()\n}\n"]}
|
package/dist/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verifySignedRefreshToken.mjs","sourceRoot":"","sources":["../../../../src/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;AACpG,OAAO,EAAE,yBAAyB,EAAE,6DAA4C;AAChF,OAAO,EAAE,kCAAkC,EAAE,sEAAqD;AAClG,OAAO,EAAE,sBAAsB,EAAE,0DAAyC;AAK1E,MAAM,UAAU,wBAAwB,CAAC,GAAoB,EAAE,IAAa;IAC3E,oGAAoG;IAEpG,MAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAA;IAE/C,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,mCAAmC,EAAE,CAAA;IAC5C,CAAC;IAED,MAAM,OAAO,GAAwB,EAAE,CAAA;IACvC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC1C,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC7C,qCAAqC;QACrC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACrB,CAAC,CAAC,CAAA;IACF;;OAEG;IACH,MAAM,YAAY,GAAG,OAAO,EAAE,aAAa,CAAA;IAC3C,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,MAAM,yBAAyB,EAAE,CAAA;IAClC,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,EAAE,CAAC,mBAAmB,CAAC,CAAA;IAChD,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,kCAAkC,EAAE,CAAA;IAC3C,CAAC;IAED,mBAAmB;IACnB,gCAAgC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,YAAY,EAAE,EAAE,SAAS,CAAC,CAAA;IAEpE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QAClB,oBAAoB;QACpB,MAAM,sBAAsB,CAAC,kCAAkC,CAAC,CAAA;IACjE,CAAC;IAED,OAAO,WAAW,YAAY,EAAE,CAAA;AACjC,CAAC","sourcesContent":["import { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { throwPreconditionFailedNoAuthCookie } from '@throw/throwPreconditionFailedNoAuthCookie.mjs'\nimport { throwRefreshTokenRequired } from '@throw/throwRefreshTokenRequired.mjs'\nimport { throwRefreshTokenSignatureRequired } from '@throw/throwRefreshTokenSignatureRequired.mjs'\nimport { throwUnauthorizedError } from '@throw/throwUnauthorizedError.mjs'\nimport Keygrip from 'keygrip'\n\nimport { TCookieRefreshToken } from './TCookieRefreshToken.mjs'\n\nexport function verifySignedRefreshToken(ctx: IContextRefresh, keys: Keygrip): string {\n\t// @todo must check the cookie or the header or both, and what to do if one of the two is missing ??\n\n\tconst cookieHeader = ctx.request.header?.cookie\n\n\tif (cookieHeader === undefined) {\n\t\tthrow throwPreconditionFailedNoAuthCookie()\n\t}\n\n\tconst cookies: TCookieRefreshToken = {}\n\tcookieHeader.split(';').forEach((cookie) => {\n\t\tconst [key, value] = cookie.trim().split('=')\n\t\t// @ts-expect-error ignore wrong keys\n\t\tcookies[key] = value\n\t})\n\t/**\n\t * 'refresh_token=27119032-9043-4a9f-bd4c-9d06fd576290; refresh_token.sig=P1gZO6-49xVEMkiMqkOjJ2Cxaf3mQb18GaflDsjibuv4fFWYIOzcW26didnVJ1aridyY40CFzDtufzI6zI8jkQ'\n\t */\n\tconst refreshToken = cookies?.refresh_token\n\tif (!refreshToken) {\n\t\tthrow throwRefreshTokenRequired()\n\t}\n\tconst signature = cookies?.['refresh_token.sig']\n\tif (!signature) {\n\t\tthrow throwRefreshTokenSignatureRequired()\n\t}\n\n\t// Verify signature\n\t// Verify signature with Keygrip\n\tconst index = keys.index(`refresh_token=${refreshToken}`, signature)\n\n\tif (index === -1) {\n\t\t// Signature invalid\n\t\tthrow throwUnauthorizedError('Invalid Refresh Cookie signature')\n\t}\n\n\treturn `refresh:${refreshToken}`\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/koa/middleware/authenticatedLogoutHandler/index.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,uBAAuB,E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/IContextLogout.mjs'\nimport { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { redisClient } from '@dataSources/Redis.mjs'\nimport { isValidUuidV4 } from '@lib/isValidUuidV4.mjs'\nimport { verifyIntrospectionCode } from '@private/lib/verifyIntrospectionCode.mjs'\nimport { throwAlreadyDone } from '@throw/throwAlreadyDone.mjs'\nimport { throwPreconditionFailedNoAuthCookie } from '@throw/throwPreconditionFailedNoAuthCookie.mjs'\nimport { throwPreconditionFailedNoAuthHeader } from '@throw/throwPreconditionFailedNoAuthHeader.mjs'\nimport * as dotenv from 'dotenv'\nimport Keygrip from 'keygrip'\nimport { Next } from 'koa'\n\nimport { verifySignedRefreshToken } from '../authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs'\n\ndotenv.config()\n\nconst requireIntrospectionOrThrow = (header: IContextLogout['request']['header'], throwOnFail: () => never): true => {\n\tif (typeof header !== 'undefined' && verifyIntrospectionCode(header['x-introspectioncode'])) {\n\t\treturn true\n\t}\n\tthrow throwOnFail()\n}\n\nconst extractBearerAccessToken = (authorization: string | undefined): string =>\n\tauthorization?.startsWith('Bearer access:') && isValidUuidV4(authorization.slice('Bearer access:'.length))\n\t\t? authorization.replace('Bearer ', '')\n\t\t: ''\n\nexport const authenticatedLogoutHandler = (keys: Keygrip) => async (ctx: IContextLogout, next: Next) => {\n\t/***************************\n\t * CLIENT:\n\t * - in authorization: ctx.request.header.authorization = Bearer ACCESS_TOKEN_HERE\n\t * - in cookie: ctx.request.header.cookie = refresh_cookie=TOKEN_HERE\n\t */\n\tlet introspection = false\n\n\t// refresh\n\tconst cookie = ctx.request.header?.cookie // refresh\n\tif (typeof cookie === 'undefined') {\n\t\tintrospection = requireIntrospectionOrThrow(ctx.request.header, throwPreconditionFailedNoAuthCookie)\n\t}\n\n\tconst authorization = ctx.request.header?.authorization // access\n\tif (typeof authorization === 'undefined') {\n\t\tintrospection = requireIntrospectionOrThrow(ctx.request.header, throwPreconditionFailedNoAuthHeader)\n\t}\n\n\tif (!introspection) {\n\t\tconst refreshToken = verifySignedRefreshToken(ctx as unknown as IContextRefresh, keys)\n\t\tconst redRefreshSession = await redisClient.hGet(`${process.env.REDIS_KEY}${refreshToken}`, 'id')\n\t\tif (redRefreshSession != null) {\n\t\t\tctx.state = {\n\t\t\t\tuser: {\n\t\t\t\t\trefreshToken: refreshToken\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow throwAlreadyDone()\n\t\t}\n\n\t\t// Access Token, optional\n\t\t// The 'Bearer access:' prefix must be checked before building the Redis key:\n\t\t// without this check the client controls the entire key and could reach refresh: entries.\n\t\t// The suffix is checked too: the prefix alone still leaves the rest of the key client-controlled.\n\t\t// Tokens with the wrong prefix, or a suffix that is not a v4 uuid, are ignored rather than\n\t\t// rejected: the access token remains optional here.\n\t\tconst accessToken = extractBearerAccessToken(authorization)\n\t\tif (accessToken !== '') {\n\t\t\tconst redAccessSession = await redisClient.hGet(`${process.env.REDIS_KEY}${accessToken}`, 'id') // 'access:' already present\n\t\t\tif (redAccessSession != null) {\n\t\t\t\tctx.state.user.accessToken = accessToken\n\t\t\t} // else no problem, session could be expired\n\t\t}\n\t} // else introspection\n\treturn next()\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/koa/middleware/authenticatedResourceHandler/index.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,gBAAgB,EAAE,0CAAiC;AAC5D,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,uBAAuB,EAAE,yDAAgD;AAClF,OAAO,EAAE,gCAAgC,EAAE,oEAAmD;AAC9F,OAAO,EAAE,wBAAwB,EAAE,4DAA2C;AAC9E,OAAO,EAAE,mBAAmB,EAAE,uDAAsC;AACpE,OAAO,EAAE,iCAAiC,EAAE,qEAAoD;AAChG,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;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K,CAAC,IAAI,GAAG;YAChB,GAAG,OAAO;YACV,EAAE,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,qBAAqB;SACxD,CAAA;IACF,CAAC;SAAM,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC;QAClF,MAAM,gCAAgC,EAAE,CAAA;IACzC,CAAC,CAAC,mBAAmB;IAErB,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { IContextAuthenticatedResource } from '@context/IContextAuthenticatedResource.mjs'\nimport { redisClient } from '@dataSources/Redis.mjs'\nimport { isSessionBlocked } from '@lib/isSessionBlocked.mjs'\nimport { isValidUuidV4 } from '@lib/isValidUuidV4.mjs'\nimport { verifyIntrospectionCode } from '@private/lib/verifyIntrospectionCode.mjs'\nimport { throwAccessTokenExpiredOrDeleted } from '@throw/throwAccessTokenExpiredOrDeleted.mjs'\nimport { throwAccessTokenRequired } from '@throw/throwAccessTokenRequired.mjs'\nimport { throwForbiddenError } from '@throw/throwForbiddenError.mjs'\nimport { throwMissingMalformedInvalidToken } from '@throw/throwMissingMalformedInvalidToken.mjs'\nimport { throwPreconditionFailedNoAuthHeader } from '@throw/throwPreconditionFailedNoAuthHeader.mjs'\nimport * as dotenv from 'dotenv'\nimport { Next } from 'koa'\nimport { Types } from 'mongoose'\n\ndotenv.config()\n\n/**\n * Find out access token in Bearer header\n */\nexport const authenticatedResourceHandler = () => async (ctx: IContextAuthenticatedResource, next: Next) => {\n\t/***************************\n\t * CLIENT:\n\t * - in authorization: ctx.request.header.authorization = 'Bearer ACCESS_TOKEN\n\t */\n\n\tconst authorization = ctx.request.header?.authorization\n\n\t// more detailed errors code instead of generic 401 unauthorized (tampering)\n\tif (authorization === undefined) {\n\t\tthrow throwPreconditionFailedNoAuthHeader()\n\t}\n\tif (!authorization.startsWith('Bearer access:')) {\n\t\tthrow throwAccessTokenRequired()\n\t}\n\n\tconst key = authorization.replace('Bearer ', '')\n\n\t// the prefix check above leaves the rest of the key client-controlled: the suffix must be a\n\t// real v4 uuid — the only shape generateAccessToken produces — before it reaches Redis\n\tif (!isValidUuidV4(key.slice('access:'.length))) {\n\t\tthrow throwMissingMalformedInvalidToken()\n\t}\n\n\t// does the key access:xxx exist in Redis ? read Redis...\n\tconst redSession = await redisClient.hGetAll(\n\t\t`${process.env.REDIS_KEY}${key}` // 'access:' present inside key\n\t)\n\tif (Object.keys(redSession).length !== 0) {\n\t\tconst redData = { ...redSession } // For safety, Redis return an object without the default Object.prototype in its prototype chain.\n\t\t// is the user reported as blocked within the session ? (see isSessionBlocked)\n\t\tif (isSessionBlocked(redData)) {\n\t\t\tthrow throwForbiddenError()\n\t\t}\n\n\t\tctx.state.user = {\n\t\t\t...redData,\n\t\t\tid: new Types.ObjectId(redData.id) // fix id as ObjectId\n\t\t}\n\t} else if (!verifyIntrospectionCode(ctx.request.header?.['x-introspectioncode'])) {\n\t\tthrow throwAccessTokenExpiredOrDeleted()\n\t} // else return next\n\n\treturn next()\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/koa/middleware/debug/index.mts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,GAAoB,EAAE,IAAU,EAAE,EAAE;IAC5E,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { Next } from 'koa'\n\nexport const debugHandler = () => async (ctx: IContextRefresh, next: Next) => {\n\treturn next()\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verifyEmail.mjs","sourceRoot":"","sources":["../../../src/koa/router/verifyEmail.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EA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esContent":["import { isSafeRedirectTarget } from '@lib/isSafeRedirectTarget.mjs'\nimport { IContextVerifyEmail } from '@private/graphQL/schema/context/IContextVerifyEmail.mjs'\nimport { assertVerifyEmailAllowed, TAssertVerifyEmailAllowed } from '@private/lib/access/assertVerifyEmailAllowed.mjs'\nimport { enableEmailAccess, TEnableEmailAccess } from '@private/lib/access/db/enableEmailAccess.mjs'\nimport { TUserData4VerifyEmail, userData4VerifyEmail } from '@private/lib/access/db/userData4VerifyEmail.mjs'\n\n/** Reader, guard chain and writer the handler needs, all bound to the same model + paths by the caller. */\nexport interface IVerifyEmailRouterDeps {\n\tuserData4VerifyEmail: TUserData4VerifyEmail\n\tassertVerifyEmailAllowed: TAssertVerifyEmailAllowed\n\tenableEmailAccess: TEnableEmailAccess\n}\n\n/**\n * Koa handler for the email-activation link.\n *\n * Taking the collaborators as arguments is what makes the handler testable at all: the DB read used to\n * be an ESM live binding that the tsx loader refuses to let sinon replace, so the whole try-body was\n * dead code in the suite and sat under a `c8 ignore`. It is now injected, the ignore is gone, and every\n * path is exercised directly.\n */\nexport const createVerifyEmailRouter = (deps: IVerifyEmailRouterDeps) => () => async (ctx: IContextVerifyEmail) => {\n\tconst { email, hash } = ctx.params\n\n\tconst uEmail = email.toLowerCase()\n\n\ttry {\n\t\t// search if the email exists\n\t\tconst user = await deps.userData4VerifyEmail(uEmail)\n\n\t\t// Every access guard lives in assertVerifyEmailAllowed, which is unit-tested.\n\t\tconst uId = await deps.assertVerifyEmailAllowed(user, email, hash)\n\n\t\t// ok enable email — only ever reached once every guard above has passed\n\t\tawait deps.enableEmailAccess(uId, email)\n\t\tctx.redirect('/x/registration-done') // url without prefix\n\t\t// ctx.redirect('https://google.it') // external url\n\t} catch (err: unknown) {\n\t\tconst link = (err as Error).message as string\n\t\tif (isSafeRedirectTarget(link)) {\n\t\t\tctx.redirect(link)\n\t\t} else {\n\t\t\tctx.redirect('/x/error')\n\t\t}\n\t}\n}\n\n/** Shape of the bound router, for the modules that take it as a dependency. */\nexport type TVerifyEmailRouter = ReturnType<typeof createVerifyEmailRouter>\n\n/** `UserBase`-bound default — the router every existing consumer already imports. */\nexport const routerVerifyEmail: TVerifyEmailRouter = createVerifyEmailRouter({\n\tuserData4VerifyEmail,\n\tassertVerifyEmailAllowed,\n\tenableEmailAccess\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tdwKoaErrorHandler.mjs","sourceRoot":"","sources":["../../src/koa/tdwKoaErrorHandler.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAKtC,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,eAAe;AACf,SAAS,kBAAkB,CAAC,MAAiB,EAAE,cAAuB;IACrE,IAAI,cAAc,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,CAAA;IAC9C,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,IAAI,GAAG,CAAA;AAC5B,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CACtB,MAAiB,EACjB,cAAuB,EACvB,MAAc;IAEd,MAAM,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAElE,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,OAAO,SAAS,CAAA;IACjB,CAAC;IAED,MAAM,IAAI,GAAoC;QAC7C,OAAO,EAAE,MAAM,CAAC,OAAO;KACvB,CAAA;IACD,IAAI,cAAc,EAAE,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,WAAW,IAAI,EAAE,CAAA;IACxD,CAAC;IACD,OAAO,IAAI,CAAA;AACZ,CAAC;AAED,oBAAoB;AACpB,SAAS,uBAAuB,CAAC,MAAiB,EAAE,cAAuB;IAC1E,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC5C,IAAI,CAAC,cAAc,EAAE,CAAC;YACrB,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAChC,CAAC;IACF,CAAC;AACF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAA4B,EAAE,IAAU;IAChF,IAAI,CAAC;QACJ,MAAM,IAAI,EAAE,CAAA;IACb,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,GAAgB,CAAA;QAC/B,MAAM,cAAc,GAAG,GAAG,YAAY,YAAY,CAAA;QAElD,GAAG,CAAC,MAAM,GAAG,kBAAkB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;QAEvD,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;QAC/D,IAAI,IAAI,EAAE,CAAC;YACV,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,CAAC;QAED,uBAAuB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;QAE/C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,CAAC;AACF,CAAC","sourcesContent":["import { IContextKoaErrorHandler } from '@context/IContextKoaErrorHandler.mjs'\nimport * as Sentry from '@sentry/node'\nimport * as dotenv from 'dotenv'\nimport { GraphQLError } from 'graphql'\nimport { Next } from 'koa'\n\nimport { IKoaError } from './IKoaError.mjs'\n\ndotenv.config()\n\n// check status\nfunction resolveErrorStatus(errKoa: IKoaError, isIstanceOfGQL: boolean): number {\n\tif (isIstanceOfGQL) {\n\t\treturn errKoa.extensions?.http?.status || 500\n\t}\n\treturn errKoa.status || 500\n}\n\n/**\n * do not set body for status codes that do not allow it\n */\nfunction buildErrorBody(\n\terrKoa: IKoaError,\n\tisIstanceOfGQL: boolean,\n\tstatus: number\n): IContextKoaErrorHandler['body'] | undefined {\n\tconst allowBody = ![100, 101, 102, 204, 205, 304].includes(status)\n\n\tif (!allowBody) {\n\t\treturn undefined\n\t}\n\n\tconst body: IContextKoaErrorHandler['body'] = {\n\t\tmessage: errKoa.message\n\t}\n\tif (isIstanceOfGQL) {\n\t\tbody.description = errKoa.extensions?.description || ''\n\t}\n\treturn body\n}\n\n// more debug data ?\nfunction maybeCaptureSentryError(errKoa: IKoaError, isIstanceOfGQL: boolean): void {\n\tif (process.env.NODE_ENV === 'development') {\n\t\tif (!isIstanceOfGQL) {\n\t\t\tSentry.captureException(errKoa)\n\t\t}\n\t}\n}\n\nexport async function tdwKoaErrorHandler(ctx: IContextKoaErrorHandler, next: Next) {\n\ttry {\n\t\tawait next()\n\t} catch (err: unknown) {\n\t\tconst errKoa = err as IKoaError\n\t\tconst isIstanceOfGQL = err instanceof GraphQLError\n\n\t\tctx.status = resolveErrorStatus(errKoa, isIstanceOfGQL)\n\n\t\tconst body = buildErrorBody(errKoa, isIstanceOfGQL, ctx.status)\n\t\tif (body) {\n\t\t\tctx.body = body\n\t\t}\n\n\t\tmaybeCaptureSentryError(errKoa, isIstanceOfGQL)\n\n\t\tctx.app.emit('error', errKoa, ctx)\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayLib.mjs","sourceRoot":"","sources":["../../src/lib/ArrayLib.mts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;IACpB,gBAAe,CAAC;IAEhB,OAAO,CAAC,IAAc,EAAE,IAAc;QACrC,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;QAC/D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAEnC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACjD,CAAC;CACD,CAAC,oBAAoB","sourcesContent":["export class ArrayLib {\n\tconstructor() {}\n\n\tarrDiff(arr1: string[], arr2: string[]) {\n\t\tconst arrays = [arr1, arr2].sort((a, b) => a.length - b.length)\n\t\tconst smallSet = new Set(arrays[0])\n\n\t\treturn arrays[1].filter((x) => !smallSet.has(x))\n\t}\n} /* c8 ignore next */\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.mjs","sourceRoot":"","sources":["../../src/lib/Constants.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAA;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AAChE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA","sourcesContent":["import { Types } from 'mongoose'\n\nexport const OBJECTID_0_STR = '000000000000000000000000'\nexport const OBJECTID_0_OBJ = new Types.ObjectId(OBJECTID_0_STR)\nexport const EMAIL_MAX_LEN = 255\n\nexport const MIN_PWD_LENGTH = 10\nexport const MAX_PWD_LENGTH = 72\n\nexport const EMAIL_HASH_LEN = 50\n"]}
|
package/dist/lib/DateLib.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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AE,CAAC,OAAO,EAAE,CAAA;QAC5B,8CAA8C;QAE9C,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IACzC,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,OAAe,EAAE,GAAW;QAC9C,MAAM,UAAU,GAAG,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAA;QAChE,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAA;IAC5C,CAAC;CACD,CAAA,CAAC,oBAAoB","sourcesContent":["export const DateLib = class DateLib {\n\tconstructor() {}\n\n\tstatic getDate(dateNum: Date) {\n\t\tconst dateStr = dateNum.toString()\n\t\tconst year = parseInt(dateStr.substring(0, 4))\n\t\tconst month = parseInt(dateStr.substring(4, 6))\n\t\tconst day = parseInt(dateStr.substring(6, 8))\n\t\tconst hours = parseInt(dateStr.substring(8, 10))\n\t\tconst min = parseInt(dateStr.substring(10, 12))\n\t\tconst sec = parseInt(dateStr.substring(12, 14))\n\n\t\tconst date = new Date(Date.UTC(year, month - 1, day, hours, min, sec))\n\n\t\treturn {\n\t\t\tyear,\n\t\t\tdate\n\t\t}\n\t}\n\n\tstatic minElapsed(dt: Date): number {\n\t\t// read elapsed minutes\n\t\tconst nowDt = new Date()\n\t\tconst now = nowDt.getTime()\n\n\t\tconst lastReq = dt.getTime()\n\t\t// const lastReq = new Date('' + dt).getTime()\n\n\t\treturn DateLib.timeDiffMin(lastReq, now)\n\t}\n\n\tstatic timeDiffMin(lastReq: number, now: number): number {\n\t\tconst difference = lastReq > now ? lastReq - now : now - lastReq\n\t\treturn Math.floor(difference / (1000 * 60))\n\t}\n} /* c8 ignore next */\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAuthorizationDisDel.mjs","sourceRoot":"","sources":["../../src/lib/IAuthorizationDisDel.mts"],"names":[],"mappings":"","sourcesContent":["export interface IAuthorizationDisDel {\n\tdisabled?: boolean\n\tdeleted?: Date\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ICookies.mjs","sourceRoot":"","sources":["../../src/lib/ICookies.mts"],"names":[],"mappings":"","sourcesContent":["export type ICookies = {\n\tset(key: 'access_token' | 'refresh_token', value: string, options: Options): void\n\tget(key: 'access_token' | 'refresh_token'): string | undefined\n}\ntype Options = {\n\thttpOnly?: boolean\n\tsameSite?: string\n\tsecure?: boolean\n\tpath?: string\n\texpirationDate?: number\n\tmaxAge?: number\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IMariaDBErr.mjs","sourceRoot":"","sources":["../../../src/lib/MariaDB/IMariaDBErr.mts"],"names":[],"mappings":"","sourcesContent":["export interface IMariaDbErr {\n\tparent?: {\n\t\tsqlMessage?: string\n\t\tcode: string\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MariaDBErrType.mjs","sourceRoot":"","sources":["../../../src/lib/MariaDB/MariaDBErrType.mts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACzB,uDAAqC,CAAA;AACtC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB","sourcesContent":["// https://mariadb.com/kb/en/mariadb-error-code-reference/\nexport enum MariaDBErrType {\n\tER_DATA_TOO_LONG = 'ER_DATA_TOO_LONG'\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwSqlErrors.mjs","sourceRoot":"","sources":["../../../src/lib/MariaDB/throwSqlErrors.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,yDAA2C;AAC9E,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,UAAU,cAAc,CAAC,CAAc;IAC5C,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QAC1F,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;QAEtD,6DAA6D;QAC7D,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACxC,8GAA8G;QAC9G,MAAM,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,CAAC,CAAC,CAAA;QAC9D,2FAA2F;QAC3F,MAAM,YAAY,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,gBAAgB,GAAG,CAAC,CAAC,CAAA;QAE3D,MAAM,wBAAwB,CAAC,YAAY,CAAC,CAAA;IAC7C,CAAC;SAAM,CAAC;QACP,yBAAyB;QACzB,MAAM,kBAAkB,EAAE,CAAA;IAC3B,CAAC;AACF,CAAC","sourcesContent":["import { IMariaDbErr } from '@lib/MariaDB/IMariaDBErr.mjs'\nimport { throwErrorWrongUserInput } from '@throw/throwErrorWrongUserInput.mjs'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\n\nimport { MariaDBErrType } from './MariaDBErrType.mjs'\n\nexport function throwSqlErrors(e: IMariaDbErr) {\n\tif (e.parent && e.parent.sqlMessage && e.parent.code === MariaDBErrType.ER_DATA_TOO_LONG) {\n\t\tconst err = e.parent.sqlMessage.replace(' column', '')\n\n\t\t// Find the index of the first occurrence of the single quote\n\t\tconst firstQuoteIndex = err.indexOf(\"'\")\n\t\t// Find the index of the second occurrence of the single quote, starting the search just after the first quote\n\t\tconst secondQuoteIndex = err.indexOf(\"'\", firstQuoteIndex + 1)\n\t\t// Extract the substring from the start of the string to just after the second single quote\n\t\tconst errorMessage = err.substring(0, secondQuoteIndex + 1)\n\n\t\tthrow throwErrorWrongUserInput(errorMessage)\n\t} else {\n\t\t// @todo report to Sentry\n\t\tthrow throwInternalError()\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IMongoDBError.mjs","sourceRoot":"","sources":["../../../src/lib/MongoDB/IMongoDBError.mts"],"names":[],"mappings":"","sourcesContent":["import { MongoDBErrType } from '@lib/MongoDB/MongoDBErrType.mjs'\n\nexport interface IMongoDBError {\n\terrorResponse?: {\n\t\tcode: MongoDBErrType\n\t}\n\tparent?: {\n\t\terrorResponse?: {\n\t\t\tcode: MongoDBErrType\n\t\t}\n\t}\n\tmessage: string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IOnboarding.mjs","sourceRoot":"","sources":["../../../src/lib/MongoDB/IOnboarding.mts"],"names":[],"mappings":"","sourcesContent":["export interface IOnboarding {\n\tonboardingStep?: string\n\tonboardingDone?: boolean\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MongoDBErrType.mjs","sourceRoot":"","sources":["../../../src/lib/MongoDB/MongoDBErrType.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACzB,iFAAyB,CAAA;AAC1B,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB","sourcesContent":["export enum MongoDBErrType {\n\tDuplicateKeyError = 11000\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwIfMongoErr.mjs","sourceRoot":"","sources":["../../../src/lib/MongoDB/throwIfMongoErr.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,6BAAuC;AAChE,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAClE,OAAO,EAAE,wBAAwB,EAAE,yDAA2C;AAE9E,MAAM,UAAU,eAAe,CAAC,CAAgB;IAC/C,IACC,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB,CAAC;QAC9E,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB,CAAC,EACvG,CAAC;QACF,MAAM,kBAAkB,EAAE,CAAA;IAC3B,CAAC;SAAM,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAChD,MAAM,wBAAwB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IAC5E,CAAC;AACF,CAAC","sourcesContent":["import { IMongoDBError } from '@lib/MongoDB/IMongoDBError.mjs'\nimport { MongoDBErrType } from '@lib/MongoDB/MongoDBErrType.mjs'\nimport { throwConflictError } from '@throw/throwConflictError.mjs'\nimport { throwErrorWrongUserInput } from '@throw/throwErrorWrongUserInput.mjs'\n\nexport function throwIfMongoErr(e: IMongoDBError) {\n\tif (\n\t\t(e.errorResponse && e.errorResponse.code === MongoDBErrType.DuplicateKeyError) ||\n\t\t(e.parent && e.parent.errorResponse && e.parent.errorResponse.code === MongoDBErrType.DuplicateKeyError)\n\t) {\n\t\tthrow throwConflictError()\n\t} else if (e.message.startsWith('[Validator]')) {\n\t\tthrow throwErrorWrongUserInput(e.message.replace('[Validator]', '').trim())\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwMongoErrors.mjs","sourceRoot":"","sources":["../../../src/lib/MongoDB/throwMongoErrors.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,8BAAwC;AAClE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAElE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAgB,EAAS,EAAE;IAC7D,eAAe,CAAC,CAAC,CAAC,CAAA;IAClB,kBAAkB;IAElB,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAC1B,MAAM,kBAAkB,EAAE,CAAA;AAC3B,CAAC,CAAA","sourcesContent":["import { IMongoDBError } from '@lib/MongoDB/IMongoDBError.mjs'\nimport { throwIfMongoErr } from '@lib/MongoDB/throwIfMongoErr.mjs'\nimport * as Sentry from '@sentry/node'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\n\nexport const throwMongoDBErrors = (e: IMongoDBError): never => {\n\tthrowIfMongoErr(e)\n\t// else throw here\n\n\tSentry.captureException(e)\n\tthrow throwInternalError()\n}\n"]}
|
package/dist/lib/NumLib.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NumLib.mjs","sourceRoot":"","sources":["../../src/lib/NumLib.mts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IAClB,gBAAe,CAAC;IAEhB;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,GAAW;QACjC,OAAO,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACD,CAAC,oBAAoB","sourcesContent":["export class NumLib {\n\tconstructor() {}\n\n\t/************\n\t * parseFloat wants '.' as the decimal separator !!\n\t *\n\t * @param val\n\t * @returns {number}\n\t */\n\tstatic parseFloatFixed(val: string): number {\n\t\treturn parseFloat(val.replace(/,/g, '.'))\n\t}\n} /* c8 ignore next */\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPostgresError.mjs","sourceRoot":"","sources":["../../../src/lib/PostgreSQL/IPostgresError.mts"],"names":[],"mappings":"","sourcesContent":["export interface IPostgresError extends Error {\n\tcode?: string\n\tdetail?: string\n\tconstraint?: string\n\thint?: string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPostgresErrorCodes.mjs","sourceRoot":"","sources":["../../../src/lib/PostgreSQL/IPostgresErrorCodes.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAEX;AAFD,WAAY,mBAAmB;IAC9B,kDAA2B,CAAA;AAC5B,CAAC,EAFW,mBAAmB,KAAnB,mBAAmB,QAE9B","sourcesContent":["export enum IPostgresErrorCodes {\n\tduplicateKeyValue = '23505'\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"makePostgreSqlLogError.mjs","sourceRoot":"","sources":["../../../src/lib/PostgreSQL/makePostgreSqlLogError.mts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CAAC,OAAuB;IAC7D,OAAO,GAAG,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,MAAM,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;AACvF,CAAC","sourcesContent":["import { IPostgresError } from '@lib/PostgreSQL/IPostgresError.mjs'\n\nexport function makePostgreSqlLogError(pgError: IPostgresError): string {\n\treturn `${pgError.code} | ${pgError.hint} | ${pgError.detail} | ${pgError.constraint}`\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RedisBoolean.mjs","sourceRoot":"","sources":["../../../src/lib/Redis/RedisBoolean.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,0BAAU,CAAA;IACV,2BAAW,CAAA;AACZ,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["export enum RedisBoolean {\n\ttrue = '1',\n\tfalse = '0'\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildPrefixedRedisKey.mjs","sourceRoot":"","sources":["../../../src/lib/Redis/buildPrefixedRedisKey.mts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA8B,EAAE,KAAa;IAClF,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,EAAE,CAAA;AAC9D,CAAC","sourcesContent":["/**\n * Builds a Redis session key by adding its namespace prefix ('access:' or 'refresh:') — unless the\n * token already carries it, in which case it is returned unchanged.\n * ctx.state.user.refreshToken/accessToken arrive already prefixed from this package's own\n * authenticatedLogoutHandler / authenticatedAuthorizationHandler, but a consumer wiring\n * ctx.state.user by hand may pass a bare uuid: accept both shapes so the caller never builds\n * 'refresh:refresh:<uuid>' and deletes a key that was never written.\n */\nexport function buildPrefixedRedisKey(prefix: 'access:' | 'refresh:', token: string): string {\n\treturn token.startsWith(prefix) ? token : `${prefix}${token}`\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fromRedisBooleanValue.mjs","sourceRoot":"","sources":["../../../src/lib/Redis/fromRedisBooleanValue.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,UAAU,qBAAqB,CAAC,IAAkB;IACvD,OAAO,IAAI,KAAK,YAAY,CAAC,IAAI,CAAA;AAClC,CAAC","sourcesContent":["import { RedisBoolean } from './RedisBoolean.mjs'\n\nexport function fromRedisBooleanValue(data: RedisBoolean) {\n\treturn data === RedisBoolean.true\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toRedisBooleanValue.mjs","sourceRoot":"","sources":["../../../src/lib/Redis/toRedisBooleanValue.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAA;AACtD,CAAC","sourcesContent":["import { RedisBoolean } from './RedisBoolean.mjs'\n\nexport function toRedisBooleanValue(value: boolean) {\n\treturn value ? RedisBoolean.true : RedisBoolean.false\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StringLib.mjs","sourceRoot":"","sources":["../../src/lib/StringLib.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEpD,mFAAmF;AACnF,MAAM,eAAe,GAAG,kCAAkC,CAAA;AAE1D,MAAM,OAAO,SAAS;IACrB,wBAAwB;IACxB,gBAAe,CAAC;IAEhB,SAAS,CAAC,GAAW;QACpB,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;IACxC,CAAC;IAED,kBAAkB,CAAC,GAAuB;QACzC,OAAO,OAAO,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,CAAC,MAAc;QAC1B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;QAC9C,IAAI,CAAC,GAAG,EAAE,CAAA;QACV,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACvB,CAAC,IAAI,eAAe,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;QACjD,CAAC;QAED,OAAO,CAAC,CAAA;IACT,CAAC;IAED;;;OAGG;IACH,YAAY;QACX,OAAO,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,GA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AC,CAAC,EAAE,CAAC;YAChC,CAAC,CAAC,UAAU,EAAE,CACd,CAAA;IACF,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,WAAmB,EAAE;QAC3C,OAAO,4BAA4B,IAAI,KAAK,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAA;IACpF,CAAC;CACD,CAAC,oBAAoB","sourcesContent":["import { randomBytes, randomInt } from 'node:crypto'\n\n// 32 chars, a subset of base36. 256 % 32 === 0 so a byte maps uniformly with % 32.\nconst RANDOM_ALPHABET = '0123456789abcdefghijklmnopqrstuv'\n\nexport class StringLib {\n\t// implements IStringLib\n\tconstructor() {}\n\n\tcleanHtml(str: string): string {\n\t\treturn str.replace(/(<([^>]+)>)/gi, '')\n\t}\n\n\tcleanHtmlUndefined(str: string | undefined): string | undefined {\n\t\treturn typeof str === 'undefined' ? str : str.replace(/(<([^>]+)>)/gi, '')\n\t}\n\n\t/**\n\t * Cryptographically random string of `length` characters.\n\t *\n\t * This is the generator behind every password-reset hash and email-confirmation\n\t * hash in the package (emailHash -> registerNewUser / setEmailHash, and resetPwd\n\t * directly). It previously used Math.random(), which is NOT a CSPRNG: V8 implements\n\t * it as xorshift128+, whose internal state is recoverable from a modest number of\n\t * observed outputs, after which every future value is predictable. An attacker could\n\t * request a reset for an account they control, read their own hash from the email,\n\t * recover the generator state, and predict the hash issued next — then trigger a\n\t * reset for a victim and use the predicted token. The 50-character length gave no\n\t * protection: entropy is bounded by the generator, not by the output length.\n\t *\n\t * The alphabet is 32 characters, a subset of the base36 output this has always\n\t * produced, so callers matching /^[0-9a-z]+$/ are unaffected. 256 % 32 === 0, so\n\t * mapping a byte with % 32 is uniform — no modulo bias, and no rejection branch.\n\t * 5 bits per character: a 50-character hash carries 250 bits.\n\t */\n\trandomString(length: number): string {\n\t\tconst bytes = randomBytes(Math.max(0, length))\n\t\tlet s = ''\n\t\tfor (const b of bytes) {\n\t\t\ts += RANDOM_ALPHABET[b % RANDOM_ALPHABET.length]\n\t\t}\n\n\t\treturn s\n\t}\n\n\t/**\n\t * return OTP as string\n\t * @returns {string}\n\t */\n\tgetRandomOTP(): string {\n\t\treturn '' + this.getRandomArbitrary(100000, 999999)\n\t}\n\n\t/**\n\t * Cryptographically random integer in [min, max).\n\t *\n\t * Also moved off Math.random(): this backs getRandomOTP(), and a predictable\n\t * one-time password defeats the point of one.\n\t *\n\t * Uses crypto.randomInt rather than a hand-rolled modulo, which would over-represent\n\t * the low end of the range. Hand-rolling the usual rejection loop was the first\n\t * attempt, but its retry branch is statistically unreachable (~1 in 4 billion), so it\n\t * could never be covered by a test — and an uncoverable branch is exactly what the\n\t * coverage gate exists to refuse. randomInt does the same rejection inside Node.\n\t */\n\tgetRandomArbitrary(min: number, max: number) {\n\t\tconst lo = Math.trunc(min)\n\t\tconst range = Math.max(0, Math.trunc(max) - lo)\n\t\tif (range === 0) {\n\t\t\treturn lo\n\t\t}\n\n\t\treturn randomInt(lo, lo + range)\n\t}\n\n\tisoToTimestamp(isoStr: Date): number {\n\t\t// const date = new Date(isoStr)\n\t\t// return date.getTime()\n\t\treturn isoStr.getTime()\n\t}\n\n\tisoFormatDMY(data: string): string {\n\t\tconst d = new Date(data)\n\t\treturn d.getUTCDate() + '/' + (d.getUTCMonth() + +1) + '/' + d.getUTCFullYear()\n\t}\n\n\tisoFormatDateTime(data: string): string {\n\t\tconst d = new Date(data)\n\t\treturn (\n\t\t\td.getUTCDate() +\n\t\t\t'/' +\n\t\t\t(d.getUTCMonth() + +1) +\n\t\t\t'/' +\n\t\t\td.getUTCFullYear() +\n\t\t\t' ' +\n\t\t\td.getHours() +\n\t\t\t':' +\n\t\t\t(d.getMinutes() < 10 ? '0' : '') +\n\t\t\td.getMinutes() +\n\t\t\t':' +\n\t\t\t(d.getSeconds() < 10 ? '0' : '') +\n\t\t\td.getSeconds()\n\t\t)\n\t}\n\n\tmakeLink(link: string, linkText: string = ''): string {\n\t\treturn `<a target='_blank' href='${link}'>${linkText === '' ? link : linkText}</a>`\n\t}\n} /* c8 ignore next */\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessPaths.mjs","sourceRoot":"","sources":["../../../src/lib/access/accessPaths.mts"],"names":[],"mappings":"AAmDA,8FAA8F;AAC9F,MAAM,CAAC,MAAM,uBAAuB,GAAmB,MAAM,CAAC,MAAM,CAAC;IACpE,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,gBAAgB;IAC1B,IAAI,EAAE,mBAAmB;IACzB,YAAY,EAAE,sBAAsB;IACpC,SAAS,EAAE,mBAAmB;IAC9B,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,kBAAkB;IAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,CAAC;CACxE,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAA+B;IACnE,OAAO,EAAE,GAAG,uBAAuB,EAAE,GAAG,KAAK,EAAE,CAAA;AAChD,CAAC;AAkCD,8FAA8F;AAC9F,MAAM,CAAC,MAAM,0BAA0B,GAAsB,MAAM,CAAC,MAAM,CAAC;IAC1E,KAAK,EAAE,aAAa;IACpB,KAAK,EAAE,qBAAqB;IAC5B,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,2BAA2B;IACxC,YAAY,EAAE,4BAA4B;IAC1C,WAAW,EAAE,2BAA2B;IACxC,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,kBAAkB;IAC5B,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,oBAAoB,EAAE,2BAA2B,EAAE,4BAA4B,CAAC,CAAC;IAC7G,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC;QAC/B,oBAAoB;QACpB,2BAA2B;QAC3B,4BAA4B;QAC5B,2BAA2B;KAC3B,CAAC;CACF,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAkC;IACzE,OAAO,EAAE,GAAG,0BAA0B,EAAE,GAAG,KAAK,EAAE,CAAA;AACnD,CAAC","sourcesContent":["import { Model } from 'mongoose'\n\n/**\n * Any mongoose model an access flow can be pointed at.\n *\n * Deliberately `Model<any>`: the flows only ever call `findOne`, `updateOne`, `countDocuments` and\n * `deleteOne` with computed field paths, so nothing here can be typed against a concrete document\n * shape without forcing every consumer to describe theirs. The `paths` map below is what pins the\n * contract instead — a wrong path is a runtime no-op, which is why the defaults are exported and the\n * flows are tested against them.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TAccessModel = Model<any>\n\n/**\n * Field paths the password-reset flow reads and writes.\n *\n * Every value is a dotted mongo path into the account document. They are supplied as data rather\n * than hard-coded because `UserBase` is only one possible layout: a consumer whose accounts live in\n * another collection, or under another field tree, could not use `resetPwd` / `updatePassword` at\n * all while the paths were baked in.\n */\nexport interface IResetPwdPaths {\n\t/** Login address. Used as the lookup filter by `getResetPwd` and `removeResetReq`. */\n\temail: string\n\t/** Bcrypt hash slot `updatePassword` overwrites. */\n\tpassword: string\n\t/** Display name passed to the reset / confirmation emails. Missing value ⇒ empty string. */\n\tname: string\n\t/** When the pending reset was requested. Drives the 10-minute throttle and the 60-minute expiry. */\n\tresetDateReq: string\n\t/** Password-reset token. Must stay disjoint from the email-verification hash slot. */\n\tresetHash: string\n\t/** Account tombstone flag. A set value makes `getResetPwd` answer `null`, as for an unknown address. */\n\tdeleted: string\n\t/** Account lockout flag. A set value makes `getResetPwd` answer `null`, as for an unknown address. */\n\tdisabled: string\n\t/**\n\t * Paths `removeResetReq` `$unset`s once a reset has been consumed.\n\t *\n\t * Kept separate from `resetDateReq` / `resetHash` on purpose — it is NOT always the same list.\n\t * A layout that stores the request as one all-or-nothing subdocument, e.g.\n\t * `resetPwd: { resetDateReq, resetHash }` under `validationLevel: 'strict'` +\n\t * `validationAction: 'error'`, rejects a write that unsets a single member: the leftover document\n\t * fails validation. The only legal cleanup there is `$unset: { resetPwd: '' }` — one container\n\t * path, not two leaf paths. Deriving this list from the leaves would make that layout impossible\n\t * to express, and the flat default hides the problem completely.\n\t */\n\tresetClear: readonly string[]\n}\n\n/** The layout of `UserBase` — i.e. the behaviour of the flow before it took a `paths` map. */\nexport const DEFAULT_RESET_PWD_PATHS: IResetPwdPaths = Object.freeze({\n\temail: 'login.email',\n\tpassword: 'login.password',\n\tname: 'personalData.name',\n\tresetDateReq: 'account.resetDateReq',\n\tresetHash: 'account.resetHash',\n\tdeleted: 'account.deleted',\n\tdisabled: 'account.disabled',\n\tresetClear: Object.freeze(['account.resetDateReq', 'account.resetHash'])\n})\n\n/**\n * Merge a partial override over {@link DEFAULT_RESET_PWD_PATHS}.\n *\n * Plain spread: a key present with an explicit `undefined` value overrides the default with\n * `undefined`, so pass only the keys being changed.\n */\nexport function resolveResetPwdPaths(paths?: Partial<IResetPwdPaths>): IResetPwdPaths {\n\treturn { ...DEFAULT_RESET_PWD_PATHS, ...paths }\n}\n\n/**\n * Field paths the email-verification and email-change flows read and write.\n *\n * Same rationale as {@link IResetPwdPaths}. Note that `hash` here is the inbox-proof token\n * (activation and email change, 3-day life, `requestTimes` throttle) and must never be pointed at\n * the same field as `IResetPwdPaths.resetHash`: while the two shared one slot, a hash issued by\n * either flow authenticated the other, and an unauthenticated reset request killed pending\n * activation links.\n */\nexport interface IVerifyEmailPaths {\n\t/** Live login address — lookup filter, and the field `confirmNewEmail` writes on an email change. */\n\temail: string\n\t/** Boolean flag `enableEmailAccess` flips once a verification link is honoured. */\n\tvalid: string\n\t/** Verification / email-change token. Never the password-reset slot. */\n\thash: string\n\t/** When the current token was issued. Drives the 3-day link window. */\n\tdateLastReq: string\n\t/** Strike counter. Five wrong hashes delete the account. */\n\trequestTimes: string\n\t/** Address awaiting confirmation during an email change. */\n\tnewEmailTmp: string\n\t/** Account tombstone flag. */\n\tdeleted: string\n\t/** Account lockout flag. */\n\tdisabled: string\n\t/** Paths `enableEmailAccess` `$unset`s once a verification link is honoured. */\n\tverifyClear: readonly string[]\n\t/** Paths `confirmNewEmail` `$unset`s once a new address is accepted. */\n\temailChangeClear: readonly string[]\n}\n\n/** The layout of `UserBase` — i.e. the behaviour of the flow before it took a `paths` map. */\nexport const DEFAULT_VERIFY_EMAIL_PATHS: IVerifyEmailPaths = Object.freeze({\n\temail: 'login.email',\n\tvalid: 'account.email.valid',\n\thash: 'account.email.hash',\n\tdateLastReq: 'account.email.dateLastReq',\n\trequestTimes: 'account.email.requestTimes',\n\tnewEmailTmp: 'account.email.newEmailTmp',\n\tdeleted: 'account.deleted',\n\tdisabled: 'account.disabled',\n\tverifyClear: Object.freeze(['account.email.hash', 'account.email.dateLastReq', 'account.email.requestTimes']),\n\temailChangeClear: Object.freeze([\n\t\t'account.email.hash',\n\t\t'account.email.dateLastReq',\n\t\t'account.email.requestTimes',\n\t\t'account.email.newEmailTmp'\n\t])\n})\n\n/**\n * Merge a partial override over {@link DEFAULT_VERIFY_EMAIL_PATHS}.\n *\n * Plain spread: a key present with an explicit `undefined` value overrides the default with\n * `undefined`, so pass only the keys being changed.\n */\nexport function resolveVerifyEmailPaths(paths?: Partial<IVerifyEmailPaths>): IVerifyEmailPaths {\n\treturn { ...DEFAULT_VERIFY_EMAIL_PATHS, ...paths }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createResetPwdFlow.mjs","sourceRoot":"","sources":["../../../src/lib/access/createResetPwdFlow.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oDAA8C;AAC1E,OAAO,EAAE,oBAAoB,EAAE,uDAAiD;AAChF,OAAO,EAAE,kBAAkB,EAAE,qDAA+C;AAC5E,OAAO,EAAE,sBAAsB,EAAE,yDAAmD;AAEpF,OAAO,EAAE,sBAAsB,EAAqB,MAAM,6CAA6C,CAAA;AACvG,OAAO,EAAE,4BAA4B,EAA2B,MAAM,mDAAmD,CAAA;AACzH,OAAO,EAAkB,oBAAoB,EAAgB,MAAM,mBAAmB,CAAA;AActF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAA2B,EAAiB,EAAE;IAC9F,MAAM,QAAQ,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAA;IAE5C,MAAM,WAAW,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAEtD,OAAO;QACN,QAAQ,EAAE,sBAAsB,CAAC;YAChC,WAAW;YACX,YAAY,EAAE,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC;SACjD,CAAC;QACF,cAAc,EAAE,4BAA4B,CAAC;YAC5C,WAAW;YACX,gBAAgB,EAAE,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC;YACzD,cAAc,EAAE,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC;SACrD,CAAC;KACF,CAAA;AACF,CAAC,CAAA","sourcesContent":["import { createGetResetPwd } from '@private/lib/access/db/getResetPwd.mjs'\nimport { createRemoveResetReq } from '@private/lib/access/db/removeResetReq.mjs'\nimport { createSaveResetReq } from '@private/lib/access/db/saveResetReq.mjs'\nimport { createUpdatePasswordDb } from '@private/lib/access/db/updatePasswordDb.mjs'\n\nimport { createResetPwdMutation, TResetPwdMutation } from '../../graphQL/schema/mutations/resetPwd.mjs'\nimport { createUpdatePasswordMutation, TUpdatePasswordMutation } from '../../graphQL/schema/mutations/updatePassword.mjs'\nimport { IResetPwdPaths, resolveResetPwdPaths, TAccessModel } from './accessPaths.mjs'\n\n/** What the factory needs: the account model, plus any path that differs from the default layout. */\nexport interface ICreateResetPwdFlowArgs {\n\tmodel: TAccessModel\n\tpaths?: Partial<IResetPwdPaths>\n}\n\n/** The two mutations the flow exposes, bound to the model and paths passed in. */\nexport interface IResetPwdFlow {\n\tresetPwd: TResetPwdMutation\n\tupdatePassword: TUpdatePasswordMutation\n}\n\n/**\n * Build the password-reset mutations against any mongoose model.\n *\n * The package's own `resetPwd` / `updatePassword` exports are this factory applied to `UserBase` with\n * `DEFAULT_RESET_PWD_PATHS`, so switching to it changes nothing until a path is overridden.\n *\n * Every key of `paths` is optional and falls back to the default layout. `resetClear` is the one to\n * look at twice: it is the list of paths the cleanup `$unset`s, and it is NOT derived from\n * `resetDateReq` + `resetHash`. A schema storing the request as one required-members subdocument under\n * `validationLevel: 'strict'` is left invalid by unsetting a single member, and the write is rejected —\n * such a schema must pass the container path instead. See `IResetPwdPaths.resetClear`.\n *\n * ```ts\n * const { resetPwd, updatePassword } = createResetPwdFlow({\n * model: Account,\n * paths: { email: 'mail', password: 'pwd', name: 'profile.fullName', resetClear: ['resetPwd'] }\n * })\n * ```\n */\nexport const createResetPwdFlow = ({ model, paths }: ICreateResetPwdFlowArgs): IResetPwdFlow => {\n\tconst resolved = resolveResetPwdPaths(paths)\n\n\tconst getResetPwd = createGetResetPwd(model, resolved)\n\n\treturn {\n\t\tresetPwd: createResetPwdMutation({\n\t\t\tgetResetPwd,\n\t\t\tsaveResetReq: createSaveResetReq(model, resolved)\n\t\t}),\n\t\tupdatePassword: createUpdatePasswordMutation({\n\t\t\tgetResetPwd,\n\t\t\tupdatePasswordDb: createUpdatePasswordDb(model, resolved),\n\t\t\tremoveResetReq: createRemoveResetReq(model, resolved)\n\t\t})\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createVerifyEmailFlow.mjs","sourceRoot":"","sources":["../../../src/lib/access/createVerifyEmailFlow.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAA6B,8DAAwD;AAC5H,OAAO,EAAE,qBAAqB,EAAoB,wDAAkD;AACpG,OAAO,EAAE,uBAAuB,EAAsB,0DAAoD;AAC1G,OAAO,EAAE,uBAAuB,EAAsB,0DAAoD;AAC1G,OAAO,EAAE,iBAAiB,EAAgB,oDAA8C;AACxF,OAAO,EAAE,kBAAkB,EAAiB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B;QACjB,WAAW;QACX,wBAAwB;QACxB,qBAAqB,EAAE,mCAAmC,CAAC;YAC1D,KAAK;YACL,KAAK,EAAE,QAAQ;YACf,eAAe;YACf,WAAW;SACX,CAAC;QACF,iBAAiB,EAAE,uBAAuB,CAAC;YAC1C,oBAAoB;YACpB,wBAAwB;YACxB,iBAAiB;SACjB,CAAC;KACF,CAAA;AACF,CAAC,CAAA","sourcesContent":["import { createAssertVerifyEmailAllowed, TAssertVerifyEmailAllowed } from '@private/lib/access/assertVerifyEmailAllowed.mjs'\nimport { createConfirmNewEmail, TConfirmNewEmail } from '@private/lib/access/db/confirmNewEmail.mjs'\nimport { createDeleteUserByEmail, TDeleteUserByEmail } from '@private/lib/access/db/deleteUserByEmail.mjs'\nimport { createEnableEmailAccess, TEnableEmailAccess } from '@private/lib/access/db/enableEmailAccess.mjs'\nimport { createIncReqTimes, TIncReqTimes } from '@private/lib/access/db/incReqTimes.mjs'\nimport { createSetEmailHash, TSetEmailHash } from '@private/lib/access/db/setEmailHash.mjs'\nimport { createUserData4VerifyEmail, TUserData4VerifyEmail } from '@private/lib/access/db/userData4VerifyEmail.mjs'\nimport { createHandleIfHashBad } from '@private/lib/access/handleIfHashBad.mjs'\nimport { createHandleIfMoreThan3DaysPassed } from '@private/lib/access/handleIfMoreThan3DaysPassed.mjs'\nimport { createHandleIfTooMuchRequestsTimes } from '@private/lib/access/handleIfTooMuchRequestsTimes.mjs'\n\nimport {\n\tcreateEmailChangeHashVerifyMutation,\n\tTEmailChangeHashVerifyMutation\n} from '../../graphQL/schema/mutations/emailChangeHashVerify.mjs'\nimport { createVerifyEmailRouter, TVerifyEmailRouter } from '../../koa/router/verifyEmail.mjs'\nimport { IVerifyEmailPaths, resolveVerifyEmailPaths, TAccessModel } from './accessPaths.mjs'\n\n/** What the factory needs: the account model, plus any path that differs from the default layout. */\nexport interface ICreateVerifyEmailFlowArgs {\n\tmodel: TAccessModel\n\tpaths?: Partial<IVerifyEmailPaths>\n}\n\n/** Everything the verify-email chain exposes, bound to the model and paths passed in. */\nexport interface IVerifyEmailFlow {\n\tuserData4VerifyEmail: TUserData4VerifyEmail\n\tsetEmailHash: TSetEmailHash\n\tenableEmailAccess: TEnableEmailAccess\n\tconfirmNewEmail: TConfirmNewEmail\n\tdeleteUserByEmail: TDeleteUserByEmail\n\tincReqTimes: TIncReqTimes\n\tassertVerifyEmailAllowed: TAssertVerifyEmailAllowed\n\temailChangeHashVerify: TEmailChangeHashVerifyMutation\n\trouterVerifyEmail: TVerifyEmailRouter\n}\n\n/**\n * Build the whole email-verification chain against any mongoose model.\n *\n * The package's own exports (`userData4VerifyEmail`, `setEmailHash`, `enableEmailAccess`,\n * `confirmNewEmail`, `emailChangeHashVerify`, `routerVerifyEmail`) are this factory applied to\n * `UserBase` with `DEFAULT_VERIFY_EMAIL_PATHS`, so switching to it changes nothing until a path is\n * overridden.\n *\n * The two `*Clear` keys are lists of paths to `$unset`, and neither is derived from the leaf paths the\n * flow reads: a schema storing the verification state as one required-members subdocument is left\n * invalid by unsetting a single member. Pass the container path in that case. See `IVerifyEmailPaths`.\n *\n * ```ts\n * const flow = createVerifyEmailFlow({\n * model: Account,\n * paths: { email: 'mail', valid: 'verified', verifyClear: ['verification'] }\n * })\n * router.get('/check/verify-email/:email/:hash', flow.routerVerifyEmail())\n * ```\n */\nexport const createVerifyEmailFlow = ({ model, paths }: ICreateVerifyEmailFlowArgs): IVerifyEmailFlow => {\n\tconst resolved = resolveVerifyEmailPaths(paths)\n\n\tconst userData4VerifyEmail = createUserData4VerifyEmail(model, resolved)\n\tconst enableEmailAccess = createEnableEmailAccess(model, resolved)\n\tconst confirmNewEmail = createConfirmNewEmail(model, resolved)\n\tconst deleteUserByEmail = createDeleteUserByEmail(model, resolved)\n\tconst incReqTimes = createIncReqTimes(model, resolved)\n\n\tconst assertVerifyEmailAllowed = createAssertVerifyEmailAllowed({\n\t\tpaths: resolved,\n\t\thandleIfHashBad: createHandleIfHashBad(incReqTimes),\n\t\thandleIfMoreThan3DaysPassed: createHandleIfMoreThan3DaysPassed(deleteUserByEmail),\n\t\thandleIfTooMuchRequestsTimes: createHandleIfTooMuchRequestsTimes(deleteUserByEmail)\n\t})\n\n\treturn {\n\t\tuserData4VerifyEmail,\n\t\tsetEmailHash: createSetEmailHash(model, resolved),\n\t\tenableEmailAccess,\n\t\tconfirmNewEmail,\n\t\tdeleteUserByEmail,\n\t\tincReqTimes,\n\t\tassertVerifyEmailAllowed,\n\t\temailChangeHashVerify: createEmailChangeHashVerifyMutation({\n\t\t\tmodel,\n\t\t\tpaths: resolved,\n\t\t\tconfirmNewEmail,\n\t\t\tincReqTimes\n\t\t}),\n\t\trouterVerifyEmail: createVerifyEmailRouter({\n\t\t\tuserData4VerifyEmail,\n\t\t\tassertVerifyEmailAllowed,\n\t\t\tenableEmailAccess\n\t\t})\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkEmailLen.mjs","sourceRoot":"","sources":["../../src/lib/checkEmailLen.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,wBAA0B;AAClD,OAAO,EAAE,wBAAwB,EAAE,sDAA2C;AAE9E,MAAM,UAAU,aAAa,CAAC,KAAa;IAC1C,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAClB,MAAM,wBAAwB,CAAC,uBAAuB,CAAC,CAAA;IACxD,CAAC;SAAM,IAAI,KAAK,CAAC,MAAM,GAAG,aAAa,EAAE,CAAC;QACzC,MAAM,wBAAwB,CAAC,uBAAuB,aAAa,aAAa,CAAC,CAAA;IAClF,CAAC;AACF,CAAC","sourcesContent":["import { EMAIL_MAX_LEN } from '@lib/Constants.mjs'\nimport { throwErrorWrongUserInput } from '@throw/throwErrorWrongUserInput.mjs'\n\nexport function checkEmailLen(email: string) {\n\tif (email === '') {\n\t\tthrow throwErrorWrongUserInput('Email cannot be empty')\n\t} else if (email.length > EMAIL_MAX_LEN) {\n\t\tthrow throwErrorWrongUserInput(`Email cannot exceed ${EMAIL_MAX_LEN} characters`)\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkPwdLen.mjs","sourceRoot":"","sources":["../../src/lib/checkPwdLen.mts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,0GAA0G;AAE1G,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,wBAA0B;AACnE,OAAO,EAAE,wBAAwB,EAAE,sDAA2C;AAE9E,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC3C,IAAI,QAAQ,CAAC,MAAM,GAAG,cAAc,EAAE,CAAC;QACtC,MAAM,wBAAwB,CAAC,uBAAuB,CAAC,CAAA;IACxD,CAAC;SAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,cAAc,EAAE,CAAC;QAC7C,MAAM,wBAAwB,CAAC,sBAAsB,CAAC,CAAA;IACvD,CAAC;AACF,CAAC","sourcesContent":["// OWASP max len 72 chr for bcrypt\n// https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#input-limits-of-bcrypt\n\nimport { MAX_PWD_LENGTH, MIN_PWD_LENGTH } from '@lib/Constants.mjs'\nimport { throwErrorWrongUserInput } from '@throw/throwErrorWrongUserInput.mjs'\n\nexport function checkPwdLen(password: string) {\n\tif (password.length < MIN_PWD_LENGTH) {\n\t\tthrow throwErrorWrongUserInput('Password is too short')\n\t} else if (password.length > MAX_PWD_LENGTH) {\n\t\tthrow throwErrorWrongUserInput('Password is too long')\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hitStat.mjs","sourceRoot":"","sources":["../../../../src/lib/db/log/hitStat.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qEAAoD;AAEnF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,WAAW,IAAY;IAClD,6BAA6B;IAC7B,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACnG,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IAElB,yBAAyB;IACzB,OAAO,oBAAoB,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;AAC5H,CAAC,CAAA","sourcesContent":["import { DevStatsGraphQLCalls } from '@models/MongoDB/log/DevStatsGraphQLCalls.mjs'\n\nexport const hitStat = async function (call: string) {\n\t// get last document of stats\n\tconst ret = await DevStatsGraphQLCalls.find({}).select('_id').sort({ dataora: -1 }).limit(1).lean()\n\tconst doc = ret[0]\n\n\t// set true for this call\n\treturn DevStatsGraphQLCalls.updateOne({ _id: doc._id, 'list.name': call }, { 'list.$.hit': true }, { runValidators: true })\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logGlobalError.mjs","sourceRoot":"","sources":["../../../../src/lib/db/log/logGlobalError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,+DAA8C;AAQvE,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,GAAiB;IACxD,IAAI,GAAG,CAAC,OAAO,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAM;IAE3D,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,EAAE,CAAC,CAAA;IAC7C,IAAI,GAAG,CAAC,OAAO,KAAK,EAAE;QAAE,cAAc,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAAA;IACtD,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,cAAc,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAA;IAE9D,+BAA+B;AAChC,CAAC,CAAA","sourcesContent":["import { LogGlobalError } from '@models/MongoDB/log/LogGlobalError.mjs'\n\n/** Payload accepted by `logGlobalError`. Exported so a consumer re-exporting the helper can name its type. */\nexport interface IGlobalError {\n\tmessage: string\n\tstackArr: Array<string>\n}\n\nexport const logGlobalError = function (log: IGlobalError) {\n\tif (log.message === '' && log.stackArr.length === 0) return\n\n\tconst newGlobalError = new LogGlobalError({})\n\tif (log.message !== '') newGlobalError.m = log.message\n\tif (log.stackArr.length !== 0) newGlobalError.s = log.stackArr\n\n\t// return newGlobalError.save()\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logGraphql.mjs","sourceRoot":"","sources":["../../../../src/lib/db/log/logGraphql.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gEAA+C;AAGzE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,KAAqB,EAAE,IAAY,EAAE,MAAc,EAAE,KAAa;IACrG,IAAI,eAAe,CAAC;QACnB,KAAK;QACL,IAAI;QACJ,MAAM;QACN,KAAK;KACL,CAAC,CAAA;IACF;;;;;;;;;OASM;AACP,CAAC,CAAA","sourcesContent":["import { LogStatsGraphql } from '@models/MongoDB/log/LogStatsGraphql.mjs'\nimport { Types } from 'mongoose'\n\n/**\n * Logs operations performed by users\n * @param owner\n * @param nome\n * @param status\n * @param msTot\n */\nexport const logGraphql = function (owner: Types.ObjectId, nome: string, status: number, msTot: number) {\n\tnew LogStatsGraphql({\n\t\towner,\n\t\tnome,\n\t\tstatus,\n\t\tmsTot\n\t})\n\t/*\n return new Promise((resolve, reject) => {\n newStatsGraphql.save((err: any, res: any) => {\n if (err) {\n reject('Log error.' + err)\n } else {\n resolve(res)\n }\n })\n }) */\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logThrow.mjs","sourceRoot":"","sources":["../../../../src/lib/db/log/logThrow.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,yDAAwC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,oCAAoC;AAEpC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,GAAW,EAAE,QAAgB;IAC9D,IAAI,QAAQ,CAAC;QACZ,GAAG,EAAE,IAAI,KAAK,CAAC,QAAQ,EAAE;QACzB,OAAO,EAAE,GAAG;QACZ,QAAQ;QACR,QAAQ,EAAE,IAAI,IAAI,EAAE;KACpB,CAAC,CAAA;IAEF,+LAA+L;IAC/L,mGAAmG;IAEnG,8BAA8B;AAC/B,CAAC,CAAA","sourcesContent":["import { LogThrow } from '@models/MongoDB/log/LogThrow.mjs'\nimport { Types } from 'mongoose'\n\n// const lastSendEmail = new Date();\n\nexport const logThrow = function (log: string, errLevel: number) {\n\tnew LogThrow({\n\t\t_id: new Types.ObjectId(),\n\t\tmessage: log,\n\t\terrLevel,\n\t\tinserted: new Date()\n\t})\n\n\t// send email, check last send email to avoid flooding (check last send email in collection with TTL / create a variable that stays available on every call to this function (lastSendEmail ?))\n\t// check db with config, e.g.: admin sets block on sending email because they're fixing the problem\n\n\t// return newThrowError.save()\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ILoginSet.mjs","sourceRoot":"","sources":["../../../../src/lib/db/login/ILoginSet.mts"],"names":[],"mappings":"","sourcesContent":["export interface ILoginSet {\n\tlogin?: {\n\t\tfirstLogin?: Date\n\t\tlastLogin?: Date\n\t\trememberMe?: boolean\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ILoginUnset.mjs","sourceRoot":"","sources":["../../../../src/lib/db/login/ILoginUnset.mts"],"names":[],"mappings":"","sourcesContent":["export interface ILoginUnset {\n\tlogin?: {\n\t\trememberMe: number\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerNewUser.mjs","sourceRoot":"","sources":["../../../src/lib/db/registerNewUser.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,yBAA0B;AAC9C,OAAO,EAAE,eAAe,EAAE,+BAAgC;AAC1D,OAAO,EAAE,QAAQ,EAAE,kDAAoC;AACvD,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,QAAgB,EAAE,OAAsB;IAC7F,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAA;IACnC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;IACxB,MAAM,gBAAgB,GAAG,SAAS,EAAE,CAAA;IACpC,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAA;IAE3C,MAAM,QAAQ,GAAG;QAChB;YACC,GAAG,EAAE,MAAM;YACX,KAAK,EAAE;gBACN,KAAK,EAAE,MAAM;gBACb,QAAQ,EAAE,GAAG;aACb;YACD,OAAO,EAAE;gBACR,KAAK,EAAE;oBACN,KAAK,EAAE,KAAK;oBACZ,WAAW,EAAE,KAAK;oBAClB,YAAY,EAAE,CAAC;oBACf,IAAI,EAAE,gBAAgB;iBACtB;gBACD,gBAAgB,EAAE,KAAK;aACvB;SACD;KACD,CAAA;IAED,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;IAC5C,OAAO,gBAAgB,CAAA;AACxB,CAAC","sourcesContent":["import { emailHash } from '@lib/emailHash.mjs'\nimport { encryptPassword } from '@lib/encryptPassword.mjs'\nimport { UserBase } from '@models/MongoDB/UserBase.mjs'\nimport { ClientSession, Types } from 'mongoose'\n\nexport async function registerNewUser(uEmail: string, password: string, session: ClientSession) {\n\tconst userId = new Types.ObjectId()\n\tconst nowDt = new Date()\n\tconst hashConfirmEmail = emailHash()\n\tconst pwd = await encryptPassword(password)\n\n\tconst newUsers = [\n\t\t{\n\t\t\t_id: userId,\n\t\t\tlogin: {\n\t\t\t\temail: uEmail,\n\t\t\t\tpassword: pwd\n\t\t\t},\n\t\t\taccount: {\n\t\t\t\temail: {\n\t\t\t\t\tvalid: false,\n\t\t\t\t\tdateLastReq: nowDt,\n\t\t\t\t\trequestTimes: 1,\n\t\t\t\t\thash: hashConfirmEmail\n\t\t\t\t},\n\t\t\t\tregistrationDate: nowDt\n\t\t\t}\n\t\t}\n\t]\n\n\tawait UserBase.create(newUsers, { session })\n\treturn hashConfirmEmail\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"userExist.mjs","sourceRoot":"","sources":["../../../src/lib/db/userExist.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kDAAoC;AAGvD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAc,EAAE,OAAsB;IACrE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA;IAE7F,OAAO,IAAI,KAAK,IAAI,CAAA;AACrB,CAAC","sourcesContent":["import { UserBase } from '@models/MongoDB/UserBase.mjs'\nimport { ClientSession } from 'mongoose'\n\nexport async function userExist(uEmail: string, session: ClientSession) {\n\tconst user = await UserBase.findOne({ 'login.email': uEmail }, '_id').session(session).lean()\n\n\treturn user !== null\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emailHash.mjs","sourceRoot":"","sources":["../../src/lib/emailHash.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAA0B;AACnD,OAAO,EAAE,SAAS,EAAE,wBAA0B;AAE9C,MAAM,UAAU,SAAS;IACxB,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAA;IAC9B,OAAO,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import { EMAIL_HASH_LEN } from '@lib/Constants.mjs'\nimport { StringLib } from '@lib/StringLib.mjs'\n\nexport function emailHash() {\n\tconst StrObj = new StringLib()\n\treturn StrObj.randomString(EMAIL_HASH_LEN)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryptPassword.mjs","sourceRoot":"","sources":["../../src/lib/encryptPassword.mts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,4CAAyC;AAE/D,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW;IAChD,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import bcrypt from '@node-rs/bcrypt'\nimport { SALT_ROUNDS } from '@private/lib/access/Constants.mjs'\n\nexport async function encryptPassword(pwd: string): Promise<string> {\n\treturn await bcrypt.hash(pwd, SALT_ROUNDS)\n}\n"]}
|
package/dist/lib/hash.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hash.mjs","sourceRoot":"","sources":["../../src/lib/hash.mts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAA;AAEpC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAa,EAAE,IAAY;IACjE,IAAI,CAAC;QACJ,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACzC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,MAAM,GAAG,CAAA;IACV,CAAC;AACF,CAAC","sourcesContent":["import bcrypt from '@node-rs/bcrypt'\n\n/**\n *\n * @param clear plaintext password\n * @param hash password hash\n */\nexport async function compareHashAsync(clear: string, hash: string) {\n\ttry {\n\t\treturn await bcrypt.compare(clear, hash)\n\t} catch (err) {\n\t\tthrow err\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isSafeRedirectTarget.mjs","sourceRoot":"","sources":["../../src/lib/isSafeRedirectTarget.mts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,4EAA4E;AAC5E,+EAA+E;AAC/E,MAAM,0BAA0B,GAAG,2BAA2B,CAAA;AAE9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IACjD,OAAO,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC9C,CAAC","sourcesContent":["// Anchored allowlist: an absolute path under /x/ and nothing else. The leading `/x/` is\n// literal, so a protocol-relative target ('//evil.com') and an absolute URL\n// ('https://evil.com') both fail before the character class is ever consulted.\nconst ALLOW_ENCODED_URLS_AFTER_X = /^\\/x\\/[a-zA-Z0-9._\\-%/]+$/\n\n/**\n * Is this value safe to hand to `ctx.redirect()`?\n *\n * Exists as a named, tested function rather than an inline regex test because guard\n * *strength* is invisible to static analysis: Semgrep accepts any `if (re.test(x))` or\n * `if (x.startsWith(p))` as a sanitizer without evaluating what the pattern actually\n * admits. Replacing this call with `link.startsWith('/')` was verified to pass both the\n * semgrep scan and the full test suite while accepting '//evil.com' — a real open\n * redirect. The regex therefore lives here, behind tests that pin the attack strings it\n * must reject, and koa-utils.open-redirect.unvalidated recognises only this function as\n * a sanitizer so an ad-hoc replacement is reported instead of silently trusted.\n *\n * Deliberately strict: same-origin absolute paths under the /x/ prefix only. Percent\n * encoding is allowed (the prefix is still literal, so an encoded separator cannot\n * escape the path into an authority), but scheme-relative and absolute URLs are not.\n *\n * @param value the candidate redirect target, typically attacker-influenced\n */\nexport function isSafeRedirectTarget(value: string): boolean {\n\treturn ALLOW_ENCODED_URLS_AFTER_X.test(value)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isSessionBlocked.mjs","sourceRoot":"","sources":["../../src/lib/isSessionBlocked.mts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA+B;IAC/D,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,OAAO,CAAC,CAAA;AACjD,CAAC","sourcesContent":["/**\n * Is the user reported as blocked within the session?\n * Redis stores hash values as strings, so this flag is truthy for both the strings\n * 'true' and 'false' alike — any non-empty value blocks.\n * Use this instead of deleting the token to block user access; set the flag from the control panel.\n */\nexport function isSessionBlocked(redData: Record<string, string>): boolean {\n\treturn !!(redData?.disabled || redData?.deleted)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isValidUuidV4.mjs","sourceRoot":"","sources":["../../src/lib/isValidUuidV4.mts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,wEAAwE,CAAA;AAE3F;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IAC1C,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC","sourcesContent":["const UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i\n\n/**\n * Is this a syntactically valid v4 UUID — the shape generateAccessToken/generateRefreshToken\n * (src/lib/tokens.mts) always produce?\n * Used at the trust boundary to reject a client-supplied token suffix before it is used to build\n * a Redis key: checking the 'access:' prefix alone still leaves the rest of the key client-controlled.\n */\nexport function isValidUuidV4(value: string): boolean {\n\treturn UUID_V4_RE.test(value)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"makeOnboardingData.mjs","sourceRoot":"","sources":["../../src/lib/makeOnboardingData.mts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,IAAiB;IACnD,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAChE,CAAC","sourcesContent":["import { IOnboarding } from '@lib/MongoDB/IOnboarding.mjs'\n\nexport function makeOnboardingData(data: IOnboarding): string | null {\n\treturn data.onboardingDone ? (data.onboardingStep ?? '') : null\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setLoginCookies.mjs","sourceRoot":"","sources":["../../src/lib/setLoginCookies.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,2BAA6B;AAC3D,OAAO,EAAE,oBAAoB,EAAE,qBAAuB;AAEtD,MAAM,UAAU,eAAe,CAAC,GAAkB,EAAE,YAAoB;IACvE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,YAAY,EAAE;QAC9C,GAAG,mBAAmB;QACtB,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC,4BAA4B;KAChE,CAAC,CAAA;IACF,6BAA6B;AAC9B,CAAC","sourcesContent":["import { IContextLogin } from '@context/IContextLogin.mjs'\nimport { refreshTokenOptions } from '@lib/tokenOptions.mjs'\nimport { REFRESH_TOKEN_EXPIRY } from '@lib/tokens.mjs'\n\nexport function setLoginCookies(ctx: IContextLogin, refreshToken: string) {\n\tctx.cookies.set('refresh_token', refreshToken, {\n\t\t...refreshTokenOptions,\n\t\tmaxAge: REFRESH_TOKEN_EXPIRY * 1000 // maxAge is in milliseconds\n\t})\n\t// if remember me, generate ?\n}\n"]}
|
package/dist/lib/sleepMs.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sleepMs.mjs","sourceRoot":"","sources":["../../src/lib/sleepMs.mts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA","sourcesContent":["export const sleepMs = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwIfNotValidEnumValue.mjs","sourceRoot":"","sources":["../../src/lib/throwIfNotValidEnumValue.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,sDAA2C;AAE9E,MAAM,UAAU,wBAAwB,CACvC,OAAU,EACV,KAAgC;IAEhC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAwB,CAAC,CAAA;IACrE,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,MAAM,wBAAwB,CAAC,kBAAkB,CAAC,CAAA;IACnD,CAAC;AACF,CAAC","sourcesContent":["import { throwErrorWrongUserInput } from '@throw/throwErrorWrongUserInput.mjs'\n\nexport function throwIfNotValidEnumValue<T extends Record<string, string | number>>(\n\tenumObj: T,\n\tvalue: string | number | boolean\n): void {\n\tconst ret = Object.values(enumObj).includes(value as string | number)\n\tif (!ret) {\n\t\tthrow throwErrorWrongUserInput('Wrong enum value')\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokenOptions.mjs","sourceRoot":"","sources":["../../src/lib/tokenOptions.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,WAAW,GAAG;IACnB,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,KAAK,EAAE,4BAA4B;IAC3C,cAAc,EAAE,CAAC;CACjB,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,GAAG,WAAW;IACd,0BAA0B;CAC1B,CAAA;AACD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,GAAG,WAAW;IACd,+BAA+B;CAC/B,CAAA,CAAC,oBAAoB","sourcesContent":["import * as dotenv from 'dotenv'\n\ndotenv.config()\n\nconst baseOptions = {\n\thttpOnly: true,\n\tsameSite: 'Strict',\n\tsecure: false, // rewrite a true in Nginx !\n\texpirationDate: 0\n}\n\nexport const accessTokenOptions = {\n\t...baseOptions\n\t// path: '/resource-api',\n}\nexport const refreshTokenOptions = {\n\t...baseOptions\n\t// path: '/authorization-api',\n} /* c8 ignore next */\n"]}
|
package/dist/lib/tokens.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.mjs","sourceRoot":"","sources":["../../src/lib/tokens.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AAEnC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA,CAAC,UAAU;AAEhE,SAAS,aAAa;IACrB,OAAO,MAAM,EAAE,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,mBAAmB;IAClC,OAAO,aAAa,EAAE,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,oBAAoB;IACnC,OAAO,aAAa,EAAE,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB;IAChC,mEAAmE;IACnE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;IAC5B,2CAA2C;IAC3C,MAAM,YAAY,GAAG,MAAM,GAAG,EAAE,CAAA,CAAC,cAAc;IAC/C,kDAAkD;IAClD,MAAM,aAAa,GAAG,CAAC,YAAY,GAAG,EAAE,CAAC,GAAG,EAAE,CAAA;IAC9C,kDAAkD;IAClD,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;AACjC,CAAC","sourcesContent":["import { v4 as uuidv4 } from 'uuid'\n\nexport const REFRESH_TOKEN_EXPIRY = 90 * 24 * 60 * 60 // 90 days\n\nfunction generateToken() {\n\treturn uuidv4()\n}\n\nexport function generateAccessToken() {\n\treturn generateToken()\n}\n\nexport function generateRefreshToken() {\n\treturn generateToken()\n}\n\nexport function accessTokenExpiry() {\n\t// Generate a random number between 0 (inclusive) and 1 (exclusive)\n\tconst random = Math.random()\n\t// Scale it to the desired range (30 to 90)\n\tconst scaledRandom = random * 61 // 90 - 30 + 1\n\t// Shift it to start from 30 and switch to minutes\n\tconst shiftedRandom = (scaledRandom + 30) * 60\n\t// Floor the value to get an integer and return it\n\treturn Math.floor(shiftedRandom)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tryCatchRethrow.mjs","sourceRoot":"","sources":["../../src/lib/tryCatchRethrow.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,+CAAoC;AAChE,OAAO,EAAE,kBAAkB,EAAE,gDAAqC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,MAAM,UAAU,eAAe,CAAC,CAAuB;IACtD,eAAe,CAAC,CAAC,CAAC,CAAA;IAElB,kBAAkB;IAClB,IAAI,CAAC,YAAY,YAAY,EAAE,CAAC;QAC/B,uCAAuC;QACvC,MAAM,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,CAAA;QAChD,MAAM,IAAI,GAAI,CAAC,CAAC,UAAU,EAAE,WAAsB,IAAI,EAAE,CAAA;QACxD,MAAM,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACjD,CAAC;SAAM,CAAC;QACP,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;QAC1B,MAAM,kBAAkB,EAAE,CAAA;IAC3B,CAAC;AACF,CAAC","sourcesContent":["import * as Sentry from '@sentry/node'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\nimport { GraphQLError } from 'graphql'\n\nimport { throwIfMongoErr } from './MongoDB/throwIfMongoErr.mjs'\n\nexport function tryCatchRethrow(e: GraphQLError | Error) {\n\tthrowIfMongoErr(e)\n\n\t// else throw here\n\tif (e instanceof GraphQLError) {\n\t\t// @ts-expect-error status do not exist\n\t\tconst status = e.extensions?.http?.status || 500\n\t\tconst desc = (e.extensions?.description as string) || ''\n\t\tthrow throwGraphQLError(status, e.message, desc)\n\t} else {\n\t\tSentry.captureException(e)\n\t\tthrow throwInternalError()\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_validateMimeType.mjs","sourceRoot":"","sources":["../../../src/private/files/_validateMimeType.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,QAAgB,EAAE,gBAA0B,EAAmB,EAAE;IACxG,0CAA0C;IAC1C,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAA;IAEtD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAA,CAAC,kCAAkC;IACpF,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAA,CAAC,6BAA6B;IACtD,8EAA8E;IAC9E,IAAI,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,OAAO,QAAQ,CAAC,GAAG,CAAA;IACpB,CAAC;SAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACV,CAAC;AACF,CAAC,CAAA","sourcesContent":["/**\n * Utility function to validate MIME type via magic number\n * @param filePath\n * @param allowedMimeTypes\n */\nexport const _validateMimeType = async (filePath: string, allowedMimeTypes: string[]): Promise<string> => {\n\t// Dynamically import the file-type module\n\tconst { fileTypeFromFile } = await import('file-type')\n\n\tconst fileType = await fileTypeFromFile(filePath) // Get the file type from the file\n\tif (!fileType) return '' // Could not detect file type\n\t// Check if the detected MIME type is allowed and is so, return file extension\n\tif (allowedMimeTypes.includes(fileType.mime)) {\n\t\treturn fileType.ext\n\t} else {\n\t\treturn ''\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertNoTraversal.mjs","sourceRoot":"","sources":["../../../src/private/files/assertNoTraversal.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,IAAY;IAC5D,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,kBAAkB,CAAC,CAAA;IACnD,CAAC;AACF,CAAC","sourcesContent":["/**\n * Reject a path traversal attempt in a value that is interpolated into a filesystem path.\n *\n * Deliberately narrow: it rejects only a literal `..` path component, and still allows\n * separators, so a legitimate multi-segment value such as `2026/07` keeps working. A\n * stricter `path.basename()` would close more, but it silently rewrites `2026/07` to `07`\n * and would break published consumers — see the rule notes in .semgrep/koa-utils.yml.\n *\n * @param value the caller-supplied value\n * @param name parameter name, used in the error message\n */\nexport function assertNoTraversal(value: string, name: string) {\n\tif (value.split(/[\\\\/]/).includes('..')) {\n\t\tthrow new Error(`Invalid ${name}: path traversal`)\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reEncode.mjs","sourceRoot":"","sources":["../../../src/private/files/reEncode.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAClE,OAAO,EAAE,QAAQ,IAAI,EAAE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CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;QACzG,CAAC;IACF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAC5B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;IAC9C,CAAC;IAED,4FAA4F;IAC5F,wFAAwF;IACxF,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC;YACJ,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC1B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;YAC1B,MAAM,kBAAkB,EAAE,CAAA;QAC3B,CAAC;IACF,CAAC;IAED,OAAO,aAAa,CAAA;AACrB,CAAC","sourcesContent":["import * as Sentry from '@sentry/node'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\nimport { promises as fs } from 'fs'\nimport sharp, { FormatEnum } from 'sharp'\n\ntype AvailableFormatInf = 'jpeg' | 'png' | 'webp' | 'avif'\n\n/**\n * Re-encode the image to a specific format and remove all metadata (EXIF, etc.)\n * @param filePath\n * @param ext\n * @param quality\n */\nexport async function reEncode(filePath: string, ext: keyof FormatEnum | AvailableFormatInf, quality = 100) {\n\tconst finalFilepath = filePath.replace(/\\.[^.]+$/, `.${ext}`)\n\n\ttry {\n\t\t// Read the bytes up front: sharp refuses to use one file as both input and output, which is\n\t\t// exactly what happens when the source already carries the target extension.\n\t\tconst input = await fs.readFile(filePath)\n\n\t\tif (ext === 'jpeg') {\n\t\t\tawait sharp(input).jpeg({ quality, progressive: true }).withMetadata({}).withExif({}).toFile(finalFilepath)\n\t\t} else if (ext === 'png') {\n\t\t\tawait sharp(input).png({ quality, progressive: true }).withMetadata({}).withExif({}).toFile(finalFilepath)\n\t\t} else if (ext === 'webp') {\n\t\t\tawait sharp(input).webp({ quality, lossless: true }).withMetadata({}).withExif({}).toFile(finalFilepath)\n\t\t} else if (ext === 'avif') {\n\t\t\tawait sharp(input).avif({ quality, lossless: true }).withMetadata({}).withExif({}).toFile(finalFilepath)\n\t\t}\n\t} catch (err) {\n\t\tSentry.captureException(err)\n\t\tthrow new Error('Error processing the image')\n\t}\n\n\t// unlink the original only when the re-encoded image landed on a different path — comparing\n\t// extensions instead would delete the file just written whenever the two paths coincide\n\tif (finalFilepath !== filePath) {\n\t\ttry {\n\t\t\tawait fs.unlink(filePath)\n\t\t} catch (e) {\n\t\t\tSentry.captureException(e)\n\t\t\tthrow throwInternalError()\n\t\t}\n\t}\n\n\treturn finalFilepath\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Consts.mjs","sourceRoot":"","sources":["../../../src/private/graphQL/Consts.mts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAC7B,8GAA8G,CAAA;AAC/G,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAA","sourcesContent":["export const ERR_MISCONFIGURED =\n\t'We have misconfigured some services. Our technicians are already fixing the problem. Please try again later.'\nexport const ERR_OOPS = 'Oops'\n"]}
|