@etainabl/nodejs-sdk 1.3.125 → 1.3.127

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/dist/esm/index.js CHANGED
@@ -5505,8 +5505,8 @@ var dataFetchersIds = ["bacnet", "solis", "solarman", "gridfetch", "smartflow",
5505
5505
  function sendEmail(lambdaSource, context, error, destinations) {
5506
5506
  const sesClient = new SESClient({ region: "eu-west-1" });
5507
5507
  const template = emailTemplate_default({
5508
- title: `WARNING: ${lambdaSource} Lambda Failed`,
5509
- alertLevel: "warning",
5508
+ title: `CRITICAL: ${lambdaSource} Lambda Failed`,
5509
+ alertLevel: "critical",
5510
5510
  message: `Error: ${error.message}. AWS Log Stream: ${context.logStreamName}, AWS Request ID: ${context.awsRequestId}`
5511
5511
  });
5512
5512
  const emailCommand = new SendEmailCommand({
@@ -5515,7 +5515,7 @@ function sendEmail(lambdaSource, context, error, destinations) {
5515
5515
  ToAddresses: destinations
5516
5516
  },
5517
5517
  Message: {
5518
- Subject: { Data: `WARNING: New Alert for the ${lambdaSource}` },
5518
+ Subject: { Data: `CRITICAL: New Alert for the ${lambdaSource}` },
5519
5519
  Body: {
5520
5520
  Html: { Data: template }
5521
5521
  }
@@ -5603,27 +5603,28 @@ async function uploadCsv({ csvContent, automationRun, s3Client, orgFilename, col
5603
5603
  throw new Error(error);
5604
5604
  }
5605
5605
  }
5606
- async function handleError({ etnApi, automationRun, error, lambdaSource, accountId }) {
5606
+ async function handleError({ etnApi, automationRun, error, lambdaSource, accountId, automation }) {
5607
5607
  await etnApi.createAutomationRunLog(automationRun._id, {
5608
5608
  message: error.message,
5609
5609
  status: "error",
5610
5610
  lambdaSource
5611
5611
  });
5612
- const message = automationRun.source?.fileName ? `Automation "${automationRun.description}" FAILED while processing file: ${automationRun.source.fileName}` : `Automation "${automationRun.description}" FAILED.`;
5612
+ const { description, service } = automation;
5613
+ const message = automationRun.source?.fileName ? `Automation "${description || service}" FAILED while processing file: ${automationRun.source.fileName}` : `Automation "${description}" FAILED.`;
5613
5614
  await etnApi.createLog({
5614
5615
  message,
5615
5616
  context: {
5616
5617
  status: "error",
5617
5618
  error: error.message,
5618
5619
  automationId: automationRun.automationId,
5619
- automationDescription: automationRun.description,
5620
+ automationDescription: description,
5620
5621
  automationRunId: automationRun._id
5621
5622
  },
5622
5623
  type: "automation-ingest",
5623
5624
  userSub: lambdaSource,
5624
5625
  companyId: automationRun.companyId
5625
5626
  });
5626
- if (accountId) {
5627
+ if (automationRun.category === "dataFetcher" && accountId) {
5627
5628
  await etnApi.updateAccountStatusForAutomation(automationRun.automationId, accountId, { status: "error" });
5628
5629
  }
5629
5630
  }