@etainabl/nodejs-sdk 1.3.170 → 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 (25) hide show
  1. package/dist/esm/{chunk-KR5LXISF.js → chunk-4G647IUM.js} +2 -2
  2. package/dist/esm/{chunk-6AFRW6DM.js → chunk-HR3W7R4B.js} +66 -66
  3. package/dist/esm/{chunk-6AFRW6DM.js.map → chunk-HR3W7R4B.js.map} +1 -1
  4. package/dist/esm/{chunk-HP5O34C3.js → chunk-UR6FJOYI.js} +2 -2
  5. package/dist/esm/{dist-es-UZVIZZYV.js → dist-es-JA6GH4HX.js} +2 -2
  6. package/dist/esm/{dist-es-KG7JV3KL.js → dist-es-QWNQVMYC.js} +4 -4
  7. package/dist/esm/{dist-es-7A5AP37F.js → dist-es-XOZGODLE.js} +4 -4
  8. package/dist/esm/index.js +2733 -2762
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/esm/{loadSso-WTBVK2SM.js → loadSso-66ZTLICD.js} +5 -5
  11. package/dist/esm/{loadSso-WTBVK2SM.js.map → loadSso-66ZTLICD.js.map} +1 -1
  12. package/dist/esm/{sso-oidc-3AEK6OAH.js → sso-oidc-Z2X56STB.js} +5 -5
  13. package/dist/esm/{sso-oidc-3AEK6OAH.js.map → sso-oidc-Z2X56STB.js.map} +1 -1
  14. package/dist/esm/{sts-AUUXBNVW.js → sts-XINKL27T.js} +5 -5
  15. package/dist/esm/{sts-AUUXBNVW.js.map → sts-XINKL27T.js.map} +1 -1
  16. package/dist/index.d.cts +166 -242
  17. package/dist/index.d.ts +166 -242
  18. package/dist/index.js +73651 -73672
  19. package/dist/index.js.map +1 -1
  20. package/package.json +4 -3
  21. /package/dist/esm/{chunk-KR5LXISF.js.map → chunk-4G647IUM.js.map} +0 -0
  22. /package/dist/esm/{chunk-HP5O34C3.js.map → chunk-UR6FJOYI.js.map} +0 -0
  23. /package/dist/esm/{dist-es-UZVIZZYV.js.map → dist-es-JA6GH4HX.js.map} +0 -0
  24. /package/dist/esm/{dist-es-KG7JV3KL.js.map → dist-es-QWNQVMYC.js.map} +0 -0
  25. /package/dist/esm/{dist-es-7A5AP37F.js.map → dist-es-XOZGODLE.js.map} +0 -0
package/dist/index.d.cts 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
  };
@@ -1325,9 +1325,16 @@ interface ETNEvent {
1325
1325
  }
1326
1326
 
1327
1327
  /**
1328
- * 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
1329
1330
  */
