@etainabl/nodejs-sdk 1.3.186 → 1.3.187

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
@@ -493,8 +493,8 @@ interface CustomAlertTrigger<ID = string, DateType = Date | string, metadataType
493
493
  processedAt?: DateType;
494
494
  lastTriggeredEvent?: DateType;
495
495
  companyId: ID;
496
- userSub: string;
497
- recipientUserSubs?: string[];
496
+ userId: ID;
497
+ recipientUserIds?: ID[];
498
498
  active: boolean;
499
499
  createdAt?: DateType;
500
500
  updatedAt?: DateType;
@@ -672,7 +672,7 @@ type FormattedReading = Omit<Reading<string, string>, '_id'>;
672
672
  type FormattedInvoice = Omit<Invoice<string, string>, '_id' | 's3Key'>;
673
673
  interface HandleErrorParams {
674
674
  context: Context;
675
- etnApi: ReturnType<typeof _default$5>;
675
+ etnApi: ReturnType<typeof _default$4>;
676
676
  automationRun: AutomationRun<string>;
677
677
  lambdaSource: string;
678
678
  error: Error;
@@ -1313,12 +1313,10 @@ interface Job<ID = string, DateType = Date | string> {
1313
1313
  windowEnd?: DateType;
1314
1314
  startedAt?: DateType;
1315
1315
  completedAt?: DateType;
1316
- heartbeatAt?: DateType;
1317
1316
  expiresAt?: DateType;
1318
1317
  error?: string;
1319
1318
  metadata?: Record<string, any>;
1320
1319
  companyId?: ID;
1321
- userSub?: string;
1322
1320
  createdAt?: DateType;
1323
1321
  updatedAt?: DateType;
1324
1322
  deleted?: boolean;
@@ -1369,7 +1367,7 @@ interface Notification<ID = string, DateType = Date | string> {
1369
1367
  notificationTemplateId: ID;
1370
1368
  scheduledAt?: DateType;
1371
1369
  scheduledBy?: string;
1372
- userSub: string;
1370
+ userId: ID;
1373
1371
  toastHasShown?: boolean;
1374
1372
  message?: string;
1375
1373
  status: string;
@@ -1538,14 +1536,14 @@ interface NotificationSQSMessage<E extends NotificationContextEventName = Notifi
1538
1536
  eventName: E;
1539
1537
  timestamp: string;
1540
1538
  companyId: string;
1541
- userSub: string;
1539
+ userId: string;
1542
1540
  alertTriggerId?: string;
1543
1541
  notificationTemplateId?: string;
1544
1542
  context: NotificationContextMap[E];
1545
1543
  }
1546
1544
  interface SendNotificationMessageInput {
1547
1545
  companyId: string;
1548
- userSub: string;
1546
+ userId: string;
1549
1547
  alertTriggerId?: string;
1550
1548
  timestamp?: string;
1551
1549
  notificationTemplateId?: string;
@@ -1803,7 +1801,7 @@ interface AuthOptions {
1803
1801
  token?: string;
1804
1802
  userOnly?: boolean;
1805
1803
  }
1806
- declare const _default$5: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
1804
+ declare const _default$4: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
1807
1805
  instance: AxiosInstance;
1808
1806
  getAccount: (id: string, options?: AxiosRequestConfig) => Promise<Account<string>>;
1809
1807
  listAccounts: <P = Account<string>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
@@ -1980,7 +1978,7 @@ interface EmailTemplateOptions {
1980
1978
  footer?: string;
1981
1979
  includeTimestamp?: boolean;
1982
1980
  }
1983
- declare const _default$4: (options: EmailTemplateOptions) => string;
1981
+ declare const _default$3: (options: EmailTemplateOptions) => string;
1984
1982
 
1985
1983
  interface NotificationEmailOptions {
1986
1984
  title: string;
@@ -1998,18 +1996,18 @@ interface NotificationEmailOptions {
1998
1996
  }>;
1999
1997
  }
2000
1998
  declare function generateNotificationEmail(options: NotificationEmailOptions): string;
2001
- declare const _default$3: {
1999
+ declare const _default$2: {
2002
2000
  generateNotificationEmail: typeof generateNotificationEmail;
2003
2001
  };
2004
2002
 
2005
- interface LoggerOptions {
2006
- betterstack: boolean;
2007
- betterStackHost: string;
2008
- }
2009
2003
  interface ExtendedLogger extends winston.Logger {
2010
2004
  logtail?: Logtail;
2011
2005
  }
2012
- declare const _default$2: (namespace: string, betterStackOptions?: LoggerOptions) => ExtendedLogger;
2006
+ interface LoggerOptions {
2007
+ feature?: string;
2008
+ }
2009
+ declare function logger(namespace: string, options?: LoggerOptions): ExtendedLogger;
2010
+ declare function loggerWithBetterStack(namespace: string, options?: LoggerOptions): Promise<ExtendedLogger>;
2013
2011
 
2014
2012
  declare function connectToDatabase(retryAttempt?: number): Promise<Db>;
2015
2013
  declare const _default$1: {
@@ -2020,10 +2018,6 @@ declare const _default: {
2020
2018
  postMessage: (message: string) => Promise<axios.AxiosResponse<any, any>>;
2021
2019
  };
2022
2020
 
2023
- declare namespace notification {
2024
- export { };
2025
- }
2026
-
2027
2021
  interface SendNotificationMessageOptions {
2028
2022
  queueUrl?: string;
2029
2023
  sqsClient?: SQSClient;
@@ -2100,7 +2094,7 @@ declare const automationServices: {
2100
2094
  }[];
2101
2095
 
2102
2096
  declare function updateBatchJobStatus({ etnApi, automationRun, accountKey, status, errorMessage }: {
2103
- etnApi: ReturnType<typeof _default$5>;
2097
+ etnApi: ReturnType<typeof _default$4>;
2104
2098
  automationRun: AutomationRun<string>;
2105
2099
  accountKey?: string;
2106
2100
  status: 'completed' | 'failed';
@@ -2118,7 +2112,7 @@ interface StepFunctionEvent {
2118
2112
  }
2119
2113
  declare class IngestHandler {
2120
2114
  protected event: SQSEvent | SNSEvent | APIGatewayEvent | S3Event;
2121
- protected log: ReturnType<typeof _default$2>;
2115
+ protected log: ReturnType<typeof logger>;
2122
2116
  protected sqsReceiptHandle: string | undefined;
2123
2117
  constructor(event: any);
2124
2118
  isSQSEvent(event: any): event is SQSEvent;
@@ -2284,7 +2278,7 @@ type ETNModels = keyof typeof models;
2284
2278
  declare abstract class Model {
2285
2279
  openai: OpenAI;
2286
2280
  protected models: Record<ETNModels, ETNModel>;
2287
- protected log: ReturnType<typeof _default$2>;
2281
+ protected log: ReturnType<typeof logger>;
2288
2282
  constructor();
2289
2283
  }
2290
2284
 
@@ -2340,4 +2334,4 @@ declare namespace scrapers {
2340
2334
  export type { scrapers_ETNAccount as ETNAccount };
2341
2335
  }
2342
2336
 
2343
- export { type AccessLevel, type Account, type AccountResult, type Action, type ActionType, type Asset, type Automation, type AutomationRun, type AutomationRunLog, type AutomationRunSummary, type AutomationService, type AutomationServiceCategory, type AutomationSource, type Company, type CompanyInvoiceValidationRule, type CompanyInvoiceValidationSettings, type Consumption, type CreateScraperRunParams, type CustomAlertTrigger, type CustomAlertTriggerQueueMessage, type DataIngest, type DefaultField, type DeliveryStatus, type ETNEvent, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, EventNamesByCategory, type FileFormat, type ImportTemplate, type Invoice, type InvoiceCapture, type InvoiceCaptureMetadata, type InvoiceCaptureMetadataResult, type InvoiceRate, type InvoiceRateType, type InvoiceValidation, type InvoiceValidationInvoice, type InvoiceValidationResults, type InvoiceValidationRule, type InvoiceValues, type Job, type JobStatus, type Log, type Notification, type NotificationAction, type NotificationCategory, NotificationCategoryList, type NotificationCategoryPreferences, type NotificationChannels, type NotificationContext, type NotificationContextEventName, type NotificationContextMap, NotificationDefaultChannels, type NotificationEventName, type NotificationPreferences, type NotificationSQSMessage, type NotificationTemplate, type NotificationTemplateConfig, type NotificationTemplateConfigOption, type NotificationTemplateConfigType, type NotificationTemplateDefaultChannel, type NotificationTemplateRoute, type NotificationTemplateSeverity, type NotificationTemplatesMap, type Portal, type PortalSupplierSchema, type Problem, type ProblemCodes, type ProblemDetails, type Reading, type Report, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ReportTemplate, type ReportType, type ScraperRun, type SendNotificationMessageInput, type Setting, type SourceType, type Supplier, type User, type UtilityType, type WasteCategories, type WasteTypes, _default$5 as api, consumption, _default$1 as db, _default$4 as emailTemplate, integrations, _default$2 as logger, monitoring, notification, _default$3 as notificationEmailTemplate, notificationQueue, index as openai, reporting, scrapers, _default as slack, units, index$1 as utils };
2337
+ export { type AccessLevel, type Account, type AccountResult, type Action, type ActionType, type Asset, type Automation, type AutomationRun, type AutomationRunLog, type AutomationRunSummary, type AutomationService, type AutomationServiceCategory, type AutomationSource, type Company, type CompanyInvoiceValidationRule, type CompanyInvoiceValidationSettings, type Consumption, type CreateScraperRunParams, type CustomAlertTrigger, type CustomAlertTriggerQueueMessage, type DataIngest, type DefaultField, type DeliveryStatus, type ETNEvent, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, EventNamesByCategory, type FileFormat, type ImportTemplate, type Invoice, type InvoiceCapture, type InvoiceCaptureMetadata, type InvoiceCaptureMetadataResult, type InvoiceRate, type InvoiceRateType, type InvoiceValidation, type InvoiceValidationInvoice, type InvoiceValidationResults, type InvoiceValidationRule, type InvoiceValues, type Job, type JobStatus, type Log, type Notification, type NotificationAction, type NotificationCategory, NotificationCategoryList, type NotificationCategoryPreferences, type NotificationChannels, type NotificationContext, type NotificationContextEventName, type NotificationContextMap, NotificationDefaultChannels, type NotificationEventName, type NotificationPreferences, type NotificationSQSMessage, type NotificationTemplate, type NotificationTemplateConfig, type NotificationTemplateConfigOption, type NotificationTemplateConfigType, type NotificationTemplateDefaultChannel, type NotificationTemplateRoute, type NotificationTemplateSeverity, type NotificationTemplatesMap, type Portal, type PortalSupplierSchema, type Problem, type ProblemCodes, type ProblemDetails, type Reading, type Report, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ReportTemplate, type ReportType, type ScraperRun, type SendNotificationMessageInput, type Setting, type SourceType, type Supplier, type User, type UtilityType, type WasteCategories, type WasteTypes, _default$4 as api, consumption, _default$1 as db, _default$3 as emailTemplate, integrations, logger, loggerWithBetterStack, monitoring, _default$2 as notificationEmailTemplate, notificationQueue, index as openai, reporting, scrapers, _default as slack, units, index$1 as utils };
package/dist/index.d.ts CHANGED
@@ -493,8 +493,8 @@ interface CustomAlertTrigger<ID = string, DateType = Date | string, metadataType
493
493
  processedAt?: DateType;
494
494
  lastTriggeredEvent?: DateType;
495
495
  companyId: ID;
496
- userSub: string;
497
- recipientUserSubs?: string[];
496
+ userId: ID;
497
+ recipientUserIds?: ID[];
498
498
  active: boolean;
499
499
  createdAt?: DateType;
500
500
  updatedAt?: DateType;
@@ -672,7 +672,7 @@ type FormattedReading = Omit<Reading<string, string>, '_id'>;
672
672
  type FormattedInvoice = Omit<Invoice<string, string>, '_id' | 's3Key'>;
673
673
  interface HandleErrorParams {
674
674
  context: Context;
675
- etnApi: ReturnType<typeof _default$5>;
675
+ etnApi: ReturnType<typeof _default$4>;
676
676
  automationRun: AutomationRun<string>;
677
677
  lambdaSource: string;
678
678
  error: Error;
@@ -1313,12 +1313,10 @@ interface Job<ID = string, DateType = Date | string> {
1313
1313
  windowEnd?: DateType;
1314
1314
  startedAt?: DateType;
1315
1315
  completedAt?: DateType;
1316
- heartbeatAt?: DateType;
1317
1316
  expiresAt?: DateType;
1318
1317
  error?: string;
1319
1318
  metadata?: Record<string, any>;
1320
1319
  companyId?: ID;
1321
- userSub?: string;
1322
1320
  createdAt?: DateType;
1323
1321
  updatedAt?: DateType;
1324
1322
  deleted?: boolean;
@@ -1369,7 +1367,7 @@ interface Notification<ID = string, DateType = Date | string> {
1369
1367
  notificationTemplateId: ID;
1370
1368
  scheduledAt?: DateType;
1371
1369
  scheduledBy?: string;
1372
- userSub: string;
1370
+ userId: ID;
1373
1371
  toastHasShown?: boolean;
1374
1372
  message?: string;
1375
1373
  status: string;
@@ -1538,14 +1536,14 @@ interface NotificationSQSMessage<E extends NotificationContextEventName = Notifi
1538
1536
  eventName: E;
1539
1537
  timestamp: string;
1540
1538
  companyId: string;
1541
- userSub: string;
1539
+ userId: string;
1542
1540
  alertTriggerId?: string;
1543
1541
  notificationTemplateId?: string;
1544
1542
  context: NotificationContextMap[E];
1545
1543
  }
1546
1544
  interface SendNotificationMessageInput {
1547
1545
  companyId: string;
1548
- userSub: string;
1546
+ userId: string;
1549
1547
  alertTriggerId?: string;
1550
1548
  timestamp?: string;
1551
1549
  notificationTemplateId?: string;
@@ -1803,7 +1801,7 @@ interface AuthOptions {
1803
1801
  token?: string;
1804
1802
  userOnly?: boolean;
1805
1803
  }
1806
- declare const _default$5: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
1804
+ declare const _default$4: (auth: AuthOptions, instanceOptions?: CreateAxiosDefaults) => {
1807
1805
  instance: AxiosInstance;
1808
1806
  getAccount: (id: string, options?: AxiosRequestConfig) => Promise<Account<string>>;
1809
1807
  listAccounts: <P = Account<string>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
@@ -1980,7 +1978,7 @@ interface EmailTemplateOptions {
1980
1978
  footer?: string;
1981
1979
  includeTimestamp?: boolean;
1982
1980
  }
1983
- declare const _default$4: (options: EmailTemplateOptions) => string;
1981
+ declare const _default$3: (options: EmailTemplateOptions) => string;
1984
1982
 
1985
1983
  interface NotificationEmailOptions {
1986
1984
  title: string;
@@ -1998,18 +1996,18 @@ interface NotificationEmailOptions {
1998
1996
  }>;
1999
1997
  }
2000
1998
  declare function generateNotificationEmail(options: NotificationEmailOptions): string;
2001
- declare const _default$3: {
1999
+ declare const _default$2: {
2002
2000
  generateNotificationEmail: typeof generateNotificationEmail;
2003
2001
  };
2004
2002
 
2005
- interface LoggerOptions {
2006
- betterstack: boolean;
2007
- betterStackHost: string;
2008
- }
2009
2003
  interface ExtendedLogger extends winston.Logger {
2010
2004
  logtail?: Logtail;
2011
2005
  }
2012
- declare const _default$2: (namespace: string, betterStackOptions?: LoggerOptions) => ExtendedLogger;
2006
+ interface LoggerOptions {
2007
+ feature?: string;
2008
+ }
2009
+ declare function logger(namespace: string, options?: LoggerOptions): ExtendedLogger;
2010
+ declare function loggerWithBetterStack(namespace: string, options?: LoggerOptions): Promise<ExtendedLogger>;
2013
2011
 
2014
2012
  declare function connectToDatabase(retryAttempt?: number): Promise<Db>;
2015
2013
  declare const _default$1: {
@@ -2020,10 +2018,6 @@ declare const _default: {
2020
2018
  postMessage: (message: string) => Promise<axios.AxiosResponse<any, any>>;
2021
2019
  };
2022
2020
 
2023
- declare namespace notification {
2024
- export { };
2025
- }
2026
-
2027
2021
  interface SendNotificationMessageOptions {
2028
2022
  queueUrl?: string;
2029
2023
  sqsClient?: SQSClient;
@@ -2100,7 +2094,7 @@ declare const automationServices: {
2100
2094
  }[];
2101
2095
 
2102
2096
  declare function updateBatchJobStatus({ etnApi, automationRun, accountKey, status, errorMessage }: {
2103
- etnApi: ReturnType<typeof _default$5>;
2097
+ etnApi: ReturnType<typeof _default$4>;
2104
2098
  automationRun: AutomationRun<string>;
2105
2099
  accountKey?: string;
2106
2100
  status: 'completed' | 'failed';
@@ -2118,7 +2112,7 @@ interface StepFunctionEvent {
2118
2112
  }
2119
2113
  declare class IngestHandler {
2120
2114
  protected event: SQSEvent | SNSEvent | APIGatewayEvent | S3Event;
2121
- protected log: ReturnType<typeof _default$2>;
2115
+ protected log: ReturnType<typeof logger>;
2122
2116
  protected sqsReceiptHandle: string | undefined;
2123
2117
  constructor(event: any);
2124
2118
  isSQSEvent(event: any): event is SQSEvent;
@@ -2284,7 +2278,7 @@ type ETNModels = keyof typeof models;
2284
2278
  declare abstract class Model {
2285
2279
  openai: OpenAI;
2286
2280
  protected models: Record<ETNModels, ETNModel>;
2287
- protected log: ReturnType<typeof _default$2>;
2281
+ protected log: ReturnType<typeof logger>;
2288
2282
  constructor();
2289
2283
  }
2290
2284
 
@@ -2340,4 +2334,4 @@ declare namespace scrapers {
2340
2334
  export type { scrapers_ETNAccount as ETNAccount };
2341
2335
  }
2342
2336
 
2343
- export { type AccessLevel, type Account, type AccountResult, type Action, type ActionType, type Asset, type Automation, type AutomationRun, type AutomationRunLog, type AutomationRunSummary, type AutomationService, type AutomationServiceCategory, type AutomationSource, type Company, type CompanyInvoiceValidationRule, type CompanyInvoiceValidationSettings, type Consumption, type CreateScraperRunParams, type CustomAlertTrigger, type CustomAlertTriggerQueueMessage, type DataIngest, type DefaultField, type DeliveryStatus, type ETNEvent, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, EventNamesByCategory, type FileFormat, type ImportTemplate, type Invoice, type InvoiceCapture, type InvoiceCaptureMetadata, type InvoiceCaptureMetadataResult, type InvoiceRate, type InvoiceRateType, type InvoiceValidation, type InvoiceValidationInvoice, type InvoiceValidationResults, type InvoiceValidationRule, type InvoiceValues, type Job, type JobStatus, type Log, type Notification, type NotificationAction, type NotificationCategory, NotificationCategoryList, type NotificationCategoryPreferences, type NotificationChannels, type NotificationContext, type NotificationContextEventName, type NotificationContextMap, NotificationDefaultChannels, type NotificationEventName, type NotificationPreferences, type NotificationSQSMessage, type NotificationTemplate, type NotificationTemplateConfig, type NotificationTemplateConfigOption, type NotificationTemplateConfigType, type NotificationTemplateDefaultChannel, type NotificationTemplateRoute, type NotificationTemplateSeverity, type NotificationTemplatesMap, type Portal, type PortalSupplierSchema, type Problem, type ProblemCodes, type ProblemDetails, type Reading, type Report, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ReportTemplate, type ReportType, type ScraperRun, type SendNotificationMessageInput, type Setting, type SourceType, type Supplier, type User, type UtilityType, type WasteCategories, type WasteTypes, _default$5 as api, consumption, _default$1 as db, _default$4 as emailTemplate, integrations, _default$2 as logger, monitoring, notification, _default$3 as notificationEmailTemplate, notificationQueue, index as openai, reporting, scrapers, _default as slack, units, index$1 as utils };
2337
+ export { type AccessLevel, type Account, type AccountResult, type Action, type ActionType, type Asset, type Automation, type AutomationRun, type AutomationRunLog, type AutomationRunSummary, type AutomationService, type AutomationServiceCategory, type AutomationSource, type Company, type CompanyInvoiceValidationRule, type CompanyInvoiceValidationSettings, type Consumption, type CreateScraperRunParams, type CustomAlertTrigger, type CustomAlertTriggerQueueMessage, type DataIngest, type DefaultField, type DeliveryStatus, type ETNEvent, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, EventNamesByCategory, type FileFormat, type ImportTemplate, type Invoice, type InvoiceCapture, type InvoiceCaptureMetadata, type InvoiceCaptureMetadataResult, type InvoiceRate, type InvoiceRateType, type InvoiceValidation, type InvoiceValidationInvoice, type InvoiceValidationResults, type InvoiceValidationRule, type InvoiceValues, type Job, type JobStatus, type Log, type Notification, type NotificationAction, type NotificationCategory, NotificationCategoryList, type NotificationCategoryPreferences, type NotificationChannels, type NotificationContext, type NotificationContextEventName, type NotificationContextMap, NotificationDefaultChannels, type NotificationEventName, type NotificationPreferences, type NotificationSQSMessage, type NotificationTemplate, type NotificationTemplateConfig, type NotificationTemplateConfigOption, type NotificationTemplateConfigType, type NotificationTemplateDefaultChannel, type NotificationTemplateRoute, type NotificationTemplateSeverity, type NotificationTemplatesMap, type Portal, type PortalSupplierSchema, type Problem, type ProblemCodes, type ProblemDetails, type Reading, type Report, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ReportTemplate, type ReportType, type ScraperRun, type SendNotificationMessageInput, type Setting, type SourceType, type Supplier, type User, type UtilityType, type WasteCategories, type WasteTypes, _default$4 as api, consumption, _default$1 as db, _default$3 as emailTemplate, integrations, logger, loggerWithBetterStack, monitoring, _default$2 as notificationEmailTemplate, notificationQueue, index as openai, reporting, scrapers, _default as slack, units, index$1 as utils };