@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
|
@@ -420,6 +420,27 @@ export const OptionsGreeksHistory = {
|
|
|
420
420
|
}
|
|
421
421
|
catch (error) {
|
|
422
422
|
lastError = error;
|
|
423
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
424
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
425
|
+
error.message?.includes('violates unique constraint') ||
|
|
426
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
427
|
+
error.message?.includes('unique constraint') ||
|
|
428
|
+
error.message?.includes('23514') ||
|
|
429
|
+
error.message?.includes('23505') ||
|
|
430
|
+
error.message?.includes('P2002') ||
|
|
431
|
+
error.message?.includes('P2003');
|
|
432
|
+
if (isConstraintViolation) {
|
|
433
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
434
|
+
logger.error("Non-retryable constraint violation in createOneOptionsGreeksHistory", {
|
|
435
|
+
operation: 'createOneOptionsGreeksHistory',
|
|
436
|
+
model: 'OptionsGreeksHistory',
|
|
437
|
+
error: String(error),
|
|
438
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
439
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
440
|
+
isRetryable: false,
|
|
441
|
+
});
|
|
442
|
+
throw error;
|
|
443
|
+
}
|
|
423
444
|
// Check if this is a database connection error that we should retry
|
|
424
445
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
425
446
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -429,12 +450,22 @@ export const OptionsGreeksHistory = {
|
|
|
429
450
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
430
451
|
retryCount++;
|
|
431
452
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
432
|
-
logger.warn("Database connection error, retrying..."
|
|
453
|
+
logger.warn("Database connection error in createOneOptionsGreeksHistory, retrying...", {
|
|
454
|
+
operation: 'createOneOptionsGreeksHistory',
|
|
455
|
+
model: 'OptionsGreeksHistory',
|
|
456
|
+
attempt: retryCount,
|
|
457
|
+
maxRetries: MAX_RETRIES,
|
|
458
|
+
});
|
|
433
459
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
434
460
|
continue;
|
|
435
461
|
}
|
|
436
|
-
// Log
|
|
437
|
-
logger.error("Database
|
|
462
|
+
// Log structured error details and rethrow
|
|
463
|
+
logger.error("Database create operation failed", {
|
|
464
|
+
operation: 'createOneOptionsGreeksHistory',
|
|
465
|
+
model: 'OptionsGreeksHistory',
|
|
466
|
+
error: String(error),
|
|
467
|
+
isRetryable: isConnectionError,
|
|
468
|
+
});
|
|
438
469
|
throw error;
|
|
439
470
|
}
|
|
440
471
|
}
|
|
@@ -497,6 +528,27 @@ export const OptionsGreeksHistory = {
|
|
|
497
528
|
}
|
|
498
529
|
catch (error) {
|
|
499
530
|
lastError = error;
|
|
531
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
532
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
533
|
+
error.message?.includes('violates unique constraint') ||
|
|
534
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
535
|
+
error.message?.includes('unique constraint') ||
|
|
536
|
+
error.message?.includes('23514') ||
|
|
537
|
+
error.message?.includes('23505') ||
|
|
538
|
+
error.message?.includes('P2002') ||
|
|
539
|
+
error.message?.includes('P2003');
|
|
540
|
+
if (isConstraintViolation) {
|
|
541
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
542
|
+
logger.error("Non-retryable constraint violation in createManyOptionsGreeksHistory", {
|
|
543
|
+
operation: 'createManyOptionsGreeksHistory',
|
|
544
|
+
model: 'OptionsGreeksHistory',
|
|
545
|
+
error: String(error),
|
|
546
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
547
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
548
|
+
isRetryable: false,
|
|
549
|
+
});
|
|
550
|
+
throw error;
|
|
551
|
+
}
|
|
500
552
|
// Check if this is a database connection error that we should retry
|
|
501
553
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
502
554
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -506,12 +558,22 @@ export const OptionsGreeksHistory = {
|
|
|
506
558
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
507
559
|
retryCount++;
|
|
508
560
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
509
|
-
logger.warn("Database connection error, retrying..."
|
|
561
|
+
logger.warn("Database connection error in createManyOptionsGreeksHistory, retrying...", {
|
|
562
|
+
operation: 'createManyOptionsGreeksHistory',
|
|
563
|
+
model: 'OptionsGreeksHistory',
|
|
564
|
+
attempt: retryCount,
|
|
565
|
+
maxRetries: MAX_RETRIES,
|
|
566
|
+
});
|
|
510
567
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
511
568
|
continue;
|
|
512
569
|
}
|
|
513
|
-
// Log
|
|
514
|
-
logger.error("Database
|
|
570
|
+
// Log structured error details and rethrow
|
|
571
|
+
logger.error("Database createMany operation failed", {
|
|
572
|
+
operation: 'createManyOptionsGreeksHistory',
|
|
573
|
+
model: 'OptionsGreeksHistory',
|
|
574
|
+
error: String(error),
|
|
575
|
+
isRetryable: isConnectionError,
|
|
576
|
+
});
|
|
515
577
|
throw error;
|
|
516
578
|
}
|
|
517
579
|
}
|
|
@@ -1414,6 +1476,28 @@ export const OptionsGreeksHistory = {
|
|
|
1414
1476
|
}
|
|
1415
1477
|
catch (error) {
|
|
1416
1478
|
lastError = error;
|
|
1479
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1480
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1481
|
+
error.message?.includes('violates unique constraint') ||
|
|
1482
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1483
|
+
error.message?.includes('unique constraint') ||
|
|
1484
|
+
error.message?.includes('23514') ||
|
|
1485
|
+
error.message?.includes('23505') ||
|
|
1486
|
+
error.message?.includes('P2002') ||
|
|
1487
|
+
error.message?.includes('P2003');
|
|
1488
|
+
if (isConstraintViolation) {
|
|
1489
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1490
|
+
logger.error("Non-retryable constraint violation in updateOneOptionsGreeksHistory", {
|
|
1491
|
+
operation: 'updateOneOptionsGreeksHistory',
|
|
1492
|
+
model: 'OptionsGreeksHistory',
|
|
1493
|
+
error: String(error),
|
|
1494
|
+
recordId: props.id,
|
|
1495
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1496
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1497
|
+
isRetryable: false,
|
|
1498
|
+
});
|
|
1499
|
+
throw error;
|
|
1500
|
+
}
|
|
1417
1501
|
// Check if this is a database connection error that we should retry
|
|
1418
1502
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1419
1503
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1423,12 +1507,24 @@ export const OptionsGreeksHistory = {
|
|
|
1423
1507
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1424
1508
|
retryCount++;
|
|
1425
1509
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1426
|
-
logger.warn("Database connection error, retrying..."
|
|
1510
|
+
logger.warn("Database connection error in updateOneOptionsGreeksHistory, retrying...", {
|
|
1511
|
+
operation: 'updateOneOptionsGreeksHistory',
|
|
1512
|
+
model: 'OptionsGreeksHistory',
|
|
1513
|
+
attempt: retryCount,
|
|
1514
|
+
maxRetries: MAX_RETRIES,
|
|
1515
|
+
recordId: props.id,
|
|
1516
|
+
});
|
|
1427
1517
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1428
1518
|
continue;
|
|
1429
1519
|
}
|
|
1430
|
-
// Log
|
|
1431
|
-
logger.error("Database
|
|
1520
|
+
// Log structured error details and rethrow
|
|
1521
|
+
logger.error("Database update operation failed", {
|
|
1522
|
+
operation: 'updateOneOptionsGreeksHistory',
|
|
1523
|
+
model: 'OptionsGreeksHistory',
|
|
1524
|
+
error: String(error),
|
|
1525
|
+
recordId: props.id,
|
|
1526
|
+
isRetryable: isConnectionError,
|
|
1527
|
+
});
|
|
1432
1528
|
throw error;
|
|
1433
1529
|
}
|
|
1434
1530
|
}
|
|
@@ -2495,6 +2591,28 @@ export const OptionsGreeksHistory = {
|
|
|
2495
2591
|
}
|
|
2496
2592
|
catch (error) {
|
|
2497
2593
|
lastError = error;
|
|
2594
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
2595
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
2596
|
+
error.message?.includes('violates unique constraint') ||
|
|
2597
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
2598
|
+
error.message?.includes('unique constraint') ||
|
|
2599
|
+
error.message?.includes('23514') ||
|
|
2600
|
+
error.message?.includes('23505') ||
|
|
2601
|
+
error.message?.includes('P2002') ||
|
|
2602
|
+
error.message?.includes('P2003');
|
|
2603
|
+
if (isConstraintViolation) {
|
|
2604
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
2605
|
+
logger.error("Non-retryable constraint violation in upsertOneOptionsGreeksHistory", {
|
|
2606
|
+
operation: 'upsertOneOptionsGreeksHistory',
|
|
2607
|
+
model: 'OptionsGreeksHistory',
|
|
2608
|
+
error: String(error),
|
|
2609
|
+
recordId: props.id,
|
|
2610
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
2611
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
2612
|
+
isRetryable: false,
|
|
2613
|
+
});
|
|
2614
|
+
throw error;
|
|
2615
|
+
}
|
|
2498
2616
|
// Check if this is a database connection error that we should retry
|
|
2499
2617
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
2500
2618
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -2504,12 +2622,24 @@ export const OptionsGreeksHistory = {
|
|
|
2504
2622
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2505
2623
|
retryCount++;
|
|
2506
2624
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2507
|
-
logger.warn("Database connection error, retrying..."
|
|
2625
|
+
logger.warn("Database connection error in upsertOneOptionsGreeksHistory, retrying...", {
|
|
2626
|
+
operation: 'upsertOneOptionsGreeksHistory',
|
|
2627
|
+
model: 'OptionsGreeksHistory',
|
|
2628
|
+
attempt: retryCount,
|
|
2629
|
+
maxRetries: MAX_RETRIES,
|
|
2630
|
+
recordId: props.id,
|
|
2631
|
+
});
|
|
2508
2632
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2509
2633
|
continue;
|
|
2510
2634
|
}
|
|
2511
|
-
// Log
|
|
2512
|
-
logger.error("Database
|
|
2635
|
+
// Log structured error details and rethrow
|
|
2636
|
+
logger.error("Database upsert operation failed", {
|
|
2637
|
+
operation: 'upsertOneOptionsGreeksHistory',
|
|
2638
|
+
model: 'OptionsGreeksHistory',
|
|
2639
|
+
error: String(error),
|
|
2640
|
+
recordId: props.id,
|
|
2641
|
+
isRetryable: isConnectionError,
|
|
2642
|
+
});
|
|
2513
2643
|
throw error;
|
|
2514
2644
|
}
|
|
2515
2645
|
}
|
|
@@ -3412,6 +3542,27 @@ export const OptionsGreeksHistory = {
|
|
|
3412
3542
|
}
|
|
3413
3543
|
catch (error) {
|
|
3414
3544
|
lastError = error;
|
|
3545
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3546
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
3547
|
+
error.message?.includes('violates unique constraint') ||
|
|
3548
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
3549
|
+
error.message?.includes('unique constraint') ||
|
|
3550
|
+
error.message?.includes('23514') ||
|
|
3551
|
+
error.message?.includes('23505') ||
|
|
3552
|
+
error.message?.includes('P2002') ||
|
|
3553
|
+
error.message?.includes('P2003');
|
|
3554
|
+
if (isConstraintViolation) {
|
|
3555
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
3556
|
+
logger.error("Non-retryable constraint violation in updateManyOptionsGreeksHistory", {
|
|
3557
|
+
operation: 'updateManyOptionsGreeksHistory',
|
|
3558
|
+
model: 'OptionsGreeksHistory',
|
|
3559
|
+
error: String(error),
|
|
3560
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3561
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3562
|
+
isRetryable: false,
|
|
3563
|
+
});
|
|
3564
|
+
throw error;
|
|
3565
|
+
}
|
|
3415
3566
|
// Check if this is a database connection error that we should retry
|
|
3416
3567
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
3417
3568
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -3421,12 +3572,22 @@ export const OptionsGreeksHistory = {
|
|
|
3421
3572
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3422
3573
|
retryCount++;
|
|
3423
3574
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3424
|
-
logger.warn("Database connection error, retrying..."
|
|
3575
|
+
logger.warn("Database connection error in updateManyOptionsGreeksHistory, retrying...", {
|
|
3576
|
+
operation: 'updateManyOptionsGreeksHistory',
|
|
3577
|
+
model: 'OptionsGreeksHistory',
|
|
3578
|
+
attempt: retryCount,
|
|
3579
|
+
maxRetries: MAX_RETRIES,
|
|
3580
|
+
});
|
|
3425
3581
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3426
3582
|
continue;
|
|
3427
3583
|
}
|
|
3428
|
-
// Log
|
|
3429
|
-
logger.error("Database
|
|
3584
|
+
// Log structured error details and rethrow
|
|
3585
|
+
logger.error("Database updateMany operation failed", {
|
|
3586
|
+
operation: 'updateManyOptionsGreeksHistory',
|
|
3587
|
+
model: 'OptionsGreeksHistory',
|
|
3588
|
+
error: String(error),
|
|
3589
|
+
isRetryable: isConnectionError,
|
|
3590
|
+
});
|
|
3430
3591
|
throw error;
|
|
3431
3592
|
}
|
|
3432
3593
|
}
|
|
@@ -3484,6 +3645,31 @@ export const OptionsGreeksHistory = {
|
|
|
3484
3645
|
}
|
|
3485
3646
|
catch (error) {
|
|
3486
3647
|
lastError = error;
|
|
3648
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3649
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
3650
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
3651
|
+
error.message?.includes('violates unique constraint') ||
|
|
3652
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
3653
|
+
error.message?.includes('unique constraint') ||
|
|
3654
|
+
error.message?.includes('23514') ||
|
|
3655
|
+
error.message?.includes('23505') ||
|
|
3656
|
+
error.message?.includes('23503') ||
|
|
3657
|
+
error.message?.includes('P2002') ||
|
|
3658
|
+
error.message?.includes('P2003') ||
|
|
3659
|
+
error.message?.includes('P2014');
|
|
3660
|
+
if (isConstraintViolation) {
|
|
3661
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
3662
|
+
logger.error("Non-retryable constraint violation in deleteOneOptionsGreeksHistory", {
|
|
3663
|
+
operation: 'deleteOneOptionsGreeksHistory',
|
|
3664
|
+
model: 'OptionsGreeksHistory',
|
|
3665
|
+
error: String(error),
|
|
3666
|
+
recordId: props.id,
|
|
3667
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3668
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3669
|
+
isRetryable: false,
|
|
3670
|
+
});
|
|
3671
|
+
throw error;
|
|
3672
|
+
}
|
|
3487
3673
|
// Check if this is a database connection error that we should retry
|
|
3488
3674
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
3489
3675
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -3493,12 +3679,24 @@ export const OptionsGreeksHistory = {
|
|
|
3493
3679
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3494
3680
|
retryCount++;
|
|
3495
3681
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3496
|
-
logger.warn("Database connection error, retrying..."
|
|
3682
|
+
logger.warn("Database connection error in deleteOneOptionsGreeksHistory, retrying...", {
|
|
3683
|
+
operation: 'deleteOneOptionsGreeksHistory',
|
|
3684
|
+
model: 'OptionsGreeksHistory',
|
|
3685
|
+
attempt: retryCount,
|
|
3686
|
+
maxRetries: MAX_RETRIES,
|
|
3687
|
+
recordId: props.id,
|
|
3688
|
+
});
|
|
3497
3689
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3498
3690
|
continue;
|
|
3499
3691
|
}
|
|
3500
|
-
// Log
|
|
3501
|
-
logger.error("Database
|
|
3692
|
+
// Log structured error details and rethrow
|
|
3693
|
+
logger.error("Database delete operation failed", {
|
|
3694
|
+
operation: 'deleteOneOptionsGreeksHistory',
|
|
3695
|
+
model: 'OptionsGreeksHistory',
|
|
3696
|
+
error: String(error),
|
|
3697
|
+
recordId: props.id,
|
|
3698
|
+
isRetryable: isConnectionError,
|
|
3699
|
+
});
|
|
3502
3700
|
throw error;
|
|
3503
3701
|
}
|
|
3504
3702
|
}
|
|
@@ -3567,12 +3765,22 @@ export const OptionsGreeksHistory = {
|
|
|
3567
3765
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3568
3766
|
retryCount++;
|
|
3569
3767
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3570
|
-
logger.warn("Database connection error, retrying..."
|
|
3768
|
+
logger.warn("Database connection error in getOptionsGreeksHistory, retrying...", {
|
|
3769
|
+
operation: 'getOptionsGreeksHistory',
|
|
3770
|
+
model: 'OptionsGreeksHistory',
|
|
3771
|
+
attempt: retryCount,
|
|
3772
|
+
maxRetries: MAX_RETRIES,
|
|
3773
|
+
});
|
|
3571
3774
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3572
3775
|
continue;
|
|
3573
3776
|
}
|
|
3574
|
-
// Log
|
|
3575
|
-
logger.error("Database
|
|
3777
|
+
// Log structured error details and rethrow
|
|
3778
|
+
logger.error("Database get operation failed", {
|
|
3779
|
+
operation: 'getOptionsGreeksHistory',
|
|
3780
|
+
model: 'OptionsGreeksHistory',
|
|
3781
|
+
error: String(error),
|
|
3782
|
+
isRetryable: isConnectionError,
|
|
3783
|
+
});
|
|
3576
3784
|
throw error;
|
|
3577
3785
|
}
|
|
3578
3786
|
}
|
|
@@ -3629,12 +3837,22 @@ export const OptionsGreeksHistory = {
|
|
|
3629
3837
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3630
3838
|
retryCount++;
|
|
3631
3839
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3632
|
-
logger.warn("Database connection error, retrying..."
|
|
3840
|
+
logger.warn("Database connection error in getAllOptionsGreeksHistory, retrying...", {
|
|
3841
|
+
operation: 'getAllOptionsGreeksHistory',
|
|
3842
|
+
model: 'OptionsGreeksHistory',
|
|
3843
|
+
attempt: retryCount,
|
|
3844
|
+
maxRetries: MAX_RETRIES,
|
|
3845
|
+
});
|
|
3633
3846
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3634
3847
|
continue;
|
|
3635
3848
|
}
|
|
3636
|
-
// Log
|
|
3637
|
-
logger.error("Database
|
|
3849
|
+
// Log structured error details and rethrow
|
|
3850
|
+
logger.error("Database getAll operation failed", {
|
|
3851
|
+
operation: 'getAllOptionsGreeksHistory',
|
|
3852
|
+
model: 'OptionsGreeksHistory',
|
|
3853
|
+
error: String(error),
|
|
3854
|
+
isRetryable: isConnectionError,
|
|
3855
|
+
});
|
|
3638
3856
|
throw error;
|
|
3639
3857
|
}
|
|
3640
3858
|
}
|
|
@@ -3710,12 +3928,22 @@ export const OptionsGreeksHistory = {
|
|
|
3710
3928
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3711
3929
|
retryCount++;
|
|
3712
3930
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3713
|
-
logger.warn("Database connection error, retrying..."
|
|
3931
|
+
logger.warn("Database connection error in findManyOptionsGreeksHistory, retrying...", {
|
|
3932
|
+
operation: 'findManyOptionsGreeksHistory',
|
|
3933
|
+
model: 'OptionsGreeksHistory',
|
|
3934
|
+
attempt: retryCount,
|
|
3935
|
+
maxRetries: MAX_RETRIES,
|
|
3936
|
+
});
|
|
3714
3937
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3715
3938
|
continue;
|
|
3716
3939
|
}
|
|
3717
|
-
// Log
|
|
3718
|
-
logger.error("Database
|
|
3940
|
+
// Log structured error details and rethrow
|
|
3941
|
+
logger.error("Database findMany operation failed", {
|
|
3942
|
+
operation: 'findManyOptionsGreeksHistory',
|
|
3943
|
+
model: 'OptionsGreeksHistory',
|
|
3944
|
+
error: String(error),
|
|
3945
|
+
isRetryable: isConnectionError,
|
|
3946
|
+
});
|
|
3719
3947
|
throw error;
|
|
3720
3948
|
}
|
|
3721
3949
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsPosition.d.ts","sourceRoot":"","sources":["../../src/OptionsPosition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC/G,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AA2N7G,eAAO,MAAM,eAAe;IAE1B;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,mBAAmB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionsPosition.d.ts","sourceRoot":"","sources":["../../src/OptionsPosition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC/G,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AA2N7G,eAAO,MAAM,eAAe;IAE1B;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,mBAAmB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAqWhI;;;;;;OAMG;sBACqB,mBAAmB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAwHzI;;;;;;OAMG;kBACiB,mBAAmB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAyyC9H;;;;;;OAMG;kBACiB,mBAAmB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAyhD9H;;;;;;OAMG;sBACqB,mBAAmB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAwyCzI;;;;;;OAMG;kBACiB,mBAAmB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmH9H;;;;;;;OAOG;eACc,mBAAmB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IA0FpJ;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC;IA4E3G;;;;;;;OAOG;oBACmB,mBAAmB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC;CAgG5J,CAAC"}
|