@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
|
@@ -236,7 +236,7 @@ exports.OptionsTradeExecution = {
|
|
|
236
236
|
* @returns The created OptionsTradeExecution or null.
|
|
237
237
|
*/
|
|
238
238
|
async create(props, globalClient) {
|
|
239
|
-
var _a, _b, _c, _d, _e;
|
|
239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
240
240
|
// Maximum number of retries for database connection issues
|
|
241
241
|
const MAX_RETRIES = 3;
|
|
242
242
|
let retryCount = 0;
|
|
@@ -526,21 +526,52 @@ exports.OptionsTradeExecution = {
|
|
|
526
526
|
}
|
|
527
527
|
catch (error) {
|
|
528
528
|
lastError = error;
|
|
529
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
530
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
531
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
532
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
533
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
534
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
535
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
536
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
537
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
538
|
+
if (isConstraintViolation) {
|
|
539
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
540
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneOptionsTradeExecution", {
|
|
541
|
+
operation: 'createOneOptionsTradeExecution',
|
|
542
|
+
model: 'OptionsTradeExecution',
|
|
543
|
+
error: String(error),
|
|
544
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
545
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
546
|
+
isRetryable: false,
|
|
547
|
+
});
|
|
548
|
+
throw error;
|
|
549
|
+
}
|
|
529
550
|
// Check if this is a database connection error that we should retry
|
|
530
|
-
const isConnectionError = ((
|
|
531
|
-
((
|
|
532
|
-
((
|
|
533
|
-
((
|
|
534
|
-
(error.networkError && ((
|
|
551
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
552
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
553
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
554
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
555
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
535
556
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
536
557
|
retryCount++;
|
|
537
558
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
538
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
559
|
+
logger_1.logger.warn("Database connection error in createOneOptionsTradeExecution, retrying...", {
|
|
560
|
+
operation: 'createOneOptionsTradeExecution',
|
|
561
|
+
model: 'OptionsTradeExecution',
|
|
562
|
+
attempt: retryCount,
|
|
563
|
+
maxRetries: MAX_RETRIES,
|
|
564
|
+
});
|
|
539
565
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
540
566
|
continue;
|
|
541
567
|
}
|
|
542
|
-
// Log
|
|
543
|
-
logger_1.logger.error("Database
|
|
568
|
+
// Log structured error details and rethrow
|
|
569
|
+
logger_1.logger.error("Database create operation failed", {
|
|
570
|
+
operation: 'createOneOptionsTradeExecution',
|
|
571
|
+
model: 'OptionsTradeExecution',
|
|
572
|
+
error: String(error),
|
|
573
|
+
isRetryable: isConnectionError,
|
|
574
|
+
});
|
|
544
575
|
throw error;
|
|
545
576
|
}
|
|
546
577
|
}
|
|
@@ -555,7 +586,7 @@ exports.OptionsTradeExecution = {
|
|
|
555
586
|
* @returns The count of created records or null.
|
|
556
587
|
*/
|
|
557
588
|
async createMany(props, globalClient) {
|
|
558
|
-
var _a, _b, _c, _d, _e;
|
|
589
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
559
590
|
// Maximum number of retries for database connection issues
|
|
560
591
|
const MAX_RETRIES = 3;
|
|
561
592
|
let retryCount = 0;
|
|
@@ -610,21 +641,52 @@ exports.OptionsTradeExecution = {
|
|
|
610
641
|
}
|
|
611
642
|
catch (error) {
|
|
612
643
|
lastError = error;
|
|
644
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
645
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
646
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
647
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
648
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
649
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
650
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
651
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
652
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
653
|
+
if (isConstraintViolation) {
|
|
654
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
655
|
+
logger_1.logger.error("Non-retryable constraint violation in createManyOptionsTradeExecution", {
|
|
656
|
+
operation: 'createManyOptionsTradeExecution',
|
|
657
|
+
model: 'OptionsTradeExecution',
|
|
658
|
+
error: String(error),
|
|
659
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
660
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
661
|
+
isRetryable: false,
|
|
662
|
+
});
|
|
663
|
+
throw error;
|
|
664
|
+
}
|
|
613
665
|
// Check if this is a database connection error that we should retry
|
|
614
|
-
const isConnectionError = ((
|
|
615
|
-
((
|
|
616
|
-
((
|
|
617
|
-
((
|
|
618
|
-
(error.networkError && ((
|
|
666
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
667
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
668
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
669
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
670
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
619
671
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
620
672
|
retryCount++;
|
|
621
673
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
622
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
674
|
+
logger_1.logger.warn("Database connection error in createManyOptionsTradeExecution, retrying...", {
|
|
675
|
+
operation: 'createManyOptionsTradeExecution',
|
|
676
|
+
model: 'OptionsTradeExecution',
|
|
677
|
+
attempt: retryCount,
|
|
678
|
+
maxRetries: MAX_RETRIES,
|
|
679
|
+
});
|
|
623
680
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
624
681
|
continue;
|
|
625
682
|
}
|
|
626
|
-
// Log
|
|
627
|
-
logger_1.logger.error("Database
|
|
683
|
+
// Log structured error details and rethrow
|
|
684
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
685
|
+
operation: 'createManyOptionsTradeExecution',
|
|
686
|
+
model: 'OptionsTradeExecution',
|
|
687
|
+
error: String(error),
|
|
688
|
+
isRetryable: isConnectionError,
|
|
689
|
+
});
|
|
628
690
|
throw error;
|
|
629
691
|
}
|
|
630
692
|
}
|
|
@@ -639,7 +701,7 @@ exports.OptionsTradeExecution = {
|
|
|
639
701
|
* @returns The updated OptionsTradeExecution or null.
|
|
640
702
|
*/
|
|
641
703
|
async update(props, globalClient) {
|
|
642
|
-
var _a, _b, _c, _d, _e;
|
|
704
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
643
705
|
// Maximum number of retries for database connection issues
|
|
644
706
|
const MAX_RETRIES = 3;
|
|
645
707
|
let retryCount = 0;
|
|
@@ -1898,21 +1960,55 @@ exports.OptionsTradeExecution = {
|
|
|
1898
1960
|
}
|
|
1899
1961
|
catch (error) {
|
|
1900
1962
|
lastError = error;
|
|
1963
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1964
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
1965
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
1966
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
1967
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
1968
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
1969
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
1970
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
1971
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
1972
|
+
if (isConstraintViolation) {
|
|
1973
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
1974
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneOptionsTradeExecution", {
|
|
1975
|
+
operation: 'updateOneOptionsTradeExecution',
|
|
1976
|
+
model: 'OptionsTradeExecution',
|
|
1977
|
+
error: String(error),
|
|
1978
|
+
recordId: props.id,
|
|
1979
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1980
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1981
|
+
isRetryable: false,
|
|
1982
|
+
});
|
|
1983
|
+
throw error;
|
|
1984
|
+
}
|
|
1901
1985
|
// Check if this is a database connection error that we should retry
|
|
1902
|
-
const isConnectionError = ((
|
|
1903
|
-
((
|
|
1904
|
-
((
|
|
1905
|
-
((
|
|
1906
|
-
(error.networkError && ((
|
|
1986
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
1987
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
1988
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
1989
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
1990
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
1907
1991
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1908
1992
|
retryCount++;
|
|
1909
1993
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1910
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1994
|
+
logger_1.logger.warn("Database connection error in updateOneOptionsTradeExecution, retrying...", {
|
|
1995
|
+
operation: 'updateOneOptionsTradeExecution',
|
|
1996
|
+
model: 'OptionsTradeExecution',
|
|
1997
|
+
attempt: retryCount,
|
|
1998
|
+
maxRetries: MAX_RETRIES,
|
|
1999
|
+
recordId: props.id,
|
|
2000
|
+
});
|
|
1911
2001
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1912
2002
|
continue;
|
|
1913
2003
|
}
|
|
1914
|
-
// Log
|
|
1915
|
-
logger_1.logger.error("Database
|
|
2004
|
+
// Log structured error details and rethrow
|
|
2005
|
+
logger_1.logger.error("Database update operation failed", {
|
|
2006
|
+
operation: 'updateOneOptionsTradeExecution',
|
|
2007
|
+
model: 'OptionsTradeExecution',
|
|
2008
|
+
error: String(error),
|
|
2009
|
+
recordId: props.id,
|
|
2010
|
+
isRetryable: isConnectionError,
|
|
2011
|
+
});
|
|
1916
2012
|
throw error;
|
|
1917
2013
|
}
|
|
1918
2014
|
}
|
|
@@ -1927,7 +2023,7 @@ exports.OptionsTradeExecution = {
|
|
|
1927
2023
|
* @returns The updated OptionsTradeExecution or null.
|
|
1928
2024
|
*/
|
|
1929
2025
|
async upsert(props, globalClient) {
|
|
1930
|
-
var _a, _b, _c, _d, _e;
|
|
2026
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1931
2027
|
// Maximum number of retries for database connection issues
|
|
1932
2028
|
const MAX_RETRIES = 3;
|
|
1933
2029
|
let retryCount = 0;
|
|
@@ -3425,21 +3521,55 @@ exports.OptionsTradeExecution = {
|
|
|
3425
3521
|
}
|
|
3426
3522
|
catch (error) {
|
|
3427
3523
|
lastError = error;
|
|
3524
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3525
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
3526
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
3527
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
3528
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
3529
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
3530
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
3531
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
3532
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
3533
|
+
if (isConstraintViolation) {
|
|
3534
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
3535
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneOptionsTradeExecution", {
|
|
3536
|
+
operation: 'upsertOneOptionsTradeExecution',
|
|
3537
|
+
model: 'OptionsTradeExecution',
|
|
3538
|
+
error: String(error),
|
|
3539
|
+
recordId: props.id,
|
|
3540
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3541
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3542
|
+
isRetryable: false,
|
|
3543
|
+
});
|
|
3544
|
+
throw error;
|
|
3545
|
+
}
|
|
3428
3546
|
// Check if this is a database connection error that we should retry
|
|
3429
|
-
const isConnectionError = ((
|
|
3430
|
-
((
|
|
3431
|
-
((
|
|
3432
|
-
((
|
|
3433
|
-
(error.networkError && ((
|
|
3547
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
3548
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
3549
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
3550
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
3551
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
3434
3552
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3435
3553
|
retryCount++;
|
|
3436
3554
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3437
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
3555
|
+
logger_1.logger.warn("Database connection error in upsertOneOptionsTradeExecution, retrying...", {
|
|
3556
|
+
operation: 'upsertOneOptionsTradeExecution',
|
|
3557
|
+
model: 'OptionsTradeExecution',
|
|
3558
|
+
attempt: retryCount,
|
|
3559
|
+
maxRetries: MAX_RETRIES,
|
|
3560
|
+
recordId: props.id,
|
|
3561
|
+
});
|
|
3438
3562
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3439
3563
|
continue;
|
|
3440
3564
|
}
|
|
3441
|
-
// Log
|
|
3442
|
-
logger_1.logger.error("Database
|
|
3565
|
+
// Log structured error details and rethrow
|
|
3566
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
3567
|
+
operation: 'upsertOneOptionsTradeExecution',
|
|
3568
|
+
model: 'OptionsTradeExecution',
|
|
3569
|
+
error: String(error),
|
|
3570
|
+
recordId: props.id,
|
|
3571
|
+
isRetryable: isConnectionError,
|
|
3572
|
+
});
|
|
3443
3573
|
throw error;
|
|
3444
3574
|
}
|
|
3445
3575
|
}
|
|
@@ -3454,7 +3584,7 @@ exports.OptionsTradeExecution = {
|
|
|
3454
3584
|
* @returns The count of created records or null.
|
|
3455
3585
|
*/
|
|
3456
3586
|
async updateMany(props, globalClient) {
|
|
3457
|
-
var _a, _b, _c, _d, _e;
|
|
3587
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
3458
3588
|
// Maximum number of retries for database connection issues
|
|
3459
3589
|
const MAX_RETRIES = 3;
|
|
3460
3590
|
let retryCount = 0;
|
|
@@ -4713,21 +4843,52 @@ exports.OptionsTradeExecution = {
|
|
|
4713
4843
|
}
|
|
4714
4844
|
catch (error) {
|
|
4715
4845
|
lastError = error;
|
|
4846
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4847
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
4848
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
4849
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
4850
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
4851
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
4852
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
4853
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
4854
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
4855
|
+
if (isConstraintViolation) {
|
|
4856
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
4857
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManyOptionsTradeExecution", {
|
|
4858
|
+
operation: 'updateManyOptionsTradeExecution',
|
|
4859
|
+
model: 'OptionsTradeExecution',
|
|
4860
|
+
error: String(error),
|
|
4861
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4862
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4863
|
+
isRetryable: false,
|
|
4864
|
+
});
|
|
4865
|
+
throw error;
|
|
4866
|
+
}
|
|
4716
4867
|
// Check if this is a database connection error that we should retry
|
|
4717
|
-
const isConnectionError = ((
|
|
4718
|
-
((
|
|
4719
|
-
((
|
|
4720
|
-
((
|
|
4721
|
-
(error.networkError && ((
|
|
4868
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
4869
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
4870
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
4871
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
4872
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
4722
4873
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4723
4874
|
retryCount++;
|
|
4724
4875
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4725
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
4876
|
+
logger_1.logger.warn("Database connection error in updateManyOptionsTradeExecution, retrying...", {
|
|
4877
|
+
operation: 'updateManyOptionsTradeExecution',
|
|
4878
|
+
model: 'OptionsTradeExecution',
|
|
4879
|
+
attempt: retryCount,
|
|
4880
|
+
maxRetries: MAX_RETRIES,
|
|
4881
|
+
});
|
|
4726
4882
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4727
4883
|
continue;
|
|
4728
4884
|
}
|
|
4729
|
-
// Log
|
|
4730
|
-
logger_1.logger.error("Database
|
|
4885
|
+
// Log structured error details and rethrow
|
|
4886
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
4887
|
+
operation: 'updateManyOptionsTradeExecution',
|
|
4888
|
+
model: 'OptionsTradeExecution',
|
|
4889
|
+
error: String(error),
|
|
4890
|
+
isRetryable: isConnectionError,
|
|
4891
|
+
});
|
|
4731
4892
|
throw error;
|
|
4732
4893
|
}
|
|
4733
4894
|
}
|
|
@@ -4742,7 +4903,7 @@ exports.OptionsTradeExecution = {
|
|
|
4742
4903
|
* @returns The deleted OptionsTradeExecution or null.
|
|
4743
4904
|
*/
|
|
4744
4905
|
async delete(props, globalClient) {
|
|
4745
|
-
var _a, _b, _c, _d, _e;
|
|
4906
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
4746
4907
|
// Maximum number of retries for database connection issues
|
|
4747
4908
|
const MAX_RETRIES = 3;
|
|
4748
4909
|
let retryCount = 0;
|
|
@@ -4786,21 +4947,58 @@ exports.OptionsTradeExecution = {
|
|
|
4786
4947
|
}
|
|
4787
4948
|
catch (error) {
|
|
4788
4949
|
lastError = error;
|
|
4950
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4951
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
4952
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
4953
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
4954
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
4955
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
4956
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
4957
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
4958
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
4959
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
4960
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
4961
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
4962
|
+
if (isConstraintViolation) {
|
|
4963
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
4964
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneOptionsTradeExecution", {
|
|
4965
|
+
operation: 'deleteOneOptionsTradeExecution',
|
|
4966
|
+
model: 'OptionsTradeExecution',
|
|
4967
|
+
error: String(error),
|
|
4968
|
+
recordId: props.id,
|
|
4969
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4970
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4971
|
+
isRetryable: false,
|
|
4972
|
+
});
|
|
4973
|
+
throw error;
|
|
4974
|
+
}
|
|
4789
4975
|
// Check if this is a database connection error that we should retry
|
|
4790
|
-
const isConnectionError = ((
|
|
4791
|
-
((
|
|
4792
|
-
((
|
|
4793
|
-
((
|
|
4794
|
-
(error.networkError && ((
|
|
4976
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
4977
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
4978
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
4979
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
4980
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
4795
4981
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4796
4982
|
retryCount++;
|
|
4797
4983
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4798
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
4984
|
+
logger_1.logger.warn("Database connection error in deleteOneOptionsTradeExecution, retrying...", {
|
|
4985
|
+
operation: 'deleteOneOptionsTradeExecution',
|
|
4986
|
+
model: 'OptionsTradeExecution',
|
|
4987
|
+
attempt: retryCount,
|
|
4988
|
+
maxRetries: MAX_RETRIES,
|
|
4989
|
+
recordId: props.id,
|
|
4990
|
+
});
|
|
4799
4991
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4800
4992
|
continue;
|
|
4801
4993
|
}
|
|
4802
|
-
// Log
|
|
4803
|
-
logger_1.logger.error("Database
|
|
4994
|
+
// Log structured error details and rethrow
|
|
4995
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
4996
|
+
operation: 'deleteOneOptionsTradeExecution',
|
|
4997
|
+
model: 'OptionsTradeExecution',
|
|
4998
|
+
error: String(error),
|
|
4999
|
+
recordId: props.id,
|
|
5000
|
+
isRetryable: isConnectionError,
|
|
5001
|
+
});
|
|
4804
5002
|
throw error;
|
|
4805
5003
|
}
|
|
4806
5004
|
}
|
|
@@ -4879,12 +5077,22 @@ exports.OptionsTradeExecution = {
|
|
|
4879
5077
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4880
5078
|
retryCount++;
|
|
4881
5079
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4882
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
5080
|
+
logger_1.logger.warn("Database connection error in getOptionsTradeExecution, retrying...", {
|
|
5081
|
+
operation: 'getOptionsTradeExecution',
|
|
5082
|
+
model: 'OptionsTradeExecution',
|
|
5083
|
+
attempt: retryCount,
|
|
5084
|
+
maxRetries: MAX_RETRIES,
|
|
5085
|
+
});
|
|
4883
5086
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4884
5087
|
continue;
|
|
4885
5088
|
}
|
|
4886
|
-
// Log
|
|
4887
|
-
logger_1.logger.error("Database
|
|
5089
|
+
// Log structured error details and rethrow
|
|
5090
|
+
logger_1.logger.error("Database get operation failed", {
|
|
5091
|
+
operation: 'getOptionsTradeExecution',
|
|
5092
|
+
model: 'OptionsTradeExecution',
|
|
5093
|
+
error: String(error),
|
|
5094
|
+
isRetryable: isConnectionError,
|
|
5095
|
+
});
|
|
4888
5096
|
throw error;
|
|
4889
5097
|
}
|
|
4890
5098
|
}
|
|
@@ -4942,12 +5150,22 @@ exports.OptionsTradeExecution = {
|
|
|
4942
5150
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4943
5151
|
retryCount++;
|
|
4944
5152
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4945
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
5153
|
+
logger_1.logger.warn("Database connection error in getAllOptionsTradeExecution, retrying...", {
|
|
5154
|
+
operation: 'getAllOptionsTradeExecution',
|
|
5155
|
+
model: 'OptionsTradeExecution',
|
|
5156
|
+
attempt: retryCount,
|
|
5157
|
+
maxRetries: MAX_RETRIES,
|
|
5158
|
+
});
|
|
4946
5159
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4947
5160
|
continue;
|
|
4948
5161
|
}
|
|
4949
|
-
// Log
|
|
4950
|
-
logger_1.logger.error("Database
|
|
5162
|
+
// Log structured error details and rethrow
|
|
5163
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
5164
|
+
operation: 'getAllOptionsTradeExecution',
|
|
5165
|
+
model: 'OptionsTradeExecution',
|
|
5166
|
+
error: String(error),
|
|
5167
|
+
isRetryable: isConnectionError,
|
|
5168
|
+
});
|
|
4951
5169
|
throw error;
|
|
4952
5170
|
}
|
|
4953
5171
|
}
|
|
@@ -5033,12 +5251,22 @@ exports.OptionsTradeExecution = {
|
|
|
5033
5251
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
5034
5252
|
retryCount++;
|
|
5035
5253
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
5036
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
5254
|
+
logger_1.logger.warn("Database connection error in findManyOptionsTradeExecution, retrying...", {
|
|
5255
|
+
operation: 'findManyOptionsTradeExecution',
|
|
5256
|
+
model: 'OptionsTradeExecution',
|
|
5257
|
+
attempt: retryCount,
|
|
5258
|
+
maxRetries: MAX_RETRIES,
|
|
5259
|
+
});
|
|
5037
5260
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
5038
5261
|
continue;
|
|
5039
5262
|
}
|
|
5040
|
-
// Log
|
|
5041
|
-
logger_1.logger.error("Database
|
|
5263
|
+
// Log structured error details and rethrow
|
|
5264
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
5265
|
+
operation: 'findManyOptionsTradeExecution',
|
|
5266
|
+
model: 'OptionsTradeExecution',
|
|
5267
|
+
error: String(error),
|
|
5268
|
+
isRetryable: isConnectionError,
|
|
5269
|
+
});
|
|
5042
5270
|
throw error;
|
|
5043
5271
|
}
|
|
5044
5272
|
}
|