@axiumine/koa-utils 3.7.3 → 3.7.4

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 (215) hide show
  1. package/README.md +183 -0
  2. package/dist/dataSources/MariaDB.mjs +1 -0
  3. package/dist/dataSources/MariaDB.mjs.map +1 -1
  4. package/dist/dataSources/MongoDB.mjs +1 -0
  5. package/dist/dataSources/MongoDB.mjs.map +1 -1
  6. package/dist/dataSources/PostgreSQL.mjs +4 -2
  7. package/dist/dataSources/PostgreSQL.mjs.map +1 -1
  8. package/dist/dataSources/Redis.mjs +15 -13
  9. package/dist/dataSources/Redis.mjs.map +1 -1
  10. package/dist/email/SocketLabsLib.mjs +7 -10
  11. package/dist/email/SocketLabsLib.mjs.map +1 -1
  12. package/dist/files/IUploadTemp.mjs.map +1 -1
  13. package/dist/files/checkForNSFW.mjs.map +1 -1
  14. package/dist/files/fileConst.mjs.map +1 -1
  15. package/dist/files/moveFileStaticDomain.mjs.map +1 -1
  16. package/dist/files/moveImageFile.mjs.map +1 -1
  17. package/dist/files/moveTempFile.mjs.map +1 -1
  18. package/dist/files/reEncodeToJpeg.mjs.map +1 -1
  19. package/dist/files/reEncodeToPng.mjs.map +1 -1
  20. package/dist/files/reEncodeToWebp.mjs.map +1 -1
  21. package/dist/files/scanVirus.mjs.map +1 -1
  22. package/dist/files/storeUploadAsTemp.mjs +2 -0
  23. package/dist/files/storeUploadAsTemp.mjs.map +1 -1
  24. package/dist/files/uploadTempImage.mjs.map +1 -1
  25. package/dist/files/uploadTempPdf.mjs.map +1 -1
  26. package/dist/files/validateExtension.mjs.map +1 -1
  27. package/dist/files/validateJpgPngExtension.mjs.map +1 -1
  28. package/dist/files/validateMimeType.mjs.map +1 -1
  29. package/dist/files/validateMimeTypeImages.mjs.map +1 -1
  30. package/dist/files/validateMimeTypePdf.mjs.map +1 -1
  31. package/dist/files/validatePdfExtension.mjs.map +1 -1
  32. package/dist/graphQL/models/MongoDB/UserBase.mjs.map +1 -1
  33. package/dist/graphQL/models/MongoDB/log/DevStatsGraphQLCalls.mjs.map +1 -1
  34. package/dist/graphQL/models/MongoDB/log/LogGlobalError.mjs.map +1 -1
  35. package/dist/graphQL/models/MongoDB/log/LogStatsGraphql.mjs.map +1 -1
  36. package/dist/graphQL/models/MongoDB/log/LogThrow.mjs.map +1 -1
  37. package/dist/graphQL/schema/GraphQLInput/GraphQLInputLogin.mjs.map +1 -1
  38. package/dist/graphQL/schema/context/IContextAuthenticatedResource.mjs.map +1 -1
  39. package/dist/graphQL/schema/context/IContextKoaErrorHandler.mjs.map +1 -1
  40. package/dist/graphQL/schema/context/IContextLogin.mjs.map +1 -1
  41. package/dist/graphQL/schema/context/IContextLogout.mjs.map +1 -1
  42. package/dist/graphQL/schema/context/IContextRefresh.mjs.map +1 -1
  43. package/dist/graphQL/schema/context/TCommonHeaders.mjs.map +1 -1
  44. package/dist/graphQL/schema/interfaces/IFindAndUpdate.mjs.map +1 -1
  45. package/dist/graphQL/schema/mutations/emailChangeHashVerify.mjs.map +1 -1
  46. package/dist/graphQL/schema/mutations/login4Ever.mjs.map +1 -1
  47. package/dist/graphQL/schema/mutations/loginAdmin.mjs.map +1 -1
  48. package/dist/graphQL/schema/mutations/loginRememberme.mjs.map +1 -1
  49. package/dist/graphQL/schema/mutations/logout.mjs.map +1 -1
  50. package/dist/graphQL/schema/mutations/refresh.mjs +1 -4
  51. package/dist/graphQL/schema/mutations/refresh.mjs.map +1 -1
  52. package/dist/graphQL/schema/mutations/resetPwd.mjs +2 -3
  53. package/dist/graphQL/schema/mutations/resetPwd.mjs.map +1 -1
  54. package/dist/graphQL/schema/mutations/signUp.mjs.map +1 -1
  55. package/dist/graphQL/schema/mutations/updatePassword.mjs +2 -1
  56. package/dist/graphQL/schema/mutations/updatePassword.mjs.map +1 -1
  57. package/dist/graphQL/schema/types/DeleteType.mjs.map +1 -1
  58. package/dist/graphQL/schema/types/DoneType.mjs.map +1 -1
  59. package/dist/graphQL/schema/types/FindOneAndUpdateType.mjs.map +1 -1
  60. package/dist/graphQL/schema/types/LoginAppType.mjs.map +1 -1
  61. package/dist/graphQL/schema/types/LoginType.mjs.map +1 -1
  62. package/dist/graphQL/schema/types/MidNameType.mjs.map +1 -1
  63. package/dist/graphQL/schema/types/OnlyIdType.mjs.map +1 -1
  64. package/dist/graphQL/schema/types/RefreshType.mjs.map +1 -1
  65. package/dist/graphQL/schema/types/RetStatusMexType.mjs.map +1 -1
  66. package/dist/graphQL/schema/types/RetStatusType.mjs.map +1 -1
  67. package/dist/graphQL/schema/types/SaveType.mjs.map +1 -1
  68. package/dist/graphQL/schema/types/SidNameType.mjs.map +1 -1
  69. package/dist/graphQL/schema/types/SidNomeType.mjs.map +1 -1
  70. package/dist/graphQL/schema/types/UpdateResultType.mjs.map +1 -1
  71. package/dist/graphQL/status.mjs.map +1 -1
  72. package/dist/graphQL/throw/throwAccessTokenExpiredOrDeleted.mjs.map +1 -1
  73. package/dist/graphQL/throw/throwAccessTokenRequired.mjs.map +1 -1
  74. package/dist/graphQL/throw/throwAlreadyDone.mjs.map +1 -1
  75. package/dist/graphQL/throw/throwAlreadyTakenError.mjs.map +1 -1
  76. package/dist/graphQL/throw/throwConflictError.mjs.map +1 -1
  77. package/dist/graphQL/throw/throwErrorWrongUserInput.mjs.map +1 -1
  78. package/dist/graphQL/throw/throwForbiddenError.mjs.map +1 -1
  79. package/dist/graphQL/throw/throwGoneError.mjs.map +1 -1
  80. package/dist/graphQL/throw/throwGraphQLError.mjs +1 -6
  81. package/dist/graphQL/throw/throwGraphQLError.mjs.map +1 -1
  82. package/dist/graphQL/throw/throwInternalError.mjs.map +1 -1
  83. package/dist/graphQL/throw/throwMethodNotAllowedError.mjs.map +1 -1
  84. package/dist/graphQL/throw/throwMissingMalformedInvalidToken.mjs.map +1 -1
  85. package/dist/graphQL/throw/throwNotAcceptableError.mjs.map +1 -1
  86. package/dist/graphQL/throw/throwNotFoundError.mjs.map +1 -1
  87. package/dist/graphQL/throw/throwNotImplementedError.mjs.map +1 -1
  88. package/dist/graphQL/throw/throwPaymentRequiredError.mjs.map +1 -1
  89. package/dist/graphQL/throw/throwPreconditionFailedNoAuthCookie.mjs.map +1 -1
  90. package/dist/graphQL/throw/throwPreconditionFailedNoAuthHeader.mjs.map +1 -1
  91. package/dist/graphQL/throw/throwRefreshTokenExpiredOrDeleted.mjs.map +1 -1
  92. package/dist/graphQL/throw/throwRefreshTokenRequired.mjs.map +1 -1
  93. package/dist/graphQL/throw/throwRefreshTokenSignatureRequired.mjs.map +1 -1
  94. package/dist/graphQL/throw/throwTooManyRequestsError.mjs.map +1 -1
  95. package/dist/graphQL/throw/throwUnauthorizedError.mjs.map +1 -1
  96. package/dist/graphQL/throw/throwUnprocessableContentError.mjs.map +1 -1
  97. package/dist/graphQL/throw/throwUnsupportedMediaTypeError.mjs.map +1 -1
  98. package/dist/koa/IFileUpload.mjs.map +1 -1
  99. package/dist/koa/IKoaError.mjs.map +1 -1
  100. package/dist/koa/customFormatErrorFn.mjs.map +1 -1
  101. package/dist/koa/logRequestToDb.mjs.map +1 -1
  102. package/dist/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.mjs.map +1 -1
  103. package/dist/koa/middleware/authenticatedAuthorizationHandler/index.mjs.map +1 -1
  104. package/dist/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs.map +1 -1
  105. package/dist/koa/middleware/authenticatedLogoutHandler/index.mjs.map +1 -1
  106. package/dist/koa/middleware/authenticatedResourceHandler/index.mjs +1 -2
  107. package/dist/koa/middleware/authenticatedResourceHandler/index.mjs.map +1 -1
  108. package/dist/koa/middleware/debug/index.mjs.map +1 -1
  109. package/dist/koa/router/verifyEmail.mjs +2 -0
  110. package/dist/koa/router/verifyEmail.mjs.map +1 -1
  111. package/dist/koa/tdwKoaErrorHandler.mjs.map +1 -1
  112. package/dist/lib/ArrayLib.mjs +3 -4
  113. package/dist/lib/ArrayLib.mjs.map +1 -1
  114. package/dist/lib/Constants.mjs.map +1 -1
  115. package/dist/lib/DateLib.mjs +2 -3
  116. package/dist/lib/DateLib.mjs.map +1 -1
  117. package/dist/lib/IAuthorizationDisDel.mjs.map +1 -1
  118. package/dist/lib/ICookies.mjs.map +1 -1
  119. package/dist/lib/MariaDB/IMariaDBErr.mjs.map +1 -1
  120. package/dist/lib/MariaDB/MariaDBErrType.mjs.map +1 -1
  121. package/dist/lib/MariaDB/throwSqlErrors.mjs +3 -5
  122. package/dist/lib/MariaDB/throwSqlErrors.mjs.map +1 -1
  123. package/dist/lib/MongoDB/IMongoDBError.mjs.map +1 -1
  124. package/dist/lib/MongoDB/IOnboarding.mjs.map +1 -1
  125. package/dist/lib/MongoDB/MongoDBErrType.mjs.map +1 -1
  126. package/dist/lib/MongoDB/throwIfMongoErr.mjs +2 -5
  127. package/dist/lib/MongoDB/throwIfMongoErr.mjs.map +1 -1
  128. package/dist/lib/MongoDB/throwMongoErrors.mjs.map +1 -1
  129. package/dist/lib/NumLib.mjs +2 -3
  130. package/dist/lib/NumLib.mjs.map +1 -1
  131. package/dist/lib/PostgreSQL/IPostgresError.mjs.map +1 -1
  132. package/dist/lib/PostgreSQL/IPostgresErrorCodes.mjs.map +1 -1
  133. package/dist/lib/PostgreSQL/makePostgreSqlLogError.mjs.map +1 -1
  134. package/dist/lib/Redis/RedisBoolean.mjs.map +1 -1
  135. package/dist/lib/Redis/fromRedisBooleanValue.mjs.map +1 -1
  136. package/dist/lib/Redis/toRedisBooleanValue.mjs.map +1 -1
  137. package/dist/lib/StringLib.mjs +3 -4
  138. package/dist/lib/StringLib.mjs.map +1 -1
  139. package/dist/lib/checkEmailLen.mjs +1 -1
  140. package/dist/lib/checkEmailLen.mjs.map +1 -1
  141. package/dist/lib/checkPwdLen.mjs.map +1 -1
  142. package/dist/lib/db/log/hitStat.mjs +1 -5
  143. package/dist/lib/db/log/hitStat.mjs.map +1 -1
  144. package/dist/lib/db/log/logGlobalError.mjs.map +1 -1
  145. package/dist/lib/db/log/logGraphql.mjs.map +1 -1
  146. package/dist/lib/db/log/logThrow.mjs.map +1 -1
  147. package/dist/lib/db/login/ILoginSet.mjs.map +1 -1
  148. package/dist/lib/db/login/ILoginUnset.mjs.map +1 -1
  149. package/dist/lib/db/registerNewUser.mjs.map +1 -1
  150. package/dist/lib/db/userExist.mjs +1 -3
  151. package/dist/lib/db/userExist.mjs.map +1 -1
  152. package/dist/lib/emailHash.mjs.map +1 -1
  153. package/dist/lib/encryptPassword.mjs.map +1 -1
  154. package/dist/lib/hash.mjs +2 -2
  155. package/dist/lib/hash.mjs.map +1 -1
  156. package/dist/lib/makeOnboardingData.mjs.map +1 -1
  157. package/dist/lib/setLoginCookies.mjs.map +1 -1
  158. package/dist/lib/sleepMs.mjs +1 -1
  159. package/dist/lib/sleepMs.mjs.map +1 -1
  160. package/dist/lib/throwIfNotValidEnumValue.mjs.map +1 -1
  161. package/dist/lib/tokenOptions.mjs +1 -1
  162. package/dist/lib/tokenOptions.mjs.map +1 -1
  163. package/dist/lib/tokens.mjs.map +1 -1
  164. package/dist/lib/tryCatchRethrow.mjs.map +1 -1
  165. package/dist/private/files/_validateMimeType.mjs.map +1 -1
  166. package/dist/private/files/reEncode.mjs +4 -20
  167. package/dist/private/files/reEncode.mjs.map +1 -1
  168. package/dist/private/graphQL/Consts.mjs.map +1 -1
  169. package/dist/private/graphQL/models/MongoDB/private/UserAdminKoaUtils.mjs.map +1 -1
  170. package/dist/private/graphQL/schema/context/IContextLog.mjs.map +1 -1
  171. package/dist/private/graphQL/schema/context/IContextVerifyEmail.mjs.map +1 -1
  172. package/dist/private/graphQL/schema/mutations/_buildLoginStatsUpdate.d.mts +19 -0
  173. package/dist/private/graphQL/schema/mutations/_buildLoginStatsUpdate.mjs +26 -0
  174. package/dist/private/graphQL/schema/mutations/_buildLoginStatsUpdate.mjs.map +1 -0
  175. package/dist/private/graphQL/schema/mutations/_finalizeLoginCheck.d.mts +19 -0
  176. package/dist/private/graphQL/schema/mutations/_finalizeLoginCheck.mjs +28 -0
  177. package/dist/private/graphQL/schema/mutations/_finalizeLoginCheck.mjs.map +1 -0
  178. package/dist/private/graphQL/schema/mutations/checkUserAdminLoginAuthorization.mjs +2 -25
  179. package/dist/private/graphQL/schema/mutations/checkUserAdminLoginAuthorization.mjs.map +1 -1
  180. package/dist/private/graphQL/schema/mutations/checkUserLoginAuthorization.mjs +2 -26
  181. package/dist/private/graphQL/schema/mutations/checkUserLoginAuthorization.mjs.map +1 -1
  182. package/dist/private/graphQL/schema/mutations/infoUserAdminForLogin.mjs +1 -2
  183. package/dist/private/graphQL/schema/mutations/infoUserAdminForLogin.mjs.map +1 -1
  184. package/dist/private/graphQL/schema/mutations/infoUserForLogin.mjs +1 -2
  185. package/dist/private/graphQL/schema/mutations/infoUserForLogin.mjs.map +1 -1
  186. package/dist/private/graphQL/schema/mutations/infoUserForLoginSQL.mjs +1 -1
  187. package/dist/private/graphQL/schema/mutations/infoUserForLoginSQL.mjs.map +1 -1
  188. package/dist/private/graphQL/schema/mutations/setLastLoginSQL.mjs.map +1 -1
  189. package/dist/private/graphQL/schema/mutations/setRedisLoginSession.mjs +2 -8
  190. package/dist/private/graphQL/schema/mutations/setRedisLoginSession.mjs.map +1 -1
  191. package/dist/private/graphQL/schema/mutations/updateAdminLoginStats.mjs +2 -22
  192. package/dist/private/graphQL/schema/mutations/updateAdminLoginStats.mjs.map +1 -1
  193. package/dist/private/graphQL/schema/mutations/updateLoginStats4ever.mjs.map +1 -1
  194. package/dist/private/graphQL/schema/mutations/updateLoginStatsRememberme.mjs +2 -22
  195. package/dist/private/graphQL/schema/mutations/updateLoginStatsRememberme.mjs.map +1 -1
  196. package/dist/private/lib/access/Constants.mjs.map +1 -1
  197. package/dist/private/lib/access/db/confirmNewEmail.mjs.map +1 -1
  198. package/dist/private/lib/access/db/deleteUserByEmail.mjs.map +1 -1
  199. package/dist/private/lib/access/db/enableEmailAccess.mjs.map +1 -1
  200. package/dist/private/lib/access/db/getResetPwd.mjs.map +1 -1
  201. package/dist/private/lib/access/db/incReqTimes.mjs.map +1 -1
  202. package/dist/private/lib/access/db/removeResetReq.mjs.map +1 -1
  203. package/dist/private/lib/access/db/saveResetReq.mjs.map +1 -1
  204. package/dist/private/lib/access/db/setEmailHash.mjs.map +1 -1
  205. package/dist/private/lib/access/db/updatePasswordDb.mjs.map +1 -1
  206. package/dist/private/lib/access/db/userData4VerifyEmail.mjs.map +1 -1
  207. package/dist/private/lib/access/handleBadDB.mjs.map +1 -1
  208. package/dist/private/lib/access/handleIfAccountDeleted.mjs.map +1 -1
  209. package/dist/private/lib/access/handleIfAccountDisabled.mjs.map +1 -1
  210. package/dist/private/lib/access/handleIfEmailAlreadyValid.mjs.map +1 -1
  211. package/dist/private/lib/access/handleIfHashBad.mjs.map +1 -1
  212. package/dist/private/lib/access/handleIfMoreThan3DaysPassed.mjs.map +1 -1
  213. package/dist/private/lib/access/handleIfTooMuchRequestsTimes.mjs.map +1 -1
  214. package/dist/private/lib/makeBodyJson.mjs.map +1 -1
  215. package/package.json +18 -1
