@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/OptionsContract.mjs
CHANGED
|
@@ -478,6 +478,27 @@ export const OptionsContract = {
|
|
|
478
478
|
}
|
|
479
479
|
catch (error) {
|
|
480
480
|
lastError = error;
|
|
481
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
482
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
483
|
+
error.message?.includes('violates unique constraint') ||
|
|
484
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
485
|
+
error.message?.includes('unique constraint') ||
|
|
486
|
+
error.message?.includes('23514') ||
|
|
487
|
+
error.message?.includes('23505') ||
|
|
488
|
+
error.message?.includes('P2002') ||
|
|
489
|
+
error.message?.includes('P2003');
|
|
490
|
+
if (isConstraintViolation) {
|
|
491
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
492
|
+
logger.error("Non-retryable constraint violation in createOneOptionsContract", {
|
|
493
|
+
operation: 'createOneOptionsContract',
|
|
494
|
+
model: 'OptionsContract',
|
|
495
|
+
error: String(error),
|
|
496
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
497
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
498
|
+
isRetryable: false,
|
|
499
|
+
});
|
|
500
|
+
throw error;
|
|
501
|
+
}
|
|
481
502
|
// Check if this is a database connection error that we should retry
|
|
482
503
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
483
504
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -487,12 +508,22 @@ export const OptionsContract = {
|
|
|
487
508
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
488
509
|
retryCount++;
|
|
489
510
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
490
|
-
logger.warn("Database connection error, retrying..."
|
|
511
|
+
logger.warn("Database connection error in createOneOptionsContract, retrying...", {
|
|
512
|
+
operation: 'createOneOptionsContract',
|
|
513
|
+
model: 'OptionsContract',
|
|
514
|
+
attempt: retryCount,
|
|
515
|
+
maxRetries: MAX_RETRIES,
|
|
516
|
+
});
|
|
491
517
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
492
518
|
continue;
|
|
493
519
|
}
|
|
494
|
-
// Log
|
|
495
|
-
logger.error("Database
|
|
520
|
+
// Log structured error details and rethrow
|
|
521
|
+
logger.error("Database create operation failed", {
|
|
522
|
+
operation: 'createOneOptionsContract',
|
|
523
|
+
model: 'OptionsContract',
|
|
524
|
+
error: String(error),
|
|
525
|
+
isRetryable: isConnectionError,
|
|
526
|
+
});
|
|
496
527
|
throw error;
|
|
497
528
|
}
|
|
498
529
|
}
|
|
@@ -561,6 +592,27 @@ export const OptionsContract = {
|
|
|
561
592
|
}
|
|
562
593
|
catch (error) {
|
|
563
594
|
lastError = error;
|
|
595
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
596
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
597
|
+
error.message?.includes('violates unique constraint') ||
|
|
598
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
599
|
+
error.message?.includes('unique constraint') ||
|
|
600
|
+
error.message?.includes('23514') ||
|
|
601
|
+
error.message?.includes('23505') ||
|
|
602
|
+
error.message?.includes('P2002') ||
|
|
603
|
+
error.message?.includes('P2003');
|
|
604
|
+
if (isConstraintViolation) {
|
|
605
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
606
|
+
logger.error("Non-retryable constraint violation in createManyOptionsContract", {
|
|
607
|
+
operation: 'createManyOptionsContract',
|
|
608
|
+
model: 'OptionsContract',
|
|
609
|
+
error: String(error),
|
|
610
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
611
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
612
|
+
isRetryable: false,
|
|
613
|
+
});
|
|
614
|
+
throw error;
|
|
615
|
+
}
|
|
564
616
|
// Check if this is a database connection error that we should retry
|
|
565
617
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
566
618
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -570,12 +622,22 @@ export const OptionsContract = {
|
|
|
570
622
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
571
623
|
retryCount++;
|
|
572
624
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
573
|
-
logger.warn("Database connection error, retrying..."
|
|
625
|
+
logger.warn("Database connection error in createManyOptionsContract, retrying...", {
|
|
626
|
+
operation: 'createManyOptionsContract',
|
|
627
|
+
model: 'OptionsContract',
|
|
628
|
+
attempt: retryCount,
|
|
629
|
+
maxRetries: MAX_RETRIES,
|
|
630
|
+
});
|
|
574
631
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
575
632
|
continue;
|
|
576
633
|
}
|
|
577
|
-
// Log
|
|
578
|
-
logger.error("Database
|
|
634
|
+
// Log structured error details and rethrow
|
|
635
|
+
logger.error("Database createMany operation failed", {
|
|
636
|
+
operation: 'createManyOptionsContract',
|
|
637
|
+
model: 'OptionsContract',
|
|
638
|
+
error: String(error),
|
|
639
|
+
isRetryable: isConnectionError,
|
|
640
|
+
});
|
|
579
641
|
throw error;
|
|
580
642
|
}
|
|
581
643
|
}
|
|
@@ -1687,6 +1749,28 @@ export const OptionsContract = {
|
|
|
1687
1749
|
}
|
|
1688
1750
|
catch (error) {
|
|
1689
1751
|
lastError = error;
|
|
1752
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1753
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1754
|
+
error.message?.includes('violates unique constraint') ||
|
|
1755
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1756
|
+
error.message?.includes('unique constraint') ||
|
|
1757
|
+
error.message?.includes('23514') ||
|
|
1758
|
+
error.message?.includes('23505') ||
|
|
1759
|
+
error.message?.includes('P2002') ||
|
|
1760
|
+
error.message?.includes('P2003');
|
|
1761
|
+
if (isConstraintViolation) {
|
|
1762
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1763
|
+
logger.error("Non-retryable constraint violation in updateOneOptionsContract", {
|
|
1764
|
+
operation: 'updateOneOptionsContract',
|
|
1765
|
+
model: 'OptionsContract',
|
|
1766
|
+
error: String(error),
|
|
1767
|
+
recordId: props.id,
|
|
1768
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1769
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1770
|
+
isRetryable: false,
|
|
1771
|
+
});
|
|
1772
|
+
throw error;
|
|
1773
|
+
}
|
|
1690
1774
|
// Check if this is a database connection error that we should retry
|
|
1691
1775
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1692
1776
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1696,12 +1780,24 @@ export const OptionsContract = {
|
|
|
1696
1780
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1697
1781
|
retryCount++;
|
|
1698
1782
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1699
|
-
logger.warn("Database connection error, retrying..."
|
|
1783
|
+
logger.warn("Database connection error in updateOneOptionsContract, retrying...", {
|
|
1784
|
+
operation: 'updateOneOptionsContract',
|
|
1785
|
+
model: 'OptionsContract',
|
|
1786
|
+
attempt: retryCount,
|
|
1787
|
+
maxRetries: MAX_RETRIES,
|
|
1788
|
+
recordId: props.id,
|
|
1789
|
+
});
|
|
1700
1790
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1701
1791
|
continue;
|
|
1702
1792
|
}
|
|
1703
|
-
// Log
|
|
1704
|
-
logger.error("Database
|
|
1793
|
+
// Log structured error details and rethrow
|
|
1794
|
+
logger.error("Database update operation failed", {
|
|
1795
|
+
operation: 'updateOneOptionsContract',
|
|
1796
|
+
model: 'OptionsContract',
|
|
1797
|
+
error: String(error),
|
|
1798
|
+
recordId: props.id,
|
|
1799
|
+
isRetryable: isConnectionError,
|
|
1800
|
+
});
|
|
1705
1801
|
throw error;
|
|
1706
1802
|
}
|
|
1707
1803
|
}
|
|
@@ -3032,6 +3128,28 @@ export const OptionsContract = {
|
|
|
3032
3128
|
}
|
|
3033
3129
|
catch (error) {
|
|
3034
3130
|
lastError = error;
|
|
3131
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3132
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
3133
|
+
error.message?.includes('violates unique constraint') ||
|
|
3134
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
3135
|
+
error.message?.includes('unique constraint') ||
|
|
3136
|
+
error.message?.includes('23514') ||
|
|
3137
|
+
error.message?.includes('23505') ||
|
|
3138
|
+
error.message?.includes('P2002') ||
|
|
3139
|
+
error.message?.includes('P2003');
|
|
3140
|
+
if (isConstraintViolation) {
|
|
3141
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
3142
|
+
logger.error("Non-retryable constraint violation in upsertOneOptionsContract", {
|
|
3143
|
+
operation: 'upsertOneOptionsContract',
|
|
3144
|
+
model: 'OptionsContract',
|
|
3145
|
+
error: String(error),
|
|
3146
|
+
recordId: props.id,
|
|
3147
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3148
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3149
|
+
isRetryable: false,
|
|
3150
|
+
});
|
|
3151
|
+
throw error;
|
|
3152
|
+
}
|
|
3035
3153
|
// Check if this is a database connection error that we should retry
|
|
3036
3154
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
3037
3155
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -3041,12 +3159,24 @@ export const OptionsContract = {
|
|
|
3041
3159
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3042
3160
|
retryCount++;
|
|
3043
3161
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3044
|
-
logger.warn("Database connection error, retrying..."
|
|
3162
|
+
logger.warn("Database connection error in upsertOneOptionsContract, retrying...", {
|
|
3163
|
+
operation: 'upsertOneOptionsContract',
|
|
3164
|
+
model: 'OptionsContract',
|
|
3165
|
+
attempt: retryCount,
|
|
3166
|
+
maxRetries: MAX_RETRIES,
|
|
3167
|
+
recordId: props.id,
|
|
3168
|
+
});
|
|
3045
3169
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3046
3170
|
continue;
|
|
3047
3171
|
}
|
|
3048
|
-
// Log
|
|
3049
|
-
logger.error("Database
|
|
3172
|
+
// Log structured error details and rethrow
|
|
3173
|
+
logger.error("Database upsert operation failed", {
|
|
3174
|
+
operation: 'upsertOneOptionsContract',
|
|
3175
|
+
model: 'OptionsContract',
|
|
3176
|
+
error: String(error),
|
|
3177
|
+
recordId: props.id,
|
|
3178
|
+
isRetryable: isConnectionError,
|
|
3179
|
+
});
|
|
3050
3180
|
throw error;
|
|
3051
3181
|
}
|
|
3052
3182
|
}
|
|
@@ -4158,6 +4288,27 @@ export const OptionsContract = {
|
|
|
4158
4288
|
}
|
|
4159
4289
|
catch (error) {
|
|
4160
4290
|
lastError = error;
|
|
4291
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4292
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
4293
|
+
error.message?.includes('violates unique constraint') ||
|
|
4294
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
4295
|
+
error.message?.includes('unique constraint') ||
|
|
4296
|
+
error.message?.includes('23514') ||
|
|
4297
|
+
error.message?.includes('23505') ||
|
|
4298
|
+
error.message?.includes('P2002') ||
|
|
4299
|
+
error.message?.includes('P2003');
|
|
4300
|
+
if (isConstraintViolation) {
|
|
4301
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
4302
|
+
logger.error("Non-retryable constraint violation in updateManyOptionsContract", {
|
|
4303
|
+
operation: 'updateManyOptionsContract',
|
|
4304
|
+
model: 'OptionsContract',
|
|
4305
|
+
error: String(error),
|
|
4306
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4307
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4308
|
+
isRetryable: false,
|
|
4309
|
+
});
|
|
4310
|
+
throw error;
|
|
4311
|
+
}
|
|
4161
4312
|
// Check if this is a database connection error that we should retry
|
|
4162
4313
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
4163
4314
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -4167,12 +4318,22 @@ export const OptionsContract = {
|
|
|
4167
4318
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4168
4319
|
retryCount++;
|
|
4169
4320
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4170
|
-
logger.warn("Database connection error, retrying..."
|
|
4321
|
+
logger.warn("Database connection error in updateManyOptionsContract, retrying...", {
|
|
4322
|
+
operation: 'updateManyOptionsContract',
|
|
4323
|
+
model: 'OptionsContract',
|
|
4324
|
+
attempt: retryCount,
|
|
4325
|
+
maxRetries: MAX_RETRIES,
|
|
4326
|
+
});
|
|
4171
4327
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4172
4328
|
continue;
|
|
4173
4329
|
}
|
|
4174
|
-
// Log
|
|
4175
|
-
logger.error("Database
|
|
4330
|
+
// Log structured error details and rethrow
|
|
4331
|
+
logger.error("Database updateMany operation failed", {
|
|
4332
|
+
operation: 'updateManyOptionsContract',
|
|
4333
|
+
model: 'OptionsContract',
|
|
4334
|
+
error: String(error),
|
|
4335
|
+
isRetryable: isConnectionError,
|
|
4336
|
+
});
|
|
4176
4337
|
throw error;
|
|
4177
4338
|
}
|
|
4178
4339
|
}
|
|
@@ -4230,6 +4391,31 @@ export const OptionsContract = {
|
|
|
4230
4391
|
}
|
|
4231
4392
|
catch (error) {
|
|
4232
4393
|
lastError = error;
|
|
4394
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4395
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
4396
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
4397
|
+
error.message?.includes('violates unique constraint') ||
|
|
4398
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
4399
|
+
error.message?.includes('unique constraint') ||
|
|
4400
|
+
error.message?.includes('23514') ||
|
|
4401
|
+
error.message?.includes('23505') ||
|
|
4402
|
+
error.message?.includes('23503') ||
|
|
4403
|
+
error.message?.includes('P2002') ||
|
|
4404
|
+
error.message?.includes('P2003') ||
|
|
4405
|
+
error.message?.includes('P2014');
|
|
4406
|
+
if (isConstraintViolation) {
|
|
4407
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
4408
|
+
logger.error("Non-retryable constraint violation in deleteOneOptionsContract", {
|
|
4409
|
+
operation: 'deleteOneOptionsContract',
|
|
4410
|
+
model: 'OptionsContract',
|
|
4411
|
+
error: String(error),
|
|
4412
|
+
recordId: props.id,
|
|
4413
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4414
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4415
|
+
isRetryable: false,
|
|
4416
|
+
});
|
|
4417
|
+
throw error;
|
|
4418
|
+
}
|
|
4233
4419
|
// Check if this is a database connection error that we should retry
|
|
4234
4420
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
4235
4421
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -4239,12 +4425,24 @@ export const OptionsContract = {
|
|
|
4239
4425
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4240
4426
|
retryCount++;
|
|
4241
4427
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4242
|
-
logger.warn("Database connection error, retrying..."
|
|
4428
|
+
logger.warn("Database connection error in deleteOneOptionsContract, retrying...", {
|
|
4429
|
+
operation: 'deleteOneOptionsContract',
|
|
4430
|
+
model: 'OptionsContract',
|
|
4431
|
+
attempt: retryCount,
|
|
4432
|
+
maxRetries: MAX_RETRIES,
|
|
4433
|
+
recordId: props.id,
|
|
4434
|
+
});
|
|
4243
4435
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4244
4436
|
continue;
|
|
4245
4437
|
}
|
|
4246
|
-
// Log
|
|
4247
|
-
logger.error("Database
|
|
4438
|
+
// Log structured error details and rethrow
|
|
4439
|
+
logger.error("Database delete operation failed", {
|
|
4440
|
+
operation: 'deleteOneOptionsContract',
|
|
4441
|
+
model: 'OptionsContract',
|
|
4442
|
+
error: String(error),
|
|
4443
|
+
recordId: props.id,
|
|
4444
|
+
isRetryable: isConnectionError,
|
|
4445
|
+
});
|
|
4248
4446
|
throw error;
|
|
4249
4447
|
}
|
|
4250
4448
|
}
|
|
@@ -4313,12 +4511,22 @@ export const OptionsContract = {
|
|
|
4313
4511
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4314
4512
|
retryCount++;
|
|
4315
4513
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4316
|
-
logger.warn("Database connection error, retrying..."
|
|
4514
|
+
logger.warn("Database connection error in getOptionsContract, retrying...", {
|
|
4515
|
+
operation: 'getOptionsContract',
|
|
4516
|
+
model: 'OptionsContract',
|
|
4517
|
+
attempt: retryCount,
|
|
4518
|
+
maxRetries: MAX_RETRIES,
|
|
4519
|
+
});
|
|
4317
4520
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4318
4521
|
continue;
|
|
4319
4522
|
}
|
|
4320
|
-
// Log
|
|
4321
|
-
logger.error("Database
|
|
4523
|
+
// Log structured error details and rethrow
|
|
4524
|
+
logger.error("Database get operation failed", {
|
|
4525
|
+
operation: 'getOptionsContract',
|
|
4526
|
+
model: 'OptionsContract',
|
|
4527
|
+
error: String(error),
|
|
4528
|
+
isRetryable: isConnectionError,
|
|
4529
|
+
});
|
|
4322
4530
|
throw error;
|
|
4323
4531
|
}
|
|
4324
4532
|
}
|
|
@@ -4375,12 +4583,22 @@ export const OptionsContract = {
|
|
|
4375
4583
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4376
4584
|
retryCount++;
|
|
4377
4585
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4378
|
-
logger.warn("Database connection error, retrying..."
|
|
4586
|
+
logger.warn("Database connection error in getAllOptionsContract, retrying...", {
|
|
4587
|
+
operation: 'getAllOptionsContract',
|
|
4588
|
+
model: 'OptionsContract',
|
|
4589
|
+
attempt: retryCount,
|
|
4590
|
+
maxRetries: MAX_RETRIES,
|
|
4591
|
+
});
|
|
4379
4592
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4380
4593
|
continue;
|
|
4381
4594
|
}
|
|
4382
|
-
// Log
|
|
4383
|
-
logger.error("Database
|
|
4595
|
+
// Log structured error details and rethrow
|
|
4596
|
+
logger.error("Database getAll operation failed", {
|
|
4597
|
+
operation: 'getAllOptionsContract',
|
|
4598
|
+
model: 'OptionsContract',
|
|
4599
|
+
error: String(error),
|
|
4600
|
+
isRetryable: isConnectionError,
|
|
4601
|
+
});
|
|
4384
4602
|
throw error;
|
|
4385
4603
|
}
|
|
4386
4604
|
}
|
|
@@ -4456,12 +4674,22 @@ export const OptionsContract = {
|
|
|
4456
4674
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4457
4675
|
retryCount++;
|
|
4458
4676
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4459
|
-
logger.warn("Database connection error, retrying..."
|
|
4677
|
+
logger.warn("Database connection error in findManyOptionsContract, retrying...", {
|
|
4678
|
+
operation: 'findManyOptionsContract',
|
|
4679
|
+
model: 'OptionsContract',
|
|
4680
|
+
attempt: retryCount,
|
|
4681
|
+
maxRetries: MAX_RETRIES,
|
|
4682
|
+
});
|
|
4460
4683
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4461
4684
|
continue;
|
|
4462
4685
|
}
|
|
4463
|
-
// Log
|
|
4464
|
-
logger.error("Database
|
|
4686
|
+
// Log structured error details and rethrow
|
|
4687
|
+
logger.error("Database findMany operation failed", {
|
|
4688
|
+
operation: 'findManyOptionsContract',
|
|
4689
|
+
model: 'OptionsContract',
|
|
4690
|
+
error: String(error),
|
|
4691
|
+
isRetryable: isConnectionError,
|
|
4692
|
+
});
|
|
4465
4693
|
throw error;
|
|
4466
4694
|
}
|
|
4467
4695
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsGreeksHistory.d.ts","sourceRoot":"","sources":["../../src/OptionsGreeksHistory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AAC9H,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAuM7G,eAAO,MAAM,oBAAoB;IAE/B;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionsGreeksHistory.d.ts","sourceRoot":"","sources":["../../src/OptionsGreeksHistory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AAC9H,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAuM7G,eAAO,MAAM,oBAAoB;IAE/B;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAsR1I;;;;;;OAMG;sBACqB,wBAAwB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAkH9I;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA67BxI;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAimCxI;;;;;;OAMG;sBACqB,wBAAwB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA47B9I;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAmHxI;;;;;;;OAOG;eACc,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;IAuF9J;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC;IA4EhH;;;;;;;OAOG;oBACmB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC;CA6FtK,CAAC"}
|