@etainabl/nodejs-sdk 1.3.175 → 1.3.178

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.ts CHANGED
@@ -474,59 +474,27 @@ interface Action {
474
474
  icon?: string;
475
475
  }
476
476
 
477
- interface CustomAlertTemplateAction extends Action {
478
- api?: {
479
- endpoint: string;
480
- method: string;
481
- payload?: Record<string, any>;
482
- };
483
- }
484
- interface CustomAlertTemplateConfigOption {
485
- label: string;
486
- value: string;
487
- }
488
- interface CustomAlertTemplateConfig {
489
- type: 'text' | 'number' | 'password' | 'textarea' | 'radio' | 'select' | 'select2' | 'select-old' | 'select-multiple' | 'select-array' | 'select-array-list' | 'select-array-search' | 'multi-check-options' | 'tag-manager' | 'datePicker' | 'dateTimePicker' | 'dateRangePicker' | 'file' | 'slider';
490
- label: string;
491
- options?: CustomAlertTemplateConfigOption[];
492
- default?: string | null;
493
- required?: boolean;
494
- placeholder?: string;
495
- }
496
- interface CustomAlertTemplate<ID = string, DateType = Date | string> {
497
- _id: ID;
498
- name: string;
499
- description?: string;
500
- key: string;
501
- titleTemplate: string;
502
- messageTemplate: string;
503
- configSchema?: Record<string, CustomAlertTemplateConfig>;
504
- active: boolean;
505
- isSystemTemplate: boolean;
506
- createdAt?: DateType;
507
- updatedAt?: DateType;
508
- deleted?: boolean;
509
- deletedAt?: DateType;
510
- deletedBy?: string;
511
- companyId?: ID;
512
- }
513
-
514
477
  interface CustomAlertTrigger<ID = string, DateType = Date | string, metadataType = {
515
478
  [key: string]: any;
516
479
  }> {
517
480
  _id: ID;
518
- templateId?: ID;
481
+ notificationTemplateId: ID;
519
482
  state: 'pending' | 'processing' | 'processed' | 'failed' | 'cancelled';
520
483
  metadata?: metadataType;
484
+ description: string;
521
485
  channels: {
522
486
  inApp: boolean;
523
487
  email: boolean;
524
488
  sms: boolean;
525
489
  };
490
+ severity: 'error' | 'warning' | 'info' | 'success' | 'tip';
491
+ audience?: 'me' | 'allCompanyUsers' | 'userGroup';
492
+ userGroupId?: ID;
526
493
  processedAt?: DateType;
527
494
  lastTriggeredEvent?: DateType;
528
495
  companyId: ID;
529
496
  userSub: string;
497
+ active: boolean;
530
498
  createdAt?: DateType;
531
499
  updatedAt?: DateType;
532
500
  deleted?: boolean;
@@ -534,6 +502,14 @@ interface CustomAlertTrigger<ID = string, DateType = Date | string, metadataType
534
502
  deletedBy?: string;
535
503
  }
536
504
 
