@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/NewsArticle.mjs
CHANGED
|
@@ -328,6 +328,27 @@ export const NewsArticle = {
|
|
|
328
328
|
}
|
|
329
329
|
catch (error) {
|
|
330
330
|
lastError = error;
|
|
331
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
332
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
333
|
+
error.message?.includes('violates unique constraint') ||
|
|
334
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
335
|
+
error.message?.includes('unique constraint') ||
|
|
336
|
+
error.message?.includes('23514') ||
|
|
337
|
+
error.message?.includes('23505') ||
|
|
338
|
+
error.message?.includes('P2002') ||
|
|
339
|
+
error.message?.includes('P2003');
|
|
340
|
+
if (isConstraintViolation) {
|
|
341
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
342
|
+
logger.error("Non-retryable constraint violation in createOneNewsArticle", {
|
|
343
|
+
operation: 'createOneNewsArticle',
|
|
344
|
+
model: 'NewsArticle',
|
|
345
|
+
error: String(error),
|
|
346
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
347
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
348
|
+
isRetryable: false,
|
|
349
|
+
});
|
|
350
|
+
throw error;
|
|
351
|
+
}
|
|
331
352
|
// Check if this is a database connection error that we should retry
|
|
332
353
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
333
354
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -337,12 +358,22 @@ export const NewsArticle = {
|
|
|
337
358
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
338
359
|
retryCount++;
|
|
339
360
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
340
|
-
logger.warn("Database connection error, retrying..."
|
|
361
|
+
logger.warn("Database connection error in createOneNewsArticle, retrying...", {
|
|
362
|
+
operation: 'createOneNewsArticle',
|
|
363
|
+
model: 'NewsArticle',
|
|
364
|
+
attempt: retryCount,
|
|
365
|
+
maxRetries: MAX_RETRIES,
|
|
366
|
+
});
|
|
341
367
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
342
368
|
continue;
|
|
343
369
|
}
|
|
344
|
-
// Log
|
|
345
|
-
logger.error("Database
|
|
370
|
+
// Log structured error details and rethrow
|
|
371
|
+
logger.error("Database create operation failed", {
|
|
372
|
+
operation: 'createOneNewsArticle',
|
|
373
|
+
model: 'NewsArticle',
|
|
374
|
+
error: String(error),
|
|
375
|
+
isRetryable: isConnectionError,
|
|
376
|
+
});
|
|
346
377
|
throw error;
|
|
347
378
|
}
|
|
348
379
|
}
|
|
@@ -416,6 +447,27 @@ export const NewsArticle = {
|
|
|
416
447
|
}
|
|
417
448
|
catch (error) {
|
|
418
449
|
lastError = error;
|
|
450
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
451
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
452
|
+
error.message?.includes('violates unique constraint') ||
|
|
453
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
454
|
+
error.message?.includes('unique constraint') ||
|
|
455
|
+
error.message?.includes('23514') ||
|
|
456
|
+
error.message?.includes('23505') ||
|
|
457
|
+
error.message?.includes('P2002') ||
|
|
458
|
+
error.message?.includes('P2003');
|
|
459
|
+
if (isConstraintViolation) {
|
|
460
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
461
|
+
logger.error("Non-retryable constraint violation in createManyNewsArticle", {
|
|
462
|
+
operation: 'createManyNewsArticle',
|
|
463
|
+
model: 'NewsArticle',
|
|
464
|
+
error: String(error),
|
|
465
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
466
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
467
|
+
isRetryable: false,
|
|
468
|
+
});
|
|
469
|
+
throw error;
|
|
470
|
+
}
|
|
419
471
|
// Check if this is a database connection error that we should retry
|
|
420
472
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
421
473
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -425,12 +477,22 @@ export const NewsArticle = {
|
|
|
425
477
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
426
478
|
retryCount++;
|
|
427
479
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
428
|
-
logger.warn("Database connection error, retrying..."
|
|
480
|
+
logger.warn("Database connection error in createManyNewsArticle, retrying...", {
|
|
481
|
+
operation: 'createManyNewsArticle',
|
|
482
|
+
model: 'NewsArticle',
|
|
483
|
+
attempt: retryCount,
|
|
484
|
+
maxRetries: MAX_RETRIES,
|
|
485
|
+
});
|
|
429
486
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
430
487
|
continue;
|
|
431
488
|
}
|
|
432
|
-
// Log
|
|
433
|
-
logger.error("Database
|
|
489
|
+
// Log structured error details and rethrow
|
|
490
|
+
logger.error("Database createMany operation failed", {
|
|
491
|
+
operation: 'createManyNewsArticle',
|
|
492
|
+
model: 'NewsArticle',
|
|
493
|
+
error: String(error),
|
|
494
|
+
isRetryable: isConnectionError,
|
|
495
|
+
});
|
|
434
496
|
throw error;
|
|
435
497
|
}
|
|
436
498
|
}
|
|
@@ -1077,6 +1139,28 @@ export const NewsArticle = {
|
|
|
1077
1139
|
}
|
|
1078
1140
|
catch (error) {
|
|
1079
1141
|
lastError = error;
|
|
1142
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1143
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1144
|
+
error.message?.includes('violates unique constraint') ||
|
|
1145
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1146
|
+
error.message?.includes('unique constraint') ||
|
|
1147
|
+
error.message?.includes('23514') ||
|
|
1148
|
+
error.message?.includes('23505') ||
|
|
1149
|
+
error.message?.includes('P2002') ||
|
|
1150
|
+
error.message?.includes('P2003');
|
|
1151
|
+
if (isConstraintViolation) {
|
|
1152
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1153
|
+
logger.error("Non-retryable constraint violation in updateOneNewsArticle", {
|
|
1154
|
+
operation: 'updateOneNewsArticle',
|
|
1155
|
+
model: 'NewsArticle',
|
|
1156
|
+
error: String(error),
|
|
1157
|
+
recordId: props.id,
|
|
1158
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1159
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1160
|
+
isRetryable: false,
|
|
1161
|
+
});
|
|
1162
|
+
throw error;
|
|
1163
|
+
}
|
|
1080
1164
|
// Check if this is a database connection error that we should retry
|
|
1081
1165
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1082
1166
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1086,12 +1170,24 @@ export const NewsArticle = {
|
|
|
1086
1170
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1087
1171
|
retryCount++;
|
|
1088
1172
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1089
|
-
logger.warn("Database connection error, retrying..."
|
|
1173
|
+
logger.warn("Database connection error in updateOneNewsArticle, retrying...", {
|
|
1174
|
+
operation: 'updateOneNewsArticle',
|
|
1175
|
+
model: 'NewsArticle',
|
|
1176
|
+
attempt: retryCount,
|
|
1177
|
+
maxRetries: MAX_RETRIES,
|
|
1178
|
+
recordId: props.id,
|
|
1179
|
+
});
|
|
1090
1180
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1091
1181
|
continue;
|
|
1092
1182
|
}
|
|
1093
|
-
// Log
|
|
1094
|
-
logger.error("Database
|
|
1183
|
+
// Log structured error details and rethrow
|
|
1184
|
+
logger.error("Database update operation failed", {
|
|
1185
|
+
operation: 'updateOneNewsArticle',
|
|
1186
|
+
model: 'NewsArticle',
|
|
1187
|
+
error: String(error),
|
|
1188
|
+
recordId: props.id,
|
|
1189
|
+
isRetryable: isConnectionError,
|
|
1190
|
+
});
|
|
1095
1191
|
throw error;
|
|
1096
1192
|
}
|
|
1097
1193
|
}
|
|
@@ -1882,6 +1978,28 @@ export const NewsArticle = {
|
|
|
1882
1978
|
}
|
|
1883
1979
|
catch (error) {
|
|
1884
1980
|
lastError = error;
|
|
1981
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1982
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1983
|
+
error.message?.includes('violates unique constraint') ||
|
|
1984
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1985
|
+
error.message?.includes('unique constraint') ||
|
|
1986
|
+
error.message?.includes('23514') ||
|
|
1987
|
+
error.message?.includes('23505') ||
|
|
1988
|
+
error.message?.includes('P2002') ||
|
|
1989
|
+
error.message?.includes('P2003');
|
|
1990
|
+
if (isConstraintViolation) {
|
|
1991
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1992
|
+
logger.error("Non-retryable constraint violation in upsertOneNewsArticle", {
|
|
1993
|
+
operation: 'upsertOneNewsArticle',
|
|
1994
|
+
model: 'NewsArticle',
|
|
1995
|
+
error: String(error),
|
|
1996
|
+
recordId: props.id,
|
|
1997
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1998
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1999
|
+
isRetryable: false,
|
|
2000
|
+
});
|
|
2001
|
+
throw error;
|
|
2002
|
+
}
|
|
1885
2003
|
// Check if this is a database connection error that we should retry
|
|
1886
2004
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1887
2005
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1891,12 +2009,24 @@ export const NewsArticle = {
|
|
|
1891
2009
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1892
2010
|
retryCount++;
|
|
1893
2011
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1894
|
-
logger.warn("Database connection error, retrying..."
|
|
2012
|
+
logger.warn("Database connection error in upsertOneNewsArticle, retrying...", {
|
|
2013
|
+
operation: 'upsertOneNewsArticle',
|
|
2014
|
+
model: 'NewsArticle',
|
|
2015
|
+
attempt: retryCount,
|
|
2016
|
+
maxRetries: MAX_RETRIES,
|
|
2017
|
+
recordId: props.id,
|
|
2018
|
+
});
|
|
1895
2019
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1896
2020
|
continue;
|
|
1897
2021
|
}
|
|
1898
|
-
// Log
|
|
1899
|
-
logger.error("Database
|
|
2022
|
+
// Log structured error details and rethrow
|
|
2023
|
+
logger.error("Database upsert operation failed", {
|
|
2024
|
+
operation: 'upsertOneNewsArticle',
|
|
2025
|
+
model: 'NewsArticle',
|
|
2026
|
+
error: String(error),
|
|
2027
|
+
recordId: props.id,
|
|
2028
|
+
isRetryable: isConnectionError,
|
|
2029
|
+
});
|
|
1900
2030
|
throw error;
|
|
1901
2031
|
}
|
|
1902
2032
|
}
|
|
@@ -2543,6 +2673,27 @@ export const NewsArticle = {
|
|
|
2543
2673
|
}
|
|
2544
2674
|
catch (error) {
|
|
2545
2675
|
lastError = error;
|
|
2676
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
2677
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
2678
|
+
error.message?.includes('violates unique constraint') ||
|
|
2679
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
2680
|
+
error.message?.includes('unique constraint') ||
|
|
2681
|
+
error.message?.includes('23514') ||
|
|
2682
|
+
error.message?.includes('23505') ||
|
|
2683
|
+
error.message?.includes('P2002') ||
|
|
2684
|
+
error.message?.includes('P2003');
|
|
2685
|
+
if (isConstraintViolation) {
|
|
2686
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
2687
|
+
logger.error("Non-retryable constraint violation in updateManyNewsArticle", {
|
|
2688
|
+
operation: 'updateManyNewsArticle',
|
|
2689
|
+
model: 'NewsArticle',
|
|
2690
|
+
error: String(error),
|
|
2691
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
2692
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
2693
|
+
isRetryable: false,
|
|
2694
|
+
});
|
|
2695
|
+
throw error;
|
|
2696
|
+
}
|
|
2546
2697
|
// Check if this is a database connection error that we should retry
|
|
2547
2698
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
2548
2699
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -2552,12 +2703,22 @@ export const NewsArticle = {
|
|
|
2552
2703
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2553
2704
|
retryCount++;
|
|
2554
2705
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2555
|
-
logger.warn("Database connection error, retrying..."
|
|
2706
|
+
logger.warn("Database connection error in updateManyNewsArticle, retrying...", {
|
|
2707
|
+
operation: 'updateManyNewsArticle',
|
|
2708
|
+
model: 'NewsArticle',
|
|
2709
|
+
attempt: retryCount,
|
|
2710
|
+
maxRetries: MAX_RETRIES,
|
|
2711
|
+
});
|
|
2556
2712
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2557
2713
|
continue;
|
|
2558
2714
|
}
|
|
2559
|
-
// Log
|
|
2560
|
-
logger.error("Database
|
|
2715
|
+
// Log structured error details and rethrow
|
|
2716
|
+
logger.error("Database updateMany operation failed", {
|
|
2717
|
+
operation: 'updateManyNewsArticle',
|
|
2718
|
+
model: 'NewsArticle',
|
|
2719
|
+
error: String(error),
|
|
2720
|
+
isRetryable: isConnectionError,
|
|
2721
|
+
});
|
|
2561
2722
|
throw error;
|
|
2562
2723
|
}
|
|
2563
2724
|
}
|
|
@@ -2615,6 +2776,31 @@ export const NewsArticle = {
|
|
|
2615
2776
|
}
|
|
2616
2777
|
catch (error) {
|
|
2617
2778
|
lastError = error;
|
|
2779
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
2780
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
2781
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
2782
|
+
error.message?.includes('violates unique constraint') ||
|
|
2783
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
2784
|
+
error.message?.includes('unique constraint') ||
|
|
2785
|
+
error.message?.includes('23514') ||
|
|
2786
|
+
error.message?.includes('23505') ||
|
|
2787
|
+
error.message?.includes('23503') ||
|
|
2788
|
+
error.message?.includes('P2002') ||
|
|
2789
|
+
error.message?.includes('P2003') ||
|
|
2790
|
+
error.message?.includes('P2014');
|
|
2791
|
+
if (isConstraintViolation) {
|
|
2792
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
2793
|
+
logger.error("Non-retryable constraint violation in deleteOneNewsArticle", {
|
|
2794
|
+
operation: 'deleteOneNewsArticle',
|
|
2795
|
+
model: 'NewsArticle',
|
|
2796
|
+
error: String(error),
|
|
2797
|
+
recordId: props.id,
|
|
2798
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
2799
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
2800
|
+
isRetryable: false,
|
|
2801
|
+
});
|
|
2802
|
+
throw error;
|
|
2803
|
+
}
|
|
2618
2804
|
// Check if this is a database connection error that we should retry
|
|
2619
2805
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
2620
2806
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -2624,12 +2810,24 @@ export const NewsArticle = {
|
|
|
2624
2810
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2625
2811
|
retryCount++;
|
|
2626
2812
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2627
|
-
logger.warn("Database connection error, retrying..."
|
|
2813
|
+
logger.warn("Database connection error in deleteOneNewsArticle, retrying...", {
|
|
2814
|
+
operation: 'deleteOneNewsArticle',
|
|
2815
|
+
model: 'NewsArticle',
|
|
2816
|
+
attempt: retryCount,
|
|
2817
|
+
maxRetries: MAX_RETRIES,
|
|
2818
|
+
recordId: props.id,
|
|
2819
|
+
});
|
|
2628
2820
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2629
2821
|
continue;
|
|
2630
2822
|
}
|
|
2631
|
-
// Log
|
|
2632
|
-
logger.error("Database
|
|
2823
|
+
// Log structured error details and rethrow
|
|
2824
|
+
logger.error("Database delete operation failed", {
|
|
2825
|
+
operation: 'deleteOneNewsArticle',
|
|
2826
|
+
model: 'NewsArticle',
|
|
2827
|
+
error: String(error),
|
|
2828
|
+
recordId: props.id,
|
|
2829
|
+
isRetryable: isConnectionError,
|
|
2830
|
+
});
|
|
2633
2831
|
throw error;
|
|
2634
2832
|
}
|
|
2635
2833
|
}
|
|
@@ -2699,12 +2897,22 @@ export const NewsArticle = {
|
|
|
2699
2897
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2700
2898
|
retryCount++;
|
|
2701
2899
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2702
|
-
logger.warn("Database connection error, retrying..."
|
|
2900
|
+
logger.warn("Database connection error in getNewsArticle, retrying...", {
|
|
2901
|
+
operation: 'getNewsArticle',
|
|
2902
|
+
model: 'NewsArticle',
|
|
2903
|
+
attempt: retryCount,
|
|
2904
|
+
maxRetries: MAX_RETRIES,
|
|
2905
|
+
});
|
|
2703
2906
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2704
2907
|
continue;
|
|
2705
2908
|
}
|
|
2706
|
-
// Log
|
|
2707
|
-
logger.error("Database
|
|
2909
|
+
// Log structured error details and rethrow
|
|
2910
|
+
logger.error("Database get operation failed", {
|
|
2911
|
+
operation: 'getNewsArticle',
|
|
2912
|
+
model: 'NewsArticle',
|
|
2913
|
+
error: String(error),
|
|
2914
|
+
isRetryable: isConnectionError,
|
|
2915
|
+
});
|
|
2708
2916
|
throw error;
|
|
2709
2917
|
}
|
|
2710
2918
|
}
|
|
@@ -2761,12 +2969,22 @@ export const NewsArticle = {
|
|
|
2761
2969
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2762
2970
|
retryCount++;
|
|
2763
2971
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2764
|
-
logger.warn("Database connection error, retrying..."
|
|
2972
|
+
logger.warn("Database connection error in getAllNewsArticle, retrying...", {
|
|
2973
|
+
operation: 'getAllNewsArticle',
|
|
2974
|
+
model: 'NewsArticle',
|
|
2975
|
+
attempt: retryCount,
|
|
2976
|
+
maxRetries: MAX_RETRIES,
|
|
2977
|
+
});
|
|
2765
2978
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2766
2979
|
continue;
|
|
2767
2980
|
}
|
|
2768
|
-
// Log
|
|
2769
|
-
logger.error("Database
|
|
2981
|
+
// Log structured error details and rethrow
|
|
2982
|
+
logger.error("Database getAll operation failed", {
|
|
2983
|
+
operation: 'getAllNewsArticle',
|
|
2984
|
+
model: 'NewsArticle',
|
|
2985
|
+
error: String(error),
|
|
2986
|
+
isRetryable: isConnectionError,
|
|
2987
|
+
});
|
|
2770
2988
|
throw error;
|
|
2771
2989
|
}
|
|
2772
2990
|
}
|
|
@@ -2845,12 +3063,22 @@ export const NewsArticle = {
|
|
|
2845
3063
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2846
3064
|
retryCount++;
|
|
2847
3065
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2848
|
-
logger.warn("Database connection error, retrying..."
|
|
3066
|
+
logger.warn("Database connection error in findManyNewsArticle, retrying...", {
|
|
3067
|
+
operation: 'findManyNewsArticle',
|
|
3068
|
+
model: 'NewsArticle',
|
|
3069
|
+
attempt: retryCount,
|
|
3070
|
+
maxRetries: MAX_RETRIES,
|
|
3071
|
+
});
|
|
2849
3072
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2850
3073
|
continue;
|
|
2851
3074
|
}
|
|
2852
|
-
// Log
|
|
2853
|
-
logger.error("Database
|
|
3075
|
+
// Log structured error details and rethrow
|
|
3076
|
+
logger.error("Database findMany operation failed", {
|
|
3077
|
+
operation: 'findManyNewsArticle',
|
|
3078
|
+
model: 'NewsArticle',
|
|
3079
|
+
error: String(error),
|
|
3080
|
+
isRetryable: isConnectionError,
|
|
3081
|
+
});
|
|
2854
3082
|
throw error;
|
|
2855
3083
|
}
|
|
2856
3084
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewsArticleAssetSentiment.d.ts","sourceRoot":"","sources":["../../src/NewsArticleAssetSentiment.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,IAAI,6BAA6B,EAAE,MAAM,iEAAiE,CAAC;AAC7I,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AA4H7G,eAAO,MAAM,yBAAyB;IAEpC;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"NewsArticleAssetSentiment.d.ts","sourceRoot":"","sources":["../../src/NewsArticleAssetSentiment.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,IAAI,6BAA6B,EAAE,MAAM,iEAAiE,CAAC;AAC7I,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AA4H7G,eAAO,MAAM,yBAAyB;IAEpC;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAqQpJ;;;;;;OAMG;sBACqB,6BAA6B,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAkHnJ;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAslBlJ;;;;;;OAMG;kBACiB,6BAA6B,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IA4uBlJ;;;;;;OAMG;sBACqB,6BAA6B,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAqlBnJ;;;;;;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;IAwFxK;;;;;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;CAgGhL,CAAC"}
|