@adaptic/backend-legacy 0.0.903 → 0.0.905
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/ABTest.cjs +291 -63
- package/Account.cjs +291 -63
- package/AccountLinkingRequest.cjs +291 -63
- package/Action.cjs +291 -63
- package/Alert.cjs +291 -63
- package/Allocation.cjs +291 -63
- package/AlpacaAccount.cjs +291 -63
- package/AnalyticsConfiguration.cjs +291 -63
- package/AnalyticsSnapshot.cjs +291 -63
- package/Asset.cjs +291 -63
- package/AuditLog.cjs +291 -63
- package/Authenticator.cjs +291 -63
- package/Configuration.cjs +291 -63
- package/ConflictEvent.cjs +291 -63
- package/ConnectionHealthSnapshot.cjs +291 -63
- package/Customer.cjs +291 -63
- package/DeadLetterMessage.cjs +291 -63
- package/EconomicEvent.cjs +291 -63
- package/Event.cjs +291 -63
- package/EventSnapshot.cjs +291 -63
- package/FeatureImportanceAnalysis.cjs +291 -63
- package/InstitutionalFlowSignal.cjs +291 -63
- package/InstitutionalHolding.cjs +291 -63
- package/InstitutionalSentimentAlerts.cjs +291 -63
- package/InstitutionalSentimentErrors.cjs +291 -63
- package/InstitutionalSentimentHistory.cjs +291 -63
- package/InstitutionalSentimentMetrics.cjs +291 -63
- package/InviteToken.cjs +291 -63
- package/LinkedProvider.cjs +291 -63
- package/MLTrainingData.cjs +291 -63
- package/MarketSentiment.cjs +291 -63
- package/ModelArtifact.cjs +291 -63
- package/ModelVersion.cjs +291 -63
- package/ModelVersionArtifact.cjs +291 -63
- package/NewsArticle.cjs +291 -63
- package/NewsArticleAssetSentiment.cjs +291 -63
- package/OptionsContract.cjs +291 -63
- package/OptionsGreeksHistory.cjs +291 -63
- package/OptionsPosition.cjs +291 -63
- package/OptionsTradeExecution.cjs +291 -63
- package/PortfolioGreeksHistory.cjs +291 -63
- package/ScheduledOptionOrder.cjs +291 -63
- package/Session.cjs +291 -63
- package/SignalGeneratorMetrics.cjs +291 -63
- package/SignalLineage.cjs +291 -63
- package/SignalOutcome.cjs +291 -63
- package/SignalPriorityQueue.cjs +291 -63
- package/SyncEvent.cjs +291 -63
- package/SystemAlert.cjs +291 -63
- package/Trade.cjs +291 -63
- package/TradeAuditEvent.cjs +291 -63
- package/TradeExecutionHistory.cjs +291 -63
- package/User.cjs +291 -63
- package/VerificationToken.cjs +291 -63
- package/WaitlistEntry.cjs +291 -63
- package/esm/ABTest.d.ts.map +1 -1
- package/esm/ABTest.js.map +1 -1
- package/esm/ABTest.mjs +255 -27
- package/esm/Account.d.ts.map +1 -1
- package/esm/Account.js.map +1 -1
- package/esm/Account.mjs +255 -27
- package/esm/AccountLinkingRequest.d.ts.map +1 -1
- package/esm/AccountLinkingRequest.js.map +1 -1
- package/esm/AccountLinkingRequest.mjs +255 -27
- package/esm/Action.d.ts.map +1 -1
- package/esm/Action.js.map +1 -1
- package/esm/Action.mjs +255 -27
- package/esm/Alert.d.ts.map +1 -1
- package/esm/Alert.js.map +1 -1
- package/esm/Alert.mjs +255 -27
- package/esm/Allocation.d.ts.map +1 -1
- package/esm/Allocation.js.map +1 -1
- package/esm/Allocation.mjs +255 -27
- package/esm/AlpacaAccount.d.ts.map +1 -1
- package/esm/AlpacaAccount.js.map +1 -1
- package/esm/AlpacaAccount.mjs +255 -27
- package/esm/AnalyticsConfiguration.d.ts.map +1 -1
- package/esm/AnalyticsConfiguration.js.map +1 -1
- package/esm/AnalyticsConfiguration.mjs +255 -27
- package/esm/AnalyticsSnapshot.d.ts.map +1 -1
- package/esm/AnalyticsSnapshot.js.map +1 -1
- package/esm/AnalyticsSnapshot.mjs +255 -27
- package/esm/Asset.d.ts.map +1 -1
- package/esm/Asset.js.map +1 -1
- package/esm/Asset.mjs +255 -27
- package/esm/AuditLog.d.ts.map +1 -1
- package/esm/AuditLog.js.map +1 -1
- package/esm/AuditLog.mjs +255 -27
- package/esm/Authenticator.d.ts.map +1 -1
- package/esm/Authenticator.js.map +1 -1
- package/esm/Authenticator.mjs +255 -27
- package/esm/Configuration.d.ts.map +1 -1
- package/esm/Configuration.js.map +1 -1
- package/esm/Configuration.mjs +255 -27
- package/esm/ConflictEvent.d.ts.map +1 -1
- package/esm/ConflictEvent.js.map +1 -1
- package/esm/ConflictEvent.mjs +255 -27
- package/esm/ConnectionHealthSnapshot.d.ts.map +1 -1
- package/esm/ConnectionHealthSnapshot.js.map +1 -1
- package/esm/ConnectionHealthSnapshot.mjs +255 -27
- package/esm/Customer.d.ts.map +1 -1
- package/esm/Customer.js.map +1 -1
- package/esm/Customer.mjs +255 -27
- package/esm/DeadLetterMessage.d.ts.map +1 -1
- package/esm/DeadLetterMessage.js.map +1 -1
- package/esm/DeadLetterMessage.mjs +255 -27
- package/esm/EconomicEvent.d.ts.map +1 -1
- package/esm/EconomicEvent.js.map +1 -1
- package/esm/EconomicEvent.mjs +255 -27
- package/esm/Event.d.ts.map +1 -1
- package/esm/Event.js.map +1 -1
- package/esm/Event.mjs +255 -27
- package/esm/EventSnapshot.d.ts.map +1 -1
- package/esm/EventSnapshot.js.map +1 -1
- package/esm/EventSnapshot.mjs +255 -27
- package/esm/FeatureImportanceAnalysis.d.ts.map +1 -1
- package/esm/FeatureImportanceAnalysis.js.map +1 -1
- package/esm/FeatureImportanceAnalysis.mjs +255 -27
- package/esm/InstitutionalFlowSignal.d.ts.map +1 -1
- package/esm/InstitutionalFlowSignal.js.map +1 -1
- package/esm/InstitutionalFlowSignal.mjs +255 -27
- package/esm/InstitutionalHolding.d.ts.map +1 -1
- package/esm/InstitutionalHolding.js.map +1 -1
- package/esm/InstitutionalHolding.mjs +255 -27
- package/esm/InstitutionalSentimentAlerts.d.ts.map +1 -1
- package/esm/InstitutionalSentimentAlerts.js.map +1 -1
- package/esm/InstitutionalSentimentAlerts.mjs +255 -27
- package/esm/InstitutionalSentimentErrors.d.ts.map +1 -1
- package/esm/InstitutionalSentimentErrors.js.map +1 -1
- package/esm/InstitutionalSentimentErrors.mjs +255 -27
- package/esm/InstitutionalSentimentHistory.d.ts.map +1 -1
- package/esm/InstitutionalSentimentHistory.js.map +1 -1
- package/esm/InstitutionalSentimentHistory.mjs +255 -27
- package/esm/InstitutionalSentimentMetrics.d.ts.map +1 -1
- package/esm/InstitutionalSentimentMetrics.js.map +1 -1
- package/esm/InstitutionalSentimentMetrics.mjs +255 -27
- package/esm/InviteToken.d.ts.map +1 -1
- package/esm/InviteToken.js.map +1 -1
- package/esm/InviteToken.mjs +255 -27
- package/esm/LinkedProvider.d.ts.map +1 -1
- package/esm/LinkedProvider.js.map +1 -1
- package/esm/LinkedProvider.mjs +255 -27
- package/esm/MLTrainingData.d.ts.map +1 -1
- package/esm/MLTrainingData.js.map +1 -1
- package/esm/MLTrainingData.mjs +255 -27
- package/esm/MarketSentiment.d.ts.map +1 -1
- package/esm/MarketSentiment.js.map +1 -1
- package/esm/MarketSentiment.mjs +255 -27
- package/esm/ModelArtifact.d.ts.map +1 -1
- package/esm/ModelArtifact.js.map +1 -1
- package/esm/ModelArtifact.mjs +255 -27
- package/esm/ModelVersion.d.ts.map +1 -1
- package/esm/ModelVersion.js.map +1 -1
- package/esm/ModelVersion.mjs +255 -27
- package/esm/ModelVersionArtifact.d.ts.map +1 -1
- package/esm/ModelVersionArtifact.js.map +1 -1
- package/esm/ModelVersionArtifact.mjs +255 -27
- package/esm/NewsArticle.d.ts.map +1 -1
- package/esm/NewsArticle.js.map +1 -1
- package/esm/NewsArticle.mjs +255 -27
- package/esm/NewsArticleAssetSentiment.d.ts.map +1 -1
- package/esm/NewsArticleAssetSentiment.js.map +1 -1
- package/esm/NewsArticleAssetSentiment.mjs +255 -27
- package/esm/OptionsContract.d.ts.map +1 -1
- package/esm/OptionsContract.js.map +1 -1
- package/esm/OptionsContract.mjs +255 -27
- package/esm/OptionsGreeksHistory.d.ts.map +1 -1
- package/esm/OptionsGreeksHistory.js.map +1 -1
- package/esm/OptionsGreeksHistory.mjs +255 -27
- package/esm/OptionsPosition.d.ts.map +1 -1
- package/esm/OptionsPosition.js.map +1 -1
- package/esm/OptionsPosition.mjs +255 -27
- package/esm/OptionsTradeExecution.d.ts.map +1 -1
- package/esm/OptionsTradeExecution.js.map +1 -1
- package/esm/OptionsTradeExecution.mjs +255 -27
- package/esm/PortfolioGreeksHistory.d.ts.map +1 -1
- package/esm/PortfolioGreeksHistory.js.map +1 -1
- package/esm/PortfolioGreeksHistory.mjs +255 -27
- package/esm/ScheduledOptionOrder.d.ts.map +1 -1
- package/esm/ScheduledOptionOrder.js.map +1 -1
- package/esm/ScheduledOptionOrder.mjs +255 -27
- package/esm/Session.d.ts.map +1 -1
- package/esm/Session.js.map +1 -1
- package/esm/Session.mjs +255 -27
- package/esm/SignalGeneratorMetrics.d.ts.map +1 -1
- package/esm/SignalGeneratorMetrics.js.map +1 -1
- package/esm/SignalGeneratorMetrics.mjs +255 -27
- package/esm/SignalLineage.d.ts.map +1 -1
- package/esm/SignalLineage.js.map +1 -1
- package/esm/SignalLineage.mjs +255 -27
- package/esm/SignalOutcome.d.ts.map +1 -1
- package/esm/SignalOutcome.js.map +1 -1
- package/esm/SignalOutcome.mjs +255 -27
- package/esm/SignalPriorityQueue.d.ts.map +1 -1
- package/esm/SignalPriorityQueue.js.map +1 -1
- package/esm/SignalPriorityQueue.mjs +255 -27
- package/esm/SyncEvent.d.ts.map +1 -1
- package/esm/SyncEvent.js.map +1 -1
- package/esm/SyncEvent.mjs +255 -27
- package/esm/SystemAlert.d.ts.map +1 -1
- package/esm/SystemAlert.js.map +1 -1
- package/esm/SystemAlert.mjs +255 -27
- package/esm/Trade.d.ts.map +1 -1
- package/esm/Trade.js.map +1 -1
- package/esm/Trade.mjs +255 -27
- package/esm/TradeAuditEvent.d.ts.map +1 -1
- package/esm/TradeAuditEvent.js.map +1 -1
- package/esm/TradeAuditEvent.mjs +255 -27
- package/esm/TradeExecutionHistory.d.ts.map +1 -1
- package/esm/TradeExecutionHistory.js.map +1 -1
- package/esm/TradeExecutionHistory.mjs +255 -27
- package/esm/User.d.ts.map +1 -1
- package/esm/User.js.map +1 -1
- package/esm/User.mjs +255 -27
- package/esm/VerificationToken.d.ts.map +1 -1
- package/esm/VerificationToken.js.map +1 -1
- package/esm/VerificationToken.mjs +255 -27
- package/esm/WaitlistEntry.d.ts.map +1 -1
- package/esm/WaitlistEntry.js.map +1 -1
- package/esm/WaitlistEntry.mjs +255 -27
- package/esm/middleware/audit-logger.d.ts +0 -7
- package/esm/middleware/audit-logger.d.ts.map +1 -1
- package/esm/middleware/audit-logger.js.map +1 -1
- package/esm/middleware/audit-logger.mjs +5 -3
- package/esm/prismaClient.d.ts.map +1 -1
- package/esm/prismaClient.js.map +1 -1
- package/esm/prismaClient.mjs +38 -9
- package/package.json +1 -1
- package/prismaClient.cjs +38 -9
package/esm/EventSnapshot.mjs
CHANGED
|
@@ -79,6 +79,27 @@ export const EventSnapshot = {
|
|
|
79
79
|
}
|
|
80
80
|
catch (error) {
|
|
81
81
|
lastError = error;
|
|
82
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
83
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
84
|
+
error.message?.includes('violates unique constraint') ||
|
|
85
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
86
|
+
error.message?.includes('unique constraint') ||
|
|
87
|
+
error.message?.includes('23514') ||
|
|
88
|
+
error.message?.includes('23505') ||
|
|
89
|
+
error.message?.includes('P2002') ||
|
|
90
|
+
error.message?.includes('P2003');
|
|
91
|
+
if (isConstraintViolation) {
|
|
92
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
93
|
+
logger.error("Non-retryable constraint violation in createOneEventSnapshot", {
|
|
94
|
+
operation: 'createOneEventSnapshot',
|
|
95
|
+
model: 'EventSnapshot',
|
|
96
|
+
error: String(error),
|
|
97
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
98
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
99
|
+
isRetryable: false,
|
|
100
|
+
});
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
82
103
|
// Check if this is a database connection error that we should retry
|
|
83
104
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
84
105
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -88,12 +109,22 @@ export const EventSnapshot = {
|
|
|
88
109
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
89
110
|
retryCount++;
|
|
90
111
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
91
|
-
logger.warn("Database connection error, retrying..."
|
|
112
|
+
logger.warn("Database connection error in createOneEventSnapshot, retrying...", {
|
|
113
|
+
operation: 'createOneEventSnapshot',
|
|
114
|
+
model: 'EventSnapshot',
|
|
115
|
+
attempt: retryCount,
|
|
116
|
+
maxRetries: MAX_RETRIES,
|
|
117
|
+
});
|
|
92
118
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
93
119
|
continue;
|
|
94
120
|
}
|
|
95
|
-
// Log
|
|
96
|
-
logger.error("Database
|
|
121
|
+
// Log structured error details and rethrow
|
|
122
|
+
logger.error("Database create operation failed", {
|
|
123
|
+
operation: 'createOneEventSnapshot',
|
|
124
|
+
model: 'EventSnapshot',
|
|
125
|
+
error: String(error),
|
|
126
|
+
isRetryable: isConnectionError,
|
|
127
|
+
});
|
|
97
128
|
throw error;
|
|
98
129
|
}
|
|
99
130
|
}
|
|
@@ -155,6 +186,27 @@ export const EventSnapshot = {
|
|
|
155
186
|
}
|
|
156
187
|
catch (error) {
|
|
157
188
|
lastError = error;
|
|
189
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
190
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
191
|
+
error.message?.includes('violates unique constraint') ||
|
|
192
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
193
|
+
error.message?.includes('unique constraint') ||
|
|
194
|
+
error.message?.includes('23514') ||
|
|
195
|
+
error.message?.includes('23505') ||
|
|
196
|
+
error.message?.includes('P2002') ||
|
|
197
|
+
error.message?.includes('P2003');
|
|
198
|
+
if (isConstraintViolation) {
|
|
199
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
200
|
+
logger.error("Non-retryable constraint violation in createManyEventSnapshot", {
|
|
201
|
+
operation: 'createManyEventSnapshot',
|
|
202
|
+
model: 'EventSnapshot',
|
|
203
|
+
error: String(error),
|
|
204
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
205
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
206
|
+
isRetryable: false,
|
|
207
|
+
});
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
158
210
|
// Check if this is a database connection error that we should retry
|
|
159
211
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
160
212
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -164,12 +216,22 @@ export const EventSnapshot = {
|
|
|
164
216
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
165
217
|
retryCount++;
|
|
166
218
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
167
|
-
logger.warn("Database connection error, retrying..."
|
|
219
|
+
logger.warn("Database connection error in createManyEventSnapshot, retrying...", {
|
|
220
|
+
operation: 'createManyEventSnapshot',
|
|
221
|
+
model: 'EventSnapshot',
|
|
222
|
+
attempt: retryCount,
|
|
223
|
+
maxRetries: MAX_RETRIES,
|
|
224
|
+
});
|
|
168
225
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
169
226
|
continue;
|
|
170
227
|
}
|
|
171
|
-
// Log
|
|
172
|
-
logger.error("Database
|
|
228
|
+
// Log structured error details and rethrow
|
|
229
|
+
logger.error("Database createMany operation failed", {
|
|
230
|
+
operation: 'createManyEventSnapshot',
|
|
231
|
+
model: 'EventSnapshot',
|
|
232
|
+
error: String(error),
|
|
233
|
+
isRetryable: isConnectionError,
|
|
234
|
+
});
|
|
173
235
|
throw error;
|
|
174
236
|
}
|
|
175
237
|
}
|
|
@@ -256,6 +318,28 @@ export const EventSnapshot = {
|
|
|
256
318
|
}
|
|
257
319
|
catch (error) {
|
|
258
320
|
lastError = error;
|
|
321
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
322
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
323
|
+
error.message?.includes('violates unique constraint') ||
|
|
324
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
325
|
+
error.message?.includes('unique constraint') ||
|
|
326
|
+
error.message?.includes('23514') ||
|
|
327
|
+
error.message?.includes('23505') ||
|
|
328
|
+
error.message?.includes('P2002') ||
|
|
329
|
+
error.message?.includes('P2003');
|
|
330
|
+
if (isConstraintViolation) {
|
|
331
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
332
|
+
logger.error("Non-retryable constraint violation in updateOneEventSnapshot", {
|
|
333
|
+
operation: 'updateOneEventSnapshot',
|
|
334
|
+
model: 'EventSnapshot',
|
|
335
|
+
error: String(error),
|
|
336
|
+
recordId: props.id,
|
|
337
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
338
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
339
|
+
isRetryable: false,
|
|
340
|
+
});
|
|
341
|
+
throw error;
|
|
342
|
+
}
|
|
259
343
|
// Check if this is a database connection error that we should retry
|
|
260
344
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
261
345
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -265,12 +349,24 @@ export const EventSnapshot = {
|
|
|
265
349
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
266
350
|
retryCount++;
|
|
267
351
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
268
|
-
logger.warn("Database connection error, retrying..."
|
|
352
|
+
logger.warn("Database connection error in updateOneEventSnapshot, retrying...", {
|
|
353
|
+
operation: 'updateOneEventSnapshot',
|
|
354
|
+
model: 'EventSnapshot',
|
|
355
|
+
attempt: retryCount,
|
|
356
|
+
maxRetries: MAX_RETRIES,
|
|
357
|
+
recordId: props.id,
|
|
358
|
+
});
|
|
269
359
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
270
360
|
continue;
|
|
271
361
|
}
|
|
272
|
-
// Log
|
|
273
|
-
logger.error("Database
|
|
362
|
+
// Log structured error details and rethrow
|
|
363
|
+
logger.error("Database update operation failed", {
|
|
364
|
+
operation: 'updateOneEventSnapshot',
|
|
365
|
+
model: 'EventSnapshot',
|
|
366
|
+
error: String(error),
|
|
367
|
+
recordId: props.id,
|
|
368
|
+
isRetryable: isConnectionError,
|
|
369
|
+
});
|
|
274
370
|
throw error;
|
|
275
371
|
}
|
|
276
372
|
}
|
|
@@ -355,6 +451,28 @@ export const EventSnapshot = {
|
|
|
355
451
|
}
|
|
356
452
|
catch (error) {
|
|
357
453
|
lastError = error;
|
|
454
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
455
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
456
|
+
error.message?.includes('violates unique constraint') ||
|
|
457
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
458
|
+
error.message?.includes('unique constraint') ||
|
|
459
|
+
error.message?.includes('23514') ||
|
|
460
|
+
error.message?.includes('23505') ||
|
|
461
|
+
error.message?.includes('P2002') ||
|
|
462
|
+
error.message?.includes('P2003');
|
|
463
|
+
if (isConstraintViolation) {
|
|
464
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
465
|
+
logger.error("Non-retryable constraint violation in upsertOneEventSnapshot", {
|
|
466
|
+
operation: 'upsertOneEventSnapshot',
|
|
467
|
+
model: 'EventSnapshot',
|
|
468
|
+
error: String(error),
|
|
469
|
+
recordId: props.id,
|
|
470
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
471
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
472
|
+
isRetryable: false,
|
|
473
|
+
});
|
|
474
|
+
throw error;
|
|
475
|
+
}
|
|
358
476
|
// Check if this is a database connection error that we should retry
|
|
359
477
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
360
478
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -364,12 +482,24 @@ export const EventSnapshot = {
|
|
|
364
482
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
365
483
|
retryCount++;
|
|
366
484
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
367
|
-
logger.warn("Database connection error, retrying..."
|
|
485
|
+
logger.warn("Database connection error in upsertOneEventSnapshot, retrying...", {
|
|
486
|
+
operation: 'upsertOneEventSnapshot',
|
|
487
|
+
model: 'EventSnapshot',
|
|
488
|
+
attempt: retryCount,
|
|
489
|
+
maxRetries: MAX_RETRIES,
|
|
490
|
+
recordId: props.id,
|
|
491
|
+
});
|
|
368
492
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
369
493
|
continue;
|
|
370
494
|
}
|
|
371
|
-
// Log
|
|
372
|
-
logger.error("Database
|
|
495
|
+
// Log structured error details and rethrow
|
|
496
|
+
logger.error("Database upsert operation failed", {
|
|
497
|
+
operation: 'upsertOneEventSnapshot',
|
|
498
|
+
model: 'EventSnapshot',
|
|
499
|
+
error: String(error),
|
|
500
|
+
recordId: props.id,
|
|
501
|
+
isRetryable: isConnectionError,
|
|
502
|
+
});
|
|
373
503
|
throw error;
|
|
374
504
|
}
|
|
375
505
|
}
|
|
@@ -456,6 +586,27 @@ export const EventSnapshot = {
|
|
|
456
586
|
}
|
|
457
587
|
catch (error) {
|
|
458
588
|
lastError = error;
|
|
589
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
590
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
591
|
+
error.message?.includes('violates unique constraint') ||
|
|
592
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
593
|
+
error.message?.includes('unique constraint') ||
|
|
594
|
+
error.message?.includes('23514') ||
|
|
595
|
+
error.message?.includes('23505') ||
|
|
596
|
+
error.message?.includes('P2002') ||
|
|
597
|
+
error.message?.includes('P2003');
|
|
598
|
+
if (isConstraintViolation) {
|
|
599
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
600
|
+
logger.error("Non-retryable constraint violation in updateManyEventSnapshot", {
|
|
601
|
+
operation: 'updateManyEventSnapshot',
|
|
602
|
+
model: 'EventSnapshot',
|
|
603
|
+
error: String(error),
|
|
604
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
605
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
606
|
+
isRetryable: false,
|
|
607
|
+
});
|
|
608
|
+
throw error;
|
|
609
|
+
}
|
|
459
610
|
// Check if this is a database connection error that we should retry
|
|
460
611
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
461
612
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -465,12 +616,22 @@ export const EventSnapshot = {
|
|
|
465
616
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
466
617
|
retryCount++;
|
|
467
618
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
468
|
-
logger.warn("Database connection error, retrying..."
|
|
619
|
+
logger.warn("Database connection error in updateManyEventSnapshot, retrying...", {
|
|
620
|
+
operation: 'updateManyEventSnapshot',
|
|
621
|
+
model: 'EventSnapshot',
|
|
622
|
+
attempt: retryCount,
|
|
623
|
+
maxRetries: MAX_RETRIES,
|
|
624
|
+
});
|
|
469
625
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
470
626
|
continue;
|
|
471
627
|
}
|
|
472
|
-
// Log
|
|
473
|
-
logger.error("Database
|
|
628
|
+
// Log structured error details and rethrow
|
|
629
|
+
logger.error("Database updateMany operation failed", {
|
|
630
|
+
operation: 'updateManyEventSnapshot',
|
|
631
|
+
model: 'EventSnapshot',
|
|
632
|
+
error: String(error),
|
|
633
|
+
isRetryable: isConnectionError,
|
|
634
|
+
});
|
|
474
635
|
throw error;
|
|
475
636
|
}
|
|
476
637
|
}
|
|
@@ -528,6 +689,31 @@ export const EventSnapshot = {
|
|
|
528
689
|
}
|
|
529
690
|
catch (error) {
|
|
530
691
|
lastError = error;
|
|
692
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
693
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
694
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
695
|
+
error.message?.includes('violates unique constraint') ||
|
|
696
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
697
|
+
error.message?.includes('unique constraint') ||
|
|
698
|
+
error.message?.includes('23514') ||
|
|
699
|
+
error.message?.includes('23505') ||
|
|
700
|
+
error.message?.includes('23503') ||
|
|
701
|
+
error.message?.includes('P2002') ||
|
|
702
|
+
error.message?.includes('P2003') ||
|
|
703
|
+
error.message?.includes('P2014');
|
|
704
|
+
if (isConstraintViolation) {
|
|
705
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
706
|
+
logger.error("Non-retryable constraint violation in deleteOneEventSnapshot", {
|
|
707
|
+
operation: 'deleteOneEventSnapshot',
|
|
708
|
+
model: 'EventSnapshot',
|
|
709
|
+
error: String(error),
|
|
710
|
+
recordId: props.id,
|
|
711
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
712
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
713
|
+
isRetryable: false,
|
|
714
|
+
});
|
|
715
|
+
throw error;
|
|
716
|
+
}
|
|
531
717
|
// Check if this is a database connection error that we should retry
|
|
532
718
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
533
719
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -537,12 +723,24 @@ export const EventSnapshot = {
|
|
|
537
723
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
538
724
|
retryCount++;
|
|
539
725
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
540
|
-
logger.warn("Database connection error, retrying..."
|
|
726
|
+
logger.warn("Database connection error in deleteOneEventSnapshot, retrying...", {
|
|
727
|
+
operation: 'deleteOneEventSnapshot',
|
|
728
|
+
model: 'EventSnapshot',
|
|
729
|
+
attempt: retryCount,
|
|
730
|
+
maxRetries: MAX_RETRIES,
|
|
731
|
+
recordId: props.id,
|
|
732
|
+
});
|
|
541
733
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
542
734
|
continue;
|
|
543
735
|
}
|
|
544
|
-
// Log
|
|
545
|
-
logger.error("Database
|
|
736
|
+
// Log structured error details and rethrow
|
|
737
|
+
logger.error("Database delete operation failed", {
|
|
738
|
+
operation: 'deleteOneEventSnapshot',
|
|
739
|
+
model: 'EventSnapshot',
|
|
740
|
+
error: String(error),
|
|
741
|
+
recordId: props.id,
|
|
742
|
+
isRetryable: isConnectionError,
|
|
743
|
+
});
|
|
546
744
|
throw error;
|
|
547
745
|
}
|
|
548
746
|
}
|
|
@@ -611,12 +809,22 @@ export const EventSnapshot = {
|
|
|
611
809
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
612
810
|
retryCount++;
|
|
613
811
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
614
|
-
logger.warn("Database connection error, retrying..."
|
|
812
|
+
logger.warn("Database connection error in getEventSnapshot, retrying...", {
|
|
813
|
+
operation: 'getEventSnapshot',
|
|
814
|
+
model: 'EventSnapshot',
|
|
815
|
+
attempt: retryCount,
|
|
816
|
+
maxRetries: MAX_RETRIES,
|
|
817
|
+
});
|
|
615
818
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
616
819
|
continue;
|
|
617
820
|
}
|
|
618
|
-
// Log
|
|
619
|
-
logger.error("Database
|
|
821
|
+
// Log structured error details and rethrow
|
|
822
|
+
logger.error("Database get operation failed", {
|
|
823
|
+
operation: 'getEventSnapshot',
|
|
824
|
+
model: 'EventSnapshot',
|
|
825
|
+
error: String(error),
|
|
826
|
+
isRetryable: isConnectionError,
|
|
827
|
+
});
|
|
620
828
|
throw error;
|
|
621
829
|
}
|
|
622
830
|
}
|
|
@@ -673,12 +881,22 @@ export const EventSnapshot = {
|
|
|
673
881
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
674
882
|
retryCount++;
|
|
675
883
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
676
|
-
logger.warn("Database connection error, retrying..."
|
|
884
|
+
logger.warn("Database connection error in getAllEventSnapshot, retrying...", {
|
|
885
|
+
operation: 'getAllEventSnapshot',
|
|
886
|
+
model: 'EventSnapshot',
|
|
887
|
+
attempt: retryCount,
|
|
888
|
+
maxRetries: MAX_RETRIES,
|
|
889
|
+
});
|
|
677
890
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
678
891
|
continue;
|
|
679
892
|
}
|
|
680
|
-
// Log
|
|
681
|
-
logger.error("Database
|
|
893
|
+
// Log structured error details and rethrow
|
|
894
|
+
logger.error("Database getAll operation failed", {
|
|
895
|
+
operation: 'getAllEventSnapshot',
|
|
896
|
+
model: 'EventSnapshot',
|
|
897
|
+
error: String(error),
|
|
898
|
+
isRetryable: isConnectionError,
|
|
899
|
+
});
|
|
682
900
|
throw error;
|
|
683
901
|
}
|
|
684
902
|
}
|
|
@@ -754,12 +972,22 @@ export const EventSnapshot = {
|
|
|
754
972
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
755
973
|
retryCount++;
|
|
756
974
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
757
|
-
logger.warn("Database connection error, retrying..."
|
|
975
|
+
logger.warn("Database connection error in findManyEventSnapshot, retrying...", {
|
|
976
|
+
operation: 'findManyEventSnapshot',
|
|
977
|
+
model: 'EventSnapshot',
|
|
978
|
+
attempt: retryCount,
|
|
979
|
+
maxRetries: MAX_RETRIES,
|
|
980
|
+
});
|
|
758
981
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
759
982
|
continue;
|
|
760
983
|
}
|
|
761
|
-
// Log
|
|
762
|
-
logger.error("Database
|
|
984
|
+
// Log structured error details and rethrow
|
|
985
|
+
logger.error("Database findMany operation failed", {
|
|
986
|
+
operation: 'findManyEventSnapshot',
|
|
987
|
+
model: 'EventSnapshot',
|
|
988
|
+
error: String(error),
|
|
989
|
+
isRetryable: isConnectionError,
|
|
990
|
+
});
|
|
763
991
|
throw error;
|
|
764
992
|
}
|
|
765
993
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureImportanceAnalysis.d.ts","sourceRoot":"","sources":["../../src/FeatureImportanceAnalysis.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,IAAI,6BAA6B,EAAE,MAAM,iEAAiE,CAAC;AAC7I,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAyK7G,eAAO,MAAM,yBAAyB;IAEpC;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"FeatureImportanceAnalysis.d.ts","sourceRoot":"","sources":["../../src/FeatureImportanceAnalysis.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,IAAI,6BAA6B,EAAE,MAAM,iEAAiE,CAAC;AAC7I,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAyK7G,eAAO,MAAM,yBAAyB;IAEpC;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IA82BpJ;;;;;;OAMG;sBACqB,6BAA6B,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA2HnJ;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAw6GlJ;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAiqIlJ;;;;;;OAMG;sBACqB,6BAA6B,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAu6GnJ;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAmHlJ;;;;;;;OAOG;eACc,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC;IAuFxK;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC;IA4ErH;;;;;;;OAOG;oBACmB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC;CA6FhL,CAAC"}
|