@bernierllc/email 1.0.0 → 1.1.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 +76 -217
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/simple-email-service.d.ts +58 -0
- package/dist/simple-email-service.d.ts.map +1 -0
- package/dist/simple-email-service.js +416 -0
- package/dist/simple-email-service.js.map +1 -0
- package/dist/types.d.ts +311 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +33 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -22
- package/.eslintrc.json +0 -112
- package/.flake8 +0 -18
- package/.github/workflows/ci.yml +0 -300
- package/EXTRACTION_SUMMARY.md +0 -265
- package/IMPLEMENTATION_STATUS.md +0 -159
- package/OPEN_SOURCE_SETUP.md +0 -420
- package/PACKAGE_USAGE.md +0 -471
- package/examples/fastapi-example/main.py +0 -257
- package/examples/nextjs-example/next-env.d.ts +0 -13
- package/examples/nextjs-example/package.json +0 -26
- package/examples/nextjs-example/pages/admin/templates.tsx +0 -157
- package/examples/nextjs-example/tsconfig.json +0 -28
- package/packages/core/package.json +0 -70
- package/packages/core/rollup.config.js +0 -37
- package/packages/core/specification.md +0 -416
- package/packages/core/src/adapters/supabase.ts +0 -291
- package/packages/core/src/core/scheduler.ts +0 -356
- package/packages/core/src/core/template-manager.ts +0 -388
- package/packages/core/src/index.ts +0 -30
- package/packages/core/src/providers/base.ts +0 -104
- package/packages/core/src/providers/sendgrid.ts +0 -368
- package/packages/core/src/types/provider.ts +0 -91
- package/packages/core/src/types/scheduled.ts +0 -78
- package/packages/core/src/types/template.ts +0 -97
- package/packages/core/tsconfig.json +0 -23
- package/packages/python/README.md +0 -106
- package/packages/python/email_template_manager/__init__.py +0 -66
- package/packages/python/email_template_manager/config.py +0 -98
- package/packages/python/email_template_manager/core/magic_links.py +0 -245
- package/packages/python/email_template_manager/core/manager.py +0 -344
- package/packages/python/email_template_manager/core/scheduler.py +0 -473
- package/packages/python/email_template_manager/exceptions.py +0 -67
- package/packages/python/email_template_manager/models/magic_link.py +0 -59
- package/packages/python/email_template_manager/models/scheduled.py +0 -78
- package/packages/python/email_template_manager/models/template.py +0 -90
- package/packages/python/email_template_manager/providers/aws_ses.py +0 -44
- package/packages/python/email_template_manager/providers/base.py +0 -94
- package/packages/python/email_template_manager/providers/sendgrid.py +0 -325
- package/packages/python/email_template_manager/providers/smtp.py +0 -44
- package/packages/python/pyproject.toml +0 -133
- package/packages/python/setup.py +0 -93
- package/packages/python/specification.md +0 -930
- package/packages/react/README.md +0 -13
- package/packages/react/package.json +0 -105
- package/packages/react/rollup.config.js +0 -37
- package/packages/react/specification.md +0 -569
- package/packages/react/src/index.ts +0 -20
- package/packages/react/tsconfig.json +0 -24
- package/src/index.js +0 -1
- package/test_package.py +0 -125
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email service configuration options
|
|
3
|
+
*/
|
|
4
|
+
export interface EmailServiceConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Email provider configuration
|
|
7
|
+
*/
|
|
8
|
+
provider: {
|
|
9
|
+
type: 'smtp' | 'sendgrid' | 'ses' | 'mailgun' | 'postmark';
|
|
10
|
+
config: Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Default sender information
|
|
14
|
+
*/
|
|
15
|
+
defaults?: {
|
|
16
|
+
from?: string;
|
|
17
|
+
replyTo?: string;
|
|
18
|
+
subject?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Template engine configuration
|
|
22
|
+
*/
|
|
23
|
+
templates?: {
|
|
24
|
+
engine: 'liquid' | 'handlebars';
|
|
25
|
+
templateDir?: string;
|
|
26
|
+
cache?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Magic link configuration for authentication emails
|
|
30
|
+
*/
|
|
31
|
+
magicLink?: {
|
|
32
|
+
secret: string;
|
|
33
|
+
expirationMinutes?: number;
|
|
34
|
+
issuer?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Retry configuration for failed email delivery
|
|
38
|
+
*/
|
|
39
|
+
retry?: {
|
|
40
|
+
maxRetries?: number;
|
|
41
|
+
initialDelayMs?: number;
|
|
42
|
+
maxDelayMs?: number;
|
|
43
|
+
jitter?: boolean;
|
|
44
|
+
enableMetrics?: boolean;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Rate limiting configuration
|
|
48
|
+
*/
|
|
49
|
+
rateLimit?: {
|
|
50
|
+
maxEmailsPerMinute?: number;
|
|
51
|
+
maxEmailsPerHour?: number;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Email message structure
|
|
56
|
+
*/
|
|
57
|
+
export interface EmailMessage {
|
|
58
|
+
to: string | string[];
|
|
59
|
+
from?: string;
|
|
60
|
+
replyTo?: string;
|
|
61
|
+
subject: string;
|
|
62
|
+
text?: string;
|
|
63
|
+
html?: string;
|
|
64
|
+
cc?: string | string[];
|
|
65
|
+
bcc?: string | string[];
|
|
66
|
+
attachments?: EmailAttachment[];
|
|
67
|
+
templateData?: Record<string, any>;
|
|
68
|
+
priority?: EmailPriority;
|
|
69
|
+
tags?: string[];
|
|
70
|
+
metadata?: Record<string, any>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Email template message with template rendering
|
|
74
|
+
*/
|
|
75
|
+
export interface TemplateEmailMessage extends Omit<EmailMessage, 'text' | 'html'> {
|
|
76
|
+
template: string;
|
|
77
|
+
templateData: Record<string, any>;
|
|
78
|
+
engine?: 'liquid' | 'handlebars';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Magic link email configuration
|
|
82
|
+
*/
|
|
83
|
+
export interface MagicLinkEmail extends Omit<EmailMessage, 'text' | 'html'> {
|
|
84
|
+
recipient: string;
|
|
85
|
+
purpose: string;
|
|
86
|
+
redirectUrl: string;
|
|
87
|
+
template?: string;
|
|
88
|
+
customData?: Record<string, any>;
|
|
89
|
+
expirationMinutes?: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Email attachment structure
|
|
93
|
+
*/
|
|
94
|
+
export interface EmailAttachment {
|
|
95
|
+
filename: string;
|
|
96
|
+
content: Buffer | string;
|
|
97
|
+
contentType?: string;
|
|
98
|
+
encoding?: string;
|
|
99
|
+
cid?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Email priority levels
|
|
103
|
+
*/
|
|
104
|
+
export declare enum EmailPriority {
|
|
105
|
+
LOW = "low",
|
|
106
|
+
NORMAL = "normal",
|
|
107
|
+
HIGH = "high",
|
|
108
|
+
URGENT = "urgent"
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Email sending result
|
|
112
|
+
*/
|
|
113
|
+
export interface EmailResult {
|
|
114
|
+
success: boolean;
|
|
115
|
+
messageId?: string;
|
|
116
|
+
error?: string;
|
|
117
|
+
provider?: string;
|
|
118
|
+
timestamp: Date;
|
|
119
|
+
retryCount?: number;
|
|
120
|
+
deliveryTime?: number;
|
|
121
|
+
metadata?: Record<string, any>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Bulk email operation result
|
|
125
|
+
*/
|
|
126
|
+
export interface BulkEmailResult {
|
|
127
|
+
totalEmails: number;
|
|
128
|
+
successful: number;
|
|
129
|
+
failed: number;
|
|
130
|
+
results: EmailResult[];
|
|
131
|
+
errors: string[];
|
|
132
|
+
summary: {
|
|
133
|
+
successRate: number;
|
|
134
|
+
averageDeliveryTime: number;
|
|
135
|
+
totalRetries: number;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Magic link generation result
|
|
140
|
+
*/
|
|
141
|
+
export interface MagicLinkResult {
|
|
142
|
+
success: boolean;
|
|
143
|
+
magicLink?: string;
|
|
144
|
+
token?: string;
|
|
145
|
+
expiresAt?: Date;
|
|
146
|
+
error?: string;
|
|
147
|
+
emailResult?: EmailResult;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Email delivery status
|
|
151
|
+
*/
|
|
152
|
+
export declare enum DeliveryStatus {
|
|
153
|
+
PENDING = "pending",
|
|
154
|
+
SENT = "sent",
|
|
155
|
+
DELIVERED = "delivered",
|
|
156
|
+
FAILED = "failed",
|
|
157
|
+
BOUNCED = "bounced",
|
|
158
|
+
COMPLAINED = "complained"
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Email delivery tracking
|
|
162
|
+
*/
|
|
163
|
+
export interface EmailDeliveryInfo {
|
|
164
|
+
messageId: string;
|
|
165
|
+
status: DeliveryStatus;
|
|
166
|
+
timestamp: Date;
|
|
167
|
+
recipient: string;
|
|
168
|
+
subject: string;
|
|
169
|
+
provider: string;
|
|
170
|
+
retryCount: number;
|
|
171
|
+
error?: string;
|
|
172
|
+
events: DeliveryEvent[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Email delivery event
|
|
176
|
+
*/
|
|
177
|
+
export interface DeliveryEvent {
|
|
178
|
+
event: string;
|
|
179
|
+
timestamp: Date;
|
|
180
|
+
description?: string;
|
|
181
|
+
metadata?: Record<string, any>;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Email service metrics
|
|
185
|
+
*/
|
|
186
|
+
export interface EmailMetrics {
|
|
187
|
+
totalSent: number;
|
|
188
|
+
totalDelivered: number;
|
|
189
|
+
totalFailed: number;
|
|
190
|
+
successRate: number;
|
|
191
|
+
averageDeliveryTime: number;
|
|
192
|
+
retryRate: number;
|
|
193
|
+
bounceRate: number;
|
|
194
|
+
complaintRate: number;
|
|
195
|
+
providerStats: Record<string, ProviderMetrics>;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Provider-specific metrics
|
|
199
|
+
*/
|
|
200
|
+
export interface ProviderMetrics {
|
|
201
|
+
sent: number;
|
|
202
|
+
delivered: number;
|
|
203
|
+
failed: number;
|
|
204
|
+
averageDeliveryTime: number;
|
|
205
|
+
errorTypes: Record<string, number>;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Template validation result
|
|
209
|
+
*/
|
|
210
|
+
export interface TemplateValidationResult {
|
|
211
|
+
isValid: boolean;
|
|
212
|
+
errors: string[];
|
|
213
|
+
warnings: string[];
|
|
214
|
+
requiredVariables: string[];
|
|
215
|
+
optionalVariables: string[];
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Email queue configuration
|
|
219
|
+
*/
|
|
220
|
+
export interface EmailQueueConfig {
|
|
221
|
+
maxConcurrency?: number;
|
|
222
|
+
batchSize?: number;
|
|
223
|
+
retryDelay?: number;
|
|
224
|
+
priorityLevels?: boolean;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Scheduled email configuration
|
|
228
|
+
*/
|
|
229
|
+
export interface ScheduledEmail extends EmailMessage {
|
|
230
|
+
scheduledFor: Date;
|
|
231
|
+
timezone?: string;
|
|
232
|
+
recurring?: {
|
|
233
|
+
pattern: 'daily' | 'weekly' | 'monthly';
|
|
234
|
+
interval?: number;
|
|
235
|
+
endDate?: Date;
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Email campaign configuration
|
|
240
|
+
*/
|
|
241
|
+
export interface EmailCampaign {
|
|
242
|
+
name: string;
|
|
243
|
+
description?: string;
|
|
244
|
+
template: string;
|
|
245
|
+
recipients: CampaignRecipient[];
|
|
246
|
+
schedule?: {
|
|
247
|
+
startTime: Date;
|
|
248
|
+
timezone?: string;
|
|
249
|
+
batchSize?: number;
|
|
250
|
+
delayBetweenBatches?: number;
|
|
251
|
+
};
|
|
252
|
+
tracking?: {
|
|
253
|
+
trackOpens?: boolean;
|
|
254
|
+
trackClicks?: boolean;
|
|
255
|
+
trackUnsubscribes?: boolean;
|
|
256
|
+
};
|
|
257
|
+
metadata?: Record<string, any>;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Campaign recipient with personalization data
|
|
261
|
+
*/
|
|
262
|
+
export interface CampaignRecipient {
|
|
263
|
+
email: string;
|
|
264
|
+
name?: string;
|
|
265
|
+
personalData?: Record<string, any>;
|
|
266
|
+
subscriptionStatus?: 'subscribed' | 'unsubscribed' | 'bounced';
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Email service interface
|
|
270
|
+
*/
|
|
271
|
+
export interface IEmailService {
|
|
272
|
+
/**
|
|
273
|
+
* Send a single email
|
|
274
|
+
*/
|
|
275
|
+
send(message: EmailMessage): Promise<EmailResult>;
|
|
276
|
+
/**
|
|
277
|
+
* Send an email using a template
|
|
278
|
+
*/
|
|
279
|
+
sendTemplate(message: TemplateEmailMessage): Promise<EmailResult>;
|
|
280
|
+
/**
|
|
281
|
+
* Send a magic link email
|
|
282
|
+
*/
|
|
283
|
+
sendMagicLink(config: MagicLinkEmail): Promise<MagicLinkResult>;
|
|
284
|
+
/**
|
|
285
|
+
* Send multiple emails
|
|
286
|
+
*/
|
|
287
|
+
sendBulk(messages: EmailMessage[]): Promise<BulkEmailResult>;
|
|
288
|
+
/**
|
|
289
|
+
* Validate an email template
|
|
290
|
+
*/
|
|
291
|
+
validateTemplate(template: string, engine?: 'liquid' | 'handlebars'): Promise<TemplateValidationResult>;
|
|
292
|
+
/**
|
|
293
|
+
* Get email delivery metrics
|
|
294
|
+
*/
|
|
295
|
+
getMetrics(timeRange?: {
|
|
296
|
+
start: Date;
|
|
297
|
+
end: Date;
|
|
298
|
+
}): Promise<EmailMetrics>;
|
|
299
|
+
/**
|
|
300
|
+
* Track email delivery status
|
|
301
|
+
*/
|
|
302
|
+
getDeliveryStatus(messageId: string): Promise<EmailDeliveryInfo | null>;
|
|
303
|
+
/**
|
|
304
|
+
* Test email configuration
|
|
305
|
+
*/
|
|
306
|
+
testConfiguration(): Promise<{
|
|
307
|
+
success: boolean;
|
|
308
|
+
error?: string;
|
|
309
|
+
}>;
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;QAC3D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC7B,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,MAAM,EAAE,QAAQ,GAAG,YAAY,CAAC;QAChC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IAEF;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IAEF;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,gBAAgB,CAAC,EAAE,M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|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (c) 2025 Bernier LLC
|
|
4
|
+
|
|
5
|
+
This file is licensed to the client under a limited-use license.
|
|
6
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.DeliveryStatus = exports.EmailPriority = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Email priority levels
|
|
13
|
+
*/
|
|
14
|
+
var EmailPriority;
|
|
15
|
+
(function (EmailPriority) {
|
|
16
|
+
EmailPriority["LOW"] = "low";
|
|
17
|
+
EmailPriority["NORMAL"] = "normal";
|
|
18
|
+
EmailPriority["HIGH"] = "high";
|
|
19
|
+
EmailPriority["URGENT"] = "urgent";
|
|
20
|
+
})(EmailPriority || (exports.EmailPriority = EmailPriority = {}));
|
|
21
|
+
/**
|
|
22
|
+
* Email delivery status
|
|
23
|
+
*/
|
|
24
|
+
var DeliveryStatus;
|
|
25
|
+
(function (DeliveryStatus) {
|
|
26
|
+
DeliveryStatus["PENDING"] = "pending";
|
|
27
|
+
DeliveryStatus["SENT"] = "sent";
|
|
28
|
+
DeliveryStatus["DELIVERED"] = "delivered";
|
|
29
|
+
DeliveryStatus["FAILED"] = "failed";
|
|
30
|
+
DeliveryStatus["BOUNCED"] = "bounced";
|
|
31
|
+
DeliveryStatus["COMPLAINED"] = "complained";
|
|
32
|
+
})(DeliveryStatus || (exports.DeliveryStatus = DeliveryStatus = {}));
|
|
33
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAgHF;;GAEG;AACH,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,4BAAW,CAAA;IACX,kCAAiB,CAAA;IACjB,8BAAa,CAAA;IACb,kCAAiB,CAAA;AACnB,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB;AA4CD;;GAEG;AACH,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;AAC3B,CAAC,EAPW,cAAc,8BAAd,cAAc,QAOzB"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/email",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"deprecated": "This package is deprecated. Please use @bernierllc/email-service instead. See https://github.com/BernierLLC/tools/blob/main/packages/service/email-service/MIGRATION.md for migration guide.",
|
|
5
|
+
"description": "A comprehensive email service that orchestrates sending, templates, authentication, and retry logic",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"email",
|
|
10
|
+
"service",
|
|
11
|
+
"templates",
|
|
12
|
+
"authentication",
|
|
13
|
+
"magic-link",
|
|
14
|
+
"retry",
|
|
15
|
+
"reliability",
|
|
16
|
+
"orchestration",
|
|
17
|
+
"typescript"
|
|
18
|
+
],
|
|
10
19
|
"author": "Bernier LLC",
|
|
11
|
-
"license": "
|
|
20
|
+
"license": "Bernier LLC",
|
|
12
21
|
"repository": {
|
|
13
22
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/
|
|
23
|
+
"url": "https://github.com/bernierllc/tools.git",
|
|
24
|
+
"directory": "packages/service/email"
|
|
15
25
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"@
|
|
20
|
-
"
|
|
21
|
-
"
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@bernierllc/email-sender": "^0.2.4",
|
|
28
|
+
"@bernierllc/email-parser": "^0.1.1",
|
|
29
|
+
"@bernierllc/email-validator": "^1.0.3",
|
|
30
|
+
"@bernierllc/crypto-utils": "^1.0.2",
|
|
31
|
+
"@bernierllc/retry-policy": "^0.1.1",
|
|
32
|
+
"@bernierllc/retry-state": "^0.1.1",
|
|
33
|
+
"@bernierllc/retry-metrics": "^0.1.1"
|
|
22
34
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/jest": "^29.5.12",
|
|
37
|
+
"@types/node": "^20.11.19",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
39
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
40
|
+
"eslint": "^8.0.0",
|
|
41
|
+
"jest": "^29.7.0",
|
|
42
|
+
"ts-jest": "^29.1.2",
|
|
43
|
+
"typescript": "^5.3.3"
|
|
27
44
|
},
|
|
28
45
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
30
|
-
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist/**/*",
|
|
50
|
+
"README.md",
|
|
51
|
+
"LICENSE"
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsc",
|
|
55
|
+
"test": "jest",
|
|
56
|
+
"test:watch": "jest --watch",
|
|
57
|
+
"test:coverage": "jest --coverage",
|
|
58
|
+
"lint": "eslint src --ext .ts",
|
|
59
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
60
|
+
"clean": "rm -rf dist",
|
|
61
|
+
"prebuild": "npm run clean"
|
|
31
62
|
}
|
|
32
|
-
}
|
|
63
|
+
}
|
package/.eslintrc.json
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright (c) 2025 Bernier LLC
|
|
3
|
-
//
|
|
4
|
-
// This file is licensed to the client under a limited-use license.
|
|
5
|
-
// The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
-
// Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
//
|
|
8
|
-
{
|
|
9
|
-
"extends": [
|
|
10
|
-
"plugin:react/recommended",
|
|
11
|
-
"plugin:react-hooks/recommended",
|
|
12
|
-
"plugin:jsx-a11y/recommended",
|
|
13
|
-
"plugin:@typescript-eslint/recommended"
|
|
14
|
-
],
|
|
15
|
-
"plugins": [
|
|
16
|
-
"react",
|
|
17
|
-
"react-hooks",
|
|
18
|
-
"jsx-a11y",
|
|
19
|
-
"@typescript-eslint"
|
|
20
|
-
],
|
|
21
|
-
"rules": {
|
|
22
|
-
"no-object-rendering": "error",
|
|
23
|
-
"react/jsx-no-undef": "error",
|
|
24
|
-
"react/jsx-uses-react": "error",
|
|
25
|
-
"react/jsx-uses-vars": "error",
|
|
26
|
-
"react/no-unescaped-entities": "error",
|
|
27
|
-
"react/no-unknown-property": "error",
|
|
28
|
-
"react/self-closing-comp": "error",
|
|
29
|
-
"react/jsx-key": "error",
|
|
30
|
-
"react/jsx-no-duplicate-props": "error",
|
|
31
|
-
"react/jsx-no-target-blank": "error",
|
|
32
|
-
"react/jsx-pascal-case": "error",
|
|
33
|
-
"react/jsx-wrap-multilines": "error",
|
|
34
|
-
"react/jsx-curly-brace-presence": ["error", { "props": "never", "children": "never" }],
|
|
35
|
-
"@typescript-eslint/no-unused-vars": "error",
|
|
36
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
37
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
38
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
39
|
-
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
40
|
-
"react-hooks/rules-of-hooks": "error",
|
|
41
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
42
|
-
"jsx-a11y/alt-text": "error",
|
|
43
|
-
"jsx-a11y/anchor-has-content": "error",
|
|
44
|
-
"jsx-a11y/anchor-is-valid": "error",
|
|
45
|
-
"jsx-a11y/aria-props": "error",
|
|
46
|
-
"jsx-a11y/aria-proptypes": "error",
|
|
47
|
-
"jsx-a11y/aria-unsupported-elements": "error",
|
|
48
|
-
"jsx-a11y/heading-has-content": "error",
|
|
49
|
-
"jsx-a11y/iframe-has-title": "error",
|
|
50
|
-
"jsx-a11y/img-redundant-alt": "error",
|
|
51
|
-
"jsx-a11y/no-access-key": "error",
|
|
52
|
-
"jsx-a11y/no-distracting-elements": "error",
|
|
53
|
-
"jsx-a11y/no-redundant-roles": "error",
|
|
54
|
-
"jsx-a11y/role-has-required-aria-props": "error",
|
|
55
|
-
"jsx-a11y/role-supports-aria-props": "error",
|
|
56
|
-
"jsx-a11y/scope": "error",
|
|
57
|
-
"jsx-a11y/label-has-associated-control": "error",
|
|
58
|
-
"jsx-a11y/control-has-associated-label": "error",
|
|
59
|
-
"jsx-a11y/click-events-have-key-events": "error",
|
|
60
|
-
"jsx-a11y/no-static-element-interactions": "error",
|
|
61
|
-
"jsx-a11y/interactive-supports-focus": "error",
|
|
62
|
-
"jsx-a11y/no-noninteractive-element-interactions": "error",
|
|
63
|
-
"jsx-a11y/no-noninteractive-tabindex": "error",
|
|
64
|
-
"jsx-a11y/tabindex-no-positive": "error",
|
|
65
|
-
"jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
|
|
66
|
-
"jsx-a11y/media-has-caption": "error",
|
|
67
|
-
"jsx-a11y/no-autofocus": "error",
|
|
68
|
-
"no-console": "warn",
|
|
69
|
-
"no-debugger": "error",
|
|
70
|
-
"no-unused-vars": "off",
|
|
71
|
-
"prefer-const": "error",
|
|
72
|
-
"no-var": "error"
|
|
73
|
-
},
|
|
74
|
-
"settings": {
|
|
75
|
-
"react": {
|
|
76
|
-
"version": "detect"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"overrides": [
|
|
80
|
-
{
|
|
81
|
-
"files": ["**/*.ts", "**/*.tsx"],
|
|
82
|
-
"rules": {
|
|
83
|
-
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
|
84
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"files": ["**/forms/**/*.tsx", "**/*Form*.tsx", "**/*form*.tsx"],
|
|
89
|
-
"rules": {
|
|
90
|
-
"jsx-a11y/label-has-associated-control": "error",
|
|
91
|
-
"jsx-a11y/control-has-associated-label": "error",
|
|
92
|
-
"jsx-a11y/no-autofocus": "error"
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"files": ["**/navigation/**/*.tsx", "**/*Nav*.tsx", "**/*nav*.tsx"],
|
|
97
|
-
"rules": {
|
|
98
|
-
"jsx-a11y/click-events-have-key-events": "error",
|
|
99
|
-
"jsx-a11y/no-static-element-interactions": "error",
|
|
100
|
-
"jsx-a11y/interactive-supports-focus": "error"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"files": ["**/modal/**/*.tsx", "**/*Modal*.tsx", "**/*modal*.tsx", "**/*Dialog*.tsx", "**/*dialog*.tsx"],
|
|
105
|
-
"rules": {
|
|
106
|
-
"jsx-a11y/no-autofocus": "error",
|
|
107
|
-
"jsx-a11y/click-events-have-key-events": "error",
|
|
108
|
-
"jsx-a11y/no-static-element-interactions": "error"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
}
|
package/.flake8
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
[flake8]
|
|
2
|
-
# Disable checks for:
|
|
3
|
-
# E501: line too long
|
|
4
|
-
# E201/E202: whitespace after/before '(', '[', or '{'
|
|
5
|
-
# E203: whitespace before ':'
|
|
6
|
-
# E211: whitespace before '('
|
|
7
|
-
# E221/E222/E223/E224/E225/E226/E227/E228: multiple spacing errors
|
|
8
|
-
# E231/E241/E242: missing or extra whitespace after/before comma
|
|
9
|
-
# E261/E262: spaces before inline comment
|
|
10
|
-
# E301/E302/E303/E304: blank line related
|
|
11
|
-
# W291/W292/W293: trailing whitespace and newline issues
|
|
12
|
-
# W391: blank line at end of file
|
|
13
|
-
# Add more codes as needed
|
|
14
|
-
|
|
15
|
-
ignore = E201,E202,E203,E211,E221,E222,E223,E224,E225,E226,E227,E228,E231,E241,E242,E261,E262,E301,E302,E303,E304,E501,W291,W292,W293,W391
|
|
16
|
-
|
|
17
|
-
# Optionally, you can also raise the line length limit to avoid triggering it in other tools
|
|
18
|
-
max-line-length = 999
|