@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.
Files changed (220) hide show
  1. package/README.md +33 -5
  2. package/dist/graphQL/schema/mutations/emailChangeHashVerify.d.mts +7 -0
  3. package/dist/graphQL/schema/mutations/emailChangeHashVerify.mjs +38 -35
  4. package/dist/lib/access/accessPaths.d.mts +18 -0
  5. package/dist/lib/access/createMailThrottle.d.mts +34 -0
  6. package/dist/lib/access/createMailThrottle.mjs +45 -0
  7. package/dist/lib/access/createVerifyEmailFlow.d.mts +37 -4
  8. package/dist/lib/access/createVerifyEmailFlow.mjs +33 -10
  9. package/dist/lib/access/verifyEmailMailer.d.mts +54 -0
  10. package/dist/lib/access/verifyEmailMailer.mjs +48 -0
  11. package/dist/private/lib/access/assertVerifyEmailAllowed.d.mts +13 -1
  12. package/dist/private/lib/access/assertVerifyEmailAllowed.mjs +7 -4
  13. package/dist/private/lib/access/db/abandonUser.d.mts +25 -0
  14. package/dist/private/lib/access/db/abandonUser.mjs +26 -0
  15. package/dist/private/lib/access/db/deleteUserByEmail.d.mts +7 -0
  16. package/dist/private/lib/access/db/deleteUserByEmail.mjs +15 -4
  17. package/dist/private/lib/access/db/enableEmailAccess.d.mts +9 -1
  18. package/dist/private/lib/access/db/enableEmailAccess.mjs +11 -5
  19. package/dist/private/lib/access/handleBadDB.d.mts +11 -0
  20. package/dist/private/lib/access/handleBadDB.mjs +13 -1
  21. package/dist/private/lib/access/handleIfAccountDeleted.d.mts +16 -1
  22. package/dist/private/lib/access/handleIfAccountDeleted.mjs +16 -5
  23. package/dist/private/lib/access/handleIfAccountDisabled.d.mts +15 -1
  24. package/dist/private/lib/access/handleIfAccountDisabled.mjs +15 -5
  25. package/dist/private/lib/access/handleIfEmailAlreadyValid.d.mts +18 -1
  26. package/dist/private/lib/access/handleIfEmailAlreadyValid.mjs +18 -5
  27. package/dist/private/lib/access/handleIfHashBad.d.mts +5 -1
  28. package/dist/private/lib/access/handleIfHashBad.mjs +7 -5
  29. package/dist/private/lib/access/handleIfMoreThan3DaysPassed.d.mts +8 -4
  30. package/dist/private/lib/access/handleIfMoreThan3DaysPassed.mjs +10 -8
  31. package/dist/private/lib/access/handleIfTooMuchRequestsTimes.d.mts +7 -4
  32. package/dist/private/lib/access/handleIfTooMuchRequestsTimes.mjs +9 -8
  33. package/package.json +68 -18
  34. package/dist/dataSources/MariaDB.mjs.map +0 -1
  35. package/dist/dataSources/MongoDB.mjs.map +0 -1
  36. package/dist/dataSources/PostgreSQL.mjs.map +0 -1
  37. package/dist/dataSources/Redis.mjs.map +0 -1
  38. package/dist/email/SocketLabsLib.mjs.map +0 -1
  39. package/dist/files/IUploadTemp.mjs.map +0 -1
  40. package/dist/files/checkForNSFW.mjs.map +0 -1
  41. package/dist/files/fileConst.mjs.map +0 -1
  42. package/dist/files/moveFileStaticDomain.mjs.map +0 -1
  43. package/dist/files/moveImageFile.mjs.map +0 -1
  44. package/dist/files/moveTempFile.mjs.map +0 -1
  45. package/dist/files/reEncodeToJpeg.mjs.map +0 -1
  46. package/dist/files/reEncodeToPng.mjs.map +0 -1
  47. package/dist/files/reEncodeToWebp.mjs.map +0 -1
  48. package/dist/files/scanVirus.mjs.map +0 -1
  49. package/dist/files/storeUploadAsTemp.mjs.map +0 -1
  50. package/dist/files/uploadTempImage.mjs.map +0 -1
  51. package/dist/files/uploadTempPdf.mjs.map +0 -1
  52. package/dist/files/validateExtension.mjs.map +0 -1
  53. package/dist/files/validateJpgPngExtension.mjs.map +0 -1
  54. package/dist/files/validateMimeType.mjs.map +0 -1
  55. package/dist/files/validateMimeTypeImages.mjs.map +0 -1
  56. package/dist/files/validateMimeTypePdf.mjs.map +0 -1
  57. package/dist/files/validatePdfExtension.mjs.map +0 -1
  58. package/dist/graphQL/models/MongoDB/UserBase.mjs.map +0 -1
  59. package/dist/graphQL/models/MongoDB/log/DevStatsGraphQLCalls.mjs.map +0 -1
  60. package/dist/graphQL/models/MongoDB/log/LogGlobalError.mjs.map +0 -1
  61. package/dist/graphQL/models/MongoDB/log/LogStatsGraphql.mjs.map +0 -1
  62. package/dist/graphQL/models/MongoDB/log/LogThrow.mjs.map +0 -1
  63. package/dist/graphQL/schema/GraphQLInput/GraphQLInputLogin.mjs.map +0 -1
  64. package/dist/graphQL/schema/context/IContextAuthenticatedResource.mjs.map +0 -1
  65. package/dist/graphQL/schema/context/IContextKoaErrorHandler.mjs.map +0 -1
  66. package/dist/graphQL/schema/context/IContextLogin.mjs.map +0 -1
  67. package/dist/graphQL/schema/context/IContextLogout.mjs.map +0 -1
  68. package/dist/graphQL/schema/context/IContextRefresh.mjs.map +0 -1
  69. package/dist/graphQL/schema/context/TCommonHeaders.mjs.map +0 -1
  70. package/dist/graphQL/schema/interfaces/IFindAndUpdate.mjs.map +0 -1
  71. package/dist/graphQL/schema/mutations/emailChangeHashVerify.mjs.map +0 -1
  72. package/dist/graphQL/schema/mutations/login4Ever.mjs.map +0 -1
  73. package/dist/graphQL/schema/mutations/loginAdmin.mjs.map +0 -1
  74. package/dist/graphQL/schema/mutations/loginRememberme.mjs.map +0 -1
  75. package/dist/graphQL/schema/mutations/logout.mjs.map +0 -1
  76. package/dist/graphQL/schema/mutations/refresh.mjs.map +0 -1
  77. package/dist/graphQL/schema/mutations/resetPwd.mjs.map +0 -1
  78. package/dist/graphQL/schema/mutations/signUp.mjs.map +0 -1
  79. package/dist/graphQL/schema/mutations/updatePassword.mjs.map +0 -1
  80. package/dist/graphQL/schema/types/DeleteType.mjs.map +0 -1
  81. package/dist/graphQL/schema/types/DoneType.mjs.map +0 -1
  82. package/dist/graphQL/schema/types/FindOneAndUpdateType.mjs.map +0 -1
  83. package/dist/graphQL/schema/types/LoginAppType.mjs.map +0 -1
  84. package/dist/graphQL/schema/types/LoginType.mjs.map +0 -1
  85. package/dist/graphQL/schema/types/MidNameType.mjs.map +0 -1
  86. package/dist/graphQL/schema/types/OnlyIdType.mjs.map +0 -1
  87. package/dist/graphQL/schema/types/RefreshType.mjs.map +0 -1
  88. package/dist/graphQL/schema/types/RetStatusMexType.mjs.map +0 -1
  89. package/dist/graphQL/schema/types/RetStatusType.mjs.map +0 -1
  90. package/dist/graphQL/schema/types/SaveType.mjs.map +0 -1
  91. package/dist/graphQL/schema/types/SidNameType.mjs.map +0 -1
  92. package/dist/graphQL/schema/types/SidNomeType.mjs.map +0 -1
  93. package/dist/graphQL/schema/types/UpdateResultType.mjs.map +0 -1
  94. package/dist/graphQL/status.mjs.map +0 -1
  95. package/dist/graphQL/throw/throwAccessTokenExpiredOrDeleted.mjs.map +0 -1
  96. package/dist/graphQL/throw/throwAccessTokenRequired.mjs.map +0 -1
  97. package/dist/graphQL/throw/throwAlreadyDone.mjs.map +0 -1
  98. package/dist/graphQL/throw/throwAlreadyTakenError.mjs.map +0 -1
  99. package/dist/graphQL/throw/throwConflictError.mjs.map +0 -1
  100. package/dist/graphQL/throw/throwErrorWrongUserInput.mjs.map +0 -1
  101. package/dist/graphQL/throw/throwForbiddenError.mjs.map +0 -1
  102. package/dist/graphQL/throw/throwGoneError.mjs.map +0 -1
  103. package/dist/graphQL/throw/throwGraphQLError.mjs.map +0 -1
  104. package/dist/graphQL/throw/throwInternalError.mjs.map +0 -1
  105. package/dist/graphQL/throw/throwMethodNotAllowedError.mjs.map +0 -1
  106. package/dist/graphQL/throw/throwMissingMalformedInvalidToken.mjs.map +0 -1
  107. package/dist/graphQL/throw/throwNotAcceptableError.mjs.map +0 -1
  108. package/dist/graphQL/throw/throwNotFoundError.mjs.map +0 -1
  109. package/dist/graphQL/throw/throwNotImplementedError.mjs.map +0 -1
  110. package/dist/graphQL/throw/throwPaymentRequiredError.mjs.map +0 -1
  111. package/dist/graphQL/throw/throwPreconditionFailedNoAuthCookie.mjs.map +0 -1
  112. package/dist/graphQL/throw/throwPreconditionFailedNoAuthHeader.mjs.map +0 -1
  113. package/dist/graphQL/throw/throwRefreshTokenExpiredOrDeleted.mjs.map +0 -1
  114. package/dist/graphQL/throw/throwRefreshTokenRequired.mjs.map +0 -1
  115. package/dist/graphQL/throw/throwRefreshTokenSignatureRequired.mjs.map +0 -1
  116. package/dist/graphQL/throw/throwTooManyRequestsError.mjs.map +0 -1
  117. package/dist/graphQL/throw/throwUnauthorizedError.mjs.map +0 -1
  118. package/dist/graphQL/throw/throwUnprocessableContentError.mjs.map +0 -1
  119. package/dist/graphQL/throw/throwUnsupportedMediaTypeError.mjs.map +0 -1
  120. package/dist/koa/IFileUpload.mjs.map +0 -1
  121. package/dist/koa/IKoaError.mjs.map +0 -1
  122. package/dist/koa/customFormatErrorFn.mjs.map +0 -1
  123. package/dist/koa/logRequestToDb.mjs.map +0 -1
  124. package/dist/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.mjs.map +0 -1
  125. package/dist/koa/middleware/authenticatedAuthorizationHandler/index.mjs.map +0 -1
  126. package/dist/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs.map +0 -1
  127. package/dist/koa/middleware/authenticatedLogoutHandler/index.mjs.map +0 -1
  128. package/dist/koa/middleware/authenticatedResourceHandler/index.mjs.map +0 -1
  129. package/dist/koa/middleware/debug/index.mjs.map +0 -1
  130. package/dist/koa/router/verifyEmail.mjs.map +0 -1
  131. package/dist/koa/tdwKoaErrorHandler.mjs.map +0 -1
  132. package/dist/lib/ArrayLib.mjs.map +0 -1
  133. package/dist/lib/Constants.mjs.map +0 -1
  134. package/dist/lib/DateLib.mjs.map +0 -1
  135. package/dist/lib/IAuthorizationDisDel.mjs.map +0 -1
  136. package/dist/lib/ICookies.mjs.map +0 -1
  137. package/dist/lib/MariaDB/IMariaDBErr.mjs.map +0 -1
  138. package/dist/lib/MariaDB/MariaDBErrType.mjs.map +0 -1
  139. package/dist/lib/MariaDB/throwSqlErrors.mjs.map +0 -1
  140. package/dist/lib/MongoDB/IMongoDBError.mjs.map +0 -1
  141. package/dist/lib/MongoDB/IOnboarding.mjs.map +0 -1
  142. package/dist/lib/MongoDB/MongoDBErrType.mjs.map +0 -1
  143. package/dist/lib/MongoDB/throwIfMongoErr.mjs.map +0 -1
  144. package/dist/lib/MongoDB/throwMongoErrors.mjs.map +0 -1
  145. package/dist/lib/NumLib.mjs.map +0 -1
  146. package/dist/lib/PostgreSQL/IPostgresError.mjs.map +0 -1
  147. package/dist/lib/PostgreSQL/IPostgresErrorCodes.mjs.map +0 -1
  148. package/dist/lib/PostgreSQL/makePostgreSqlLogError.mjs.map +0 -1
  149. package/dist/lib/Redis/RedisBoolean.mjs.map +0 -1
  150. package/dist/lib/Redis/buildPrefixedRedisKey.mjs.map +0 -1
  151. package/dist/lib/Redis/fromRedisBooleanValue.mjs.map +0 -1
  152. package/dist/lib/Redis/toRedisBooleanValue.mjs.map +0 -1
  153. package/dist/lib/StringLib.mjs.map +0 -1
  154. package/dist/lib/access/accessPaths.mjs.map +0 -1
  155. package/dist/lib/access/createResetPwdFlow.mjs.map +0 -1
  156. package/dist/lib/access/createVerifyEmailFlow.mjs.map +0 -1
  157. package/dist/lib/checkEmailLen.mjs.map +0 -1
  158. package/dist/lib/checkPwdLen.mjs.map +0 -1
  159. package/dist/lib/db/log/hitStat.mjs.map +0 -1
  160. package/dist/lib/db/log/logGlobalError.mjs.map +0 -1
  161. package/dist/lib/db/log/logGraphql.mjs.map +0 -1
  162. package/dist/lib/db/log/logThrow.mjs.map +0 -1
  163. package/dist/lib/db/login/ILoginSet.mjs.map +0 -1
  164. package/dist/lib/db/login/ILoginUnset.mjs.map +0 -1
  165. package/dist/lib/db/registerNewUser.mjs.map +0 -1
  166. package/dist/lib/db/userExist.mjs.map +0 -1
  167. package/dist/lib/emailHash.mjs.map +0 -1
  168. package/dist/lib/encryptPassword.mjs.map +0 -1
  169. package/dist/lib/hash.mjs.map +0 -1
  170. package/dist/lib/isSafeRedirectTarget.mjs.map +0 -1
  171. package/dist/lib/isSessionBlocked.mjs.map +0 -1
  172. package/dist/lib/isValidUuidV4.mjs.map +0 -1
  173. package/dist/lib/makeOnboardingData.mjs.map +0 -1
  174. package/dist/lib/setLoginCookies.mjs.map +0 -1
  175. package/dist/lib/sleepMs.mjs.map +0 -1
  176. package/dist/lib/throwIfNotValidEnumValue.mjs.map +0 -1
  177. package/dist/lib/tokenOptions.mjs.map +0 -1
  178. package/dist/lib/tokens.mjs.map +0 -1
  179. package/dist/lib/tryCatchRethrow.mjs.map +0 -1
  180. package/dist/private/files/_validateMimeType.mjs.map +0 -1
  181. package/dist/private/files/assertNoTraversal.mjs.map +0 -1
  182. package/dist/private/files/reEncode.mjs.map +0 -1
  183. package/dist/private/graphQL/Consts.mjs.map +0 -1
  184. package/dist/private/graphQL/models/MongoDB/private/UserAdminKoaUtils.mjs.map +0 -1
  185. package/dist/private/graphQL/schema/context/IContextLog.mjs.map +0 -1
  186. package/dist/private/graphQL/schema/context/IContextVerifyEmail.mjs.map +0 -1
  187. package/dist/private/graphQL/schema/mutations/_buildLoginStatsUpdate.mjs.map +0 -1
  188. package/dist/private/graphQL/schema/mutations/_finalizeLoginCheck.mjs.map +0 -1
  189. package/dist/private/graphQL/schema/mutations/checkUserAdminLoginAuthorization.mjs.map +0 -1
  190. package/dist/private/graphQL/schema/mutations/checkUserLoginAuthorization.mjs.map +0 -1
  191. package/dist/private/graphQL/schema/mutations/infoUserAdminForLogin.mjs.map +0 -1
  192. package/dist/private/graphQL/schema/mutations/infoUserForLogin.mjs.map +0 -1
  193. package/dist/private/graphQL/schema/mutations/infoUserForLoginSQL.mjs.map +0 -1
  194. package/dist/private/graphQL/schema/mutations/setLastLoginSQL.mjs.map +0 -1
  195. package/dist/private/graphQL/schema/mutations/setRedisLoginSession.mjs.map +0 -1
  196. package/dist/private/graphQL/schema/mutations/updateAdminLoginStats.mjs.map +0 -1
  197. package/dist/private/graphQL/schema/mutations/updateLoginStats4ever.mjs.map +0 -1
  198. package/dist/private/graphQL/schema/mutations/updateLoginStatsRememberme.mjs.map +0 -1
  199. package/dist/private/lib/access/Constants.mjs.map +0 -1
  200. package/dist/private/lib/access/assertVerifyEmailAllowed.mjs.map +0 -1
  201. package/dist/private/lib/access/db/confirmNewEmail.mjs.map +0 -1
  202. package/dist/private/lib/access/db/deleteUserByEmail.mjs.map +0 -1
  203. package/dist/private/lib/access/db/enableEmailAccess.mjs.map +0 -1
  204. package/dist/private/lib/access/db/getResetPwd.mjs.map +0 -1
  205. package/dist/private/lib/access/db/incReqTimes.mjs.map +0 -1
  206. package/dist/private/lib/access/db/removeResetReq.mjs.map +0 -1
  207. package/dist/private/lib/access/db/saveResetReq.mjs.map +0 -1
  208. package/dist/private/lib/access/db/setEmailHash.mjs.map +0 -1
  209. package/dist/private/lib/access/db/updatePasswordDb.mjs.map +0 -1
  210. package/dist/private/lib/access/db/userData4VerifyEmail.mjs.map +0 -1
  211. package/dist/private/lib/access/handleBadDB.mjs.map +0 -1
  212. package/dist/private/lib/access/handleIfAccountDeleted.mjs.map +0 -1
  213. package/dist/private/lib/access/handleIfAccountDisabled.mjs.map +0 -1
  214. package/dist/private/lib/access/handleIfEmailAlreadyValid.mjs.map +0 -1
  215. package/dist/private/lib/access/handleIfHashBad.mjs.map +0 -1
  216. package/dist/private/lib/access/handleIfMoreThan3DaysPassed.mjs.map +0 -1
  217. package/dist/private/lib/access/handleIfTooMuchRequestsTimes.mjs.map +0 -1
  218. package/dist/private/lib/access/pathTools.mjs.map +0 -1
  219. package/dist/private/lib/makeBodyJson.mjs.map +0 -1
  220. package/dist/private/lib/verifyIntrospectionCode.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"PostgreSQL.mjs","sourceRoot":"","sources":["../../src/dataSources/PostgreSQL.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;AAE3B,MAAM,CAAC,M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'\nimport pg from 'pg'\n\nconst { Client, Pool } = pg\n\ndotenv.config()\n\nexport const pgClient = new Client({\n\tuser: `${process.env.POSTGRESQL_USER}`,\n\tpassword: `${process.env.POSTGRESQL_PWD}`,\n\thost: `${process.env.POSTGRESQL_HOST}`,\n\tport: parseInt(`${process.env.POSTGRESQL_PORT}`, 10),\n\tdatabase: `${process.env.POSTGRESQL_DBNAME}`\n})\n\nexport const pgPool = new Pool({\n\tuser: `${process.env.POSTGRESQL_USER}`,\n\tpassword: `${process.env.POSTGRESQL_PWD}`,\n\thost: `${process.env.POSTGRESQL_HOST}`,\n\tport: parseInt(`${process.env.POSTGRESQL_PORT}`, 10),\n\tdatabase: `${process.env.POSTGRESQL_DBNAME}`,\n\tmax: parseInt(`${process.env.POSTGRESQL_POOL_MAX}`, 10),\n\tidleTimeoutMillis: parseInt(`${process.env.POSTGRESQL_IDLE_TIMEOUT}`, 10)\n})\n\n// the pool will emit an error on behalf of any idle clients\n// it contains if a backend error or network partition happens\n/* c8 ignore start -- idle-client error path: requires live pg backend partition, not unit-testable */\npgPool.on('error', (err) => {\n\tconsole.error('Unexpected error on idle client', err)\n\tprocess.exit(-1)\n})\n/* c8 ignore stop */\n\n/*************************\n * Client, for transaction and single connection\n */\n\n// Setting up a connection\nexport const PostgreSQLClientConnect = async () => {\n\tconsole.info('[PostgreSQL Client] Try connect to database... ')\n\n\ttry {\n\t\tawait pgClient.connect()\n\n\t\t// Attach an error listener only once\n\t\tif (!pgClient.listenerCount('error')) {\n\t\t\tpgClient.on('error', (e) => {\n\t\t\t\tconst catchMex = '[PostgreSQL Client] something bad has happened!'\n\t\t\t\tSentry.captureException(e, {\n\t\t\t\t\textra: { detail: catchMex }\n\t\t\t\t})\n\t\t\t\tconsole.error(catchMex)\n\t\t\t})\n\t\t}\n\t\tif (!pgClient.listenerCount('notification')) {\n\t\t\tpgClient.on('notification', (msg) => {\n\t\t\t\tconsole.info('[PostgreSQL Client]', msg.channel)\n\t\t\t\tconsole.info('[PostgreSQL Client]', msg.payload)\n\t\t\t\tSentry.captureMessage(`[PostgreSQL Client] notification: ${msg}`, {\n\t\t\t\t\tlevel: 'warning',\n\t\t\t\t\textra: {\n\t\t\t\t\t\tchannel: msg.channel,\n\t\t\t\t\t\tpayload: msg.payload\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t\t// https://www.postgresql.org/docs/9.6/static/plpgsql-errors-and-messages.html\n\t\tif (!pgClient.listenerCount('notice')) {\n\t\t\tpgClient.on('notice', (msg) => {\n\t\t\t\tSentry.captureMessage(`[PostgreSQL Client] notice: ${msg}`, 'warning')\n\t\t\t})\n\t\t}\n\t\tconsole.info('[PostgreSQL Client] OK: PostgreSQL connection has been established successfully.')\n\t} catch (error) {\n\t\tthrow {\n\t\t\tmessage: '[PostgreSQL Client] FAIL: Unable to connect to the database: ' + error,\n\t\t\tshutdown: true\n\t\t}\n\t}\n}\n\nexport const PostgreSQLClientDisconnect = async () => {\n\tconsole.info('[PostgreSQL Client] Try close connection to database... ')\n\ttry {\n\t\tawait pgClient.end()\n\t\tconsole.info('[PostgreSQL Client] OK: PostgreSQL connection has been closed successfully.')\n\t} catch (error) {\n\t\tthrow {\n\t\t\tmessage: '[PostgreSQL Client] FAIL: Unable to close the database connection: ' + error,\n\t\t\tshutdown: true\n\t\t}\n\t}\n}\n\n/*************************\n * Pool\n *\n * -- USE WITH --\n *\n * const pgPoolClient = await pgPool.connect()\n * your queries.. await client.query('YOUR_QUERY')\n * pgPoolClient.release()\n */\n\nexport const PostgreSQLPoolDisconnect = async () => {\n\tconsole.log('[PostgreSQL Pool] Try close connection to database... ')\n\ttry {\n\t\tawait pgPool.end()\n\t\tconsole.info('[PostgreSQL Pool] OK: PostgreSQL connection has been closed successfully.')\n\t} catch (error) {\n\t\tthrow {\n\t\t\tmessage: '[PostgreSQL Pool] FAIL: Unable to close the database connection: ' + error,\n\t\t\tshutdown: true\n\t\t}\n\t}\n}\n"]}
