@etainabl/nodejs-sdk 1.3.130 → 1.3.131

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.
Files changed (31) hide show
  1. package/dist/esm/{chunk-XSPB2DRU.js → chunk-6ZE6VFBF.js} +52 -1
  2. package/dist/esm/{chunk-XSPB2DRU.js.map → chunk-6ZE6VFBF.js.map} +1 -1
  3. package/dist/esm/{chunk-VSMDPKQT.js → chunk-AFIWRSL2.js} +2 -2
  4. package/dist/esm/{chunk-EAEPE6LV.js → chunk-GEJJRBZZ.js} +3 -3
  5. package/dist/esm/{chunk-DDCT4ZYV.js → chunk-JFJBZL6W.js} +2 -2
  6. package/dist/esm/{chunk-YUPOEH3S.js → chunk-UGK43V2L.js} +2 -2
  7. package/dist/esm/{dist-es-LEN5TBON.js → dist-es-AV5FKRC6.js} +2 -2
  8. package/dist/esm/{dist-es-MTQJIBCO.js → dist-es-HQRLUYWI.js} +2 -2
  9. package/dist/esm/{dist-es-4PZVI2OP.js → dist-es-N5B4V37N.js} +5 -5
  10. package/dist/esm/{dist-es-43LBWNIP.js → dist-es-T2FMHNMU.js} +4 -4
  11. package/dist/esm/index.js +689 -212
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/{loadSso-TNKRSJIY.js → loadSso-KRYOAJJX.js} +5 -5
  14. package/dist/esm/{sso-oidc-LXV5UW7C.js → sso-oidc-RASI2Q3K.js} +5 -5
  15. package/dist/esm/{sts-7CU5WIQI.js → sts-IERANB7E.js} +4 -4
  16. package/dist/index.d.cts +41 -8
  17. package/dist/index.d.ts +41 -8
  18. package/dist/index.js +755 -229
  19. package/dist/index.js.map +1 -1
  20. package/package.json +1 -1
  21. /package/dist/esm/{chunk-VSMDPKQT.js.map → chunk-AFIWRSL2.js.map} +0 -0
  22. /package/dist/esm/{chunk-EAEPE6LV.js.map → chunk-GEJJRBZZ.js.map} +0 -0
  23. /package/dist/esm/{chunk-DDCT4ZYV.js.map → chunk-JFJBZL6W.js.map} +0 -0
  24. /package/dist/esm/{chunk-YUPOEH3S.js.map → chunk-UGK43V2L.js.map} +0 -0
  25. /package/dist/esm/{dist-es-LEN5TBON.js.map → dist-es-AV5FKRC6.js.map} +0 -0
  26. /package/dist/esm/{dist-es-MTQJIBCO.js.map → dist-es-HQRLUYWI.js.map} +0 -0
  27. /package/dist/esm/{dist-es-4PZVI2OP.js.map → dist-es-N5B4V37N.js.map} +0 -0
  28. /package/dist/esm/{dist-es-43LBWNIP.js.map → dist-es-T2FMHNMU.js.map} +0 -0
  29. /package/dist/esm/{loadSso-TNKRSJIY.js.map → loadSso-KRYOAJJX.js.map} +0 -0
  30. /package/dist/esm/{sso-oidc-LXV5UW7C.js.map → sso-oidc-RASI2Q3K.js.map} +0 -0
  31. /package/dist/esm/{sts-7CU5WIQI.js.map → sts-IERANB7E.js.map} +0 -0
@@ -2,10 +2,10 @@ import {
2
2
  loadRestJsonErrorCode,
3
3
  parseJsonBody,
4
4
  parseJsonErrorBody
5
- } from "./chunk-VSMDPKQT.js";
5
+ } from "./chunk-AFIWRSL2.js";
6
6
  import {
7
7
  requestBuilder
8
- } from "./chunk-YUPOEH3S.js";
8
+ } from "./chunk-UGK43V2L.js";
9
9
  import {
10
10
  NoAuthSigner
11
11
  } from "./chunk-UQAJZJ7E.js";
