@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
|
@@ -73,6 +73,27 @@ export const VerificationToken = {
|
|
|
73
73
|
}
|
|
74
74
|
catch (error) {
|
|
75
75
|
lastError = error;
|
|
76
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
77
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
78
|
+
error.message?.includes('violates unique constraint') ||
|
|
79
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
80
|
+
error.message?.includes('unique constraint') ||
|
|
81
|
+
error.message?.includes('23514') ||
|
|
82
|
+
error.message?.includes('23505') ||
|
|
83
|
+
error.message?.includes('P2002') ||
|
|
84
|
+
error.message?.includes('P2003');
|
|
85
|
+
if (isConstraintViolation) {
|
|
86
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
87
|
+
logger.error("Non-retryable constraint violation in createOneVerificationToken", {
|
|
88
|
+
operation: 'createOneVerificationToken',
|
|
89
|
+
model: 'VerificationToken',
|
|
90
|
+
error: String(error),
|
|
91
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
92
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
93
|
+
isRetryable: false,
|
|
94
|
+
});
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
76
97
|
// Check if this is a database connection error that we should retry
|
|
77
98
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
78
99
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -82,12 +103,22 @@ export const VerificationToken = {
|
|
|
82
103
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
83
104
|
retryCount++;
|
|
84
105
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
85
|
-
logger.warn("Database connection error, retrying..."
|
|
106
|
+
logger.warn("Database connection error in createOneVerificationToken, retrying...", {
|
|
107
|
+
operation: 'createOneVerificationToken',
|
|
108
|
+
model: 'VerificationToken',
|
|
109
|
+
attempt: retryCount,
|
|
110
|
+
maxRetries: MAX_RETRIES,
|
|
111
|
+
});
|
|
86
112
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
87
113
|
continue;
|
|
88
114
|
}
|
|
89
|
-
// Log
|
|
90
|
-
logger.error("Database
|
|
115
|
+
// Log structured error details and rethrow
|
|
116
|
+
logger.error("Database create operation failed", {
|
|
117
|
+
operation: 'createOneVerificationToken',
|
|
118
|
+
model: 'VerificationToken',
|
|
119
|
+
error: String(error),
|
|
120
|
+
isRetryable: isConnectionError,
|
|
121
|
+
});
|
|
91
122
|
throw error;
|
|
92
123
|
}
|
|
93
124
|
}
|
|
@@ -147,6 +178,27 @@ export const VerificationToken = {
|
|
|
147
178
|
}
|
|
148
179
|
catch (error) {
|
|
149
180
|
lastError = error;
|
|
181
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
182
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
183
|
+
error.message?.includes('violates unique constraint') ||
|
|
184
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
185
|
+
error.message?.includes('unique constraint') ||
|
|
186
|
+
error.message?.includes('23514') ||
|
|
187
|
+
error.message?.includes('23505') ||
|
|
188
|
+
error.message?.includes('P2002') ||
|
|
189
|
+
error.message?.includes('P2003');
|
|
190
|
+
if (isConstraintViolation) {
|
|
191
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
192
|
+
logger.error("Non-retryable constraint violation in createManyVerificationToken", {
|
|
193
|
+
operation: 'createManyVerificationToken',
|
|
194
|
+
model: 'VerificationToken',
|
|
195
|
+
error: String(error),
|
|
196
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
197
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
198
|
+
isRetryable: false,
|
|
199
|
+
});
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
150
202
|
// Check if this is a database connection error that we should retry
|
|
151
203
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
152
204
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -156,12 +208,22 @@ export const VerificationToken = {
|
|
|
156
208
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
157
209
|
retryCount++;
|
|
158
210
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
159
|
-
logger.warn("Database connection error, retrying..."
|
|
211
|
+
logger.warn("Database connection error in createManyVerificationToken, retrying...", {
|
|
212
|
+
operation: 'createManyVerificationToken',
|
|
213
|
+
model: 'VerificationToken',
|
|
214
|
+
attempt: retryCount,
|
|
215
|
+
maxRetries: MAX_RETRIES,
|
|
216
|
+
});
|
|
160
217
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
161
218
|
continue;
|
|
162
219
|
}
|
|
163
|
-
// Log
|
|
164
|
-
logger.error("Database
|
|
220
|
+
// Log structured error details and rethrow
|
|
221
|
+
logger.error("Database createMany operation failed", {
|
|
222
|
+
operation: 'createManyVerificationToken',
|
|
223
|
+
model: 'VerificationToken',
|
|
224
|
+
error: String(error),
|
|
225
|
+
isRetryable: isConnectionError,
|
|
226
|
+
});
|
|
165
227
|
throw error;
|
|
166
228
|
}
|
|
167
229
|
}
|
|
@@ -233,6 +295,28 @@ export const VerificationToken = {
|
|
|
233
295
|
}
|
|
234
296
|
catch (error) {
|
|
235
297
|
lastError = error;
|
|
298
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
299
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
300
|
+
error.message?.includes('violates unique constraint') ||
|
|
301
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
302
|
+
error.message?.includes('unique constraint') ||
|
|
303
|
+
error.message?.includes('23514') ||
|
|
304
|
+
error.message?.includes('23505') ||
|
|
305
|
+
error.message?.includes('P2002') ||
|
|
306
|
+
error.message?.includes('P2003');
|
|
307
|
+
if (isConstraintViolation) {
|
|
308
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
309
|
+
logger.error("Non-retryable constraint violation in updateOneVerificationToken", {
|
|
310
|
+
operation: 'updateOneVerificationToken',
|
|
311
|
+
model: 'VerificationToken',
|
|
312
|
+
error: String(error),
|
|
313
|
+
recordId: props.id,
|
|
314
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
315
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
316
|
+
isRetryable: false,
|
|
317
|
+
});
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
236
320
|
// Check if this is a database connection error that we should retry
|
|
237
321
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
238
322
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -242,12 +326,24 @@ export const VerificationToken = {
|
|
|
242
326
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
243
327
|
retryCount++;
|
|
244
328
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
245
|
-
logger.warn("Database connection error, retrying..."
|
|
329
|
+
logger.warn("Database connection error in updateOneVerificationToken, retrying...", {
|
|
330
|
+
operation: 'updateOneVerificationToken',
|
|
331
|
+
model: 'VerificationToken',
|
|
332
|
+
attempt: retryCount,
|
|
333
|
+
maxRetries: MAX_RETRIES,
|
|
334
|
+
recordId: props.id,
|
|
335
|
+
});
|
|
246
336
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
247
337
|
continue;
|
|
248
338
|
}
|
|
249
|
-
// Log
|
|
250
|
-
logger.error("Database
|
|
339
|
+
// Log structured error details and rethrow
|
|
340
|
+
logger.error("Database update operation failed", {
|
|
341
|
+
operation: 'updateOneVerificationToken',
|
|
342
|
+
model: 'VerificationToken',
|
|
343
|
+
error: String(error),
|
|
344
|
+
recordId: props.id,
|
|
345
|
+
isRetryable: isConnectionError,
|
|
346
|
+
});
|
|
251
347
|
throw error;
|
|
252
348
|
}
|
|
253
349
|
}
|
|
@@ -321,6 +417,28 @@ export const VerificationToken = {
|
|
|
321
417
|
}
|
|
322
418
|
catch (error) {
|
|
323
419
|
lastError = error;
|
|
420
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
421
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
422
|
+
error.message?.includes('violates unique constraint') ||
|
|
423
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
424
|
+
error.message?.includes('unique constraint') ||
|
|
425
|
+
error.message?.includes('23514') ||
|
|
426
|
+
error.message?.includes('23505') ||
|
|
427
|
+
error.message?.includes('P2002') ||
|
|
428
|
+
error.message?.includes('P2003');
|
|
429
|
+
if (isConstraintViolation) {
|
|
430
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
431
|
+
logger.error("Non-retryable constraint violation in upsertOneVerificationToken", {
|
|
432
|
+
operation: 'upsertOneVerificationToken',
|
|
433
|
+
model: 'VerificationToken',
|
|
434
|
+
error: String(error),
|
|
435
|
+
recordId: props.id,
|
|
436
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
437
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
438
|
+
isRetryable: false,
|
|
439
|
+
});
|
|
440
|
+
throw error;
|
|
441
|
+
}
|
|
324
442
|
// Check if this is a database connection error that we should retry
|
|
325
443
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
326
444
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -330,12 +448,24 @@ export const VerificationToken = {
|
|
|
330
448
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
331
449
|
retryCount++;
|
|
332
450
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
333
|
-
logger.warn("Database connection error, retrying..."
|
|
451
|
+
logger.warn("Database connection error in upsertOneVerificationToken, retrying...", {
|
|
452
|
+
operation: 'upsertOneVerificationToken',
|
|
453
|
+
model: 'VerificationToken',
|
|
454
|
+
attempt: retryCount,
|
|
455
|
+
maxRetries: MAX_RETRIES,
|
|
456
|
+
recordId: props.id,
|
|
457
|
+
});
|
|
334
458
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
335
459
|
continue;
|
|
336
460
|
}
|
|
337
|
-
// Log
|
|
338
|
-
logger.error("Database
|
|
461
|
+
// Log structured error details and rethrow
|
|
462
|
+
logger.error("Database upsert operation failed", {
|
|
463
|
+
operation: 'upsertOneVerificationToken',
|
|
464
|
+
model: 'VerificationToken',
|
|
465
|
+
error: String(error),
|
|
466
|
+
recordId: props.id,
|
|
467
|
+
isRetryable: isConnectionError,
|
|
468
|
+
});
|
|
339
469
|
throw error;
|
|
340
470
|
}
|
|
341
471
|
}
|
|
@@ -407,6 +537,27 @@ export const VerificationToken = {
|
|
|
407
537
|
}
|
|
408
538
|
catch (error) {
|
|
409
539
|
lastError = error;
|
|
540
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
541
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
542
|
+
error.message?.includes('violates unique constraint') ||
|
|
543
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
544
|
+
error.message?.includes('unique constraint') ||
|
|
545
|
+
error.message?.includes('23514') ||
|
|
546
|
+
error.message?.includes('23505') ||
|
|
547
|
+
error.message?.includes('P2002') ||
|
|
548
|
+
error.message?.includes('P2003');
|
|
549
|
+
if (isConstraintViolation) {
|
|
550
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
551
|
+
logger.error("Non-retryable constraint violation in updateManyVerificationToken", {
|
|
552
|
+
operation: 'updateManyVerificationToken',
|
|
553
|
+
model: 'VerificationToken',
|
|
554
|
+
error: String(error),
|
|
555
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
556
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
557
|
+
isRetryable: false,
|
|
558
|
+
});
|
|
559
|
+
throw error;
|
|
560
|
+
}
|
|
410
561
|
// Check if this is a database connection error that we should retry
|
|
411
562
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
412
563
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -416,12 +567,22 @@ export const VerificationToken = {
|
|
|
416
567
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
417
568
|
retryCount++;
|
|
418
569
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
419
|
-
logger.warn("Database connection error, retrying..."
|
|
570
|
+
logger.warn("Database connection error in updateManyVerificationToken, retrying...", {
|
|
571
|
+
operation: 'updateManyVerificationToken',
|
|
572
|
+
model: 'VerificationToken',
|
|
573
|
+
attempt: retryCount,
|
|
574
|
+
maxRetries: MAX_RETRIES,
|
|
575
|
+
});
|
|
420
576
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
421
577
|
continue;
|
|
422
578
|
}
|
|
423
|
-
// Log
|
|
424
|
-
logger.error("Database
|
|
579
|
+
// Log structured error details and rethrow
|
|
580
|
+
logger.error("Database updateMany operation failed", {
|
|
581
|
+
operation: 'updateManyVerificationToken',
|
|
582
|
+
model: 'VerificationToken',
|
|
583
|
+
error: String(error),
|
|
584
|
+
isRetryable: isConnectionError,
|
|
585
|
+
});
|
|
425
586
|
throw error;
|
|
426
587
|
}
|
|
427
588
|
}
|
|
@@ -479,6 +640,31 @@ export const VerificationToken = {
|
|
|
479
640
|
}
|
|
480
641
|
catch (error) {
|
|
481
642
|
lastError = error;
|
|
643
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
644
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
645
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
646
|
+
error.message?.includes('violates unique constraint') ||
|
|
647
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
648
|
+
error.message?.includes('unique constraint') ||
|
|
649
|
+
error.message?.includes('23514') ||
|
|
650
|
+
error.message?.includes('23505') ||
|
|
651
|
+
error.message?.includes('23503') ||
|
|
652
|
+
error.message?.includes('P2002') ||
|
|
653
|
+
error.message?.includes('P2003') ||
|
|
654
|
+
error.message?.includes('P2014');
|
|
655
|
+
if (isConstraintViolation) {
|
|
656
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
657
|
+
logger.error("Non-retryable constraint violation in deleteOneVerificationToken", {
|
|
658
|
+
operation: 'deleteOneVerificationToken',
|
|
659
|
+
model: 'VerificationToken',
|
|
660
|
+
error: String(error),
|
|
661
|
+
recordId: props.id,
|
|
662
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
663
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
664
|
+
isRetryable: false,
|
|
665
|
+
});
|
|
666
|
+
throw error;
|
|
667
|
+
}
|
|
482
668
|
// Check if this is a database connection error that we should retry
|
|
483
669
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
484
670
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -488,12 +674,24 @@ export const VerificationToken = {
|
|
|
488
674
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
489
675
|
retryCount++;
|
|
490
676
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
491
|
-
logger.warn("Database connection error, retrying..."
|
|
677
|
+
logger.warn("Database connection error in deleteOneVerificationToken, retrying...", {
|
|
678
|
+
operation: 'deleteOneVerificationToken',
|
|
679
|
+
model: 'VerificationToken',
|
|
680
|
+
attempt: retryCount,
|
|
681
|
+
maxRetries: MAX_RETRIES,
|
|
682
|
+
recordId: props.id,
|
|
683
|
+
});
|
|
492
684
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
493
685
|
continue;
|
|
494
686
|
}
|
|
495
|
-
// Log
|
|
496
|
-
logger.error("Database
|
|
687
|
+
// Log structured error details and rethrow
|
|
688
|
+
logger.error("Database delete operation failed", {
|
|
689
|
+
operation: 'deleteOneVerificationToken',
|
|
690
|
+
model: 'VerificationToken',
|
|
691
|
+
error: String(error),
|
|
692
|
+
recordId: props.id,
|
|
693
|
+
isRetryable: isConnectionError,
|
|
694
|
+
});
|
|
497
695
|
throw error;
|
|
498
696
|
}
|
|
499
697
|
}
|
|
@@ -559,12 +757,22 @@ export const VerificationToken = {
|
|
|
559
757
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
560
758
|
retryCount++;
|
|
561
759
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
562
|
-
logger.warn("Database connection error, retrying..."
|
|
760
|
+
logger.warn("Database connection error in getVerificationToken, retrying...", {
|
|
761
|
+
operation: 'getVerificationToken',
|
|
762
|
+
model: 'VerificationToken',
|
|
763
|
+
attempt: retryCount,
|
|
764
|
+
maxRetries: MAX_RETRIES,
|
|
765
|
+
});
|
|
563
766
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
564
767
|
continue;
|
|
565
768
|
}
|
|
566
|
-
// Log
|
|
567
|
-
logger.error("Database
|
|
769
|
+
// Log structured error details and rethrow
|
|
770
|
+
logger.error("Database get operation failed", {
|
|
771
|
+
operation: 'getVerificationToken',
|
|
772
|
+
model: 'VerificationToken',
|
|
773
|
+
error: String(error),
|
|
774
|
+
isRetryable: isConnectionError,
|
|
775
|
+
});
|
|
568
776
|
throw error;
|
|
569
777
|
}
|
|
570
778
|
}
|
|
@@ -621,12 +829,22 @@ export const VerificationToken = {
|
|
|
621
829
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
622
830
|
retryCount++;
|
|
623
831
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
624
|
-
logger.warn("Database connection error, retrying..."
|
|
832
|
+
logger.warn("Database connection error in getAllVerificationToken, retrying...", {
|
|
833
|
+
operation: 'getAllVerificationToken',
|
|
834
|
+
model: 'VerificationToken',
|
|
835
|
+
attempt: retryCount,
|
|
836
|
+
maxRetries: MAX_RETRIES,
|
|
837
|
+
});
|
|
625
838
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
626
839
|
continue;
|
|
627
840
|
}
|
|
628
|
-
// Log
|
|
629
|
-
logger.error("Database
|
|
841
|
+
// Log structured error details and rethrow
|
|
842
|
+
logger.error("Database getAll operation failed", {
|
|
843
|
+
operation: 'getAllVerificationToken',
|
|
844
|
+
model: 'VerificationToken',
|
|
845
|
+
error: String(error),
|
|
846
|
+
isRetryable: isConnectionError,
|
|
847
|
+
});
|
|
630
848
|
throw error;
|
|
631
849
|
}
|
|
632
850
|
}
|
|
@@ -699,12 +917,22 @@ export const VerificationToken = {
|
|
|
699
917
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
700
918
|
retryCount++;
|
|
701
919
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
702
|
-
logger.warn("Database connection error, retrying..."
|
|
920
|
+
logger.warn("Database connection error in findManyVerificationToken, retrying...", {
|
|
921
|
+
operation: 'findManyVerificationToken',
|
|
922
|
+
model: 'VerificationToken',
|
|
923
|
+
attempt: retryCount,
|
|
924
|
+
maxRetries: MAX_RETRIES,
|
|
925
|
+
});
|
|
703
926
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
704
927
|
continue;
|
|
705
928
|
}
|
|
706
|
-
// Log
|
|
707
|
-
logger.error("Database
|
|
929
|
+
// Log structured error details and rethrow
|
|
930
|
+
logger.error("Database findMany operation failed", {
|
|
931
|
+
operation: 'findManyVerificationToken',
|
|
932
|
+
model: 'VerificationToken',
|
|
933
|
+
error: String(error),
|
|
934
|
+
isRetryable: isConnectionError,
|
|
935
|
+
});
|
|
708
936
|
throw error;
|
|
709
937
|
}
|
|
710
938
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WaitlistEntry.d.ts","sourceRoot":"","sources":["../../src/WaitlistEntry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACzG,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAmM7G,eAAO,MAAM,aAAa;IAExB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,iBAAiB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"WaitlistEntry.d.ts","sourceRoot":"","sources":["../../src/WaitlistEntry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACzG,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAmM7G,eAAO,MAAM,aAAa;IAExB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,iBAAiB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAib5H;;;;;;OAMG;sBACqB,iBAAiB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAsHvI;;;;;;OAMG;kBACiB,iBAAiB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA8nC1H;;;;;;OAMG;kBACiB,iBAAiB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA07C1H;;;;;;OAMG;sBACqB,iBAAiB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA6nCvI;;;;;;OAMG;kBACiB,iBAAiB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAmH1H;;;;;;;OAOG;eACc,iBAAiB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAqFhJ;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC;IA4EzG;;;;;;;OAOG;oBACmB,iBAAiB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC;CA6FxJ,CAAC"}
|