@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/InviteToken.mjs
CHANGED
|
@@ -484,6 +484,27 @@ export const InviteToken = {
|
|
|
484
484
|
}
|
|
485
485
|
catch (error) {
|
|
486
486
|
lastError = error;
|
|
487
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
488
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
489
|
+
error.message?.includes('violates unique constraint') ||
|
|
490
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
491
|
+
error.message?.includes('unique constraint') ||
|
|
492
|
+
error.message?.includes('23514') ||
|
|
493
|
+
error.message?.includes('23505') ||
|
|
494
|
+
error.message?.includes('P2002') ||
|
|
495
|
+
error.message?.includes('P2003');
|
|
496
|
+
if (isConstraintViolation) {
|
|
497
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
498
|
+
logger.error("Non-retryable constraint violation in createOneInviteToken", {
|
|
499
|
+
operation: 'createOneInviteToken',
|
|
500
|
+
model: 'InviteToken',
|
|
501
|
+
error: String(error),
|
|
502
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
503
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
504
|
+
isRetryable: false,
|
|
505
|
+
});
|
|
506
|
+
throw error;
|
|
507
|
+
}
|
|
487
508
|
// Check if this is a database connection error that we should retry
|
|
488
509
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
489
510
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -493,12 +514,22 @@ export const InviteToken = {
|
|
|
493
514
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
494
515
|
retryCount++;
|
|
495
516
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
496
|
-
logger.warn("Database connection error, retrying..."
|
|
517
|
+
logger.warn("Database connection error in createOneInviteToken, retrying...", {
|
|
518
|
+
operation: 'createOneInviteToken',
|
|
519
|
+
model: 'InviteToken',
|
|
520
|
+
attempt: retryCount,
|
|
521
|
+
maxRetries: MAX_RETRIES,
|
|
522
|
+
});
|
|
497
523
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
498
524
|
continue;
|
|
499
525
|
}
|
|
500
|
-
// Log
|
|
501
|
-
logger.error("Database
|
|
526
|
+
// Log structured error details and rethrow
|
|
527
|
+
logger.error("Database create operation failed", {
|
|
528
|
+
operation: 'createOneInviteToken',
|
|
529
|
+
model: 'InviteToken',
|
|
530
|
+
error: String(error),
|
|
531
|
+
isRetryable: isConnectionError,
|
|
532
|
+
});
|
|
502
533
|
throw error;
|
|
503
534
|
}
|
|
504
535
|
}
|
|
@@ -561,6 +592,27 @@ export const InviteToken = {
|
|
|
561
592
|
}
|
|
562
593
|
catch (error) {
|
|
563
594
|
lastError = error;
|
|
595
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
596
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
597
|
+
error.message?.includes('violates unique constraint') ||
|
|
598
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
599
|
+
error.message?.includes('unique constraint') ||
|
|
600
|
+
error.message?.includes('23514') ||
|
|
601
|
+
error.message?.includes('23505') ||
|
|
602
|
+
error.message?.includes('P2002') ||
|
|
603
|
+
error.message?.includes('P2003');
|
|
604
|
+
if (isConstraintViolation) {
|
|
605
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
606
|
+
logger.error("Non-retryable constraint violation in createManyInviteToken", {
|
|
607
|
+
operation: 'createManyInviteToken',
|
|
608
|
+
model: 'InviteToken',
|
|
609
|
+
error: String(error),
|
|
610
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
611
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
612
|
+
isRetryable: false,
|
|
613
|
+
});
|
|
614
|
+
throw error;
|
|
615
|
+
}
|
|
564
616
|
// Check if this is a database connection error that we should retry
|
|
565
617
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
566
618
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -570,12 +622,22 @@ export const InviteToken = {
|
|
|
570
622
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
571
623
|
retryCount++;
|
|
572
624
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
573
|
-
logger.warn("Database connection error, retrying..."
|
|
625
|
+
logger.warn("Database connection error in createManyInviteToken, retrying...", {
|
|
626
|
+
operation: 'createManyInviteToken',
|
|
627
|
+
model: 'InviteToken',
|
|
628
|
+
attempt: retryCount,
|
|
629
|
+
maxRetries: MAX_RETRIES,
|
|
630
|
+
});
|
|
574
631
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
575
632
|
continue;
|
|
576
633
|
}
|
|
577
|
-
// Log
|
|
578
|
-
logger.error("Database
|
|
634
|
+
// Log structured error details and rethrow
|
|
635
|
+
logger.error("Database createMany operation failed", {
|
|
636
|
+
operation: 'createManyInviteToken',
|
|
637
|
+
model: 'InviteToken',
|
|
638
|
+
error: String(error),
|
|
639
|
+
isRetryable: isConnectionError,
|
|
640
|
+
});
|
|
579
641
|
throw error;
|
|
580
642
|
}
|
|
581
643
|
}
|
|
@@ -1673,6 +1735,28 @@ export const InviteToken = {
|
|
|
1673
1735
|
}
|
|
1674
1736
|
catch (error) {
|
|
1675
1737
|
lastError = error;
|
|
1738
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1739
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1740
|
+
error.message?.includes('violates unique constraint') ||
|
|
1741
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1742
|
+
error.message?.includes('unique constraint') ||
|
|
1743
|
+
error.message?.includes('23514') ||
|
|
1744
|
+
error.message?.includes('23505') ||
|
|
1745
|
+
error.message?.includes('P2002') ||
|
|
1746
|
+
error.message?.includes('P2003');
|
|
1747
|
+
if (isConstraintViolation) {
|
|
1748
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1749
|
+
logger.error("Non-retryable constraint violation in updateOneInviteToken", {
|
|
1750
|
+
operation: 'updateOneInviteToken',
|
|
1751
|
+
model: 'InviteToken',
|
|
1752
|
+
error: String(error),
|
|
1753
|
+
recordId: props.id,
|
|
1754
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1755
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1756
|
+
isRetryable: false,
|
|
1757
|
+
});
|
|
1758
|
+
throw error;
|
|
1759
|
+
}
|
|
1676
1760
|
// Check if this is a database connection error that we should retry
|
|
1677
1761
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1678
1762
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1682,12 +1766,24 @@ export const InviteToken = {
|
|
|
1682
1766
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1683
1767
|
retryCount++;
|
|
1684
1768
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1685
|
-
logger.warn("Database connection error, retrying..."
|
|
1769
|
+
logger.warn("Database connection error in updateOneInviteToken, retrying...", {
|
|
1770
|
+
operation: 'updateOneInviteToken',
|
|
1771
|
+
model: 'InviteToken',
|
|
1772
|
+
attempt: retryCount,
|
|
1773
|
+
maxRetries: MAX_RETRIES,
|
|
1774
|
+
recordId: props.id,
|
|
1775
|
+
});
|
|
1686
1776
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1687
1777
|
continue;
|
|
1688
1778
|
}
|
|
1689
|
-
// Log
|
|
1690
|
-
logger.error("Database
|
|
1779
|
+
// Log structured error details and rethrow
|
|
1780
|
+
logger.error("Database update operation failed", {
|
|
1781
|
+
operation: 'updateOneInviteToken',
|
|
1782
|
+
model: 'InviteToken',
|
|
1783
|
+
error: String(error),
|
|
1784
|
+
recordId: props.id,
|
|
1785
|
+
isRetryable: isConnectionError,
|
|
1786
|
+
});
|
|
1691
1787
|
throw error;
|
|
1692
1788
|
}
|
|
1693
1789
|
}
|
|
@@ -3046,6 +3142,28 @@ export const InviteToken = {
|
|
|
3046
3142
|
}
|
|
3047
3143
|
catch (error) {
|
|
3048
3144
|
lastError = error;
|
|
3145
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3146
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
3147
|
+
error.message?.includes('violates unique constraint') ||
|
|
3148
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
3149
|
+
error.message?.includes('unique constraint') ||
|
|
3150
|
+
error.message?.includes('23514') ||
|
|
3151
|
+
error.message?.includes('23505') ||
|
|
3152
|
+
error.message?.includes('P2002') ||
|
|
3153
|
+
error.message?.includes('P2003');
|
|
3154
|
+
if (isConstraintViolation) {
|
|
3155
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
3156
|
+
logger.error("Non-retryable constraint violation in upsertOneInviteToken", {
|
|
3157
|
+
operation: 'upsertOneInviteToken',
|
|
3158
|
+
model: 'InviteToken',
|
|
3159
|
+
error: String(error),
|
|
3160
|
+
recordId: props.id,
|
|
3161
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3162
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3163
|
+
isRetryable: false,
|
|
3164
|
+
});
|
|
3165
|
+
throw error;
|
|
3166
|
+
}
|
|
3049
3167
|
// Check if this is a database connection error that we should retry
|
|
3050
3168
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
3051
3169
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -3055,12 +3173,24 @@ export const InviteToken = {
|
|
|
3055
3173
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3056
3174
|
retryCount++;
|
|
3057
3175
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3058
|
-
logger.warn("Database connection error, retrying..."
|
|
3176
|
+
logger.warn("Database connection error in upsertOneInviteToken, retrying...", {
|
|
3177
|
+
operation: 'upsertOneInviteToken',
|
|
3178
|
+
model: 'InviteToken',
|
|
3179
|
+
attempt: retryCount,
|
|
3180
|
+
maxRetries: MAX_RETRIES,
|
|
3181
|
+
recordId: props.id,
|
|
3182
|
+
});
|
|
3059
3183
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3060
3184
|
continue;
|
|
3061
3185
|
}
|
|
3062
|
-
// Log
|
|
3063
|
-
logger.error("Database
|
|
3186
|
+
// Log structured error details and rethrow
|
|
3187
|
+
logger.error("Database upsert operation failed", {
|
|
3188
|
+
operation: 'upsertOneInviteToken',
|
|
3189
|
+
model: 'InviteToken',
|
|
3190
|
+
error: String(error),
|
|
3191
|
+
recordId: props.id,
|
|
3192
|
+
isRetryable: isConnectionError,
|
|
3193
|
+
});
|
|
3064
3194
|
throw error;
|
|
3065
3195
|
}
|
|
3066
3196
|
}
|
|
@@ -4158,6 +4288,27 @@ export const InviteToken = {
|
|
|
4158
4288
|
}
|
|
4159
4289
|
catch (error) {
|
|
4160
4290
|
lastError = error;
|
|
4291
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4292
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
4293
|
+
error.message?.includes('violates unique constraint') ||
|
|
4294
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
4295
|
+
error.message?.includes('unique constraint') ||
|
|
4296
|
+
error.message?.includes('23514') ||
|
|
4297
|
+
error.message?.includes('23505') ||
|
|
4298
|
+
error.message?.includes('P2002') ||
|
|
4299
|
+
error.message?.includes('P2003');
|
|
4300
|
+
if (isConstraintViolation) {
|
|
4301
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
4302
|
+
logger.error("Non-retryable constraint violation in updateManyInviteToken", {
|
|
4303
|
+
operation: 'updateManyInviteToken',
|
|
4304
|
+
model: 'InviteToken',
|
|
4305
|
+
error: String(error),
|
|
4306
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4307
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4308
|
+
isRetryable: false,
|
|
4309
|
+
});
|
|
4310
|
+
throw error;
|
|
4311
|
+
}
|
|
4161
4312
|
// Check if this is a database connection error that we should retry
|
|
4162
4313
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
4163
4314
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -4167,12 +4318,22 @@ export const InviteToken = {
|
|
|
4167
4318
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4168
4319
|
retryCount++;
|
|
4169
4320
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4170
|
-
logger.warn("Database connection error, retrying..."
|
|
4321
|
+
logger.warn("Database connection error in updateManyInviteToken, retrying...", {
|
|
4322
|
+
operation: 'updateManyInviteToken',
|
|
4323
|
+
model: 'InviteToken',
|
|
4324
|
+
attempt: retryCount,
|
|
4325
|
+
maxRetries: MAX_RETRIES,
|
|
4326
|
+
});
|
|
4171
4327
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4172
4328
|
continue;
|
|
4173
4329
|
}
|
|
4174
|
-
// Log
|
|
4175
|
-
logger.error("Database
|
|
4330
|
+
// Log structured error details and rethrow
|
|
4331
|
+
logger.error("Database updateMany operation failed", {
|
|
4332
|
+
operation: 'updateManyInviteToken',
|
|
4333
|
+
model: 'InviteToken',
|
|
4334
|
+
error: String(error),
|
|
4335
|
+
isRetryable: isConnectionError,
|
|
4336
|
+
});
|
|
4176
4337
|
throw error;
|
|
4177
4338
|
}
|
|
4178
4339
|
}
|
|
@@ -4230,6 +4391,31 @@ export const InviteToken = {
|
|
|
4230
4391
|
}
|
|
4231
4392
|
catch (error) {
|
|
4232
4393
|
lastError = error;
|
|
4394
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4395
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
4396
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
4397
|
+
error.message?.includes('violates unique constraint') ||
|
|
4398
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
4399
|
+
error.message?.includes('unique constraint') ||
|
|
4400
|
+
error.message?.includes('23514') ||
|
|
4401
|
+
error.message?.includes('23505') ||
|
|
4402
|
+
error.message?.includes('23503') ||
|
|
4403
|
+
error.message?.includes('P2002') ||
|
|
4404
|
+
error.message?.includes('P2003') ||
|
|
4405
|
+
error.message?.includes('P2014');
|
|
4406
|
+
if (isConstraintViolation) {
|
|
4407
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
4408
|
+
logger.error("Non-retryable constraint violation in deleteOneInviteToken", {
|
|
4409
|
+
operation: 'deleteOneInviteToken',
|
|
4410
|
+
model: 'InviteToken',
|
|
4411
|
+
error: String(error),
|
|
4412
|
+
recordId: props.id,
|
|
4413
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4414
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4415
|
+
isRetryable: false,
|
|
4416
|
+
});
|
|
4417
|
+
throw error;
|
|
4418
|
+
}
|
|
4233
4419
|
// Check if this is a database connection error that we should retry
|
|
4234
4420
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
4235
4421
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -4239,12 +4425,24 @@ export const InviteToken = {
|
|
|
4239
4425
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4240
4426
|
retryCount++;
|
|
4241
4427
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4242
|
-
logger.warn("Database connection error, retrying..."
|
|
4428
|
+
logger.warn("Database connection error in deleteOneInviteToken, retrying...", {
|
|
4429
|
+
operation: 'deleteOneInviteToken',
|
|
4430
|
+
model: 'InviteToken',
|
|
4431
|
+
attempt: retryCount,
|
|
4432
|
+
maxRetries: MAX_RETRIES,
|
|
4433
|
+
recordId: props.id,
|
|
4434
|
+
});
|
|
4243
4435
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4244
4436
|
continue;
|
|
4245
4437
|
}
|
|
4246
|
-
// Log
|
|
4247
|
-
logger.error("Database
|
|
4438
|
+
// Log structured error details and rethrow
|
|
4439
|
+
logger.error("Database delete operation failed", {
|
|
4440
|
+
operation: 'deleteOneInviteToken',
|
|
4441
|
+
model: 'InviteToken',
|
|
4442
|
+
error: String(error),
|
|
4443
|
+
recordId: props.id,
|
|
4444
|
+
isRetryable: isConnectionError,
|
|
4445
|
+
});
|
|
4248
4446
|
throw error;
|
|
4249
4447
|
}
|
|
4250
4448
|
}
|
|
@@ -4314,12 +4512,22 @@ export const InviteToken = {
|
|
|
4314
4512
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4315
4513
|
retryCount++;
|
|
4316
4514
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4317
|
-
logger.warn("Database connection error, retrying..."
|
|
4515
|
+
logger.warn("Database connection error in getInviteToken, retrying...", {
|
|
4516
|
+
operation: 'getInviteToken',
|
|
4517
|
+
model: 'InviteToken',
|
|
4518
|
+
attempt: retryCount,
|
|
4519
|
+
maxRetries: MAX_RETRIES,
|
|
4520
|
+
});
|
|
4318
4521
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4319
4522
|
continue;
|
|
4320
4523
|
}
|
|
4321
|
-
// Log
|
|
4322
|
-
logger.error("Database
|
|
4524
|
+
// Log structured error details and rethrow
|
|
4525
|
+
logger.error("Database get operation failed", {
|
|
4526
|
+
operation: 'getInviteToken',
|
|
4527
|
+
model: 'InviteToken',
|
|
4528
|
+
error: String(error),
|
|
4529
|
+
isRetryable: isConnectionError,
|
|
4530
|
+
});
|
|
4323
4531
|
throw error;
|
|
4324
4532
|
}
|
|
4325
4533
|
}
|
|
@@ -4376,12 +4584,22 @@ export const InviteToken = {
|
|
|
4376
4584
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4377
4585
|
retryCount++;
|
|
4378
4586
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4379
|
-
logger.warn("Database connection error, retrying..."
|
|
4587
|
+
logger.warn("Database connection error in getAllInviteToken, retrying...", {
|
|
4588
|
+
operation: 'getAllInviteToken',
|
|
4589
|
+
model: 'InviteToken',
|
|
4590
|
+
attempt: retryCount,
|
|
4591
|
+
maxRetries: MAX_RETRIES,
|
|
4592
|
+
});
|
|
4380
4593
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4381
4594
|
continue;
|
|
4382
4595
|
}
|
|
4383
|
-
// Log
|
|
4384
|
-
logger.error("Database
|
|
4596
|
+
// Log structured error details and rethrow
|
|
4597
|
+
logger.error("Database getAll operation failed", {
|
|
4598
|
+
operation: 'getAllInviteToken',
|
|
4599
|
+
model: 'InviteToken',
|
|
4600
|
+
error: String(error),
|
|
4601
|
+
isRetryable: isConnectionError,
|
|
4602
|
+
});
|
|
4385
4603
|
throw error;
|
|
4386
4604
|
}
|
|
4387
4605
|
}
|
|
@@ -4457,12 +4675,22 @@ export const InviteToken = {
|
|
|
4457
4675
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4458
4676
|
retryCount++;
|
|
4459
4677
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4460
|
-
logger.warn("Database connection error, retrying..."
|
|
4678
|
+
logger.warn("Database connection error in findManyInviteToken, retrying...", {
|
|
4679
|
+
operation: 'findManyInviteToken',
|
|
4680
|
+
model: 'InviteToken',
|
|
4681
|
+
attempt: retryCount,
|
|
4682
|
+
maxRetries: MAX_RETRIES,
|
|
4683
|
+
});
|
|
4461
4684
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4462
4685
|
continue;
|
|
4463
4686
|
}
|
|
4464
|
-
// Log
|
|
4465
|
-
logger.error("Database
|
|
4687
|
+
// Log structured error details and rethrow
|
|
4688
|
+
logger.error("Database findMany operation failed", {
|
|
4689
|
+
operation: 'findManyInviteToken',
|
|
4690
|
+
model: 'InviteToken',
|
|
4691
|
+
error: String(error),
|
|
4692
|
+
isRetryable: isConnectionError,
|
|
4693
|
+
});
|
|
4466
4694
|
throw error;
|
|
4467
4695
|
}
|
|
4468
4696
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkedProvider.d.ts","sourceRoot":"","sources":["../../src/LinkedProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC5G,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAmM7G,eAAO,MAAM,cAAc;IAEzB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"LinkedProvider.d.ts","sourceRoot":"","sources":["../../src/LinkedProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC5G,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAmM7G,eAAO,MAAM,cAAc;IAEzB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAya9H;;;;;;OAMG;sBACqB,kBAAkB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAoHxI;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwqC5H;;;;;;OAMG;kBACiB,kBAAkB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA+9C5H;;;;;;OAMG;sBACqB,kBAAkB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAuqCxI;;;;;;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;IA6FlJ;;;;;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;CAmG1J,CAAC"}
|