@etainabl/nodejs-sdk 1.3.151 → 1.3.153

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/index.d.cts CHANGED
@@ -611,6 +611,7 @@ type FormattedConsumption = Omit<Consumption<string, string>, '_id'>;
611
611
  type FormattedReading = Omit<Reading<string, string>, '_id'>;
612
612
  type FormattedInvoice = Omit<Invoice<string, string>, '_id' | 's3Key'>;
613
613
  interface HandleErrorParams {
614
+ context: Context;
614
615
  etnApi: ReturnType<typeof _default$4>;
615
616
  automationRun: AutomationRun<string>;
616
617
  lambdaSource: string;
@@ -640,7 +641,7 @@ interface UploadCsv {
640
641
  declare function sendEmail(lambdaSource: string, context: Context, error: Error, destinations: string[]): Promise<_aws_sdk_client_ses.SendEmailCommandOutput>;
641
642
  declare function createCsv(data: (FormattedConsumption | FormattedReading | FormattedInvoice)[]): string;
642
643
  declare function uploadCsv({ csvContent, automationRun, s3Client, orgFilename, collectionType }: UploadCsv): Promise<string>;
643
- declare function handleError({ etnApi, automationRun, error, lambdaSource, accountId, automation, messageId }: HandleErrorParams): Promise<void>;
644
+ declare function handleError({ context, etnApi, automationRun, error, lambdaSource, accountId, automation, messageId }: HandleErrorParams): Promise<void>;
644
645
  declare function deleteMessage(queueUrl: string, receiptHandle: string, sqsClient?: SQSClient): Promise<void>;
645
646
 
646
647
  type integrations_CollectionType = CollectionType;
@@ -877,7 +878,9 @@ interface CompanySettings<IDType = ObjectId | string> {
877
878
  invoiceValidationSettings?: CompanyInvoiceValidationSettings<IDType>;
878
879
  autoInvoiceValidation?: boolean;
879
880
  splitInvoices?: boolean;
881
+ completedInvoiceFilename?: 'original' | 'generated';
880
882
  invoiceFilename?: {
883
+ format?: string;
881
884
  legalNameMaxLength?: number;
882
885
  siteNameMaxLength?: number;
883
886
  };
package/dist/index.d.ts CHANGED
@@ -611,6 +611,7 @@ type FormattedConsumption = Omit<Consumption<string, string>, '_id'>;
611
611
  type FormattedReading = Omit<Reading<string, string>, '_id'>;
612
612
  type FormattedInvoice = Omit<Invoice<string, string>, '_id' | 's3Key'>;
613
613
  interface HandleErrorParams {
614
+ context: Context;
614
615
  etnApi: ReturnType<typeof _default$4>;
615
616
  automationRun: AutomationRun<string>;
616
617
  lambdaSource: string;
@@ -640,7 +641,7 @@ interface UploadCsv {
640
641
  declare function sendEmail(lambdaSource: string, context: Context, error: Error, destinations: string[]): Promise<_aws_sdk_client_ses.SendEmailCommandOutput>;
641
642
  declare function createCsv(data: (FormattedConsumption | FormattedReading | FormattedInvoice)[]): string;
642
643
  declare function uploadCsv({ csvContent, automationRun, s3Client, orgFilename, collectionType }: UploadCsv): Promise<string>;
643
- declare function handleError({ etnApi, automationRun, error, lambdaSource, accountId, automation, messageId }: HandleErrorParams): Promise<void>;
644
+ declare function handleError({ context, etnApi, automationRun, error, lambdaSource, accountId, automation, messageId }: HandleErrorParams): Promise<void>;
644
645
  declare function deleteMessage(queueUrl: string, receiptHandle: string, sqsClient?: SQSClient): Promise<void>;
645
646
 
646
647
  type integrations_CollectionType = CollectionType;
@@ -877,7 +878,9 @@ interface CompanySettings<IDType = ObjectId | string> {
877
878
  invoiceValidationSettings?: CompanyInvoiceValidationSettings<IDType>;
878
879
  autoInvoiceValidation?: boolean;
879
880
  splitInvoices?: boolean;
881
+ completedInvoiceFilename?: 'original' | 'generated';
880
882
  invoiceFilename?: {
883
+ format?: string;
881
884
  legalNameMaxLength?: number;
882
885
  siteNameMaxLength?: number;
883
886
  };
package/dist/index.js CHANGED
@@ -17439,8 +17439,8 @@ var units = [
17439
17439
  var getMeterPointNumberBottomLine = (meterPointNumber) => {
17440
17440
  if (!meterPointNumber) return "";
17441
17441
  const mpan = String(meterPointNumber).replace(/\s/g, "");
17442
- if (mpan.length === 21) {
17443
- return mpan.substring(8, 21);
17442
+ if (mpan.length === 21 || mpan.length === 22) {
17443
+ return mpan.substring(8, mpan.length);
17444
17444
  }
17445
17445
  if (mpan.length === 13) {
17446
17446
  return mpan;
@@ -25546,12 +25546,14 @@ async function uploadCsv({ csvContent, automationRun, s3Client, orgFilename, col
25546
25546
  throw new Error(error);
25547
25547
  }
25548
25548
  }
25549
- async function handleError({ etnApi, automationRun, error, lambdaSource, accountId, automation, messageId }) {
25549
+ async function handleError({ context, etnApi, automationRun, error, lambdaSource, accountId, automation, messageId }) {
25550
25550
  await etnApi.createAutomationRunLog(automationRun._id, {
25551
25551
  message: error.message,
25552
25552
  status: "error",
25553
25553
  lambdaSource,
25554
- lambdaMessageId: messageId
25554
+ lambdaMessageId: messageId,
25555
+ lambdaLogStreamName: context.logStreamName,
25556
+ lambdaRequestId: context.awsRequestId
25555
25557
  });
25556
25558
  const { description, service } = automation;
25557
25559
  const message = automationRun.source?.fileName ? `Automation "${description || service}" FAILED while processing file: ${automationRun.source.fileName}` : `Automation "${description}" FAILED.`;