@@ -1 +0,0 @@
1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AAC,CAAC,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;IACF,MAAM,WAAW,CAAC,OAAO,EAAE,CAAA;IAC3B,OAAO,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAA;AACjF,CAAC,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACpC,OAAO,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAA;IAC5D,IAAI,CAAC;QACJ,MAAM,WAAW,CAAC,KAAK,EAAE,CAAA,CAAC,kDAAkD;QAC5E,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAA;IAC3E,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,OAAO,KAAK,sBAAsB,EAAE,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAA;YACjD,OAAM,CAAC,iDAAiD;QACzD,CAAC;QACD,yCAAyC;QACzC,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACnD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;QAC1B,MAAM,CAAC,CAAA;IACR,CAAC;AACF,CAAC","sourcesContent":["import * as Sentry from '@sentry/node'\nimport * as dotenv from 'dotenv'\nimport { createClient, createCluster } from 'redis'\n\ndotenv.config()\n\nexport const redisClient =\n\tprocess.env.REDIS_IS_CLUSTER === '1'\n\t\t? /* c8 ignore start -- cluster branch: requires REDIS_IS_CLUSTER=1 + 3 redis nodes, not in unit env */\n\t\t\tcreateCluster({\n\t\t\t\trootNodes: [\n\t\t\t\t\t{ url: `redis://${process.env.REDIS_DB1_HOST}:${process.env.REDIS_DB1_PORT}` },\n\t\t\t\t\t{ url: `redis://${process.env.REDIS_DB2_HOST}:${process.env.REDIS_DB2_PORT}` },\n\t\t\t\t\t{ url: `redis://${process.env.REDIS_DB3_HOST}:${process.env.REDIS_DB3_PORT}` }\n\t\t\t\t],\n\t\t\t\tdefaults: {\n\t\t\t\t\tusername: process.env.REDIS_USERNAME,\n\t\t\t\t\tpassword: process.env.REDIS_PASSWORD\n\t\t\t\t}\n\t\t\t})\n\t\t: /* c8 ignore stop */\n\t\t\tcreateClient({ url: process.env.REDIS_URL })\n\nexport const RedisConnect = async () => {\n\tconsole.info('[Redis] Try connect to database... ')\n\n\tredisClient.on('error', (e) => {\n\t\tconsole.error('Redis Client Error')\n\t\tSentry.captureException(e)\n\t})\n\tawait redisClient.connect()\n\tconsole.info('[Redis] OK: Redis connection has been established successfully. ')\n}\n\nexport async function RedisDisconnect() {\n\tconsole.info('[Redis] Try close connection to database... ')\n\ttry {\n\t\tawait redisClient.close() // Gracefully close a client's connection to Redis\n\t\tconsole.info('[Redis] OK: Redis connection has been closed successfully.')\n\t} catch (e) {\n\t\tif (e instanceof Error && e.message === 'The client is closed') {\n\t\t\tconsole.info('[Redis] Client was already closed')\n\t\t\treturn // Continue execution if client is already closed\n\t\t}\n\t\t// For any other errors, log and re-throw\n\t\tconsole.error('[Redis] Error during disconnection')\n\t\tSentry.captureException(e)\n\t\tthrow e\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SocketLabsLib.mjs","sourceRoot":"","sources":["../../src/email/SocketLabsLib.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,6BAA0B;AAC9C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,gDAAqC;AAClE,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,CAAC,MAAM,EAAE,CAAA;AAmBf,MAAM,OAAO,aAAa;IACjB,SAAS,CAAW;IACX,YAAY,CAAQ;IACpB,QAAQ,CAAQ;IAChB,SAAS,CAAQ;IAClC,8DAA8D;IACtD,MAAM,CAAK;IACF,gBAAgB,CAAQ;IACxB,gBAAgB,C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,CAAA;IACrC,CAAC;CACD","sourcesContent":["import { StringLib } from '@lib/StringLib.mjs'\nimport * as Sentry from '@sentry/node'\nimport { BasicMessage, SocketLabsClient } from '@socketlabs/email'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\nimport * as dotenv from 'dotenv'\n\ndotenv.config()\n\ninterface ISendEmail {\n\temailFrom: string\n\temailFromName: string\n\temailTo: string\n\tsubject: string\n\ttextBody: string\n\thtmlBody: string\n}\n\ninterface IUserInfo {\n\t_id: string\n\tpersonalData: {\n\t\tname: string\n\t\tsurname: string\n\t}\n}\n\nexport class SocketLabsLib {\n\tprivate StringObj: StringLib\n\tprivate readonly platformName: string\n\tprivate readonly linkBase: string\n\tprivate readonly emailFrom: string\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate client: any\n\tprivate readonly emailHtmlHeader1: string\n\tprivate readonly emailHtmlHeader2: string\n\tprivate readonly emailHtmlFooter: string\n\n\tconstructor(htmlHeader1: string = '', htmlHeader2: string = '', htmlFooter: string = '') {\n\t\tthis.client = new SocketLabsClient(\n\t\t\t/* c8 ignore next -- env fallback '0' covered only when SOCKETLABS_SERVER_ID is unset */\n\t\t\tparseInt(process.env.SOCKETLABS_SERVER_ID || '0'),\n\t\t\t`${process.env.SOCKETLABS_SERVER_APIKEY}`,\n\t\t\t{ requestTimeout: 120, numberOfRetries: 3 }\n\t\t)\n\t\tthis.StringObj = new StringLib()\n\t\tthis.platformName = `${process.env.PLATFORM_NAME}`\n\t\tthis.linkBase = `${process.env.APP_DOMAIN}`\n\t\tthis.emailFrom = `${process.env.EMAIL_FROM}`\n\n\t\tthis.emailHtmlHeader1 = htmlHeader1 === '' ? this.htmlHeader1() : htmlHeader1\n\t\tthis.emailHtmlHeader2 = htmlHeader2 === '' ? this.htmlHeader2() : htmlHeader2\n\t\tthis.emailHtmlFooter = htmlFooter === '' ? this.htmlFooter() : htmlFooter\n\t}\n\n\tasync sendEmailVerify(emailTo: string, hash: string, name: string = '') {\n\t\tconst subject = `Confirm your email for ${this.platformName}`\n\t\tconst encodedEmail = encodeURI(emailTo)\n\t\tconst nameFixed = this.fixName(name)\n\t\tconst link = `${this.linkBase}/check/verify-email/${encodedEmail}/${hash}`\n\t\tconst linkHtml = this.StringObj.makeLink(link)\n\n\t\tconst messageTxt = `Hi${nameFixed}, you or someone else is registering you on ${this.platformName}.\n You can confirm the registration by copying this link ${link} into your browser. The Team`\n\t\tconst messageHtml = `Hi${nameFixed},<br>you or someone else is registering you on ${this.platformName}.<br><br>\n You can confirm the registration by visiting this link ${linkHtml}<br><br>\n <br><br>The Team`\n\n\t\treturn await this.sendTemplate(emailTo, subject, messageTxt, messageHtml)\n\t}\n\n\t/*\n async sendEmailPostReported(userInfo, idPost) {\n const subject = 'Post ' + idPost + ' reported'\n\n const messageTxt =\n 'Hello, post ' +\n idPost +\n ' has been reported by ' +\n userInfo.personalData.name +\n ' ' +\n userInfo.personalData.surname +\n ' (id: ' +\n userInfo._id +\n ').'\n\n const messageHtml =\n this.getHtmlHeader(subject) +\n 'Hello, post ' +\n idPost +\n ' has been reported by ' +\n userInfo.personalData.name +\n ' ' +\n userInfo.personalData.surname +\n ' (id: ' +\n userInfo._id +\n ').' +\n this.getHtmlFooter()\n\n const message = {\n emailFrom: this.emailFrom,\n emailFromName: this.platformName,\n emailTo: 'dummy@example.com',\n subject,\n textBody: messageTxt,\n htmlBody: messageHtml\n }\n return await this.sendEmail(message)\n }\n*/\n\t/**\n\t * @fixme handle retry\n\t *\nstatusCode: ECONNABORTED\nError in sending the email\nSendResponse {\n transactionReceipt: null,\n addressResults: null,\n result: {\n name: 'Timeout',\n value: 1,\n message: 'A timeout occurred sending the message'\n },\n responseMessage: 'A timeout occurred sending the message'\n}\n\t */\n\n\tasync sendEmailChangeVerify(emailTo: string, hash: string, name: string = '') {\n\t\tconst encodedEmail = encodeURI(emailTo)\n\t\tconst subject = `Confirm your email for ${this.platformName}`\n\t\tconst nameFixed = this.fixName(name)\n\t\tconst link = `${this.linkBase}/check/verify-change-email/${encodedEmail}/${hash}`\n\t\tconst linkHtml = this.StringObj.makeLink(link)\n\n\t\tconst messageTxt = `Hi${nameFixed}, you or someone else has changed the email you sign in with.\n You can confirm by copying this link ${link} into your browser. The Team.`\n\n\t\tconst messageHtml = `Hi${nameFixed},<br>you or someone else has changed the email you sign in with.<br><br>\n You can confirm the registration by visiting this link ${linkHtml}\n <br><br>The Team.`\n\n\t\treturn await this.sendTemplate(emailTo, subject, messageTxt, messageHtml)\n\t}\n\n\tasync sendWelcome(emailTo: string) {\n\t\tconst subject = `Welcome to ${this.platformName}`\n\t\tconst linkHtml = this.StringObj.makeLink(this.linkBase, this.platformName)\n\t\tconst messageTxt = `Welcome to ${this.platformName}`\n\t\tconst messageHtml = `Welcome to ${linkHtml}`\n\n\t\treturn await this.sendTemplate(emailTo, subject, messageTxt, messageHtml)\n\t}\n\n\t/**\n\t * Send account disabled notification\n\t * @param emailTo\n\t */\n\tasync accountDisabled(emailTo: string) {\n\t\tconst subject = 'Your account has been disabled'\n\t\tconst textBody = 'Hi, we are sorry but your account has been disabled. Contact us for more information.'\n\t\tconst htmlBody = `<p>${textBody}</p>`\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\t/**\n\t * Send account disabled notification\n\t * @param emailTo\n\t */\n\tasync accountBanned(emailTo: string) {\n\t\tconst subject = 'Your account has been banned'\n\t\tconst textBody = 'Hi, we are sorry but your account has been banned. Contact us for more information.'\n\t\tconst htmlBody = `<p>${textBody}</p>`\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\t/**\n\t * alertDevTeam\n\t * @param err\n\t */\n\tasync alertDevTeam(err: string) {\n\t\tconst textBody = 'error 500 ' + err\n\t\tconst htmlBody = '<p>error 500 <br><br>' + err + '</p>'\n\n\t\treturn await this.sendTemplate(`${process.env.DEV_TEAM_EMAIL}`, `${this.platformName} error 500`, textBody, htmlBody)\n\t}\n\n\t/**\n\t *\n\t * @param emailTo\n\t * @param times\n\t */\n\tasync wrongHash(emailTo: string, times: number) {\n\t\tif (times > 5) throwInternalError()\n\t\tconst remainingTimes = 5 - times\n\n\t\tconst subject = 'Wrong activation link'\n\t\tconst textBody = `Hi, you or someone else is trying to verify your email with a wrong link. You have ${remainingTimes} attempts remaining.`\n\t\tconst htmlBody = `<p>${textBody}</p>`\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\t/*****************\n\t * Too much verify requests\n\t * @param emailTo\n\t * @returns {Promise<string|null>}\n\t */\n\tasync tooMuchVerifyRequests(emailTo: string) {\n\t\tconst subject = 'Too many attempts to verify your email'\n\t\tconst textBody = 'Hi, you have made more than 5 attempts to verify your email. You need to repeat the registration request.'\n\t\tconst htmlBody =\n\t\t\t'<p>Hi, you have made 5 or more attempts to verify your email. You need to repeat the registration request.</p>'\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\t/*****************\n\t * @param emailTo\n\t * @returns {Promise<string|null>}\n\t */\n\tasync hashReqTooOld(emailTo: string) {\n\t\tconst subject = 'Activation link expired'\n\t\tconst textBody =\n\t\t\t'Hi, the activation link you are trying to use is older than 3 days and has expired. You need to repeat the registration request.'\n\t\tconst htmlBody =\n\t\t\t'<p>Hi, the activation link you are trying to use is older than 3 days and has expired. You need to repeat the registration request.</p>'\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\t/*****************\n\t * @param emailTo\n\t * @returns {Promise<string|null>}\n\t */\n\tasync emailAlreadyValid(emailTo: string) {\n\t\tconst subject = 'Account already valid'\n\t\tconst textBody = 'Hi, your account is already valid, you can log in.'\n\t\tconst htmlBody = `<p>${textBody}</p>`\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\t/**\n\t * Send subscription email\n\t * @param emailTo\n\t * @param otp\n\t */\n\tasync sendSubscriptionEmail(emailTo: string, otp: string) {\n\t\tconst subject = `Activate your ${this.platformName} account`\n\t\tconst url = `${this.linkBase}/x/emailVerify`\n\t\tconst urlHtml = this.StringObj.makeLink(url)\n\t\tconst linkHomeHtml = this.StringObj.makeLink(this.linkBase, this.platformName)\n\n\t\tconst textBody = `To confirm your subscription on ${this.platformName}, open the following link in your browser\n ${url} and enter the following activation code: ${otp}`\n\n\t\tconst htmlBody = `<p>To confirm your subscription on ${linkHomeHtml}, open the following link in your browser\n ${urlHtml} and enter the following activation code: ${otp}</p>`\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\tasync sendResetPwdConfirmation(emailTo: string, name: string = '') {\n\t\tconst subject = `Password reset for ${this.platformName}`\n\t\tconst link = this.linkBase\n\t\tconst linkHtml = this.StringObj.makeLink(link, this.platformName)\n\t\tconst nameFixed = this.fixName(name)\n\n\t\tconst textBody = `Hi${nameFixed}, you have confirmed your new password. You can now log in at: ${link}. The Team.`\n\t\tconst htmlBody = `Hi${nameFixed},<br>you have confirmed your new password.<br><br>You can now log in at:<br>${linkHtml}<br><br>The Team.`\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\tasync sendResetPwdConfirmationHash(email: string, name: string, hash: string): Promise<boolean> {\n\t\tconst encodedEmail = encodeURI(email)\n\t\tconst subject = `Password change confirmation for ${this.platformName}`\n\t\tconst linkReset = this.linkBase + '/index.php?q=reset&hash=' + hash + '&email=' + encodedEmail\n\n\t\tconst textBody = 'Hi ' + name + ', you have confirmed your new password. You can now log in at: ' + this.linkBase + ' . '\n\t\tconst htmlBody =\n\t\t\tthis.getHtmlHeader(subject) +\n\t\t\t'Hi ' +\n\t\t\tname +\n\t\t\t',<br>you have confirmed your new password.<br><br>You can now log in at:<br> ' +\n\t\t\tthis.StringObj.makeLink(linkReset) +\n\t\t\t'<br><br>The Team' +\n\t\t\tthis.getHtmlFooter()\n\n\t\ttry {\n\t\t\treturn await this.sendTemplate(email, subject, textBody, htmlBody)\n\t\t} catch (e) {\n\t\t\tSentry.captureException(e)\n\t\t\treturn false\n\t\t}\n\t}\n\n\tasync sendEmailReset(emailTo: string, hash: string, name: string = '') {\n\t\tconst subject = `Password reset for ${this.platformName}`\n\t\tconst encodedEmail = encodeURI(emailTo)\n\t\tconst link = `${this.linkBase}/x/reset/${encodedEmail}/${hash}`\n\t\tconst linkHtml = this.StringObj.makeLink(link)\n\t\tconst nameFixed = this.fixName(name)\n\n\t\tconst textBody = `Hi${nameFixed}, you or someone else has requested a password reset. You can change your login password\n by copying this link ${link} into your browser. The Team.`\n\t\tconst htmlBody = `Hi${nameFixed},<br>you or someone else has requested a password reset.<br><br>\n You can change your password by clicking the link:<br>${linkHtml}\n <br><br>The Team.`\n\n\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t}\n\n\t/**\n\t * fallback footer\n\t */\n\thtmlFooter() {\n\t\treturn '</p></td>' + ' </tr>' + ' </table>' + '</body>'\n\t}\n\n\t/**\n\t * send OTP\n\t * @param emailTo\n\t * @param otp\n\t */\n\tasync sendOTP(emailTo: string, otp: string): Promise<boolean> {\n\t\tconst subject = `OTP code for ${this.platformName}`\n\t\tconst textBody = `To confirm your subscription on ${this.platformName}, enter the following OTP code: ${otp}`\n\t\tconst htmlBody = `<p>To confirm your subscription on ${this.platformName}, enter the following OTP code: ${otp}</p>`\n\n\t\ttry {\n\t\t\treturn await this.sendTemplate(emailTo, subject, textBody, htmlBody)\n\t\t} catch (e) {\n\t\t\tSentry.captureException(e)\n\t\t\treturn false\n\t\t}\n\t}\n\n\tasync sendEmailPostReported(userInfo: IUserInfo, idPost: number | string) {\n\t\tconst subject = 'Post ' + idPost + ' reported'\n\n\t\tconst messageTxt =\n\t\t\t'Hi, post ' +\n\t\t\tidPost +\n\t\t\t' has been reported by ' +\n\t\t\tuserInfo.personalData.name +\n\t\t\t' ' +\n\t\t\tuserInfo.personalData.surname +\n\t\t\t' (id: ' +\n\t\t\tuserInfo._id +\n\t\t\t').'\n\n\t\tconst messageHtml =\n\t\t\tthis.getHtmlHeader(subject) +\n\t\t\t'Hi, post ' +\n\t\t\tidPost +\n\t\t\t' has been reported by ' +\n\t\t\tuserInfo.personalData.name +\n\t\t\t' ' +\n\t\t\tuserInfo.personalData.surname +\n\t\t\t' (id: ' +\n\t\t\tuserInfo._id +\n\t\t\t').' +\n\t\t\tthis.getHtmlFooter()\n\n\t\treturn await this.sendTemplate(`${process.env.DEV_TEAM_EMAIL}`, subject, messageTxt, messageHtml)\n\t}\n\n\tgetHtmlHeader(title: string) {\n\t\treturn (\n\t\t\t'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">' +\n\t\t\t'<html xmlns=\"http://www.w3.org/1999/xhtml\">' +\n\t\t\t' <head>' +\n\t\t\t' <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />' +\n\t\t\t' <title>' +\n\t\t\ttitle +\n\t\t\t'</title>' +\n\t\t\t' <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>' +\n\t\t\t'</head>' +\n\t\t\t'</html>' +\n\t\t\t'<body style=\"margin: 0; padding: 0;\">' +\n\t\t\t' <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">' +\n\t\t\t' <tr>' +\n\t\t\t' <td bgcolor=\"#ffffff\" style=\"padding: 40px 30px 40px 30px;\"><p style=\"color: #000000; font-family: Verdana, sans-serif; font-size: 12pt;\">'\n\t\t)\n\t}\n\n\tgetHtmlFooter() {\n\t\treturn '</p></td>' + ' </tr>' + ' </table>' + '</body>'\n\t}\n\n\tprivate async sendTemplate(emailTo: string, subject: string, textBody: string, htmlBody: string): Promise<boolean> {\n\t\treturn await this.sendEmail({\n\t\t\temailFrom: this.emailFrom,\n\t\t\temailFromName: this.platformName,\n\t\t\temailTo,\n\t\t\tsubject,\n\t\t\ttextBody,\n\t\t\thtmlBody\n\t\t})\n\t}\n\n\tprivate async sendEmail(args: ISendEmail): Promise<boolean> {\n\t\tconst { emailFrom, emailFromName, emailTo, subject, textBody, htmlBody } = args\n\t\tconst basicMessage = new BasicMessage()\n\t\tbasicMessage.setFromAddress(emailFrom, emailFromName)\n\t\tbasicMessage.setSubject(subject)\n\t\tbasicMessage.setTextBody(textBody)\n\t\tbasicMessage.setHtmlBody(this.emailHtmlHeader1 + subject + this.emailHtmlHeader2 + htmlBody + this.emailHtmlFooter)\n\t\tbasicMessage.setTo(emailTo)\n\n\t\treturn this.client.send(basicMessage).then(\n\t\t\t() => {\n\t\t\t\t//Handle successful API call\n\t\t\t\treturn true\n\t\t\t},\n\t\t\t(e: Error) => {\n\t\t\t\tSentry.captureException(e, {\n\t\t\t\t\textra: { detail: 'Error in sending the email' }\n\t\t\t\t})\n\t\t\t\treturn false\n\t\t\t}\n\t\t)\n\t}\n\n\t/**\n\t * fallback header\n\t * @private\n\t */\n\tprivate htmlHeader1() {\n\t\treturn (\n\t\t\t'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">' +\n\t\t\t'<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">' +\n\t\t\t' <head>' +\n\t\t\t' <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />' +\n\t\t\t' <title>'\n\t\t)\n\t}\n\n\t/**\n\t * fallback header\n\t * @private\n\t */\n\tprivate htmlHeader2() {\n\t\treturn (\n\t\t\t'</title>' +\n\t\t\t' <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>' +\n\t\t\t'</head>' +\n\t\t\t'</html>' +\n\t\t\t'<body style=\"margin: 0; padding: 0;\">' +\n\t\t\t' <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">' +\n\t\t\t' <tr>' +\n\t\t\t' <td bgcolor=\"#ffffff\" style=\"padding: 40px 30px 40px 30px;\"><p style=\"color: #000000; font-family: Verdana, sans-serif; font-size: 12pt;\">'\n\t\t)\n\t}\n\n\tprivate fixName(name: string) {\n\t\treturn name !== '' ? ` ${name}` : ''\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IUploadTemp.mjs","sourceRoot":"","sources":["../../src/files/IUploadTemp.mts"],"names":[],"mappings":"","sourcesContent":["export interface IUploadTemp {\n\ttempFile: string\n\text: string\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkForNSFW.mjs","sourceRoot":"","sources":["../../src/files/checkForNSFW.mts"],"names":[],"mappings":"AAAA,kFAAkF;;AAElF;;;;;;;;;;;;;;;;;;EAkBE","sourcesContent":["// const Sightengine = require('sightengine')('your-api-user', 'your-api-secret');\n\n/*\n// https://sightengine.com/ but there are other services too\nexport async function checkForNSFW(imageUrl: string) {\n\ttry {\n const result = await Sightengine.check(['nudity', 'wad']).set_url(imageUrl)\n\n if (result.nudity.safe < 0.9) {\n // NSFW content detected in the image\n return false\n }\n\n // No NSFW content detected in the image\n return true\n } catch (err) {\n // Error during content moderation: err\n return false\n }\n}\n*/\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fileConst.mjs","sourceRoot":"","sources":["../../src/files/fileConst.mts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAA;AAC/C,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAA","sourcesContent":["import path from 'path'\n\nexport const UPLOAD_TEMP_DIRECTORY_URL = '/tmp'\nexport const UPLOAD_IMG_DIRECTORY_URL = path.join(process.cwd(), 'upload/uimg')\n\nexport interface IStoreFile {\n\toriginalFilename: string\n\tfileName: string\n\tfilePath: string\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"moveFileStaticDomain.mjs","sourceRoot":"","sources":["../../src/files/moveFileStaticDomain.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,+CAA4C;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,cAAsB,EAAE,MAAc,EAAE,YAAoB,EAAE,YAAoB;IAC5H,8EAA8E;IAC9E,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IACnC,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAA;IAE/C,MAAM,cAAc,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,MAAM,IAAI,YAAY,EAAE,CAAA;IAE/E,MAAM,YAAY,CAAC,cAAc,EAAE,YAAY,EAAE,cAAc,CAAC,CAAA;AACjE,CAAC","sourcesContent":["import { assertNoTraversal } from '@private/files/assertNoTraversal.mjs'\n\nimport { moveTempFile } from './moveTempFile.mjs'\n\n/**\n * read .env STATIC_FOLDER path\n * @param sourceFilePath\n * @param folder\n * @param secondFolder\n * @param destFilename\n */\nexport async function moveFileStaticDomain(sourceFilePath: string, folder: string, secondFolder: string, destFilename: string) {\n\t// folder/secondFolder are path segments: a `..` in them escapes STATIC_FOLDER\n\tassertNoTraversal(folder, 'folder')\n\tassertNoTraversal(secondFolder, 'secondFolder')\n\n\tconst destinationDir = `${process.env.STATIC_FOLDER}/${folder}/${secondFolder}`\n\n\tawait moveTempFile(sourceFilePath, destFilename, destinationDir)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"moveImageFile.mjs","sourceRoot":"","sources":["../../src/files/moveImageFile.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,+CAA4C;AAExE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,cAAsB,EAAE,MAAc,EAAE,YAAoB,EAAE,YAAoB;IACrH,yFAAyF;IACzF,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IACnC,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAA;IAE/C,MAAM,cAAc,GAAG,GAAG,wBAAwB,IAAI,MAAM,IAAI,YAAY,EAAE,CAAA;IAE9E,MAAM,YAAY,CAAC,cAAc,EAAE,YAAY,EAAE,cAAc,CAAC,CAAA;AACjE,CAAC","sourcesContent":["import { assertNoTraversal } from '@private/files/assertNoTraversal.mjs'\n\nimport { UPLOAD_IMG_DIRECTORY_URL } from './fileConst.mjs'\nimport { moveTempFile } from './moveTempFile.mjs'\n\nexport async function moveImageFile(sourceFilePath: string, folder: string, secondFolder: string, destFilename: string) {\n\t// folder/secondFolder are path segments: a `..` in them escapes UPLOAD_IMG_DIRECTORY_URL\n\tassertNoTraversal(folder, 'folder')\n\tassertNoTraversal(secondFolder, 'secondFolder')\n\n\tconst destinationDir = `${UPLOAD_IMG_DIRECTORY_URL}/${folder}/${secondFolder}`\n\n\tawait moveTempFile(sourceFilePath, destFilename, destinationDir)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"moveTempFile.mjs","sourceRoot":"","sources":["../../src/files/moveTempFile.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,+CAA4C;AACxE,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,cAAsB,EAAE,YAAoB,EAAE,cAAsB;IACtG,mGAAmG;IACnG,6FAA6F;IAC7F,oEAAoE;IACpE,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAA;IAE/C,0CAA0C;IAC1C,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;IAElC,8BAA8B;IAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IACxC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,YAAY,GAAG,GAAG,EAAE,CAAC,CAAA;IAE1E,gBAAgB;IAChB,MAAM,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["import { assertNoTraversal } from '@private/files/assertNoTraversal.mjs'\nimport fs from 'fs-extra'\nimport path from 'path'\n\n/**\n *\n * @param sourceFilePath\n * @param destFilename\n * @param destinationDir\n */\nexport async function moveTempFile(sourceFilePath: string, destFilename: string, destinationDir: string) {\n\t// destFilename is a filename, not a path: a `..` in it escapes destinationDir via path.join below.\n\t// sourceFilePath and destinationDir are genuine caller-owned paths and are intentionally NOT\n\t// checked here — validating those is the consumer's responsibility.\n\tassertNoTraversal(destFilename, 'destFilename')\n\n\t// Ensure the destination directory exists\n\tawait fs.ensureDir(destinationDir)\n\n\t// Define the destination path\n\tconst ext = path.extname(sourceFilePath)\n\tconst destinationPath = path.join(destinationDir, `${destFilename}${ext}`)\n\n\t// Move the file\n\tawait fs.move(sourceFilePath, destinationPath)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reEncodeToJpeg.mjs","sourceRoot":"","sources":["../../src/files/reEncodeToJpeg.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,sCAAmC;AAEtD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAgB,EAAE,OAAO,GAAG,GAAG;IACnE,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AACjD,CAAC","sourcesContent":["import { reEncode } from '@private/files/reEncode.mjs'\n\nexport async function reEncodeToJpeg(filename: string, quality = 100) {\n\treturn await reEncode(filename, 'jpeg', quality)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reEncodeToPng.mjs","sourceRoot":"","sources":["../../src/files/reEncodeToPng.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,sCAAmC;AAEtD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB,EAAE,OAAO,GAAG,GAAG;IAClE,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAChD,CAAC","sourcesContent":["import { reEncode } from '@private/files/reEncode.mjs'\n\nexport async function reEncodeToPng(filename: string, quality = 100) {\n\treturn await reEncode(filename, 'png', quality)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reEncodeToWebp.mjs","sourceRoot":"","sources":["../../src/files/reEncodeToWebp.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,sCAAmC;AAEtD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAgB,EAAE,OAAO,GAAG,GAAG;IACnE,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AACjD,CAAC","sourcesContent":["import { reEncode } from '@private/files/reEncode.mjs'\n\nexport async function reEncodeToWebp(filename: string, quality = 100) {\n\treturn await reEncode(filename, 'webp', quality)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"scanVirus.mjs","sourceRoot":"","sources":["../../src/files/scanVirus.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAE/B,IAAI,gBAAgB,GAAoB,IAAI,CAAA;AAE5C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAmC;IACrE,MAAM,cAAc,GAAqB;QACxC,cAAc,EAAE,IAAI;QACpB,kBAAkB,EAAE,KAAK;QACzB,SAAS,EAAE;YACV,MAAM,EAAE,2BAA2B;YACnC,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,IAAI;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cAAc,CAAC,2BAA2B,QAAQ,EAAE,CAAC,CAAA;YAC7D,CAAC,CAAC,CAAA;QACH,CAAC;QAED,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IACvD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE;YAC1B,KAAK,EAAE,EAAE,MAAM,EAAE,iCAAiC,QAAQ,EAAE,EAAE;SAC9D,CAAC,CAAA;QACF,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IAC1E,CAAC;AACF,CAAC","sourcesContent":["import * as Sentry from '@sentry/node'\nimport NodeClam from 'clamscan'\n\nlet clamScanInstance: NodeClam | null = null\n\n/**********\n * Call inside koa initialization\n */\nexport async function initClamScan(options?: Partial<NodeClam.Options>) {\n\tconst defaultOptions: NodeClam.Options = {\n\t\tremoveInfected: true,\n\t\tquarantineInfected: false,\n\t\tclamdscan: {\n\t\t\tsocket: '/var/run/clamav/clamd.ctl',\n\t\t\ttimeout: 60000,\n\t\t\tmultiscan: true,\n\t\t\tlocalFallback: false\n\t\t},\n\t\tdebugMode: false\n\t}\n\tconsole.info('[ClamScan] init...')\n\n\ttry {\n\t\tconst mergedOptions = { ...defaultOptions, ...options }\n\t\tclamScanInstance = await new NodeClam().init(mergedOptions)\n\t\tconsole.info('[ClamScan] OK: ClamScan has been initialized successfully')\n\t\treturn clamScanInstance\n\t} catch (e) {\n\t\tconsole.error('[ClamScan] Error')\n\t\tSentry.captureException(e)\n\t\tthrow e\n\t}\n}\n\n/**\n * Result of a virus scan.\n *\n * Returned rather than kept internal because the Sentry alert used to be the ONLY\n * effect of detecting an infected file: inverting `if (isInfected)` had no observable\n * consequence, so no test could pin it (@sentry/node is a sealed ES module namespace\n * and is never initialised in the suite, making captureMessage a silent no-op there).\n * `alerted` is set inside the branch precisely so the branch itself is observable.\n *\n * scanVirus still never throws on detection — blocking remains the caller's decision —\n * but the caller now has something to decide with. Note `scanned: false` means the scan\n * did not complete: treat it as unknown, not as clean.\n */\nexport interface IScanVirusResult {\n\t/** true when ClamAV reported the file as infected */\n\tisInfected: boolean\n\t/** virus names reported by ClamAV; empty when clean or when the scan failed */\n\tviruses: string[]\n\t/** true when the infected-file alert was raised */\n\talerted: boolean\n\t/** false when the scan itself errored — the result is unknown, NOT clean */\n\tscanned: boolean\n}\n\nexport async function scanVirus(filePath: string): Promise<IScanVirusResult> {\n\tif (!clamScanInstance) {\n\t\tthrow new Error('ClamScan has not been initialized. Call initClamScan first.')\n\t}\n\n\ttry {\n\t\tconst { isInfected, viruses } = await clamScanInstance.scanFile(filePath)\n\n\t\tlet alerted = false\n\t\tif (isInfected) {\n\t\t\talerted = true\n\t\t\tSentry.withScope((scope) => {\n\t\t\t\tscope.setTag('file', filePath)\n\t\t\t\tscope.setContext('viruses', { list: viruses, count: viruses.length })\n\t\t\t\tscope.setLevel('warning')\n\t\t\t\tSentry.captureMessage(`Infected file detected: ${filePath}`)\n\t\t\t})\n\t\t}\n\n\t\treturn { isInfected, viruses, alerted, scanned: true }\n\t} catch (e) {\n\t\tSentry.captureException(e, {\n\t\t\textra: { detail: `Error while scanning the file ${filePath}` }\n\t\t})\n\t\treturn { isInfected: false, viruses: [], alerted: false, scanned: false }\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"storeUploadAsTemp.mjs","sourceRoot":"","sources":["../../src/files/storeUploadAsTemp.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AAGnC,OAAO,EAAc,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAEv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AAE,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;QAEvF,iFAAiF;QACjF,iFAAiF;QACjF,+EAA+E;QAC/E,kFAAkF;QAClF,4EAA4E;QAC5E,gFAAgF;QAChF,YAAY;QACZ,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAC5B,IAAI,YAAY,EAAE,CAAC;gBAClB,gBAAgB,CAAC,IAAI,KAAK,CAAC,kCAAkC,WAAW,QAAQ,CAAC,CAAC,CAAA;YACnF,CAAC;iBAAM,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;gBAClC,gBAAgB,CAAC,YAAY,CAAC,CAAA;YAC/B,CAAC;iBAAM,CAAC;gBACP,OAAO,CAAC,SAAS,CAAC,CAAA;YACnB,CAAC;QACF,CAAC,CAAC,CAAA;QAEF,+EAA+E;QAC/E,8EAA8E;QAC9E,iFAAiF;QACjF,qBAAqB;QACrB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE;YACpC,YAAY,GAAG,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;QAEF,sLAAsL;QACtL,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;QAEhE,yCAAyC;QACzC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IACzB,CAAC,CAAC,CAAA;IAEF,OAAO;QACN,gBAAgB,EAAE,QAAQ;QAC1B,QAAQ,EAAE,cAAc;QACxB,QAAQ,EAAE,aAAa;KACvB,CAAA;AACF,CAAC","sourcesContent":["import { createWriteStream, unlink } from 'node:fs'\n\nimport path from 'path'\nimport { v4 as uuidv4 } from 'uuid'\n\nimport { IFileUpload } from '../koa/IFileUpload.mjs'\nimport { IStoreFile, UPLOAD_TEMP_DIRECTORY_URL } from './fileConst.mjs'\n\n// Simulating __dirname using process.cwd()\n// const __dirname = process.cwd()\nconst MAX_FILE_SIZE = 5 * 1024 * 1024 // 5MB size limit\n\nexport async function storeUploadAsTemp(upload: Promise<IFileUpload>, maxFileSize: number = MAX_FILE_SIZE): Promise<IStoreFile> {\n\tconst { createReadStream, filename } = await upload\n\tconst stream = createReadStream()\n\tconst storedFileName = uuidv4() + path.extname(filename).toLowerCase()\n\tconst storedFileUrl = `${UPLOAD_TEMP_DIRECTORY_URL}/${storedFileName}`\n\tlet fileSize = 0 // Variable to track file size\n\tlet sizeExceeded = false // Set once the limit is passed; read by the 'close' handler\n\tlet writeFailure: Error | null = null // Set on a write/stream error; read by the 'close' handler\n\n\t// Store the file in the filesystem.\n\tawait new Promise((resolve, reject) => {\n\t\t// Create a stream to which the upload will be written.\n\t\tconst writeStream = createWriteStream(storedFileUrl)\n\n\t\t// Check file size during streaming.\n\t\t// Only flags and stops the stream — the rejection is issued from the 'close'\n\t\t// handler below. Rejecting from inside unlink's callback here would lose the\n\t\t// race: writeStream.destroy() emits 'close' synchronously ahead of the async\n\t\t// unlink, so 'close' resolved the promise first and the later reject() was a\n\t\t// no-op on an already-settled promise. An oversize upload therefore reported\n\t\t// SUCCESS while returning a path that had just been deleted.\n\t\tstream.on('data', (chunk: Buffer) => {\n\t\t\tfileSize += chunk.length\n\t\t\tif (!sizeExceeded && fileSize > maxFileSize) {\n\t\t\t\tsizeExceeded = true\n\t\t\t\twriteStream.destroy() // Stop the stream\n\t\t\t}\n\t\t})\n\n\t\t// Best-effort cleanup, then reject. Cleanup is fire-and-forget by design: the\n\t\t// upload has already failed, and an unlink error must not mask the real cause.\n\t\tconst removeThenReject = (reason: Error) => unlink(storedFileUrl, () => reject(reason))\n\n\t\t// 'close' is the single settle point. Every failure path below only RECORDS what\n\t\t// went wrong and stops the stream; nothing settles the Promise itself. Rejecting\n\t\t// from inside an unlink callback instead would lose the race — destroy() emits\n\t\t// 'close' ahead of the async unlink, so 'close' settled the Promise first and the\n\t\t// later reject() was a no-op. That is why an oversize upload used to report\n\t\t// SUCCESS with a filePath that had just been deleted, and why a write error did\n\t\t// the same.\n\t\twriteStream.on('close', () => {\n\t\t\tif (sizeExceeded) {\n\t\t\t\tremoveThenReject(new Error(`File size exceeds the limit of ${maxFileSize} bytes`))\n\t\t\t} else if (writeFailure !== null) {\n\t\t\t\tremoveThenReject(writeFailure)\n\t\t\t} else {\n\t\t\t\tresolve(undefined)\n\t\t\t}\n\t\t})\n\n\t\t// Record the write error; 'close' follows and does the rejecting. The previous\n\t\t// version rejected here with 'File size exceeds the limit.' regardless of the\n\t\t// actual cause, which was misleading for every non-size failure — the real error\n\t\t// is propagated now.\n\t\twriteStream.on('error', (e: Error) => {\n\t\t\twriteFailure = e\n\t\t})\n\n\t\t// In Node.js <= v13, errors are not automatically propagated between piped streams. If there is an error receiving the upload, destroy the write stream with the corresponding error.\n\t\tstream.on('error', (error: Error) => writeStream.destroy(error))\n\n\t\t// Pipe the upload into the write stream.\n\t\tstream.pipe(writeStream)\n\t})\n\n\treturn {\n\t\toriginalFilename: filename,\n\t\tfileName: storedFileName,\n\t\tfilePath: storedFileUrl\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"uploadTempImage.mjs","sourceRoot":"","sources":["../../src/files/uploadTempImage.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAErE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAyB;IACzD,IAAI,cAAc,GAAG,EAAE,CAAA;IAEvB,IAAI,CAAC;QACJ,qBAAqB;QACrB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAC3D,MAAM,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACjD,MAAM,sBAAsB,CAAC,QAAQ,CAAC,CAAA;QACtC,SAAS;QACT,MAAM,SAAS,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAA;QAC9B,SAAS;QAET,cAAc,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAA;QAC/C,+BAA+B;QAC/B,+BAA+B;QAC/B,2BAA2B;QAC3B,cAAc;QACd,cAAc;QACd,cAAc;QACd,8CAA8C;QAC9C,iEAAiE;IAClE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,0BAA0B;QAC1B,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAA;QACxC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACvC,CAAC;IAED,OAAO;QACN,GAAG,EAAE,MAAM;QACX,QAAQ,EAAE,cAAc;KACxB,CAAA;AACF,CAAC","sourcesContent":["import { IFileUpload } from '../koa/IFileUpload.mjs'\nimport { IUploadTemp } from './IUploadTemp.mjs'\nimport { reEncodeToWebp } from './reEncodeToWebp.mjs'\nimport { scanVirus } from './scanVirus.mjs'\nimport { storeUploadAsTemp } from './storeUploadAsTemp.mjs'\nimport { validateJpgPngExtension } from './validateJpgPngExtension.mjs'\nimport { validateJpgPngMimeType } from './validateMimeTypeImages.mjs'\n\n/**\n * Validate file extension, Mime Type, scan with ClamAV, re encode to webp, rename final file\n * @todo log uploaded file\n * @param img\n */\nexport async function uploadTemp(img: Promise<IFileUpload>): Promise<IUploadTemp> {\n\tlet storedTempFile = ''\n\n\ttry {\n\t\t// Step 1 - Readme.md\n\t\tconst { fileName, filePath } = await storeUploadAsTemp(img)\n\t\tawait validateJpgPngExtension(fileName, filePath)\n\t\tawait validateJpgPngMimeType(filePath)\n\t\t// step 2\n\t\tawait scanVirus(`${filePath}`)\n\t\t// step 3\n\n\t\tstoredTempFile = await reEncodeToWebp(filePath)\n\t\t// await checkForNSFW(filePath)\n\t\t// step 4 - safe file name (ok)\n\t\t// step 5 - rate limit (ok)\n\t\t// step 6 - ok\n\t\t// step 7 - ok\n\t\t// step8 - log\n\t\t// user's IP address, filename, and timestamp,\n\t\t// @todo await logUpload('team', uId, originalFilename, fileName)\n\t} catch (e) {\n\t\t// error for file handling\n\t\tconsole.error('Error storing image:', e)\n\t\tthrow new Error('Error storing image')\n\t}\n\n\treturn {\n\t\text: 'webp',\n\t\ttempFile: storedTempFile\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"uploadTempPdf.mjs","sourceRoot":"","sources":["../../src/files/uploadTempPdf.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAyB;IAC5D,IAAI,cAAc,GAAG,EAAE,CAAA;IAEvB,IAAI,CAAC;QACJ,qBAAqB;QACrB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAC3D,MAAM,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAC9C,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QACnC,SAAS;QACT,MAAM,SAAS,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAA;QAC9B,SAAS;QAET,wFAAwF;QACxF,cAAc,GAAG,QAAQ,CAAA;QACzB,+BAA+B;QAC/B,+BAA+B;QAC/B,2BAA2B;QAC3B,cAAc;QACd,cAAc;QACd,cAAc;QACd,8CAA8C;QAC9C,iEAAiE;IAClE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,0BAA0B;QAC1B,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAA;QACtC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACrC,CAAC;IAED,OAAO;QACN,GAAG,EAAE,KAAK;QACV,QAAQ,EAAE,cAAc;KACxB,CAAA;AACF,CAAC","sourcesContent":["import { IFileUpload } from '../koa/IFileUpload.mjs'\nimport { IUploadTemp } from './IUploadTemp.mjs'\nimport { scanVirus } from './scanVirus.mjs'\nimport { storeUploadAsTemp } from './storeUploadAsTemp.mjs'\nimport { validateMimeTypePdf } from './validateMimeTypePdf.mjs'\nimport { validatePdfExtension } from './validatePdfExtension.mjs'\n\n/**\n * Validate file extension, Mime Type, scan with ClamAV, re encode to pdf, rename final file\n * @todo log uploaded file, reencode pdf\n * @param pdf\n */\nexport async function uploadTempPdf(pdf: Promise<IFileUpload>): Promise<IUploadTemp> {\n\tlet storedTempFile = ''\n\n\ttry {\n\t\t// Step 1 - Readme.md\n\t\tconst { fileName, filePath } = await storeUploadAsTemp(pdf)\n\t\tawait validatePdfExtension(fileName, filePath)\n\t\tawait validateMimeTypePdf(filePath)\n\t\t// step 2\n\t\tawait scanVirus(`${filePath}`)\n\t\t// step 3\n\n\t\t// @todo reencode with dangerzone https://github.com/freedomofpress/dangerzone/tree/main\n\t\tstoredTempFile = filePath\n\t\t// await checkForNSFW(filePath)\n\t\t// step 4 - safe file name (ok)\n\t\t// step 5 - rate limit (ok)\n\t\t// step 6 - ok\n\t\t// step 7 - ok\n\t\t// step8 - log\n\t\t// user's IP address, filename, and timestamp,\n\t\t// @todo await logUpload('team', uId, originalFilename, fileName)\n\t} catch (e) {\n\t\t// error for file handling\n\t\tconsole.error('Error storing pdf:', e)\n\t\tthrow new Error('Error storing pdf')\n\t}\n\n\treturn {\n\t\text: 'pdf',\n\t\ttempFile: storedTempFile\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateExtension.mjs","sourceRoot":"","sources":["../../src/files/validateExtension.mts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,iBAA2B,EAAE,EAAE;IAClF,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;IAChD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import path from 'path'\n\n/**\n * Utility function to validate file extension\n * @param filename\n * @param allowedExtensions\n */\nexport const validateExtension = (filename: string, allowedExtensions: string[]) => {\n\tconst ext = path.extname(filename).toLowerCase()\n\treturn allowedExtensions.includes(ext)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateJpgPngExtension.mjs","sourceRoot":"","sources":["../../src/files/validateJpgPngExtension.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,QAAgB,EAAE,QAAgB;IAC/E,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;QAC7D,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA,CAAC,oBAAoB;QAC9C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC1C,CAAC;AACF,CAAC","sourcesContent":["import fs from 'fs-extra'\n\nimport { validateExtension } from './validateExtension.mjs'\n\nexport async function validateJpgPngExtension(filename: string, filePath: string) {\n\tif (!validateExtension(filename, ['.jpg', '.jpeg', '.png'])) {\n\t\tawait fs.remove(filePath) // Clean up the file\n\t\tthrow new Error('Invalid file extension')\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateMimeType.mjs","sourceRoot":"","sources":["../../src/files/validateMimeType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,+CAA4C;AACxE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,QAAgB,EAAE,gBAA0B;IAClF,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;IACpE,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QACrB,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA,CAAC,oBAAoB;QAC9C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC1C,CAAC;SAAM,CAAC;QACP,OAAO,QAAQ,CAAA;IAChB,CAAC;AACF,CAAC","sourcesContent":["import { _validateMimeType } from '@private/files/_validateMimeType.mjs'\nimport fs from 'fs-extra'\n\n/**\n * Validate MIME type based on file content (magic number validation)\n * @param filePath\n * @param allowedMimeTypes\n */\nexport async function validateMimeType(filePath: string, allowedMimeTypes: string[]): Promise<string> {\n\tconst mimeType = await _validateMimeType(filePath, allowedMimeTypes)\n\tif (mimeType === '') {\n\t\tawait fs.remove(filePath) // Clean up the file\n\t\tthrow new Error('Invalid file MIME type')\n\t} else {\n\t\treturn mimeType\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateMimeTypeImages.mjs","sourceRoot":"","sources":["../../src/files/validateMimeTypeImages.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,QAAgB;IAC5D,OAAO,MAAM,gBAAgB,CAAC,QAAQ,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAA;AACrE,CAAC","sourcesContent":["import { validateMimeType } from './validateMimeType.mjs'\n\n/**\n * Validate MIME type based on file content (magic number validation)\n * @param filePath\n */\nexport async function validateJpgPngMimeType(filePath: string): Promise<string> {\n\treturn await validateMimeType(filePath, ['image/jpeg', 'image/png'])\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateMimeTypePdf.mjs","sourceRoot":"","sources":["../../src/files/validateMimeTypePdf.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IACzD,OAAO,MAAM,gBAAgB,CAAC,QAAQ,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAC7D,CAAC","sourcesContent":["import { validateMimeType } from './validateMimeType.mjs'\n\n/**\n * Validate MIME type based on file content (magic number validation)\n * @param filePath\n */\nexport async function validateMimeTypePdf(filePath: string): Promise<string> {\n\treturn await validateMimeType(filePath, ['application/pdf'])\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validatePdfExtension.mjs","sourceRoot":"","sources":["../../src/files/validatePdfExtension.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,QAAgB;IAC5E,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA,CAAC,oBAAoB;QAC9C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC1C,CAAC;AACF,CAAC","sourcesContent":["import fs from 'fs-extra'\n\nimport { validateExtension } from './validateExtension.mjs'\n\nexport async function validatePdfExtension(filename: string, filePath: string) {\n\tif (!validateExtension(filename, ['.pdf'])) {\n\t\tawait fs.remove(filePath) // Clean up the file\n\t\tthrow new Error('Invalid file extension')\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserBase.mjs","sourceRoot":"","sources":["../../../../src/graphQL/models/MongoDB/UserBase.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAS,MAAM,UAAU,CAAA;AAgE/C,MAAM,cAAc,GAA4B,IAAI,MAAM,CACzD;IACC,KAAK,EAAE;QACN,IAAI,EAAE;YACL,GAAG,EAAE,KAAK;YACV,KAAK,EAAE;gBACN,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,QAAQ,EAAE;gBACT,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,UAAU,EAAE;gBACX,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,KAAK;aACf;YACD,SAAS,EAAE;gBACV,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,KAAK;aACf;SACD;QACD,QAAQ,EAAE,IAAI;KACd;IACD,OAAO,EAAE;QACR,IAAI,EAAE;YACL,GAAG,EAAE,KAAK;YACV,KAAK,EAAE;gBACN,IAAI,EAAE;oBACL,GAAG,EAAE,KAAK;oBACV,KAAK,EAAE;wBACN,IAAI,EAAE,OAAO;wBACb,QAAQ,EAAE,IAAI;qBACd;oBACD,WAAW,EAAE;wBACZ,IAAI,EAAE,IAAI;wBACV,QAAQ,EAAE,KAAK;qBACf;oBACD,YAAY,EAAE;wBACb,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,KAAK;qBACf;oBACD,IAAI,EAAE;wBACL,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,KAAK;qBACf;oBACD,WAAW,EAAE;wBACZ,IAAI,EAAE,MAAM;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,QAAQ,GAAG,KAAK,CAAkB,UAAU,EAAE,cAAc,CAAC,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,CAAA","sourcesContent":["import { model, Schema, Types } from 'mongoose'\n\nexport interface IInfoUserForLogin {\n\t_id: Types.ObjectId\n\tlogin: {\n\t\tpassword: string\n\t\tlastLogin?: Date\n\t}\n\taccount: {\n\t\temail: {\n\t\t\tvalid: boolean\n\t\t}\n\t\tonboardingStep?: string\n\t\tonboardingDone?: boolean\n\t\trememberMe?: boolean\n\t\tdisabled?: boolean\n\t\tdeleted?: boolean\n\t}\n}\n\nexport interface IUserBaseSchema {\n\t_id: Types.ObjectId\n\tlogin: {\n\t\t_id?: boolean\n\t\temail: string\n\t\tpassword: string\n\t\tfirstLogin?: Date\n\t\tlastLogin?: Date\n\t}\n\taccount: {\n\t\t_id?: boolean\n\t\temail: {\n\t\t\t_id?: boolean\n\t\t\tvalid: boolean\n\t\t\tdateLastReq?: Date\n\t\t\trequestTimes?: number\n\t\t\thash?: string\n\t\t\tnewEmailTmp?: string\n\t\t}\n\t\tonboardingStep?: string\n\t\tonboardingDone?: boolean\n\t\trememberMe?: boolean\n\t\tregistrationDate: Date\n\t\taccountValidDate?: Date\n\t\tnewsletter?: boolean\n\t\tresetDateReq?: Date\n\t\t/**\n\t\t * Password-reset token. Deliberately NOT `account.email.hash`: that slot belongs to the\n\t\t * email-verification and email-change flows, which have a different lifetime (3 days vs 60\n\t\t * minutes), a different throttle, and a different trust domain. While the two shared one\n\t\t * field, requesting a reset silently invalidated a pending activation link, and a hash\n\t\t * issued by either flow was accepted by the other.\n\t\t */\n\t\tresetHash?: string\n\t\tdisabled?: boolean\n\t\tdeleted?: boolean\n\t}\n\tpersonalData?: {\n\t\t_id: false\n\t\tname: string\n\t}\n\t__v?: number\n}\n\nconst UserBaseSchema: Schema<IUserBaseSchema> = new Schema(\n\t{\n\t\tlogin: {\n\t\t\ttype: {\n\t\t\t\t_id: false,\n\t\t\t\temail: {\n\t\t\t\t\ttype: String,\n\t\t\t\t\trequired: true\n\t\t\t\t},\n\t\t\t\tpassword: {\n\t\t\t\t\ttype: String,\n\t\t\t\t\trequired: true\n\t\t\t\t},\n\t\t\t\tfirstLogin: {\n\t\t\t\t\ttype: Date,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\tlastLogin: {\n\t\t\t\t\ttype: Date,\n\t\t\t\t\trequired: false\n\t\t\t\t}\n\t\t\t},\n\t\t\trequired: true\n\t\t},\n\t\taccount: {\n\t\t\ttype: {\n\t\t\t\t_id: false,\n\t\t\t\temail: {\n\t\t\t\t\ttype: {\n\t\t\t\t\t\t_id: false,\n\t\t\t\t\t\tvalid: {\n\t\t\t\t\t\t\ttype: Boolean,\n\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdateLastReq: {\n\t\t\t\t\t\t\ttype: Date,\n\t\t\t\t\t\t\trequired: false\n\t\t\t\t\t\t},\n\t\t\t\t\t\trequestTimes: {\n\t\t\t\t\t\t\ttype: Number,\n\t\t\t\t\t\t\trequired: false\n\t\t\t\t\t\t},\n\t\t\t\t\t\thash: {\n\t\t\t\t\t\t\ttype: String,\n\t\t\t\t\t\t\trequired: false\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnewEmailTmp: {\n\t\t\t\t\t\t\ttype: String,\n\t\t\t\t\t\t\trequired: false\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\trequired: true\n\t\t\t\t},\n\t\t\t\tonboardingStep: {\n\t\t\t\t\ttype: String,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\tonboardingDone: {\n\t\t\t\t\ttype: Boolean,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\trememberMe: {\n\t\t\t\t\ttype: Boolean,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\tregistrationDate: {\n\t\t\t\t\ttype: Date,\n\t\t\t\t\trequired: true\n\t\t\t\t},\n\t\t\t\taccountValidDate: {\n\t\t\t\t\ttype: Date,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\tnewsletter: {\n\t\t\t\t\ttype: Boolean,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\tresetDateReq: {\n\t\t\t\t\ttype: Date,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\tresetHash: {\n\t\t\t\t\ttype: String,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\t// Boolean, matching IUserBaseSchema. It was String, and that inverted the flag: a\n\t\t\t\t// hydrated read (infoUserForLogin uses .exec(), not .lean()) cast a stored `false`\n\t\t\t\t// to the string 'false', which is truthy, so every consumer's `if (account.disabled)`\n\t\t\t\t// locked out a user explicitly marked NOT disabled. Writing `false` through Mongoose\n\t\t\t\t// stored the string too. Existing rows holding 'true'/'false' strings must be\n\t\t\t\t// migrated — run scripts/migrate-account-disabled-to-boolean.mjs. Mongoose repairs\n\t\t\t\t// them on hydration, but .lean() readers (userData4VerifyEmail, emailChangeHashVerify)\n\t\t\t\t// see the raw value and would still block on the string.\n\t\t\t\tdisabled: {\n\t\t\t\t\ttype: Boolean,\n\t\t\t\t\trequired: false\n\t\t\t\t},\n\t\t\t\tdeleted: {\n\t\t\t\t\ttype: Boolean,\n\t\t\t\t\trequired: false\n\t\t\t\t}\n\t\t\t},\n\t\t\trequired: true\n\t\t},\n\t\tpersonalData: {\n\t\t\ttype: {\n\t\t\t\t_id: false,\n\t\t\t\tname: {\n\t\t\t\t\ttype: String,\n\t\t\t\t\trequired: true\n\t\t\t\t}\n\t\t\t},\n\t\t\trequired: false\n\t\t},\n\t\t__v: {\n\t\t\ttype: Number,\n\t\t\trequired: false\n\t\t}\n\t},\n\t{\n\t\tcollection: 'user'\n\t}\n)\n\nconst UserBase = model<IUserBaseSchema>('UserBase', UserBaseSchema)\nexport { UserBase }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevStatsGraphQLCalls.mjs","sourceRoot":"","sources":["../../../../../src/graphQL/models/MongoDB/log/DevStatsGraphQLCalls.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAS,MAAM,UAAU,CAAA;AAoB/C,MAAM,0BAA0B,GAAG,IAAI,MAAM,CAC5C;IACC,IAAI,EAAE;QACL,IAAI,EAAE;YACL;gBACC,GAAG,EAAE;oBACJ,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;oBAC3B,QAAQ,EAAE,IAAI;iBACd;gBACD,IAAI,EAAE;oBACL,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,GAAG,EAAE;oBACJ,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,KAAK;iBACf;aACD;SACD;QACD,QAAQ,EAAE,IAAI;KACd;IACD,OAAO,EAAE;QACR,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,oDAAoD;KAC9E;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KACf;CACD,EACD;IACC,UAAU,EAAE,sBAAsB;CAClC,CACD,CAAA;AAED,MAAM,oBAAoB,GAAG,KAAK,CAA8B,sBAAsB,EAAE,0BAA0B,CAAC,CAAA;AACnH,OAAO,EAAE,oBAAoB,EAAE,CAAA","sourcesContent":["import { model, Schema, Types } from 'mongoose'\n\nexport interface IDevStatsGraphQLCalls {\n\tname: string\n\thit?: boolean\n}\n\nexport interface IDevStatsGraphQLCallsSchema {\n\t_id: Types.ObjectId\n\tlist: [\n\t\t{\n\t\t\t_id?: Types.ObjectId\n\t\t\tname: string\n\t\t\thit?: boolean\n\t\t}\n\t]\n\tdataora: Date\n\t__v?: number\n}\n\nconst DevStatsGraphQLCallsSchema = new Schema<IDevStatsGraphQLCallsSchema>(\n\t{\n\t\tlist: {\n\t\t\ttype: [\n\t\t\t\t{\n\t\t\t\t\t_id: {\n\t\t\t\t\t\ttype: Schema.Types.ObjectId,\n\t\t\t\t\t\trequired: true\n\t\t\t\t\t},\n\t\t\t\t\tname: {\n\t\t\t\t\t\ttype: String,\n\t\t\t\t\t\trequired: true\n\t\t\t\t\t},\n\t\t\t\t\thit: {\n\t\t\t\t\t\ttype: Boolean,\n\t\t\t\t\t\trequired: false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t],\n\t\t\trequired: true\n\t\t},\n\t\tdataora: {\n\t\t\ttype: Date,\n\t\t\trequired: false,\n\t\t\tdefault: () => new Date() // Ensure a new Date is generated for each document.\n\t\t},\n\t\t__v: {\n\t\t\ttype: Number,\n\t\t\trequired: false\n\t\t}\n\t},\n\t{\n\t\tcollection: 'devStatsGraphQLCalls'\n\t}\n)\n\nconst DevStatsGraphQLCalls = model<IDevStatsGraphQLCallsSchema>('DevStatsGraphQLCalls', DevStatsGraphQLCallsSchema)\nexport { DevStatsGraphQLCalls }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogGlobalError.mjs","sourceRoot":"","sources":["../../../../../src/graphQL/models/MongoDB/log/LogGlobalError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAS,MAAM,UAAU,CAAA;AAU/C,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAC1C;IACC,CAAC,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,CAAC,EAAE;QACF,IAAI,EAAE,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,IAAI;KACd;IACD,CAAC,EAAE;QACF,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,oDAAoD;KAC9E;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KACf;CACD,EACD;IACC,UAAU,EAAE,gBAAgB;CAC5B,CACD,CAAA;AAED,MAAM,cAAc,GAAG,KAAK,CAA4B,gBAAgB,EAAE,wBAAwB,CAAC,CAAA;AACnG,OAAO,EAAE,cAAc,EAAE,CAAA","sourcesContent":["import { model, Schema, Types } from 'mongoose'\n\nexport interface IGlobalErrorGraphqlSchema {\n\t_id: Types.ObjectId\n\tm: string // message\n\ts: Array<string> // stack\n\ti: Date // inserted\n\t__v?: number\n}\n\nconst GlobalErrorGraphqlSchema = new Schema<IGlobalErrorGraphqlSchema>(\n\t{\n\t\tm: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t},\n\t\ts: {\n\t\t\ttype: [String],\n\t\t\trequired: true\n\t\t},\n\t\ti: {\n\t\t\ttype: Date,\n\t\t\trequired: false,\n\t\t\tdefault: () => new Date() // Ensure a new Date is generated for each document.\n\t\t},\n\t\t__v: {\n\t\t\ttype: Number,\n\t\t\trequired: false\n\t\t}\n\t},\n\t{\n\t\tcollection: 'logGlobalError'\n\t}\n)\n\nconst LogGlobalError = model<IGlobalErrorGraphqlSchema>('LogGlobalError', GlobalErrorGraphqlSchema)\nexport { LogGlobalError }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogStatsGraphql.mjs","sourceRoot":"","sources":["../../../../../src/graphQL/models/MongoDB/log/LogStatsGraphql.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAS,MAAM,UAAU,CAAA;AAa/C,MAAM,kBAAkB,GAAG,IAAI,MAAM,CACpC;IACC,CAAC,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,CAAC,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,CAAC,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,CAAC,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,CAAC,EAAE;QACF,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,oDAAoD;KAC9E;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KACf;CACD,EACD;IACC,UAAU,EAAE,iBAAiB;CAC7B,CACD,CAAA;AAED,MAAM,eAAe,GAAG,KAAK,CAAsB,iBAAiB,EAAE,kBAAkB,CAAC,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,CAAA","sourcesContent":["import { model, Schema, Types } from 'mongoose'\n\n/** Document shape of the `LogStatsGraphql` model. Exported so a consumer re-exporting the model can name its type. */\nexport interface IStatsGraphqlSchema {\n\t_id: Types.ObjectId\n\tu: number // user\n\tn: string // query name\n\ti: Date // inserted\n\ts: number // status\n\tm: number // msTot\n\t__v?: number\n}\n\nconst StatsGraphqlSchema = new Schema<IStatsGraphqlSchema>(\n\t{\n\t\tu: {\n\t\t\ttype: Number,\n\t\t\trequired: true\n\t\t},\n\t\tn: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t},\n\t\ts: {\n\t\t\ttype: Number,\n\t\t\trequired: true\n\t\t},\n\t\tm: {\n\t\t\ttype: Number,\n\t\t\trequired: true\n\t\t},\n\t\ti: {\n\t\t\ttype: Date,\n\t\t\trequired: false,\n\t\t\tdefault: () => new Date() // Ensure a new Date is generated for each document.\n\t\t},\n\t\t__v: {\n\t\t\ttype: Number,\n\t\t\trequired: false\n\t\t}\n\t},\n\t{\n\t\tcollection: 'logStatsGraphql'\n\t}\n)\n\nconst LogStatsGraphql = model<IStatsGraphqlSchema>('LogStatsGraphql', StatsGraphqlSchema)\nexport { LogStatsGraphql }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogThrow.mjs","sourceRoot":"","sources":["../../../../../src/graphQL/models/MongoDB/log/LogThrow.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAS,MAAM,UAAU,CAAA;AAW/C,MAAM,qBAAqB,GAAG,IAAI,MAAM,CACvC;IACC,CAAC,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,CAAC,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,EAAE,EAAE;QACH,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,CAAC,EAAE;QACF,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,oDAAoD;KAC9E;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;KACZ;CACD,EACD;IACC,UAAU,EAAE,UAAU;CACtB,CACD,CAAA;AAED,MAAM,QAAQ,GAAG,KAAK,CAAyB,UAAU,EAAE,qBAAqB,CAAC,CAAA;AACjF,OAAO,EAAE,QAAQ,EAAE,CAAA","sourcesContent":["import { model, Schema, Types } from 'mongoose'\n\nexport interface ILogThrowGraphqlSchema {\n\t_id: Types.ObjectId\n\tu: number // user\n\tm: string // message\n\tel: number // error level\n\ti: Date // inserted\n\t__v?: number\n}\n\nconst LogThrowGraphqlSchema = new Schema<ILogThrowGraphqlSchema>(\n\t{\n\t\tu: {\n\t\t\ttype: Number,\n\t\t\trequired: true\n\t\t},\n\t\tm: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t},\n\t\tel: {\n\t\t\ttype: Number,\n\t\t\trequired: true\n\t\t},\n\t\ti: {\n\t\t\ttype: Date,\n\t\t\trequired: false,\n\t\t\tdefault: () => new Date() // Ensure a new Date is generated for each document.\n\t\t},\n\t\t__v: {\n\t\t\ttype: Number\n\t\t}\n\t},\n\t{\n\t\tcollection: 'logThrow'\n\t}\n)\n\nconst LogThrow = model<ILogThrowGraphqlSchema>('LogThrow', LogThrowGraphqlSchema)\nexport { LogThrow }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GraphQLInputLogin.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/GraphQLInput/GraphQLInputLogin.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE/E,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,sBAAsB,CAAC;IAC3D,IAAI,EAAE,mBAAmB;IACzB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QAClD,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACrD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLInputObjectType, GraphQLNonNull, GraphQLString } from 'graphql'\n\nexport const GraphQLInputLogin = new GraphQLInputObjectType({\n\tname: 'GraphQLInputLogin',\n\tfields: () => ({\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IContextAuthenticatedResource.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/context/IContextAuthenticatedResource.mts"],"names":[],"mappings":"","sourcesContent":["import { TCommonHeaders } from '@context/TCommonHeaders.mjs'\nimport { IncomingHttpHeaders } from 'http'\nimport { Types } from 'mongoose'\n\ninterface ISessionApi {\n\tid: Types.ObjectId\n\t// disabled?: boolean | 'true'; // no need to read this, user is blocked at resource handler level defined only if true or 'true'\n\t// deleted?: boolean | 'true'; // no need to read this, user is blocked at resource handler level defined only if true or 'true'\n}\n\ntype IStateApi = {\n\tuser: ISessionApi\n}\n\nexport type IContextAuthenticatedResource = {\n\tstate: IStateApi\n\trequest: {\n\t\theader?: TCommonHeaders & IncomingHttpHeaders\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IContextKoaErrorHandler.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/context/IContextKoaErrorHandler.mts"],"names":[],"mappings":"","sourcesContent":["import { IKoaError } from '../../../koa/IKoaError.mjs'\n\nexport interface IContextKoaErrorHandler {\n\tstatus: number\n\tbody: {\n\t\tdescription?: string\n\t\tmessage: string\n\t}\n\tapp: {\n\t\temit(event: string, err: IKoaError, ctx: IContextKoaErrorHandler): void\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IContextLogin.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/context/IContextLogin.mts"],"names":[],"mappings":"","sourcesContent":["import { ICookies } from '@lib/ICookies.mjs'\n\nexport type IContextLogin = {\n\tcookies: ICookies\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IContextLogout.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/context/IContextLogout.mts"],"names":[],"mappings":"","sourcesContent":["import { TCommonHeaders } from '@context/TCommonHeaders.mjs'\nimport { ICookies } from '@lib/ICookies.mjs'\nimport { IncomingHttpHeaders } from 'http'\n\ninterface ISessionApi {\n\trefreshToken: string // 90 days - cookie\n\taccessToken?: string // 90 min - headers\n}\n\ntype IStateApi = {\n\tuser: ISessionApi\n}\n\nexport type IContextLogout = {\n\tstate: IStateApi\n\tcookies: ICookies\n\trequest: {\n\t\theader?: TCommonHeaders & IncomingHttpHeaders\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IContextRefresh.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/context/IContextRefresh.mts"],"names":[],"mappings":"","sourcesContent":["import { TCommonHeaders } from '@context/TCommonHeaders.mjs'\nimport { ICookies } from '@lib/ICookies.mjs'\nimport { IncomingHttpHeaders } from 'http'\nimport { Types } from 'mongoose'\n\ninterface ISessionAuthenticated {\n\tid: Types.ObjectId\n\trefreshToken: string\n\t// disabled?: boolean | 'true'; // no need to read this, user is blocked at resource handler level defined only if true or 'true'\n\t// deleted?: boolean | 'true'; // no need to read this, user is blocked at resource handler level defined only if true or 'true'\n}\n\ntype IStateAuthenticated = {\n\tuser: ISessionAuthenticated\n}\n\nexport type IContextRefresh = {\n\tstate: IStateAuthenticated\n\tcookies: ICookies\n\trequest: {\n\t\theader?: TCommonHeaders & IncomingHttpHeaders\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"TCommonHeaders.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/context/TCommonHeaders.mts"],"names":[],"mappings":"","sourcesContent":["export type TCommonHeaders = {\n\thost?: string\n\tauthorization?: string\n\t'user-agent'?: string\n\t'content-type'?: string\n\t'content-length'?: string\n\t'x-introspectioncode'?: string\n\taccept?: string\n\torigin?: string\n\treferer?: string\n\tcookie?: string\n\tconnection?: string\n\tdnt?: string\n\toperation?: string\n\t// Add other common headers as needed\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IFindAndUpdate.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/interfaces/IFindAndUpdate.mts"],"names":[],"mappings":"","sourcesContent":["import { Types } from 'mongoose'\n\n/**\n * Use like this:\n * const result = await Model.findByIdAndUpdate(...) as IFindAndUpdate<IImprenditoreModel>;\n * result.value; // IImprenditoreModel | null\n *\n * If you do not need the new or the old document, use updateOne() !\n */\nexport interface IFindAndUpdate<T = unknown> {\n\tvalue: T | null // The document\n\tlastErrorObject: {\n\t\tupdatedExisting: boolean // Indicates whether it updated an existing document (true) or created a new one via\n\t\t// \tupsert (false)\n\t\tupserted?: Types.ObjectId // Present only if an upsert occurred\n\t}\n\tok: 0 | 1 // indicates whether the MongoDB command succeeded (1) or had an error (0). If the\n\t// \tdocument was not found, ok is 1 because the command succeeded !! so\n\t// \tcheck if value is not null to verify the document was found\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"emailChangeHashVerify.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/emailChangeHashVerify.mts"],"names":[],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,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAuB,CAAC,CAAA;IAC9F,CAAC;CACD,CAAC,CAAA;AAKF,uFAAuF;AACvF,MAAM,CAAC,MAAM,qBAAqB,GAAmC,mCAAmC,CAAC;IACxG,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,0BAA0B;IACjC,eAAe;IACf,WAAW;CACX,CAAC,CAAA","sourcesContent":["import { SocketLabsLib } from '@email/SocketLabsLib.mjs'\nimport { DEFAULT_VERIFY_EMAIL_PATHS, IVerifyEmailPaths, TAccessModel } from '@lib/access/accessPaths.mjs'\nimport { StringLib } from '@lib/StringLib.mjs'\nimport { UserBase } from '@models/MongoDB/UserBase.mjs'\nimport confirmNewEmail, { TConfirmNewEmail } from '@private/lib/access/db/confirmNewEmail.mjs'\nimport { incReqTimes, TIncReqTimes } from '@private/lib/access/db/incReqTimes.mjs'\nimport { buildProjection, readPath } from '@private/lib/access/pathTools.mjs'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\nimport { GraphQLBoolean, GraphQLNonNull, GraphQLString } from 'graphql'\nimport { Types } from 'mongoose'\n\n/** Arguments accepted by the `emailChangeHashVerify` mutation. Exported so a consumer re-exporting the bound mutation can name its type. */\nexport interface IEmailChangeHashVerifyArgs {\n\temail: string\n\thash: string\n}\n\n/** Model, field map and writers the resolver needs, all bound together by the caller. */\nexport interface IEmailChangeHashVerifyDeps {\n\tmodel: TAccessModel\n\tpaths: IVerifyEmailPaths\n\tconfirmNewEmail: TConfirmNewEmail\n\tincReqTimes: TIncReqTimes\n}\n\n/**\n * Everything the extracted branch handlers need, bundled so each stays within the max-params budget:\n * the bound deps, the lean document just read, the lowercased email and one shared SocketLabs client.\n */\ninterface IVerifyContext {\n\tdeps: IEmailChangeHashVerifyDeps\n\tuser: unknown\n\tuEmail: string\n\tsocketLabs: SocketLabsLib\n}\n\n/**\n * The submitted hash does not match the stored one: count the attempt and warn the account owner.\n * Extracted from resolve() only to keep it inside the max-lines-per-function budget — behaviour unchanged.\n */\nasync function handleHashMismatch(ctx: IVerifyContext, uId: Types.ObjectId, requestTimes: number | undefined) {\n\t// hash failed\n\n\tif (typeof requestTimes === 'undefined') {\n\t\tthrow throwInternalError()\n\t}\n\n\tawait ctx.deps.incReqTimes(uId)\n\t// noinspection ES6MissingAwait\n\tctx.socketLabs.wrongHash(ctx.uEmail, requestTimes)\n\treturn false\n}\n\n/**\n * The submitted hash matches: enforce the freshness/account guards and, if the target email is still\n * free, accept it. Extracted from resolve() only to keep it inside the max-lines-per-function budget.\n */\nasync function handleValidHash(ctx: IVerifyContext, uId: Types.ObjectId, dateLastReq: Date | undefined) {\n\tconst { deps, user, uEmail, socketLabs } = ctx\n\tconst { paths } = deps\n\n\tif (typeof dateLastReq === 'undefined') {\n\t\t// @fixme sentry 'dateLastReq is undefined'\n\t\tthrow throwInternalError()\n\t}\n\n\t// if dateLastReq is older than 3 days, warn and stop\n\tconst StrLibObj = new StringLib()\n\tconst now = new Date()\n\tconst day3ago = new Date(now.setDate(now.getDate() - 3))\n\n\tif (StrLibObj.isoToTimestamp(day3ago) > StrLibObj.isoToTimestamp(dateLastReq)) {\n\t\t// dateLastReq too old then 3 days\n\n\t\t// noinspection ES6MissingAwait\n\t\tsocketLabs.hashReqTooOld(uEmail)\n\t\treturn false\n\t}\n\n\t// account is deleted -> maybe by admin for any reason\n\t// Read raw: this is a .lean() query, so Mongoose casting never runs and these are real booleans\n\t// only on data that scripts/migrate-account-disabled-to-boolean.mjs has been through. A legacy\n\t// string 'false' is truthy and blocks here — migrate, don't coerce.\n\tif (readPath(user, paths.deleted)) {\n\t\treturn false\n\t}\n\t// if account is disabled, for any reason\n\tif (readPath(user, paths.disabled)) {\n\t\t// noinspection ES6MissingAwait\n\t\tsocketLabs.accountDisabled(uEmail)\n\t\treturn false\n\t}\n\n\t// valid request. meanwhile, has some user registered with this email address ??\n\tconst qty = await deps.model.countDocuments({ [paths.email]: uEmail })\n\tif (qty > 0) {\n\t\treturn false\n\t}\n\n\t// accept new email\n\tawait deps.confirmNewEmail(uId, uEmail)\n\treturn true\n}\n\n/**\n * Change email - Verify match between email and hash\n *\n * The collection and every field path come from `deps`, so the same resolver serves any account model.\n * The projection is built from the same map the reads use, which is what keeps a read field from going\n * missing — the exact bug that made every wrong hash answer 500 through 5.1.0.\n */\nexport const createEmailChangeHashVerifyMutation = (deps: IEmailChangeHashVerifyDeps) => ({\n\tdescription: 'Change email - Verify match between email and hash',\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\thash: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: IEmailChangeHashVerifyArgs) {\n\t\tconst { paths } = deps\n\t\tconst uEmail = args.email.toLowerCase()\n\n\t\t// search if the email exists\n\t\t// Every field this resolver reads must be listed. account.email.requestTimes was missing, and\n\t\t// because this is a .lean() read the absent key made handleHashMismatch throw 500 on *every*\n\t\t// wrong hash: the strike counter never advanced and the owner never got the wrongHash warning.\n\t\tconst user = await deps.model\n\t\t\t.findOne({ [paths.newEmailTmp]: uEmail })\n\t\t\t.select(buildProjection([paths.hash, paths.dateLastReq, paths.requestTimes, paths.deleted, paths.disabled]))\n\t\t\t.lean()\n\n\t\t// if email not found, return (do not tell the user the real problem !)\n\t\tif (user === null) {\n\t\t\treturn false // @fixme throw\n\t\t}\n\n\t\tconst ctx: IVerifyContext = { deps, user, uEmail, socketLabs: new SocketLabsLib() }\n\n\t\tconst uId = readPath(user, '_id') as Types.ObjectId\n\t\tconst dateLastReq = readPath(user, paths.dateLastReq) as Date | undefined\n\n\t\tif (args.hash === readPath(user, paths.hash)) {\n\t\t\treturn handleValidHash(ctx, uId, dateLastReq)\n\t\t}\n\t\treturn handleHashMismatch(ctx, uId, readPath(user, paths.requestTimes) as number | undefined)\n\t}\n})\n\n/** Shape of the bound mutation, for the modules that take it as a dependency. */\nexport type TEmailChangeHashVerifyMutation = ReturnType<typeof createEmailChangeHashVerifyMutation>\n\n/** `UserBase`-bound default — the mutation every existing consumer already imports. */\nexport const emailChangeHashVerify: TEmailChangeHashVerifyMutation = createEmailChangeHashVerifyMutation({\n\tmodel: UserBase,\n\tpaths: DEFAULT_VERIFY_EMAIL_PATHS,\n\tconfirmNewEmail,\n\tincReqTimes\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"login4Ever.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/login4Ever.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,WAAW,EAAE,qCAA4B;AAClD,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gCAAuB;AAC9F,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,kFAAyE;AAC/G,OAAO,EAAE,oBAAoB,EAAE,2EAAkE;AACjG,OAAO,EAAE,qBAAqB,EAAE,4EAAmE;AACnG,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,+BAA6B;AACjD,OAAO,EAAgB,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrE,OAAO,QAAQ,MAAM,UAAU,CAAA;AAQ/B,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,WAAW,EAAE,4CAA4C;IACzD,IAAI,EAAE,IAAI,cAAc,CAAC,SAAS,CAAC;IACnC,IAAI,EAAE;QACL,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QAClD,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACrD;IACD,KAAK,CAAC,OAAO,CAAC,CAAU,EAAE,IAAqB,EAAE,GAAkB;QAClE,MAAM,EAA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ContextLogin.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { checkPwdLen } from '@lib/checkPwdLen.mjs'\nimport { setLoginCookies } from '@lib/setLoginCookies.mjs'\nimport { accessTokenExpiry, generateAccessToken, generateRefreshToken } from '@lib/tokens.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { checkUserLoginAuthorization } from '@private/graphQL/schema/mutations/checkUserLoginAuthorization.mjs'\nimport { setRedisLoginSession } from '@private/graphQL/schema/mutations/setRedisLoginSession.mjs'\nimport { updateLoginStats4ever } from '@private/graphQL/schema/mutations/updateLoginStats4ever.mjs'\nimport * as Sentry from '@sentry/node'\nimport { LoginType } from '@stypes/LoginType.mjs'\nimport { GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\n/** Arguments accepted by the `login4Ever` mutation. Exported so a consumer re-exporting the bound mutation can name its type. */\nexport interface ILogin4EverArgs {\n\temail: string\n\tpassword: string\n}\n\nexport const login4Ever = {\n\tdescription: 'login in platform WITHOUT remember me flag',\n\ttype: new GraphQLNonNull(LoginType),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: ILogin4EverArgs, ctx: IContextLogin) {\n\t\tconst { email, password } = args\n\n\t\tconst uEmail = email.toLowerCase().trim()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\tlet accessToken = ''\n\n\t\tconst session = await mongoose.startSession()\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t// search if the email exists\n\t\t\t\tconst user = await checkUserLoginAuthorization(uEmail, password, session)\n\n\t\t\t\t// pwd valid\n\t\t\t\tconst uId = user.userId\n\t\t\t\tawait updateLoginStats4ever(uId, user.lastLogin, session)\n\n\t\t\t\taccessToken = generateAccessToken()\n\t\t\t\tconst refreshToken = generateRefreshToken()\n\t\t\t\tconst accTokenExp = accessTokenExpiry()\n\n\t\t\t\tawait setRedisLoginSession(uId, accessToken, accTokenExp, refreshToken)\n\t\t\t\tsetLoginCookies(ctx, refreshToken)\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\taccessToken = ''\n\t\t\tSentry.captureException(e)\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\t\treturn { accessToken }\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loginAdmin.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/loginAdmin.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,WAAW,EAAE,qCAA4B;AAClD,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gCAAuB;AAC9F,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,gCAAgC,EAAE,uFAA8E;AACzH,OAAO,EAAE,oBAAoB,EAAE,2EAAkE;AACjG,OAAO,EAAE,qBAAqB,EAAE,4EAAmE;AACnG,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,+BAA6B;AACjD,OAAO,EAAE,cAAc,EAAgB,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,QAAQ,MAAM,UAAU,CAAA;AAS/B;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,WAAW,EAAE,yBAAyB;IACtC,IAAI,EAAE,IAAI,cAAc,CAAC,SAAS,CAAC;IACnC,IAAI,EAAE;QACL,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QAClD,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EA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yB,CAAC,CAAA;QAC3C,CAAC;gBAAS,CAAC;YACV,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;QAC3B,CAAC;QAED,OAAO;YACN,WAAW;SACX,CAAA;IACF,CAAC;CACD,CAAA","sourcesContent":["import { IContextLogin } from '@context/IContextLogin.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { checkPwdLen } from '@lib/checkPwdLen.mjs'\nimport { setLoginCookies } from '@lib/setLoginCookies.mjs'\nimport { accessTokenExpiry, generateAccessToken, generateRefreshToken } from '@lib/tokens.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { checkUserAdminLoginAuthorization } from '@private/graphQL/schema/mutations/checkUserAdminLoginAuthorization.mjs'\nimport { setRedisLoginSession } from '@private/graphQL/schema/mutations/setRedisLoginSession.mjs'\nimport { updateAdminLoginStats } from '@private/graphQL/schema/mutations/updateAdminLoginStats.mjs'\nimport * as Sentry from '@sentry/node'\nimport { LoginType } from '@stypes/LoginType.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\n/** Arguments accepted by the `loginAdmin` mutation. Exported so a consumer re-exporting the bound mutation can name its type. */\nexport interface ILoginAdminArgs {\n\temail: string\n\tpassword: string\n\trememberMe: boolean\n}\n\n/**\n *\n */\nexport const loginAdmin = {\n\tdescription: 'login admin in platform',\n\ttype: new GraphQLNonNull(LoginType),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) },\n\t\trememberMe: { type: new GraphQLNonNull(GraphQLBoolean) }\n\t},\n\tasync resolve(_: unknown, args: ILoginAdminArgs, ctx: IContextLogin) {\n\t\tconst { email, password, rememberMe } = args\n\n\t\tconst uEmail = email.toLowerCase().trim()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\tlet accessToken = ''\n\n\t\tconst session = await mongoose.startSession()\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t// search if the email exists\n\t\t\t\tconst user = await checkUserAdminLoginAuthorization(uEmail, password, session)\n\t\t\t\t// pwd valid\n\t\t\t\tconst uId = user.userId\n\t\t\t\tawait updateAdminLoginStats(uId, user.lastLogin, rememberMe, session)\n\n\t\t\t\taccessToken = generateAccessToken()\n\t\t\t\tconst refreshToken = generateRefreshToken()\n\t\t\t\tconst accTokenExp = accessTokenExpiry()\n\n\t\t\t\tawait setRedisLoginSession(uId, accessToken, accTokenExp, refreshToken)\n\t\t\t\tsetLoginCookies(ctx, refreshToken)\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\taccessToken = ''\n\t\t\tSentry.captureException(e)\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\treturn {\n\t\t\taccessToken\n\t\t}\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loginRememberme.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/loginRememberme.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,WAAW,EAAE,qCAA4B;AAClD,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gCAAuB;AAC9F,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,kFAAyE;AAC/G,OAAO,EAAE,oBAAoB,EAAE,2EAAkE;AACjG,OAAO,EAAE,0BAA0B,EAAE,iFAAwE;AAC7G,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,+BAA6B;AACjD,OAAO,EAAE,cAAc,EAAgB,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,QAAQ,MAAM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BAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;gBACvE,eAAe,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;QACH,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACrB,WAAW,GAAG,EAAE,CAAA;YAChB,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;YAC1B,eAAe,CAAC,CAAyB,CAAC,CAAA;QAC3C,CAAC;gBAAS,CAAC;YACV,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;QAC3B,CAAC;QAED,OAAO,EAAE,WAAW,EAAE,CAAA;IACvB,CAAC;CACD,CAAA","sourcesContent":["import { IContextLogin } from '@context/IContextLogin.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { checkPwdLen } from '@lib/checkPwdLen.mjs'\nimport { setLoginCookies } from '@lib/setLoginCookies.mjs'\nimport { accessTokenExpiry, generateAccessToken, generateRefreshToken } from '@lib/tokens.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { checkUserLoginAuthorization } from '@private/graphQL/schema/mutations/checkUserLoginAuthorization.mjs'\nimport { setRedisLoginSession } from '@private/graphQL/schema/mutations/setRedisLoginSession.mjs'\nimport { updateLoginStatsRememberme } from '@private/graphQL/schema/mutations/updateLoginStatsRememberme.mjs'\nimport * as Sentry from '@sentry/node'\nimport { LoginType } from '@stypes/LoginType.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\n/** Arguments accepted by the `loginRememberme` mutation. Exported so a consumer re-exporting the bound mutation can name its type. */\nexport interface ILoginRemembermeArgs {\n\temail: string\n\tpassword: string\n\trememberMe: boolean\n}\n\nexport const loginRememberme = {\n\tdescription: 'login in platform with remember me flag',\n\ttype: new GraphQLNonNull(LoginType),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) },\n\t\trememberMe: { type: new GraphQLNonNull(GraphQLBoolean) }\n\t},\n\tasync resolve(_: unknown, args: ILoginRemembermeArgs, ctx: IContextLogin) {\n\t\tconst { email, password, rememberMe } = args\n\n\t\tconst uEmail = email.toLowerCase().trim()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\tlet accessToken = ''\n\n\t\tconst session = await mongoose.startSession()\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t// search if the email exists\n\t\t\t\tconst user = await checkUserLoginAuthorization(uEmail, password, session)\n\t\t\t\t// pwd valid\n\t\t\t\tconst uId = user.userId\n\t\t\t\tawait updateLoginStatsRememberme(uId, user.lastLogin, rememberMe, session)\n\n\t\t\t\taccessToken = generateAccessToken()\n\t\t\t\tconst refreshToken = generateRefreshToken()\n\t\t\t\tconst accTokenExp = accessTokenExpiry()\n\n\t\t\t\tawait setRedisLoginSession(uId, accessToken, accTokenExp, refreshToken)\n\t\t\t\tsetLoginCookies(ctx, refreshToken)\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\taccessToken = ''\n\t\t\tSentry.captureException(e)\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\treturn { accessToken }\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"logout.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/logout.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,qBAAqB,EAAE,qDAA4C;AAC5E,OAAO,EAAE,mBAAmB,EAAE,sCAA6B;AAC3D,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExD,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC;IACxC,KAAK,CAAC,OAAO,CAAC,CAAU,EAAE,EAAE,EAAE,GAAmB;QAChD,IAAI,CAAC;YACJ,iDAAiD;YACjD,iDAAiD;YACjD,2FAA2F;YAC3F,mFAAmF;YACnF,wFAAwF;YAExF,MAAM,WAAW,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,qBAAqB,CAAC,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;YAElH,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,IAAI,EAAE,CAAA;YACrD,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;gBACxB,MAAM,WAAW,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,qBAAqB,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC,CAAA;YAClG,CAAC;YAED,iBAAiB;YACjB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,EAAE,mBAAmB,CAAC,CAAA;QAC1D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,gBAAgB;YAChB,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;QAC3B,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC;CACD,CAAA","sourcesContent":["import { IContextLogout } from '@context/IContextLogout.mjs'\nimport { redisClient } from '@dataSources/Redis.mjs'\nimport { buildPrefixedRedisKey } from '@lib/Redis/buildPrefixedRedisKey.mjs'\nimport { refreshTokenOptions } from '@lib/tokenOptions.mjs'\nimport * as Sentry from '@sentry/node'\nimport * as dotenv from 'dotenv'\nimport { GraphQLBoolean, GraphQLNonNull } from 'graphql'\n\ndotenv.config()\n\nexport const logout = {\n\tdescription: 'logout',\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\tasync resolve(_: unknown, {}, ctx: IContextLogout) {\n\t\ttry {\n\t\t\t// delete the access token used to make this call\n\t\t\t// and, if it still exists, the refresh token too\n\t\t\t// buildPrefixedRedisKey is idempotent: the tokens are already prefixed when ctx.state.user\n\t\t\t// comes from authenticatedLogoutHandler, so re-adding the prefix here would delete\n\t\t\t// 'refresh:refresh:<uuid>' — a key that was never written — and leave the session alive\n\n\t\t\tawait redisClient.del(`${process.env.REDIS_KEY}${buildPrefixedRedisKey('refresh:', ctx.state.user.refreshToken)}`)\n\n\t\t\tconst accessToken = ctx.state.user?.accessToken || ''\n\t\t\tif (accessToken !== '') {\n\t\t\t\tawait redisClient.del(`${process.env.REDIS_KEY}${buildPrefixedRedisKey('access:', accessToken)}`)\n\t\t\t}\n\n\t\t\t// delete cookies\n\t\t\tctx.cookies.set('refresh_token', '', refreshTokenOptions)\n\t\t} catch (e) {\n\t\t\t// ignore errors\n\t\t\tSentry.captureException(e)\n\t\t}\n\n\t\treturn true\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"refresh.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/refresh.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gCAAuB;AACpH,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,iCAA+B;AACrD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;AAEtD,MAAM,CAAC,MAAM,EAAE,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CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAA;YAErH,eAAe,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;YAElC,mDAAmD;YACnD,MAAM,WAAW,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,UAAU,EAAE,CAAC,CAAA;YAE9D,MAAM,GAAG,IAAI,CAAA;QACd,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACrB,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;YAC1B,cAAc;YACd,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;YAC5E,WAAW,GAAG,EAAE,CAAA;YAChB,eAAe,CAAC,CAAyB,CAAC,CAAA;QAC3C,CAAC;QAED,OAAO;YACN,MAAM;YACN,WAAW;SACX,CAAA;IACF,CAAC;CACD,CAAA","sourcesContent":["import { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { redisClient } from '@dataSources/Redis.mjs'\nimport { setLoginCookies } from '@lib/setLoginCookies.mjs'\nimport { accessTokenExpiry, generateAccessToken, generateRefreshToken, REFRESH_TOKEN_EXPIRY } from '@lib/tokens.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport * as Sentry from '@sentry/node'\nimport { RefreshType } from '@stypes/RefreshType.mjs'\nimport * as dotenv from 'dotenv'\nimport { GraphQLError, GraphQLNonNull } from 'graphql'\n\ndotenv.config()\n\nexport const refresh = {\n\tdescription: 'refresh token',\n\ttype: new GraphQLNonNull(RefreshType),\n\tasync resolve(_: unknown, {}, ctx: IContextRefresh) {\n\t\tlet status = false // default\n\n\t\t// has the refresh token, access token already expired\n\n\t\t// gets the user id already copied into ctx\n\t\tconst userId = ctx.state.user.id.toString()\n\n\t\t// generates the 2 new tokens\n\t\tlet accessToken = generateAccessToken()\n\t\tlet refreshToken = generateRefreshToken()\n\t\tconst keyAccess = `${process.env.REDIS_KEY}access:${accessToken}`\n\t\tconst keyRefresh = `${process.env.REDIS_KEY}refresh:${refreshToken}`\n\n\t\tlet accessTokenData = ctx.state.user\n\t\tconst oldRefresh = ctx.state.user.refreshToken\n\t\t// @ts-expect-error delete refresh\n\t\tdelete accessTokenData.refreshToken\n\n\t\tconst refreshTokenData = { id: userId }\n\n\t\ttry {\n\t\t\t// Store session in Redis\n\t\t\tawait Promise.all([\n\t\t\t\tredisClient.hSet(keyAccess, accessTokenData as unknown as Record<string, string>),\n\t\t\t\tredisClient.hSet(keyRefresh, refreshTokenData as unknown as Record<string, string>)\n\t\t\t])\n\n\t\t\t// set expiry\n\t\t\tconst accTokenExp = accessTokenExpiry()\n\t\t\tawait Promise.all([redisClient.expire(keyAccess, accTokenExp), redisClient.expire(keyRefresh, REFRESH_TOKEN_EXPIRY)])\n\n\t\t\tsetLoginCookies(ctx, refreshToken)\n\n\t\t\t// deletes the refresh token used to make this call\n\t\t\tawait redisClient.del(`${process.env.REDIS_KEY}${oldRefresh}`)\n\n\t\t\tstatus = true\n\t\t} catch (e: unknown) {\n\t\t\tSentry.captureException(e)\n\t\t\t// delete keys\n\t\t\tawait Promise.all([redisClient.del(keyAccess), redisClient.del(keyRefresh)])\n\t\t\taccessToken = ''\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t}\n\n\t\treturn {\n\t\t\tstatus,\n\t\t\taccessToken\n\t\t}\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"resetPwd.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/resetPwd.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,yCAAgC;AACxD,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,cAAc,EAAE,mCAA0B;AACnD,OAAO,EAAE,OAAO,EAAE,iCAAwB;AAC1C,OA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AA6F;QAC7F,4FAA4F;QAC5F,uFAAuF;QACvF,+FAA+F;QAC/F,yFAAyF;QACzF,MAAM,IAAI,GAAG,WAAkC,CAAA;QAC/C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC;gBACJ,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA;gBACzC,KAAK,aAAa,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;oBACpF,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;gBAC3B,CAAC,CAAC,CAAA;YACH,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACrB,oEAAoE;gBACpE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;YAC3B,CAAC;QACF,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC;CACD,CAAC,CAAA;AAKF,uFAAuF;AACvF,MAAM,CAAC,MAAM,QAAQ,GAAsB,sBAAsB,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAA","sourcesContent":["import { SocketLabsLib } from '@email/SocketLabsLib.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { EMAIL_HASH_LEN } from '@lib/Constants.mjs'\nimport { DateLib } from '@lib/DateLib.mjs'\nimport { StringLib } from '@lib/StringLib.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { getResetPwd, TGetResetPwd } from '@private/lib/access/db/getResetPwd.mjs'\nimport { saveResetReq, TSaveResetReq } from '@private/lib/access/db/saveResetReq.mjs'\nimport * as Sentry from '@sentry/node'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\n/** Arguments accepted by the `resetPwd` mutation. Exported so a consumer re-exporting the bound mutation can name its type. */\nexport interface IResetPwdArgs {\n\temail: string\n}\n\n/** What the committed transaction leaves behind for the post-commit send. */\ninterface IPendingMail {\n\thash: string\n\tname: string\n}\n\n/** Readers and writers the resolver needs, all bound to the same model + paths by the caller. */\nexport interface IResetPwdDeps {\n\tgetResetPwd: TGetResetPwd\n\tsaveResetReq: TSaveResetReq\n}\n\n/**\n * Take the user email and send an email with a link for change the password.\n * for privacy, true is returned whatever happens: unknown address, first request, or a request\n * throttled because the previous one is less than 10 minutes old. The caller can never tell them apart,\n * and the mail is queued after the commit without being awaited so the response time does not tell\n * them apart either.\n *\n * The collection and field layout live entirely in the injected reader/writer, so the same resolver\n * serves any account model. Nothing about the flow itself changes.\n */\nexport const createResetPwdMutation = (deps: IResetPwdDeps) => ({\n\tdescription: 'send reset password link',\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: IResetPwdArgs) {\n\t\tconst { email } = args\n\n\t\tconst uEmail = email.toLowerCase().trim()\n\t\tcheckEmailLen(uEmail)\n\n\t\t// Set only when the transaction actually persisted a fresh reset request. The mail itself goes\n\t\t// out after the commit, and is not awaited — see the block below the transaction.\n\t\tlet pendingMail: IPendingMail | null = null\n\n\t\tconst session = await mongoose.startSession()\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t// email exists? -> retrieve whether there have already been reset requests -> return 4xx ??\n\t\t\t\tconst resetPwdVal = await deps.getResetPwd(session, uEmail)\n\n\t\t\t\t// don't reveal that the email doesn't exist, for privacy\n\t\t\t\tif (resetPwdVal === null) return\n\n\t\t\t\t// ok, email exists\n\n\t\t\t\t// -> wait 10 minutes from the last password reset request\n\n\t\t\t\t// if a password request already exists, read the date in seconds.\n\t\t\t\tconst lastReq = typeof resetPwdVal.resetDateReq !== 'undefined' ? new Date('' + resetPwdVal.resetDateReq) : null\n\n\t\t\t\t// request already made previously?\n\t\t\t\t// send a new email with the recovery link only if the last one is at least 10 minutes old\n\t\t\t\tconst nowDt = new Date()\n\n\t\t\t\t// The throttle is enforced silently. Throwing 429 here answered \"this address is\n\t\t\t\t// registered and has a reset pending\" to an unauthenticated caller, while an unknown\n\t\t\t\t// address returned true — an enumeration oracle for any address that had been through\n\t\t\t\t// this flow. Both cases now return true and send nothing.\n\t\t\t\tlet calculateHash = true\n\t\t\t\tif (lastReq !== null) {\n\t\t\t\t\tcalculateHash = DateLib.minElapsed(lastReq) >= 10\n\t\t\t\t}\n\n\t\t\t\tif (calculateHash) {\n\t\t\t\t\t// generate hash for password reset\n\t\t\t\t\tconst StrObj = new StringLib()\n\t\t\t\t\tconst hash = StrObj.randomString(EMAIL_HASH_LEN)\n\n\t\t\t\t\t// set hash and current reset date\n\t\t\t\t\tawait deps.saveResetReq(session, resetPwdVal._id, nowDt, hash)\n\n\t\t\t\t\t// the mail is queued after the commit, not here\n\t\t\t\t\tpendingMail = { hash, name: resetPwdVal.name }\n\t\t\t\t} // calculateHash\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\t// Reached only on a committed transaction: tryCatchRethrow above always throws.\n\t\t//\n\t\t// Three reasons this send sits here and is deliberately not awaited:\n\t\t// 1. Timing. Awaiting a network round-trip to SocketLabs made the response measurably slower\n\t\t// exactly when the address was registered and not throttled — the same fact the removed 429\n\t\t// used to state outright. What is left is one extra updateOne, ~a millisecond against\n\t\t// internet jitter, and the 10-minute throttle caps an attacker at one sample per address,\n\t\t// so there is nothing to average out.\n\t\t// 2. Retries. session.withTransaction re-runs its callback on a transient error. With the send\n\t\t// inside, a retried commit mailed the user a second link and invalidated the first.\n\t\t// 3. Failure disclosure. A SocketLabs outage used to surface as a 500, which only an address\n\t\t// that actually exists could ever receive.\n\t\t// The cost is that a delivery failure is now visible in Sentry only, mail in flight is lost if\n\t\t// the process is killed before the request settles, and — the one a user feels — the hash is\n\t\t// already committed when the send fails, so the 10-minute throttle is armed for a link that\n\t\t// never arrived. Clearing resetHash/resetDateReq from the catch below to undo that was\n\t\t// considered and rejected: a rejected promise does not prove non-delivery, and a timeout after\n\t\t// SocketLabs accepted the message would kill a link already sitting in the user's inbox.\n\t\tconst mail = pendingMail as IPendingMail | null\n\t\tif (mail !== null) {\n\t\t\ttry {\n\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\tvoid SocketLabsObj.sendEmailReset(uEmail, mail.hash, mail.name).catch((e: unknown) => {\n\t\t\t\t\tSentry.captureException(e)\n\t\t\t\t})\n\t\t\t} catch (e: unknown) {\n\t\t\t\t// the constructor, or a synchronous throw before the promise exists\n\t\t\t\tSentry.captureException(e)\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n})\n\n/** Shape of the bound mutation, for the modules that take it as a dependency. */\nexport type TResetPwdMutation = ReturnType<typeof createResetPwdMutation>\n\n/** `UserBase`-bound default — the mutation every existing consumer already imports. */\nexport const resetPwd: TResetPwdMutation = createResetPwdMutation({ getResetPwd, saveResetReq })\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"signUp.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/signUp.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,yCAAgC;AACxD,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,WAAW,EAAE,qCAA4B;AAClD,OAAO,EAAE,eAAe,EAAE,4CAAmC;AAC7D,OAAO,EAAE,SAAS,EAAE,sCAA6B;AACjD,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,2CAAqC;AAClE,OAAO,EAAE,cAAc,EAAgB,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,QAAQ,MAAM,UAAU,CAAA;AAQ/B,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,WAAW,EAAE,SAAS;IACtB,IAAI,EA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C,CAAA;QAC3C,CAAC;gBAAS,CAAC;YACV,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;QAC3B,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC;CACD,CAAA","sourcesContent":["import { SocketLabsLib } from '@email/SocketLabsLib.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { checkPwdLen } from '@lib/checkPwdLen.mjs'\nimport { registerNewUser } from '@lib/db/registerNewUser.mjs'\nimport { userExist } from '@lib/db/userExist.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { throwConflictError } from '@throw/throwConflictError.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\n/** Arguments accepted by the `signUp` mutation. Exported so a consumer re-exporting the bound mutation can name its type. */\nexport interface ISignUpArgs {\n\temail: string\n\tpassword: string\n}\n\nexport const signUp = {\n\tdescription: 'Sign Up',\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: ISignUpArgs) {\n\t\tconst { email, password } = args\n\n\t\tconst uEmail = email.toLowerCase().trim()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\tconst session = await mongoose.startSession()\n\t\tlet uExist = false\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t/********************************************\n\t\t\t\t * First, search if the user does not exist\n\t\t\t\t */\n\t\t\t\tuExist = await userExist(uEmail, session)\n\t\t\t\tif (uExist) {\n\t\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\t\tawait SocketLabsObj.emailAlreadyValid(uEmail)\n\t\t\t\t\tthrow throwConflictError()\n\t\t\t\t}\n\n\t\t\t\t/*********************************************\n\t\t\t\t * ok, new user. create user obj for DB. generate hash password\n\t\t\t\t */\n\t\t\t\tconst hashConfirmEmail = await registerNewUser(uEmail, password, session)\n\n\t\t\t\t/************************************\n\t\t\t\t * send email\n\t\t\t\t */\n\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\tawait SocketLabsObj.sendEmailVerify(uEmail, hashConfirmEmail)\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\treturn true\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"updatePassword.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/mutations/updatePassword.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,yCAAgC;AACxD,OAAO,EAAE,aAAa,EAAE,uCAA8B;AACtD,OAAO,EAAE,WAAW,EAAE,qCAA4B;AAClD,OAAO,EAAE,OAAO,EAAE,iCAAwB;AAC1C,OAAO,EAAE,eAAe,EAAE,yCAAgC;AAC1D,OAAO,EAAE,WAAW,EAAgB,uDAA8C;AAClF,OAAO,cAAmC,0DAAiD;AAC3F,OAAO,gBAAuC,4DAAmD;AACjG,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,4CAAsC;AACpE,OAAO,EAAE,kBAAkB,EAAE,2CAAqC;AAClE,OAAO,EAAE,cAAc,EAAgB,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,QAA2B,MAAM,UAAU,CAAA;AAuBlD;;;;GAIG;AACH,KAAK,UAAU,kBAAkB,CAChC,IAAyB,EACzB,OAAsB,EACtB,KAA2B;IAE3B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IACxC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAExD,kCAAkC;IAClC,I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;QAC7F,6FAA6F;QAC7F,+FAA+F;QAC/F,sFAAsF;QACtF,EAAE;QACF,8FAA8F;QAC9F,8FAA8F;QAC9F,+FAA+F;QAC/F,6FAA6F;QAC7F,iEAAiE;QACjE,EAAE;QACF,6FAA6F;QAC7F,4FAA4F;QAC5F,yFAAyF;QACzF,0FAA0F;QAC1F,uCAAuC;QACvC,MAAM,IAAI,GAAG,SAA0B,CAAA;QACvC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC;gBACJ,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA;gBACzC,MAAM,aAAa,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YAC3D,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACrB,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;YAC3B,CAAC;QACF,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC;CACD,CAAC,CAAA;AAKF,uFAAuF;AACvF,MAAM,CAAC,MAAM,cAAc,GAA4B,4BAA4B,CAAC;IACnF,WAAW;IACX,gBAAgB;IAChB,cAAc;CACd,CAAC,CAAA","sourcesContent":["import { SocketLabsLib } from '@email/SocketLabsLib.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { checkPwdLen } from '@lib/checkPwdLen.mjs'\nimport { DateLib } from '@lib/DateLib.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { getResetPwd, TGetResetPwd } from '@private/lib/access/db/getResetPwd.mjs'\nimport removeResetReq, { TRemoveResetReq } from '@private/lib/access/db/removeResetReq.mjs'\nimport updatePasswordDb, { TUpdatePasswordDb } from '@private/lib/access/db/updatePasswordDb.mjs'\nimport * as Sentry from '@sentry/node'\nimport { throwForbiddenError } from '@throw/throwForbiddenError.mjs'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose, { ClientSession } from 'mongoose'\n\n/** Arguments accepted by the `updatePassword` mutation. Exported so a consumer re-exporting the bound mutation can name its type. */\nexport interface IUpdatePasswordArgs {\n\temail: string\n\thash: string\n\tpassword: string\n}\n\n/** Readers and writers the resolver needs, all bound to the same model + paths by the caller. */\nexport interface IUpdatePasswordDeps {\n\tgetResetPwd: TGetResetPwd\n\tupdatePasswordDb: TUpdatePasswordDb\n\tremoveResetReq: TRemoveResetReq\n}\n\n/** Normalised inputs the transaction body works on, bundled to keep it within the max-params budget. */\ninterface IUpdatePasswordInput {\n\tuEmail: string\n\thash: string\n\tpassword: string\n}\n\n/**\n * The transactional core: validate the reset hash, apply the new password and clear the request.\n * Extracted from resolve() only to keep it inside the max-lines-per-function budget — behaviour\n * unchanged. Returns the account holder's name so the caller can mail the post-commit confirmation.\n */\nasync function applyPasswordReset(\n\tdeps: IUpdatePasswordDeps,\n\tsession: ClientSession,\n\tinput: IUpdatePasswordInput\n): Promise<string> {\n\tconst { uEmail, hash, password } = input\n\tconst resetPwd = await deps.getResetPwd(session, uEmail)\n\n\t// check if email is present in db\n\tif (resetPwd === null) {\n\t\tthrow throwForbiddenError() // don't reveal whether the email is present, for privacy\n\t}\n\n\t// No usable reset state. This is NOT an internal error as far as the caller is concerned:\n\t// answering 500 here while an unknown address answers 403 turns this mutation into an\n\t// account-enumeration oracle, because every registered account that has never requested a\n\t// reset lands on this branch (getResetPwd yields resetHash === null whenever\n\t// account.resetDateReq is undefined). Same 403 as the unknown-address path; the orphan\n\t// state is reported to Sentry instead of to the caller.\n\tif (resetPwd.resetHash === null) {\n\t\tSentry.captureMessage(`[updatePassword] no usable resetHash for ${uEmail}`)\n\t\tthrow throwForbiddenError()\n\t}\n\t/* c8 ignore next 4 -- defensive guard, resetDateReq cannot be null when resetHash is set */\n\tif (resetPwd.resetDateReq === null) {\n\t\tSentry.captureMessage(`[updatePassword] resetHash set but resetDateReq missing for ${uEmail}`)\n\t\tthrow throwForbiddenError()\n\t}\n\n\t// check if hash is missing or invalid\n\tif (resetPwd.resetHash !== hash) {\n\t\tthrow throwForbiddenError() // don't reveal whether the email is present, for privacy\n\t}\n\n\t// check if the request was made within 1 hour\n\tconst dt1 = new Date('' + resetPwd.resetDateReq)\n\tif (DateLib.minElapsed(dt1) > 60) {\n\t\tthrow throwForbiddenError() // The link is no longer valid\n\t}\n\n\tconst update = await deps.updatePasswordDb(session, resetPwd._id, password)\n\tif (!update) {\n\t\tthrow throwInternalError() // \"System error while updating the password.\"\n\t}\n\n\t// delete password reset request data from db\n\tawait deps.removeResetReq(session, uEmail)\n\n\t// the confirmation email is sent after the commit, not here\n\treturn resetPwd.name\n}\n\n/**\n * Change the password of an account holding a valid, unexpired reset hash.\n *\n * The collection and field layout live entirely in the injected reader/writers, so the same resolver\n * serves any account model. In particular the cleanup unsets whatever `resetClear` names, which is not\n * necessarily the two leaf paths this resolver reads — see `removeResetReq`.\n */\nexport const createUpdatePasswordMutation = (deps: IUpdatePasswordDeps) => ({\n\tdescription: \"changes the user's password\",\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\thash: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: IUpdatePasswordArgs) {\n\t\tconst { email, hash, password } = args\n\n\t\tconst uEmail = email.trim().toLowerCase()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\t// Set only once the transaction has actually persisted the new password. Carries the user's\n\t\t// name to the post-commit confirmation email.\n\t\tlet confirmTo: string | null = null\n\n\t\tconst session = await mongoose.startSession()\n\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\tconfirmTo = await applyPasswordReset(deps, session, { uEmail, hash, password })\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\t// Reached only on a committed transaction: tryCatchRethrow above always throws.\n\t\t//\n\t\t// The send sits here rather than inside the callback because session.withTransaction re-runs\n\t\t// its callback on a transient error, and a retried commit therefore mailed the user a second\n\t\t// \"your password was changed\" notice. It is still awaited — unlike resetPwd there is no timing\n\t\t// oracle to close here, since reaching this point at all requires a valid reset hash.\n\t\t//\n\t\t// A delivery failure no longer fails the request. It used to abort the transaction and answer\n\t\t// 500, rolling back the password change with it — consistent, but it made the mail provider a\n\t\t// hard dependency: with SocketLabs down, nobody could complete a reset at all. The password is\n\t\t// committed by the time we get here, so the failure goes to Sentry and the caller still gets\n\t\t// true. The confirmation is a notice, not part of the operation.\n\t\t//\n\t\t// Don't \"restore\" the abort: there is no transaction left to abort at this point. Rethrowing\n\t\t// would report 500 for a password that is already live, and compensating would mean writing\n\t\t// back the old bcrypt hash, which this flow never reads. Moving the send back inside the\n\t\t// callback brings back the duplicate notice AND lets a mail go out for a commit that then\n\t\t// fails — an email cannot be recalled.\n\t\tconst name = confirmTo as string | null\n\t\tif (name !== null) {\n\t\t\ttry {\n\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\tawait SocketLabsObj.sendResetPwdConfirmation(uEmail, name)\n\t\t\t} catch (e: unknown) {\n\t\t\t\tSentry.captureException(e)\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n})\n\n/** Shape of the bound mutation, for the modules that take it as a dependency. */\nexport type TUpdatePasswordMutation = ReturnType<typeof createUpdatePasswordMutation>\n\n/** `UserBase`-bound default — the mutation every existing consumer already imports. */\nexport const updatePassword: TUpdatePasswordMutation = createUpdatePasswordMutation({\n\tgetResetPwd,\n\tupdatePasswordDb,\n\tremoveResetReq\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeleteType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/DeleteType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEvE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC;IAC/C,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,YAAY,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;QACtC,YAAY,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;KAClC,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,CAAC;CACf,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLInt, GraphQLObjectType } from 'graphql'\n\nexport const DeleteType = new GraphQLObjectType({\n\tname: 'DeleteType',\n\tfields: () => ({\n\t\tacknowledged: { type: GraphQLBoolean },\n\t\tdeletedCount: { type: GraphQLInt }\n\t})\n})\n\nexport const RET_DEL_ROLLBACK = {\n\tacknowledged: false,\n\tdeletedCount: 0\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DoneType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/DoneType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAErG,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC;IAC7C,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE;QAClD,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QACpD,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KACxB,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLID, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\nexport const DoneType = new GraphQLObjectType({\n\tname: 'DoneType',\n\tfields: () => ({\n\t\tdone: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\tmessage: { type: new GraphQLNonNull(GraphQLString) },\n\t\t_id: { type: GraphQLID }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FindOneAndUpdateType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/FindOneAndUpdateType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3E,MAAM,0BAA0B,GAAG,IAAI,iBAAiB,CAAC;IACxD,IAAI,EAAE,4BAA4B;IAClC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,eAAe,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE;KAC7D,CAAC;CACF,CAAC,CAAA;AAEF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,iBAAiB,CAAC;IACzD,IAAI,EAAE,sBAAsB;IAC5B,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,eAAe,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,0BAA0B,CAAC,EAAE;KACzE,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType } from 'graphql'\n\nconst FindOneAndUpdateDetailType = new GraphQLObjectType({\n\tname: 'FindOneAndUpdateDetailType',\n\tfields: () => ({\n\t\tupdatedExisting: { type: new GraphQLNonNull(GraphQLBoolean) }\n\t})\n})\n\n// I ignore the other data\nexport const FindOneAndUpdateType = new GraphQLObjectType({\n\tname: 'FindOneAndUpdateType',\n\tfields: () => ({\n\t\tlastErrorObject: { type: new GraphQLNonNull(FindOneAndUpdateDetailType) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoginAppType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/LoginAppType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1F,sCAAsC;AACtC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,iBAAiB,CAAC;IACjD,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QACxD,cAAc,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QAC3D,cAAc,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE;KAC5D,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n// returns null id if it fails to save\nexport const LoginAppType = new GraphQLObjectType({\n\tname: 'LoginAppType',\n\tfields: () => ({\n\t\taccessToken: { type: new GraphQLNonNull(GraphQLString) },\n\t\tonboardingStep: { type: new GraphQLNonNull(GraphQLString) },\n\t\tonboardingDone: { type: new GraphQLNonNull(GraphQLBoolean) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoginType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/LoginType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1E,sCAAsC;AACtC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC;IAC9C,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACxD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n// returns null id if it fails to save\nexport const LoginType = new GraphQLObjectType({\n\tname: 'LoginType',\n\tfields: () => ({\n\t\taccessToken: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MidNameType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/MidNameType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAErF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE;QAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACjD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLID, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n/**\n * MongoDB _id & name\n */\nexport const MidNameType = new GraphQLObjectType({\n\tname: 'MidNameType',\n\tfields: () => ({\n\t\t_id: { type: new GraphQLNonNull(GraphQLID) },\n\t\tname: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"OnlyIdType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/OnlyIdType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC;IAC/C,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE;KAC5C,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLID, GraphQLNonNull, GraphQLObjectType } from 'graphql'\n\nexport const OnlyIdType = new GraphQLObjectType({\n\tname: 'OnlyIdType',\n\tfields: () => ({\n\t\t_id: { type: new GraphQLNonNull(GraphQLID) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RefreshType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/RefreshType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1F,sCAAsC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE;QACpD,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACxD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLBoolean, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n// returns null id if it fails to save\nexport const RefreshType = new GraphQLObjectType({\n\tname: 'RefreshType',\n\tfields: () => ({\n\t\tstatus: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\taccessToken: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RetStatusMexType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/RetStatusMexType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,iBAAiB,CAAC;IACrD,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;QACnD,GAAG,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;KAC5B,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\nexport const RetStatusMexType = new GraphQLObjectType({\n\tname: 'RetStatusMexType',\n\tfields: () => ({\n\t\tstatus: { type: new GraphQLNonNull(GraphQLString) },\n\t\tmex: { type: GraphQLString }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RetStatusType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/RetStatusType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1E,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,iBAAiB,CAAC;IAClD,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACnD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\nexport const RetStatusType = new GraphQLObjectType({\n\tname: 'RetStatusType',\n\tfields: () => ({\n\t\tstatus: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SaveType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/SaveType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEtD,sCAAsC;AACtC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC;IAC7C,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KACxB,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLID, GraphQLObjectType } from 'graphql'\n\n// returns null id if it fails to save\nexport const SaveType = new GraphQLObjectType({\n\tname: 'SaveType',\n\tfields: () => ({\n\t\t_id: { type: GraphQLID }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SidNameType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/SidNameType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,UAAU,CAAC,EAAE;QAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACjD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLInt, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n/**\n * MariaDB id & name\n */\nexport const SidNameType = new GraphQLObjectType({\n\tname: 'SidNameType',\n\tfields: () => ({\n\t\tid: { type: new GraphQLNonNull(GraphQLInt) },\n\t\tname: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SidNomeType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/SidNomeType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,UAAU,CAAC,EAAE;QAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE;KACjD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLInt, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql'\n\n/**\n * MariaDB id & nome\n */\nexport const SidNomeType = new GraphQLObjectType({\n\tname: 'SidNomeType',\n\tfields: () => ({\n\t\tid: { type: new GraphQLNonNull(GraphQLInt) },\n\t\tnome: { type: new GraphQLNonNull(GraphQLString) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UpdateResultType.mjs","sourceRoot":"","sources":["../../../../src/graphQL/schema/types/UpdateResultType.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA,CAAC,sCAAsC;AAE9G,sCAAsC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,iBAAiB,CAAC;IACrD,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,aAAa,EAAE,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,UAAU,CAAC,EAAE;KACvD,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLInt, GraphQLNonNull, GraphQLObjectType } from 'graphql' // returns null id if it fails to save\n\n// returns null id if it fails to save\nexport const UpdateResultType = new GraphQLObjectType({\n\tname: 'UpdateResultType',\n\tfields: () => ({\n\t\tmodifiedCount: { type: new GraphQLNonNull(GraphQLInt) }\n\t})\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.mjs","sourceRoot":"","sources":["../../src/graphQL/status.mts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAA;AACxB,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA;AAC9B,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAA;AAClD,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAA;AACpD,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAA;AACxC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAA;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAA","sourcesContent":["export const stOk = 'ok'\nexport const stExist = 'exist'\nexport const stFailToSendEmail = 'failToSendEmail'\nexport const stNotFoundNotMatch = 'notFoundNotMatch'\nexport const stErrBackend = 'errBackend'\nexport const stWait = 'wait'\nexport const stExpired = 'expired'\n"]}