@@ -1 +1 @@
1
- {"version":3,"file":"throwConflictError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwConflictError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qCAAyC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,OAAe,6BAA6B,EAC3C,EAAE;IACH,0CAA0C;IAC1C,MAAM,sBAAsB,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC,CAAA"}
1
+ {"version":3,"file":"throwConflictError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwConflictError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qCAAyC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,6BAA6B,EAAE,EAAE;IAClF,0CAA0C;IAC1C,MAAM,sBAAsB,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC,CAAA","sourcesContent":["import { throwAlreadyTakenError } from '@throw/throwAlreadyTakenError.mjs'\n\nexport const throwConflictError = (desc: string = 'You have already done this.') => {\n\t// es. invio email a chi l'ha già ricevuta\n\tthrow throwAlreadyTakenError(desc)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwErrorWrongUserInput.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwErrorWrongUserInput.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAE,EAAE;IAC3D,MAAM,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,CAAA;AACrD,CAAC,CAAA"}
1
+ {"version":3,"file":"throwErrorWrongUserInput.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwErrorWrongUserInput.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAE,EAAE;IAC3D,MAAM,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,CAAA;AACrD,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwErrorWrongUserInput = (message: string) => {\n\tthrow throwGraphQLError(400, 'Bad Request', message)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwForbiddenError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwForbiddenError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACvC,MAAM,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AACxD,CAAC,CAAA"}
1
+ {"version":3,"file":"throwForbiddenError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwForbiddenError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACvC,MAAM,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AACxD,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwForbiddenError = () => {\n\tthrow throwGraphQLError(403, 'Forbidden', 'Forbidden.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwGoneError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwGoneError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAe,iBAAiB,EAAE,EAAE;IAClE,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC7C,CAAC,CAAA"}
1
+ {"version":3,"file":"throwGoneError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwGoneError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAe,iBAAiB,EAAE,EAAE;IAClE,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC7C,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwGoneError = (desc: string = ERR_MISCONFIGURED) => {\n\tthrow throwGraphQLError(410, ERR_OOPS, desc)\n}\n"]}
@@ -1,10 +1,5 @@
1
1
  import { GraphQLError } from 'graphql';
2
2
  export const throwGraphQLError = (status, title, description = '') => {
3
- throw new GraphQLError(title, {
4
- extensions: {
5
- http: { status },
6
- description
7
- }
8
- });
3
+ throw new GraphQLError(title, { extensions: { http: { status }, description } });
9
4
  };
10
5
  //# sourceMappingURL=throwGraphQLError.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"throwGraphQLError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwGraphQLError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAChC,MAAc,EACd,KAAa,EACb,cAAsB,EAAE,EACvB,EAAE;IACH,MAAM,IAAI,YAAY,CAAC,KAAK,EAAE;QAC7B,UAAU,EAAE;YACX,IAAI,EAAE,EAAE,MAAM,EAAE;YAChB,WAAW;SACX;KACD,CAAC,CAAA;AACH,CAAC,CAAA"}
