@etainabl/nodejs-sdk 1.3.119 → 1.3.120

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
@@ -169,7 +169,7 @@ var factory = {
169
169
  method: "GET",
170
170
  url: `${endpoint}/${id}${postEndpoint ? `/${postEndpoint}` : ""}`
171
171
  };
172
- log.info(`API Request: ${req.method} ${process.env.ETAsINABL_API_URL}/${req.url}`);
172
+ log.info(`API Request: ${req.method} ${process.env.ETAINABL_API_URL}/${req.url}`);
173
173
  let res;
174
174
  try {
175
175
  res = await etainablApi.get(req.url, options);
@@ -352,7 +352,7 @@ var api_default = (auth, instanceOptions = {}) => {
352
352
  createAutomationLog: subFactory.create(etainablApi, "automation", "logs"),
353
353
  updateAutomationLog: subFactory.update(etainablApi, "automation", "logs"),
354
354
  removeAutomationLog: subFactory.remove(etainablApi, "automation", "logs"),
355
- updateAccountStatusForAutomation: subFactory.update(etainablApi, "automation", "status"),
355
+ updateAccountStatusForAutomation: subFactory.update(etainablApi, "automation", "account-status"),
356
356
  // company
357
357
  getCompany: factory.getWithId(etainablApi, "companies"),
358
358
  getCompanyInvoiceValidationRules: factory.getWithId(
@@ -478,6 +478,7 @@ var api_default = (auth, instanceOptions = {}) => {
478
478
  "logs"
479
479
  ),
480
480
  searchAutomationRun: factory.get(etainablApi, "automation-runs", "search"),
481
+ updateAccountResults: factory.update(etainablApi, "automation-runs", "import"),
481
482
  // global search
482
483
  globalSearch: factory.get(etainablApi, "global-search", "search")
483
484
  };
@@ -1471,9 +1472,11 @@ var integrations_exports = {};
1471
1472
  __export(integrations_exports, {
1472
1473
  collectionTypes: () => collectionTypes,
1473
1474
  createCsv: () => createCsv,
1475
+ dataFetchersIds: () => dataFetchersIds,
1474
1476
  deleteMessage: () => deleteMessage,
1475
1477
  errorCodes: () => errorCodes,
1476
1478
  handleError: () => handleError,
1479
+ sendEmail: () => sendEmail,
1477
1480
  uploadCsv: () => uploadCsv
1478
1481
  });
1479
1482
  import { stringify } from "csv-stringify/sync";
@@ -5462,6 +5465,7 @@ var PutObjectCommand = class extends Command.classBuilder().ep({
5462
5465
  };
5463
5466
 
5464
5467
  // src/integrations.ts
5468
+ import { SESClient, SendEmailCommand } from "@aws-sdk/client-ses";
5465
5469
  import { SQSClient, DeleteMessageCommand } from "@aws-sdk/client-sqs";
5466
5470
  var collectionTypes = ["readings", "consumptions", "invoices"];
5467
5471
  var errorCodes = [
@@ -5475,6 +5479,28 @@ var errorCodes = [
5475
5479
  "VALIDATION_ERROR",
5476
5480
  "METER_READS_ZERO"
5477
5481
  ];
5482
+ var dataFetchersIds = ["bacnet", "solis", "solarman", "gridfetch", "smartflow", "smartvatten", "beringar", "4dmonitoring"];
5483
+ function sendEmail(lambdaSource, context, error, destinations) {
5484
+ const sesClient = new SESClient({ region: "eu-west-1" });
5485
+ const template = emailTemplate_default({
5486
+ title: `WARNING: ${lambdaSource} Lambda Failed`,
5487
+ alertLevel: "warning",
5488
+ message: `Error: ${error.message}. AWS Log Stream: ${context.logStreamName}, AWS Request ID: ${context.awsRequestId}`
5489
+ });
5490
+ const emailCommand = new SendEmailCommand({
5491
+ Source: `alerts@${process.env.EMAIL_DOMAIN}`,
5492
+ Destination: {
5493
+ ToAddresses: destinations
5494
+ },
5495
+ Message: {
5496
+ Subject: { Data: `WARNING: New Alert for the ${lambdaSource}` },
5497
+ Body: {
5498
+ Html: { Data: template }
5499
+ }
5500
+ }
5501
+ });
5502
+ return sesClient.send(emailCommand);
5503
+ }
5478
5504
  function createCsv(data) {
5479
5505
  function flattenObject(obj, prefix = "") {
5480
5506
  const flattened = {};