505
+ interface CustomAlertTriggerQueueMessage {
506
+ triggerId: string;
507
+ jobId: string;
508
+ windowStart?: string;
509
+ windowEnd?: string;
510
+ notificationTemplateId?: string;
511
+ }
512
+
537
513
  interface Address {
538
514
  streetAddress: string;
539
515
  locality?: string;
@@ -1324,6 +1300,29 @@ interface ETNEvent {
1324
1300
  companyId: string;
1325
1301
  }
1326
1302
 
1303
+ type JobStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
1304
+ interface Job<ID = string, DateType = Date | string> {
1305
+ _id: ID;
1306
+ type: string;
1307
+ key: string;
1308
+ status: JobStatus;
1309
+ windowStart?: DateType;
1310
+ windowEnd?: DateType;
1311
+ startedAt?: DateType;
1312
+ completedAt?: DateType;
1313
+ heartbeatAt?: DateType;
1314
+ expiresAt?: DateType;
1315
+ error?: string;
1316
+ metadata?: Record<string, any>;
1317
+ companyId?: ID;
1318
+ userSub?: string;
1319
+ createdAt?: DateType;
1320
+ updatedAt?: DateType;
1321
+ deleted?: boolean;
1322
+ deletedAt?: DateType;
1323
+ deletedBy?: string;
1324
+ }
1325
+
1327
1326
  /**
1328
1327
  * Context type mapping for different notification events
1329
1328
  * Each event type has its own structured context data
@@ -1370,6 +1369,7 @@ interface Notification<ID = string, DateType = Date | string> {
1370
1369
  userSub: string;
1371
1370
  toastHasShown?: boolean;
1372
1371
  message?: string;
1372
+ status: string;
1373
1373
  isAcknowledged?: boolean;
1374
1374
  acknowledgedAt?: DateType;
1375
1375
  customAlertTriggerId?: ID;
@@ -1401,52 +1401,107 @@ interface Notification<ID = string, DateType = Date | string> {
1401
1401
  deleted?: boolean;
1402
1402
  deletedAt?: DateType;
1403
1403
  deletedBy?: string;
1404
- companyId: ID;
1404
+ companyId?: ID;
1405
1405
  }
1406
1406
 
1407
- type NotificationTemplateCategory = 'automation' | 'report' | 'team' | 'dataQuality' | 'discussion' | 'scraper';
1407
+ declare const NotificationTemplateCategories: readonly ["automation", "report", "team", "dataQuality", "discussion", "scraper"];
1408
+ type NotificationTemplateCategory = typeof NotificationTemplateCategories[number];
1409
+ declare const EventNamesByCategory: {
1410
+ readonly automation: readonly ["automationFailed", "runCompleted", "hasnotRun", "fileNotExpected"];
1411
+ readonly report: readonly ["reportSuccess", "reportFailed"];
1412
+ readonly team: readonly ["newUserSignIn"];
1413
+ readonly dataQuality: readonly ["thresholdBreached", "approachingThreshold", "readingOverdue", "readingDueSoon", "contractRenewalUpcoming", "contractRenewalOverdue"];
1414
+ readonly discussion: readonly ["commentAdded", "mentionInComment"];
1415
+ readonly scraper: readonly ["scraperLoginError", "scraperHasnotRun", "scraperRunCompleted"];
1416
+ };
1417
+ type AutomationEventName = typeof EventNamesByCategory.automation[number];
1418
+ type ReportEventName = typeof EventNamesByCategory.report[number];
1419
+ type TeamEventName = typeof EventNamesByCategory.team[number];
1420
+ type DataQualityEventName = typeof EventNamesByCategory.dataQuality[number];
1421
+ type DiscussionEventName = typeof EventNamesByCategory.discussion[number];
1422
+ type ScraperEventName = typeof EventNamesByCategory.scraper[number];
1423
+ type NotificationEventName = AutomationEventName | ReportEventName | TeamEventName | DataQualityEventName | DiscussionEventName | ScraperEventName;
1408
1424
  type NotificationTemplateSeverity = 'error' | 'warning' | 'info' | 'success' | 'tip';
1409
1425
  type NotificationTemplateDefaultChannel = 'off' | 'inApp' | 'email' | 'sms';
1426
+ type NotificationTemplateConfigType = 'text' | 'number' | 'password' | 'textarea' | 'radio' | 'select' | 'select2' | 'select-old' | 'select-multiple' | 'select-array' | 'select-array-list' | 'select-array-search' | 'multi-check-options' | 'tag-manager' | 'datePicker' | 'dateTimePicker' | 'dateRangePicker' | 'file' | 'slider';
1427
+ interface NotificationTemplateConfigOption {
1428
+ label: string;
1429
+ value: string;
1430
+ }
1431
+ interface NotificationTemplateConfig {
1432
+ type: NotificationTemplateConfigType;
1433
+ label: string;
1434
+ options?: NotificationTemplateConfigOption[];
1435
+ default?: string | null;
1436
+ required?: boolean;
1437
+ placeholder?: string;
1438
+ }
1439
+ interface NotificationTemplateRoute {
1440
+ name?: string;
1441
+ params?: Record<string, any>;
1442
+ }
1410
1443
  interface NotificationTemplate<ID = string, DateType = Date | string> {
1411
1444
  _id: ID;
1412
1445
  name: string;
1413
1446
  description?: string;
1414
1447
  category: NotificationTemplateCategory;
1415
- eventName: string;
1448
+ eventName: NotificationEventName;
1416
1449
  severity: NotificationTemplateSeverity;
1417
1450
  isSystem?: boolean;
1418
1451
  default: NotificationTemplateDefaultChannel;
1419
- message: string;
1420
- route: {
1421
- name: {
1422
- type: String;
1423
- default: '';
1424
- };
1425
- params?: {
1426
- type: Object;
1427
- default: () => {};
1428
- };
1429
- query?: {
1430
- type: Object;
1431
- default: () => {};
1432
- };
1433
- };
1434
- icon: string;
1452
+ message?: string;
1453
+ route?: NotificationTemplateRoute;
1454
+ icon?: string;
1455
+ config?: Map<string, NotificationTemplateConfig> | Record<string, NotificationTemplateConfig>;
1435
1456
  createdAt?: DateType;
1436
1457
  updatedAt?: DateType;
1437
- deleted?: boolean;
1438
- deletedAt?: DateType;
1439
- deletedBy?: string;
1440
1458
  }
1441
1459
 
1442
1460
  type NotificationContextMap = {
1443
- generalReportGenerated: {
1461
+ reportSuccess: {
1462
+ report: {
1463
+ fileName: string;
1464
+ _id: string;
1465
+ };
1466
+ };
1467
+ reportFailed: {
1444
1468
  report: {
1445
1469
  fileName: string;
1446
- type: string;
1447
1470
  _id: string;
1448
1471
  };
1449
1472
  };
1473
+ automationFailed: {
1474
+ context: {
1475
+ message: string;
1476
+ metadata: {
1477
+ items: {
1478
+ message: string;
1479
+ route: {
1480
+ name: string;
1481
+ query: {
1482
+ id: string;
1483
+ };
1484
+ };
1485
+ }[];
1486
+ };
1487
+ };
1488
+ };
1489
+ readingOverdue: {
1490
+ context: {
1491
+ message: string;
1492
+ metadata: {
1493
+ items: {
1494
+ message: string;
1495
+ route: {
1496
+ name: string;
1497
+ params: {
1498
+ id: string;
1499
+ };
1500
+ };
1501
+ }[];
1502
+ };
1503
+ };
1504
+ };
1450
1505
  };
1451
1506
  type NotificationEventType = keyof NotificationContextMap;
1452
1507
  interface NotificationSQSMessage<E extends NotificationEventType = NotificationEventType> {
@@ -1461,6 +1516,7 @@ interface SendNotificationMessageInput<E extends NotificationEventType> {
1461
1516
  companyId: string;
1462
1517
  userSub: string;
1463
1518
  alertTriggerId?: string;
1519
+ timestamp?: string;
1464
1520
  }
1465
1521
 
1466
1522
  interface Log<IDType = ObjectId | string> {
@@ -1725,11 +1781,6 @@ declare const _default$5: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
1725
1781
  removeAccount: (id: string, options?: AxiosRequestConfig) => Promise<Account<string>>;
1726
1782
  getAccountSchema: (options?: AxiosRequestConfig) => Promise<any>;
1727
1783
  invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1728
- getAlertTemplate: (id: string, options?: AxiosRequestConfig) => Promise<CustomAlertTemplate<string, string | Date>>;
1729
- listAlertTemplates: <P = CustomAlertTemplate<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1730
- updateAlertTemplate: (id: string, data: any, options?: AxiosRequestConfig) => Promise<CustomAlertTemplate<string, string | Date>>;
1731
- createAlertTemplate: (data: any, options?: AxiosRequestConfig) => Promise<CustomAlertTemplate<string, string | Date>>;
1732
- removeAlertTemplate: (id: string, options?: AxiosRequestConfig) => Promise<CustomAlertTemplate<string, string | Date>>;
1733
1784
  getAlertTrigger: (id: string, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string, {
1734
1785
  [key: string]: any;
1735
1786
  }>>;
@@ -1748,6 +1799,16 @@ declare const _default$5: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
1748
1799
  bulkUpdateAlertTriggers: (data: BulkUpdateCustomAlertTriggersRequest, options?: AxiosRequestConfig) => Promise<ETNBulkUpdateResult>;
1749
1800
  retryAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1750
1801
  cancelAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1802
+ getCustomAlertTrigger: (id: string, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string, {
1803
+ [key: string]: any;
1804
+ }>>;
1805
+ listCustomAlertTriggers: <P = CustomAlertTrigger<string, string, {
1806
+ [key: string]: any;
1807
+ }>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1808
+ updateCustomAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string | Date, {
1809
+ [key: string]: any;
1810
+ }>>;
1811
+ bulkUpdateCustomAlertTriggers: (data: BulkUpdateCustomAlertTriggersRequest, options?: AxiosRequestConfig) => Promise<ETNBulkUpdateResult>;
1751
1812
  getAsset: (id: string, options?: AxiosRequestConfig) => Promise<Asset<string>>;
1752
1813
  listAssets: <P = Asset<string>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1753
1814
  updateAsset: (id: string, data: any, options?: AxiosRequestConfig) => Promise<Asset<string>>;
@@ -1803,6 +1864,12 @@ declare const _default$5: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
1803
1864
  createLog: (data: any, options?: AxiosRequestConfig) => Promise<Log<string>>;
1804
1865
  createLogBulk: (data: any, options?: AxiosRequestConfig) => Promise<Log<string>[]>;
1805
1866
  removeLog: (id: string, options?: AxiosRequestConfig) => Promise<Log<string>>;
1867
+ getJob: (id: string, options?: AxiosRequestConfig) => Promise<Job<string, string | Date>>;
1868
+ listJobs: <P = Job<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1869
+ updateJob: (id: string, data: any, options?: AxiosRequestConfig) => Promise<Job<string, string | Date>>;
1870
+ createJob: (data: any, options?: AxiosRequestConfig) => Promise<Job<string, string | Date>>;
1871
+ createJobBulk: (data: any, options?: AxiosRequestConfig) => Promise<Job<string, string | Date>[]>;
1872
+ removeJob: (id: string, options?: AxiosRequestConfig) => Promise<Job<string, string | Date>>;
1806
1873
  getNotification: (id: string, options?: AxiosRequestConfig) => Promise<Notification<string, string | Date>>;
1807
1874
  listNotifications: <P = Notification<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1808
1875
  updateNotification: (id: string, data: any, options?: AxiosRequestConfig) => Promise<Notification<string, string | Date>>;
@@ -1810,6 +1877,11 @@ declare const _default$5: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
1810
1877
  bulkCreateNotifications: (data: any, options?: AxiosRequestConfig) => Promise<Notification<string, string | Date>[]>;
1811
1878
  bulkUpdateNotificationDeliveryStatus: (data: any, options?: AxiosRequestConfig) => Promise<ETNBulkUpdateResult>;
1812
1879
  removeNotification: (id: string, options?: AxiosRequestConfig) => Promise<Notification<string, string | Date>>;
1880
+ getNotificationTemplate: (id: string, options?: AxiosRequestConfig) => Promise<NotificationTemplate<string, string | Date>>;
1881
+ listNotificationTemplates: <P = NotificationTemplate<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1882
+ updateNotificationTemplate: (id: string, data: any, options?: AxiosRequestConfig) => Promise<NotificationTemplate<string, string | Date>>;
1883
+ createNotificationTemplate: (data: any, options?: AxiosRequestConfig) => Promise<NotificationTemplate<string, string | Date>>;
1884
+ removeNotificationTemplate: (id: string, options?: AxiosRequestConfig) => Promise<NotificationTemplate<string, string | Date>>;
1813
1885
  getReading: (id: string, options?: AxiosRequestConfig) => Promise<Reading<string, Date>>;
1814
1886
  listReadings: <P = Reading<string, Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1815
1887
  updateReading: (id: string, data: any, options?: AxiosRequestConfig) => Promise<Reading<string, Date>>;
@@ -1942,6 +2014,7 @@ interface SendNotificationMessageOptions {
1942
2014
  sqsClient?: SQSClient;
1943
2015
  }
1944
2016
  type NotificationType = keyof NotificationContextMap;
2017
+ declare function createNotificationMessage<T extends NotificationType>(eventName: T, context: NotificationContextMap[T], input: SendNotificationMessageInput<T>): NotificationSQSMessage<T>;
1945
2018
  type SendNotificationParams<T extends NotificationType> = {
1946
2019
  eventName: T;
1947
2020
  context: NotificationContextMap[T];
@@ -1952,9 +2025,10 @@ declare function sendNotificationMessage<T extends NotificationType>({ eventName
1952
2025
  messageId: string;
1953
2026
  }>;
1954
2027
 
2028
+ declare const notificationQueue_createNotificationMessage: typeof createNotificationMessage;
1955
2029
  declare const notificationQueue_sendNotificationMessage: typeof sendNotificationMessage;
1956
2030
  declare namespace notificationQueue {
1957
- export { notificationQueue_sendNotificationMessage as sendNotificationMessage };
2031
+ export { notificationQueue_createNotificationMessage as createNotificationMessage, notificationQueue_sendNotificationMessage as sendNotificationMessage };
1958
2032
  }
1959
2033
 
1960
2034
  interface ConsumptionData {
@@ -2173,4 +2247,4 @@ declare namespace scrapers {
2173
2247
  export type { scrapers_ETNAccount as ETNAccount };
2174
2248
  }
2175
2249
 
2176
- 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 CustomAlertTemplate, type CustomAlertTemplateAction, type CustomAlertTemplateConfig, type CustomAlertTemplateConfigOption, type CustomAlertTrigger, type DataIngest, type DefaultField, type DeliveryStatus, type ETNEvent, type ETNPagedResponse$1 as ETNPagedResponse, type Email, type Entity, 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 Log, type Notification, type NotificationAction, type NotificationCategory, type NotificationCategoryKey, NotificationCategoryList, type NotificationCategoryPreferences, type NotificationChannels, type NotificationContextMap, NotificationDefaultChannels, type NotificationEventType, type NotificationPreferences, type NotificationSQSMessage, type NotificationTemplate, type NotificationTemplateCategory, type NotificationTemplateDefaultChannel, 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 };
2250
+ export { type AccessLevel, type Account, type AccountResult, type Action, type ActionType, type Asset, type Automation, type AutomationEventName, 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 DataQualityEventName, type DefaultField, type DeliveryStatus, type DiscussionEventName, 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, type NotificationCategoryKey, NotificationCategoryList, type NotificationCategoryPreferences, type NotificationChannels, type NotificationContextMap, NotificationDefaultChannels, type NotificationEventName, type NotificationEventType, type NotificationPreferences, type NotificationSQSMessage, type NotificationTemplate, NotificationTemplateCategories, type NotificationTemplateCategory, 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 ReportEventName, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ReportTemplate, type ReportType, type ScraperEventName, type ScraperRun, type SendNotificationMessageInput, type Setting, type SourceType, type Supplier, type TeamEventName, 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 };
package/dist/index.js CHANGED
@@ -75978,8 +75978,10 @@ var init_dist_es53 = __esm({
75978
75978
  // src/index.ts
75979
75979
  var index_exports = {};
75980
75980
  __export(index_exports, {
75981
+ EventNamesByCategory: () => EventNamesByCategory,
75981
75982
  NotificationCategoryList: () => NotificationCategoryList,
75982
75983
  NotificationDefaultChannels: () => NotificationDefaultChannels,
75984
+ NotificationTemplateCategories: () => NotificationTemplateCategories,
75983
75985
  ObjectId: () => import_mongodb2.ObjectId,
75984
75986
  api: () => api_default,
75985
75987
  consumption: () => consumption_exports,
@@ -76219,12 +76221,6 @@ var api_default = (auth, instanceOptions = {}) => {
76219
76221
  removeAccount: factory.remove(etainablApi, "accounts"),
76220
76222
  getAccountSchema: factory.get(etainablApi, "accounts", "schema"),
76221
76223
  invalidateAccountCache: factory.customWithId(etainablApi, "put", "accounts", "invalidate-cache"),
76222
- // alert templates
76223
- getAlertTemplate: factory.getWithId(etainablApi, "alert-templates"),
76224
- listAlertTemplates: factory.list(etainablApi, "alert-templates"),
76225
- updateAlertTemplate: factory.update(etainablApi, "alert-templates"),
76226
- createAlertTemplate: factory.create(etainablApi, "alert-templates"),
76227
- removeAlertTemplate: factory.remove(etainablApi, "alert-templates"),
76228
76224
  // alert triggers
76229
76225
  getAlertTrigger: factory.getWithId(etainablApi, "alert-triggers"),
76230
76226
  listAlertTriggers: factory.list(etainablApi, "alert-triggers"),
@@ -76238,6 +76234,15 @@ var api_default = (auth, instanceOptions = {}) => {
76238
76234
  ),
76239
76235
  retryAlertTrigger: factory.customWithId(etainablApi, "post", "alert-triggers", "retry"),
76240
76236
  cancelAlertTrigger: factory.customWithId(etainablApi, "post", "alert-triggers", "cancel"),
76237
+ // custom alert triggers
76238
+ getCustomAlertTrigger: factory.getWithId(etainablApi, "custom-alert-triggers"),
76239
+ listCustomAlertTriggers: factory.list(etainablApi, "custom-alert-triggers"),
76240
+ updateCustomAlertTrigger: factory.update(etainablApi, "custom-alert-triggers"),
76241
+ bulkUpdateCustomAlertTriggers: factory.create(
76242
+ etainablApi,
76243
+ "custom-alert-triggers",
76244
+ "bulk-update"
76245
+ ),
76241
76246
  // assets
76242
76247
  getAsset: factory.getWithId(etainablApi, "assets"),
76243
76248
  listAssets: factory.list(etainablApi, "assets"),
@@ -76306,6 +76311,12 @@ var api_default = (auth, instanceOptions = {}) => {
76306
76311
  createLog: factory.create(etainablApi, "logs"),
76307
76312
  createLogBulk: factory.create(etainablApi, "logs", "bulk"),
76308
76313
  removeLog: factory.remove(etainablApi, "logs"),
76314
+ getJob: factory.getWithId(etainablApi, "jobs"),
76315
+ listJobs: factory.list(etainablApi, "jobs"),
76316
+ updateJob: factory.update(etainablApi, "jobs"),
76317
+ createJob: factory.create(etainablApi, "jobs"),
76318
+ createJobBulk: factory.create(etainablApi, "jobs", "bulk"),
76319
+ removeJob: factory.remove(etainablApi, "jobs"),
76309
76320
  // notifications
76310
76321
  getNotification: factory.getWithId(etainablApi, "notifications"),
76311
76322
  listNotifications: factory.list(etainablApi, "notifications"),
@@ -76314,6 +76325,12 @@ var api_default = (auth, instanceOptions = {}) => {
76314
76325
  bulkCreateNotifications: factory.create(etainablApi, "notifications", "bulk"),
76315
76326
  bulkUpdateNotificationDeliveryStatus: factory.create(etainablApi, "notifications", "bulk-delivery-status"),
76316
76327
  removeNotification: factory.remove(etainablApi, "notifications"),
76328
+ // notification templates
76329
+ getNotificationTemplate: factory.getWithId(etainablApi, "notification-templates"),
76330
+ listNotificationTemplates: factory.list(etainablApi, "notification-templates"),
76331
+ updateNotificationTemplate: factory.update(etainablApi, "notification-templates"),
76332
+ createNotificationTemplate: factory.create(etainablApi, "notification-templates"),
76333
+ removeNotificationTemplate: factory.remove(etainablApi, "notification-templates"),
76317
76334
  // readings
76318
76335
  getReading: factory.getWithId(etainablApi, "readings"),
76319
76336
  listReadings: factory.list(etainablApi, "readings"),
@@ -76930,6 +76947,7 @@ var notification_exports = {};
76930
76947
  // src/notificationQueue.ts
76931
76948
  var notificationQueue_exports = {};
76932
76949
  __export(notificationQueue_exports, {
76950
+ createNotificationMessage: () => createNotificationMessage,
76933
76951
  sendNotificationMessage: () => sendNotificationMessage
76934
76952
  });
76935
76953
 
@@ -78380,10 +78398,11 @@ var SendMessageCommand = class extends Command.classBuilder().ep(commonParams).m
78380
78398
 
78381
78399
  // src/notificationQueue.ts
78382
78400
  function createNotificationMessage(eventName, context, input) {
78401
+ const { timestamp, ...payload } = input;
78383
78402
  return {
78384
78403
  eventName,
78385
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
78386
- ...input,
78404
+ timestamp: timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
78405
+ ...payload,
78387
78406
  context
78388
78407
  };
78389
78408
  }
@@ -85841,10 +85860,30 @@ var NotificationDefaultChannels = {
85841
85860
  email: false,
85842
85861
  sms: false
85843
85862
  };
85863
+
85864
+ // src/types/notificationTemplate.ts
85865
+ var NotificationTemplateCategories = [
85866
+ "automation",
85867
+ "report",
85868
+ "team",
85869
+ "dataQuality",
85870
+ "discussion",
85871
+ "scraper"
85872
+ ];
85873
+ var EventNamesByCategory = {
85874
+ automation: ["automationFailed", "runCompleted", "hasnotRun", "fileNotExpected"],
85875
+ report: ["reportSuccess", "reportFailed"],
85876
+ team: ["newUserSignIn"],
85877
+ dataQuality: ["thresholdBreached", "approachingThreshold", "readingOverdue", "readingDueSoon", "contractRenewalUpcoming", "contractRenewalOverdue"],
85878
+ discussion: ["commentAdded", "mentionInComment"],
85879
+ scraper: ["scraperLoginError", "scraperHasnotRun", "scraperRunCompleted"]
85880
+ };
85844
85881
  // Annotate the CommonJS export names for ESM import in node:
85845
85882
  0 && (module.exports = {
85883
+ EventNamesByCategory,
85846
85884
  NotificationCategoryList,
85847
85885
  NotificationDefaultChannels,
85886
+ NotificationTemplateCategories,
85848
85887
  ObjectId,
85849
85888
  api,
85850
85889
  consumption,