@axiumine/koa-utils 4.0.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -104,13 +104,13 @@ Pipeline: stream to `/tmp` (5 MB cap) → extension + magic-number MIME check
104
104
  ### Email
105
105
 
106
106
  ```ts
107
- import { SocketLabsLib } from '@axiumine/koa-utils/email/SocketlabsLib'
107
+ import { SocketLabsLib } from '@axiumine/koa-utils/email/SocketLabsLib'
108
108
 
109
109
  const mailer = new SocketLabsLib()
110
110
  await mailer.sendEmailVerify('user@example.com', hash)
111
111
  ```
112
112
 
113
- > Note: copy is hard-coded (a few legacy methods still carry YourCompany-branded placeholder text). Subclass / replace template methods for other locales or brands.
113
+ > Note: copy is hard-coded English and branded with `PLATFORM_NAME`. Subclass / replace template methods for other locales.
114
114
 
115
115
  ### Helpers
116
116
 
@@ -1,4 +1,4 @@
1
- interface IInfoUtente {
1
+ interface IUserInfo {
2
2
  _id: string;
3
3
  personalData: {
4
4
  name: string;
@@ -77,8 +77,8 @@ SendResponse {
77
77
  * @param otp
78
78
  */
79
79
  sendSubscriptionEmail(emailTo: string, otp: string): Promise<boolean>;
80
- sendConfermaResetPwd(emailTo: string, name?: string): Promise<boolean>;
81
- sendConfermaResetPwdHash(email: string, name: string, hash: string): Promise<true | null>;
80
+ sendResetPwdConfirmation(emailTo: string, name?: string): Promise<boolean>;
81
+ sendResetPwdConfirmationHash(email: string, name: string, hash: string): Promise<boolean>;
82
82
  sendEmailReset(emailTo: string, hash: string, name?: string): Promise<boolean>;
83
83
  /**
84
84
  * fallback footer
@@ -89,8 +89,8 @@ SendResponse {
89
89
  * @param emailTo
90
90
  * @param otp
91
91
  */
92
- sendOTP(emailTo: string, otp: string): Promise<null>;
93
- sendEmailPostSegnalato(infoUtente: IInfoUtente, idPost: number | string): Promise<boolean>;
92
+ sendOTP(emailTo: string, otp: string): Promise<boolean>;
93
+ sendEmailPostReported(userInfo: IUserInfo, idPost: number | string): Promise<boolean>;
94
94
  getHtmlHeader(title: string): string;
95
95
  getHtmlFooter(): string;
96
96
  private sendTemplate;
@@ -102,8 +102,8 @@ SendResponse {
102
102
  const linkHtml = this.StringObj.makeLink(link);
103
103
  const messageTxt = `Hi${nameFixed}, you or someone else has changed the email you sign in with.
104
104
  You can confirm by copying this link ${link} into your browser. The Team.`;
105
- const messageHtml = `Hi${nameFixed},<br>you or someone else has changed the email you sign in with.<br><br>" +
106
- 'You can confirm the registration by visiting this link ${linkHtml}
105
+ const messageHtml = `Hi${nameFixed},<br>you or someone else has changed the email you sign in with.<br><br>
106
+ You can confirm the registration by visiting this link ${linkHtml}
107
107
  <br><br>The Team.`;
108
108
  return await this.sendTemplate(emailTo, subject, messageTxt, messageHtml);
109
109
  }
@@ -194,8 +194,8 @@ SendResponse {
194
194
  * @param otp
195
195
  */
196
196
  async sendSubscriptionEmail(emailTo, otp) {
197
- const subject = `Activate your ${this.platformName} account}`;
198
- const url = `${this.linkBase}'/x/emailVerify`;
197
+ const subject = `Activate your ${this.platformName} account`;
198
+ const url = `${this.linkBase}/x/emailVerify`;
199
199
  const urlHtml = this.StringObj.makeLink(url);
200
200
  const linkHomeHtml = this.StringObj.makeLink(this.linkBase, this.platformName);
201
201
  const textBody = `To confirm your subscription on ${this.platformName}, open the following link in your browser
@@ -204,7 +204,7 @@ SendResponse {
204
204
  ${urlHtml} and enter the following activation code: ${otp}</p>`;
205
205
  return await this.sendTemplate(emailTo, subject, textBody, htmlBody);
206
206
  }
207
- async sendConfermaResetPwd(emailTo, name = '') {
207
+ async sendResetPwdConfirmation(emailTo, name = '') {
208
208
  const subject = `Password reset for ${this.platformName}`;
209
209
  const link = this.linkBase;
210
210
  const linkHtml = this.StringObj.makeLink(link, this.platformName);
@@ -213,9 +213,9 @@ SendResponse {
213
213
  const htmlBody = `Hi${nameFixed},<br>you have confirmed your new password.<br><br>You can now log in at:<br>${linkHtml}<br><br>The Team.`;
214
214
  return await this.sendTemplate(emailTo, subject, textBody, htmlBody);
215
215
  }
216
- async sendConfermaResetPwdHash(email, name, hash) {
216
+ async sendResetPwdConfirmationHash(email, name, hash) {
217
217
  const encodedEmail = encodeURI(email);
218
- const subject = 'Password reset for YourCompany';
218
+ const subject = `Password change confirmation for ${this.platformName}`;
219
219
  const linkReset = this.linkBase + '/index.php?q=reset&hash=' + hash + '&email=' + encodedEmail;
220
220
  const textBody = 'Hi ' + name + ', you have confirmed your new password. You can now log in at: ' + this.linkBase + ' . ';
221
221
  const htmlBody = this.getHtmlHeader(subject) +
@@ -225,15 +225,13 @@ SendResponse {
225
225
  this.StringObj.makeLink(linkReset) +
226
226
  '<br><br>The Team' +
227
227
  this.getHtmlFooter();
228
- let ret;
229
228
  try {
230
- ret = await this.sendTemplate(email, 'Password change confirmation for YourCompany', textBody, htmlBody);
229
+ return await this.sendTemplate(email, subject, textBody, htmlBody);
231
230
  }
232
231
  catch (e) {
233
232
  Sentry.captureException(e);
234
- ret = null;
233
+ return false;
235
234
  }
236
- return ret ? ret : null; // if the send succeeds, returns the hash, otherwise null
237
235
  }
238
236
  async sendEmailReset(emailTo, hash, name = '') {
239
237
  const subject = `Password reset for ${this.platformName}`;
@@ -260,43 +258,40 @@ SendResponse {
260
258
  * @param otp
261
259
  */
262
260
  async sendOTP(emailTo, otp) {
263
- let textBody = 'To confirm your subscription on YourCompany, enter the following OTP code: ' + otp;
264
- let htmlBody = '<p>To confirm your subscription on YourCompany, enter the following OTP code: ' + otp + '</p>';
265
- let ret;
261
+ const subject = `OTP code for ${this.platformName}`;
262
+ const textBody = `To confirm your subscription on ${this.platformName}, enter the following OTP code: ${otp}`;
263
+ const htmlBody = `<p>To confirm your subscription on ${this.platformName}, enter the following OTP code: ${otp}</p>`;
266
264
  try {
267
- await this.sendTemplate(emailTo, 'OTP code for YourCompany', textBody, htmlBody);
268
- ret = null;
265
+ return await this.sendTemplate(emailTo, subject, textBody, htmlBody);
269
266
  }
270
267
  catch (e) {
271
268
  Sentry.captureException(e);
272
- ret = null;
269
+ return false;
273
270
  }
274
- /* c8 ignore next -- ret is always null in this function */
275
- return ret ? ret : null; // if the send succeeds, returns the hash, otherwise null
276
271
  }
277
- async sendEmailPostSegnalato(infoUtente, idPost) {
272
+ async sendEmailPostReported(userInfo, idPost) {
278
273
  const subject = 'Post ' + idPost + ' reported';
279
274
  const messageTxt = 'Hi, post ' +
280
275
  idPost +
281
276
  ' has been reported by ' +
282
- infoUtente.personalData.name +
277
+ userInfo.personalData.name +
283
278
  ' ' +
284
- infoUtente.personalData.surname +
279
+ userInfo.personalData.surname +
285
280
  ' (id: ' +
286
- infoUtente._id +
281
+ userInfo._id +
287
282
  ').';
288
283
  const messageHtml = this.getHtmlHeader(subject) +
289
284
  'Hi, post ' +
290
285
  idPost +
291
286
  ' has been reported by ' +
292
- infoUtente.personalData.name +
287
+ userInfo.personalData.name +
293
288
  ' ' +
294
- infoUtente.personalData.surname +
289
+ userInfo.personalData.surname +
295
290
  ' (id: ' +
296
- infoUtente._id +
291
+ userInfo._id +
297
292
  ').' +
298
293
  this.getHtmlFooter();
299
- return await this.sendTemplate('dummy@example.com', subject, messageTxt, messageHtml);
294
+ return await this.sendTemplate(`${process.env.DEV_TEAM_EMAIL}`, subject, messageTxt, messageHtml);
300
295
  }
301
296
  getHtmlHeader(title) {
302
297
  return ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' +
@@ -353,7 +348,7 @@ SendResponse {
353
348
  */
354
349
  htmlHeader1() {
355
350
  return ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' +
356
- '<html lang="it" xmlns="http://www.w3.org/1999/xhtml">' +
351
+ '<html lang="en" xmlns="http://www.w3.org/1999/xhtml">' +
357
352
  ' <head>' +
358
353
  ' <meta http-equiv="Content-Type" content="text/html; charset=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I,CACzC,GAAG,EAAE;YACJ,4BAA4B;YAC5B,oDAAoD;YACpD,wEAAwE;YACxE,OAAO,IAAI,CAAA;QACZ,CAAC,EACD,CAAC,CAAQ,EAAE,EAAE;YACZ,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE;gBAC1B,KAAK,EAAE,EAAE,MAAM,EAAE,4BAA4B,EAAE;aAC/C,CAAC,CAAA;YACF,OAAO,KAAK,CAAA;QACb,CAAC,CACD,CAAA;IACF,CAAC;IAED;;;OAGG;IACK,WAAW;QAClB,OAAO,CACN,2HAA2H;YAC3H,uDAAuD;YACvD,SAAS;YACT,yEAAyE;YACzE,WAAW,CACX,CAAA;IACF,CAAC;IAED;;;OAGG;IACK,WAAW;QAClB,OAAO,CACN,UAAU;YACV,2EAA2E;YAC3E,SAAS;YACT,SAAS;YACT,uCAAuC;YACvC,gFAAgF;YAChF,QAAQ;YACR,+IAA+I,CAC/I,CAAA;IACF,CAAC;IAEO,OAAO,CAAC,IAAY;QAC3B,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,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 IInfoUtente {\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 sendConfermaResetPwd(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 sendConfermaResetPwdHash(email: string, name: string, hash: string) {\n\t\tconst encodedEmail = encodeURI(email)\n\t\tconst subject = 'Password reset for YourCompany'\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\tlet ret: boolean | null\n\t\ttry {\n\t\t\tret = await this.sendTemplate(email, 'Password change confirmation for YourCompany', textBody, htmlBody)\n\t\t} catch (e) {\n\t\t\tSentry.captureException(e)\n\t\t\tret = null\n\t\t}\n\t\treturn ret ? ret : null // if the send succeeds, returns the hash, otherwise null\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) {\n\t\tlet textBody = 'To confirm your subscription on YourCompany, enter the following OTP code: ' + otp\n\t\tlet htmlBody = '<p>To confirm your subscription on YourCompany, enter the following OTP code: ' + otp + '</p>'\n\n\t\tlet ret: string | null\n\t\ttry {\n\t\t\tawait this.sendTemplate(emailTo, 'OTP code for YourCompany', textBody, htmlBody)\n\t\t\tret = null\n\t\t} catch (e) {\n\t\t\tSentry.captureException(e)\n\t\t\tret = null\n\t\t}\n\t\t/* c8 ignore next -- ret is always null in this function */\n\t\treturn ret ? ret : null // if the send succeeds, returns the hash, otherwise null\n\t}\n\n\tasync sendEmailPostSegnalato(infoUtente: IInfoUtente, 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\tinfoUtente.personalData.name +\n\t\t\t' ' +\n\t\t\tinfoUtente.personalData.surname +\n\t\t\t' (id: ' +\n\t\t\tinfoUtente._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\tinfoUtente.personalData.name +\n\t\t\t' ' +\n\t\t\tinfoUtente.personalData.surname +\n\t\t\t' (id: ' +\n\t\t\tinfoUtente._id +\n\t\t\t').' +\n\t\t\tthis.getHtmlFooter()\n\n\t\treturn await this.sendTemplate('dummy@example.com', 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\t// console.debug('[sendEmail] Email sent correctly')\n\t\t\t\t//console.\t\t\t\t// console.debug('[sendEmail] Email sent correctly')(res);\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=\"it\" 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
+ {"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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AW;QAClB,OAAO,CACN,2HAA2H;YAC3H,uDAAuD;YACvD,SAAS;YACT,yEAAyE;YACzE,WAAW,CACX,CAAA;IACF,CAAC;IAED;;;OAGG;IACK,WAAW;QAClB,OAAO,CACN,UAAU;YACV,2EAA2E;YAC3E,SAAS;YACT,SAAS;YACT,uCAAuC;YACvC,gFAAgF;YAChF,QAAQ;YACR,+IAA+I,CAC/I,CAAA;IACF,CAAC;IAEO,OAAO,CAAC,IAAY;QAC3B,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,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\t// console.debug('[sendEmail] Email sent correctly')\n\t\t\t\t//console.\t\t\t\t// console.debug('[sendEmail] Email sent correctly')(res);\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"]}
@@ -56,7 +56,7 @@ export const updatePassword = {
56
56
  await removeResetReq(session, uEmail);
57
57
  // send new password confirmation email
58
58
  const SocketLabsObj = new SocketLabsLib();
59
- await SocketLabsObj.sendConfermaResetPwd(uEmail, resetPwd.name);
59
+ await SocketLabsObj.sendResetPwdConfirmation(uEmail, resetPwd.name);
60
60
  });
61
61
  }
62
62
  catch (e) {
@@ -1 +1 @@
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,EAAE,uDAA8C;AACpE,OAAO,cAAc,0DAAiD;AACtE,OAAO,gBAAgB,4DAAmD;AA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AAA","sourcesContent":["import { SocketLabsLib } from '@email/SocketLabsLib.mjs'\nimport { checkEmailLen } from '@lib/checkEmailLen.mjs'\nimport { checkPwdLen } from '@lib/checkPwdLen.mjs'\nimport { DateLib } from '@lib/DateLib.mjs'\nimport { tryCatchRethrow } from '@lib/tryCatchRethrow.mjs'\nimport { getResetPwd } from '@private/lib/access/db/getResetPwd.mjs'\nimport removeResetReq from '@private/lib/access/db/removeResetReq.mjs'\nimport updatePasswordDb from '@private/lib/access/db/updatePasswordDb.mjs'\nimport { throwForbiddenError } from '@throw/throwForbiddenError.mjs'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\ninterface IArgs {\n\temail: string\n\thash: string\n\tpassword: string\n}\n\nexport const updatePassword = {\n\tdescription: \"changes the user's password\",\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\thash: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: IArgs) {\n\t\tconst { email, hash, password } = args\n\n\t\tconst uEmail = email.trim().toLowerCase()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\tconst session = await mongoose.startSession()\n\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\tconst resetPwd = await getResetPwd(session, uEmail)\n\n\t\t\t\t// check if email is present in db\n\t\t\t\tif (resetPwd === null) {\n\t\t\t\t\tthrow throwForbiddenError() // don't reveal whether the email is present, for privacy\n\t\t\t\t}\n\t\t\t\t// console.debug('--email present')\n\n\t\t\t\tif (resetPwd.resetHash === null) {\n\t\t\t\t\tthrow throwInternalError()\n\t\t\t\t}\n\t\t\t\t/* c8 ignore next 3 -- defensive guard, resetDateReq cannot be null when resetHash is set */\n\t\t\t\tif (resetPwd.resetDateReq === null) {\n\t\t\t\t\tthrow throwInternalError() // throwSoftwareError('resetDateReq missing !')\n\t\t\t\t}\n\n\t\t\t\t// check if hash is missing or invalid\n\t\t\t\tif (resetPwd.resetHash !== hash) {\n\t\t\t\t\tthrow throwForbiddenError() // don't reveal whether the email is present, for privacy\n\t\t\t\t} // else console.debug('--hash valid')\n\n\t\t\t\t// check if the request was made within 1 hour\n\t\t\t\tconst dt1 = new Date('' + resetPwd.resetDateReq)\n\t\t\t\tif (DateLib.minElapsed(dt1) > 60) {\n\t\t\t\t\tthrow throwForbiddenError() // The link is no longer valid\n\t\t\t\t} // else console.debug('--link valid')\n\n\t\t\t\tconst update = await updatePasswordDb(session, resetPwd._id, password)\n\t\t\t\tif (!update) {\n\t\t\t\t\tthrow throwInternalError() // \"System error while updating the password.\"\n\t\t\t\t} // else console.debug('--pwd updated')\n\n\t\t\t\t// delete password reset request data from db\n\t\t\t\tawait removeResetReq(session, uEmail)\n\n\t\t\t\t// send new password confirmation email\n\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\tawait SocketLabsObj.sendConfermaResetPwd(uEmail, resetPwd.name)\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\treturn true\n\t}\n}\n"]}
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,EAAE,uDAA8C;AACpE,OAAO,cAAc,0DAAiD;AACtE,OAAO,gBAAgB,4DAAmD;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,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 } from '@private/lib/access/db/getResetPwd.mjs'\nimport removeResetReq from '@private/lib/access/db/removeResetReq.mjs'\nimport updatePasswordDb from '@private/lib/access/db/updatePasswordDb.mjs'\nimport { throwForbiddenError } from '@throw/throwForbiddenError.mjs'\nimport { throwInternalError } from '@throw/throwInternalError.mjs'\nimport { GraphQLBoolean, GraphQLError, GraphQLNonNull, GraphQLString } from 'graphql'\nimport mongoose from 'mongoose'\n\ninterface IArgs {\n\temail: string\n\thash: string\n\tpassword: string\n}\n\nexport const updatePassword = {\n\tdescription: \"changes the user's password\",\n\ttype: new GraphQLNonNull(GraphQLBoolean),\n\targs: {\n\t\temail: { type: new GraphQLNonNull(GraphQLString) },\n\t\thash: { type: new GraphQLNonNull(GraphQLString) },\n\t\tpassword: { type: new GraphQLNonNull(GraphQLString) }\n\t},\n\tasync resolve(_: unknown, args: IArgs) {\n\t\tconst { email, hash, password } = args\n\n\t\tconst uEmail = email.trim().toLowerCase()\n\t\tcheckEmailLen(uEmail)\n\t\tcheckPwdLen(password)\n\n\t\tconst session = await mongoose.startSession()\n\n\t\ttry {\n\t\t\tawait session.withTransaction(async () => {\n\t\t\t\tconst resetPwd = await getResetPwd(session, uEmail)\n\n\t\t\t\t// check if email is present in db\n\t\t\t\tif (resetPwd === null) {\n\t\t\t\t\tthrow throwForbiddenError() // don't reveal whether the email is present, for privacy\n\t\t\t\t}\n\t\t\t\t// console.debug('--email present')\n\n\t\t\t\tif (resetPwd.resetHash === null) {\n\t\t\t\t\tthrow throwInternalError()\n\t\t\t\t}\n\t\t\t\t/* c8 ignore next 3 -- defensive guard, resetDateReq cannot be null when resetHash is set */\n\t\t\t\tif (resetPwd.resetDateReq === null) {\n\t\t\t\t\tthrow throwInternalError() // throwSoftwareError('resetDateReq missing !')\n\t\t\t\t}\n\n\t\t\t\t// check if hash is missing or invalid\n\t\t\t\tif (resetPwd.resetHash !== hash) {\n\t\t\t\t\tthrow throwForbiddenError() // don't reveal whether the email is present, for privacy\n\t\t\t\t} // else console.debug('--hash valid')\n\n\t\t\t\t// check if the request was made within 1 hour\n\t\t\t\tconst dt1 = new Date('' + resetPwd.resetDateReq)\n\t\t\t\tif (DateLib.minElapsed(dt1) > 60) {\n\t\t\t\t\tthrow throwForbiddenError() // The link is no longer valid\n\t\t\t\t} // else console.debug('--link valid')\n\n\t\t\t\tconst update = await updatePasswordDb(session, resetPwd._id, password)\n\t\t\t\tif (!update) {\n\t\t\t\t\tthrow throwInternalError() // \"System error while updating the password.\"\n\t\t\t\t} // else console.debug('--pwd updated')\n\n\t\t\t\t// delete password reset request data from db\n\t\t\t\tawait removeResetReq(session, uEmail)\n\n\t\t\t\t// send new password confirmation email\n\t\t\t\tconst SocketLabsObj = new SocketLabsLib()\n\t\t\t\tawait SocketLabsObj.sendResetPwdConfirmation(uEmail, resetPwd.name)\n\t\t\t})\n\t\t} catch (e: unknown) {\n\t\t\ttryCatchRethrow(e as GraphQLError | Error)\n\t\t} finally {\n\t\t\tawait session.endSession()\n\t\t}\n\n\t\treturn true\n\t}\n}\n"]}
@@ -1,2 +1,2 @@
1
1
  import { ClientSession, Types } from 'mongoose';
2
- export declare function setEmailHash(session: ClientSession, idUtente: Types.ObjectId): Promise<string>;
2
+ export declare function setEmailHash(session: ClientSession, userId: Types.ObjectId): Promise<string>;
@@ -1,10 +1,10 @@
1
1
  import { emailHash } from "../../../../lib/emailHash.mjs";
2
2
  import { UserBase } from "../../../../graphQL/models/MongoDB/UserBase.mjs";
3
- export async function setEmailHash(session, idUtente) {
3
+ export async function setEmailHash(session, userId) {
4
4
  const hash = emailHash();
5
5
  //calculate password hash
6
6
  const dtNow = new Date();
7
- await UserBase.updateOne({ _id: idUtente }, {
7
+ await UserBase.updateOne({ _id: userId }, {
8
8
  $set: {
9
9
  'account.email.hash': hash,
10
10
  'account.email.requestTimes': 1, // ok
@@ -1 +1 @@
1
- {"version":3,"file":"setEmailHash.mjs","sourceRoot":"","sources":["../../../../../src/private/lib/access/db/setEmailHash.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,sCAA0B;AAC9C,OAAO,EAAE,QAAQ,EAAE,wDAAoC;AAGvD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAsB,EAAE,QAAwB;IAClF,MAAM,IAAI,GAAG,SAAS,EAAE,CAAA;IAExB,yBAAyB;IACzB,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;IAExB,MAAM,QAAQ,CAAC,SAAS,CACvB,EAAE,GAAG,EAAE,QAAQ,EAAE,EACjB;QACC,IAAI,EAAE;YACL,oBAAoB,EAAE,IAAI;YAC1B,4BAA4B,EAAE,CAAC,EAAE,KAAK;YACtC,2BAA2B,EAAE,KAAK;SAClC;KACD,EACD,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAChC,CAAA;IAED,OAAO,IAAI,CAAA,CAAC,2CAA2C;AACxD,CAAC","sourcesContent":["import { emailHash } from '@lib/emailHash.mjs'\nimport { UserBase } from '@models/MongoDB/UserBase.mjs'\nimport { ClientSession, Types } from 'mongoose'\n\nexport async function setEmailHash(session: ClientSession, idUtente: Types.ObjectId) {\n\tconst hash = emailHash()\n\n\t//calculate password hash\n\tconst dtNow = new Date()\n\n\tawait UserBase.updateOne(\n\t\t{ _id: idUtente },\n\t\t{\n\t\t\t$set: {\n\t\t\t\t'account.email.hash': hash,\n\t\t\t\t'account.email.requestTimes': 1, // ok\n\t\t\t\t'account.email.dateLastReq': dtNow\n\t\t\t}\n\t\t},\n\t\t{ session, runValidators: true }\n\t)\n\n\treturn hash // else it goes into exception @fixme check\n}\n"]}
1
+ {"version":3,"file":"setEmailHash.mjs","sourceRoot":"","sources":["../../../../../src/private/lib/access/db/setEmailHash.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,sCAA0B;AAC9C,OAAO,EAAE,QAAQ,EAAE,wDAAoC;AAGvD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAsB,EAAE,MAAsB;IAChF,MAAM,IAAI,GAAG,SAAS,EAAE,CAAA;IAExB,yBAAyB;IACzB,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;IAExB,MAAM,QAAQ,CAAC,SAAS,CACvB,EAAE,GAAG,EAAE,MAAM,EAAE,EACf;QACC,IAAI,EAAE;YACL,oBAAoB,EAAE,IAAI;YAC1B,4BAA4B,EAAE,CAAC,EAAE,KAAK;YACtC,2BAA2B,EAAE,KAAK;SAClC;KACD,EACD,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAChC,CAAA;IAED,OAAO,IAAI,CAAA,CAAC,2CAA2C;AACxD,CAAC","sourcesContent":["import { emailHash } from '@lib/emailHash.mjs'\nimport { UserBase } from '@models/MongoDB/UserBase.mjs'\nimport { ClientSession, Types } from 'mongoose'\n\nexport async function setEmailHash(session: ClientSession, userId: Types.ObjectId) {\n\tconst hash = emailHash()\n\n\t//calculate password hash\n\tconst dtNow = new Date()\n\n\tawait UserBase.updateOne(\n\t\t{ _id: userId },\n\t\t{\n\t\t\t$set: {\n\t\t\t\t'account.email.hash': hash,\n\t\t\t\t'account.email.requestTimes': 1, // ok\n\t\t\t\t'account.email.dateLastReq': dtNow\n\t\t\t}\n\t\t},\n\t\t{ session, runValidators: true }\n\t)\n\n\treturn hash // else it goes into exception @fixme check\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiumine/koa-utils",
3
- "version": "4.0.1",
3
+ "version": "5.0.0",
4
4
  "description": "Koa Utils",
5
5
  "type": "module",
6
6
  "repository": {
@@ -191,7 +191,7 @@
191
191
  "import": "./dist/dataSources/Redis.mjs",
192
192
  "types": "./dist/dataSources/Redis.d.mts"
193
193
  },
194
- "./email/SocketlabsLib": {
194
+ "./email/SocketLabsLib": {
195
195
  "import": "./dist/email/SocketLabsLib.mjs",
196
196
  "types": "./dist/email/SocketLabsLib.d.mts"
197
197
  },