@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/ModelArtifact.mjs
CHANGED
|
@@ -522,6 +522,27 @@ export const ModelArtifact = {
|
|
|
522
522
|
}
|
|
523
523
|
catch (error) {
|
|
524
524
|
lastError = error;
|
|
525
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
526
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
527
|
+
error.message?.includes('violates unique constraint') ||
|
|
528
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
529
|
+
error.message?.includes('unique constraint') ||
|
|
530
|
+
error.message?.includes('23514') ||
|
|
531
|
+
error.message?.includes('23505') ||
|
|
532
|
+
error.message?.includes('P2002') ||
|
|
533
|
+
error.message?.includes('P2003');
|
|
534
|
+
if (isConstraintViolation) {
|
|
535
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
536
|
+
logger.error("Non-retryable constraint violation in createOneModelArtifact", {
|
|
537
|
+
operation: 'createOneModelArtifact',
|
|
538
|
+
model: 'ModelArtifact',
|
|
539
|
+
error: String(error),
|
|
540
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
541
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
542
|
+
isRetryable: false,
|
|
543
|
+
});
|
|
544
|
+
throw error;
|
|
545
|
+
}
|
|
525
546
|
// Check if this is a database connection error that we should retry
|
|
526
547
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
527
548
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -531,12 +552,22 @@ export const ModelArtifact = {
|
|
|
531
552
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
532
553
|
retryCount++;
|
|
533
554
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
534
|
-
logger.warn("Database connection error, retrying..."
|
|
555
|
+
logger.warn("Database connection error in createOneModelArtifact, retrying...", {
|
|
556
|
+
operation: 'createOneModelArtifact',
|
|
557
|
+
model: 'ModelArtifact',
|
|
558
|
+
attempt: retryCount,
|
|
559
|
+
maxRetries: MAX_RETRIES,
|
|
560
|
+
});
|
|
535
561
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
536
562
|
continue;
|
|
537
563
|
}
|
|
538
|
-
// Log
|
|
539
|
-
logger.error("Database
|
|
564
|
+
// Log structured error details and rethrow
|
|
565
|
+
logger.error("Database create operation failed", {
|
|
566
|
+
operation: 'createOneModelArtifact',
|
|
567
|
+
model: 'ModelArtifact',
|
|
568
|
+
error: String(error),
|
|
569
|
+
isRetryable: isConnectionError,
|
|
570
|
+
});
|
|
540
571
|
throw error;
|
|
541
572
|
}
|
|
542
573
|
}
|
|
@@ -606,6 +637,27 @@ export const ModelArtifact = {
|
|
|
606
637
|
}
|
|
607
638
|
catch (error) {
|
|
608
639
|
lastError = error;
|
|
640
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
641
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
642
|
+
error.message?.includes('violates unique constraint') ||
|
|
643
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
644
|
+
error.message?.includes('unique constraint') ||
|
|
645
|
+
error.message?.includes('23514') ||
|
|
646
|
+
error.message?.includes('23505') ||
|
|
647
|
+
error.message?.includes('P2002') ||
|
|
648
|
+
error.message?.includes('P2003');
|
|
649
|
+
if (isConstraintViolation) {
|
|
650
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
651
|
+
logger.error("Non-retryable constraint violation in createManyModelArtifact", {
|
|
652
|
+
operation: 'createManyModelArtifact',
|
|
653
|
+
model: 'ModelArtifact',
|
|
654
|
+
error: String(error),
|
|
655
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
656
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
657
|
+
isRetryable: false,
|
|
658
|
+
});
|
|
659
|
+
throw error;
|
|
660
|
+
}
|
|
609
661
|
// Check if this is a database connection error that we should retry
|
|
610
662
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
611
663
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -615,12 +667,22 @@ export const ModelArtifact = {
|
|
|
615
667
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
616
668
|
retryCount++;
|
|
617
669
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
618
|
-
logger.warn("Database connection error, retrying..."
|
|
670
|
+
logger.warn("Database connection error in createManyModelArtifact, retrying...", {
|
|
671
|
+
operation: 'createManyModelArtifact',
|
|
672
|
+
model: 'ModelArtifact',
|
|
673
|
+
attempt: retryCount,
|
|
674
|
+
maxRetries: MAX_RETRIES,
|
|
675
|
+
});
|
|
619
676
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
620
677
|
continue;
|
|
621
678
|
}
|
|
622
|
-
// Log
|
|
623
|
-
logger.error("Database
|
|
679
|
+
// Log structured error details and rethrow
|
|
680
|
+
logger.error("Database createMany operation failed", {
|
|
681
|
+
operation: 'createManyModelArtifact',
|
|
682
|
+
model: 'ModelArtifact',
|
|
683
|
+
error: String(error),
|
|
684
|
+
isRetryable: isConnectionError,
|
|
685
|
+
});
|
|
624
686
|
throw error;
|
|
625
687
|
}
|
|
626
688
|
}
|
|
@@ -2022,6 +2084,28 @@ export const ModelArtifact = {
|
|
|
2022
2084
|
}
|
|
2023
2085
|
catch (error) {
|
|
2024
2086
|
lastError = error;
|
|
2087
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
2088
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
2089
|
+
error.message?.includes('violates unique constraint') ||
|
|
2090
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
2091
|
+
error.message?.includes('unique constraint') ||
|
|
2092
|
+
error.message?.includes('23514') ||
|
|
2093
|
+
error.message?.includes('23505') ||
|
|
2094
|
+
error.message?.includes('P2002') ||
|
|
2095
|
+
error.message?.includes('P2003');
|
|
2096
|
+
if (isConstraintViolation) {
|
|
2097
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
2098
|
+
logger.error("Non-retryable constraint violation in updateOneModelArtifact", {
|
|
2099
|
+
operation: 'updateOneModelArtifact',
|
|
2100
|
+
model: 'ModelArtifact',
|
|
2101
|
+
error: String(error),
|
|
2102
|
+
recordId: props.id,
|
|
2103
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
2104
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
2105
|
+
isRetryable: false,
|
|
2106
|
+
});
|
|
2107
|
+
throw error;
|
|
2108
|
+
}
|
|
2025
2109
|
// Check if this is a database connection error that we should retry
|
|
2026
2110
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
2027
2111
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -2031,12 +2115,24 @@ export const ModelArtifact = {
|
|
|
2031
2115
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2032
2116
|
retryCount++;
|
|
2033
2117
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2034
|
-
logger.warn("Database connection error, retrying..."
|
|
2118
|
+
logger.warn("Database connection error in updateOneModelArtifact, retrying...", {
|
|
2119
|
+
operation: 'updateOneModelArtifact',
|
|
2120
|
+
model: 'ModelArtifact',
|
|
2121
|
+
attempt: retryCount,
|
|
2122
|
+
maxRetries: MAX_RETRIES,
|
|
2123
|
+
recordId: props.id,
|
|
2124
|
+
});
|
|
2035
2125
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2036
2126
|
continue;
|
|
2037
2127
|
}
|
|
2038
|
-
// Log
|
|
2039
|
-
logger.error("Database
|
|
2128
|
+
// Log structured error details and rethrow
|
|
2129
|
+
logger.error("Database update operation failed", {
|
|
2130
|
+
operation: 'updateOneModelArtifact',
|
|
2131
|
+
model: 'ModelArtifact',
|
|
2132
|
+
error: String(error),
|
|
2133
|
+
recordId: props.id,
|
|
2134
|
+
isRetryable: isConnectionError,
|
|
2135
|
+
});
|
|
2040
2136
|
throw error;
|
|
2041
2137
|
}
|
|
2042
2138
|
}
|
|
@@ -3728,6 +3824,28 @@ export const ModelArtifact = {
|
|
|
3728
3824
|
}
|
|
3729
3825
|
catch (error) {
|
|
3730
3826
|
lastError = error;
|
|
3827
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3828
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
3829
|
+
error.message?.includes('violates unique constraint') ||
|
|
3830
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
3831
|
+
error.message?.includes('unique constraint') ||
|
|
3832
|
+
error.message?.includes('23514') ||
|
|
3833
|
+
error.message?.includes('23505') ||
|
|
3834
|
+
error.message?.includes('P2002') ||
|
|
3835
|
+
error.message?.includes('P2003');
|
|
3836
|
+
if (isConstraintViolation) {
|
|
3837
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
3838
|
+
logger.error("Non-retryable constraint violation in upsertOneModelArtifact", {
|
|
3839
|
+
operation: 'upsertOneModelArtifact',
|
|
3840
|
+
model: 'ModelArtifact',
|
|
3841
|
+
error: String(error),
|
|
3842
|
+
recordId: props.id,
|
|
3843
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3844
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3845
|
+
isRetryable: false,
|
|
3846
|
+
});
|
|
3847
|
+
throw error;
|
|
3848
|
+
}
|
|
3731
3849
|
// Check if this is a database connection error that we should retry
|
|
3732
3850
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
3733
3851
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -3737,12 +3855,24 @@ export const ModelArtifact = {
|
|
|
3737
3855
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3738
3856
|
retryCount++;
|
|
3739
3857
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3740
|
-
logger.warn("Database connection error, retrying..."
|
|
3858
|
+
logger.warn("Database connection error in upsertOneModelArtifact, retrying...", {
|
|
3859
|
+
operation: 'upsertOneModelArtifact',
|
|
3860
|
+
model: 'ModelArtifact',
|
|
3861
|
+
attempt: retryCount,
|
|
3862
|
+
maxRetries: MAX_RETRIES,
|
|
3863
|
+
recordId: props.id,
|
|
3864
|
+
});
|
|
3741
3865
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3742
3866
|
continue;
|
|
3743
3867
|
}
|
|
3744
|
-
// Log
|
|
3745
|
-
logger.error("Database
|
|
3868
|
+
// Log structured error details and rethrow
|
|
3869
|
+
logger.error("Database upsert operation failed", {
|
|
3870
|
+
operation: 'upsertOneModelArtifact',
|
|
3871
|
+
model: 'ModelArtifact',
|
|
3872
|
+
error: String(error),
|
|
3873
|
+
recordId: props.id,
|
|
3874
|
+
isRetryable: isConnectionError,
|
|
3875
|
+
});
|
|
3746
3876
|
throw error;
|
|
3747
3877
|
}
|
|
3748
3878
|
}
|
|
@@ -5144,6 +5274,27 @@ export const ModelArtifact = {
|
|
|
5144
5274
|
}
|
|
5145
5275
|
catch (error) {
|
|
5146
5276
|
lastError = error;
|
|
5277
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
5278
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
5279
|
+
error.message?.includes('violates unique constraint') ||
|
|
5280
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
5281
|
+
error.message?.includes('unique constraint') ||
|
|
5282
|
+
error.message?.includes('23514') ||
|
|
5283
|
+
error.message?.includes('23505') ||
|
|
5284
|
+
error.message?.includes('P2002') ||
|
|
5285
|
+
error.message?.includes('P2003');
|
|
5286
|
+
if (isConstraintViolation) {
|
|
5287
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
5288
|
+
logger.error("Non-retryable constraint violation in updateManyModelArtifact", {
|
|
5289
|
+
operation: 'updateManyModelArtifact',
|
|
5290
|
+
model: 'ModelArtifact',
|
|
5291
|
+
error: String(error),
|
|
5292
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
5293
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
5294
|
+
isRetryable: false,
|
|
5295
|
+
});
|
|
5296
|
+
throw error;
|
|
5297
|
+
}
|
|
5147
5298
|
// Check if this is a database connection error that we should retry
|
|
5148
5299
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
5149
5300
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -5153,12 +5304,22 @@ export const ModelArtifact = {
|
|
|
5153
5304
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
5154
5305
|
retryCount++;
|
|
5155
5306
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
5156
|
-
logger.warn("Database connection error, retrying..."
|
|
5307
|
+
logger.warn("Database connection error in updateManyModelArtifact, retrying...", {
|
|
5308
|
+
operation: 'updateManyModelArtifact',
|
|
5309
|
+
model: 'ModelArtifact',
|
|
5310
|
+
attempt: retryCount,
|
|
5311
|
+
maxRetries: MAX_RETRIES,
|
|
5312
|
+
});
|
|
5157
5313
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
5158
5314
|
continue;
|
|
5159
5315
|
}
|
|
5160
|
-
// Log
|
|
5161
|
-
logger.error("Database
|
|
5316
|
+
// Log structured error details and rethrow
|
|
5317
|
+
logger.error("Database updateMany operation failed", {
|
|
5318
|
+
operation: 'updateManyModelArtifact',
|
|
5319
|
+
model: 'ModelArtifact',
|
|
5320
|
+
error: String(error),
|
|
5321
|
+
isRetryable: isConnectionError,
|
|
5322
|
+
});
|
|
5162
5323
|
throw error;
|
|
5163
5324
|
}
|
|
5164
5325
|
}
|
|
@@ -5216,6 +5377,31 @@ export const ModelArtifact = {
|
|
|
5216
5377
|
}
|
|
5217
5378
|
catch (error) {
|
|
5218
5379
|
lastError = error;
|
|
5380
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
5381
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
5382
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
5383
|
+
error.message?.includes('violates unique constraint') ||
|
|
5384
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
5385
|
+
error.message?.includes('unique constraint') ||
|
|
5386
|
+
error.message?.includes('23514') ||
|
|
5387
|
+
error.message?.includes('23505') ||
|
|
5388
|
+
error.message?.includes('23503') ||
|
|
5389
|
+
error.message?.includes('P2002') ||
|
|
5390
|
+
error.message?.includes('P2003') ||
|
|
5391
|
+
error.message?.includes('P2014');
|
|
5392
|
+
if (isConstraintViolation) {
|
|
5393
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
5394
|
+
logger.error("Non-retryable constraint violation in deleteOneModelArtifact", {
|
|
5395
|
+
operation: 'deleteOneModelArtifact',
|
|
5396
|
+
model: 'ModelArtifact',
|
|
5397
|
+
error: String(error),
|
|
5398
|
+
recordId: props.id,
|
|
5399
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
5400
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
5401
|
+
isRetryable: false,
|
|
5402
|
+
});
|
|
5403
|
+
throw error;
|
|
5404
|
+
}
|
|
5219
5405
|
// Check if this is a database connection error that we should retry
|
|
5220
5406
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
5221
5407
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -5225,12 +5411,24 @@ export const ModelArtifact = {
|
|
|
5225
5411
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
5226
5412
|
retryCount++;
|
|
5227
5413
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
5228
|
-
logger.warn("Database connection error, retrying..."
|
|
5414
|
+
logger.warn("Database connection error in deleteOneModelArtifact, retrying...", {
|
|
5415
|
+
operation: 'deleteOneModelArtifact',
|
|
5416
|
+
model: 'ModelArtifact',
|
|
5417
|
+
attempt: retryCount,
|
|
5418
|
+
maxRetries: MAX_RETRIES,
|
|
5419
|
+
recordId: props.id,
|
|
5420
|
+
});
|
|
5229
5421
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
5230
5422
|
continue;
|
|
5231
5423
|
}
|
|
5232
|
-
// Log
|
|
5233
|
-
logger.error("Database
|
|
5424
|
+
// Log structured error details and rethrow
|
|
5425
|
+
logger.error("Database delete operation failed", {
|
|
5426
|
+
operation: 'deleteOneModelArtifact',
|
|
5427
|
+
model: 'ModelArtifact',
|
|
5428
|
+
error: String(error),
|
|
5429
|
+
recordId: props.id,
|
|
5430
|
+
isRetryable: isConnectionError,
|
|
5431
|
+
});
|
|
5234
5432
|
throw error;
|
|
5235
5433
|
}
|
|
5236
5434
|
}
|
|
@@ -5296,12 +5494,22 @@ export const ModelArtifact = {
|
|
|
5296
5494
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
5297
5495
|
retryCount++;
|
|
5298
5496
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
5299
|
-
logger.warn("Database connection error, retrying..."
|
|
5497
|
+
logger.warn("Database connection error in getModelArtifact, retrying...", {
|
|
5498
|
+
operation: 'getModelArtifact',
|
|
5499
|
+
model: 'ModelArtifact',
|
|
5500
|
+
attempt: retryCount,
|
|
5501
|
+
maxRetries: MAX_RETRIES,
|
|
5502
|
+
});
|
|
5300
5503
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
5301
5504
|
continue;
|
|
5302
5505
|
}
|
|
5303
|
-
// Log
|
|
5304
|
-
logger.error("Database
|
|
5506
|
+
// Log structured error details and rethrow
|
|
5507
|
+
logger.error("Database get operation failed", {
|
|
5508
|
+
operation: 'getModelArtifact',
|
|
5509
|
+
model: 'ModelArtifact',
|
|
5510
|
+
error: String(error),
|
|
5511
|
+
isRetryable: isConnectionError,
|
|
5512
|
+
});
|
|
5305
5513
|
throw error;
|
|
5306
5514
|
}
|
|
5307
5515
|
}
|
|
@@ -5358,12 +5566,22 @@ export const ModelArtifact = {
|
|
|
5358
5566
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
5359
5567
|
retryCount++;
|
|
5360
5568
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
5361
|
-
logger.warn("Database connection error, retrying..."
|
|
5569
|
+
logger.warn("Database connection error in getAllModelArtifact, retrying...", {
|
|
5570
|
+
operation: 'getAllModelArtifact',
|
|
5571
|
+
model: 'ModelArtifact',
|
|
5572
|
+
attempt: retryCount,
|
|
5573
|
+
maxRetries: MAX_RETRIES,
|
|
5574
|
+
});
|
|
5362
5575
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
5363
5576
|
continue;
|
|
5364
5577
|
}
|
|
5365
|
-
// Log
|
|
5366
|
-
logger.error("Database
|
|
5578
|
+
// Log structured error details and rethrow
|
|
5579
|
+
logger.error("Database getAll operation failed", {
|
|
5580
|
+
operation: 'getAllModelArtifact',
|
|
5581
|
+
model: 'ModelArtifact',
|
|
5582
|
+
error: String(error),
|
|
5583
|
+
isRetryable: isConnectionError,
|
|
5584
|
+
});
|
|
5367
5585
|
throw error;
|
|
5368
5586
|
}
|
|
5369
5587
|
}
|
|
@@ -5436,12 +5654,22 @@ export const ModelArtifact = {
|
|
|
5436
5654
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
5437
5655
|
retryCount++;
|
|
5438
5656
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
5439
|
-
logger.warn("Database connection error, retrying..."
|
|
5657
|
+
logger.warn("Database connection error in findManyModelArtifact, retrying...", {
|
|
5658
|
+
operation: 'findManyModelArtifact',
|
|
5659
|
+
model: 'ModelArtifact',
|
|
5660
|
+
attempt: retryCount,
|
|
5661
|
+
maxRetries: MAX_RETRIES,
|
|
5662
|
+
});
|
|
5440
5663
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
5441
5664
|
continue;
|
|
5442
5665
|
}
|
|
5443
|
-
// Log
|
|
5444
|
-
logger.error("Database
|
|
5666
|
+
// Log structured error details and rethrow
|
|
5667
|
+
logger.error("Database findMany operation failed", {
|
|
5668
|
+
operation: 'findManyModelArtifact',
|
|
5669
|
+
model: 'ModelArtifact',
|
|
5670
|
+
error: String(error),
|
|
5671
|
+
isRetryable: isConnectionError,
|
|
5672
|
+
});
|
|
5445
5673
|
throw error;
|
|
5446
5674
|
}
|
|
5447
5675
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelVersion.d.ts","sourceRoot":"","sources":["../../src/ModelVersion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtG,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAyK7G,eAAO,MAAM,YAAY;IAEvB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,gBAAgB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ModelVersion.d.ts","sourceRoot":"","sources":["../../src/ModelVersion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtG,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAyK7G,eAAO,MAAM,YAAY;IAEvB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,gBAAgB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA61D1H;;;;;;OAMG;sBACqB,gBAAgB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA8ItI;;;;;;OAMG;kBACiB,gBAAgB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA27OxH;;;;;;OAMG;kBACiB,gBAAgB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmqSxH;;;;;;OAMG;sBACqB,gBAAgB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA07OtI;;;;;;OAMG;kBACiB,gBAAgB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmHxH;;;;;;;OAOG;eACc,gBAAgB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAoF9I;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC;IA4ExG;;;;;;;OAOG;oBACmB,gBAAgB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC;CA0FtJ,CAAC"}
|