@@ -50,7 +50,7 @@ import {
50
50
  resolveRegionConfig,
51
51
  resolveRetryConfig,
52
52
  resolveUserAgentConfig
53
- } from "./chunk-DDCT4ZYV.js";
53
+ } from "./chunk-JFJBZL6W.js";
54
54
  import {
55
55
  loadConfig,
56
56
  parseUrl
@@ -82,7 +82,7 @@ import {
82
82
  toBase64,
83
83
  toUtf8,
84
84
  withBaseException
85
- } from "./chunk-XSPB2DRU.js";
85
+ } from "./chunk-6ZE6VFBF.js";
86
86
  import "./chunk-HAEAETXR.js";
87
87
  import "./chunk-UZGMBQZB.js";
88
88
  import "./chunk-3YGWW265.js";
@@ -656,4 +656,4 @@ export {
656
656
  GetRoleCredentialsCommand,
657
657
  SSOClient
658
658
  };
659
- //# sourceMappingURL=loadSso-TNKRSJIY.js.map
659
+ //# sourceMappingURL=loadSso-KRYOAJJX.js.map
@@ -2,10 +2,10 @@ import {
2
2
  loadRestJsonErrorCode,
3
3
  parseJsonBody,
4
4
  parseJsonErrorBody
5
- } from "./chunk-VSMDPKQT.js";
5
+ } from "./chunk-AFIWRSL2.js";
6
6
  import {
7
7
  requestBuilder
8
- } from "./chunk-YUPOEH3S.js";
8
+ } from "./chunk-UGK43V2L.js";
9
9
  import {
10
10
  package_default
11
11
  } from "./chunk-V42NON4H.js";
@@ -53,7 +53,7 @@ import {
53
53
  resolveRegionConfig,
54
54
  resolveRetryConfig,
55
55
  resolveUserAgentConfig
56
- } from "./chunk-DDCT4ZYV.js";
56
+ } from "./chunk-JFJBZL6W.js";
57
57
  import {
58
58
  loadConfig,
59
59
  parseUrl
@@ -86,7 +86,7 @@ import {
86
86
  toBase64,
87
87
  toUtf8,
88
88
  withBaseException
89
- } from "./chunk-XSPB2DRU.js";
89
+ } from "./chunk-6ZE6VFBF.js";
90
90
  import "./chunk-HAEAETXR.js";
91
91
  import "./chunk-UZGMBQZB.js";
92
92
  import "./chunk-3YGWW265.js";
@@ -828,4 +828,4 @@ export {
828
828
  UnsupportedGrantTypeException,
829
829
  Client as __Client
830
830
  };
831
- //# sourceMappingURL=sso-oidc-LXV5UW7C.js.map
831
+ //# sourceMappingURL=sso-oidc-RASI2Q3K.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parseXmlBody,
3
3
  parseXmlErrorBody
4
- } from "./chunk-EAEPE6LV.js";
4
+ } from "./chunk-GEJJRBZZ.js";
5
5
  import {
6
6
  package_default
7
7
  } from "./chunk-V42NON4H.js";
@@ -49,7 +49,7 @@ import {
49
49
  resolveRegionConfig,
50
50
  resolveRetryConfig,
51
51
  resolveUserAgentConfig
52
- } from "./chunk-DDCT4ZYV.js";
52
+ } from "./chunk-JFJBZL6W.js";
53
53
  import {
54
54
  loadConfig,
55
55
  parseUrl
@@ -81,7 +81,7 @@ import {
81
81
  toBase64,
82
82
  toUtf8,
83
83
  withBaseException
84
- } from "./chunk-XSPB2DRU.js";
84
+ } from "./chunk-6ZE6VFBF.js";
85
85
  import "./chunk-HAEAETXR.js";
