@etainabl/nodejs-sdk 1.3.167 → 1.3.174

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 (67) hide show
  1. package/dist/esm/{chunk-IMDTX6W5.js → chunk-3G3VXGQN.js} +4 -4
  2. package/dist/esm/{chunk-YFU6P2WU.js → chunk-4G647IUM.js} +2 -2
  3. package/dist/esm/{chunk-STQV3LF2.js → chunk-4JDZJVKZ.js} +2 -2
  4. package/dist/esm/{chunk-ZW5YT27C.js → chunk-CRX53WMM.js} +100 -47
  5. package/dist/esm/chunk-CRX53WMM.js.map +1 -0
  6. package/dist/esm/{chunk-JI6PVVK3.js → chunk-D74LA2XQ.js} +73 -39
  7. package/dist/esm/chunk-D74LA2XQ.js.map +1 -0
  8. package/dist/esm/{chunk-COGWOFTA.js → chunk-HR3W7R4B.js} +393 -542
  9. package/dist/esm/chunk-HR3W7R4B.js.map +1 -0
  10. package/dist/esm/{chunk-R2ZTENKB.js → chunk-IX2LY325.js} +4 -3
  11. package/dist/esm/chunk-IX2LY325.js.map +1 -0
  12. package/dist/esm/{chunk-72KZNKH6.js → chunk-KWPO3OOT.js} +6 -6
  13. package/dist/esm/{chunk-3J7VUCCC.js → chunk-UR6FJOYI.js} +12 -10
  14. package/dist/esm/chunk-UR6FJOYI.js.map +1 -0
  15. package/dist/esm/{chunk-LARQKHST.js → chunk-XARQOPCZ.js} +2 -2
  16. package/dist/esm/{chunk-STDLTQUB.js → chunk-YLT3BSXS.js} +2 -2
  17. package/dist/esm/{chunk-KH6HADHN.js → chunk-Z63CAAFL.js} +14 -2
  18. package/dist/esm/chunk-Z63CAAFL.js.map +1 -0
  19. package/dist/esm/{dist-es-LSJVIQHH.js → dist-es-5JWI4CRR.js} +6 -6
  20. package/dist/esm/{dist-es-RLY6WB4O.js → dist-es-JA6GH4HX.js} +3 -3
  21. package/dist/esm/{dist-es-DNTTNOP2.js → dist-es-JPDE6SED.js} +7 -6
  22. package/dist/esm/dist-es-JPDE6SED.js.map +1 -0
  23. package/dist/esm/{dist-es-4M6QLI3Z.js → dist-es-LLOEQMJI.js} +4 -6
  24. package/dist/esm/{dist-es-4M6QLI3Z.js.map → dist-es-LLOEQMJI.js.map} +1 -1
  25. package/dist/esm/{dist-es-QLMS2EJQ.js → dist-es-MHVHZTM3.js} +3 -3
  26. package/dist/esm/{dist-es-VW2LACDX.js → dist-es-QWNQVMYC.js} +13 -43
  27. package/dist/esm/dist-es-QWNQVMYC.js.map +1 -0
  28. package/dist/esm/{dist-es-OELE3ZU6.js → dist-es-XOZGODLE.js} +13 -15
  29. package/dist/esm/{dist-es-OELE3ZU6.js.map → dist-es-XOZGODLE.js.map} +1 -1
  30. package/dist/esm/{event-streams-JLZWM2TX.js → event-streams-XQKMMN5Z.js} +52 -12
  31. package/dist/esm/event-streams-XQKMMN5Z.js.map +1 -0
  32. package/dist/esm/index.js +2768 -2795
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/{loadSso-OCDZAUKH.js → loadSso-66ZTLICD.js} +30 -31
  35. package/dist/esm/loadSso-66ZTLICD.js.map +1 -0
  36. package/dist/esm/{sso-oidc-M2EXZ76U.js → sso-oidc-Z2X56STB.js} +14 -15
  37. package/dist/esm/{sso-oidc-M2EXZ76U.js.map → sso-oidc-Z2X56STB.js.map} +1 -1
  38. package/dist/esm/{sts-KKJVSQNR.js → sts-XINKL27T.js} +15 -16
  39. package/dist/esm/{sts-KKJVSQNR.js.map → sts-XINKL27T.js.map} +1 -1
  40. package/dist/index.d.cts +168 -242
  41. package/dist/index.d.ts +168 -242
  42. package/dist/index.js +62437 -62510
  43. package/dist/index.js.map +1 -1
  44. package/package.json +4 -3
  45. package/dist/esm/chunk-3J7VUCCC.js.map +0 -1
  46. package/dist/esm/chunk-5UJEKK4C.js +0 -22
  47. package/dist/esm/chunk-5UJEKK4C.js.map +0 -1
  48. package/dist/esm/chunk-COGWOFTA.js.map +0 -1
  49. package/dist/esm/chunk-GA2PLVMV.js +0 -29
  50. package/dist/esm/chunk-GA2PLVMV.js.map +0 -1
  51. package/dist/esm/chunk-JI6PVVK3.js.map +0 -1
  52. package/dist/esm/chunk-KH6HADHN.js.map +0 -1
  53. package/dist/esm/chunk-R2ZTENKB.js.map +0 -1
  54. package/dist/esm/chunk-ZW5YT27C.js.map +0 -1
  55. package/dist/esm/dist-es-DNTTNOP2.js.map +0 -1
  56. package/dist/esm/dist-es-VW2LACDX.js.map +0 -1
  57. package/dist/esm/event-streams-JLZWM2TX.js.map +0 -1
  58. package/dist/esm/loadSso-OCDZAUKH.js.map +0 -1
  59. /package/dist/esm/{chunk-IMDTX6W5.js.map → chunk-3G3VXGQN.js.map} +0 -0
  60. /package/dist/esm/{chunk-YFU6P2WU.js.map → chunk-4G647IUM.js.map} +0 -0
  61. /package/dist/esm/{chunk-STQV3LF2.js.map → chunk-4JDZJVKZ.js.map} +0 -0
  62. /package/dist/esm/{chunk-72KZNKH6.js.map → chunk-KWPO3OOT.js.map} +0 -0
  63. /package/dist/esm/{chunk-LARQKHST.js.map → chunk-XARQOPCZ.js.map} +0 -0
  64. /package/dist/esm/{chunk-STDLTQUB.js.map → chunk-YLT3BSXS.js.map} +0 -0
  65. /package/dist/esm/{dist-es-LSJVIQHH.js.map → dist-es-5JWI4CRR.js.map} +0 -0
  66. /package/dist/esm/{dist-es-RLY6WB4O.js.map → dist-es-JA6GH4HX.js.map} +0 -0
  67. /package/dist/esm/{dist-es-QLMS2EJQ.js.map → dist-es-MHVHZTM3.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -8,8 +8,8 @@ import { Context, SQSEvent, SNSEvent, APIGatewayEvent, S3Event } from 'aws-lambd
8
8
  import { SQSClient } from '@aws-sdk/client-sqs';
9
9
  import winston from 'winston';
10
10
  import { Logtail } from '@logtail/node';
11
- import { z, ZodObject } from 'zod';
12
11
  import moment from 'moment';
12
+ import { ZodObject } from 'zod';
13
13
  import OpenAI from 'openai';
14
14
  import { ResponseTextConfig } from 'openai/resources/responses/responses';
15
15
  import { Reasoning } from 'openai/resources.mjs';
@@ -474,34 +474,33 @@ interface Action {
474
474
  icon?: string;
475
475
  }
476
476
 
477
- interface AlertTemplateAction extends Action {
477
+ interface CustomAlertTemplateAction extends Action {
478
478
  api?: {
479
479
  endpoint: string;
480
480
  method: string;
481
481
  payload?: Record<string, any>;
482
482
  };
483
483
  }
484
- interface AlertTemplateConfigOption {
484
+ interface CustomAlertTemplateConfigOption {
485
485
  label: string;
486
486
  value: string;
487
487
  }
488
- interface AlertTemplateConfig {
488
+ interface CustomAlertTemplateConfig {
489
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
490
  label: string;
491
- options?: AlertTemplateConfigOption[];
491
+ options?: CustomAlertTemplateConfigOption[];
492
492
  default?: string | null;
493
493
  required?: boolean;
494
494
  placeholder?: string;
495
495
  }
496
- interface AlertTemplate<ID = string, DateType = Date | string> {
496
+ interface CustomAlertTemplate<ID = string, DateType = Date | string> {
497
497
  _id: ID;
498
498
  name: string;
499
499
  description?: string;
500
500
  key: string;
501
501
  titleTemplate: string;
502
502
  messageTemplate: string;
503
- actions?: AlertTemplateAction[];
504
- configSchema?: Record<string, AlertTemplateConfig>;
503
+ configSchema?: Record<string, CustomAlertTemplateConfig>;
505
504
  active: boolean;
506
505
  isSystemTemplate: boolean;
507
506
  createdAt?: DateType;
@@ -512,7 +511,7 @@ interface AlertTemplate<ID = string, DateType = Date | string> {
512
511
  companyId?: ID;
513
512
  }
514
513
 
515
- interface AlertTrigger<ID = string, DateType = Date | string, metadataType = {
514
+ interface CustomAlertTrigger<ID = string, DateType = Date | string, metadataType = {
516
515
  [key: string]: any;
517
516
  }> {
518
517
  _id: ID;
@@ -520,6 +519,7 @@ interface AlertTrigger<ID = string, DateType = Date | string, metadataType = {
520
519
  state: 'pending' | 'processing' | 'processed' | 'failed' | 'cancelled';
521
520
  metadata?: metadataType;
522
521
  channels: {
522
+ inApp: boolean;
523
523
  email: boolean;
524
524
  sms: boolean;
525
525
  };
@@ -661,6 +661,7 @@ interface Asset<IDType = ObjectId | string> {
661
661
  assetGroupIds: IDType[];
662
662
  userSub: string;
663
663
  gresbId?: string;
664
+ tags?: string[];
664
665
  }
665
666
 
666
667
  type AutomationSource = 'ftp' | 'email' | 's3' | 'manual';
@@ -1324,9 +1325,16 @@ interface ETNEvent {
1324
1325
  }
1325
1326
 
1326
1327
  /**
1327
- * Notification categories matching user.schema.js NOTIFICATION_CATEGORIES
1328
+ * Context type mapping for different notification events
1329
+ * Each event type has its own structured context data
1328
1330
  */
1329
- type NotificationCategory = 'report' | 'invoiceValidation' | 'automation' | 'custom';
1331
+ declare const NotificationCategoryList: readonly ["automation", "report", "team", "dataQuality", "discussion", "scraper"];
1332
+ type NotificationCategory = typeof NotificationCategoryList[number];
1333
+ declare const NotificationDefaultChannels: {
1334
+ readonly inApp: true;
1335
+ readonly email: false;
1336
+ readonly sms: false;
1337
+ };
1330
1338
  interface NotificationAction extends Action {
1331
1339
  api?: {
1332
1340
  endpoint: string;
@@ -1347,30 +1355,34 @@ interface DeliveryStatus {
1347
1355
  messageId?: string;
1348
1356
  error?: string;
1349
1357
  };
1358
+ inApp: {
1359
+ sent: boolean;
1360
+ sentAt?: Date;
1361
+ messageId?: string;
1362
+ error?: string;
1363
+ };
1350
1364
  }
1351
1365
  interface Notification<ID = string, DateType = Date | string> {
1352
1366
  _id: ID;
1353
- linkedData?: Record<string, any>;
1354
- type: 'notification' | 'alert';
1355
- content?: string;
1356
- icon?: string;
1357
- status?: string;
1367
+ notificationTemplateIdId: ID;
1358
1368
  scheduledAt?: DateType;
1359
1369
  scheduledBy?: string;
1360
- isSeen: boolean;
1361
1370
  userSub: string;
1362
- title?: string;
1371
+ toastHasShown?: boolean;
1363
1372
  message?: string;
1364
- severity?: 'critical' | 'high' | 'medium' | 'low' | 'info';
1365
1373
  isAcknowledged?: boolean;
1366
1374
  acknowledgedAt?: DateType;
1367
- actions?: NotificationAction[] | null;
1368
- alertTriggerId?: ID;
1369
- alertTemplateId?: ID;
1370
- category: NotificationCategory;
1375
+ customAlertTriggerId?: ID;
1376
+ metadata?: Record<string, any>;
1377
+ route?: {
1378
+ name: string;
1379
+ params?: Record<string, any>;
1380
+ query?: Record<string, any>;
1381
+ };
1371
1382
  channels?: {
1372
1383
  email?: boolean;
1373
1384
  sms?: boolean;
1385
+ inApp?: boolean;
1374
1386
  };
1375
1387
  deliveryStatus?: {
1376
1388
  email?: {
@@ -1389,7 +1401,66 @@ interface Notification<ID = string, DateType = Date | string> {
1389
1401
  deleted?: boolean;
1390
1402
  deletedAt?: DateType;
1391
1403
  deletedBy?: string;
1392
- companyId?: ID;
1404
+ companyId: ID;
1405
+ }
1406
+
1407
+ type NotificationTemplateCategory = 'automation' | 'report' | 'team' | 'dataQuality' | 'discussion' | 'scraper';
1408
+ type NotificationTemplateSeverity = 'error' | 'warning' | 'info' | 'success' | 'tip';
1409
+ type NotificationTemplateDefaultChannel = 'off' | 'inApp' | 'email' | 'sms';
1410
+ interface NotificationTemplate<ID = string, DateType = Date | string> {
1411
+ _id: ID;
1412
+ name: string;
1413
+ description?: string;
1414
+ category: NotificationTemplateCategory;
1415
+ eventName: string;
1416
+ severity: NotificationTemplateSeverity;
1417
+ isSystem?: boolean;
1418
+ 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;
1435
+ createdAt?: DateType;
1436
+ updatedAt?: DateType;
1437
+ deleted?: boolean;
1438
+ deletedAt?: DateType;
1439
+ deletedBy?: string;
1440
+ }
1441
+
1442
+ type NotificationContextMap = {
1443
+ generalReportGenerated: {
1444
+ report: {
1445
+ fileName: string;
1446
+ type: string;
1447
+ _id: string;
1448
+ };
1449
+ };
1450
+ };
1451
+ type NotificationEventType = keyof NotificationContextMap;
1452
+ interface NotificationSQSMessage<E extends NotificationEventType = NotificationEventType> {
1453
+ eventName: E;
1454
+ timestamp: string;
1455
+ companyId: string;
1456
+ userSub: string;
1457
+ alertTriggerId?: string;
1458
+ context: NotificationContextMap[E];
1459
+ }
1460
+ interface SendNotificationMessageInput<E extends NotificationEventType> {
1461
+ companyId: string;
1462
+ userSub: string;
1463
+ alertTriggerId?: string;
1393
1464
  }
1394
1465
 
1395
1466
  interface Log<IDType = ObjectId | string> {
@@ -1465,6 +1536,7 @@ interface ReportMetadata<IDType = ObjectId | string> {
1465
1536
  dateField?: 'startDateEndDate' | 'startDate' | 'endDate' | 'confirmedAt';
1466
1537
  includeSubMeters?: boolean;
1467
1538
  accountTag?: string;
1539
+ assetTag?: string;
1468
1540
  recipients?: string[];
1469
1541
  coverCalculationMethod: 'ignoreInactive' | 'showInactive';
1470
1542
  groupBy: 'asset' | 'tags' | 'entity';
@@ -1567,28 +1639,21 @@ interface Supplier<IDType = ObjectId | string> {
1567
1639
  interface IUserCompany<IDType = ObjectId | string> {
1568
1640
  companyId: IDType;
1569
1641
  }
1570
- interface CategoryPreferences {
1571
- enabled: boolean;
1572
- channels: {
1573
- email: boolean;
1574
- sms: boolean;
1575
- };
1576
- }
1577
- interface ReportCategoryPreferences extends CategoryPreferences {
1578
- onGenerated: boolean;
1579
- onError: boolean;
1580
- }
1581
- interface NotificationPreferences {
1582
- channels: {
1583
- email: boolean;
1584
- sms: boolean;
1585
- };
1586
- categories: {
1587
- report: ReportCategoryPreferences;
1588
- invoiceValidation?: CategoryPreferences;
1589
- automation?: CategoryPreferences;
1590
- };
1591
- }
1642
+ type NotificationChannels = {
1643
+ inApp: boolean;
1644
+ email: boolean;
1645
+ sms: boolean;
1646
+ };
1647
+ type NotificationTemplatesMap = Record<string, boolean>;
1648
+ type NotificationCategoryKey = (typeof NotificationCategoryList)[number];
1649
+ type NotificationCategoryPreferences<IDType = ObjectId | string> = {
1650
+ channels: NotificationChannels;
1651
+ templates: NotificationTemplatesMap;
1652
+ };
1653
+ type NotificationPreferences<IDType = ObjectId | string> = {
1654
+ channels: NotificationChannels;
1655
+ categories: Record<NotificationCategoryKey, NotificationCategoryPreferences<IDType>>;
1656
+ };
1592
1657
  interface User<IDType = ObjectId | string> {
1593
1658
  _id: IDType;
1594
1659
  name: string;
@@ -1638,13 +1703,13 @@ interface ETNBulkUpdateResult {
1638
1703
  modifiedCount: number;
1639
1704
  matchedCount: number;
1640
1705
  }
1641
- interface BulkUpdateAlertTriggerItem {
1706
+ interface BulkUpdateCustomAlertTriggerItem {
1642
1707
  id: string;
1643
1708
  processedAt?: Date | string;
1644
1709
  lastTriggeredEvent?: Date | string;
1645
1710
  }
1646
- interface BulkUpdateAlertTriggersRequest {
1647
- updates: BulkUpdateAlertTriggerItem[];
1711
+ interface BulkUpdateCustomAlertTriggersRequest {
1712
+ updates: BulkUpdateCustomAlertTriggerItem[];
1648
1713
  }
1649
1714
  interface AuthOptions {
1650
1715
  key?: string;
@@ -1660,27 +1725,27 @@ declare const _default$5: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
1660
1725
  removeAccount: (id: string, options?: AxiosRequestConfig) => Promise<Account<string>>;
1661
1726
  getAccountSchema: (options?: AxiosRequestConfig) => Promise<any>;
1662
1727
  invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1663
- getAlertTemplate: (id: string, options?: AxiosRequestConfig) => Promise<AlertTemplate<string, string | Date>>;
1664
- listAlertTemplates: <P = AlertTemplate<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1665
- updateAlertTemplate: (id: string, data: any, options?: AxiosRequestConfig) => Promise<AlertTemplate<string, string | Date>>;
1666
- createAlertTemplate: (data: any, options?: AxiosRequestConfig) => Promise<AlertTemplate<string, string | Date>>;
1667
- removeAlertTemplate: (id: string, options?: AxiosRequestConfig) => Promise<AlertTemplate<string, string | Date>>;
1668
- getAlertTrigger: (id: string, options?: AxiosRequestConfig) => Promise<AlertTrigger<string, string, {
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
+ getAlertTrigger: (id: string, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string, {
1669
1734
  [key: string]: any;
1670
1735
  }>>;
1671
- listAlertTriggers: <P = AlertTrigger<string, string, {
1736
+ listAlertTriggers: <P = CustomAlertTrigger<string, string, {
1672
1737
  [key: string]: any;
1673
1738
  }>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1674
- updateAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<AlertTrigger<string, string | Date, {
1739
+ updateAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string | Date, {
1675
1740
  [key: string]: any;
1676
1741
  }>>;
1677
- createAlertTrigger: (data: any, options?: AxiosRequestConfig) => Promise<AlertTrigger<string, string | Date, {
1742
+ createAlertTrigger: (data: any, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string | Date, {
1678
1743
  [key: string]: any;
1679
1744
  }>>;
1680
- removeAlertTrigger: (id: string, options?: AxiosRequestConfig) => Promise<AlertTrigger<string, string | Date, {
1745
+ removeAlertTrigger: (id: string, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string | Date, {
1681
1746
  [key: string]: any;
1682
1747
  }>>;
1683
- bulkUpdateAlertTriggers: (data: BulkUpdateAlertTriggersRequest, options?: AxiosRequestConfig) => Promise<ETNBulkUpdateResult>;
1748
+ bulkUpdateAlertTriggers: (data: BulkUpdateCustomAlertTriggersRequest, options?: AxiosRequestConfig) => Promise<ETNBulkUpdateResult>;
1684
1749
  retryAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1685
1750
  cancelAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1686
1751
  getAsset: (id: string, options?: AxiosRequestConfig) => Promise<Asset<string>>;
@@ -1832,6 +1897,23 @@ interface EmailTemplateOptions {
1832
1897
  }
1833
1898
  declare const _default$4: (options: EmailTemplateOptions) => string;
1834
1899
 
1900
+ interface NotificationEmailOptions {
1901
+ title: string;
1902
+ message: string;
1903
+ severity?: 'critical' | 'high' | 'medium' | 'low' | 'info';
1904
+ category?: string;
1905
+ userName?: string;
1906
+ actions?: Array<{
1907
+ label: string;
1908
+ url?: string;
1909
+ }>;
1910
+ metadata?: Record<string, any>;
1911
+ }
1912
+ declare function generateNotificationEmail(options: NotificationEmailOptions): string;
1913
+ declare const _default$3: {
1914
+ generateNotificationEmail: typeof generateNotificationEmail;
1915
+ };
1916
+
1835
1917
  interface LoggerOptions {
1836
1918
  betterstack: boolean;
1837
1919
  betterStackToken: string;
@@ -1840,195 +1922,39 @@ interface LoggerOptions {
1840
1922
  interface ExtendedLogger extends winston.Logger {
1841
1923
  logtail?: Logtail;
1842
1924
  }
1843
- declare const _default$3: (namespace: string, betterStackOptions?: LoggerOptions) => ExtendedLogger;
1925
+ declare const _default$2: (namespace: string, betterStackOptions?: LoggerOptions) => ExtendedLogger;
1844
1926
 
1845
1927
  declare function connectToDatabase(retryAttempt?: number): Promise<Db>;
1846
- declare const _default$2: {
1928
+ declare const _default$1: {
1847
1929
  connectToDatabase: typeof connectToDatabase;
1848
1930
  };
1849
1931
 
1850
- declare const _default$1: {
1932
+ declare const _default: {
1851
1933
  postMessage: (message: string) => Promise<axios.AxiosResponse<any, any>>;
1852
1934
  };
1853
1935
 
1854
- declare const SendNotificationOptionsSchema: z.ZodObject<{
1855
- notificationType: z.ZodEnum<["notification", "alert"]>;
1856
- title: z.ZodString;
1857
- message: z.ZodString;
1858
- severity: z.ZodDefault<z.ZodOptional<z.ZodEnum<["critical", "high", "medium", "low", "info"]>>>;
1859
- user: z.ZodObject<{
1860
- userSub: z.ZodString;
1861
- email: z.ZodOptional<z.ZodString>;
1862
- name: z.ZodOptional<z.ZodString>;
1863
- }, "strip", z.ZodTypeAny, {
1864
- userSub: string;
1865
- name?: string | undefined;
1866
- email?: string | undefined;
1867
- }, {
1868
- userSub: string;
1869
- name?: string | undefined;
1870
- email?: string | undefined;
1871
- }>;
1872
- category: z.ZodEnum<["report", "invoiceValidation", "automation", "custom"]>;
1873
- channels: z.ZodObject<{
1874
- inApp: z.ZodOptional<z.ZodBoolean>;
1875
- email: z.ZodBoolean;
1876
- sms: z.ZodBoolean;
1877
- }, "strip", z.ZodTypeAny, {
1878
- email: boolean;
1879
- sms: boolean;
1880
- inApp?: boolean | undefined;
1881
- }, {
1882
- email: boolean;
1883
- sms: boolean;
1884
- inApp?: boolean | undefined;
1885
- }>;
1886
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1887
- alertTriggerId: z.ZodOptional<z.ZodString>;
1888
- alertTemplateId: z.ZodOptional<z.ZodString>;
1889
- companyId: z.ZodString;
1890
- actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
1891
- type: z.ZodEnum<["viewDetails", "acknowledge", "dismiss"]>;
1892
- label: z.ZodString;
1893
- route: z.ZodOptional<z.ZodObject<{
1894
- name: z.ZodString;
1895
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1896
- }, "strip", z.ZodTypeAny, {
1897
- name: string;
1898
- params?: Record<string, any> | undefined;
1899
- }, {
1900
- name: string;
1901
- params?: Record<string, any> | undefined;
1902
- }>>;
1903
- icon: z.ZodOptional<z.ZodString>;
1904
- api: z.ZodOptional<z.ZodObject<{
1905
- endpoint: z.ZodString;
1906
- method: z.ZodString;
1907
- payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1908
- }, "strip", z.ZodTypeAny, {
1909
- endpoint: string;
1910
- method: string;
1911
- payload?: Record<string, any> | undefined;
1912
- }, {
1913
- endpoint: string;
1914
- method: string;
1915
- payload?: Record<string, any> | undefined;
1916
- }>>;
1917
- }, "strip", z.ZodTypeAny, {
1918
- type: "viewDetails" | "acknowledge" | "dismiss";
1919
- label: string;
1920
- route?: {
1921
- name: string;
1922
- params?: Record<string, any> | undefined;
1923
- } | undefined;
1924
- icon?: string | undefined;
1925
- api?: {
1926
- endpoint: string;
1927
- method: string;
1928
- payload?: Record<string, any> | undefined;
1929
- } | undefined;
1930
- }, {
1931
- type: "viewDetails" | "acknowledge" | "dismiss";
1932
- label: string;
1933
- route?: {
1934
- name: string;
1935
- params?: Record<string, any> | undefined;
1936
- } | undefined;
1937
- icon?: string | undefined;
1938
- api?: {
1939
- endpoint: string;
1940
- method: string;
1941
- payload?: Record<string, any> | undefined;
1942
- } | undefined;
1943
- }>, "many">>;
1944
- }, "strip", z.ZodTypeAny, {
1945
- message: string;
1946
- title: string;
1947
- category: "custom" | "automation" | "report" | "invoiceValidation";
1948
- companyId: string;
1949
- user: {
1950
- userSub: string;
1951
- name?: string | undefined;
1952
- email?: string | undefined;
1953
- };
1954
- severity: "info" | "critical" | "medium" | "high" | "low";
1955
- notificationType: "notification" | "alert";
1956
- channels: {
1957
- email: boolean;
1958
- sms: boolean;
1959
- inApp?: boolean | undefined;
1960
- };
1961
- metadata?: Record<string, any> | undefined;
1962
- actions?: {
1963
- type: "viewDetails" | "acknowledge" | "dismiss";
1964
- label: string;
1965
- route?: {
1966
- name: string;
1967
- params?: Record<string, any> | undefined;
1968
- } | undefined;
1969
- icon?: string | undefined;
1970
- api?: {
1971
- endpoint: string;
1972
- method: string;
1973
- payload?: Record<string, any> | undefined;
1974
- } | undefined;
1975
- }[] | undefined;
1976
- alertTriggerId?: string | undefined;
1977
- alertTemplateId?: string | undefined;
1978
- }, {
1979
- message: string;
1980
- title: string;
1981
- category: "custom" | "automation" | "report" | "invoiceValidation";
1982
- companyId: string;
1983
- user: {
1984
- userSub: string;
1985
- name?: string | undefined;
1986
- email?: string | undefined;
1987
- };
1988
- notificationType: "notification" | "alert";
1989
- channels: {
1990
- email: boolean;
1991
- sms: boolean;
1992
- inApp?: boolean | undefined;
1993
- };
1994
- metadata?: Record<string, any> | undefined;
1995
- severity?: "info" | "critical" | "medium" | "high" | "low" | undefined;
1996
- actions?: {
1997
- type: "viewDetails" | "acknowledge" | "dismiss";
1998
- label: string;
1999
- route?: {
2000
- name: string;
2001
- params?: Record<string, any> | undefined;
2002
- } | undefined;
2003
- icon?: string | undefined;
2004
- api?: {
2005
- endpoint: string;
2006
- method: string;
2007
- payload?: Record<string, any> | undefined;
2008
- } | undefined;
2009
- }[] | undefined;
2010
- alertTriggerId?: string | undefined;
2011
- alertTemplateId?: string | undefined;
2012
- }>;
2013
- type SendNotificationOptions = z.infer<typeof SendNotificationOptionsSchema>;
2014
- type CreatedNotification = Notification<string>;
2015
- interface NotificationContext {
2016
- db?: Db;
2017
- api?: ReturnType<typeof _default$5>;
2018
- }
2019
- declare function sendBulkNotifications(notifications: SendNotificationOptions[], context: NotificationContext): Promise<CreatedNotification[]>;
2020
- declare function sendNotification(options: SendNotificationOptions, context: NotificationContext): Promise<CreatedNotification>;
2021
- declare const _default: {
2022
- sendNotification: typeof sendNotification;
2023
- sendBulkNotifications: typeof sendBulkNotifications;
1936
+ declare namespace notification {
1937
+ export { };
1938
+ }
1939
+
1940
+ interface SendNotificationMessageOptions {
1941
+ queueUrl?: string;
1942
+ sqsClient?: SQSClient;
1943
+ }
1944
+ type NotificationType = keyof NotificationContextMap;
1945
+ type SendNotificationParams<T extends NotificationType> = {
1946
+ eventName: T;
1947
+ context: NotificationContextMap[T];
1948
+ input: SendNotificationMessageInput<T>;
1949
+ options?: SendNotificationMessageOptions;
2024
1950
  };
1951
+ declare function sendNotificationMessage<T extends NotificationType>({ eventName, context, input, options }: SendNotificationParams<T>): Promise<{
1952
+ messageId: string;
1953
+ }>;
2025
1954
 
2026
- type notification_NotificationContext = NotificationContext;
2027
- type notification_SendNotificationOptions = SendNotificationOptions;
2028
- declare const notification_sendBulkNotifications: typeof sendBulkNotifications;
2029
- declare const notification_sendNotification: typeof sendNotification;
2030
- declare namespace notification {
2031
- export { type notification_NotificationContext as NotificationContext, type notification_SendNotificationOptions as SendNotificationOptions, _default as default, notification_sendBulkNotifications as sendBulkNotifications, notification_sendNotification as sendNotification };
1955
+ declare const notificationQueue_sendNotificationMessage: typeof sendNotificationMessage;
1956
+ declare namespace notificationQueue {
1957
+ export { notificationQueue_sendNotificationMessage as sendNotificationMessage };
2032
1958
  }
2033
1959
 
2034
1960
  interface ConsumptionData {
@@ -2084,7 +2010,7 @@ interface StepFunctionEvent {
2084
2010
  }
2085
2011
  declare class IngestHandler {
2086
2012
  protected event: SQSEvent | SNSEvent | APIGatewayEvent | S3Event;
2087
- protected log: ReturnType<typeof _default$3>;
2013
+ protected log: ReturnType<typeof _default$2>;
2088
2014
  protected sqsReceiptHandle: string | undefined;
2089
2015
  constructor(event: any);
2090
2016
  isSQSEvent(event: any): event is SQSEvent;
@@ -2191,7 +2117,7 @@ type ETNModels = keyof typeof models;
2191
2117
  declare abstract class Model {
2192
2118
  openai: OpenAI;
2193
2119
  protected models: Record<ETNModels, ETNModel>;
2194
- protected log: ReturnType<typeof _default$3>;
2120
+ protected log: ReturnType<typeof _default$2>;
2195
2121
  constructor();
2196
2122
  }
2197
2123
 
@@ -2247,4 +2173,4 @@ declare namespace scrapers {
2247
2173
  export type { scrapers_ETNAccount as ETNAccount };
2248
2174
  }
2249
2175
 
2250
- export { type AccessLevel, type Account, type AccountResult, type Action, type ActionType, type AlertTemplate, type AlertTemplateAction, type AlertTemplateConfig, type AlertTemplateConfigOption, type AlertTrigger, type Asset, type Automation, type AutomationRun, type AutomationRunLog, type AutomationRunSummary, type AutomationService, type AutomationServiceCategory, type AutomationSource, type CategoryPreferences, type Company, type CompanyInvoiceValidationRule, type CompanyInvoiceValidationSettings, type Consumption, type CreateScraperRunParams, 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 NotificationPreferences, type Portal, type PortalSupplierSchema, type Problem, type ProblemCodes, type ProblemDetails, type Reading, type Report, type ReportCategoryPreferences, type ReportMetadata, type ReportSource, type ReportSourceIdItem, type ReportTemplate, type ReportType, type ScraperRun, type Setting, type SourceType, type Supplier, type User, type UtilityType, type WasteCategories, type WasteTypes, _default$5 as api, consumption, _default$2 as db, _default$4 as emailTemplate, integrations, _default$3 as logger, monitoring, notification, index as openai, reporting, scrapers, _default$1 as slack, units, index$1 as utils };
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 };