@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/VerificationToken.cjs
CHANGED
|
@@ -30,7 +30,7 @@ exports.VerificationToken = {
|
|
|
30
30
|
* @returns The created VerificationToken or null.
|
|
31
31
|
*/
|
|
32
32
|
async create(props, globalClient) {
|
|
33
|
-
var _a, _b, _c, _d, _e;
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
34
34
|
// Maximum number of retries for database connection issues
|
|
35
35
|
const MAX_RETRIES = 3;
|
|
36
36
|
let retryCount = 0;
|
|
@@ -77,21 +77,52 @@ exports.VerificationToken = {
|
|
|
77
77
|
}
|
|
78
78
|
catch (error) {
|
|
79
79
|
lastError = error;
|
|
80
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
81
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
82
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
83
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
84
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
85
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
86
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
87
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
88
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
89
|
+
if (isConstraintViolation) {
|
|
90
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
91
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneVerificationToken", {
|
|
92
|
+
operation: 'createOneVerificationToken',
|
|
93
|
+
model: 'VerificationToken',
|
|
94
|
+
error: String(error),
|
|
95
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
96
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
97
|
+
isRetryable: false,
|
|
98
|
+
});
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
80
101
|
// Check if this is a database connection error that we should retry
|
|
81
|
-
const isConnectionError = ((
|
|
82
|
-
((
|
|
83
|
-
((
|
|
84
|
-
((
|
|
85
|
-
(error.networkError && ((
|
|
102
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
103
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
104
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
105
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
106
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
86
107
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
87
108
|
retryCount++;
|
|
88
109
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
89
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
110
|
+
logger_1.logger.warn("Database connection error in createOneVerificationToken, retrying...", {
|
|
111
|
+
operation: 'createOneVerificationToken',
|
|
112
|
+
model: 'VerificationToken',
|
|
113
|
+
attempt: retryCount,
|
|
114
|
+
maxRetries: MAX_RETRIES,
|
|
115
|
+
});
|
|
90
116
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
91
117
|
continue;
|
|
92
118
|
}
|
|
93
|
-
// Log
|
|
94
|
-
logger_1.logger.error("Database
|
|
119
|
+
// Log structured error details and rethrow
|
|
120
|
+
logger_1.logger.error("Database create operation failed", {
|
|
121
|
+
operation: 'createOneVerificationToken',
|
|
122
|
+
model: 'VerificationToken',
|
|
123
|
+
error: String(error),
|
|
124
|
+
isRetryable: isConnectionError,
|
|
125
|
+
});
|
|
95
126
|
throw error;
|
|
96
127
|
}
|
|
97
128
|
}
|
|
@@ -106,7 +137,7 @@ exports.VerificationToken = {
|
|
|
106
137
|
* @returns The count of created records or null.
|
|
107
138
|
*/
|
|
108
139
|
async createMany(props, globalClient) {
|
|
109
|
-
var _a, _b, _c, _d, _e;
|
|
140
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
110
141
|
// Maximum number of retries for database connection issues
|
|
111
142
|
const MAX_RETRIES = 3;
|
|
112
143
|
let retryCount = 0;
|
|
@@ -152,21 +183,52 @@ exports.VerificationToken = {
|
|
|
152
183
|
}
|
|
153
184
|
catch (error) {
|
|
154
185
|
lastError = error;
|
|
186
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
187
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
188
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
189
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
190
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
191
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
192
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
193
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
194
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
195
|
+
if (isConstraintViolation) {
|
|
196
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
197
|
+
logger_1.logger.error("Non-retryable constraint violation in createManyVerificationToken", {
|
|
198
|
+
operation: 'createManyVerificationToken',
|
|
199
|
+
model: 'VerificationToken',
|
|
200
|
+
error: String(error),
|
|
201
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
202
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
203
|
+
isRetryable: false,
|
|
204
|
+
});
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
155
207
|
// Check if this is a database connection error that we should retry
|
|
156
|
-
const isConnectionError = ((
|
|
157
|
-
((
|
|
158
|
-
((
|
|
159
|
-
((
|
|
160
|
-
(error.networkError && ((
|
|
208
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
209
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
210
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
211
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
212
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
161
213
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
162
214
|
retryCount++;
|
|
163
215
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
164
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
216
|
+
logger_1.logger.warn("Database connection error in createManyVerificationToken, retrying...", {
|
|
217
|
+
operation: 'createManyVerificationToken',
|
|
218
|
+
model: 'VerificationToken',
|
|
219
|
+
attempt: retryCount,
|
|
220
|
+
maxRetries: MAX_RETRIES,
|
|
221
|
+
});
|
|
165
222
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
166
223
|
continue;
|
|
167
224
|
}
|
|
168
|
-
// Log
|
|
169
|
-
logger_1.logger.error("Database
|
|
225
|
+
// Log structured error details and rethrow
|
|
226
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
227
|
+
operation: 'createManyVerificationToken',
|
|
228
|
+
model: 'VerificationToken',
|
|
229
|
+
error: String(error),
|
|
230
|
+
isRetryable: isConnectionError,
|
|
231
|
+
});
|
|
170
232
|
throw error;
|
|
171
233
|
}
|
|
172
234
|
}
|
|
@@ -181,7 +243,7 @@ exports.VerificationToken = {
|
|
|
181
243
|
* @returns The updated VerificationToken or null.
|
|
182
244
|
*/
|
|
183
245
|
async update(props, globalClient) {
|
|
184
|
-
var _a, _b, _c, _d, _e;
|
|
246
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
185
247
|
// Maximum number of retries for database connection issues
|
|
186
248
|
const MAX_RETRIES = 3;
|
|
187
249
|
let retryCount = 0;
|
|
@@ -239,21 +301,55 @@ exports.VerificationToken = {
|
|
|
239
301
|
}
|
|
240
302
|
catch (error) {
|
|
241
303
|
lastError = error;
|
|
304
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
305
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
306
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
307
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
308
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
309
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
310
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
311
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
312
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
313
|
+
if (isConstraintViolation) {
|
|
314
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
315
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneVerificationToken", {
|
|
316
|
+
operation: 'updateOneVerificationToken',
|
|
317
|
+
model: 'VerificationToken',
|
|
318
|
+
error: String(error),
|
|
319
|
+
recordId: props.id,
|
|
320
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
321
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
322
|
+
isRetryable: false,
|
|
323
|
+
});
|
|
324
|
+
throw error;
|
|
325
|
+
}
|
|
242
326
|
// Check if this is a database connection error that we should retry
|
|
243
|
-
const isConnectionError = ((
|
|
244
|
-
((
|
|
245
|
-
((
|
|
246
|
-
((
|
|
247
|
-
(error.networkError && ((
|
|
327
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
328
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
329
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
330
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
331
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
248
332
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
249
333
|
retryCount++;
|
|
250
334
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
251
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
335
|
+
logger_1.logger.warn("Database connection error in updateOneVerificationToken, retrying...", {
|
|
336
|
+
operation: 'updateOneVerificationToken',
|
|
337
|
+
model: 'VerificationToken',
|
|
338
|
+
attempt: retryCount,
|
|
339
|
+
maxRetries: MAX_RETRIES,
|
|
340
|
+
recordId: props.id,
|
|
341
|
+
});
|
|
252
342
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
253
343
|
continue;
|
|
254
344
|
}
|
|
255
|
-
// Log
|
|
256
|
-
logger_1.logger.error("Database
|
|
345
|
+
// Log structured error details and rethrow
|
|
346
|
+
logger_1.logger.error("Database update operation failed", {
|
|
347
|
+
operation: 'updateOneVerificationToken',
|
|
348
|
+
model: 'VerificationToken',
|
|
349
|
+
error: String(error),
|
|
350
|
+
recordId: props.id,
|
|
351
|
+
isRetryable: isConnectionError,
|
|
352
|
+
});
|
|
257
353
|
throw error;
|
|
258
354
|
}
|
|
259
355
|
}
|
|
@@ -268,7 +364,7 @@ exports.VerificationToken = {
|
|
|
268
364
|
* @returns The updated VerificationToken or null.
|
|
269
365
|
*/
|
|
270
366
|
async upsert(props, globalClient) {
|
|
271
|
-
var _a, _b, _c, _d, _e;
|
|
367
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
272
368
|
// Maximum number of retries for database connection issues
|
|
273
369
|
const MAX_RETRIES = 3;
|
|
274
370
|
let retryCount = 0;
|
|
@@ -328,21 +424,55 @@ exports.VerificationToken = {
|
|
|
328
424
|
}
|
|
329
425
|
catch (error) {
|
|
330
426
|
lastError = error;
|
|
427
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
428
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
429
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
430
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
431
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
432
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
433
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
434
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
435
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
436
|
+
if (isConstraintViolation) {
|
|
437
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
438
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneVerificationToken", {
|
|
439
|
+
operation: 'upsertOneVerificationToken',
|
|
440
|
+
model: 'VerificationToken',
|
|
441
|
+
error: String(error),
|
|
442
|
+
recordId: props.id,
|
|
443
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
444
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
445
|
+
isRetryable: false,
|
|
446
|
+
});
|
|
447
|
+
throw error;
|
|
448
|
+
}
|
|
331
449
|
// Check if this is a database connection error that we should retry
|
|
332
|
-
const isConnectionError = ((
|
|
333
|
-
((
|
|
334
|
-
((
|
|
335
|
-
((
|
|
336
|
-
(error.networkError && ((
|
|
450
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
451
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
452
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
453
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
454
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
337
455
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
338
456
|
retryCount++;
|
|
339
457
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
340
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
458
|
+
logger_1.logger.warn("Database connection error in upsertOneVerificationToken, retrying...", {
|
|
459
|
+
operation: 'upsertOneVerificationToken',
|
|
460
|
+
model: 'VerificationToken',
|
|
461
|
+
attempt: retryCount,
|
|
462
|
+
maxRetries: MAX_RETRIES,
|
|
463
|
+
recordId: props.id,
|
|
464
|
+
});
|
|
341
465
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
342
466
|
continue;
|
|
343
467
|
}
|
|
344
|
-
// Log
|
|
345
|
-
logger_1.logger.error("Database
|
|
468
|
+
// Log structured error details and rethrow
|
|
469
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
470
|
+
operation: 'upsertOneVerificationToken',
|
|
471
|
+
model: 'VerificationToken',
|
|
472
|
+
error: String(error),
|
|
473
|
+
recordId: props.id,
|
|
474
|
+
isRetryable: isConnectionError,
|
|
475
|
+
});
|
|
346
476
|
throw error;
|
|
347
477
|
}
|
|
348
478
|
}
|
|
@@ -357,7 +487,7 @@ exports.VerificationToken = {
|
|
|
357
487
|
* @returns The count of created records or null.
|
|
358
488
|
*/
|
|
359
489
|
async updateMany(props, globalClient) {
|
|
360
|
-
var _a, _b, _c, _d, _e;
|
|
490
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
361
491
|
// Maximum number of retries for database connection issues
|
|
362
492
|
const MAX_RETRIES = 3;
|
|
363
493
|
let retryCount = 0;
|
|
@@ -415,21 +545,52 @@ exports.VerificationToken = {
|
|
|
415
545
|
}
|
|
416
546
|
catch (error) {
|
|
417
547
|
lastError = error;
|
|
548
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
549
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
550
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
551
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
552
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
553
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
554
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
555
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
556
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
557
|
+
if (isConstraintViolation) {
|
|
558
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
559
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManyVerificationToken", {
|
|
560
|
+
operation: 'updateManyVerificationToken',
|
|
561
|
+
model: 'VerificationToken',
|
|
562
|
+
error: String(error),
|
|
563
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
564
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
565
|
+
isRetryable: false,
|
|
566
|
+
});
|
|
567
|
+
throw error;
|
|
568
|
+
}
|
|
418
569
|
// Check if this is a database connection error that we should retry
|
|
419
|
-
const isConnectionError = ((
|
|
420
|
-
((
|
|
421
|
-
((
|
|
422
|
-
((
|
|
423
|
-
(error.networkError && ((
|
|
570
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
571
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
572
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
573
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
574
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
424
575
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
425
576
|
retryCount++;
|
|
426
577
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
427
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
578
|
+
logger_1.logger.warn("Database connection error in updateManyVerificationToken, retrying...", {
|
|
579
|
+
operation: 'updateManyVerificationToken',
|
|
580
|
+
model: 'VerificationToken',
|
|
581
|
+
attempt: retryCount,
|
|
582
|
+
maxRetries: MAX_RETRIES,
|
|
583
|
+
});
|
|
428
584
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
429
585
|
continue;
|
|
430
586
|
}
|
|
431
|
-
// Log
|
|
432
|
-
logger_1.logger.error("Database
|
|
587
|
+
// Log structured error details and rethrow
|
|
588
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
589
|
+
operation: 'updateManyVerificationToken',
|
|
590
|
+
model: 'VerificationToken',
|
|
591
|
+
error: String(error),
|
|
592
|
+
isRetryable: isConnectionError,
|
|
593
|
+
});
|
|
433
594
|
throw error;
|
|
434
595
|
}
|
|
435
596
|
}
|
|
@@ -444,7 +605,7 @@ exports.VerificationToken = {
|
|
|
444
605
|
* @returns The deleted VerificationToken or null.
|
|
445
606
|
*/
|
|
446
607
|
async delete(props, globalClient) {
|
|
447
|
-
var _a, _b, _c, _d, _e;
|
|
608
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
448
609
|
// Maximum number of retries for database connection issues
|
|
449
610
|
const MAX_RETRIES = 3;
|
|
450
611
|
let retryCount = 0;
|
|
@@ -488,21 +649,58 @@ exports.VerificationToken = {
|
|
|
488
649
|
}
|
|
489
650
|
catch (error) {
|
|
490
651
|
lastError = error;
|
|
652
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
653
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
654
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
655
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
656
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
657
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
658
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
659
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
660
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
661
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
662
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
663
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
664
|
+
if (isConstraintViolation) {
|
|
665
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
666
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneVerificationToken", {
|
|
667
|
+
operation: 'deleteOneVerificationToken',
|
|
668
|
+
model: 'VerificationToken',
|
|
669
|
+
error: String(error),
|
|
670
|
+
recordId: props.id,
|
|
671
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
672
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
673
|
+
isRetryable: false,
|
|
674
|
+
});
|
|
675
|
+
throw error;
|
|
676
|
+
}
|
|
491
677
|
// Check if this is a database connection error that we should retry
|
|
492
|
-
const isConnectionError = ((
|
|
493
|
-
((
|
|
494
|
-
((
|
|
495
|
-
((
|
|
496
|
-
(error.networkError && ((
|
|
678
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
679
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
680
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
681
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
682
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
497
683
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
498
684
|
retryCount++;
|
|
499
685
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
500
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
686
|
+
logger_1.logger.warn("Database connection error in deleteOneVerificationToken, retrying...", {
|
|
687
|
+
operation: 'deleteOneVerificationToken',
|
|
688
|
+
model: 'VerificationToken',
|
|
689
|
+
attempt: retryCount,
|
|
690
|
+
maxRetries: MAX_RETRIES,
|
|
691
|
+
recordId: props.id,
|
|
692
|
+
});
|
|
501
693
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
502
694
|
continue;
|
|
503
695
|
}
|
|
504
|
-
// Log
|
|
505
|
-
logger_1.logger.error("Database
|
|
696
|
+
// Log structured error details and rethrow
|
|
697
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
698
|
+
operation: 'deleteOneVerificationToken',
|
|
699
|
+
model: 'VerificationToken',
|
|
700
|
+
error: String(error),
|
|
701
|
+
recordId: props.id,
|
|
702
|
+
isRetryable: isConnectionError,
|
|
703
|
+
});
|
|
506
704
|
throw error;
|
|
507
705
|
}
|
|
508
706
|
}
|
|
@@ -569,12 +767,22 @@ exports.VerificationToken = {
|
|
|
569
767
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
570
768
|
retryCount++;
|
|
571
769
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
572
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
770
|
+
logger_1.logger.warn("Database connection error in getVerificationToken, retrying...", {
|
|
771
|
+
operation: 'getVerificationToken',
|
|
772
|
+
model: 'VerificationToken',
|
|
773
|
+
attempt: retryCount,
|
|
774
|
+
maxRetries: MAX_RETRIES,
|
|
775
|
+
});
|
|
573
776
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
574
777
|
continue;
|
|
575
778
|
}
|
|
576
|
-
// Log
|
|
577
|
-
logger_1.logger.error("Database
|
|
779
|
+
// Log structured error details and rethrow
|
|
780
|
+
logger_1.logger.error("Database get operation failed", {
|
|
781
|
+
operation: 'getVerificationToken',
|
|
782
|
+
model: 'VerificationToken',
|
|
783
|
+
error: String(error),
|
|
784
|
+
isRetryable: isConnectionError,
|
|
785
|
+
});
|
|
578
786
|
throw error;
|
|
579
787
|
}
|
|
580
788
|
}
|
|
@@ -632,12 +840,22 @@ exports.VerificationToken = {
|
|
|
632
840
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
633
841
|
retryCount++;
|
|
634
842
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
635
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
843
|
+
logger_1.logger.warn("Database connection error in getAllVerificationToken, retrying...", {
|
|
844
|
+
operation: 'getAllVerificationToken',
|
|
845
|
+
model: 'VerificationToken',
|
|
846
|
+
attempt: retryCount,
|
|
847
|
+
maxRetries: MAX_RETRIES,
|
|
848
|
+
});
|
|
636
849
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
637
850
|
continue;
|
|
638
851
|
}
|
|
639
|
-
// Log
|
|
640
|
-
logger_1.logger.error("Database
|
|
852
|
+
// Log structured error details and rethrow
|
|
853
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
854
|
+
operation: 'getAllVerificationToken',
|
|
855
|
+
model: 'VerificationToken',
|
|
856
|
+
error: String(error),
|
|
857
|
+
isRetryable: isConnectionError,
|
|
858
|
+
});
|
|
641
859
|
throw error;
|
|
642
860
|
}
|
|
643
861
|
}
|
|
@@ -711,12 +929,22 @@ exports.VerificationToken = {
|
|
|
711
929
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
712
930
|
retryCount++;
|
|
713
931
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
714
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
932
|
+
logger_1.logger.warn("Database connection error in findManyVerificationToken, retrying...", {
|
|
933
|
+
operation: 'findManyVerificationToken',
|
|
934
|
+
model: 'VerificationToken',
|
|
935
|
+
attempt: retryCount,
|
|
936
|
+
maxRetries: MAX_RETRIES,
|
|
937
|
+
});
|
|
715
938
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
716
939
|
continue;
|
|
717
940
|
}
|
|
718
|
-
// Log
|
|
719
|
-
logger_1.logger.error("Database
|
|
941
|
+
// Log structured error details and rethrow
|
|
942
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
943
|
+
operation: 'findManyVerificationToken',
|
|
944
|
+
model: 'VerificationToken',
|
|
945
|
+
error: String(error),
|
|
946
|
+
isRetryable: isConnectionError,
|
|
947
|
+
});
|
|
720
948
|
throw error;
|
|
721
949
|
}
|
|
722
950
|
}
|