86
86
  import {
87
87
  setCredentialFeature
@@ -1161,4 +1161,4 @@ export {
1161
1161
  getDefaultRoleAssumer2 as getDefaultRoleAssumer,
1162
1162
  getDefaultRoleAssumerWithWebIdentity2 as getDefaultRoleAssumerWithWebIdentity
1163
1163
  };
1164
- //# sourceMappingURL=sts-7CU5WIQI.js.map
1164
+ //# sourceMappingURL=sts-IERANB7E.js.map
package/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { ObjectId, Db } from 'mongodb';
4
4
  export { ObjectId } from 'mongodb';
5
5
  import * as _aws_sdk_client_ses from '@aws-sdk/client-ses';
6
6
  import { S3Client } from '@aws-sdk/client-s3';
7
- import { Context } from 'aws-lambda';
7
+ import { Context, SQSEvent, SNSEvent, APIGatewayEvent, S3Event } from 'aws-lambda';
8
8
  import { SQSClient } from '@aws-sdk/client-sqs';
9
9
  import winston from 'winston';
10
10
  import moment from 'moment';
@@ -624,6 +624,7 @@ interface HandleErrorParams {
624
624
  lambdaSource: string;
625
625
  error: Error;
626
626
  accountId?: string;
627
+ messageId: string;
627
628
  automation: Automation<string>;
628
629
  }
629
630
  declare const collectionTypes: readonly ["readings", "consumptions", "invoices"];
@@ -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 }: HandleErrorParams): Promise<void>;
644
+ declare function handleError({ 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;
@@ -662,12 +663,12 @@ declare namespace integrations {
662
663
  interface AutomationRunLog<DateType = Date | string> {
663
664
  date: DateType;
664
665
  message: string;
665
- status: 'error' | 'running' | 'success';
666
+ status: 'error' | 'running' | 'success' | 'warning';
666
667
  errorMessage?: string;
667
- lambdaSource?: string;
668
+ lambdaSource: string;
668
669
  lambdaRequestId?: string;
669
670
  lambdaLogStreamName?: string;
670
- lambdaMessageId?: string;
671
+ lambdaMessageId: string;
671
672
  }
672
673
  interface AccountResult<IDType = ObjectId | string, DateType = Date | string> {
673
674
  accountId: IDType;
@@ -723,7 +724,6 @@ interface SourceMetadata {
723
724
  }
724
725
  interface AutomationRunSummary {
725
726
  totalRows?: number;
726
- processedRows?: number;
727
727
  failedRows?: number;
728
728
  accountsNotFound?: number;
729
729
  accountsFound?: number;
@@ -736,7 +736,7 @@ interface AutomationRun<IDType = ObjectId | string, DateType = Date | string> {
736
736
  companyId: IDType;
737
737
  active: boolean;
738
738
  category: 'dataFetcher' | 'dataExtractor';
739
- status: 'running' | 'success' | 'failed' | 'completedWithWarnings';
739
+ status: 'running' | 'success' | 'failed' | 'warning';
740
740
  collectionType?: CollectionType;
741
741
  source?: SourceMetadata;
742
742
  summary?: AutomationRunSummary;
@@ -747,6 +747,8 @@ interface AutomationRun<IDType = ObjectId | string, DateType = Date | string> {
747
747
  s3Bucket: string;
748
748
  s3Key: string;
749
749
  fileName: string;
750
+ totalRecords: number;
751
+ fileSize: number;
750
752
  };
751
753
  chunkProcessing?: {
752
754
  totalChunks: number;
@@ -1595,13 +1597,44 @@ declare const automationServices: {
1595
1597
  category: AutomationServiceCategory;
1596
1598
  }[];
1597
1599
 
1600
+ interface StepFunctionEvent {
1601
+ params: any;
1602
+ input: {
1603
+ companyId: string;
1604
+ userSub: string;
1605
+ [key: string]: any;
1606
+ };
1607
+ name: string;
1608
+ }
1609
+ declare class IngestHandler {
1610
+ protected event: SQSEvent | SNSEvent | APIGatewayEvent | S3Event;
1611
+ protected log: ReturnType<typeof _default$2>;
1612
+ protected sqsReceiptHandle: string | undefined;
1613
+ constructor(event: any);
1614
+ isSQSEvent(event: any): event is SQSEvent;
1615
+ isSNSEvent(event: any): event is SNSEvent;
1616
+ isAPIGatewayEvent(event: any): event is APIGatewayEvent;
1617
+ isS3Event(event: any): event is S3Event;
1618
+ isStepFunction(event: any): event is StepFunctionEvent;
1619
+ handleEvent(): Promise<ETNEvent>;
1620
+ handleSQSEvent(eventType?: ETNEvent['eventType']): Promise<ETNEvent>;
1621
+ handleSNSEvent(eventType?: ETNEvent['eventType']): Promise<ETNEvent>;
1622
+ handleAPIGatewayEvent(): ETNEvent;
1623
+ handleS3Event(eventType?: ETNEvent['eventType']): Promise<ETNEvent>;
1624
+ handleStepFunctionEvent(eventType?: ETNEvent['eventType']): Promise<ETNEvent>;
1625
+ getS3ObjectMetadata(bucket: string, key: string): Promise<Record<string, string>>;
1626
+ deleteMessage(queueUrl?: string | undefined): Promise<void>;
1627
+ }
1628
+
1629
+ type index$1_IngestHandler = IngestHandler;
1630
+ declare const index$1_IngestHandler: typeof IngestHandler;
1598
1631
  declare const index$1_automationServices: typeof automationServices;
1599
1632
  declare const index$1_automationSources: typeof automationSources;
1600
1633
  declare const index$1_getMeterPointNumberBottomLine: typeof getMeterPointNumberBottomLine;
1601
1634
  declare const index$1_utilityTypes: typeof utilityTypes;
1602
1635
  declare const index$1_wasteCategories: typeof wasteCategories;
1603
1636
  declare namespace index$1 {
1604
- export { index$1_automationServices as automationServices, index$1_automationSources as automationSources, index$1_getMeterPointNumberBottomLine as getMeterPointNumberBottomLine, units$1 as units, index$1_utilityTypes as utilityTypes, index$1_wasteCategories as wasteCategories };
1637
+ export { index$1_IngestHandler as IngestHandler, index$1_automationServices as automationServices, index$1_automationSources as automationSources, index$1_getMeterPointNumberBottomLine as getMeterPointNumberBottomLine, units$1 as units, index$1_utilityTypes as utilityTypes, index$1_wasteCategories as wasteCategories };
1605
1638
  }
1606
1639
 
1607
1640
  interface ETNModel {
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { ObjectId, Db } from 'mongodb';
4
4
  export { ObjectId } from 'mongodb';
5
5
  import * as _aws_sdk_client_ses from '@aws-sdk/client-ses';
6
6
  import { S3Client } from '@aws-sdk/client-s3';
7
- import { Context } from 'aws-lambda';
7
+ import { Context, SQSEvent, SNSEvent, APIGatewayEvent, S3Event } from 'aws-lambda';
8
8
  import { SQSClient } from '@aws-sdk/client-sqs';
9
9
  import winston from 'winston';
10
10
  import moment from 'moment';
@@ -624,6 +624,7 @@ interface HandleErrorParams {
624
624
  lambdaSource: string;
625
625
  error: Error;
626
626
  accountId?: string;
627
+ messageId: string;
627
628
  automation: Automation<string>;
628
629
  }
629
630
  declare const collectionTypes: readonly ["readings", "consumptions", "invoices"];
@@ -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 }: HandleErrorParams): Promise<void>;
644
+ declare function handleError({ 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;
@@ -662,12 +663,12 @@ declare namespace integrations {
662
663
  interface AutomationRunLog<DateType = Date | string> {
663
664
  date: DateType;
664
665
  message: string;
665
- status: 'error' | 'running' | 'success';
666
+ status: 'error' | 'running' | 'success' | 'warning';
666
667
  errorMessage?: string;
667
- lambdaSource?: string;
668
+ lambdaSource: string;
668
669
  lambdaRequestId?: string;
669
670
  lambdaLogStreamName?: string;
670
- lambdaMessageId?: string;
671
+ lambdaMessageId: string;
671
672
  }
672
673
  interface AccountResult<IDType = ObjectId | string, DateType = Date | string> {
673
674
  accountId: IDType;
@@ -723,7 +724,6 @@ interface SourceMetadata {
723
724
  }
724
725
  interface AutomationRunSummary {
725
726
  totalRows?: number;
726
- processedRows?: number;
727
727
  failedRows?: number;
728
728
  accountsNotFound?: number;
729
729
  accountsFound?: number;
@@ -736,7 +736,7 @@ interface AutomationRun<IDType = ObjectId | string, DateType = Date | string> {
736
736
  companyId: IDType;
737
737
  active: boolean;
738
738
  category: 'dataFetcher' | 'dataExtractor';
739
- status: 'running' | 'success' | 'failed' | 'completedWithWarnings';
739
+ status: 'running' | 'success' | 'failed' | 'warning';
740
740
  collectionType?: CollectionType;
741
741
  source?: SourceMetadata;
742
742
  summary?: AutomationRunSummary;
@@ -747,6 +747,8 @@ interface AutomationRun<IDType = ObjectId | string, DateType = Date | string> {
747
747
  s3Bucket: string;
748
748
  s3Key: string;
749
749
  fileName: string;
750
+ totalRecords: number;
751
+ fileSize: number;
750
752
  };
751
753
  chunkProcessing?: {
752
754
  totalChunks: number;
@@ -1595,13 +1597,44 @@ declare const automationServices: {
1595
1597
  category: AutomationServiceCategory;
1596
1598
  }[];
1597
1599
 
1600
+ interface StepFunctionEvent {
1601
+ params: any;
1602
+ input: {
1603
+ companyId: string;
1604
+ userSub: string;
1605
+ [key: string]: any;
1606
+ };
1607
+ name: string;
1608
+ }
1609
+ declare class IngestHandler {
1610
+ protected event: SQSEvent | SNSEvent | APIGatewayEvent | S3Event;
1611
+ protected log: ReturnType<typeof _default$2>;
1612
+ protected sqsReceiptHandle: string | undefined;
1613
+ constructor(event: any);
1614
+ isSQSEvent(event: any): event is SQSEvent;
1615
+ isSNSEvent(event: any): event is SNSEvent;
1616
+ isAPIGatewayEvent(event: any): event is APIGatewayEvent;
1617
+ isS3Event(event: any): event is S3Event;
1618
+ isStepFunction(event: any): event is StepFunctionEvent;
1619
+ handleEvent(): Promise<ETNEvent>;
1620
+ handleSQSEvent(eventType?: ETNEvent['eventType']): Promise<ETNEvent>;
1621
+ handleSNSEvent(eventType?: ETNEvent['eventType']): Promise<ETNEvent>;
1622
+ handleAPIGatewayEvent(): ETNEvent;
1623
+ handleS3Event(eventType?: ETNEvent['eventType']): Promise<ETNEvent>;
1624
+ handleStepFunctionEvent(eventType?: ETNEvent['eventType']): Promise<ETNEvent>;
1625
+ getS3ObjectMetadata(bucket: string, key: string): Promise<Record<string, string>>;
1626
+ deleteMessage(queueUrl?: string | undefined): Promise<void>;
1627
+ }
1628
+
1629
+ type index$1_IngestHandler = IngestHandler;
1630
+ declare const index$1_IngestHandler: typeof IngestHandler;
1598
1631
  declare const index$1_automationServices: typeof automationServices;
1599
1632
  declare const index$1_automationSources: typeof automationSources;
1600
1633
  declare const index$1_getMeterPointNumberBottomLine: typeof getMeterPointNumberBottomLine;
1601
1634
  declare const index$1_utilityTypes: typeof utilityTypes;
1602
1635
  declare const index$1_wasteCategories: typeof wasteCategories;
1603
1636
  declare namespace index$1 {
1604
- export { index$1_automationServices as automationServices, index$1_automationSources as automationSources, index$1_getMeterPointNumberBottomLine as getMeterPointNumberBottomLine, units$1 as units, index$1_utilityTypes as utilityTypes, index$1_wasteCategories as wasteCategories };
1637
+ export { index$1_IngestHandler as IngestHandler, index$1_automationServices as automationServices, index$1_automationSources as automationSources, index$1_getMeterPointNumberBottomLine as getMeterPointNumberBottomLine, units$1 as units, index$1_utilityTypes as utilityTypes, index$1_wasteCategories as wasteCategories };
1605
1638
  }
1606
1639
 
1607
1640
  interface ETNModel {