@superdangerous/app-framework 4.9.2 → 4.15.0
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/README.md +8 -2
- package/dist/api/logsRouter.d.ts +4 -1
- package/dist/api/logsRouter.d.ts.map +1 -1
- package/dist/api/logsRouter.js +100 -118
- package/dist/api/logsRouter.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/middleware/validation.d.ts +48 -43
- package/dist/middleware/validation.d.ts.map +1 -1
- package/dist/middleware/validation.js +48 -43
- package/dist/middleware/validation.js.map +1 -1
- package/dist/services/emailService.d.ts +146 -0
- package/dist/services/emailService.d.ts.map +1 -0
- package/dist/services/emailService.js +649 -0
- package/dist/services/emailService.js.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/websocketServer.d.ts +7 -4
- package/dist/services/websocketServer.d.ts.map +1 -1
- package/dist/services/websocketServer.js +22 -16
- package/dist/services/websocketServer.js.map +1 -1
- package/dist/types/index.d.ts +7 -8
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +11 -2
- package/src/api/logsRouter.ts +119 -138
- package/src/index.ts +14 -0
- package/src/middleware/validation.ts +82 -90
- package/src/services/emailService.ts +812 -0
- package/src/services/index.ts +14 -0
- package/src/services/websocketServer.ts +37 -23
- package/src/types/index.ts +7 -8
- package/ui/data-table/components/BatchActionsBar.tsx +53 -0
- package/ui/data-table/components/ColumnVisibility.tsx +111 -0
- package/ui/data-table/components/DataTablePage.tsx +238 -0
- package/ui/data-table/components/Pagination.tsx +203 -0
- package/ui/data-table/components/PaginationControls.tsx +122 -0
- package/ui/data-table/components/TableFilters.tsx +139 -0
- package/ui/data-table/components/index.ts +27 -0
- package/ui/data-table/hooks/index.ts +17 -0
- package/ui/data-table/hooks/useColumnOrder.ts +233 -0
- package/ui/data-table/hooks/useColumnVisibility.ts +128 -0
- package/ui/data-table/hooks/usePagination.ts +160 -0
- package/ui/data-table/hooks/useResizableColumns.ts +280 -0
- package/ui/data-table/index.ts +74 -0
- package/ui/dist/index.d.mts +207 -5
- package/ui/dist/index.d.ts +207 -5
- package/ui/dist/index.js +36 -43
- package/ui/dist/index.js.map +1 -1
- package/ui/dist/index.mjs +36 -43
- package/ui/dist/index.mjs.map +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email Service supporting Resend API and Nodemailer SMTP
|
|
3
|
+
* A generic, reusable email service for the app framework.
|
|
4
|
+
* Resend is preferred when API key is configured.
|
|
5
|
+
*/
|
|
6
|
+
import { EventEmitter } from "events";
|
|
7
|
+
export interface EmailOptions {
|
|
8
|
+
to: string | string[];
|
|
9
|
+
subject: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
html?: string;
|
|
12
|
+
attachments?: Array<{
|
|
13
|
+
filename: string;
|
|
14
|
+
content?: string | Buffer;
|
|
15
|
+
path?: string;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export interface EmailConfig {
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
provider?: "resend" | "smtp";
|
|
21
|
+
resend?: {
|
|
22
|
+
apiKey: string;
|
|
23
|
+
};
|
|
24
|
+
smtp?: {
|
|
25
|
+
host: string;
|
|
26
|
+
port: number;
|
|
27
|
+
secure?: boolean;
|
|
28
|
+
auth?: {
|
|
29
|
+
user: string;
|
|
30
|
+
pass: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
from?: string;
|
|
34
|
+
to?: string[];
|
|
35
|
+
appName?: string;
|
|
36
|
+
appTitle?: string;
|
|
37
|
+
logoUrl?: string;
|
|
38
|
+
brandColor?: string;
|
|
39
|
+
footerText?: string;
|
|
40
|
+
footerLink?: string;
|
|
41
|
+
}
|
|
42
|
+
export type NotificationEventType = "startup" | "shutdown" | "error" | "warning" | "info" | "success" | "custom";
|
|
43
|
+
export interface NotificationEvent {
|
|
44
|
+
type: NotificationEventType;
|
|
45
|
+
title?: string;
|
|
46
|
+
data: Record<string, unknown>;
|
|
47
|
+
timestamp: Date;
|
|
48
|
+
}
|
|
49
|
+
export interface EmailServiceStatus {
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
provider: "Resend" | "SMTP" | "None";
|
|
52
|
+
recipients: string[];
|
|
53
|
+
}
|
|
54
|
+
export declare class EmailService extends EventEmitter {
|
|
55
|
+
private transporter?;
|
|
56
|
+
private resend?;
|
|
57
|
+
private enabled;
|
|
58
|
+
private useResend;
|
|
59
|
+
private notificationQueue;
|
|
60
|
+
private processingInterval?;
|
|
61
|
+
private fromAddress;
|
|
62
|
+
private defaultRecipients;
|
|
63
|
+
private config;
|
|
64
|
+
private appName;
|
|
65
|
+
private appTitle;
|
|
66
|
+
private logoUrl?;
|
|
67
|
+
private brandColor;
|
|
68
|
+
private footerText?;
|
|
69
|
+
private footerLink?;
|
|
70
|
+
constructor(config?: EmailConfig);
|
|
71
|
+
/**
|
|
72
|
+
* Initialize the email service
|
|
73
|
+
*/
|
|
74
|
+
initialize(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Update branding configuration
|
|
77
|
+
*/
|
|
78
|
+
setBranding(options: {
|
|
79
|
+
appName?: string;
|
|
80
|
+
appTitle?: string;
|
|
81
|
+
logoUrl?: string;
|
|
82
|
+
brandColor?: string;
|
|
83
|
+
footerText?: string;
|
|
84
|
+
footerLink?: string;
|
|
85
|
+
}): void;
|
|
86
|
+
/**
|
|
87
|
+
* Send an email
|
|
88
|
+
*/
|
|
89
|
+
sendEmail(options: EmailOptions): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Queue a notification event
|
|
92
|
+
*/
|
|
93
|
+
queueNotification(event: NotificationEvent): void;
|
|
94
|
+
/**
|
|
95
|
+
* Send immediate notification (bypasses queue)
|
|
96
|
+
*/
|
|
97
|
+
sendImmediateNotification(event: NotificationEvent): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Send a notification with custom type and data
|
|
100
|
+
*/
|
|
101
|
+
notify(type: NotificationEventType, title: string, data: Record<string, unknown>, immediate?: boolean): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Send startup notification
|
|
104
|
+
*/
|
|
105
|
+
notifyStartup(data?: Record<string, unknown>): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Send error notification
|
|
108
|
+
*/
|
|
109
|
+
notifyError(errorMessage: string, details?: Record<string, unknown>): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Send test email
|
|
112
|
+
*/
|
|
113
|
+
sendTestEmail(): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Get service status
|
|
116
|
+
*/
|
|
117
|
+
getStatus(): EmailServiceStatus;
|
|
118
|
+
/**
|
|
119
|
+
* Shutdown the service
|
|
120
|
+
*/
|
|
121
|
+
shutdown(): Promise<void>;
|
|
122
|
+
private startNotificationProcessor;
|
|
123
|
+
private processNotificationQueue;
|
|
124
|
+
private groupNotificationsByType;
|
|
125
|
+
private sendNotificationEmail;
|
|
126
|
+
private getNotificationSubject;
|
|
127
|
+
private getNotificationIcon;
|
|
128
|
+
private getAccentColor;
|
|
129
|
+
private formatDateTime;
|
|
130
|
+
private formatEventDataHtml;
|
|
131
|
+
private formatNotificationHtml;
|
|
132
|
+
private formatNotificationText;
|
|
133
|
+
private formatEventDataText;
|
|
134
|
+
private getNotificationTitle;
|
|
135
|
+
private generateTestEmailHtml;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get the email service instance (singleton)
|
|
139
|
+
*/
|
|
140
|
+
export declare function getEmailService(): EmailService | null;
|
|
141
|
+
/**
|
|
142
|
+
* Create and initialize the email service
|
|
143
|
+
*/
|
|
144
|
+
export declare function createEmailService(config: EmailConfig): Promise<EmailService>;
|
|
145
|
+
export default EmailService;
|
|
146
|
+
//# sourceMappingURL=emailService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emailService.d.ts","sourceRoot":"","sources":["../../src/services/emailService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAmBtC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,IAAI,CAAC,EAAE;YACL,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB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