1330
- 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
+ };
1331
1338
  interface NotificationAction extends Action {
1332
1339
  api?: {
1333
1340
  endpoint: string;
@@ -1348,30 +1355,34 @@ interface DeliveryStatus {
1348
1355
  messageId?: string;
1349
1356
  error?: string;
1350
1357
  };
1358
+ inApp: {
1359
+ sent: boolean;
1360
+ sentAt?: Date;
1361
+ messageId?: string;
1362
+ error?: string;
1363
+ };
1351
1364
  }
1352
1365
  interface Notification<ID = string, DateType = Date | string> {
1353
1366
  _id: ID;
1354
- linkedData?: Record<string, any>;
1355
- type: 'notification' | 'alert';
1356
- content?: string;
1357
- icon?: string;
1358
- status?: string;
1367
+ notificationTemplateIdId: ID;
1359
1368
  scheduledAt?: DateType;
1360
1369
  scheduledBy?: string;
1361
- isSeen: boolean;
1362
1370
  userSub: string;
1363
- title?: string;
1371
+ toastHasShown?: boolean;
1364
1372
  message?: string;
1365
- severity?: 'critical' | 'high' | 'medium' | 'low' | 'info';
1366
1373
  isAcknowledged?: boolean;
1367
1374
  acknowledgedAt?: DateType;
1368
- actions?: NotificationAction[] | null;
1369
- alertTriggerId?: ID;
1370
- alertTemplateId?: ID;
1371
- 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
+ };
1372
1382
  channels?: {
1373
1383
  email?: boolean;
1374
1384
  sms?: boolean;
1385
+ inApp?: boolean;
1375
1386
  };
1376
1387
  deliveryStatus?: {
1377
1388
  email?: {
@@ -1390,7 +1401,66 @@ interface Notification<ID = string, DateType = Date | string> {
1390
1401
  deleted?: boolean;
1391
1402
  deletedAt?: DateType;
1392
1403
  deletedBy?: string;
1393
- 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;
1394
1464
  }
1395
1465
 
1396
1466
  interface Log<IDType = ObjectId | string> {
@@ -1569,28 +1639,21 @@ interface Supplier<IDType = ObjectId | string> {
1569
1639
  interface IUserCompany<IDType = ObjectId | string> {
1570
1640
  companyId: IDType;
1571
1641
  }
1572
- interface CategoryPreferences {
1573
- enabled: boolean;
1574
- channels: {
1575
- email: boolean;
1576
- sms: boolean;
1577
- };
1578
- }
1579
- interface ReportCategoryPreferences extends CategoryPreferences {
1580
- onGenerated: boolean;
1581
- onError: boolean;
1582
- }
1583
- interface NotificationPreferences {
1584
- channels: {
1585
- email: boolean;
1586
- sms: boolean;
1587
- };
1588
- categories: {
1589
- report: ReportCategoryPreferences;
1590
- invoiceValidation?: CategoryPreferences;
1591
- automation?: CategoryPreferences;
1592
- };
1593
- }
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
+ };
1594
1657
  interface User<IDType = ObjectId | string> {
1595
1658
  _id: IDType;
1596
1659
  name: string;
@@ -1640,13 +1703,13 @@ interface ETNBulkUpdateResult {
1640
1703
  modifiedCount: number;
1641
1704
  matchedCount: number;
1642
1705
  }
1643
- interface BulkUpdateAlertTriggerItem {
1706
+ interface BulkUpdateCustomAlertTriggerItem {
1644
1707
  id: string;
1645
1708
  processedAt?: Date | string;
1646
1709
  lastTriggeredEvent?: Date | string;
1647
1710
  }
1648
- interface BulkUpdateAlertTriggersRequest {
1649
- updates: BulkUpdateAlertTriggerItem[];
1711
+ interface BulkUpdateCustomAlertTriggersRequest {
1712
+ updates: BulkUpdateCustomAlertTriggerItem[];
1650
1713
  }
1651
1714
  interface AuthOptions {
1652
1715
  key?: string;
@@ -1662,27 +1725,27 @@ declare const _default$5: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
1662
1725
  removeAccount: (id: string, options?: AxiosRequestConfig) => Promise<Account<string>>;
1663
1726
  getAccountSchema: (options?: AxiosRequestConfig) => Promise<any>;
1664
1727
  invalidateAccountCache: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1665
- getAlertTemplate: (id: string, options?: AxiosRequestConfig) => Promise<AlertTemplate<string, string | Date>>;
1666
- listAlertTemplates: <P = AlertTemplate<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1667
- updateAlertTemplate: (id: string, data: any, options?: AxiosRequestConfig) => Promise<AlertTemplate<string, string | Date>>;
1668
- createAlertTemplate: (data: any, options?: AxiosRequestConfig) => Promise<AlertTemplate<string, string | Date>>;
1669
- removeAlertTemplate: (id: string, options?: AxiosRequestConfig) => Promise<AlertTemplate<string, string | Date>>;
1670
- 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, {
1671
1734
  [key: string]: any;
1672
1735
  }>>;
1673
- listAlertTriggers: <P = AlertTrigger<string, string, {
1736
+ listAlertTriggers: <P = CustomAlertTrigger<string, string, {
1674
1737
  [key: string]: any;
1675
1738
  }>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1676
- 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, {
1677
1740
  [key: string]: any;
1678
1741
  }>>;
1679
- createAlertTrigger: (data: any, options?: AxiosRequestConfig) => Promise<AlertTrigger<string, string | Date, {
1742
+ createAlertTrigger: (data: any, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string | Date, {
1680
1743
  [key: string]: any;
1681
1744
  }>>;
1682
- removeAlertTrigger: (id: string, options?: AxiosRequestConfig) => Promise<AlertTrigger<string, string | Date, {
1745
+ removeAlertTrigger: (id: string, options?: AxiosRequestConfig) => Promise<CustomAlertTrigger<string, string | Date, {
1683
1746
  [key: string]: any;
1684
1747
  }>>;
1685
- bulkUpdateAlertTriggers: (data: BulkUpdateAlertTriggersRequest, options?: AxiosRequestConfig) => Promise<ETNBulkUpdateResult>;
1748
+ bulkUpdateAlertTriggers: (data: BulkUpdateCustomAlertTriggersRequest, options?: AxiosRequestConfig) => Promise<ETNBulkUpdateResult>;
1686
1749
  retryAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1687
1750
  cancelAlertTrigger: (id: string, data: any, options?: AxiosRequestConfig) => Promise<any>;
1688
1751
  getAsset: (id: string, options?: AxiosRequestConfig) => Promise<Asset<string>>;
@@ -1834,6 +1897,23 @@ interface EmailTemplateOptions {
1834
1897
  }
1835
1898
  declare const _default$4: (options: EmailTemplateOptions) => string;
1836
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
+
1837
1917
  interface LoggerOptions {
1838
1918
  betterstack: boolean;
1839
1919
  betterStackToken: string;
@@ -1842,195 +1922,39 @@ interface LoggerOptions {
1842
1922
  interface ExtendedLogger extends winston.Logger {
1843
1923
  logtail?: Logtail;
1844
1924
  }
1845
- declare const _default$3: (namespace: string, betterStackOptions?: LoggerOptions) => ExtendedLogger;
1925
+ declare const _default$2: (namespace: string, betterStackOptions?: LoggerOptions) => ExtendedLogger;
1846
1926
 
1847
1927
  declare function connectToDatabase(retryAttempt?: number): Promise<Db>;
1848
- declare const _default$2: {
1928
+ declare const _default$1: {
1849
1929
  connectToDatabase: typeof connectToDatabase;
1850
1930
  };
1851
1931
 
1852
- declare const _default$1: {
1932
+ declare const _default: {
1853
1933
  postMessage: (message: string) => Promise<axios.AxiosResponse<any, any>>;
1854
1934
  };
1855
1935
 
1856
- declare const SendNotificationOptionsSchema: z.ZodObject<{
1857
- notificationType: z.ZodEnum<["notification", "alert"]>;
1858
- title: z.ZodString;
1859
- message: z.ZodString;
1860
- severity: z.ZodDefault<z.ZodOptional<z.ZodEnum<["critical", "high", "medium", "low", "info"]>>>;
1861
- user: z.ZodObject<{
1862
- userSub: z.ZodString;
1863
- email: z.ZodOptional<z.ZodString>;
1864
- name: z.ZodOptional<z.ZodString>;
1865
- }, "strip", z.ZodTypeAny, {
1866
- userSub: string;
1867
- name?: string | undefined;
1868
- email?: string | undefined;
1869
- }, {
1870
- userSub: string;
1871
- name?: string | undefined;
1872
- email?: string | undefined;
1873
- }>;
1874
- category: z.ZodEnum<["report", "invoiceValidation", "automation", "custom"]>;
1875
- channels: z.ZodObject<{
1876
- inApp: z.ZodOptional<z.ZodBoolean>;
1877
- email: z.ZodBoolean;
1878
- sms: z.ZodBoolean;
1879
- }, "strip", z.ZodTypeAny, {
1880
- email: boolean;
1881
- sms: boolean;
1882
- inApp?: boolean | undefined;
1883
- }, {
1884
- email: boolean;
1885
- sms: boolean;
1886
- inApp?: boolean | undefined;
1887
- }>;
1888
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1889
- alertTriggerId: z.ZodOptional<z.ZodString>;
1890
- alertTemplateId: z.ZodOptional<z.ZodString>;
1891
- companyId: z.ZodString;
1892
- actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
1893
- type: z.ZodEnum<["viewDetails", "acknowledge", "dismiss"]>;
1894
- label: z.ZodString;
1895
- route: z.ZodOptional<z.ZodObject<{
1896
- name: z.ZodString;
1897
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1898
- }, "strip", z.ZodTypeAny, {
1899
- name: string;
1900
- params?: Record<string, any> | undefined;
1901
- }, {
1902
- name: string;
1903
- params?: Record<string, any> | undefined;
1904
- }>>;
1905
- icon: z.ZodOptional<z.ZodString>;
1906
- api: z.ZodOptional<z.ZodObject<{
1907
- endpoint: z.ZodString;
1908
- method: z.ZodString;
1909
- payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1910
- }, "strip", z.ZodTypeAny, {
1911
- endpoint: string;
1912
- method: string;
1913
- payload?: Record<string, any> | undefined;
1914
- }, {
1915
- endpoint: string;
1916
- method: string;
1917
- payload?: Record<string, any> | undefined;
1918
- }>>;
1919
- }, "strip", z.ZodTypeAny, {
1920
- type: "viewDetails" | "acknowledge" | "dismiss";
1921
- label: string;
1922
- route?: {
1923
- name: string;
1924
- params?: Record<string, any> | undefined;
1925
- } | undefined;
1926
- icon?: string | undefined;
1927
- api?: {
1928
- endpoint: string;
1929
- method: string;
1930
- payload?: Record<string, any> | undefined;
1931
- } | undefined;
1932
- }, {
1933
- type: "viewDetails" | "acknowledge" | "dismiss";
1934
- label: string;
1935
- route?: {
1936
- name: string;
1937
- params?: Record<string, any> | undefined;
1938
- } | undefined;
1939
- icon?: string | undefined;
1940
- api?: {
1941
- endpoint: string;
1942
- method: string;
1943
- payload?: Record<string, any> | undefined;
1944
- } | undefined;
1945
- }>, "many">>;
1946
- }, "strip", z.ZodTypeAny, {
1947
- message: string;
1948
- title: string;
1949
- category: "custom" | "automation" | "report" | "invoiceValidation";
1950
- companyId: string;
1951
- user: {
1952
- userSub: string;
1953
- name?: string | undefined;
1954
- email?: string | undefined;
1955
- };
1956
- severity: "info" | "critical" | "medium" | "high" | "low";
1957
- notificationType: "notification" | "alert";
1958
- channels: {
1959
- email: boolean;
1960
- sms: boolean;
1961
- inApp?: boolean | undefined;
1962
- };
1963
- metadata?: Record<string, any> | undefined;
1964
- actions?: {
1965
- type: "viewDetails" | "acknowledge" | "dismiss";
1966
- label: string;
1967
- route?: {
1968
- name: string;
1969
- params?: Record<string, any> | undefined;
1970
- } | undefined;
1971
- icon?: string | undefined;
1972
- api?: {
1973
- endpoint: string;
1974
- method: string;
1975
- payload?: Record<string, any> | undefined;
1976
- } | undefined;
1977
- }[] | undefined;
1978
- alertTriggerId?: string | undefined;
1979
- alertTemplateId?: string | undefined;
1980
- }, {
1981
- message: string;
1982
- title: string;
1983
- category: "custom" | "automation" | "report" | "invoiceValidation";
1984
- companyId: string;
1985
- user: {
1986
- userSub: string;
1987
- name?: string | undefined;
1988
- email?: string | undefined;
1989
- };
1990
- notificationType: "notification" | "alert";
1991
- channels: {
1992
- email: boolean;
1993
- sms: boolean;
1994
- inApp?: boolean | undefined;
1995
- };
1996
- metadata?: Record<string, any> | undefined;
1997
- severity?: "info" | "critical" | "medium" | "high" | "low" | undefined;
1998
- actions?: {
1999
- type: "viewDetails" | "acknowledge" | "dismiss";
2000
- label: string;
2001
- route?: {
2002
- name: string;
2003
- params?: Record<string, any> | undefined;
2004
- } | undefined;
2005
- icon?: string | undefined;
2006
- api?: {
2007
- endpoint: string;
2008
- method: string;
2009
- payload?: Record<string, any> | undefined;
2010
- } | undefined;
2011
- }[] | undefined;
2012
- alertTriggerId?: string | undefined;
2013
- alertTemplateId?: string | undefined;
2014
- }>;
2015
- type SendNotificationOptions = z.infer<typeof SendNotificationOptionsSchema>;
2016
- type CreatedNotification = Notification<string>;
2017
- interface NotificationContext {
2018
- db?: Db;
2019
- api?: ReturnType<typeof _default$5>;
2020
- }
2021
- declare function sendBulkNotifications(notifications: SendNotificationOptions[], context: NotificationContext): Promise<CreatedNotification[]>;
2022
- declare function sendNotification(options: SendNotificationOptions, context: NotificationContext): Promise<CreatedNotification>;
2023
- declare const _default: {
2024
- sendNotification: typeof sendNotification;
2025
- 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;
2026
1950
  };
1951
+ declare function sendNotificationMessage<T extends NotificationType>({ eventName, context, input, options }: SendNotificationParams<T>): Promise<{
1952
+ messageId: string;
1953
+ }>;
2027
1954
 
2028
- type notification_NotificationContext = NotificationContext;
2029
- type notification_SendNotificationOptions = SendNotificationOptions;
2030
- declare const notification_sendBulkNotifications: typeof sendBulkNotifications;
2031
- declare const notification_sendNotification: typeof sendNotification;
2032
- declare namespace notification {
2033
- 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 };
2034
1958
  }
2035
1959
 
2036
1960
  interface ConsumptionData {
@@ -2086,7 +2010,7 @@ interface StepFunctionEvent {
2086
2010
  }
2087
2011
  declare class IngestHandler {
2088
2012
  protected event: SQSEvent | SNSEvent | APIGatewayEvent | S3Event;
2089
- protected log: ReturnType<typeof _default$3>;
2013
+ protected log: ReturnType<typeof _default$2>;
2090
2014
  protected sqsReceiptHandle: string | undefined;
2091
2015
  constructor(event: any);
2092
2016
  isSQSEvent(event: any): event is SQSEvent;
@@ -2193,7 +2117,7 @@ type ETNModels = keyof typeof models;
2193
2117
  declare abstract class Model {
2194
2118
  openai: OpenAI;
2195
2119
  protected models: Record<ETNModels, ETNModel>;
2196
- protected log: ReturnType<typeof _default$3>;
2120
+ protected log: ReturnType<typeof _default$2>;
2197
2121
  constructor();
2198
2122
  }
2199
2123
 
@@ -2249,4 +2173,4 @@ declare namespace scrapers {
2249
2173
  export type { scrapers_ETNAccount as ETNAccount };
2250
2174
  }
2251
2175
 
2252
- 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 };