@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/LinkedProvider.mjs
CHANGED
|
@@ -563,6 +563,27 @@ export const LinkedProvider = {
|
|
|
563
563
|
}
|
|
564
564
|
catch (error) {
|
|
565
565
|
lastError = error;
|
|
566
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
567
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
568
|
+
error.message?.includes('violates unique constraint') ||
|
|
569
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
570
|
+
error.message?.includes('unique constraint') ||
|
|
571
|
+
error.message?.includes('23514') ||
|
|
572
|
+
error.message?.includes('23505') ||
|
|
573
|
+
error.message?.includes('P2002') ||
|
|
574
|
+
error.message?.includes('P2003');
|
|
575
|
+
if (isConstraintViolation) {
|
|
576
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
577
|
+
logger.error("Non-retryable constraint violation in createOneLinkedProvider", {
|
|
578
|
+
operation: 'createOneLinkedProvider',
|
|
579
|
+
model: 'LinkedProvider',
|
|
580
|
+
error: String(error),
|
|
581
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
582
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
583
|
+
isRetryable: false,
|
|
584
|
+
});
|
|
585
|
+
throw error;
|
|
586
|
+
}
|
|
566
587
|
// Check if this is a database connection error that we should retry
|
|
567
588
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
568
589
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -572,12 +593,22 @@ export const LinkedProvider = {
|
|
|
572
593
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
573
594
|
retryCount++;
|
|
574
595
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
575
|
-
logger.warn("Database connection error, retrying..."
|
|
596
|
+
logger.warn("Database connection error in createOneLinkedProvider, retrying...", {
|
|
597
|
+
operation: 'createOneLinkedProvider',
|
|
598
|
+
model: 'LinkedProvider',
|
|
599
|
+
attempt: retryCount,
|
|
600
|
+
maxRetries: MAX_RETRIES,
|
|
601
|
+
});
|
|
576
602
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
577
603
|
continue;
|
|
578
604
|
}
|
|
579
|
-
// Log
|
|
580
|
-
logger.error("Database
|
|
605
|
+
// Log structured error details and rethrow
|
|
606
|
+
logger.error("Database create operation failed", {
|
|
607
|
+
operation: 'createOneLinkedProvider',
|
|
608
|
+
model: 'LinkedProvider',
|
|
609
|
+
error: String(error),
|
|
610
|
+
isRetryable: isConnectionError,
|
|
611
|
+
});
|
|
581
612
|
throw error;
|
|
582
613
|
}
|
|
583
614
|
}
|
|
@@ -642,6 +673,27 @@ export const LinkedProvider = {
|
|
|
642
673
|
}
|
|
643
674
|
catch (error) {
|
|
644
675
|
lastError = error;
|
|
676
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
677
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
678
|
+
error.message?.includes('violates unique constraint') ||
|
|
679
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
680
|
+
error.message?.includes('unique constraint') ||
|
|
681
|
+
error.message?.includes('23514') ||
|
|
682
|
+
error.message?.includes('23505') ||
|
|
683
|
+
error.message?.includes('P2002') ||
|
|
684
|
+
error.message?.includes('P2003');
|
|
685
|
+
if (isConstraintViolation) {
|
|
686
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
687
|
+
logger.error("Non-retryable constraint violation in createManyLinkedProvider", {
|
|
688
|
+
operation: 'createManyLinkedProvider',
|
|
689
|
+
model: 'LinkedProvider',
|
|
690
|
+
error: String(error),
|
|
691
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
692
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
693
|
+
isRetryable: false,
|
|
694
|
+
});
|
|
695
|
+
throw error;
|
|
696
|
+
}
|
|
645
697
|
// Check if this is a database connection error that we should retry
|
|
646
698
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
647
699
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -651,12 +703,22 @@ export const LinkedProvider = {
|
|
|
651
703
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
652
704
|
retryCount++;
|
|
653
705
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
654
|
-
logger.warn("Database connection error, retrying..."
|
|
706
|
+
logger.warn("Database connection error in createManyLinkedProvider, retrying...", {
|
|
707
|
+
operation: 'createManyLinkedProvider',
|
|
708
|
+
model: 'LinkedProvider',
|
|
709
|
+
attempt: retryCount,
|
|
710
|
+
maxRetries: MAX_RETRIES,
|
|
711
|
+
});
|
|
655
712
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
656
713
|
continue;
|
|
657
714
|
}
|
|
658
|
-
// Log
|
|
659
|
-
logger.error("Database
|
|
715
|
+
// Log structured error details and rethrow
|
|
716
|
+
logger.error("Database createMany operation failed", {
|
|
717
|
+
operation: 'createManyLinkedProvider',
|
|
718
|
+
model: 'LinkedProvider',
|
|
719
|
+
error: String(error),
|
|
720
|
+
isRetryable: isConnectionError,
|
|
721
|
+
});
|
|
660
722
|
throw error;
|
|
661
723
|
}
|
|
662
724
|
}
|
|
@@ -1794,6 +1856,28 @@ export const LinkedProvider = {
|
|
|
1794
1856
|
}
|
|
1795
1857
|
catch (error) {
|
|
1796
1858
|
lastError = error;
|
|
1859
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1860
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1861
|
+
error.message?.includes('violates unique constraint') ||
|
|
1862
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1863
|
+
error.message?.includes('unique constraint') ||
|
|
1864
|
+
error.message?.includes('23514') ||
|
|
1865
|
+
error.message?.includes('23505') ||
|
|
1866
|
+
error.message?.includes('P2002') ||
|
|
1867
|
+
error.message?.includes('P2003');
|
|
1868
|
+
if (isConstraintViolation) {
|
|
1869
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1870
|
+
logger.error("Non-retryable constraint violation in updateOneLinkedProvider", {
|
|
1871
|
+
operation: 'updateOneLinkedProvider',
|
|
1872
|
+
model: 'LinkedProvider',
|
|
1873
|
+
error: String(error),
|
|
1874
|
+
recordId: props.id,
|
|
1875
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1876
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1877
|
+
isRetryable: false,
|
|
1878
|
+
});
|
|
1879
|
+
throw error;
|
|
1880
|
+
}
|
|
1797
1881
|
// Check if this is a database connection error that we should retry
|
|
1798
1882
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1799
1883
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1803,12 +1887,24 @@ export const LinkedProvider = {
|
|
|
1803
1887
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1804
1888
|
retryCount++;
|
|
1805
1889
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1806
|
-
logger.warn("Database connection error, retrying..."
|
|
1890
|
+
logger.warn("Database connection error in updateOneLinkedProvider, retrying...", {
|
|
1891
|
+
operation: 'updateOneLinkedProvider',
|
|
1892
|
+
model: 'LinkedProvider',
|
|
1893
|
+
attempt: retryCount,
|
|
1894
|
+
maxRetries: MAX_RETRIES,
|
|
1895
|
+
recordId: props.id,
|
|
1896
|
+
});
|
|
1807
1897
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1808
1898
|
continue;
|
|
1809
1899
|
}
|
|
1810
|
-
// Log
|
|
1811
|
-
logger.error("Database
|
|
1900
|
+
// Log structured error details and rethrow
|
|
1901
|
+
logger.error("Database update operation failed", {
|
|
1902
|
+
operation: 'updateOneLinkedProvider',
|
|
1903
|
+
model: 'LinkedProvider',
|
|
1904
|
+
error: String(error),
|
|
1905
|
+
recordId: props.id,
|
|
1906
|
+
isRetryable: isConnectionError,
|
|
1907
|
+
});
|
|
1812
1908
|
throw error;
|
|
1813
1909
|
}
|
|
1814
1910
|
}
|
|
@@ -3257,6 +3353,28 @@ export const LinkedProvider = {
|
|
|
3257
3353
|
}
|
|
3258
3354
|
catch (error) {
|
|
3259
3355
|
lastError = error;
|
|
3356
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3357
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
3358
|
+
error.message?.includes('violates unique constraint') ||
|
|
3359
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
3360
|
+
error.message?.includes('unique constraint') ||
|
|
3361
|
+
error.message?.includes('23514') ||
|
|
3362
|
+
error.message?.includes('23505') ||
|
|
3363
|
+
error.message?.includes('P2002') ||
|
|
3364
|
+
error.message?.includes('P2003');
|
|
3365
|
+
if (isConstraintViolation) {
|
|
3366
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
3367
|
+
logger.error("Non-retryable constraint violation in upsertOneLinkedProvider", {
|
|
3368
|
+
operation: 'upsertOneLinkedProvider',
|
|
3369
|
+
model: 'LinkedProvider',
|
|
3370
|
+
error: String(error),
|
|
3371
|
+
recordId: props.id,
|
|
3372
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3373
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3374
|
+
isRetryable: false,
|
|
3375
|
+
});
|
|
3376
|
+
throw error;
|
|
3377
|
+
}
|
|
3260
3378
|
// Check if this is a database connection error that we should retry
|
|
3261
3379
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
3262
3380
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -3266,12 +3384,24 @@ export const LinkedProvider = {
|
|
|
3266
3384
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3267
3385
|
retryCount++;
|
|
3268
3386
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3269
|
-
logger.warn("Database connection error, retrying..."
|
|
3387
|
+
logger.warn("Database connection error in upsertOneLinkedProvider, retrying...", {
|
|
3388
|
+
operation: 'upsertOneLinkedProvider',
|
|
3389
|
+
model: 'LinkedProvider',
|
|
3390
|
+
attempt: retryCount,
|
|
3391
|
+
maxRetries: MAX_RETRIES,
|
|
3392
|
+
recordId: props.id,
|
|
3393
|
+
});
|
|
3270
3394
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3271
3395
|
continue;
|
|
3272
3396
|
}
|
|
3273
|
-
// Log
|
|
3274
|
-
logger.error("Database
|
|
3397
|
+
// Log structured error details and rethrow
|
|
3398
|
+
logger.error("Database upsert operation failed", {
|
|
3399
|
+
operation: 'upsertOneLinkedProvider',
|
|
3400
|
+
model: 'LinkedProvider',
|
|
3401
|
+
error: String(error),
|
|
3402
|
+
recordId: props.id,
|
|
3403
|
+
isRetryable: isConnectionError,
|
|
3404
|
+
});
|
|
3275
3405
|
throw error;
|
|
3276
3406
|
}
|
|
3277
3407
|
}
|
|
@@ -4409,6 +4539,27 @@ export const LinkedProvider = {
|
|
|
4409
4539
|
}
|
|
4410
4540
|
catch (error) {
|
|
4411
4541
|
lastError = error;
|
|
4542
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4543
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
4544
|
+
error.message?.includes('violates unique constraint') ||
|
|
4545
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
4546
|
+
error.message?.includes('unique constraint') ||
|
|
4547
|
+
error.message?.includes('23514') ||
|
|
4548
|
+
error.message?.includes('23505') ||
|
|
4549
|
+
error.message?.includes('P2002') ||
|
|
4550
|
+
error.message?.includes('P2003');
|
|
4551
|
+
if (isConstraintViolation) {
|
|
4552
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
4553
|
+
logger.error("Non-retryable constraint violation in updateManyLinkedProvider", {
|
|
4554
|
+
operation: 'updateManyLinkedProvider',
|
|
4555
|
+
model: 'LinkedProvider',
|
|
4556
|
+
error: String(error),
|
|
4557
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4558
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4559
|
+
isRetryable: false,
|
|
4560
|
+
});
|
|
4561
|
+
throw error;
|
|
4562
|
+
}
|
|
4412
4563
|
// Check if this is a database connection error that we should retry
|
|
4413
4564
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
4414
4565
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -4418,12 +4569,22 @@ export const LinkedProvider = {
|
|
|
4418
4569
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4419
4570
|
retryCount++;
|
|
4420
4571
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4421
|
-
logger.warn("Database connection error, retrying..."
|
|
4572
|
+
logger.warn("Database connection error in updateManyLinkedProvider, retrying...", {
|
|
4573
|
+
operation: 'updateManyLinkedProvider',
|
|
4574
|
+
model: 'LinkedProvider',
|
|
4575
|
+
attempt: retryCount,
|
|
4576
|
+
maxRetries: MAX_RETRIES,
|
|
4577
|
+
});
|
|
4422
4578
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4423
4579
|
continue;
|
|
4424
4580
|
}
|
|
4425
|
-
// Log
|
|
4426
|
-
logger.error("Database
|
|
4581
|
+
// Log structured error details and rethrow
|
|
4582
|
+
logger.error("Database updateMany operation failed", {
|
|
4583
|
+
operation: 'updateManyLinkedProvider',
|
|
4584
|
+
model: 'LinkedProvider',
|
|
4585
|
+
error: String(error),
|
|
4586
|
+
isRetryable: isConnectionError,
|
|
4587
|
+
});
|
|
4427
4588
|
throw error;
|
|
4428
4589
|
}
|
|
4429
4590
|
}
|
|
@@ -4481,6 +4642,31 @@ export const LinkedProvider = {
|
|
|
4481
4642
|
}
|
|
4482
4643
|
catch (error) {
|
|
4483
4644
|
lastError = error;
|
|
4645
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4646
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
4647
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
4648
|
+
error.message?.includes('violates unique constraint') ||
|
|
4649
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
4650
|
+
error.message?.includes('unique constraint') ||
|
|
4651
|
+
error.message?.includes('23514') ||
|
|
4652
|
+
error.message?.includes('23505') ||
|
|
4653
|
+
error.message?.includes('23503') ||
|
|
4654
|
+
error.message?.includes('P2002') ||
|
|
4655
|
+
error.message?.includes('P2003') ||
|
|
4656
|
+
error.message?.includes('P2014');
|
|
4657
|
+
if (isConstraintViolation) {
|
|
4658
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
4659
|
+
logger.error("Non-retryable constraint violation in deleteOneLinkedProvider", {
|
|
4660
|
+
operation: 'deleteOneLinkedProvider',
|
|
4661
|
+
model: 'LinkedProvider',
|
|
4662
|
+
error: String(error),
|
|
4663
|
+
recordId: props.id,
|
|
4664
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4665
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4666
|
+
isRetryable: false,
|
|
4667
|
+
});
|
|
4668
|
+
throw error;
|
|
4669
|
+
}
|
|
4484
4670
|
// Check if this is a database connection error that we should retry
|
|
4485
4671
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
4486
4672
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -4490,12 +4676,24 @@ export const LinkedProvider = {
|
|
|
4490
4676
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4491
4677
|
retryCount++;
|
|
4492
4678
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4493
|
-
logger.warn("Database connection error, retrying..."
|
|
4679
|
+
logger.warn("Database connection error in deleteOneLinkedProvider, retrying...", {
|
|
4680
|
+
operation: 'deleteOneLinkedProvider',
|
|
4681
|
+
model: 'LinkedProvider',
|
|
4682
|
+
attempt: retryCount,
|
|
4683
|
+
maxRetries: MAX_RETRIES,
|
|
4684
|
+
recordId: props.id,
|
|
4685
|
+
});
|
|
4494
4686
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4495
4687
|
continue;
|
|
4496
4688
|
}
|
|
4497
|
-
// Log
|
|
4498
|
-
logger.error("Database
|
|
4689
|
+
// Log structured error details and rethrow
|
|
4690
|
+
logger.error("Database delete operation failed", {
|
|
4691
|
+
operation: 'deleteOneLinkedProvider',
|
|
4692
|
+
model: 'LinkedProvider',
|
|
4693
|
+
error: String(error),
|
|
4694
|
+
recordId: props.id,
|
|
4695
|
+
isRetryable: isConnectionError,
|
|
4696
|
+
});
|
|
4499
4697
|
throw error;
|
|
4500
4698
|
}
|
|
4501
4699
|
}
|
|
@@ -4570,12 +4768,22 @@ export const LinkedProvider = {
|
|
|
4570
4768
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4571
4769
|
retryCount++;
|
|
4572
4770
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4573
|
-
logger.warn("Database connection error, retrying..."
|
|
4771
|
+
logger.warn("Database connection error in getLinkedProvider, retrying...", {
|
|
4772
|
+
operation: 'getLinkedProvider',
|
|
4773
|
+
model: 'LinkedProvider',
|
|
4774
|
+
attempt: retryCount,
|
|
4775
|
+
maxRetries: MAX_RETRIES,
|
|
4776
|
+
});
|
|
4574
4777
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4575
4778
|
continue;
|
|
4576
4779
|
}
|
|
4577
|
-
// Log
|
|
4578
|
-
logger.error("Database
|
|
4780
|
+
// Log structured error details and rethrow
|
|
4781
|
+
logger.error("Database get operation failed", {
|
|
4782
|
+
operation: 'getLinkedProvider',
|
|
4783
|
+
model: 'LinkedProvider',
|
|
4784
|
+
error: String(error),
|
|
4785
|
+
isRetryable: isConnectionError,
|
|
4786
|
+
});
|
|
4579
4787
|
throw error;
|
|
4580
4788
|
}
|
|
4581
4789
|
}
|
|
@@ -4632,12 +4840,22 @@ export const LinkedProvider = {
|
|
|
4632
4840
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4633
4841
|
retryCount++;
|
|
4634
4842
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4635
|
-
logger.warn("Database connection error, retrying..."
|
|
4843
|
+
logger.warn("Database connection error in getAllLinkedProvider, retrying...", {
|
|
4844
|
+
operation: 'getAllLinkedProvider',
|
|
4845
|
+
model: 'LinkedProvider',
|
|
4846
|
+
attempt: retryCount,
|
|
4847
|
+
maxRetries: MAX_RETRIES,
|
|
4848
|
+
});
|
|
4636
4849
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4637
4850
|
continue;
|
|
4638
4851
|
}
|
|
4639
|
-
// Log
|
|
4640
|
-
logger.error("Database
|
|
4852
|
+
// Log structured error details and rethrow
|
|
4853
|
+
logger.error("Database getAll operation failed", {
|
|
4854
|
+
operation: 'getAllLinkedProvider',
|
|
4855
|
+
model: 'LinkedProvider',
|
|
4856
|
+
error: String(error),
|
|
4857
|
+
isRetryable: isConnectionError,
|
|
4858
|
+
});
|
|
4641
4859
|
throw error;
|
|
4642
4860
|
}
|
|
4643
4861
|
}
|
|
@@ -4719,12 +4937,22 @@ export const LinkedProvider = {
|
|
|
4719
4937
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4720
4938
|
retryCount++;
|
|
4721
4939
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4722
|
-
logger.warn("Database connection error, retrying..."
|
|
4940
|
+
logger.warn("Database connection error in findManyLinkedProvider, retrying...", {
|
|
4941
|
+
operation: 'findManyLinkedProvider',
|
|
4942
|
+
model: 'LinkedProvider',
|
|
4943
|
+
attempt: retryCount,
|
|
4944
|
+
maxRetries: MAX_RETRIES,
|
|
4945
|
+
});
|
|
4723
4946
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4724
4947
|
continue;
|
|
4725
4948
|
}
|
|
4726
|
-
// Log
|
|
4727
|
-
logger.error("Database
|
|
4949
|
+
// Log structured error details and rethrow
|
|
4950
|
+
logger.error("Database findMany operation failed", {
|
|
4951
|
+
operation: 'findManyLinkedProvider',
|
|
4952
|
+
model: 'LinkedProvider',
|
|
4953
|
+
error: String(error),
|
|
4954
|
+
isRetryable: isConnectionError,
|
|
4955
|
+
});
|
|
4728
4956
|
throw error;
|
|
4729
4957
|
}
|
|
4730
4958
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLTrainingData.d.ts","sourceRoot":"","sources":["../../src/MLTrainingData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC5G,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAgE7G,eAAO,MAAM,cAAc;IAEzB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"MLTrainingData.d.ts","sourceRoot":"","sources":["../../src/MLTrainingData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC5G,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAgE7G,eAAO,MAAM,cAAc;IAEzB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA8J9H;;;;;;OAMG;sBACqB,kBAAkB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA4JxI;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAiR5H;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA0T5H;;;;;;OAMG;sBACqB,kBAAkB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAgRxI;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAmH5H;;;;;;;OAOG;eACc,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IA0FlJ;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC;IA4E1G;;;;;;;OAOG;oBACmB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC;CAgG1J,CAAC"}
|