@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/Account.cjs
CHANGED
|
@@ -208,7 +208,7 @@ exports.Account = {
|
|
|
208
208
|
* @returns The created Account or null.
|
|
209
209
|
*/
|
|
210
210
|
async create(props, globalClient) {
|
|
211
|
-
var _a, _b, _c, _d, _e;
|
|
211
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
212
212
|
// Maximum number of retries for database connection issues
|
|
213
213
|
const MAX_RETRIES = 3;
|
|
214
214
|
let retryCount = 0;
|
|
@@ -572,21 +572,52 @@ exports.Account = {
|
|
|
572
572
|
}
|
|
573
573
|
catch (error) {
|
|
574
574
|
lastError = error;
|
|
575
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
576
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
577
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
578
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
579
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
580
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
581
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
582
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
583
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
584
|
+
if (isConstraintViolation) {
|
|
585
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
586
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneAccount", {
|
|
587
|
+
operation: 'createOneAccount',
|
|
588
|
+
model: 'Account',
|
|
589
|
+
error: String(error),
|
|
590
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
591
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
592
|
+
isRetryable: false,
|
|
593
|
+
});
|
|
594
|
+
throw error;
|
|
595
|
+
}
|
|
575
596
|
// Check if this is a database connection error that we should retry
|
|
576
|
-
const isConnectionError = ((
|
|
577
|
-
((
|
|
578
|
-
((
|
|
579
|
-
((
|
|
580
|
-
(error.networkError && ((
|
|
597
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
598
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
599
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
600
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
601
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
581
602
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
582
603
|
retryCount++;
|
|
583
604
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
584
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
605
|
+
logger_1.logger.warn("Database connection error in createOneAccount, retrying...", {
|
|
606
|
+
operation: 'createOneAccount',
|
|
607
|
+
model: 'Account',
|
|
608
|
+
attempt: retryCount,
|
|
609
|
+
maxRetries: MAX_RETRIES,
|
|
610
|
+
});
|
|
585
611
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
586
612
|
continue;
|
|
587
613
|
}
|
|
588
|
-
// Log
|
|
589
|
-
logger_1.logger.error("Database
|
|
614
|
+
// Log structured error details and rethrow
|
|
615
|
+
logger_1.logger.error("Database create operation failed", {
|
|
616
|
+
operation: 'createOneAccount',
|
|
617
|
+
model: 'Account',
|
|
618
|
+
error: String(error),
|
|
619
|
+
isRetryable: isConnectionError,
|
|
620
|
+
});
|
|
590
621
|
throw error;
|
|
591
622
|
}
|
|
592
623
|
}
|
|
@@ -601,7 +632,7 @@ exports.Account = {
|
|
|
601
632
|
* @returns The count of created records or null.
|
|
602
633
|
*/
|
|
603
634
|
async createMany(props, globalClient) {
|
|
604
|
-
var _a, _b, _c, _d, _e;
|
|
635
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
605
636
|
// Maximum number of retries for database connection issues
|
|
606
637
|
const MAX_RETRIES = 3;
|
|
607
638
|
let retryCount = 0;
|
|
@@ -655,21 +686,52 @@ exports.Account = {
|
|
|
655
686
|
}
|
|
656
687
|
catch (error) {
|
|
657
688
|
lastError = error;
|
|
689
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
690
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
691
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
692
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
693
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
694
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
695
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
696
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
697
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
698
|
+
if (isConstraintViolation) {
|
|
699
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
700
|
+
logger_1.logger.error("Non-retryable constraint violation in createManyAccount", {
|
|
701
|
+
operation: 'createManyAccount',
|
|
702
|
+
model: 'Account',
|
|
703
|
+
error: String(error),
|
|
704
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
705
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
706
|
+
isRetryable: false,
|
|
707
|
+
});
|
|
708
|
+
throw error;
|
|
709
|
+
}
|
|
658
710
|
// Check if this is a database connection error that we should retry
|
|
659
|
-
const isConnectionError = ((
|
|
660
|
-
((
|
|
661
|
-
((
|
|
662
|
-
((
|
|
663
|
-
(error.networkError && ((
|
|
711
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
712
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
713
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
714
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
715
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
664
716
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
665
717
|
retryCount++;
|
|
666
718
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
667
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
719
|
+
logger_1.logger.warn("Database connection error in createManyAccount, retrying...", {
|
|
720
|
+
operation: 'createManyAccount',
|
|
721
|
+
model: 'Account',
|
|
722
|
+
attempt: retryCount,
|
|
723
|
+
maxRetries: MAX_RETRIES,
|
|
724
|
+
});
|
|
668
725
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
669
726
|
continue;
|
|
670
727
|
}
|
|
671
|
-
// Log
|
|
672
|
-
logger_1.logger.error("Database
|
|
728
|
+
// Log structured error details and rethrow
|
|
729
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
730
|
+
operation: 'createManyAccount',
|
|
731
|
+
model: 'Account',
|
|
732
|
+
error: String(error),
|
|
733
|
+
isRetryable: isConnectionError,
|
|
734
|
+
});
|
|
673
735
|
throw error;
|
|
674
736
|
}
|
|
675
737
|
}
|
|
@@ -684,7 +746,7 @@ exports.Account = {
|
|
|
684
746
|
* @returns The updated Account or null.
|
|
685
747
|
*/
|
|
686
748
|
async update(props, globalClient) {
|
|
687
|
-
var _a, _b, _c, _d, _e;
|
|
749
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
688
750
|
// Maximum number of retries for database connection issues
|
|
689
751
|
const MAX_RETRIES = 3;
|
|
690
752
|
let retryCount = 0;
|
|
@@ -1810,21 +1872,55 @@ exports.Account = {
|
|
|
1810
1872
|
}
|
|
1811
1873
|
catch (error) {
|
|
1812
1874
|
lastError = error;
|
|
1875
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1876
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
1877
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
1878
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
1879
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
1880
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
1881
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
1882
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
1883
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
1884
|
+
if (isConstraintViolation) {
|
|
1885
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
1886
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneAccount", {
|
|
1887
|
+
operation: 'updateOneAccount',
|
|
1888
|
+
model: 'Account',
|
|
1889
|
+
error: String(error),
|
|
1890
|
+
recordId: props.id,
|
|
1891
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1892
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1893
|
+
isRetryable: false,
|
|
1894
|
+
});
|
|
1895
|
+
throw error;
|
|
1896
|
+
}
|
|
1813
1897
|
// Check if this is a database connection error that we should retry
|
|
1814
|
-
const isConnectionError = ((
|
|
1815
|
-
((
|
|
1816
|
-
((
|
|
1817
|
-
((
|
|
1818
|
-
(error.networkError && ((
|
|
1898
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
1899
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
1900
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
1901
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
1902
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
1819
1903
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1820
1904
|
retryCount++;
|
|
1821
1905
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1822
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1906
|
+
logger_1.logger.warn("Database connection error in updateOneAccount, retrying...", {
|
|
1907
|
+
operation: 'updateOneAccount',
|
|
1908
|
+
model: 'Account',
|
|
1909
|
+
attempt: retryCount,
|
|
1910
|
+
maxRetries: MAX_RETRIES,
|
|
1911
|
+
recordId: props.id,
|
|
1912
|
+
});
|
|
1823
1913
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1824
1914
|
continue;
|
|
1825
1915
|
}
|
|
1826
|
-
// Log
|
|
1827
|
-
logger_1.logger.error("Database
|
|
1916
|
+
// Log structured error details and rethrow
|
|
1917
|
+
logger_1.logger.error("Database update operation failed", {
|
|
1918
|
+
operation: 'updateOneAccount',
|
|
1919
|
+
model: 'Account',
|
|
1920
|
+
error: String(error),
|
|
1921
|
+
recordId: props.id,
|
|
1922
|
+
isRetryable: isConnectionError,
|
|
1923
|
+
});
|
|
1828
1924
|
throw error;
|
|
1829
1925
|
}
|
|
1830
1926
|
}
|
|
@@ -1839,7 +1935,7 @@ exports.Account = {
|
|
|
1839
1935
|
* @returns The updated Account or null.
|
|
1840
1936
|
*/
|
|
1841
1937
|
async upsert(props, globalClient) {
|
|
1842
|
-
var _a, _b, _c, _d, _e;
|
|
1938
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1843
1939
|
// Maximum number of retries for database connection issues
|
|
1844
1940
|
const MAX_RETRIES = 3;
|
|
1845
1941
|
let retryCount = 0;
|
|
@@ -3278,21 +3374,55 @@ exports.Account = {
|
|
|
3278
3374
|
}
|
|
3279
3375
|
catch (error) {
|
|
3280
3376
|
lastError = error;
|
|
3377
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
3378
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
3379
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
3380
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
3381
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
3382
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
3383
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
3384
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
3385
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
3386
|
+
if (isConstraintViolation) {
|
|
3387
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
3388
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneAccount", {
|
|
3389
|
+
operation: 'upsertOneAccount',
|
|
3390
|
+
model: 'Account',
|
|
3391
|
+
error: String(error),
|
|
3392
|
+
recordId: props.id,
|
|
3393
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
3394
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
3395
|
+
isRetryable: false,
|
|
3396
|
+
});
|
|
3397
|
+
throw error;
|
|
3398
|
+
}
|
|
3281
3399
|
// Check if this is a database connection error that we should retry
|
|
3282
|
-
const isConnectionError = ((
|
|
3283
|
-
((
|
|
3284
|
-
((
|
|
3285
|
-
((
|
|
3286
|
-
(error.networkError && ((
|
|
3400
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
3401
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
3402
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
3403
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
3404
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
3287
3405
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
3288
3406
|
retryCount++;
|
|
3289
3407
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
3290
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
3408
|
+
logger_1.logger.warn("Database connection error in upsertOneAccount, retrying...", {
|
|
3409
|
+
operation: 'upsertOneAccount',
|
|
3410
|
+
model: 'Account',
|
|
3411
|
+
attempt: retryCount,
|
|
3412
|
+
maxRetries: MAX_RETRIES,
|
|
3413
|
+
recordId: props.id,
|
|
3414
|
+
});
|
|
3291
3415
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
3292
3416
|
continue;
|
|
3293
3417
|
}
|
|
3294
|
-
// Log
|
|
3295
|
-
logger_1.logger.error("Database
|
|
3418
|
+
// Log structured error details and rethrow
|
|
3419
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
3420
|
+
operation: 'upsertOneAccount',
|
|
3421
|
+
model: 'Account',
|
|
3422
|
+
error: String(error),
|
|
3423
|
+
recordId: props.id,
|
|
3424
|
+
isRetryable: isConnectionError,
|
|
3425
|
+
});
|
|
3296
3426
|
throw error;
|
|
3297
3427
|
}
|
|
3298
3428
|
}
|
|
@@ -3307,7 +3437,7 @@ exports.Account = {
|
|
|
3307
3437
|
* @returns The count of created records or null.
|
|
3308
3438
|
*/
|
|
3309
3439
|
async updateMany(props, globalClient) {
|
|
3310
|
-
var _a, _b, _c, _d, _e;
|
|
3440
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
3311
3441
|
// Maximum number of retries for database connection issues
|
|
3312
3442
|
const MAX_RETRIES = 3;
|
|
3313
3443
|
let retryCount = 0;
|
|
@@ -4433,21 +4563,52 @@ exports.Account = {
|
|
|
4433
4563
|
}
|
|
4434
4564
|
catch (error) {
|
|
4435
4565
|
lastError = error;
|
|
4566
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4567
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
4568
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
4569
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
4570
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
4571
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
4572
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
4573
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
4574
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
4575
|
+
if (isConstraintViolation) {
|
|
4576
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
4577
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManyAccount", {
|
|
4578
|
+
operation: 'updateManyAccount',
|
|
4579
|
+
model: 'Account',
|
|
4580
|
+
error: String(error),
|
|
4581
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4582
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4583
|
+
isRetryable: false,
|
|
4584
|
+
});
|
|
4585
|
+
throw error;
|
|
4586
|
+
}
|
|
4436
4587
|
// Check if this is a database connection error that we should retry
|
|
4437
|
-
const isConnectionError = ((
|
|
4438
|
-
((
|
|
4439
|
-
((
|
|
4440
|
-
((
|
|
4441
|
-
(error.networkError && ((
|
|
4588
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
4589
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
4590
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
4591
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
4592
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
4442
4593
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4443
4594
|
retryCount++;
|
|
4444
4595
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4445
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
4596
|
+
logger_1.logger.warn("Database connection error in updateManyAccount, retrying...", {
|
|
4597
|
+
operation: 'updateManyAccount',
|
|
4598
|
+
model: 'Account',
|
|
4599
|
+
attempt: retryCount,
|
|
4600
|
+
maxRetries: MAX_RETRIES,
|
|
4601
|
+
});
|
|
4446
4602
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4447
4603
|
continue;
|
|
4448
4604
|
}
|
|
4449
|
-
// Log
|
|
4450
|
-
logger_1.logger.error("Database
|
|
4605
|
+
// Log structured error details and rethrow
|
|
4606
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
4607
|
+
operation: 'updateManyAccount',
|
|
4608
|
+
model: 'Account',
|
|
4609
|
+
error: String(error),
|
|
4610
|
+
isRetryable: isConnectionError,
|
|
4611
|
+
});
|
|
4451
4612
|
throw error;
|
|
4452
4613
|
}
|
|
4453
4614
|
}
|
|
@@ -4462,7 +4623,7 @@ exports.Account = {
|
|
|
4462
4623
|
* @returns The deleted Account or null.
|
|
4463
4624
|
*/
|
|
4464
4625
|
async delete(props, globalClient) {
|
|
4465
|
-
var _a, _b, _c, _d, _e;
|
|
4626
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
4466
4627
|
// Maximum number of retries for database connection issues
|
|
4467
4628
|
const MAX_RETRIES = 3;
|
|
4468
4629
|
let retryCount = 0;
|
|
@@ -4506,21 +4667,58 @@ exports.Account = {
|
|
|
4506
4667
|
}
|
|
4507
4668
|
catch (error) {
|
|
4508
4669
|
lastError = error;
|
|
4670
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
4671
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
4672
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
4673
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
4674
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
4675
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
4676
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
4677
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
4678
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
4679
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
4680
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
4681
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
4682
|
+
if (isConstraintViolation) {
|
|
4683
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
4684
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneAccount", {
|
|
4685
|
+
operation: 'deleteOneAccount',
|
|
4686
|
+
model: 'Account',
|
|
4687
|
+
error: String(error),
|
|
4688
|
+
recordId: props.id,
|
|
4689
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
4690
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
4691
|
+
isRetryable: false,
|
|
4692
|
+
});
|
|
4693
|
+
throw error;
|
|
4694
|
+
}
|
|
4509
4695
|
// Check if this is a database connection error that we should retry
|
|
4510
|
-
const isConnectionError = ((
|
|
4511
|
-
((
|
|
4512
|
-
((
|
|
4513
|
-
((
|
|
4514
|
-
(error.networkError && ((
|
|
4696
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
4697
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
4698
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
4699
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
4700
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
4515
4701
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4516
4702
|
retryCount++;
|
|
4517
4703
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4518
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
4704
|
+
logger_1.logger.warn("Database connection error in deleteOneAccount, retrying...", {
|
|
4705
|
+
operation: 'deleteOneAccount',
|
|
4706
|
+
model: 'Account',
|
|
4707
|
+
attempt: retryCount,
|
|
4708
|
+
maxRetries: MAX_RETRIES,
|
|
4709
|
+
recordId: props.id,
|
|
4710
|
+
});
|
|
4519
4711
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4520
4712
|
continue;
|
|
4521
4713
|
}
|
|
4522
|
-
// Log
|
|
4523
|
-
logger_1.logger.error("Database
|
|
4714
|
+
// Log structured error details and rethrow
|
|
4715
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
4716
|
+
operation: 'deleteOneAccount',
|
|
4717
|
+
model: 'Account',
|
|
4718
|
+
error: String(error),
|
|
4719
|
+
recordId: props.id,
|
|
4720
|
+
isRetryable: isConnectionError,
|
|
4721
|
+
});
|
|
4524
4722
|
throw error;
|
|
4525
4723
|
}
|
|
4526
4724
|
}
|
|
@@ -4591,12 +4789,22 @@ exports.Account = {
|
|
|
4591
4789
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4592
4790
|
retryCount++;
|
|
4593
4791
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4594
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
4792
|
+
logger_1.logger.warn("Database connection error in getAccount, retrying...", {
|
|
4793
|
+
operation: 'getAccount',
|
|
4794
|
+
model: 'Account',
|
|
4795
|
+
attempt: retryCount,
|
|
4796
|
+
maxRetries: MAX_RETRIES,
|
|
4797
|
+
});
|
|
4595
4798
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4596
4799
|
continue;
|
|
4597
4800
|
}
|
|
4598
|
-
// Log
|
|
4599
|
-
logger_1.logger.error("Database
|
|
4801
|
+
// Log structured error details and rethrow
|
|
4802
|
+
logger_1.logger.error("Database get operation failed", {
|
|
4803
|
+
operation: 'getAccount',
|
|
4804
|
+
model: 'Account',
|
|
4805
|
+
error: String(error),
|
|
4806
|
+
isRetryable: isConnectionError,
|
|
4807
|
+
});
|
|
4600
4808
|
throw error;
|
|
4601
4809
|
}
|
|
4602
4810
|
}
|
|
@@ -4654,12 +4862,22 @@ exports.Account = {
|
|
|
4654
4862
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4655
4863
|
retryCount++;
|
|
4656
4864
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4657
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
4865
|
+
logger_1.logger.warn("Database connection error in getAllAccount, retrying...", {
|
|
4866
|
+
operation: 'getAllAccount',
|
|
4867
|
+
model: 'Account',
|
|
4868
|
+
attempt: retryCount,
|
|
4869
|
+
maxRetries: MAX_RETRIES,
|
|
4870
|
+
});
|
|
4658
4871
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4659
4872
|
continue;
|
|
4660
4873
|
}
|
|
4661
|
-
// Log
|
|
4662
|
-
logger_1.logger.error("Database
|
|
4874
|
+
// Log structured error details and rethrow
|
|
4875
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
4876
|
+
operation: 'getAllAccount',
|
|
4877
|
+
model: 'Account',
|
|
4878
|
+
error: String(error),
|
|
4879
|
+
isRetryable: isConnectionError,
|
|
4880
|
+
});
|
|
4663
4881
|
throw error;
|
|
4664
4882
|
}
|
|
4665
4883
|
}
|
|
@@ -4739,12 +4957,22 @@ exports.Account = {
|
|
|
4739
4957
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
4740
4958
|
retryCount++;
|
|
4741
4959
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
4742
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
4960
|
+
logger_1.logger.warn("Database connection error in findManyAccount, retrying...", {
|
|
4961
|
+
operation: 'findManyAccount',
|
|
4962
|
+
model: 'Account',
|
|
4963
|
+
attempt: retryCount,
|
|
4964
|
+
maxRetries: MAX_RETRIES,
|
|
4965
|
+
});
|
|
4743
4966
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
4744
4967
|
continue;
|
|
4745
4968
|
}
|
|
4746
|
-
// Log
|
|
4747
|
-
logger_1.logger.error("Database
|
|
4969
|
+
// Log structured error details and rethrow
|
|
4970
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
4971
|
+
operation: 'findManyAccount',
|
|
4972
|
+
model: 'Account',
|
|
4973
|
+
error: String(error),
|
|
4974
|
+
isRetryable: isConnectionError,
|
|
4975
|
+
});
|
|
4748
4976
|
throw error;
|
|
4749
4977
|
}
|
|
4750
4978
|
}
|