@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
|
@@ -73,7 +73,7 @@ exports.InstitutionalSentimentHistory = {
|
|
|
73
73
|
* @returns The created InstitutionalSentimentHistory or null.
|
|
74
74
|
*/
|
|
75
75
|
async create(props, globalClient) {
|
|
76
|
-
var _a, _b, _c, _d, _e;
|
|
76
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
77
77
|
// Maximum number of retries for database connection issues
|
|
78
78
|
const MAX_RETRIES = 3;
|
|
79
79
|
let retryCount = 0;
|
|
@@ -161,21 +161,52 @@ exports.InstitutionalSentimentHistory = {
|
|
|
161
161
|
}
|
|
162
162
|
catch (error) {
|
|
163
163
|
lastError = error;
|
|
164
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
165
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
166
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
167
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
168
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
169
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
170
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
171
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
172
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
173
|
+
if (isConstraintViolation) {
|
|
174
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
175
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneInstitutionalSentimentHistory", {
|
|
176
|
+
operation: 'createOneInstitutionalSentimentHistory',
|
|
177
|
+
model: 'InstitutionalSentimentHistory',
|
|
178
|
+
error: String(error),
|
|
179
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
180
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
181
|
+
isRetryable: false,
|
|
182
|
+
});
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
164
185
|
// Check if this is a database connection error that we should retry
|
|
165
|
-
const isConnectionError = ((
|
|
166
|
-
((
|
|
167
|
-
((
|
|
168
|
-
((
|
|
169
|
-
(error.networkError && ((
|
|
186
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
187
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
188
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
189
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
190
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
170
191
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
171
192
|
retryCount++;
|
|
172
193
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
173
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
194
|
+
logger_1.logger.warn("Database connection error in createOneInstitutionalSentimentHistory, retrying...", {
|
|
195
|
+
operation: 'createOneInstitutionalSentimentHistory',
|
|
196
|
+
model: 'InstitutionalSentimentHistory',
|
|
197
|
+
attempt: retryCount,
|
|
198
|
+
maxRetries: MAX_RETRIES,
|
|
199
|
+
});
|
|
174
200
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
175
201
|
continue;
|
|
176
202
|
}
|
|
177
|
-
// Log
|
|
178
|
-
logger_1.logger.error("Database
|
|
203
|
+
// Log structured error details and rethrow
|
|
204
|
+
logger_1.logger.error("Database create operation failed", {
|
|
205
|
+
operation: 'createOneInstitutionalSentimentHistory',
|
|
206
|
+
model: 'InstitutionalSentimentHistory',
|
|
207
|
+
error: String(error),
|
|
208
|
+
isRetryable: isConnectionError,
|
|
209
|
+
});
|
|
179
210
|
throw error;
|
|
180
211
|
}
|
|
181
212
|
}
|
|
@@ -190,7 +221,7 @@ exports.InstitutionalSentimentHistory = {
|
|
|
190
221
|
* @returns The count of created records or null.
|
|
191
222
|
*/
|
|
192
223
|
async createMany(props, globalClient) {
|
|
193
|
-
var _a, _b, _c, _d, _e;
|
|
224
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
194
225
|
// Maximum number of retries for database connection issues
|
|
195
226
|
const MAX_RETRIES = 3;
|
|
196
227
|
let retryCount = 0;
|
|
@@ -277,21 +308,52 @@ exports.InstitutionalSentimentHistory = {
|
|
|
277
308
|
}
|
|
278
309
|
catch (error) {
|
|
279
310
|
lastError = error;
|
|
311
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
312
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
313
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
314
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
315
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
316
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
317
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
318
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
319
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
320
|
+
if (isConstraintViolation) {
|
|
321
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
322
|
+
logger_1.logger.error("Non-retryable constraint violation in createManyInstitutionalSentimentHistory", {
|
|
323
|
+
operation: 'createManyInstitutionalSentimentHistory',
|
|
324
|
+
model: 'InstitutionalSentimentHistory',
|
|
325
|
+
error: String(error),
|
|
326
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
327
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
328
|
+
isRetryable: false,
|
|
329
|
+
});
|
|
330
|
+
throw error;
|
|
331
|
+
}
|
|
280
332
|
// Check if this is a database connection error that we should retry
|
|
281
|
-
const isConnectionError = ((
|
|
282
|
-
((
|
|
283
|
-
((
|
|
284
|
-
((
|
|
285
|
-
(error.networkError && ((
|
|
333
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
334
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
335
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
336
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
337
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
286
338
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
287
339
|
retryCount++;
|
|
288
340
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
289
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
341
|
+
logger_1.logger.warn("Database connection error in createManyInstitutionalSentimentHistory, retrying...", {
|
|
342
|
+
operation: 'createManyInstitutionalSentimentHistory',
|
|
343
|
+
model: 'InstitutionalSentimentHistory',
|
|
344
|
+
attempt: retryCount,
|
|
345
|
+
maxRetries: MAX_RETRIES,
|
|
346
|
+
});
|
|
290
347
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
291
348
|
continue;
|
|
292
349
|
}
|
|
293
|
-
// Log
|
|
294
|
-
logger_1.logger.error("Database
|
|
350
|
+
// Log structured error details and rethrow
|
|
351
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
352
|
+
operation: 'createManyInstitutionalSentimentHistory',
|
|
353
|
+
model: 'InstitutionalSentimentHistory',
|
|
354
|
+
error: String(error),
|
|
355
|
+
isRetryable: isConnectionError,
|
|
356
|
+
});
|
|
295
357
|
throw error;
|
|
296
358
|
}
|
|
297
359
|
}
|
|
@@ -306,7 +368,7 @@ exports.InstitutionalSentimentHistory = {
|
|
|
306
368
|
* @returns The updated InstitutionalSentimentHistory or null.
|
|
307
369
|
*/
|
|
308
370
|
async update(props, globalClient) {
|
|
309
|
-
var _a, _b, _c, _d, _e;
|
|
371
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
310
372
|
// Maximum number of retries for database connection issues
|
|
311
373
|
const MAX_RETRIES = 3;
|
|
312
374
|
let retryCount = 0;
|
|
@@ -496,21 +558,55 @@ exports.InstitutionalSentimentHistory = {
|
|
|
496
558
|
}
|
|
497
559
|
catch (error) {
|
|
498
560
|
lastError = error;
|
|
561
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
562
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
563
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
564
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
565
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
566
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
567
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
568
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
569
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
570
|
+
if (isConstraintViolation) {
|
|
571
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
572
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneInstitutionalSentimentHistory", {
|
|
573
|
+
operation: 'updateOneInstitutionalSentimentHistory',
|
|
574
|
+
model: 'InstitutionalSentimentHistory',
|
|
575
|
+
error: String(error),
|
|
576
|
+
recordId: props.id,
|
|
577
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
578
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
579
|
+
isRetryable: false,
|
|
580
|
+
});
|
|
581
|
+
throw error;
|
|
582
|
+
}
|
|
499
583
|
// Check if this is a database connection error that we should retry
|
|
500
|
-
const isConnectionError = ((
|
|
501
|
-
((
|
|
502
|
-
((
|
|
503
|
-
((
|
|
504
|
-
(error.networkError && ((
|
|
584
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
585
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
586
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
587
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
588
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
505
589
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
506
590
|
retryCount++;
|
|
507
591
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
508
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
592
|
+
logger_1.logger.warn("Database connection error in updateOneInstitutionalSentimentHistory, retrying...", {
|
|
593
|
+
operation: 'updateOneInstitutionalSentimentHistory',
|
|
594
|
+
model: 'InstitutionalSentimentHistory',
|
|
595
|
+
attempt: retryCount,
|
|
596
|
+
maxRetries: MAX_RETRIES,
|
|
597
|
+
recordId: props.id,
|
|
598
|
+
});
|
|
509
599
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
510
600
|
continue;
|
|
511
601
|
}
|
|
512
|
-
// Log
|
|
513
|
-
logger_1.logger.error("Database
|
|
602
|
+
// Log structured error details and rethrow
|
|
603
|
+
logger_1.logger.error("Database update operation failed", {
|
|
604
|
+
operation: 'updateOneInstitutionalSentimentHistory',
|
|
605
|
+
model: 'InstitutionalSentimentHistory',
|
|
606
|
+
error: String(error),
|
|
607
|
+
recordId: props.id,
|
|
608
|
+
isRetryable: isConnectionError,
|
|
609
|
+
});
|
|
514
610
|
throw error;
|
|
515
611
|
}
|
|
516
612
|
}
|
|
@@ -525,7 +621,7 @@ exports.InstitutionalSentimentHistory = {
|
|
|
525
621
|
* @returns The updated InstitutionalSentimentHistory or null.
|
|
526
622
|
*/
|
|
527
623
|
async upsert(props, globalClient) {
|
|
528
|
-
var _a, _b, _c, _d, _e;
|
|
624
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
529
625
|
// Maximum number of retries for database connection issues
|
|
530
626
|
const MAX_RETRIES = 3;
|
|
531
627
|
let retryCount = 0;
|
|
@@ -752,21 +848,55 @@ exports.InstitutionalSentimentHistory = {
|
|
|
752
848
|
}
|
|
753
849
|
catch (error) {
|
|
754
850
|
lastError = error;
|
|
851
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
852
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
853
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
854
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
855
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
856
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
857
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
858
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
859
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
860
|
+
if (isConstraintViolation) {
|
|
861
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
862
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneInstitutionalSentimentHistory", {
|
|
863
|
+
operation: 'upsertOneInstitutionalSentimentHistory',
|
|
864
|
+
model: 'InstitutionalSentimentHistory',
|
|
865
|
+
error: String(error),
|
|
866
|
+
recordId: props.id,
|
|
867
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
868
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
869
|
+
isRetryable: false,
|
|
870
|
+
});
|
|
871
|
+
throw error;
|
|
872
|
+
}
|
|
755
873
|
// Check if this is a database connection error that we should retry
|
|
756
|
-
const isConnectionError = ((
|
|
757
|
-
((
|
|
758
|
-
((
|
|
759
|
-
((
|
|
760
|
-
(error.networkError && ((
|
|
874
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
875
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
876
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
877
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
878
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
761
879
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
762
880
|
retryCount++;
|
|
763
881
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
764
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
882
|
+
logger_1.logger.warn("Database connection error in upsertOneInstitutionalSentimentHistory, retrying...", {
|
|
883
|
+
operation: 'upsertOneInstitutionalSentimentHistory',
|
|
884
|
+
model: 'InstitutionalSentimentHistory',
|
|
885
|
+
attempt: retryCount,
|
|
886
|
+
maxRetries: MAX_RETRIES,
|
|
887
|
+
recordId: props.id,
|
|
888
|
+
});
|
|
765
889
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
766
890
|
continue;
|
|
767
891
|
}
|
|
768
|
-
// Log
|
|
769
|
-
logger_1.logger.error("Database
|
|
892
|
+
// Log structured error details and rethrow
|
|
893
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
894
|
+
operation: 'upsertOneInstitutionalSentimentHistory',
|
|
895
|
+
model: 'InstitutionalSentimentHistory',
|
|
896
|
+
error: String(error),
|
|
897
|
+
recordId: props.id,
|
|
898
|
+
isRetryable: isConnectionError,
|
|
899
|
+
});
|
|
770
900
|
throw error;
|
|
771
901
|
}
|
|
772
902
|
}
|
|
@@ -781,7 +911,7 @@ exports.InstitutionalSentimentHistory = {
|
|
|
781
911
|
* @returns The count of created records or null.
|
|
782
912
|
*/
|
|
783
913
|
async updateMany(props, globalClient) {
|
|
784
|
-
var _a, _b, _c, _d, _e;
|
|
914
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
785
915
|
// Maximum number of retries for database connection issues
|
|
786
916
|
const MAX_RETRIES = 3;
|
|
787
917
|
let retryCount = 0;
|
|
@@ -971,21 +1101,52 @@ exports.InstitutionalSentimentHistory = {
|
|
|
971
1101
|
}
|
|
972
1102
|
catch (error) {
|
|
973
1103
|
lastError = error;
|
|
1104
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1105
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
1106
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
1107
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
1108
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
1109
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
1110
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
1111
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
1112
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
1113
|
+
if (isConstraintViolation) {
|
|
1114
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
1115
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManyInstitutionalSentimentHistory", {
|
|
1116
|
+
operation: 'updateManyInstitutionalSentimentHistory',
|
|
1117
|
+
model: 'InstitutionalSentimentHistory',
|
|
1118
|
+
error: String(error),
|
|
1119
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1120
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1121
|
+
isRetryable: false,
|
|
1122
|
+
});
|
|
1123
|
+
throw error;
|
|
1124
|
+
}
|
|
974
1125
|
// Check if this is a database connection error that we should retry
|
|
975
|
-
const isConnectionError = ((
|
|
976
|
-
((
|
|
977
|
-
((
|
|
978
|
-
((
|
|
979
|
-
(error.networkError && ((
|
|
1126
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
1127
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
1128
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
1129
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
1130
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
980
1131
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
981
1132
|
retryCount++;
|
|
982
1133
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
983
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1134
|
+
logger_1.logger.warn("Database connection error in updateManyInstitutionalSentimentHistory, retrying...", {
|
|
1135
|
+
operation: 'updateManyInstitutionalSentimentHistory',
|
|
1136
|
+
model: 'InstitutionalSentimentHistory',
|
|
1137
|
+
attempt: retryCount,
|
|
1138
|
+
maxRetries: MAX_RETRIES,
|
|
1139
|
+
});
|
|
984
1140
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
985
1141
|
continue;
|
|
986
1142
|
}
|
|
987
|
-
// Log
|
|
988
|
-
logger_1.logger.error("Database
|
|
1143
|
+
// Log structured error details and rethrow
|
|
1144
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
1145
|
+
operation: 'updateManyInstitutionalSentimentHistory',
|
|
1146
|
+
model: 'InstitutionalSentimentHistory',
|
|
1147
|
+
error: String(error),
|
|
1148
|
+
isRetryable: isConnectionError,
|
|
1149
|
+
});
|
|
989
1150
|
throw error;
|
|
990
1151
|
}
|
|
991
1152
|
}
|
|
@@ -1000,7 +1161,7 @@ exports.InstitutionalSentimentHistory = {
|
|
|
1000
1161
|
* @returns The deleted InstitutionalSentimentHistory or null.
|
|
1001
1162
|
*/
|
|
1002
1163
|
async delete(props, globalClient) {
|
|
1003
|
-
var _a, _b, _c, _d, _e;
|
|
1164
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1004
1165
|
// Maximum number of retries for database connection issues
|
|
1005
1166
|
const MAX_RETRIES = 3;
|
|
1006
1167
|
let retryCount = 0;
|
|
@@ -1044,21 +1205,58 @@ exports.InstitutionalSentimentHistory = {
|
|
|
1044
1205
|
}
|
|
1045
1206
|
catch (error) {
|
|
1046
1207
|
lastError = error;
|
|
1208
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1209
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
1210
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
1211
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
1212
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
1213
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
1214
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
1215
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
1216
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
1217
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
1218
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
1219
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
1220
|
+
if (isConstraintViolation) {
|
|
1221
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
1222
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneInstitutionalSentimentHistory", {
|
|
1223
|
+
operation: 'deleteOneInstitutionalSentimentHistory',
|
|
1224
|
+
model: 'InstitutionalSentimentHistory',
|
|
1225
|
+
error: String(error),
|
|
1226
|
+
recordId: props.id,
|
|
1227
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1228
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1229
|
+
isRetryable: false,
|
|
1230
|
+
});
|
|
1231
|
+
throw error;
|
|
1232
|
+
}
|
|
1047
1233
|
// Check if this is a database connection error that we should retry
|
|
1048
|
-
const isConnectionError = ((
|
|
1049
|
-
((
|
|
1050
|
-
((
|
|
1051
|
-
((
|
|
1052
|
-
(error.networkError && ((
|
|
1234
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
1235
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
1236
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
1237
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
1238
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
1053
1239
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1054
1240
|
retryCount++;
|
|
1055
1241
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1056
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1242
|
+
logger_1.logger.warn("Database connection error in deleteOneInstitutionalSentimentHistory, retrying...", {
|
|
1243
|
+
operation: 'deleteOneInstitutionalSentimentHistory',
|
|
1244
|
+
model: 'InstitutionalSentimentHistory',
|
|
1245
|
+
attempt: retryCount,
|
|
1246
|
+
maxRetries: MAX_RETRIES,
|
|
1247
|
+
recordId: props.id,
|
|
1248
|
+
});
|
|
1057
1249
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1058
1250
|
continue;
|
|
1059
1251
|
}
|
|
1060
|
-
// Log
|
|
1061
|
-
logger_1.logger.error("Database
|
|
1252
|
+
// Log structured error details and rethrow
|
|
1253
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
1254
|
+
operation: 'deleteOneInstitutionalSentimentHistory',
|
|
1255
|
+
model: 'InstitutionalSentimentHistory',
|
|
1256
|
+
error: String(error),
|
|
1257
|
+
recordId: props.id,
|
|
1258
|
+
isRetryable: isConnectionError,
|
|
1259
|
+
});
|
|
1062
1260
|
throw error;
|
|
1063
1261
|
}
|
|
1064
1262
|
}
|
|
@@ -1128,12 +1326,22 @@ exports.InstitutionalSentimentHistory = {
|
|
|
1128
1326
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1129
1327
|
retryCount++;
|
|
1130
1328
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1131
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1329
|
+
logger_1.logger.warn("Database connection error in getInstitutionalSentimentHistory, retrying...", {
|
|
1330
|
+
operation: 'getInstitutionalSentimentHistory',
|
|
1331
|
+
model: 'InstitutionalSentimentHistory',
|
|
1332
|
+
attempt: retryCount,
|
|
1333
|
+
maxRetries: MAX_RETRIES,
|
|
1334
|
+
});
|
|
1132
1335
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1133
1336
|
continue;
|
|
1134
1337
|
}
|
|
1135
|
-
// Log
|
|
1136
|
-
logger_1.logger.error("Database
|
|
1338
|
+
// Log structured error details and rethrow
|
|
1339
|
+
logger_1.logger.error("Database get operation failed", {
|
|
1340
|
+
operation: 'getInstitutionalSentimentHistory',
|
|
1341
|
+
model: 'InstitutionalSentimentHistory',
|
|
1342
|
+
error: String(error),
|
|
1343
|
+
isRetryable: isConnectionError,
|
|
1344
|
+
});
|
|
1137
1345
|
throw error;
|
|
1138
1346
|
}
|
|
1139
1347
|
}
|
|
@@ -1191,12 +1399,22 @@ exports.InstitutionalSentimentHistory = {
|
|
|
1191
1399
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1192
1400
|
retryCount++;
|
|
1193
1401
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1194
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1402
|
+
logger_1.logger.warn("Database connection error in getAllInstitutionalSentimentHistory, retrying...", {
|
|
1403
|
+
operation: 'getAllInstitutionalSentimentHistory',
|
|
1404
|
+
model: 'InstitutionalSentimentHistory',
|
|
1405
|
+
attempt: retryCount,
|
|
1406
|
+
maxRetries: MAX_RETRIES,
|
|
1407
|
+
});
|
|
1195
1408
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1196
1409
|
continue;
|
|
1197
1410
|
}
|
|
1198
|
-
// Log
|
|
1199
|
-
logger_1.logger.error("Database
|
|
1411
|
+
// Log structured error details and rethrow
|
|
1412
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
1413
|
+
operation: 'getAllInstitutionalSentimentHistory',
|
|
1414
|
+
model: 'InstitutionalSentimentHistory',
|
|
1415
|
+
error: String(error),
|
|
1416
|
+
isRetryable: isConnectionError,
|
|
1417
|
+
});
|
|
1200
1418
|
throw error;
|
|
1201
1419
|
}
|
|
1202
1420
|
}
|
|
@@ -1273,12 +1491,22 @@ exports.InstitutionalSentimentHistory = {
|
|
|
1273
1491
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1274
1492
|
retryCount++;
|
|
1275
1493
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1276
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1494
|
+
logger_1.logger.warn("Database connection error in findManyInstitutionalSentimentHistory, retrying...", {
|
|
1495
|
+
operation: 'findManyInstitutionalSentimentHistory',
|
|
1496
|
+
model: 'InstitutionalSentimentHistory',
|
|
1497
|
+
attempt: retryCount,
|
|
1498
|
+
maxRetries: MAX_RETRIES,
|
|
1499
|
+
});
|
|
1277
1500
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1278
1501
|
continue;
|
|
1279
1502
|
}
|
|
1280
|
-
// Log
|
|
1281
|
-
logger_1.logger.error("Database
|
|
1503
|
+
// Log structured error details and rethrow
|
|
1504
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
1505
|
+
operation: 'findManyInstitutionalSentimentHistory',
|
|
1506
|
+
model: 'InstitutionalSentimentHistory',
|
|
1507
|
+
error: String(error),
|
|
1508
|
+
isRetryable: isConnectionError,
|
|
1509
|
+
});
|
|
1282
1510
|
throw error;
|
|
1283
1511
|
}
|
|
1284
1512
|
}
|