@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/OptionsPosition.mjs
CHANGED
|
@@ -519,6 +519,27 @@ export const OptionsPosition = {
|
|
|
519
519
|
}
|
|
520
520
|
catch (error) {
|
|
521
521
|
lastError = error;
|
|
522
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
523
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
524
|
+
error.message?.includes('violates unique constraint') ||
|
|
525
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
526
|
+
error.message?.includes('unique constraint') ||
|
|
527
|
+
error.message?.includes('23514') ||
|
|
528
|
+
error.message?.includes('23505') ||
|
|
529
|
+
error.message?.includes('P2002') ||
|
|
530
|
+
error.message?.includes('P2003');
|
|
531
|
+
if (isConstraintViolation) {
|
|
532
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
533
|
+
logger.error("Non-retryable constraint violation in createOneOptionsPosition", {
|
|
534
|
+
operation: 'createOneOptionsPosition',
|
|
535
|
+
model: 'OptionsPosition',
|
|
536
|
+
error: String(error),
|
|
537
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
538
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
539
|
+
isRetryable: false,
|
|
540
|
+
});
|
|
541
|
+
throw error;
|
|
542
|
+
}
|
|
522
543
|
// Check if this is a database connection error that we should retry
|
|
523
544
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
524
545
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -528,12 +549,22 @@ export const OptionsPosition = {
|
|
|
528
549
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
529
550
|
retryCount++;
|
|
530
551
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
531
|
-
logger.warn("Database connection error, retrying..."
|
|
552
|
+
logger.warn("Database connection error in createOneOptionsPosition, retrying...", {
|
|
553
|
+
operation: 'createOneOptionsPosition',
|
|
554
|
+
model: 'OptionsPosition',
|
|
555
|
+
attempt: retryCount,
|
|
556
|
+
maxRetries: MAX_RETRIES,
|
|
557
|
+
});
|
|
532
558
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
533
559
|
continue;
|
|
534
560
|
}
|
|
535
|
-
// Log
|
|
536
|
-
logger.error("Database
|
|
561
|
+
// Log structured error details and rethrow
|
|
562
|
+
logger.error("Database create operation failed", {
|
|
563
|
+
operation: 'createOneOptionsPosition',
|
|
564
|
+
model: 'OptionsPosition',
|
|
565
|
+
error: String(error),
|
|
566
|
+
isRetryable: isConnectionError,
|
|
567
|
+
});
|
|
537
568
|
throw error;
|
|
538
569
|
}
|
|
539
570
|
}
|
|
@@ -602,6 +633,27 @@ export const OptionsPosition = {
|
|
|
602
633
|
}
|
|
603
634
|
catch (error) {
|
|
604
635
|
lastError = error;
|
|
636
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
637
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
638
|
+
error.message?.includes('violates unique constraint') ||
|
|
639
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
640
|
+
error.message?.includes('unique constraint') ||
|
|
641
|
+
error.message?.includes('23514') ||
|
|
642
|
+
error.message?.includes('23505') ||
|
|
643
|
+
error.message?.includes('P2002') ||
|
|
644
|
+
error.message?.includes('P2003');
|
|
645
|
+
if (isConstraintViolation) {
|
|
646
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
647
|
+
logger.error("Non-retryable constraint violation in createManyOptionsPosition", {
|
|
648
|
+
operation: 'createManyOptionsPosition',
|
|
649
|
+
model: 'OptionsPosition',
|
|
650
|
+
error: String(error),
|
|
651
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
652
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
653
|
+
isRetryable: false,
|
|
654
|
+
});
|
|
655
|
+
throw error;
|
|
656
|
+
}
|
|
605
657
|
// Check if this is a database connection error that we should retry
|
|
606
658
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
607
659
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -611,12 +663,22 @@ export const OptionsPosition = {
|
|
|
611
663
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
612
664
|
retryCount++;
|
|
613
665
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
614
|
-
logger.warn("Database connection error, retrying..."
|
|
666
|
+
logger.warn("Database connection error in createManyOptionsPosition, retrying...", {
|
|
667
|
+
operation: 'createManyOptionsPosition',
|
|
668
|
+
model: 'OptionsPosition',
|
|
669
|
+
attempt: retryCount,
|
|
670
|
+
maxRetries: MAX_RETRIES,
|
|
671
|
+
});
|
|
615
672
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
616
673
|
continue;
|
|
617
674
|
}
|
|
618
|
-
// Log
|
|
619
|
-
logger.error("Database
|
|
675
|
+
// Log structured error details and rethrow
|
|
676
|
+
logger.error("Database createMany operation failed", {
|
|
677
|
+
operation: 'createManyOptionsPosition',
|
|
678
|
+
model: 'OptionsPosition',
|
|
679
|
+
error: String(error),
|
|
680
|
+
isRetryable: isConnectionError,
|
|
681
|
+
});
|
|
620
682
|
throw error;
|
|
621
683
|
}
|
|
622
684
|
}
|
|
@@ -1883,6 +1945,28 @@ export const OptionsPosition = {
|
|
|
1883
1945
|
}
|
|
1884
1946
|
catch (error) {
|
|
1885
1947
|
lastError = error;
|
|
1948
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1949
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1950
|
+
error.message?.includes('violates unique constraint') ||
|
|
1951
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1952
|
+
error.message?.includes('unique constraint') ||
|
|
1953
|
+
error.message?.includes('23514') ||
|
|
1954
|
+
error.message?.includes('23505') ||
|
|
1955
|
+
error.message?.includes('P2002') ||
|
|
1956
|
+
error.message?.includes('P2003');
|
|
1957
|
+
if (isConstraintViolation) {
|
|
1958
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1959
|
+
logger.error("Non-retryable constraint violation in updateOneOptionsPosition", {
|
|
1960
|
+
operation: 'updateOneOptionsPosition',
|
|
1961
|
+
model: 'OptionsPosition',
|
|
1962
|
+
error: String(error),
|
|
1963
|
+
recordId: props.id,
|
|
1964
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1965
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1966
|
+
isRetryable: false,
|
|
1967
|
+
});
|
|
1968
|
+
throw error;
|
|
1969
|
+
}
|
|
1886
1970
|
// Check if this is a database connection error that we should retry
|
|
1887
1971
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1888
1972
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1892,12 +1976,24 @@ export const OptionsPosition = {
|
|
|
1892
1976
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1893
1977
|
retryCount++;
|
|
1894
1978
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1895
|
-
logger.warn("Database connection error, retrying..."
|
|
1979
|
+
logger.warn("Database connection error in updateOneOptionsPosition, retrying...", {
|
|
1980
|
+
operation: 'updateOneOptionsPosition',
|
|
1981
|
+
model: 'OptionsPosition',
|
|
1982
|
+
attempt: retryCount,
|
|
1983
|
+
maxRetries: MAX_RETRIES,
|
|
1984
|
+
recordId: props.id,
|
|
1985
|
+
});
|
|
1896
1986
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1897
1987
|
continue;
|
|
1898
1988
|
}
|
|
1899
|
-
// Log
|
|
1900
|
-
logger.error("Database
|
|
1989
|
+
// Log structured error details and rethrow
|
|
1990
|
+
logger.error("Database update operation failed", {
|
|
1991
|
+
operation: 'updateOneOptionsPosition',
|
|
1992
|
+
model: 'OptionsPosition',
|
|
1993
|
+
error: String(error),
|
|
1994
|
+
recordId: props.id,
|
|
1995
|
+
isRetryable: isConnectionError,
|
|
1996
|
+
});
|
|
1901
1997
|
throw error;
|
|
1902
1998
|
}
|
|
1903
1999
|
}
|
|
@@ -3404,6 +3500,28 @@ export const OptionsPosition = {
|
|
|
3404
3500
|
}
|
|
3405
3501
|
catch (error) {
|
|
3406
3502
|
lastError = error;
|
|
3503
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3504
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
3505
|
+
error.message?.includes('violates unique constraint') ||
|
|
3506
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
3507
|
+
error.message?.includes('unique constraint') ||
|
|
3508
|
+
error.message?.includes('23514') ||
|
|
3509
|
+
error.message?.includes('23505') ||
|
|
3510
|
+
error.message?.includes('P2002') ||
|
|
3511
|
+
error.message?.includes('P2003');
|
|
3512
|
+
if (isConstraintViolation) {
|
|
3513
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
3514
|
+
logger.error("Non-retryable constraint violation in upsertOneOptionsPosition", {
|
|
3515
|
+
operation: 'upsertOneOptionsPosition',
|
|
3516
|
+
model: 'OptionsPosition',
|
|
3517
|
+
error: String(error),
|
|
3518
|
+
recordId: props.id,
|
|
3519
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3520
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3521
|
+
isRetryable: false,
|
|
3522
|
+
});
|
|
3523
|
+
throw error;
|
|
3524
|
+
}
|
|
3407
3525
|
// Check if this is a database connection error that we should retry
|
|
3408
3526
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
3409
3527
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -3413,12 +3531,24 @@ export const OptionsPosition = {
|
|
|
3413
3531
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3414
3532
|
retryCount++;
|
|
3415
3533
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3416
|
-
logger.warn("Database connection error, retrying..."
|
|
3534
|
+
logger.warn("Database connection error in upsertOneOptionsPosition, retrying...", {
|
|
3535
|
+
operation: 'upsertOneOptionsPosition',
|
|
3536
|
+
model: 'OptionsPosition',
|
|
3537
|
+
attempt: retryCount,
|
|
3538
|
+
maxRetries: MAX_RETRIES,
|
|
3539
|
+
recordId: props.id,
|
|
3540
|
+
});
|
|
3417
3541
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3418
3542
|
continue;
|
|
3419
3543
|
}
|
|
3420
|
-
// Log
|
|
3421
|
-
logger.error("Database
|
|
3544
|
+
// Log structured error details and rethrow
|
|
3545
|
+
logger.error("Database upsert operation failed", {
|
|
3546
|
+
operation: 'upsertOneOptionsPosition',
|
|
3547
|
+
model: 'OptionsPosition',
|
|
3548
|
+
error: String(error),
|
|
3549
|
+
recordId: props.id,
|
|
3550
|
+
isRetryable: isConnectionError,
|
|
3551
|
+
});
|
|
3422
3552
|
throw error;
|
|
3423
3553
|
}
|
|
3424
3554
|
}
|
|
@@ -4685,6 +4815,27 @@ export const OptionsPosition = {
|
|
|
4685
4815
|
}
|
|
4686
4816
|
catch (error) {
|
|
4687
4817
|
lastError = error;
|
|
4818
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4819
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
4820
|
+
error.message?.includes('violates unique constraint') ||
|
|
4821
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
4822
|
+
error.message?.includes('unique constraint') ||
|
|
4823
|
+
error.message?.includes('23514') ||
|
|
4824
|
+
error.message?.includes('23505') ||
|
|
4825
|
+
error.message?.includes('P2002') ||
|
|
4826
|
+
error.message?.includes('P2003');
|
|
4827
|
+
if (isConstraintViolation) {
|
|
4828
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
4829
|
+
logger.error("Non-retryable constraint violation in updateManyOptionsPosition", {
|
|
4830
|
+
operation: 'updateManyOptionsPosition',
|
|
4831
|
+
model: 'OptionsPosition',
|
|
4832
|
+
error: String(error),
|
|
4833
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4834
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4835
|
+
isRetryable: false,
|
|
4836
|
+
});
|
|
4837
|
+
throw error;
|
|
4838
|
+
}
|
|
4688
4839
|
// Check if this is a database connection error that we should retry
|
|
4689
4840
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
4690
4841
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -4694,12 +4845,22 @@ export const OptionsPosition = {
|
|
|
4694
4845
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4695
4846
|
retryCount++;
|
|
4696
4847
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4697
|
-
logger.warn("Database connection error, retrying..."
|
|
4848
|
+
logger.warn("Database connection error in updateManyOptionsPosition, retrying...", {
|
|
4849
|
+
operation: 'updateManyOptionsPosition',
|
|
4850
|
+
model: 'OptionsPosition',
|
|
4851
|
+
attempt: retryCount,
|
|
4852
|
+
maxRetries: MAX_RETRIES,
|
|
4853
|
+
});
|
|
4698
4854
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4699
4855
|
continue;
|
|
4700
4856
|
}
|
|
4701
|
-
// Log
|
|
4702
|
-
logger.error("Database
|
|
4857
|
+
// Log structured error details and rethrow
|
|
4858
|
+
logger.error("Database updateMany operation failed", {
|
|
4859
|
+
operation: 'updateManyOptionsPosition',
|
|
4860
|
+
model: 'OptionsPosition',
|
|
4861
|
+
error: String(error),
|
|
4862
|
+
isRetryable: isConnectionError,
|
|
4863
|
+
});
|
|
4703
4864
|
throw error;
|
|
4704
4865
|
}
|
|
4705
4866
|
}
|
|
@@ -4757,6 +4918,31 @@ export const OptionsPosition = {
|
|
|
4757
4918
|
}
|
|
4758
4919
|
catch (error) {
|
|
4759
4920
|
lastError = error;
|
|
4921
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4922
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
4923
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
4924
|
+
error.message?.includes('violates unique constraint') ||
|
|
4925
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
4926
|
+
error.message?.includes('unique constraint') ||
|
|
4927
|
+
error.message?.includes('23514') ||
|
|
4928
|
+
error.message?.includes('23505') ||
|
|
4929
|
+
error.message?.includes('23503') ||
|
|
4930
|
+
error.message?.includes('P2002') ||
|
|
4931
|
+
error.message?.includes('P2003') ||
|
|
4932
|
+
error.message?.includes('P2014');
|
|
4933
|
+
if (isConstraintViolation) {
|
|
4934
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
4935
|
+
logger.error("Non-retryable constraint violation in deleteOneOptionsPosition", {
|
|
4936
|
+
operation: 'deleteOneOptionsPosition',
|
|
4937
|
+
model: 'OptionsPosition',
|
|
4938
|
+
error: String(error),
|
|
4939
|
+
recordId: props.id,
|
|
4940
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4941
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4942
|
+
isRetryable: false,
|
|
4943
|
+
});
|
|
4944
|
+
throw error;
|
|
4945
|
+
}
|
|
4760
4946
|
// Check if this is a database connection error that we should retry
|
|
4761
4947
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
4762
4948
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -4766,12 +4952,24 @@ export const OptionsPosition = {
|
|
|
4766
4952
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4767
4953
|
retryCount++;
|
|
4768
4954
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4769
|
-
logger.warn("Database connection error, retrying..."
|
|
4955
|
+
logger.warn("Database connection error in deleteOneOptionsPosition, retrying...", {
|
|
4956
|
+
operation: 'deleteOneOptionsPosition',
|
|
4957
|
+
model: 'OptionsPosition',
|
|
4958
|
+
attempt: retryCount,
|
|
4959
|
+
maxRetries: MAX_RETRIES,
|
|
4960
|
+
recordId: props.id,
|
|
4961
|
+
});
|
|
4770
4962
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4771
4963
|
continue;
|
|
4772
4964
|
}
|
|
4773
|
-
// Log
|
|
4774
|
-
logger.error("Database
|
|
4965
|
+
// Log structured error details and rethrow
|
|
4966
|
+
logger.error("Database delete operation failed", {
|
|
4967
|
+
operation: 'deleteOneOptionsPosition',
|
|
4968
|
+
model: 'OptionsPosition',
|
|
4969
|
+
error: String(error),
|
|
4970
|
+
recordId: props.id,
|
|
4971
|
+
isRetryable: isConnectionError,
|
|
4972
|
+
});
|
|
4775
4973
|
throw error;
|
|
4776
4974
|
}
|
|
4777
4975
|
}
|
|
@@ -4843,12 +5041,22 @@ export const OptionsPosition = {
|
|
|
4843
5041
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4844
5042
|
retryCount++;
|
|
4845
5043
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4846
|
-
logger.warn("Database connection error, retrying..."
|
|
5044
|
+
logger.warn("Database connection error in getOptionsPosition, retrying...", {
|
|
5045
|
+
operation: 'getOptionsPosition',
|
|
5046
|
+
model: 'OptionsPosition',
|
|
5047
|
+
attempt: retryCount,
|
|
5048
|
+
maxRetries: MAX_RETRIES,
|
|
5049
|
+
});
|
|
4847
5050
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4848
5051
|
continue;
|
|
4849
5052
|
}
|
|
4850
|
-
// Log
|
|
4851
|
-
logger.error("Database
|
|
5053
|
+
// Log structured error details and rethrow
|
|
5054
|
+
logger.error("Database get operation failed", {
|
|
5055
|
+
operation: 'getOptionsPosition',
|
|
5056
|
+
model: 'OptionsPosition',
|
|
5057
|
+
error: String(error),
|
|
5058
|
+
isRetryable: isConnectionError,
|
|
5059
|
+
});
|
|
4852
5060
|
throw error;
|
|
4853
5061
|
}
|
|
4854
5062
|
}
|
|
@@ -4905,12 +5113,22 @@ export const OptionsPosition = {
|
|
|
4905
5113
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4906
5114
|
retryCount++;
|
|
4907
5115
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4908
|
-
logger.warn("Database connection error, retrying..."
|
|
5116
|
+
logger.warn("Database connection error in getAllOptionsPosition, retrying...", {
|
|
5117
|
+
operation: 'getAllOptionsPosition',
|
|
5118
|
+
model: 'OptionsPosition',
|
|
5119
|
+
attempt: retryCount,
|
|
5120
|
+
maxRetries: MAX_RETRIES,
|
|
5121
|
+
});
|
|
4909
5122
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4910
5123
|
continue;
|
|
4911
5124
|
}
|
|
4912
|
-
// Log
|
|
4913
|
-
logger.error("Database
|
|
5125
|
+
// Log structured error details and rethrow
|
|
5126
|
+
logger.error("Database getAll operation failed", {
|
|
5127
|
+
operation: 'getAllOptionsPosition',
|
|
5128
|
+
model: 'OptionsPosition',
|
|
5129
|
+
error: String(error),
|
|
5130
|
+
isRetryable: isConnectionError,
|
|
5131
|
+
});
|
|
4914
5132
|
throw error;
|
|
4915
5133
|
}
|
|
4916
5134
|
}
|
|
@@ -4989,12 +5207,22 @@ export const OptionsPosition = {
|
|
|
4989
5207
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4990
5208
|
retryCount++;
|
|
4991
5209
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4992
|
-
logger.warn("Database connection error, retrying..."
|
|
5210
|
+
logger.warn("Database connection error in findManyOptionsPosition, retrying...", {
|
|
5211
|
+
operation: 'findManyOptionsPosition',
|
|
5212
|
+
model: 'OptionsPosition',
|
|
5213
|
+
attempt: retryCount,
|
|
5214
|
+
maxRetries: MAX_RETRIES,
|
|
5215
|
+
});
|
|
4993
5216
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4994
5217
|
continue;
|
|
4995
5218
|
}
|
|
4996
|
-
// Log
|
|
4997
|
-
logger.error("Database
|
|
5219
|
+
// Log structured error details and rethrow
|
|
5220
|
+
logger.error("Database findMany operation failed", {
|
|
5221
|
+
operation: 'findManyOptionsPosition',
|
|
5222
|
+
model: 'OptionsPosition',
|
|
5223
|
+
error: String(error),
|
|
5224
|
+
isRetryable: isConnectionError,
|
|
5225
|
+
});
|
|
4998
5226
|
throw error;
|
|
4999
5227
|
}
|
|
5000
5228
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsTradeExecution.d.ts","sourceRoot":"","sources":["../../src/OptionsTradeExecution.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,IAAI,yBAAyB,EAAE,MAAM,6DAA6D,CAAC;AACjI,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AA+N7G,eAAO,MAAM,qBAAqB;IAEhC;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,yBAAyB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionsTradeExecution.d.ts","sourceRoot":"","sources":["../../src/OptionsTradeExecution.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,IAAI,yBAAyB,EAAE,MAAM,6DAA6D,CAAC;AACjI,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AA+N7G,eAAO,MAAM,qBAAqB;IAEhC;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,yBAAyB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAoW5I;;;;;;OAMG;sBACqB,yBAAyB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAwH/I;;;;;;OAMG;kBACiB,yBAAyB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IA+yC1I;;;;;;OAMG;kBACiB,yBAAyB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IA8hD1I;;;;;;OAMG;sBACqB,yBAAyB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA8yC/I;;;;;;OAMG;kBACiB,yBAAyB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAmH1I;;;;;;;OAOG;eACc,yBAAyB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAgGhK;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,yBAAyB,EAAE,GAAG,IAAI,CAAC;IA4EjH;;;;;;;OAOG;oBACmB,yBAAyB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,yBAAyB,EAAE,GAAG,IAAI,CAAC;CAsGxK,CAAC"}
|