@etainabl/nodejs-sdk 1.3.147 → 1.3.148
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 +97 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.cts +30 -11
- package/dist/index.d.ts +30 -11
- package/dist/index.js +98 -8
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
package/dist/index.d.cts
CHANGED
|
@@ -7,6 +7,7 @@ import { S3Client } from '@aws-sdk/client-s3';
|
|
|
7
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
|
+
import { Logtail } from '@logtail/node';
|
|
10
11
|
import moment from 'moment';
|
|
11
12
|
import { ZodObject } from 'zod';
|
|
12
13
|
import OpenAI from 'openai';
|
|
@@ -277,8 +278,9 @@ interface Item {
|
|
|
277
278
|
value: number;
|
|
278
279
|
[key: string]: any;
|
|
279
280
|
}
|
|
281
|
+
declare const unitTypes: readonly ["kwh", "kg", "m3", "lbs", "tonnes", "wh", "mwh", "ft3", "hcf", "m3/h", "qty", "l", "C", "mcuf", "hcuf", "tcuf", "ocuf", "hm3", "tm3", "nm3", "%", "lux", "ppm", "db", "hpa", "ppb", "count"];
|
|
280
282
|
type AccountType = UtilityType;
|
|
281
|
-
type ETNUnit =
|
|
283
|
+
type ETNUnit = typeof unitTypes[number];
|
|
282
284
|
type BaseUnit = 'kwh' | 'm3' | 'C' | 'kg' | 'm3/h' | 'l' | 'ppm' | 'lux' | 'db' | 'hpa' | 'ppb' | 'count' | '%';
|
|
283
285
|
declare const accountTypeMap: {
|
|
284
286
|
[key: string]: BaseUnit;
|
|
@@ -290,7 +292,7 @@ declare const convertItems: (items: Item[], type: AccountType, defaultUnits: ETN
|
|
|
290
292
|
declare const simpleConvert: (value: number, fromUnit: string, toUnit: string) => number;
|
|
291
293
|
declare const checkAccountTypeVsUnits: (type: string, unit: string, additionalLog?: number | "") => {
|
|
292
294
|
type: AccountType;
|
|
293
|
-
unit:
|
|
295
|
+
unit: "lux" | "kwh" | "m3" | "hcf" | "ft3" | "mcuf" | "hcuf" | "tcuf" | "ocuf" | "hm3" | "tm3" | "nm3" | "kg" | "tonnes" | "lbs" | "wh" | "mwh" | "qty" | "l" | "m3/h" | "C" | "%" | "ppm" | "db" | "hpa" | "ppb" | "count";
|
|
294
296
|
};
|
|
295
297
|
|
|
296
298
|
type units_AccountType = AccountType;
|
|
@@ -301,8 +303,9 @@ declare const units_accountTypeUnitMap: typeof accountTypeUnitMap;
|
|
|
301
303
|
declare const units_checkAccountTypeVsUnits: typeof checkAccountTypeVsUnits;
|
|
302
304
|
declare const units_convertItems: typeof convertItems;
|
|
303
305
|
declare const units_simpleConvert: typeof simpleConvert;
|
|
306
|
+
declare const units_unitTypes: typeof unitTypes;
|
|
304
307
|
declare namespace units {
|
|
305
|
-
export { type units_AccountType as AccountType, type units_BaseUnit as BaseUnit, type units_ETNUnit as ETNUnit, units_accountTypeMap as accountTypeMap, units_accountTypeUnitMap as accountTypeUnitMap, units_checkAccountTypeVsUnits as checkAccountTypeVsUnits, units_convertItems as convertItems, units_simpleConvert as simpleConvert };
|
|
308
|
+
export { type units_AccountType as AccountType, type units_BaseUnit as BaseUnit, type units_ETNUnit as ETNUnit, units_accountTypeMap as accountTypeMap, units_accountTypeUnitMap as accountTypeUnitMap, units_checkAccountTypeVsUnits as checkAccountTypeVsUnits, units_convertItems as convertItems, units_simpleConvert as simpleConvert, units_unitTypes as unitTypes };
|
|
306
309
|
}
|
|
307
310
|
|
|
308
311
|
interface Portal {
|
|
@@ -617,7 +620,14 @@ interface HandleErrorParams {
|
|
|
617
620
|
automation: Automation<string>;
|
|
618
621
|
}
|
|
619
622
|
declare const collectionTypes: readonly ["readings", "consumptions", "invoices"];
|
|
620
|
-
declare const errorCodes:
|
|
623
|
+
declare const errorCodes: ProblemCodes[];
|
|
624
|
+
type ErrorMap = Record<ProblemCodes, {
|
|
625
|
+
status: 'error' | 'warning';
|
|
626
|
+
message: string;
|
|
627
|
+
unique?: boolean;
|
|
628
|
+
isUnique?: (params: Problem, problems: Problem[]) => boolean;
|
|
629
|
+
}>;
|
|
630
|
+
declare const errorCodeMap: ErrorMap;
|
|
621
631
|
declare const dataFetchersIds: AutomationService[];
|
|
622
632
|
type CollectionType = 'readings' | 'consumptions' | 'invoices';
|
|
623
633
|
interface UploadCsv {
|
|
@@ -641,12 +651,13 @@ declare const integrations_collectionTypes: typeof collectionTypes;
|
|
|
641
651
|
declare const integrations_createCsv: typeof createCsv;
|
|
642
652
|
declare const integrations_dataFetchersIds: typeof dataFetchersIds;
|
|
643
653
|
declare const integrations_deleteMessage: typeof deleteMessage;
|
|
654
|
+
declare const integrations_errorCodeMap: typeof errorCodeMap;
|
|
644
655
|
declare const integrations_errorCodes: typeof errorCodes;
|
|
645
656
|
declare const integrations_handleError: typeof handleError;
|
|
646
657
|
declare const integrations_sendEmail: typeof sendEmail;
|
|
647
658
|
declare const integrations_uploadCsv: typeof uploadCsv;
|
|
648
659
|
declare namespace integrations {
|
|
649
|
-
export { type integrations_CollectionType as CollectionType, type integrations_FormattedConsumption as FormattedConsumption, type integrations_FormattedInvoice as FormattedInvoice, type integrations_FormattedReading as FormattedReading, integrations_collectionTypes as collectionTypes, integrations_createCsv as createCsv, integrations_dataFetchersIds as dataFetchersIds, integrations_deleteMessage as deleteMessage, integrations_errorCodes as errorCodes, integrations_handleError as handleError, integrations_sendEmail as sendEmail, integrations_uploadCsv as uploadCsv };
|
|
660
|
+
export { type integrations_CollectionType as CollectionType, type integrations_FormattedConsumption as FormattedConsumption, type integrations_FormattedInvoice as FormattedInvoice, type integrations_FormattedReading as FormattedReading, integrations_collectionTypes as collectionTypes, integrations_createCsv as createCsv, integrations_dataFetchersIds as dataFetchersIds, integrations_deleteMessage as deleteMessage, integrations_errorCodeMap as errorCodeMap, integrations_errorCodes as errorCodes, integrations_handleError as handleError, integrations_sendEmail as sendEmail, integrations_uploadCsv as uploadCsv };
|
|
650
661
|
}
|
|
651
662
|
|
|
652
663
|
interface AutomationRunLog<DateType = Date | string> {
|
|
@@ -1446,11 +1457,11 @@ declare const _default$4: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
|
|
|
1446
1457
|
getCompanyInvoiceValidationRules: (id: string, options?: AxiosRequestConfig) => Promise<CompanyInvoiceValidationRule<string>[]>;
|
|
1447
1458
|
listCompanies: <P = Company<string>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
|
|
1448
1459
|
updateCompany: (id: string, data: any, options?: AxiosRequestConfig) => Promise<Company<string>>;
|
|
1449
|
-
getConsumption: (id: string, options?: AxiosRequestConfig) => Promise<
|
|
1450
|
-
listConsumptions: <P =
|
|
1451
|
-
updateConsumption: (id: string, data: any, options?: AxiosRequestConfig) => Promise<
|
|
1452
|
-
createConsumption: (data: any, options?: AxiosRequestConfig) => Promise<
|
|
1453
|
-
removeConsumption: (id: string, options?: AxiosRequestConfig) => Promise<
|
|
1460
|
+
getConsumption: (id: string, options?: AxiosRequestConfig) => Promise<Consumption<string, Date>>;
|
|
1461
|
+
listConsumptions: <P = Consumption<string, Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
|
|
1462
|
+
updateConsumption: (id: string, data: any, options?: AxiosRequestConfig) => Promise<Consumption<string, Date>>;
|
|
1463
|
+
createConsumption: (data: any, options?: AxiosRequestConfig) => Promise<Consumption<string, Date>>;
|
|
1464
|
+
removeConsumption: (id: string, options?: AxiosRequestConfig) => Promise<Consumption<string, Date>>;
|
|
1454
1465
|
getConsumptionSchema: (options?: AxiosRequestConfig) => Promise<any>;
|
|
1455
1466
|
getEmail: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
1456
1467
|
listEmails: <P = any>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
|
|
@@ -1559,7 +1570,15 @@ interface EmailTemplateOptions {
|
|
|
1559
1570
|
}
|
|
1560
1571
|
declare const _default$3: (options: EmailTemplateOptions) => string;
|
|
1561
1572
|
|
|
1562
|
-
|
|
1573
|
+
interface LoggerOptions {
|
|
1574
|
+
betterstack: boolean;
|
|
1575
|
+
betterStackToken: string;
|
|
1576
|
+
betterStackHost: string;
|
|
1577
|
+
}
|
|
1578
|
+
interface ExtendedLogger extends winston.Logger {
|
|
1579
|
+
logtail?: Logtail;
|
|
1580
|
+
}
|
|
1581
|
+
declare const _default$2: (namespace: string, betterStackOptions?: LoggerOptions) => ExtendedLogger;
|
|
1563
1582
|
|
|
1564
1583
|
declare function connectToDatabase(retryAttempt?: number): Promise<Db>;
|
|
1565
1584
|
declare const _default$1: {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { S3Client } from '@aws-sdk/client-s3';
|
|
|
7
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
|
+
import { Logtail } from '@logtail/node';
|
|
10
11
|
import moment from 'moment';
|
|
11
12
|
import { ZodObject } from 'zod';
|
|
12
13
|
import OpenAI from 'openai';
|
|
@@ -277,8 +278,9 @@ interface Item {
|
|
|
277
278
|
value: number;
|
|
278
279
|
[key: string]: any;
|
|
279
280
|
}
|
|
281
|
+
declare const unitTypes: readonly ["kwh", "kg", "m3", "lbs", "tonnes", "wh", "mwh", "ft3", "hcf", "m3/h", "qty", "l", "C", "mcuf", "hcuf", "tcuf", "ocuf", "hm3", "tm3", "nm3", "%", "lux", "ppm", "db", "hpa", "ppb", "count"];
|
|
280
282
|
type AccountType = UtilityType;
|
|
281
|
-
type ETNUnit =
|
|
283
|
+
type ETNUnit = typeof unitTypes[number];
|
|
282
284
|
type BaseUnit = 'kwh' | 'm3' | 'C' | 'kg' | 'm3/h' | 'l' | 'ppm' | 'lux' | 'db' | 'hpa' | 'ppb' | 'count' | '%';
|
|
283
285
|
declare const accountTypeMap: {
|
|
284
286
|
[key: string]: BaseUnit;
|
|
@@ -290,7 +292,7 @@ declare const convertItems: (items: Item[], type: AccountType, defaultUnits: ETN
|
|
|
290
292
|
declare const simpleConvert: (value: number, fromUnit: string, toUnit: string) => number;
|
|
291
293
|
declare const checkAccountTypeVsUnits: (type: string, unit: string, additionalLog?: number | "") => {
|
|
292
294
|
type: AccountType;
|
|
293
|
-
unit:
|
|
295
|
+
unit: "lux" | "kwh" | "m3" | "hcf" | "ft3" | "mcuf" | "hcuf" | "tcuf" | "ocuf" | "hm3" | "tm3" | "nm3" | "kg" | "tonnes" | "lbs" | "wh" | "mwh" | "qty" | "l" | "m3/h" | "C" | "%" | "ppm" | "db" | "hpa" | "ppb" | "count";
|
|
294
296
|
};
|
|
295
297
|
|
|
296
298
|
type units_AccountType = AccountType;
|
|
@@ -301,8 +303,9 @@ declare const units_accountTypeUnitMap: typeof accountTypeUnitMap;
|
|
|
301
303
|
declare const units_checkAccountTypeVsUnits: typeof checkAccountTypeVsUnits;
|
|
302
304
|
declare const units_convertItems: typeof convertItems;
|
|
303
305
|
declare const units_simpleConvert: typeof simpleConvert;
|
|
306
|
+
declare const units_unitTypes: typeof unitTypes;
|
|
304
307
|
declare namespace units {
|
|
305
|
-
export { type units_AccountType as AccountType, type units_BaseUnit as BaseUnit, type units_ETNUnit as ETNUnit, units_accountTypeMap as accountTypeMap, units_accountTypeUnitMap as accountTypeUnitMap, units_checkAccountTypeVsUnits as checkAccountTypeVsUnits, units_convertItems as convertItems, units_simpleConvert as simpleConvert };
|
|
308
|
+
export { type units_AccountType as AccountType, type units_BaseUnit as BaseUnit, type units_ETNUnit as ETNUnit, units_accountTypeMap as accountTypeMap, units_accountTypeUnitMap as accountTypeUnitMap, units_checkAccountTypeVsUnits as checkAccountTypeVsUnits, units_convertItems as convertItems, units_simpleConvert as simpleConvert, units_unitTypes as unitTypes };
|
|
306
309
|
}
|
|
307
310
|
|
|
308
311
|
interface Portal {
|
|
@@ -617,7 +620,14 @@ interface HandleErrorParams {
|
|
|
617
620
|
automation: Automation<string>;
|
|
618
621
|
}
|
|
619
622
|
declare const collectionTypes: readonly ["readings", "consumptions", "invoices"];
|
|
620
|
-
declare const errorCodes:
|
|
623
|
+
declare const errorCodes: ProblemCodes[];
|
|
624
|
+
type ErrorMap = Record<ProblemCodes, {
|
|
625
|
+
status: 'error' | 'warning';
|
|
626
|
+
message: string;
|
|
627
|
+
unique?: boolean;
|
|
628
|
+
isUnique?: (params: Problem, problems: Problem[]) => boolean;
|
|
629
|
+
}>;
|
|
630
|
+
declare const errorCodeMap: ErrorMap;
|
|
621
631
|
declare const dataFetchersIds: AutomationService[];
|
|
622
632
|
type CollectionType = 'readings' | 'consumptions' | 'invoices';
|
|
623
633
|
interface UploadCsv {
|
|
@@ -641,12 +651,13 @@ declare const integrations_collectionTypes: typeof collectionTypes;
|
|
|
641
651
|
declare const integrations_createCsv: typeof createCsv;
|
|
642
652
|
declare const integrations_dataFetchersIds: typeof dataFetchersIds;
|
|
643
653
|
declare const integrations_deleteMessage: typeof deleteMessage;
|
|
654
|
+
declare const integrations_errorCodeMap: typeof errorCodeMap;
|
|
644
655
|
declare const integrations_errorCodes: typeof errorCodes;
|
|
645
656
|
declare const integrations_handleError: typeof handleError;
|
|
646
657
|
declare const integrations_sendEmail: typeof sendEmail;
|
|
647
658
|
declare const integrations_uploadCsv: typeof uploadCsv;
|
|
648
659
|
declare namespace integrations {
|
|
649
|
-
export { type integrations_CollectionType as CollectionType, type integrations_FormattedConsumption as FormattedConsumption, type integrations_FormattedInvoice as FormattedInvoice, type integrations_FormattedReading as FormattedReading, integrations_collectionTypes as collectionTypes, integrations_createCsv as createCsv, integrations_dataFetchersIds as dataFetchersIds, integrations_deleteMessage as deleteMessage, integrations_errorCodes as errorCodes, integrations_handleError as handleError, integrations_sendEmail as sendEmail, integrations_uploadCsv as uploadCsv };
|
|
660
|
+
export { type integrations_CollectionType as CollectionType, type integrations_FormattedConsumption as FormattedConsumption, type integrations_FormattedInvoice as FormattedInvoice, type integrations_FormattedReading as FormattedReading, integrations_collectionTypes as collectionTypes, integrations_createCsv as createCsv, integrations_dataFetchersIds as dataFetchersIds, integrations_deleteMessage as deleteMessage, integrations_errorCodeMap as errorCodeMap, integrations_errorCodes as errorCodes, integrations_handleError as handleError, integrations_sendEmail as sendEmail, integrations_uploadCsv as uploadCsv };
|
|
650
661
|
}
|
|
651
662
|
|
|
652
663
|
interface AutomationRunLog<DateType = Date | string> {
|
|
@@ -1446,11 +1457,11 @@ declare const _default$4: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
|
|
|
1446
1457
|
getCompanyInvoiceValidationRules: (id: string, options?: AxiosRequestConfig) => Promise<CompanyInvoiceValidationRule<string>[]>;
|
|
1447
1458
|
listCompanies: <P = Company<string>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
|
|
1448
1459
|
updateCompany: (id: string, data: any, options?: AxiosRequestConfig) => Promise<Company<string>>;
|
|
1449
|
-
getConsumption: (id: string, options?: AxiosRequestConfig) => Promise<
|
|
1450
|
-
listConsumptions: <P =
|
|
1451
|
-
updateConsumption: (id: string, data: any, options?: AxiosRequestConfig) => Promise<
|
|
1452
|
-
createConsumption: (data: any, options?: AxiosRequestConfig) => Promise<
|
|
1453
|
-
removeConsumption: (id: string, options?: AxiosRequestConfig) => Promise<
|
|
1460
|
+
getConsumption: (id: string, options?: AxiosRequestConfig) => Promise<Consumption<string, Date>>;
|
|
1461
|
+
listConsumptions: <P = Consumption<string, Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
|
|
1462
|
+
updateConsumption: (id: string, data: any, options?: AxiosRequestConfig) => Promise<Consumption<string, Date>>;
|
|
1463
|
+
createConsumption: (data: any, options?: AxiosRequestConfig) => Promise<Consumption<string, Date>>;
|
|
1464
|
+
removeConsumption: (id: string, options?: AxiosRequestConfig) => Promise<Consumption<string, Date>>;
|
|
1454
1465
|
getConsumptionSchema: (options?: AxiosRequestConfig) => Promise<any>;
|
|
1455
1466
|
getEmail: (id: string, options?: AxiosRequestConfig) => Promise<any>;
|
|
1456
1467
|
listEmails: <P = any>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
|
|
@@ -1559,7 +1570,15 @@ interface EmailTemplateOptions {
|
|
|
1559
1570
|
}
|
|
1560
1571
|
declare const _default$3: (options: EmailTemplateOptions) => string;
|
|
1561
1572
|
|
|
1562
|
-
|
|
1573
|
+
interface LoggerOptions {
|
|
1574
|
+
betterstack: boolean;
|
|
1575
|
+
betterStackToken: string;
|
|
1576
|
+
betterStackHost: string;
|
|
1577
|
+
}
|
|
1578
|
+
interface ExtendedLogger extends winston.Logger {
|
|
1579
|
+
logtail?: Logtail;
|
|
1580
|
+
}
|
|
1581
|
+
declare const _default$2: (namespace: string, betterStackOptions?: LoggerOptions) => ExtendedLogger;
|
|
1563
1582
|
|
|
1564
1583
|
declare function connectToDatabase(retryAttempt?: number): Promise<Db>;
|
|
1565
1584
|
declare const _default$1: {
|
package/dist/index.js
CHANGED
|
@@ -16213,6 +16213,8 @@ var import_https = __toESM(require("https"), 1);
|
|
|
16213
16213
|
|
|
16214
16214
|
// src/logger.ts
|
|
16215
16215
|
var import_winston = __toESM(require("winston"), 1);
|
|
16216
|
+
var import_node = require("@logtail/node");
|
|
16217
|
+
var import_winston2 = require("@logtail/winston");
|
|
16216
16218
|
var localFormat = import_winston.default.format.combine(
|
|
16217
16219
|
import_winston.default.format.timestamp({ format: "HH:mm:ss" }),
|
|
16218
16220
|
import_winston.default.format.colorize(),
|
|
@@ -16223,12 +16225,24 @@ var localFormat = import_winston.default.format.combine(
|
|
|
16223
16225
|
return `${timestamp} ${level} ${namespace} ${message}${metaStr}`;
|
|
16224
16226
|
})
|
|
16225
16227
|
);
|
|
16226
|
-
var logger_default = (namespace) =>
|
|
16227
|
-
|
|
16228
|
-
|
|
16229
|
-
|
|
16230
|
-
|
|
16231
|
-
|
|
16228
|
+
var logger_default = (namespace, betterStackOptions) => {
|
|
16229
|
+
const transports = [new import_winston.default.transports.Console()];
|
|
16230
|
+
let logtail;
|
|
16231
|
+
if (betterStackOptions?.betterstack && betterStackOptions?.betterStackToken && betterStackOptions?.betterStackHost) {
|
|
16232
|
+
logtail = new import_node.Logtail(betterStackOptions.betterStackToken, {
|
|
16233
|
+
endpoint: betterStackOptions.betterStackHost
|
|
16234
|
+
});
|
|
16235
|
+
transports.push(new import_winston2.LogtailTransport(logtail));
|
|
16236
|
+
}
|
|
16237
|
+
const logger2 = import_winston.default.createLogger({
|
|
16238
|
+
level: "debug",
|
|
16239
|
+
format: process.env.ENV === "local" ? localFormat : import_winston.default.format.combine(import_winston.default.format.timestamp(), import_winston.default.format.json()),
|
|
16240
|
+
defaultMeta: { service: process.env.AWS_LAMBDA_FUNCTION_NAME, script: namespace },
|
|
16241
|
+
transports
|
|
16242
|
+
});
|
|
16243
|
+
logger2.logtail = logtail;
|
|
16244
|
+
return logger2;
|
|
16245
|
+
};
|
|
16232
16246
|
|
|
16233
16247
|
// src/api.ts
|
|
16234
16248
|
var log = logger_default("etainablApi");
|
|
@@ -16845,8 +16859,38 @@ __export(units_exports, {
|
|
|
16845
16859
|
accountTypeUnitMap: () => accountTypeUnitMap,
|
|
16846
16860
|
checkAccountTypeVsUnits: () => checkAccountTypeVsUnits,
|
|
16847
16861
|
convertItems: () => convertItems,
|
|
16848
|
-
simpleConvert: () => simpleConvert
|
|
16849
|
-
|
|
16862
|
+
simpleConvert: () => simpleConvert,
|
|
16863
|
+
unitTypes: () => unitTypes
|
|
16864
|
+
});
|
|
16865
|
+
var unitTypes = [
|
|
16866
|
+
"kwh",
|
|
16867
|
+
"kg",
|
|
16868
|
+
"m3",
|
|
16869
|
+
"lbs",
|
|
16870
|
+
"tonnes",
|
|
16871
|
+
"wh",
|
|
16872
|
+
"mwh",
|
|
16873
|
+
"ft3",
|
|
16874
|
+
"hcf",
|
|
16875
|
+
"m3/h",
|
|
16876
|
+
"qty",
|
|
16877
|
+
"l",
|
|
16878
|
+
"C",
|
|
16879
|
+
"mcuf",
|
|
16880
|
+
"hcuf",
|
|
16881
|
+
"tcuf",
|
|
16882
|
+
"ocuf",
|
|
16883
|
+
"hm3",
|
|
16884
|
+
"tm3",
|
|
16885
|
+
"nm3",
|
|
16886
|
+
"%",
|
|
16887
|
+
"lux",
|
|
16888
|
+
"ppm",
|
|
16889
|
+
"db",
|
|
16890
|
+
"hpa",
|
|
16891
|
+
"ppb",
|
|
16892
|
+
"count"
|
|
16893
|
+
];
|
|
16850
16894
|
var accountTypeMap = {
|
|
16851
16895
|
electricity: "kwh",
|
|
16852
16896
|
gas: "kwh",
|
|
@@ -23438,6 +23482,7 @@ __export(integrations_exports, {
|
|
|
23438
23482
|
createCsv: () => createCsv,
|
|
23439
23483
|
dataFetchersIds: () => dataFetchersIds,
|
|
23440
23484
|
deleteMessage: () => deleteMessage,
|
|
23485
|
+
errorCodeMap: () => errorCodeMap,
|
|
23441
23486
|
errorCodes: () => errorCodes,
|
|
23442
23487
|
handleError: () => handleError,
|
|
23443
23488
|
sendEmail: () => sendEmail,
|
|
@@ -25354,6 +25399,51 @@ var errorCodes = [
|
|
|
25354
25399
|
"VALIDATION_ERROR",
|
|
25355
25400
|
"METER_READS_ZERO"
|
|
25356
25401
|
];
|
|
25402
|
+
var errorCodeMap = {
|
|
25403
|
+
ACCOUNT_NOT_FOUND: {
|
|
25404
|
+
status: "error",
|
|
25405
|
+
message: "Account not found for the provided device ID or MPAN.",
|
|
25406
|
+
isUnique: ({ details }, problems) => {
|
|
25407
|
+
return !problems.some((p7) => p7.code === "ACCOUNT_NOT_FOUND" && p7.details?.value === details?.value) || true;
|
|
25408
|
+
}
|
|
25409
|
+
},
|
|
25410
|
+
INVALID_DATE_FORMAT: {
|
|
25411
|
+
status: "error",
|
|
25412
|
+
message: "The date format in the file is invalid"
|
|
25413
|
+
},
|
|
25414
|
+
INVALID_TIME_FORMAT: {
|
|
25415
|
+
status: "error",
|
|
25416
|
+
message: "The time format in the file is invalid"
|
|
25417
|
+
},
|
|
25418
|
+
COLUMN_LIMIT_EXCEEDED: {
|
|
25419
|
+
status: "error",
|
|
25420
|
+
message: "The number of columns in the file exceeds the allowed limit.",
|
|
25421
|
+
unique: true
|
|
25422
|
+
},
|
|
25423
|
+
INVALID_TIMESTAMP: {
|
|
25424
|
+
status: "error",
|
|
25425
|
+
message: "The timestamp in the file is invalid."
|
|
25426
|
+
},
|
|
25427
|
+
MISSING_DEVICE_ID: {
|
|
25428
|
+
status: "error",
|
|
25429
|
+
message: "The device ID is missing in the file.",
|
|
25430
|
+
unique: true
|
|
25431
|
+
},
|
|
25432
|
+
UNSUPPORTED_UTILITY_TYPE: {
|
|
25433
|
+
status: "error",
|
|
25434
|
+
message: "The utility type in the file is not supported.",
|
|
25435
|
+
unique: true
|
|
25436
|
+
},
|
|
25437
|
+
VALIDATION_ERROR: {
|
|
25438
|
+
status: "error",
|
|
25439
|
+
message: "There was a validation error with the data in the file."
|
|
25440
|
+
},
|
|
25441
|
+
METER_READS_ZERO: {
|
|
25442
|
+
status: "warning",
|
|
25443
|
+
message: "Some meter reads are zero, which may indicate an issue with the data.",
|
|
25444
|
+
unique: true
|
|
25445
|
+
}
|
|
25446
|
+
};
|
|
25357
25447
|
var dataFetchersIds = ["bacnet", "solis", "solarman", "gridfetch", "smartflow", "smartvatten", "beringar", "4dmonitoring"];
|
|
25358
25448
|
function sendEmail(lambdaSource, context, error, destinations) {
|
|
25359
25449
|
const sesClient = new SESClient({ region: "eu-west-1" });
|