@bernierllc/retry-suite 0.5.14 → 0.5.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin-server.d.ts +30 -0
- package/dist/admin/admin-server.js +335 -0
- package/dist/components/retry-dashboard.d.ts +17 -0
- package/dist/components/retry-dashboard.js +406 -0
- package/dist/config/configuration-manager.d.ts +20 -0
- package/dist/config/configuration-manager.js +310 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.js +24 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +34 -0
- package/dist/integrations/email-integration.d.ts +13 -0
- package/dist/integrations/email-integration.js +231 -0
- package/dist/integrations/integration-manager.d.ts +15 -0
- package/dist/integrations/integration-manager.js +109 -0
- package/dist/integrations/slack-integration.d.ts +10 -0
- package/dist/integrations/slack-integration.js +95 -0
- package/dist/integrations/webhook-integration.d.ts +10 -0
- package/dist/integrations/webhook-integration.js +83 -0
- package/dist/retry-suite.d.ts +36 -0
- package/dist/retry-suite.js +362 -0
- package/dist/types.d.ts +205 -0
- package/dist/types.js +9 -0
- package/package.json +4 -4
|
@@ -0,0 +1,362 @@
|
|
|
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.RetrySuite = void 0;
|
|
11
|
+
// Note: Using simpler approach since actual packages may not be available in dev environment
|
|
12
|
+
// import { RetryManager } from '@bernierllc/retry-manager';
|
|
13
|
+
// import { MemoryRetryStateStorage, createRetryState } from '@bernierllc/retry-state';
|
|
14
|
+
// import { MetricsCollector } from '@bernierllc/retry-metrics';
|
|
15
|
+
// Simple mock implementations for development
|
|
16
|
+
class MockRetryManager {
|
|
17
|
+
config;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.config = config;
|
|
20
|
+
}
|
|
21
|
+
async executeWithRetry(id, fn, options) {
|
|
22
|
+
try {
|
|
23
|
+
const result = await fn();
|
|
24
|
+
return { success: true, result, attempts: 1, error: null };
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return { success: false, result: null, attempts: options?.maxRetries || 3, error };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class MockMemoryStorage {
|
|
32
|
+
data = new Map();
|
|
33
|
+
constructor() { }
|
|
34
|
+
async get(key) { return this.data.get(key); }
|
|
35
|
+
async set(key, value) { this.data.set(key, value); }
|
|
36
|
+
}
|
|
37
|
+
class MockMetricsCollector {
|
|
38
|
+
config;
|
|
39
|
+
constructor(config) {
|
|
40
|
+
this.config = config;
|
|
41
|
+
}
|
|
42
|
+
async getMetrics() {
|
|
43
|
+
return {
|
|
44
|
+
totalRetries: 0,
|
|
45
|
+
successfulRetries: 0,
|
|
46
|
+
failedRetries: 0,
|
|
47
|
+
averageRetryTime: 0
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const admin_server_1 = require("./admin/admin-server");
|
|
52
|
+
const integration_manager_1 = require("./integrations/integration-manager");
|
|
53
|
+
const configuration_manager_1 = require("./config/configuration-manager");
|
|
54
|
+
class RetrySuite {
|
|
55
|
+
retryManager;
|
|
56
|
+
stateStorage;
|
|
57
|
+
metricsCollector;
|
|
58
|
+
adminServer;
|
|
59
|
+
integrationManager;
|
|
60
|
+
configManager;
|
|
61
|
+
config;
|
|
62
|
+
retryStates = new Map();
|
|
63
|
+
metrics;
|
|
64
|
+
constructor(config) {
|
|
65
|
+
this.config = config;
|
|
66
|
+
this.configManager = new configuration_manager_1.ConfigurationManager(config);
|
|
67
|
+
// Initialize core services
|
|
68
|
+
this.stateStorage = new MockMemoryStorage();
|
|
69
|
+
this.metricsCollector = new MockMetricsCollector({
|
|
70
|
+
enabled: config.retryMonitoring.enabled
|
|
71
|
+
});
|
|
72
|
+
this.retryManager = new MockRetryManager({
|
|
73
|
+
defaultOptions: config.retryManager.defaultOptions
|
|
74
|
+
});
|
|
75
|
+
this.adminServer = new admin_server_1.AdminServer(config.admin, this);
|
|
76
|
+
this.integrationManager = new integration_manager_1.IntegrationManager(config.integrations);
|
|
77
|
+
this.metrics = this.initializeMetrics();
|
|
78
|
+
this.setupEventListeners();
|
|
79
|
+
}
|
|
80
|
+
async executeWithRetry(id, fn, options) {
|
|
81
|
+
const startTime = Date.now();
|
|
82
|
+
try {
|
|
83
|
+
// Create retry status tracking
|
|
84
|
+
const retryStatus = {
|
|
85
|
+
id,
|
|
86
|
+
status: 'running',
|
|
87
|
+
attempts: 0,
|
|
88
|
+
maxAttempts: options?.maxRetries || this.config.retryManager.defaultOptions.maxRetries,
|
|
89
|
+
lastAttempt: new Date(),
|
|
90
|
+
metadata: options?.metadata || {}
|
|
91
|
+
};
|
|
92
|
+
this.retryStates.set(id, retryStatus);
|
|
93
|
+
// Execute with the real retry manager
|
|
94
|
+
const result = await this.retryManager.executeWithRetry(id, fn, options);
|
|
95
|
+
const totalTime = Date.now() - startTime;
|
|
96
|
+
// Update status based on result
|
|
97
|
+
retryStatus.status = result.success ? 'completed' : 'failed';
|
|
98
|
+
retryStatus.attempts = result.attempts || 1;
|
|
99
|
+
retryStatus.result = result.success ? result.result : undefined;
|
|
100
|
+
retryStatus.error = result.error?.message;
|
|
101
|
+
// Update metrics
|
|
102
|
+
this.updateMetrics(result, totalTime);
|
|
103
|
+
// Send alerts if needed
|
|
104
|
+
if (!result.success && result.error) {
|
|
105
|
+
await this.sendFailureAlert(id, result.error);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
success: result.success,
|
|
109
|
+
result: result.result,
|
|
110
|
+
error: result.error,
|
|
111
|
+
attempts: result.attempts || 1,
|
|
112
|
+
totalTime
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
await this.sendCriticalAlert(id, error);
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async retryWithBackoff(fn, options) {
|
|
121
|
+
const id = this.generateRetryId();
|
|
122
|
+
const result = await this.executeWithRetry(id, fn, options);
|
|
123
|
+
if (!result.success) {
|
|
124
|
+
throw result.error || new Error('Retry failed');
|
|
125
|
+
}
|
|
126
|
+
return result.result;
|
|
127
|
+
}
|
|
128
|
+
async scheduleRetry(id, fn, scheduleTime) {
|
|
129
|
+
const delay = scheduleTime.getTime() - Date.now();
|
|
130
|
+
if (delay <= 0) {
|
|
131
|
+
return {
|
|
132
|
+
success: false,
|
|
133
|
+
error: 'Schedule time must be in the future'
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const scheduleId = `scheduled_${id}_${Date.now()}`;
|
|
137
|
+
setTimeout(async () => {
|
|
138
|
+
try {
|
|
139
|
+
await this.executeWithRetry(id, fn);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.error(`Scheduled retry ${id} failed:`, error);
|
|
143
|
+
}
|
|
144
|
+
}, delay);
|
|
145
|
+
return {
|
|
146
|
+
success: true,
|
|
147
|
+
scheduleId,
|
|
148
|
+
scheduledTime: scheduleTime
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
async getRetryStatus(id) {
|
|
152
|
+
return this.retryStates.get(id) || null;
|
|
153
|
+
}
|
|
154
|
+
async cancelRetry(id) {
|
|
155
|
+
const status = this.retryStates.get(id);
|
|
156
|
+
if (!status) {
|
|
157
|
+
return {
|
|
158
|
+
success: false,
|
|
159
|
+
message: `Retry ${id} not found`
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (status.status === 'completed' || status.status === 'failed') {
|
|
163
|
+
return {
|
|
164
|
+
success: false,
|
|
165
|
+
message: `Retry ${id} has already finished`
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
status.status = 'cancelled';
|
|
169
|
+
this.retryStates.set(id, status);
|
|
170
|
+
return {
|
|
171
|
+
success: true,
|
|
172
|
+
message: `Retry ${id} cancelled successfully`
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async pauseRetry(id) {
|
|
176
|
+
const status = this.retryStates.get(id);
|
|
177
|
+
if (!status) {
|
|
178
|
+
return {
|
|
179
|
+
success: false,
|
|
180
|
+
message: `Retry ${id} not found`
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (status.status !== 'running') {
|
|
184
|
+
return {
|
|
185
|
+
success: false,
|
|
186
|
+
message: `Retry ${id} is not currently running`
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
status.status = 'paused';
|
|
190
|
+
this.retryStates.set(id, status);
|
|
191
|
+
return {
|
|
192
|
+
success: true,
|
|
193
|
+
message: `Retry ${id} paused successfully`
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
async resumeRetry(id) {
|
|
197
|
+
const status = this.retryStates.get(id);
|
|
198
|
+
if (!status) {
|
|
199
|
+
return {
|
|
200
|
+
success: false,
|
|
201
|
+
message: `Retry ${id} not found`
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
if (status.status !== 'paused') {
|
|
205
|
+
return {
|
|
206
|
+
success: false,
|
|
207
|
+
message: `Retry ${id} is not paused`
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
status.status = 'running';
|
|
211
|
+
this.retryStates.set(id, status);
|
|
212
|
+
return {
|
|
213
|
+
success: true,
|
|
214
|
+
message: `Retry ${id} resumed successfully`
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
async getMetrics(options) {
|
|
218
|
+
try {
|
|
219
|
+
const collectedMetrics = await this.metricsCollector.getMetrics();
|
|
220
|
+
// Combine local metrics with collected metrics
|
|
221
|
+
const combinedMetrics = {
|
|
222
|
+
...this.metrics,
|
|
223
|
+
totalRetries: collectedMetrics.totalRetries || this.metrics.totalRetries,
|
|
224
|
+
successfulRetries: collectedMetrics.successfulRetries || this.metrics.successfulRetries,
|
|
225
|
+
failedRetries: collectedMetrics.failedRetries || this.metrics.failedRetries,
|
|
226
|
+
averageRetryTime: collectedMetrics.averageRetryTime || this.metrics.averageRetryTime,
|
|
227
|
+
retrySuccessRate: (collectedMetrics.totalRetries > 0 ?
|
|
228
|
+
(collectedMetrics.successfulRetries / collectedMetrics.totalRetries * 100) :
|
|
229
|
+
this.metrics.retrySuccessRate),
|
|
230
|
+
activeRetries: this.retryStates.size,
|
|
231
|
+
topFailureReasons: this.metrics.topFailureReasons,
|
|
232
|
+
performanceByHour: this.metrics.performanceByHour,
|
|
233
|
+
storageUsage: this.metrics.storageUsage
|
|
234
|
+
};
|
|
235
|
+
return combinedMetrics;
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
console.error('Failed to get metrics:', error);
|
|
239
|
+
return { ...this.metrics };
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async getAlerts(options) {
|
|
243
|
+
// For now, return empty array - would integrate with monitoring service
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
async getPerformanceReport(options) {
|
|
247
|
+
const metrics = await this.getMetrics();
|
|
248
|
+
const alerts = await this.getAlerts();
|
|
249
|
+
return {
|
|
250
|
+
period: {
|
|
251
|
+
startDate: options?.startDate || new Date(Date.now() - 24 * 60 * 60 * 1000),
|
|
252
|
+
endDate: options?.endDate || new Date()
|
|
253
|
+
},
|
|
254
|
+
summary: metrics,
|
|
255
|
+
trends: [],
|
|
256
|
+
recommendations: this.generateRecommendations(metrics),
|
|
257
|
+
alerts
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
async updateConfiguration(config) {
|
|
261
|
+
return this.configManager.updateConfiguration(config);
|
|
262
|
+
}
|
|
263
|
+
getConfiguration() {
|
|
264
|
+
return this.configManager.getConfiguration();
|
|
265
|
+
}
|
|
266
|
+
validateConfiguration(config) {
|
|
267
|
+
return this.configManager.validateConfiguration(config);
|
|
268
|
+
}
|
|
269
|
+
async startAdminServer(port) {
|
|
270
|
+
const serverPort = port || this.config.admin.port;
|
|
271
|
+
await this.adminServer.start(serverPort);
|
|
272
|
+
}
|
|
273
|
+
async stopAdminServer() {
|
|
274
|
+
await this.adminServer.stop();
|
|
275
|
+
}
|
|
276
|
+
getAdminUrl() {
|
|
277
|
+
return this.adminServer.getUrl();
|
|
278
|
+
}
|
|
279
|
+
generateRetryId() {
|
|
280
|
+
return `retry_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
281
|
+
}
|
|
282
|
+
initializeMetrics() {
|
|
283
|
+
return {
|
|
284
|
+
totalRetries: 0,
|
|
285
|
+
successfulRetries: 0,
|
|
286
|
+
failedRetries: 0,
|
|
287
|
+
averageRetryTime: 0,
|
|
288
|
+
retrySuccessRate: 0,
|
|
289
|
+
activeRetries: 0,
|
|
290
|
+
topFailureReasons: [],
|
|
291
|
+
performanceByHour: [],
|
|
292
|
+
storageUsage: {
|
|
293
|
+
totalEntries: 0,
|
|
294
|
+
sizeBytes: 0,
|
|
295
|
+
oldestEntry: new Date(),
|
|
296
|
+
newestEntry: new Date()
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
updateMetrics(result, totalTime) {
|
|
301
|
+
this.metrics.totalRetries += 1;
|
|
302
|
+
if (result.success) {
|
|
303
|
+
this.metrics.successfulRetries += 1;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
this.metrics.failedRetries += 1;
|
|
307
|
+
}
|
|
308
|
+
this.metrics.retrySuccessRate = (this.metrics.successfulRetries / this.metrics.totalRetries) * 100;
|
|
309
|
+
this.metrics.averageRetryTime = (this.metrics.averageRetryTime + totalTime) / 2;
|
|
310
|
+
}
|
|
311
|
+
async sendFailureAlert(id, error) {
|
|
312
|
+
const alert = {
|
|
313
|
+
id: `retry_failure_${id}`,
|
|
314
|
+
type: 'warning',
|
|
315
|
+
message: `Retry operation ${id} failed: ${error.message}`,
|
|
316
|
+
severity: 'medium',
|
|
317
|
+
timestamp: new Date(),
|
|
318
|
+
metadata: { retryId: id, error: error.message },
|
|
319
|
+
acknowledged: false
|
|
320
|
+
};
|
|
321
|
+
await this.integrationManager.sendAlert(alert);
|
|
322
|
+
}
|
|
323
|
+
async sendCriticalAlert(id, error) {
|
|
324
|
+
const alert = {
|
|
325
|
+
id: `retry_critical_${id}`,
|
|
326
|
+
type: 'error',
|
|
327
|
+
message: `Critical error in retry operation ${id}: ${error.message}`,
|
|
328
|
+
severity: 'critical',
|
|
329
|
+
timestamp: new Date(),
|
|
330
|
+
metadata: { retryId: id, error: error.message },
|
|
331
|
+
acknowledged: false
|
|
332
|
+
};
|
|
333
|
+
await this.integrationManager.sendCriticalAlert(alert);
|
|
334
|
+
}
|
|
335
|
+
generateRecommendations(metrics) {
|
|
336
|
+
const recommendations = [];
|
|
337
|
+
if (metrics.retrySuccessRate < 80) {
|
|
338
|
+
recommendations.push({
|
|
339
|
+
type: 'configuration',
|
|
340
|
+
priority: 'high',
|
|
341
|
+
title: 'Low Success Rate',
|
|
342
|
+
description: `Current success rate is ${metrics.retrySuccessRate.toFixed(1)}%`,
|
|
343
|
+
action: 'Consider adjusting retry parameters or investigating root causes'
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
if (metrics.averageRetryTime > 5000) {
|
|
347
|
+
recommendations.push({
|
|
348
|
+
type: 'performance',
|
|
349
|
+
priority: 'medium',
|
|
350
|
+
title: 'High Average Retry Time',
|
|
351
|
+
description: `Average retry time is ${metrics.averageRetryTime}ms`,
|
|
352
|
+
action: 'Consider optimizing retry delays or investigating performance bottlenecks'
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return recommendations;
|
|
356
|
+
}
|
|
357
|
+
setupEventListeners() {
|
|
358
|
+
// Setup event listeners for retry manager events
|
|
359
|
+
// This would integrate with the actual retry manager events
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
exports.RetrySuite = RetrySuite;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
export interface RetrySuiteConfig {
|
|
2
|
+
retryManager: RetryManagerConfig;
|
|
3
|
+
retryStorage: RetryStorageConfig;
|
|
4
|
+
retryMonitoring: RetryMonitoringConfig;
|
|
5
|
+
admin: AdminConfig;
|
|
6
|
+
integrations: IntegrationConfig[];
|
|
7
|
+
logging: LoggingConfig;
|
|
8
|
+
}
|
|
9
|
+
export interface RetryManagerConfig {
|
|
10
|
+
defaultOptions: {
|
|
11
|
+
maxRetries: number;
|
|
12
|
+
initialDelayMs: number;
|
|
13
|
+
backoffFactor: number;
|
|
14
|
+
maxDelayMs?: number;
|
|
15
|
+
jitter?: boolean;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface RetryStorageConfig {
|
|
19
|
+
type: 'memory' | 'redis' | 'file';
|
|
20
|
+
options: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
export interface RetryMonitoringConfig {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
metricsInterval: number;
|
|
25
|
+
alertThresholds: {
|
|
26
|
+
failureRate: number;
|
|
27
|
+
averageRetryTime: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface AdminConfig {
|
|
31
|
+
port: number;
|
|
32
|
+
host: string;
|
|
33
|
+
auth: {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
username?: string;
|
|
36
|
+
password?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface IntegrationConfig {
|
|
40
|
+
type: 'slack' | 'pagerduty' | 'email' | 'webhook';
|
|
41
|
+
config: Record<string, any>;
|
|
42
|
+
}
|
|
43
|
+
export interface LoggingConfig {
|
|
44
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
45
|
+
format: 'json' | 'text';
|
|
46
|
+
}
|
|
47
|
+
export interface RetryStatus {
|
|
48
|
+
id: string;
|
|
49
|
+
status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'paused';
|
|
50
|
+
attempts: number;
|
|
51
|
+
maxAttempts: number;
|
|
52
|
+
lastAttempt?: Date;
|
|
53
|
+
nextAttempt?: Date;
|
|
54
|
+
error?: string;
|
|
55
|
+
result?: any;
|
|
56
|
+
metadata: Record<string, any>;
|
|
57
|
+
}
|
|
58
|
+
export interface RetryOptions {
|
|
59
|
+
maxRetries?: number;
|
|
60
|
+
initialDelayMs?: number;
|
|
61
|
+
backoffFactor?: number;
|
|
62
|
+
maxDelayMs?: number;
|
|
63
|
+
jitter?: boolean;
|
|
64
|
+
metadata?: Record<string, any>;
|
|
65
|
+
}
|
|
66
|
+
export interface RetryResult<T> {
|
|
67
|
+
success: boolean;
|
|
68
|
+
result?: T;
|
|
69
|
+
error?: Error;
|
|
70
|
+
attempts: number;
|
|
71
|
+
totalTime: number;
|
|
72
|
+
}
|
|
73
|
+
export interface RetryMetrics {
|
|
74
|
+
totalRetries: number;
|
|
75
|
+
successfulRetries: number;
|
|
76
|
+
failedRetries: number;
|
|
77
|
+
averageRetryTime: number;
|
|
78
|
+
retrySuccessRate: number;
|
|
79
|
+
activeRetries: number;
|
|
80
|
+
topFailureReasons: FailureReason[];
|
|
81
|
+
performanceByHour: HourlyMetrics[];
|
|
82
|
+
storageUsage: StorageMetrics;
|
|
83
|
+
}
|
|
84
|
+
export interface FailureReason {
|
|
85
|
+
reason: string;
|
|
86
|
+
count: number;
|
|
87
|
+
percentage: number;
|
|
88
|
+
}
|
|
89
|
+
export interface HourlyMetrics {
|
|
90
|
+
hour: string;
|
|
91
|
+
retries: number;
|
|
92
|
+
successes: number;
|
|
93
|
+
failures: number;
|
|
94
|
+
averageTime: number;
|
|
95
|
+
}
|
|
96
|
+
export interface StorageMetrics {
|
|
97
|
+
totalEntries: number;
|
|
98
|
+
sizeBytes: number;
|
|
99
|
+
oldestEntry: Date;
|
|
100
|
+
newestEntry: Date;
|
|
101
|
+
}
|
|
102
|
+
export interface Alert {
|
|
103
|
+
id: string;
|
|
104
|
+
type: 'error' | 'warning' | 'info';
|
|
105
|
+
message: string;
|
|
106
|
+
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
107
|
+
timestamp: Date;
|
|
108
|
+
metadata: Record<string, any>;
|
|
109
|
+
acknowledged: boolean;
|
|
110
|
+
acknowledgedBy?: string;
|
|
111
|
+
acknowledgedAt?: Date;
|
|
112
|
+
}
|
|
113
|
+
export interface PerformanceReport {
|
|
114
|
+
period: {
|
|
115
|
+
startDate: Date;
|
|
116
|
+
endDate: Date;
|
|
117
|
+
};
|
|
118
|
+
summary: RetryMetrics;
|
|
119
|
+
trends: TrendData[];
|
|
120
|
+
recommendations: Recommendation[];
|
|
121
|
+
alerts: Alert[];
|
|
122
|
+
}
|
|
123
|
+
export interface TrendData {
|
|
124
|
+
metric: string;
|
|
125
|
+
values: Array<{
|
|
126
|
+
timestamp: Date;
|
|
127
|
+
value: number;
|
|
128
|
+
}>;
|
|
129
|
+
trend: 'increasing' | 'decreasing' | 'stable';
|
|
130
|
+
}
|
|
131
|
+
export interface Recommendation {
|
|
132
|
+
type: 'performance' | 'configuration' | 'monitoring';
|
|
133
|
+
priority: 'low' | 'medium' | 'high';
|
|
134
|
+
title: string;
|
|
135
|
+
description: string;
|
|
136
|
+
action: string;
|
|
137
|
+
}
|
|
138
|
+
export interface MetricsOptions {
|
|
139
|
+
period?: 'last1hour' | 'last24hours' | 'last7days' | 'last30days';
|
|
140
|
+
startDate?: Date;
|
|
141
|
+
endDate?: Date;
|
|
142
|
+
}
|
|
143
|
+
export interface AlertOptions {
|
|
144
|
+
severity?: Array<'low' | 'medium' | 'high' | 'critical'>;
|
|
145
|
+
acknowledged?: boolean;
|
|
146
|
+
limit?: number;
|
|
147
|
+
}
|
|
148
|
+
export interface ReportOptions {
|
|
149
|
+
startDate: Date;
|
|
150
|
+
endDate: Date;
|
|
151
|
+
includeRecommendations?: boolean;
|
|
152
|
+
includeTrends?: boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface ScheduleResult {
|
|
155
|
+
success: boolean;
|
|
156
|
+
scheduleId?: string;
|
|
157
|
+
scheduledTime?: Date;
|
|
158
|
+
error?: string;
|
|
159
|
+
}
|
|
160
|
+
export interface CancelResult {
|
|
161
|
+
success: boolean;
|
|
162
|
+
message: string;
|
|
163
|
+
}
|
|
164
|
+
export interface PauseResult {
|
|
165
|
+
success: boolean;
|
|
166
|
+
message: string;
|
|
167
|
+
}
|
|
168
|
+
export interface ResumeResult {
|
|
169
|
+
success: boolean;
|
|
170
|
+
message: string;
|
|
171
|
+
}
|
|
172
|
+
export interface ConfigResult {
|
|
173
|
+
success: boolean;
|
|
174
|
+
message?: string;
|
|
175
|
+
errors?: string[];
|
|
176
|
+
}
|
|
177
|
+
export interface ValidationResult {
|
|
178
|
+
isValid: boolean;
|
|
179
|
+
errors: string[];
|
|
180
|
+
}
|
|
181
|
+
export interface Integration {
|
|
182
|
+
type: string;
|
|
183
|
+
sendAlert(alert: Alert): Promise<void>;
|
|
184
|
+
sendCriticalAlert(alert: Alert): Promise<void>;
|
|
185
|
+
}
|
|
186
|
+
export interface SlackConfig {
|
|
187
|
+
token: string;
|
|
188
|
+
channel: string;
|
|
189
|
+
criticalChannel?: string;
|
|
190
|
+
}
|
|
191
|
+
export interface PagerDutyConfig {
|
|
192
|
+
apiKey: string;
|
|
193
|
+
serviceId: string;
|
|
194
|
+
}
|
|
195
|
+
export interface EmailConfig {
|
|
196
|
+
provider: string;
|
|
197
|
+
apiKey: string;
|
|
198
|
+
from: string;
|
|
199
|
+
to: string[];
|
|
200
|
+
}
|
|
201
|
+
export interface WebhookConfig {
|
|
202
|
+
url: string;
|
|
203
|
+
headers?: Record<string, string>;
|
|
204
|
+
timeout?: number;
|
|
205
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
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 });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/retry-suite",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.17",
|
|
4
4
|
"description": "Complete retry system with admin interface, monitoring dashboard, and comprehensive retry workflows",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"react-dom": "^18.2.0",
|
|
29
29
|
"uuid": "^11.1.1",
|
|
30
30
|
"ws": "^8.14.2",
|
|
31
|
-
"@bernierllc/retry-manager": "^3.0.4",
|
|
32
|
-
"@bernierllc/email-sender": "^5.13.0",
|
|
33
31
|
"@bernierllc/message-queue": "^1.5.2",
|
|
32
|
+
"@bernierllc/retry-manager": "^3.0.6",
|
|
34
33
|
"@bernierllc/retry-metrics": "^0.5.0",
|
|
35
|
-
"@bernierllc/retry-state": "^0.5.0"
|
|
34
|
+
"@bernierllc/retry-state": "^0.5.0",
|
|
35
|
+
"@bernierllc/email-sender": "^5.14.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/compression": "^1.7.2",
|