1
+ {"version":3,"file":"throwGraphQLError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwGraphQLError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,cAAsB,EAAE,EAAE,EAAE;IAC5F,MAAM,IAAI,YAAY,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,CAAC,CAAA;AACjF,CAAC,CAAA","sourcesContent":["import { GraphQLError } from 'graphql'\n\nexport const throwGraphQLError = (status: number, title: string, description: string = '') => {\n\tthrow new GraphQLError(title, { extensions: { http: { status }, description } })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwInternalError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwInternalError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE,EAAE;IACvD,MAAM,iBAAiB,CACtB,GAAG,EACH,uBAAuB,EACvB,8BAA8B,IAAI,EAAE,CACpC,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwInternalError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwInternalError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE,EAAE;IACvD,MAAM,iBAAiB,CAAC,GAAG,EAAE,uBAAuB,EAAE,8BAA8B,IAAI,EAAE,CAAC,CAAA;AAC5F,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwInternalError = (desc: string = '') => {\n\tthrow throwGraphQLError(500, 'Internal Server Error', `Error reported to Dev Team.${desc}`)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwMethodNotAllowedError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwMethodNotAllowedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC9C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA"}
1
+ {"version":3,"file":"throwMethodNotAllowedError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwMethodNotAllowedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC9C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwMethodNotAllowedError = () => {\n\tthrow throwGraphQLError(405, ERR_OOPS, ERR_MISCONFIGURED)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwMissingMalformedInvalidToken.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwMissingMalformedInvalidToken.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACrD,MAAM,iBAAiB,CACtB,GAAG,EACH,gBAAgB,EAChB,kCAAkC,CAClC,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwMissingMalformedInvalidToken.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwMissingMalformedInvalidToken.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACrD,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,kCAAkC,CAAC,CAAA;AACnF,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwMissingMalformedInvalidToken = () => {\n\tthrow throwGraphQLError(499, 'Token Required', 'Missing/malformed/invalid token.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwNotAcceptableError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwNotAcceptableError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC3C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA"}
1
+ {"version":3,"file":"throwNotAcceptableError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwNotAcceptableError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC3C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwNotAcceptableError = () => {\n\tthrow throwGraphQLError(406, ERR_OOPS, ERR_MISCONFIGURED)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwNotFoundError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwNotFoundError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,iBAAiB,EAAE,EAAE;IACtE,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC7C,CAAC,CAAA"}
1
+ {"version":3,"file":"throwNotFoundError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwNotFoundError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,iBAAiB,EAAE,EAAE;IACtE,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC7C,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwNotFoundError = (desc: string = ERR_MISCONFIGURED) => {\n\tthrow throwGraphQLError(404, ERR_OOPS, desc)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwNotImplementedError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwNotImplementedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC5C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA"}
1
+ {"version":3,"file":"throwNotImplementedError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwNotImplementedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yCAAmC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC5C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAC1D,CAAC,CAAA","sourcesContent":["import { ERR_MISCONFIGURED, ERR_OOPS } from '@private/graphQL/Consts.mjs'\nimport { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwNotImplementedError = () => {\n\tthrow throwGraphQLError(501, ERR_OOPS, ERR_MISCONFIGURED)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwPaymentRequiredError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwPaymentRequiredError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC7C,MAAM,iBAAiB,CACtB,GAAG,EACH,kBAAkB,EAClB,mDAAmD,CACnD,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwPaymentRequiredError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwPaymentRequiredError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC7C,MAAM,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,EAAE,mDAAmD,CAAC,CAAA;AACtG,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwPaymentRequiredError = () => {\n\tthrow throwGraphQLError(402, 'Payment Required', 'You must have a subscription to use this feature.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwPreconditionFailedNoAuthCookie.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwPreconditionFailedNoAuthCookie.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,EAAE;IACvD,MAAM,iBAAiB,CACtB,GAAG,EACH,qBAAqB,EACrB,0BAA0B,CAC1B,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwPreconditionFailedNoAuthCookie.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwPreconditionFailedNoAuthCookie.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,EAAE;IACvD,MAAM,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,EAAE,0BAA0B,CAAC,CAAA;AAChF,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from './throwGraphQLError.mjs'\n\nexport const throwPreconditionFailedNoAuthCookie = () => {\n\tthrow throwGraphQLError(412, 'Precondition Failed', 'No authorization cookie.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwPreconditionFailedNoAuthHeader.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwPreconditionFailedNoAuthHeader.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,EAAE;IACvD,MAAM,iBAAiB,CACtB,GAAG,EACH,qBAAqB,EACrB,0BAA0B,CAC1B,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwPreconditionFailedNoAuthHeader.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwPreconditionFailedNoAuthHeader.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,EAAE;IACvD,MAAM,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,EAAE,0BAA0B,CAAC,CAAA;AAChF,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from './throwGraphQLError.mjs'\n\nexport const throwPreconditionFailedNoAuthHeader = () => {\n\tthrow throwGraphQLError(412, 'Precondition Failed', 'No authorization header.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwRefreshTokenExpiredOrDeleted.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwRefreshTokenExpiredOrDeleted.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACrD,MAAM,iBAAiB,CACtB,GAAG,EACH,eAAe,EACf,+CAA+C,CAC/C,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwRefreshTokenExpiredOrDeleted.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwRefreshTokenExpiredOrDeleted.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACrD,MAAM,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,+CAA+C,CAAC,CAAA;AAC/F,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwRefreshTokenExpiredOrDeleted = () => {\n\tthrow throwGraphQLError(498, 'Invalid Token', 'Refresh Token is expired or deleted by Admin.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwRefreshTokenRequired.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwRefreshTokenRequired.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC7C,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,yBAAyB,CAAC,CAAA;AAC1E,CAAC,CAAA"}
1
+ {"version":3,"file":"throwRefreshTokenRequired.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwRefreshTokenRequired.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC7C,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,yBAAyB,CAAC,CAAA;AAC1E,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwRefreshTokenRequired = () => {\n\tthrow throwGraphQLError(499, 'Token Required', 'Refresh Token Required.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwRefreshTokenSignatureRequired.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwRefreshTokenSignatureRequired.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAAG,EAAE;IACtD,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,mCAAmC,CAAC,CAAA;AACpF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwRefreshTokenSignatureRequired.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwRefreshTokenSignatureRequired.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAAG,EAAE;IACtD,MAAM,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,EAAE,mCAAmC,CAAC,CAAA;AACpF,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwRefreshTokenSignatureRequired = () => {\n\tthrow throwGraphQLError(499, 'Token Required', 'Refresh Token Signature Required.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwTooManyRequestsError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwTooManyRequestsError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAe,EAAE,EAAE,EAAE;IAC9D,MAAM,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAA;AACxD,CAAC,CAAA"}
1
+ {"version":3,"file":"throwTooManyRequestsError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwTooManyRequestsError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAe,EAAE,EAAE,EAAE;IAC9D,MAAM,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAA;AACxD,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwTooManyRequestsError = (desc: string = '') => {\n\tthrow throwGraphQLError(429, 'Too Many Requests', desc)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwUnauthorizedError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwUnauthorizedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAe,uBAAuB,EAAE,EAAE;IAChF,MAAM,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,CAAA;AACnD,CAAC,CAAA"}
1
+ {"version":3,"file":"throwUnauthorizedError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwUnauthorizedError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAe,uBAAuB,EAAE,EAAE;IAChF,MAAM,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,CAAA;AACnD,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwUnauthorizedError = (text: string = 'You are unauthorized.') => {\n\tthrow throwGraphQLError(401, 'Unauthorized', text)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwUnprocessableContentError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwUnprocessableContentError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAc,qEAAqE,EAAE,EAAE;IACrI,MAAM,iBAAiB,CACtB,GAAG,EACH,uBAAuB,EACvB,GAAG,CACH,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwUnprocessableContentError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwUnprocessableContentError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC7C,MAAc,qEAAqE,EAClF,EAAE;IACH,MAAM,iBAAiB,CAAC,GAAG,EAAE,uBAAuB,EAAE,GAAG,CAAC,CAAA;AAC3D,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwUnprocessableContentError = (\n\ttxt: string = 'We are unable to process the instructions contained in the request.'\n) => {\n\tthrow throwGraphQLError(422, 'Unprocessable Content', txt)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwUnsupportedMediaTypeError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwUnsupportedMediaTypeError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE;IAClD,MAAM,iBAAiB,CACtB,GAAG,EACH,wBAAwB,EACxB,uEAAuE,CACvE,CAAA;AACF,CAAC,CAAA"}
1
+ {"version":3,"file":"throwUnsupportedMediaTypeError.mjs","sourceRoot":"","sources":["../../../../src/graphQL/throw/throwUnsupportedMediaTypeError.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAoC;AAEhE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE;IAClD,MAAM,iBAAiB,CAAC,GAAG,EAAE,wBAAwB,EAAE,uEAAuE,CAAC,CAAA;AAChI,CAAC,CAAA","sourcesContent":["import { throwGraphQLError } from '@throw/throwGraphQLError.mjs'\n\nexport const throwUnsupportedMediaTypeError = () => {\n\tthrow throwGraphQLError(415, 'Unsupported Media Type', 'The chosen media type is not supported. Please change the media type.')\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IFileUpload.mjs","sourceRoot":"","sources":["../../../src/koa/IFileUpload.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"IFileUpload.mjs","sourceRoot":"","sources":["../../../src/koa/IFileUpload.mts"],"names":[],"mappings":"","sourcesContent":["export interface IFileUpload {\n\tcreateReadStream: () => NodeJS.ReadableStream\n\tfilename: string\n\tmimetype: string\n\tencoding: string\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IKoaError.mjs","sourceRoot":"","sources":["../../../src/koa/IKoaError.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"IKoaError.mjs","sourceRoot":"","sources":["../../../src/koa/IKoaError.mts"],"names":[],"mappings":"","sourcesContent":["export interface IKoaError {\n\textensions?: {\n\t\thttp?: {\n\t\t\tstatus: number\n\t\t}\n\t\tdescription: string\n\t}\n\tstatus?: number\n\tbody: {\n\t\tdescription: string\n\t}\n\tmessage: string\n\tpath: string\n\tstack: string\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"customFormatErrorFn.mjs","sourceRoot":"","sources":["../../../src/koa/customFormatErrorFn.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAyB,EAAE,EAAE;IAChE,IAAI,GAAG,YAAY,YAAY,EAAE,CAAC;QACjC,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE;YACnC,UAAU,EAAE,GAAG,CAAC,UAAU;SAC1B,CAAC,CAAA;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC,CAAA"}
1
+ {"version":3,"file":"customFormatErrorFn.mjs","sourceRoot":"","sources":["../../../src/koa/customFormatErrorFn.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAyB,EAAE,EAAE;IAChE,IAAI,GAAG,YAAY,YAAY,EAAE,CAAC;QACjC,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE;YACnC,UAAU,EAAE,GAAG,CAAC,UAAU;SAC1B,CAAC,CAAA;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC,CAAA","sourcesContent":["import { GraphQLError } from 'graphql'\n\nexport const customFormatErrorFn = (err: GraphQLError | Error) => {\n\tif (err instanceof GraphQLError) {\n\t\tthrow new GraphQLError(err.message, {\n\t\t\textensions: err.extensions\n\t\t})\n\t}\n\n\treturn err\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"logRequestToDb.mjs","sourceRoot":"","sources":["../../../src/koa/logRequestToDb.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,6BAA0B;AAInD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAgB,EAAE,IAAU;IAChE,qDAAqD;IACrD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IACzB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACxB,MAAM,IAAI,EAAE,CAAA;IAEZ,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACtB,MAAM,KAAK,GAAG,GAAG,GAAG,KAAK,CAAA;IAEzB,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,cAAc,CAAA;IACjD,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAA;IACrD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IACzB,OAAO,CAAC,KAAK,CACZ,GAAG,MAAM,IAAI,aAAa,gBAAgB,IAAI,CAAC,QAAQ,EAAE,MAAM,KAAK,uBAAuB,CAC3F,CAAA;IAED,iDAAiD;AAClD,CAAC"}
1
+ {"version":3,"file":"logRequestToDb.mjs","sourceRoot":"","sources":["../../../src/koa/logRequestToDb.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,6BAA0B;AAInD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAgB,EAAE,IAAU;IAChE,qDAAqD;IACrD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IACzB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACxB,MAAM,IAAI,EAAE,CAAA;IAEZ,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACtB,MAAM,KAAK,GAAG,GAAG,GAAG,KAAK,CAAA;IAEzB,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,cAAc,CAAA;IACjD,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAA;IACrD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IACzB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,aAAa,gBAAgB,IAAI,CAAC,QAAQ,EAAE,MAAM,KAAK,uBAAuB,CAAC,CAAA;IAE1G,iDAAiD;AAClD,CAAC","sourcesContent":["import { OBJECTID_0_OBJ } from '@lib/Constants.mjs'\nimport { IContextLog } from '@private/graphQL/schema/context/IContextLog.mjs'\nimport { Next } from 'koa'\n\nexport async function logRequestToDb(ctx: IContextLog, next: Next) {\n\t// qui ${ctx.request.body?.operationName} è undefined\n\tconst method = ctx.method\n\tconsole.debug(`${method} ${ctx.url}\\n\\r`)\n\tconst start = Date.now()\n\tawait next()\n\n\tconst now = Date.now()\n\tconst msTot = now - start\n\n\tconst user = ctx.state.user?.id || OBJECTID_0_OBJ\n\tconst operationName = ctx.request.body?.operationName\n\tconst status = ctx.status\n\tconsole.debug(`${status} ${operationName} eseguita da ${user.toString()} - ${msTot}ms\\n\\r---------------`)\n\n\t// logGraphql(user, operationName, status, msTot)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TCookieRefreshToken.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"TCookieRefreshToken.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/authenticatedAuthorizationHandler/TCookieRefreshToken.mts"],"names":[],"mappings":"","sourcesContent":["export type TCookieRefreshToken = {\n\trefresh_token?: string\n\t'refresh_token.sig'?: string\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/authenticatedAuthorizationHandler/index.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,mBAAmB,EAAE,uDAAsC;AACpE,OAAO,EAAE,iCAAiC,EAAE,qEAAoD;AAChG,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAGhC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AAEzE,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,CAAC,MAAM,iCAAiC,GAC7C,CAAC,IAAa,EAAE,EAAE,CAAC,KAAK,EAAE,GAAoB,EAAE,IAAU,EAAE,EAAE;IAC7D,2CAA2C;IAE3C;;;OAGG;IAEH,6CAA6C;IAC7C,MAAM,iBAAiB,GAAG,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MAAM,gCAAgC,CAAA;AAEzE,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,KAAK,EAAE,GAAoB,EAAE,IAAU,EAAE,EAAE;IAC9G,2CAA2C;IAE3C;;;OAGG;IAEH,6CAA6C;IAC7C,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC7D,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,iBAAiB,EAAE,CAAC,CAAA;IAC5F,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,EAAE,GAAG,UAAU,EAAE,CAAA,CAAC,mGAAmG;QAErI,wDAAwD;QACxD,2HAA2H;QAC3H,IAAI,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YAC3C,MAAM,mBAAmB,EAAE,CAAA;QAC5B,CAAC;QACD,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG;YAChB,GAAG,OAAO;YACV,EAAE,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,YAAY,EAAE,iBAAiB;SAC/B,CAAA;IACF,CAAC;SAAM,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,qBAAqB,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAChG,MAAM,iCAAiC,EAAE,CAAA;IAC1C,CAAC,CAAC,qBAAqB;IAEvB,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { redisClient } from '@dataSources/Redis.mjs'\nimport { throwForbiddenError } from '@throw/throwForbiddenError.mjs'\nimport { throwRefreshTokenExpiredOrDeleted } from '@throw/throwRefreshTokenExpiredOrDeleted.mjs'\nimport * as dotenv from 'dotenv'\nimport Keygrip from 'keygrip'\nimport { Next } from 'koa'\nimport { Types } from 'mongoose'\n\nimport { verifySignedRefreshToken } from './verifySignedRefreshToken.mjs'\n\ndotenv.config()\n\nexport const authenticatedAuthorizationHandler = (keys: Keygrip) => async (ctx: IContextRefresh, next: Next) => {\n\t// console.debug('[authorizationHandler] ')\n\n\t/***************************\n\t * CLIENT:\n\t * - invia opaque token come cookie\n\t */\n\n\t// la chiave esiste in redis ? ok, read redis\n\tconst refreshTokenRedis = verifySignedRefreshToken(ctx, keys)\n\tconst redSession = await redisClient.hGetAll(`${process.env.REDIS_KEY}${refreshTokenRedis}`)\n\tif (Object.keys(redSession).length !== 0) {\n\t\tconst redData = { ...redSession } // For safety, Redis return an object without the default Object.prototype in its prototype chain.\n\n\t\t// user è riportato come bloccato dentro alla sessione ?\n\t\t// da usare per bloccare l'accesso all'utente, invece di eliminare il token, impostare questo flag da pannello di controllo\n\t\tif (redData?.disabled || redData?.deleted) {\n\t\t\tthrow throwForbiddenError()\n\t\t}\n\t\tctx.state.user = {\n\t\t\t...redData,\n\t\t\tid: new Types.ObjectId(redData.id),\n\t\t\trefreshToken: refreshTokenRedis\n\t\t}\n\t} else if (ctx.request.header?.['x-introspectioncode'] !== `${process.env.INTROSPECTION_CODE}`) {\n\t\tthrow throwRefreshTokenExpiredOrDeleted()\n\t} // else return next()\n\n\treturn next()\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"verifySignedRefreshToken.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;AACpG,OAAO,EAAE,yBAAyB,EAAE,6DAA4C;AAChF,OAAO,EAAE,kCAAkC,EAAE,sEAAqD;AAClG,OAAO,EAAE,s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efreshToken.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;AACpG,OAAO,EAAE,yBAAyB,EAAE,6DAA4C;AAChF,OAAO,EAAE,kCAAkC,EAAE,sEAAqD;AAClG,OAAO,EAAE,sBAAsB,EAAE,0DAAyC;AAK1E,MAAM,UAAU,wBAAwB,CAAC,GAAoB,EAAE,IAAa;IAC3E,6FAA6F;IAE7F,MAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAA;IAC/C,0DAA0D;IAE1D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,mCAAmC,EAAE,CAAA;IAC5C,CAAC;IAED,MAAM,OAAO,GAAwB,EAAE,CAAA;IACvC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC1C,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC7C,qCAAqC;QACrC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACrB,CAAC,CAAC,CAAA;IACF;;OAEG;IACH,MAAM,YAAY,GAAG,OAAO,EAAE,aAAa,CAAA;IAC3C,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,MAAM,yBAAyB,EAAE,CAAA;IAClC,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,EAAE,CAAC,mBAAmB,CAAC,CAAA;IAChD,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,kCAAkC,EAAE,CAAA;IAC3C,CAAC;IACD,8CAA8C;IAC9C,wCAAwC;IAExC,mBAAmB;IACnB,gCAAgC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,YAAY,EAAE,EAAE,SAAS,CAAC,CAAA;IAEpE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QAClB,oBAAoB;QACpB,MAAM,sBAAsB,CAAC,kCAAkC,CAAC,CAAA;IACjE,CAAC;IACD,gCAAgC;IAEhC,OAAO,WAAW,YAAY,EAAE,CAAA;AACjC,CAAC","sourcesContent":["import { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { throwPreconditionFailedNoAuthCookie } from '@throw/throwPreconditionFailedNoAuthCookie.mjs'\nimport { throwRefreshTokenRequired } from '@throw/throwRefreshTokenRequired.mjs'\nimport { throwRefreshTokenSignatureRequired } from '@throw/throwRefreshTokenSignatureRequired.mjs'\nimport { throwUnauthorizedError } from '@throw/throwUnauthorizedError.mjs'\nimport Keygrip from 'keygrip'\n\nimport { TCookieRefreshToken } from './TCookieRefreshToken.mjs'\n\nexport function verifySignedRefreshToken(ctx: IContextRefresh, keys: Keygrip): string {\n\t// @todo deve controllare il cookie o l'header o entrambi e cosa fare se manca uno dei due ??\n\n\tconst cookieHeader = ctx.request.header?.cookie\n\t// console.debug('ctx.request.header', ctx.request.header)\n\n\tif (cookieHeader === undefined) {\n\t\tthrow throwPreconditionFailedNoAuthCookie()\n\t}\n\n\tconst cookies: TCookieRefreshToken = {}\n\tcookieHeader.split(';').forEach((cookie) => {\n\t\tconst [key, value] = cookie.trim().split('=')\n\t\t// @ts-expect-error ignore wrong keys\n\t\tcookies[key] = value\n\t})\n\t/**\n\t * 'refresh_token=27119032-9043-4a9f-bd4c-9d06fd576290; refresh_token.sig=P1gZO6-49xVEMkiMqkOjJ2Cxaf3mQb18GaflDsjibuv4fFWYIOzcW26didnVJ1aridyY40CFzDtufzI6zI8jkQ'\n\t */\n\tconst refreshToken = cookies?.refresh_token\n\tif (!refreshToken) {\n\t\tthrow throwRefreshTokenRequired()\n\t}\n\tconst signature = cookies?.['refresh_token.sig']\n\tif (!signature) {\n\t\tthrow throwRefreshTokenSignatureRequired()\n\t}\n\t// console.debug('refreshToken', refreshToken)\n\t// console.debug('signature', signature)\n\n\t// Verify signature\n\t// Verify signature with Keygrip\n\tconst index = keys.index(`refresh_token=${refreshToken}`, signature)\n\n\tif (index === -1) {\n\t\t// Signature invalid\n\t\tthrow throwUnauthorizedError('Invalid Refresh Cookie signature')\n\t}\n\t// console.debug('signature OK')\n\n\treturn `refresh:${refreshToken}`\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/authenticatedLogoutHandler/index.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,gBAAgB,EAAE,oDAAmC;AAC9D,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;AACpG,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;AACpG,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAIhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mEAAmE,CAAA;AAE5G,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,KAAK,EAAE,GAAmB,EAAE,IAAU,EAAE,EAAE;IACtG;;;;OAIG;IACH;;;;QAII;IACJ,IAAI,aAAa,GAAG,KAAK,CAAA;IAEzB,UAAU;IACV,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAA,CAAC,UAAU;IACpD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACnC,IACC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,WAAW;YACzC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAChF,CAAC;YACF,aAAa,GAAG,IAAI,CAAA;QACrB,CAAC;aAAM,CAAC;YACP,MAAM,mCAAmC,EAAE,CAAA;QAC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KAAK,CAAC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;YACzC,CAAC,CAAC,4CAA4C;QAC/C,CAAC;IACF,CAAC,CAAC,qBAAqB;IACvB,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/authenticatedLogoutHandler/index.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,gBAAgB,EAAE,oDAAmC;AAC9D,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;AACpG,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;AACpG,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAIhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mEAAmE,CAAA;AAE5G,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,KAAK,EAAE,GAAmB,EAAE,IAAU,EAAE,EAAE;IACtG;;;;OAIG;IACH;;;;QAII;IACJ,IAAI,aAAa,GAAG,KAAK,CAAA;IAEzB,UAAU;IACV,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAA,CAAC,UAAU;IACpD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACnC,IACC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,WAAW;YACzC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAChF,CAAC;YACF,aAAa,GAAG,IAAI,CAAA;QACrB,CAAC;aAAM,CAAC;YACP,MAAM,mCAAmC,EAAE,CAAA;QAC5C,CAAC;IACF,CAAC;IAED,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAA,C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AAC,CAAC,qBAAqB;IACvB,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { IContextLogout } from '@context/IContextLogout.mjs'\nimport { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { redisClient } from '@dataSources/Redis.mjs'\nimport { throwAlreadyDone } from '@throw/throwAlreadyDone.mjs'\nimport { throwPreconditionFailedNoAuthCookie } from '@throw/throwPreconditionFailedNoAuthCookie.mjs'\nimport { throwPreconditionFailedNoAuthHeader } from '@throw/throwPreconditionFailedNoAuthHeader.mjs'\nimport * as dotenv from 'dotenv'\nimport Keygrip from 'keygrip'\nimport { Next } from 'koa'\n\nimport { verifySignedRefreshToken } from '../authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs'\n\ndotenv.config()\n\nexport const authenticatedLogoutHandler = (keys: Keygrip) => async (ctx: IContextLogout, next: Next) => {\n\t/***************************\n\t * CLIENT:\n\t * - in authorization: ctx.request.header.authorization = Bearer ACCESS_TOKEN_HERE\n\t * - in cookie: ctx.request.header.cookie = refresh_cookie=TOKEN_HERE\n\t */\n\t/*\n\tif (typeof ctx.request.header?.operation !== 'undefined') {\n\t\tconst operationName = ctx.request.header.operation\n\t\tconsole.debug('[authorizationHandler] operationName: ', operationName)\n\t} */\n\tlet introspection = false\n\n\t// refresh\n\tconst cookie = ctx.request.header?.cookie // refresh\n\tif (typeof cookie === 'undefined') {\n\t\tif (\n\t\t\ttypeof ctx.request.header !== 'undefined' &&\n\t\t\tctx.request.header['x-introspectioncode'] === `${process.env.INTROSPECTION_CODE}`\n\t\t) {\n\t\t\tintrospection = true\n\t\t} else {\n\t\t\tthrow throwPreconditionFailedNoAuthCookie()\n\t\t}\n\t}\n\n\tconst authorization = ctx.request.header?.authorization // access\n\tif (typeof authorization === 'undefined') {\n\t\tif (\n\t\t\ttypeof ctx.request.header !== 'undefined' &&\n\t\t\tctx.request.header['x-introspectioncode'] === `${process.env.INTROSPECTION_CODE}`\n\t\t) {\n\t\t\tintrospection = true\n\t\t} else {\n\t\t\tthrow throwPreconditionFailedNoAuthHeader()\n\t\t}\n\t}\n\n\tif (!introspection) {\n\t\tconst refreshToken = verifySignedRefreshToken(ctx as unknown as IContextRefresh, keys)\n\t\tconst redRefreshSession = await redisClient.hGet(`${process.env.REDIS_KEY}${refreshToken}`, 'id')\n\t\tif (redRefreshSession != null) {\n\t\t\tctx.state = {\n\t\t\t\tuser: {\n\t\t\t\t\trefreshToken: refreshToken\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow throwAlreadyDone()\n\t\t}\n\n\t\t// Access Token, optional\n\t\tconst accessToken = authorization!.replace('Bearer ', '')\n\t\tif (accessToken !== '') {\n\t\t\tconst redAccessSession = await redisClient.hGet(`${process.env.REDIS_KEY}${accessToken}`, 'id') // 'access:' already present\n\t\t\tif (redAccessSession != null) {\n\t\t\t\tctx.state.user.accessToken = accessToken\n\t\t\t} // else no problem, session could be expired\n\t\t}\n\t} // else introspection\n\treturn next()\n}\n"]}
@@ -38,8 +38,7 @@ export const authenticatedResourceHandler = () => async (ctx, next) => {
38
38
  id: new Types.ObjectId(redData.id) // fix id as ObjectId
39
39
  };
40
40
  }
41
- else if (ctx.request.header?.['x-introspectioncode'] !==
42
- `${process.env.INTROSPECTION_CODE}`) {
41
+ else if (ctx.request.header?.['x-introspectioncode'] !== `${process.env.INTROSPECTION_CODE}`) {
43
42
  throw throwAccessTokenExpiredOrDeleted();
44
43
  } // else return next
45
44
  return next();
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/authenticatedResourceHandler/index.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,uCAA8B;AACpD,OAAO,EAAE,gCAAgC,EAAE,oEAAmD;AAC9F,OAAO,EAAE,wBAAwB,EAAE,4DAA2C;AAC9E,OAAO,EAAE,mBAAmB,EAAE,uDAAsC;AACpE,OAAO,EAAE,mCAAmC,EAAE,uEAAsD;AACpG,OAAO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AAO,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,+BAA+B;KAChE,CAAA;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,EAAE,GAAG,UAAU,EAAE,CAAA,CAAC,mGAAmG;QACrI,wDAAwD;QACxD,2HAA2H;QAC3H,IAAI,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YAC3C,MAAM,mBAAmB,EAAE,CAAA;QAC5B,CAAC;QAED,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG;YAChB,GAAG,OAAO;YACV,EAAE,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,qBAAqB;SACxD,CAAA;IACF,CAAC;SAAM,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,qBAAqB,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAChG,MAAM,gCAAgC,EAAE,CAAA;IACzC,CAAC,CAAC,mBAAmB;IAErB,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { IContextAuthenticatedResource } from '@context/IContextAuthenticatedResource.mjs'\nimport { redisClient } from '@dataSources/Redis.mjs'\nimport { throwAccessTokenExpiredOrDeleted } from '@throw/throwAccessTokenExpiredOrDeleted.mjs'\nimport { throwAccessTokenRequired } from '@throw/throwAccessTokenRequired.mjs'\nimport { throwForbiddenError } from '@throw/throwForbiddenError.mjs'\nimport { throwPreconditionFailedNoAuthHeader } from '@throw/throwPreconditionFailedNoAuthHeader.mjs'\nimport * as dotenv from 'dotenv'\nimport { Next } from 'koa'\nimport { Types } from 'mongoose'\n\ndotenv.config()\n\n/**\n * Find out access token in Bearer header\n */\nexport const authenticatedResourceHandler = () => async (ctx: IContextAuthenticatedResource, next: Next) => {\n\t/***************************\n\t * CLIENT:\n\t * - in authorization: ctx.request.header.authorization = 'Bearer ACCESS_TOKEN\n\t */\n\n\tconst authorization = ctx.request.header?.authorization\n\n\t// more detailed errors code instead of generic 401 unauthorized (tampering)\n\tif (authorization === undefined) {\n\t\tthrow throwPreconditionFailedNoAuthHeader()\n\t}\n\tif (!authorization.startsWith('Bearer access:')) {\n\t\tthrow throwAccessTokenRequired()\n\t}\n\n\tconst key = authorization.replace('Bearer ', '')\n\n\t// la chiave access:xxx esiste in Redis ? read Redis...\n\tconst redSession = await redisClient.hGetAll(\n\t\t`${process.env.REDIS_KEY}${key}` // 'access:' present inside key\n\t)\n\tif (Object.keys(redSession).length !== 0) {\n\t\tconst redData = { ...redSession } // For safety, Redis return an object without the default Object.prototype in its prototype chain.\n\t\t// user è riportato come bloccato dentro alla sessione ?\n\t\t// da usare per bloccare l'accesso all'utente, invece di eliminare il token, impostare questo flag da pannello di controllo\n\t\tif (redData?.disabled || redData?.deleted) {\n\t\t\tthrow throwForbiddenError()\n\t\t}\n\n\t\tctx.state.user = {\n\t\t\t...redData,\n\t\t\tid: new Types.ObjectId(redData.id) // fix id as ObjectId\n\t\t}\n\t} else if (ctx.request.header?.['x-introspectioncode'] !== `${process.env.INTROSPECTION_CODE}`) {\n\t\tthrow throwAccessTokenExpiredOrDeleted()\n\t} // else return next\n\n\treturn next()\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/debug/index.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAKvC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,GAAoB,EAAE,IAAU,EAAE,EAAE;IAC5E,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;IAC3C,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACvE,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtF,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAA;IAE7F,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../../src/koa/middleware/debug/index.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAKvC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,GAAoB,EAAE,IAAU,EAAE,EAAE;IAC5E,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;IAC3C,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACvE,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtF,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAA;IAE7F,OAAO,IAAI,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import * as console from 'node:console'\n\nimport { IContextRefresh } from '@context/IContextRefresh.mjs'\nimport { Next } from 'koa'\n\nexport const debugHandler = () => async (ctx: IContextRefresh, next: Next) => {\n\tconsole.debug('[debugHandler]', new Date())\n\tconsole.debug('[debugHandler] ctx.request.header:', ctx.request.header)\n\tconsole.debug('[debugHandler] ctx.request.header.cookie:', ctx.request.header?.cookie)\n\tconsole.debug('[debugHandler] ctx.cookies[refresh_token]:', ctx.cookies.get('refresh_token'))\n\n\treturn next()\n}\n"]}
@@ -9,6 +9,7 @@ import { handleIfMoreThan3DaysPassed } from "../../private/lib/access/handleIfMo
9
9
  import { handleIfTooMuchRequestsTimes } from "../../private/lib/access/handleIfTooMuchRequestsTimes.mjs";
10
10
  // allow url encoded urls after /x/
11
11
  const ALLOW_ENCODED_URLS_AFTER_X = /^\/x\/[a-zA-Z0-9._\-%/]+$/;
12
+ /* c8 ignore start -- ESM live-binding limit: inner async handler stubs (@private/lib/access/*) are non-configurable in tsx loader, integration coverage on consumer */
12
13
  export const routerVerifyEmail = () => async (ctx) => {
13
14
  const { email, hash } = ctx.params;
14
15
  const uEmail = email.toLowerCase();
@@ -43,4 +44,5 @@ export const routerVerifyEmail = () => async (ctx) => {
43
44
  }
44
45
  }
45
46
  };
47
+ /* c8 ignore stop */
46
48
  //# sourceMappingURL=verifyEmail.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifyEmail.mjs","sourceRoot":"","sources":["../../../../src/koa/router/verifyEmail.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,0DAAoD;AAChF,OAAO,EAAE,oBAAoB,EAAE,6DAAuD;AACtF,OAAO,EAAE,WAAW,EAAE,iDAA2C;AACjE,OAAO,EAAE,sBAAsB,EAAE,4DAAsD;AACvF,OAAO,EAAE,uBAAuB,EAAE,6DAAuD;AACzF,OAAO,EAAE,yBAAyB,EAAE,+DAAyD;AAC7F,OAAO,EAAE,eAAe,EAAE,qDAA+C;AACzE,OAAO,EAAE,2BAA2B,EAAE,iEAA2D;AACjG,OAAO,EAAE,4BAA4B,EAAE,kEAA4D;AAGnG,mCAAmC;AACnC,MAAM,0BAA0B,GAAG,2BAA2B,CAAA;AAE9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,GAAwB,EAAE,EAAE;IACzE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;IAElC,MAAM,MAAM,GAAG,KAAK,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AAE,QAAQ,EAAE,GAAG,WAAW,CAAA;QAEzC,MAAM,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAA;QAC9D,WAAW,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;QACtC,MAAM,4BAA4B,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;QACvD,MAAM,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAA;QAE5E,MAAM,2BAA2B,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACrD,MAAM,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAC5C,MAAM,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAE9C,kBAAkB;QAClB,MAAM,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACnC,GAAG,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAA,CAAC,qBAAqB;QAC1D,oDAAoD;IACrD,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACvB,MAAM,IAAI,GAAI,GAAa,CAAC,OAAiB,CAAA;QAC7C,IAAI,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QACnB,CAAC;aAAM,CAAC;YACP,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QACzB,CAAC;IACF,CAAC;AACF,CAAC,CAAA;AACD,oBAAoB","sourcesContent":["import { IContextVerifyEmail } from '@private/graphQL/schema/context/IContextVerifyEmail.mjs'\nimport { enableEmailAccess } from '@private/lib/access/db/enableEmailAccess.mjs'\nimport { userData4VerifyEmail } from '@private/lib/access/db/userData4VerifyEmail.mjs'\nimport { handleBadDB } from '@private/lib/access/handleBadDB.mjs'\nimport { handleIfAccountDeleted } from '@private/lib/access/handleIfAccountDeleted.mjs'\nimport { handleIfAccountDisabled } from '@private/lib/access/handleIfAccountDisabled.mjs'\nimport { handleIfEmailAlreadyValid } from '@private/lib/access/handleIfEmailAlreadyValid.mjs'\nimport { handleIfHashBad } from '@private/lib/access/handleIfHashBad.mjs'\nimport { handleIfMoreThan3DaysPassed } from '@private/lib/access/handleIfMoreThan3DaysPassed.mjs'\nimport { handleIfTooMuchRequestsTimes } from '@private/lib/access/handleIfTooMuchRequestsTimes.mjs'\n\n// allow url encoded urls after /x/\nconst ALLOW_ENCODED_URLS_AFTER_X = /^\\/x\\/[a-zA-Z0-9._\\-%/]+$/\n\n/* c8 ignore start -- ESM live-binding limit: inner async handler stubs (@private/lib/access/*) are non-configurable in tsx loader, integration coverage on consumer */\nexport const routerVerifyEmail = () => async (ctx: IContextVerifyEmail) => {\n\tconst { email, hash } = ctx.params\n\n\tconst uEmail = email.toLowerCase()\n\n\ttry {\n\t\t// search if the email exists\n\t\tconst user = await userData4VerifyEmail(uEmail)\n\t\tconst uId = user._id\n\t\tconst userAccount = user.account\n\t\tconst userAccountEmail = userAccount.email\n\t\tconst requestTimes = userAccountEmail.requestTimes\n\t\tconst dateLastReq = userAccountEmail.dateLastReq\n\t\tconst { deleted, disabled } = userAccount\n\n\t\tawait handleIfEmailAlreadyValid(email, userAccountEmail.valid)\n\t\thandleBadDB(requestTimes, dateLastReq)\n\t\tawait handleIfTooMuchRequestsTimes(email, requestTimes)\n\t\tawait handleIfHashBad(uId, email, hash, requestTimes, userAccountEmail.hash)\n\n\t\tawait handleIfMoreThan3DaysPassed(email, dateLastReq)\n\t\tawait handleIfAccountDeleted(email, deleted)\n\t\tawait handleIfAccountDisabled(email, disabled)\n\n\t\t// ok enable email\n\t\tawait enableEmailAccess(uId, email)\n\t\tctx.redirect('/x/registration-done') // url without prefix\n\t\t// ctx.redirect('https://google.it') // external url\n\t} catch (err: unknown) {\n\t\tconst link = (err as Error).message as string\n\t\tif (ALLOW_ENCODED_URLS_AFTER_X.test(link)) {\n\t\t\tctx.redirect(link)\n\t\t} else {\n\t\t\tctx.redirect('/x/error')\n\t\t}\n\t}\n}\n/* c8 ignore stop */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tdwKoaErrorHandler.mjs","sourceRoot":"","sources":["../../../src/koa/tdwKoaErrorHandler.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAKtC,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAA4B,EAAE,IAAU;IAChF,IAAI,CAAC;QACJ,MAAM,IAAI,EAAE,CAAA;IACb,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,GAAgB,CAAA;QAC/B,MAAM,cAAc,GAAG,GAAG,YAAY,YAAY,CAAA;QAElD,eAAe;QACf,IAAI,cAAc,EAAE,CAAC;YACpB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,CAAA;QACpD,CAAC;aAAM,CAAC;YACP,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,GAAG,CAAA;QAClC,CAAC;QAED;;WAEG;QACH,MAAM,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAEtE,IAAI,SAAS,EAAE,CAAC;YACf,GAAG,CAAC,IAAI,GAAG;gBACV,OAAO,EAAE,MAAM,CAAC,OAAO;aACvB,CAAA;YACD,IAAI,cAAc,EAAE,CAAC;gBACpB,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,WAAW,IAAI,EAAE,CAAA;Y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EtE,IAAI,SAAS,EAAE,CAAC;YACf,GAAG,CAAC,IAAI,GAAG;gBACV,OAAO,EAAE,MAAM,CAAC,OAAO;aACvB,CAAA;YACD,IAAI,cAAc,EAAE,CAAC;gBACpB,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,WAAW,IAAI,EAAE,CAAA;YAC5D,CAAC;QACF,CAAC;QAED,oBAAoB;QACpB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;YAC5C,IAAI,CAAC,cAAc,EAAE,CAAC;gBACrB,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;YAChC,CAAC;QACF,CAAC;QAED,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,CAAC;AACF,CAAC","sourcesContent":["import { IContextKoaErrorHandler } from '@context/IContextKoaErrorHandler.mjs'\nimport * as Sentry from '@sentry/node'\nimport * as dotenv from 'dotenv'\nimport { GraphQLError } from 'graphql'\nimport { Next } from 'koa'\n\nimport { IKoaError } from './IKoaError.mjs'\n\ndotenv.config()\n\nexport async function tdwKoaErrorHandler(ctx: IContextKoaErrorHandler, next: Next) {\n\ttry {\n\t\tawait next()\n\t} catch (err: unknown) {\n\t\tconst errKoa = err as IKoaError\n\t\tconst isIstanceOfGQL = err instanceof GraphQLError\n\n\t\t// check status\n\t\tif (isIstanceOfGQL) {\n\t\t\tctx.status = errKoa.extensions?.http?.status || 500\n\t\t} else {\n\t\t\tctx.status = errKoa.status || 500\n\t\t}\n\n\t\t/**\n\t\t * do not set body for status codes that do not allow it\n\t\t */\n\t\tconst allowBody = ![100, 101, 102, 204, 205, 304].includes(ctx.status)\n\n\t\tif (allowBody) {\n\t\t\tctx.body = {\n\t\t\t\tmessage: errKoa.message\n\t\t\t}\n\t\t\tif (isIstanceOfGQL) {\n\t\t\t\tctx.body.description = errKoa.extensions?.description || ''\n\t\t\t}\n\t\t}\n\n\t\t// more debug data ?\n\t\tif (process.env.NODE_ENV === 'development') {\n\t\t\tif (!isIstanceOfGQL) {\n\t\t\t\tSentry.captureException(errKoa)\n\t\t\t}\n\t\t}\n\n\t\tctx.app.emit('error', errKoa, ctx)\n\t}\n}\n"]}
@@ -1,10 +1,9 @@
1
1
  export class ArrayLib {
2
- constructor() {
3
- }
2
+ constructor() { }
4
3
  arrDiff(arr1, arr2) {
5
4
  const arrays = [arr1, arr2].sort((a, b) => a.length - b.length);
6
5
  const smallSet = new Set(arrays[0]);
7
- return arrays[1].filter(x => !smallSet.has(x));
6
+ return arrays[1].filter((x) => !smallSet.has(x));
8
7
  }
9
- }
8
+ } /* c8 ignore next */
10
9
  //# sourceMappingURL=ArrayLib.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayLib.mjs","sourceRoot":"","sources":["../../../src/lib/ArrayLib.mts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;IACpB;IACA,CAAC;IAED,OAAO,CAAC,IAAc,EAAE,IAAc;QACrC,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;QAC/D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAEnC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,CAAC;CACD"}
1
+ {"version":3,"file":"ArrayLib.mjs","sourceRoot":"","sources":["../../../src/lib/ArrayLib.mts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;IACpB,gBAAe,CAAC;IAEhB,OAAO,CAAC,IAAc,EAAE,IAAc;QACrC,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;QAC/D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAEnC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACjD,CAAC;CACD,CAAC,oBAAoB","sourcesContent":["export class ArrayLib {\n\tconstructor() {}\n\n\tarrDiff(arr1: string[], arr2: string[]) {\n\t\tconst arrays = [arr1, arr2].sort((a, b) => a.length - b.length)\n\t\tconst smallSet = new Set(arrays[0])\n\n\t\treturn arrays[1].filter((x) => !smallSet.has(x))\n\t}\n} /* c8 ignore next */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.mjs","sourceRoot":"","sources":["../../../src/lib/Constants.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAA;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AAChE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA"}
1
+ {"version":3,"file":"Constants.mjs","sourceRoot":"","sources":["../../../src/lib/Constants.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAA;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AAChE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA","sourcesContent":["import { Types } from 'mongoose'\n\nexport const OBJECTID_0_STR = '000000000000000000000000'\nexport const OBJECTID_0_OBJ = new Types.ObjectId(OBJECTID_0_STR)\nexport const EMAIL_MAX_LEN = 255\n\nexport const MIN_PWD_LENGTH = 10\nexport const MAX_PWD_LENGTH = 72\n\nexport const EMAIL_HASH_LEN = 50\n"]}
@@ -1,6 +1,5 @@
1
1
  export const DateLib = class DateLib {
2
- constructor() {
3
- }
2
+ constructor() { }
4
3
  static getDate(dateNum) {
5
4
  const dateStr = dateNum.toString();
6
5
  const year = parseInt(dateStr.substring(0, 4));
@@ -32,5 +31,5 @@ export const DateLib = class DateLib {
32
31
  const difference = lastReq > now ? lastReq - now : now - lastReq;
33
32
  return Math.floor(difference / (1000 * 60));
34
33
  }
35
- };
34
+ }; /* c8 ignore next */
36
35
  //# sourceMappingURL=DateLib.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateLib.mjs","sourceRoot":"","sources":["../../../src/lib/DateLib.mts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,OAAO;IACnC;IACA,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,OAAa;QAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAA;QAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9C,MAAM,KAAK,GAAG,QAA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G,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;QAEtE,OAAO;YACN,IAAI;YACJ,IAAI;SACJ,CAAA;IACF,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,EAAQ;QACzB,2BAA2B;QAE3B,uBAAuB;QACvB,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;QACxB,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,CAAA;QAE3B,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QACtD,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAA;QAE1C,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAA;QAC5B,8CAA8C;QAE9C,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;QACjD,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;QACvC,OAAO,OAAO,CAAA;IACf,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,OAAe,EAAE,GAAW;QAC9C,MAAM,UAAU,GAAG,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAA;QAChE,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAA;IAC5C,CAAC;CACD,CAAA,CAAC,oBAAoB","sourcesContent":["export const DateLib = class DateLib {\n\tconstructor() {}\n\n\tstatic getDate(dateNum: Date) {\n\t\tconst dateStr = dateNum.toString()\n\t\tconst year = parseInt(dateStr.substring(0, 4))\n\t\tconst month = parseInt(dateStr.substring(4, 6))\n\t\tconst day = parseInt(dateStr.substring(6, 8))\n\t\tconst hours = parseInt(dateStr.substring(8, 10))\n\t\tconst min = parseInt(dateStr.substring(10, 12))\n\t\tconst sec = parseInt(dateStr.substring(12, 14))\n\n\t\tconst date = new Date(Date.UTC(year, month - 1, day, hours, min, sec))\n\n\t\treturn {\n\t\t\tyear,\n\t\t\tdate\n\t\t}\n\t}\n\n\tstatic minElapsed(dt: Date): number {\n\t\t// stampa date di confronto\n\n\t\t// legge minuti passati\n\t\tconst nowDt = new Date()\n\t\tconst now = nowDt.getTime()\n\n\t\tconsole.debug('ora ultimo invio: ', new Date('' + dt))\n\t\tconsole.debug('ora attuale : ', nowDt)\n\n\t\tconst lastReq = dt.getTime()\n\t\t// const lastReq = new Date('' + dt).getTime()\n\n\t\tconst elapsed = DateLib.timeDiffMin(lastReq, now)\n\t\tconsole.debug('sono passati ', elapsed)\n\t\treturn elapsed\n\t}\n\n\tstatic timeDiffMin(lastReq: number, now: number): number {\n\t\tconst difference = lastReq > now ? lastReq - now : now - lastReq\n\t\treturn Math.floor(difference / (1000 * 60))\n\t}\n} /* c8 ignore next */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IAuthorizationDisDel.mjs","sourceRoot":"","sources":["../../../src/lib/IAuthorizationDisDel.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"IAuthorizationDisDel.mjs","sourceRoot":"","sources":["../../../src/lib/IAuthorizationDisDel.mts"],"names":[],"mappings":"","sourcesContent":["export interface IAuthorizationDisDel {\n\tdisabled?: boolean\n\tdeleted?: Date\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ICookies.mjs","sourceRoot":"","sources":["../../../src/lib/ICookies.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"ICookies.mjs","sourceRoot":"","sources":["../../../src/lib/ICookies.mts"],"names":[],"mappings":"","sourcesContent":["export type ICookies = {\n\tset(key: 'access_token' | 'refresh_token', value: string, options: Options): void\n\tget(key: 'access_token' | 'refresh_token'): string | undefined\n}\ntype Options = {\n\thttpOnly?: boolean\n\tsameSite?: string\n\tsecure?: boolean\n\tpath?: string\n\texpirationDate?: number\n\tmaxAge?: number\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IMariaDBErr.mjs","sourceRoot":"","sources":["../../../../src/lib/MariaDB/IMariaDBErr.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"IMariaDBErr.mjs","sourceRoot":"","sources":["../../../../src/lib/MariaDB/IMariaDBErr.mts"],"names":[],"mappings":"","sourcesContent":["export interface IMariaDbErr {\n\tparent?: {\n\t\tsqlMessage?: string\n\t\tcode: string\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MariaDBErrType.mjs","sourceRoot":"","sources":["../../../../src/lib/MariaDB/MariaDBErrType.mts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACzB,uDAAqC,CAAA;AACtC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB"}
1
+ {"version":3,"file":"MariaDBErrType.mjs","sourceRoot":"","sources":["../../../../src/lib/MariaDB/MariaDBErrType.mts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACzB,uDAAqC,CAAA;AACtC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB","sourcesContent":["// https://mariadb.com/kb/en/mariadb-error-code-reference/\nexport enum MariaDBErrType {\n\tER_DATA_TOO_LONG = 'ER_DATA_TOO_LONG'\n}\n"]}
@@ -2,14 +2,12 @@ import { throwErrorWrongUserInput } from "../../graphQL/throw/throwErrorWrongUse
2
2
  import { throwInternalError } from "../../graphQL/throw/throwInternalError.mjs";
3
3
  import { MariaDBErrType } from './MariaDBErrType.mjs';
4
4
  export function throwSqlErrors(e) {
5
- if (e.parent &&
6
- e.parent.sqlMessage &&
7
- e.parent.code === MariaDBErrType.ER_DATA_TOO_LONG) {
5
+ if (e.parent && e.parent.sqlMessage && e.parent.code === MariaDBErrType.ER_DATA_TOO_LONG) {
8
6
  const err = e.parent.sqlMessage.replace(' column', '');
9
7
  // Find the index of the first occurrence of the single quote
10
- const firstQuoteIndex = err.indexOf('\'');
8
+ const firstQuoteIndex = err.indexOf("'");
11
9
  // Find the index of the second occurrence of the single quote, starting the search just after the first quote
12
- const secondQuoteIndex = err.indexOf('\'', firstQuoteIndex + 1);
10
+ const secondQuoteIndex = err.indexOf("'", firstQuoteIndex + 1);
13
11
  // Extract the substring from the start of the string to just after the second single quote
14
12
  const errorMessage = err.substring(0, secondQuoteIndex + 1);
15
13
  throw throwErrorWrongUserInput(errorMessage);
@@ -1 +1 @@
1
- {"version":3,"file":"throwSqlErrors.mjs","sourceRoot":"","sources":["../../../../src/lib/MariaDB/throwSqlErrors.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,yDAA2C;AAC9E,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,UAAU,cAAc,CAAC,CAAc;IAC5C,IACC,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,MAAM,CAAC,UAAU;QACnB,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAChD,CAAC;QACF,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;QAEtD,6DAA6D;QAC7D,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACzC,8GAA8G;QAC9G,MAAM,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,eAAe,GAAG,CAAC,CAAC,CAAA;QAC/D,2FAA2F;QAC3F,MAAM,YAAY,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,gBAAgB,GAAG,CAAC,CAAC,CAAA;QAE3D,MAAM,wBAAwB,CAAC,YAAY,CAAC,CAAA;IAC7C,CAAC;SAAM,CAAC;QACP,yBAAyB;QACzB,MAAM,kBAAkB,EAAE,CAAA;IAC3B,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"throwSqlErrors.mjs","sourceRoot":"","sources":["../../../../src/lib/MariaDB/throwSqlErrors.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,yDAA2C;AAC9E,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,UAAU,cAAc,CAAC,CAAc;IAC5C,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QAC1F,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;QAEtD,6DAA6D;QAC7D,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACxC,8GAA8G;QAC9G,MAAM,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,CAAC,CAAC,CAAA;QAC9D,2FAA2F;QAC3F,MAAM,YAAY,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,gBAAgB,GAAG,CAAC,CAAC,CAAA;QAE3D,MAAM,wBAAwB,CAAC,YAAY,CAAC,CAAA;IAC7C,CAAC;SAAM,CAAC;QACP,yBAAyB;QACzB,MAAM,kBAAkB,EAAE,CAAA;IAC3B,CAAC;AACF,CAAC","sourcesContent":["import { IMariaDbErr } from '@lib/MariaDB/IMariaDBErr.mjs'\nimport { throwErrorWrongUserInput } from '@throw/throwErrorWrongUserInput.mjs'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\n\nimport { MariaDBErrType } from './MariaDBErrType.mjs'\n\nexport function throwSqlErrors(e: IMariaDbErr) {\n\tif (e.parent && e.parent.sqlMessage && e.parent.code === MariaDBErrType.ER_DATA_TOO_LONG) {\n\t\tconst err = e.parent.sqlMessage.replace(' column', '')\n\n\t\t// Find the index of the first occurrence of the single quote\n\t\tconst firstQuoteIndex = err.indexOf(\"'\")\n\t\t// Find the index of the second occurrence of the single quote, starting the search just after the first quote\n\t\tconst secondQuoteIndex = err.indexOf(\"'\", firstQuoteIndex + 1)\n\t\t// Extract the substring from the start of the string to just after the second single quote\n\t\tconst errorMessage = err.substring(0, secondQuoteIndex + 1)\n\n\t\tthrow throwErrorWrongUserInput(errorMessage)\n\t} else {\n\t\t// @todo report to Sentry\n\t\tthrow throwInternalError()\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IMongoDBError.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/IMongoDBError.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"IMongoDBError.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/IMongoDBError.mts"],"names":[],"mappings":"","sourcesContent":["import { MongoDBErrType } from '@lib/MongoDB/MongoDBErrType.mjs'\n\nexport interface IMongoDBError {\n\terrorResponse?: {\n\t\tcode: MongoDBErrType\n\t}\n\tparent?: {\n\t\terrorResponse?: {\n\t\t\tcode: MongoDBErrType\n\t\t}\n\t}\n\tmessage: string\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IOnboarding.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/IOnboarding.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"IOnboarding.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/IOnboarding.mts"],"names":[],"mappings":"","sourcesContent":["export interface IOnboarding {\n\tonboardingStep?: string\n\tonboardingDone?: boolean\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MongoDBErrType.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/MongoDBErrType.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACzB,iFAAyB,CAAA;AAC1B,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB"}
1
+ {"version":3,"file":"MongoDBErrType.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/MongoDBErrType.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACzB,iFAAyB,CAAA;AAC1B,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB","sourcesContent":["export enum MongoDBErrType {\n\tDuplicateKeyError = 11000\n}\n"]}
@@ -2,11 +2,8 @@ import { MongoDBErrType } from "./MongoDBErrType.mjs";
2
2
  import { throwConflictError } from "../../graphQL/throw/throwConflictError.mjs";
3
3
  import { throwErrorWrongUserInput } from "../../graphQL/throw/throwErrorWrongUserInput.mjs";
4
4
  export function throwIfMongoErr(e) {
5
- if ((e.errorResponse &&
6
- e.errorResponse.code === MongoDBErrType.DuplicateKeyError) ||
7
- (e.parent &&
8
- e.parent.errorResponse &&
9
- e.parent.errorResponse.code === MongoDBErrType.DuplicateKeyError)) {
5
+ if ((e.errorResponse && e.errorResponse.code === MongoDBErrType.DuplicateKeyError) ||
6
+ (e.parent && e.parent.errorResponse && e.parent.errorResponse.code === MongoDBErrType.DuplicateKeyError)) {
10
7
  throw throwConflictError();
11
8
  }
12
9
  else if (e.message.startsWith('[Validator]')) {
@@ -1 +1 @@
1
- {"version":3,"file":"throwIfMongoErr.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/throwIfMongoErr.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,6BAAuC;AAChE,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAClE,OAAO,EAAE,wBAAwB,EAAE,yDAA2C;AAE9E,MAAM,UAAU,eAAe,CAAC,CAAgB;IAC/C,IACC,CAAC,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,aAAa,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB,CAAC;QAC3D,CAAC,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,MAAM,CAAC,aAAa;YACtB,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB,CAAC,EACjE,CAAC;QACF,MAAM,kBAAkB,EAAE,CAAA;IAC3B,CAAC;SAAM,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAChD,MAAM,wBAAwB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IAC5E,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"throwIfMongoErr.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/throwIfMongoErr.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,6BAAuC;AAChE,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAClE,OAAO,EAAE,wBAAwB,EAAE,yDAA2C;AAE9E,MAAM,UAAU,eAAe,CAAC,CAAgB;IAC/C,IACC,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB,CAAC;QAC9E,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB,CAAC,EACvG,CAAC;QACF,MAAM,kBAAkB,EAAE,CAAA;IAC3B,CAAC;SAAM,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAChD,MAAM,wBAAwB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IAC5E,CAAC;AACF,CAAC","sourcesContent":["import { IMongoDBError } from '@lib/MongoDB/IMongoDBError.mjs'\nimport { MongoDBErrType } from '@lib/MongoDB/MongoDBErrType.mjs'\nimport { throwConflictError } from '@throw/throwConflictError.mjs'\nimport { throwErrorWrongUserInput } from '@throw/throwErrorWrongUserInput.mjs'\n\nexport function throwIfMongoErr(e: IMongoDBError) {\n\tif (\n\t\t(e.errorResponse && e.errorResponse.code === MongoDBErrType.DuplicateKeyError) ||\n\t\t(e.parent && e.parent.errorResponse && e.parent.errorResponse.code === MongoDBErrType.DuplicateKeyError)\n\t) {\n\t\tthrow throwConflictError()\n\t} else if (e.message.startsWith('[Validator]')) {\n\t\tthrow throwErrorWrongUserInput(e.message.replace('[Validator]', '').trim())\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"throwMongoErrors.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/throwMongoErrors.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,8BAAwC;AAClE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAElE,MAAM,UAAU,kBAAkB,CAAC,CAAgB;IAClD,eAAe,CAAC,CAAC,CAAC,CAAA;IAClB,kBAAkB;IAElB,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAC1B,MAAM,kBAAkB,EAAE,CAAA;AAC3B,CAAC"}
1
+ {"version":3,"file":"throwMongoErrors.mjs","sourceRoot":"","sources":["../../../../src/lib/MongoDB/throwMongoErrors.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,8BAAwC;AAClE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,mDAAqC;AAElE,MAAM,UAAU,kBAAkB,CAAC,CAAgB;IAClD,eAAe,CAAC,CAAC,CAAC,CAAA;IAClB,kBAAkB;IAElB,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAC1B,MAAM,kBAAkB,EAAE,CAAA;AAC3B,CAAC","sourcesContent":["import { IMongoDBError } from '@lib/MongoDB/IMongoDBError.mjs'\nimport { throwIfMongoErr } from '@lib/MongoDB/throwIfMongoErr.mjs'\nimport * as Sentry from '@sentry/node'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\n\nexport function throwMongoDBErrors(e: IMongoDBError) {\n\tthrowIfMongoErr(e)\n\t// else throw here\n\n\tSentry.captureException(e)\n\tthrow throwInternalError()\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  export class NumLib {
2
- constructor() {
3
- }
2
+ constructor() { }
4
3
  /************
5
4
  * parseFloat vuole il '.' come separatore decimale !!
6
5
  *
@@ -10,5 +9,5 @@ export class NumLib {
10
9
  static parseFloatFixed(val) {
11
10
  return parseFloat(val.replace(/,/g, '.'));
12
11
  }
13
- }
12
+ } /* c8 ignore next */
14
13
  //# sourceMappingURL=NumLib.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumLib.mjs","sourceRoot":"","sources":["../../../src/lib/NumLib.mts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IAClB;IACA,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,GAAW;QACjC,OAAO,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACD"}
1
+ {"version":3,"file":"NumLib.mjs","sourceRoot":"","sources":["../../../src/lib/NumLib.mts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IAClB,gBAAe,CAAC;IAEhB;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,GAAW;QACjC,OAAO,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACD,CAAC,oBAAoB","sourcesContent":["export class NumLib {\n\tconstructor() {}\n\n\t/************\n\t * parseFloat vuole il '.' come separatore decimale !!\n\t *\n\t * @param val\n\t * @returns {number}\n\t */\n\tstatic parseFloatFixed(val: string): number {\n\t\treturn parseFloat(val.replace(/,/g, '.'))\n\t}\n} /* c8 ignore next */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IPostgresError.mjs","sourceRoot":"","sources":["../../../../src/lib/PostgreSQL/IPostgresError.mts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"IPostgresError.mjs","sourceRoot":"","sources":["../../../../src/lib/PostgreSQL/IPostgresError.mts"],"names":[],"mappings":"","sourcesContent":["export interface IPostgresError extends Error {\n\tcode?: string\n\tdetail?: string\n\tconstraint?: string\n\thint?: string\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IPostgresErrorCodes.mjs","sourceRoot":"","sources":["../../../../src/lib/PostgreSQL/IPostgresErrorCodes.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAEX;AAFD,WAAY,mBAAmB;IAC9B,kDAA2B,CAAA;AAC5B,CAAC,EAFW,mBAAmB,KAAnB,mBAAmB,QAE9B"}
1
+ {"version":3,"file":"IPostgresErrorCodes.mjs","sourceRoot":"","sources":["../../../../src/lib/PostgreSQL/IPostgresErrorCodes.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAEX;AAFD,WAAY,mBAAmB;IAC9B,kDAA2B,CAAA;AAC5B,CAAC,EAFW,mBAAmB,KAAnB,mBAAmB,QAE9B","sourcesContent":["export enum IPostgresErrorCodes {\n\tduplicateKeyValue = '23505'\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"makePostgreSqlLogError.mjs","sourceRoot":"","sources":["../../../../src/lib/PostgreSQL/makePostgreSqlLogError.mts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CAAC,OAAuB;IAC7D,OAAO,GAAG,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,MAAM,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;AACvF,CAAC"}
1
+ {"version":3,"file":"makePostgreSqlLogError.mjs","sourceRoot":"","sources":["../../../../src/lib/PostgreSQL/makePostgreSqlLogError.mts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CAAC,OAAuB;IAC7D,OAAO,GAAG,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,MAAM,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;AACvF,CAAC","sourcesContent":["import { IPostgresError } from '@lib/PostgreSQL/IPostgresError.mjs'\n\nexport function makePostgreSqlLogError(pgError: IPostgresError): string {\n\treturn `${pgError.code} | ${pgError.hint} | ${pgError.detail} | ${pgError.constraint}`\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RedisBoolean.mjs","sourceRoot":"","sources":["../../../../src/lib/Redis/RedisBoolean.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,0BAAU,CAAA;IACV,2BAAW,CAAA;AACZ,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB"}
1
+ {"version":3,"file":"RedisBoolean.mjs","sourceRoot":"","sources":["../../../../src/lib/Redis/RedisBoolean.mts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,0BAAU,CAAA;IACV,2BAAW,CAAA;AACZ,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["export enum RedisBoolean {\n\ttrue = '1',\n\tfalse = '0'\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fromRedisBooleanValue.mjs","sourceRoot":"","sources":["../../../../src/lib/Redis/fromRedisBooleanValue.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,UAAU,qBAAqB,CAAC,IAAkB;IACvD,OAAO,IAAI,KAAK,YAAY,CAAC,IAAI,CAAA;AAClC,CAAC"}
1
+ {"version":3,"file":"fromRedisBooleanValue.mjs","sourceRoot":"","sources":["../../../../src/lib/Redis/fromRedisBooleanValue.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,UAAU,qBAAqB,CAAC,IAAkB;IACvD,OAAO,IAAI,KAAK,YAAY,CAAC,IAAI,CAAA;AAClC,CAAC","sourcesContent":["import { RedisBoolean } from './RedisBoolean.mjs'\n\nexport function fromRedisBooleanValue(data: RedisBoolean) {\n\treturn data === RedisBoolean.true\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"toRedisBooleanValue.mjs","sourceRoot":"","sources":["../../../../src/lib/Redis/toRedisBooleanValue.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAA;AACtD,CAAC"}
1
+ {"version":3,"file":"toRedisBooleanValue.mjs","sourceRoot":"","sources":["../../../../src/lib/Redis/toRedisBooleanValue.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAA;AACtD,CAAC","sourcesContent":["import { RedisBoolean } from './RedisBoolean.mjs'\n\nexport function toRedisBooleanValue(value: boolean) {\n\treturn value ? RedisBoolean.true : RedisBoolean.false\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  export class StringLib {
2
2
  // implements IStringLib
3
- constructor() {
4
- }
3
+ constructor() { }
5
4
  cleanHtml(str) {
6
5
  return str.replace(/(<([^>]+)>)/gi, '');
7
6
  }
@@ -33,7 +32,7 @@ export class StringLib {
33
32
  }
34
33
  isoFormatDMY(data) {
35
34
  const d = new Date(data);
36
- return (d.getUTCDate() + '/' + (d.getUTCMonth() + +1) + '/' + d.getUTCFullYear());
35
+ return d.getUTCDate() + '/' + (d.getUTCMonth() + +1) + '/' + d.getUTCFullYear();
37
36
  }
38
37
  isoFormatDateTime(data) {
39
38
  const d = new Date(data);
@@ -54,5 +53,5 @@ export class StringLib {
54
53
  makeLink(link, linkText = '') {
55
54
  return `<a target='_blank' href='${link}'>${linkText === '' ? link : linkText}</a>`;
56
55
  }
57
- }
56
+ } /* c8 ignore next */
58
57
  //# sourceMappingURL=StringLib.mjs.map