@yrpri/api 9.0.83 → 9.0.84

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.
@@ -112,7 +112,7 @@ const importPost = (post, done) => {
112
112
  description += answers[i].value.trim();
113
113
  }
114
114
  catch (error) {
115
- description += answers[i].value;
115
+ description += `${answers[i].value}`;
116
116
  console.warn(`Error trimming answer to description: ${answers[i].value}`);
117
117
  }
118
118
  }
@@ -282,7 +282,10 @@ const getTranslatedTextForPost = (post, callback) => {
282
282
  parallelCallback(error);
283
283
  }
284
284
  else if (translations) {
285
- postStructuredAnswers = translations.join(". ");
285
+ const safeTranslations = translations.map((val) => {
286
+ return typeof val === "string" ? val : String(val);
287
+ });
288
+ postStructuredAnswers = safeTranslations.join(". ");
286
289
  parallelCallback();
287
290
  }
288
291
  else {
@@ -215,9 +215,10 @@ module.exports = (sequelize, DataTypes) => {
215
215
  const textStrings = [];
216
216
  let combinedText = "";
217
217
  for (const answer of post.public_data.structuredAnswersJson) {
218
- if (answer.value) {
219
- textStrings.push(answer.value);
220
- combinedText += answer.value;
218
+ if (answer.value !== undefined && answer.value !== null) {
219
+ const safeValue = typeof answer.value === "string" ? answer.value : String(answer.value);
220
+ textStrings.push(safeValue);
221
+ combinedText += safeValue;
221
222
  }
222
223
  else {
223
224
  textStrings.push("");
@@ -12,7 +12,7 @@ export class AgentInviteManager {
12
12
  /**
13
13
  * Send a notification email to group admins about the current workflow step or completion.
14
14
  */
15
- static async sendInviteEmail(link, agentRunId, groupId, user) {
15
+ static async sendInviteEmail(link, agentRunId, groupId, senderUser, inviteeEmail) {
16
16
  try {
17
17
  const agentRun = await NotificationAgentQueueManager.getAgentRun(agentRunId);
18
18
  if (!agentRun) {
@@ -32,11 +32,11 @@ export class AgentInviteManager {
32
32
  },
33
33
  ],
34
34
  }));
35
- const emailContent = EmailTemplateRenderer.renderEmail("", user.name, agentRun.Subscription?.Plan?.AgentProduct?.name || "", agentRun.workflow, link, "https://evoly.ai/is/amplifier/img/amplifier-logo.png", "https://evoly.ai/is/amplifier/img/evoly-bw-logo.png", "https://evoly.ai/", "© 2024 Evoly ehf, Vegmuli 8, 108, Reykjavik, Iceland");
35
+ const emailContent = EmailTemplateRenderer.renderEmail("", senderUser.name, agentRun.Subscription?.Plan?.AgentProduct?.name || "", agentRun.workflow, link, "https://evoly.ai/is/amplifier/img/amplifier-logo.png", "https://evoly.ai/is/amplifier/img/evoly-bw-logo.png", "https://evoly.ai/", "© 2024 Evoly ehf, Vegmuli 8, 108, Reykjavik, Iceland");
36
36
  queue.add("send-one-email", {
37
37
  subject: subject,
38
38
  template: "general_user_notification",
39
- user: user,
39
+ user: { id: null, email: inviteeEmail, name: inviteeEmail },
40
40
  domain: group.Community?.Domain,
41
41
  group: group,
42
42
  object: {},
@@ -1015,7 +1015,7 @@ router.post("/:groupId/sendEmailInvitesForAnons", auth.can("edit group"), async
1015
1015
  from_user_id: req.user.id,
1016
1016
  });
1017
1017
  const invite_link = `https://app.${req.ypDomain.domain_name}/group/${group.id}?anonInvite=1&token=${token}&forAgentBundle=1`;
1018
- await AgentInviteManager.sendInviteEmail(invite_link, req.body.agentRunId, group.id, req.user);
1018
+ await AgentInviteManager.sendInviteEmail(invite_link, req.body.agentRunId, group.id, req.user, email);
1019
1019
  log.info("Invite Created", {
1020
1020
  email,
1021
1021
  inviteId: invite.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yrpri/api",
3
- "version": "9.0.83",
3
+ "version": "9.0.84",
4
4
  "license": "MIT",
5
5
  "author": "Robert Bjarnason & Citizens Foundation",
6
6
  "repository": {