@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/ConflictEvent.cjs
CHANGED
|
@@ -36,7 +36,7 @@ exports.ConflictEvent = {
|
|
|
36
36
|
* @returns The created ConflictEvent or null.
|
|
37
37
|
*/
|
|
38
38
|
async create(props, globalClient) {
|
|
39
|
-
var _a, _b, _c, _d, _e;
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
40
40
|
// Maximum number of retries for database connection issues
|
|
41
41
|
const MAX_RETRIES = 3;
|
|
42
42
|
let retryCount = 0;
|
|
@@ -89,21 +89,52 @@ exports.ConflictEvent = {
|
|
|
89
89
|
}
|
|
90
90
|
catch (error) {
|
|
91
91
|
lastError = error;
|
|
92
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
93
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
94
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
95
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
96
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
97
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
98
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
99
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
100
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
101
|
+
if (isConstraintViolation) {
|
|
102
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
103
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneConflictEvent", {
|
|
104
|
+
operation: 'createOneConflictEvent',
|
|
105
|
+
model: 'ConflictEvent',
|
|
106
|
+
error: String(error),
|
|
107
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
108
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
109
|
+
isRetryable: false,
|
|
110
|
+
});
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
92
113
|
// Check if this is a database connection error that we should retry
|
|
93
|
-
const isConnectionError = ((
|
|
94
|
-
((
|
|
95
|
-
((
|
|
96
|
-
((
|
|
97
|
-
(error.networkError && ((
|
|
114
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
115
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
116
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
117
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
118
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
98
119
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
99
120
|
retryCount++;
|
|
100
121
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
101
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
122
|
+
logger_1.logger.warn("Database connection error in createOneConflictEvent, retrying...", {
|
|
123
|
+
operation: 'createOneConflictEvent',
|
|
124
|
+
model: 'ConflictEvent',
|
|
125
|
+
attempt: retryCount,
|
|
126
|
+
maxRetries: MAX_RETRIES,
|
|
127
|
+
});
|
|
102
128
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
103
129
|
continue;
|
|
104
130
|
}
|
|
105
|
-
// Log
|
|
106
|
-
logger_1.logger.error("Database
|
|
131
|
+
// Log structured error details and rethrow
|
|
132
|
+
logger_1.logger.error("Database create operation failed", {
|
|
133
|
+
operation: 'createOneConflictEvent',
|
|
134
|
+
model: 'ConflictEvent',
|
|
135
|
+
error: String(error),
|
|
136
|
+
isRetryable: isConnectionError,
|
|
137
|
+
});
|
|
107
138
|
throw error;
|
|
108
139
|
}
|
|
109
140
|
}
|
|
@@ -118,7 +149,7 @@ exports.ConflictEvent = {
|
|
|
118
149
|
* @returns The count of created records or null.
|
|
119
150
|
*/
|
|
120
151
|
async createMany(props, globalClient) {
|
|
121
|
-
var _a, _b, _c, _d, _e;
|
|
152
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
122
153
|
// Maximum number of retries for database connection issues
|
|
123
154
|
const MAX_RETRIES = 3;
|
|
124
155
|
let retryCount = 0;
|
|
@@ -170,21 +201,52 @@ exports.ConflictEvent = {
|
|
|
170
201
|
}
|
|
171
202
|
catch (error) {
|
|
172
203
|
lastError = error;
|
|
204
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
205
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
206
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
207
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
208
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
209
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
210
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
211
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
212
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
213
|
+
if (isConstraintViolation) {
|
|
214
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
215
|
+
logger_1.logger.error("Non-retryable constraint violation in createManyConflictEvent", {
|
|
216
|
+
operation: 'createManyConflictEvent',
|
|
217
|
+
model: 'ConflictEvent',
|
|
218
|
+
error: String(error),
|
|
219
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
220
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
221
|
+
isRetryable: false,
|
|
222
|
+
});
|
|
223
|
+
throw error;
|
|
224
|
+
}
|
|
173
225
|
// Check if this is a database connection error that we should retry
|
|
174
|
-
const isConnectionError = ((
|
|
175
|
-
((
|
|
176
|
-
((
|
|
177
|
-
((
|
|
178
|
-
(error.networkError && ((
|
|
226
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
227
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
228
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
229
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
230
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
179
231
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
180
232
|
retryCount++;
|
|
181
233
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
182
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
234
|
+
logger_1.logger.warn("Database connection error in createManyConflictEvent, retrying...", {
|
|
235
|
+
operation: 'createManyConflictEvent',
|
|
236
|
+
model: 'ConflictEvent',
|
|
237
|
+
attempt: retryCount,
|
|
238
|
+
maxRetries: MAX_RETRIES,
|
|
239
|
+
});
|
|
183
240
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
184
241
|
continue;
|
|
185
242
|
}
|
|
186
|
-
// Log
|
|
187
|
-
logger_1.logger.error("Database
|
|
243
|
+
// Log structured error details and rethrow
|
|
244
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
245
|
+
operation: 'createManyConflictEvent',
|
|
246
|
+
model: 'ConflictEvent',
|
|
247
|
+
error: String(error),
|
|
248
|
+
isRetryable: isConnectionError,
|
|
249
|
+
});
|
|
188
250
|
throw error;
|
|
189
251
|
}
|
|
190
252
|
}
|
|
@@ -199,7 +261,7 @@ exports.ConflictEvent = {
|
|
|
199
261
|
* @returns The updated ConflictEvent or null.
|
|
200
262
|
*/
|
|
201
263
|
async update(props, globalClient) {
|
|
202
|
-
var _a, _b, _c, _d, _e;
|
|
264
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
203
265
|
// Maximum number of retries for database connection issues
|
|
204
266
|
const MAX_RETRIES = 3;
|
|
205
267
|
let retryCount = 0;
|
|
@@ -278,21 +340,55 @@ exports.ConflictEvent = {
|
|
|
278
340
|
}
|
|
279
341
|
catch (error) {
|
|
280
342
|
lastError = error;
|
|
343
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
344
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
345
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
346
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
347
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
348
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
349
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
350
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
351
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
352
|
+
if (isConstraintViolation) {
|
|
353
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
354
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneConflictEvent", {
|
|
355
|
+
operation: 'updateOneConflictEvent',
|
|
356
|
+
model: 'ConflictEvent',
|
|
357
|
+
error: String(error),
|
|
358
|
+
recordId: props.id,
|
|
359
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
360
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
361
|
+
isRetryable: false,
|
|
362
|
+
});
|
|
363
|
+
throw error;
|
|
364
|
+
}
|
|
281
365
|
// Check if this is a database connection error that we should retry
|
|
282
|
-
const isConnectionError = ((
|
|
283
|
-
((
|
|
284
|
-
((
|
|
285
|
-
((
|
|
286
|
-
(error.networkError && ((
|
|
366
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
367
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
368
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
369
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
370
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
287
371
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
288
372
|
retryCount++;
|
|
289
373
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
290
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
374
|
+
logger_1.logger.warn("Database connection error in updateOneConflictEvent, retrying...", {
|
|
375
|
+
operation: 'updateOneConflictEvent',
|
|
376
|
+
model: 'ConflictEvent',
|
|
377
|
+
attempt: retryCount,
|
|
378
|
+
maxRetries: MAX_RETRIES,
|
|
379
|
+
recordId: props.id,
|
|
380
|
+
});
|
|
291
381
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
292
382
|
continue;
|
|
293
383
|
}
|
|
294
|
-
// Log
|
|
295
|
-
logger_1.logger.error("Database
|
|
384
|
+
// Log structured error details and rethrow
|
|
385
|
+
logger_1.logger.error("Database update operation failed", {
|
|
386
|
+
operation: 'updateOneConflictEvent',
|
|
387
|
+
model: 'ConflictEvent',
|
|
388
|
+
error: String(error),
|
|
389
|
+
recordId: props.id,
|
|
390
|
+
isRetryable: isConnectionError,
|
|
391
|
+
});
|
|
296
392
|
throw error;
|
|
297
393
|
}
|
|
298
394
|
}
|
|
@@ -307,7 +403,7 @@ exports.ConflictEvent = {
|
|
|
307
403
|
* @returns The updated ConflictEvent or null.
|
|
308
404
|
*/
|
|
309
405
|
async upsert(props, globalClient) {
|
|
310
|
-
var _a, _b, _c, _d, _e;
|
|
406
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
311
407
|
// Maximum number of retries for database connection issues
|
|
312
408
|
const MAX_RETRIES = 3;
|
|
313
409
|
let retryCount = 0;
|
|
@@ -394,21 +490,55 @@ exports.ConflictEvent = {
|
|
|
394
490
|
}
|
|
395
491
|
catch (error) {
|
|
396
492
|
lastError = error;
|
|
493
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
494
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
495
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
496
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
497
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
498
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
499
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
500
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
501
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
502
|
+
if (isConstraintViolation) {
|
|
503
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
504
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneConflictEvent", {
|
|
505
|
+
operation: 'upsertOneConflictEvent',
|
|
506
|
+
model: 'ConflictEvent',
|
|
507
|
+
error: String(error),
|
|
508
|
+
recordId: props.id,
|
|
509
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
510
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
511
|
+
isRetryable: false,
|
|
512
|
+
});
|
|
513
|
+
throw error;
|
|
514
|
+
}
|
|
397
515
|
// Check if this is a database connection error that we should retry
|
|
398
|
-
const isConnectionError = ((
|
|
399
|
-
((
|
|
400
|
-
((
|
|
401
|
-
((
|
|
402
|
-
(error.networkError && ((
|
|
516
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
517
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
518
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
519
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
520
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
403
521
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
404
522
|
retryCount++;
|
|
405
523
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
406
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
524
|
+
logger_1.logger.warn("Database connection error in upsertOneConflictEvent, retrying...", {
|
|
525
|
+
operation: 'upsertOneConflictEvent',
|
|
526
|
+
model: 'ConflictEvent',
|
|
527
|
+
attempt: retryCount,
|
|
528
|
+
maxRetries: MAX_RETRIES,
|
|
529
|
+
recordId: props.id,
|
|
530
|
+
});
|
|
407
531
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
408
532
|
continue;
|
|
409
533
|
}
|
|
410
|
-
// Log
|
|
411
|
-
logger_1.logger.error("Database
|
|
534
|
+
// Log structured error details and rethrow
|
|
535
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
536
|
+
operation: 'upsertOneConflictEvent',
|
|
537
|
+
model: 'ConflictEvent',
|
|
538
|
+
error: String(error),
|
|
539
|
+
recordId: props.id,
|
|
540
|
+
isRetryable: isConnectionError,
|
|
541
|
+
});
|
|
412
542
|
throw error;
|
|
413
543
|
}
|
|
414
544
|
}
|
|
@@ -423,7 +553,7 @@ exports.ConflictEvent = {
|
|
|
423
553
|
* @returns The count of created records or null.
|
|
424
554
|
*/
|
|
425
555
|
async updateMany(props, globalClient) {
|
|
426
|
-
var _a, _b, _c, _d, _e;
|
|
556
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
427
557
|
// Maximum number of retries for database connection issues
|
|
428
558
|
const MAX_RETRIES = 3;
|
|
429
559
|
let retryCount = 0;
|
|
@@ -502,21 +632,52 @@ exports.ConflictEvent = {
|
|
|
502
632
|
}
|
|
503
633
|
catch (error) {
|
|
504
634
|
lastError = error;
|
|
635
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
636
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
637
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
638
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
639
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
640
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
641
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
642
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
643
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
644
|
+
if (isConstraintViolation) {
|
|
645
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
646
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManyConflictEvent", {
|
|
647
|
+
operation: 'updateManyConflictEvent',
|
|
648
|
+
model: 'ConflictEvent',
|
|
649
|
+
error: String(error),
|
|
650
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
651
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
652
|
+
isRetryable: false,
|
|
653
|
+
});
|
|
654
|
+
throw error;
|
|
655
|
+
}
|
|
505
656
|
// Check if this is a database connection error that we should retry
|
|
506
|
-
const isConnectionError = ((
|
|
507
|
-
((
|
|
508
|
-
((
|
|
509
|
-
((
|
|
510
|
-
(error.networkError && ((
|
|
657
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
658
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
659
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
660
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
661
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
511
662
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
512
663
|
retryCount++;
|
|
513
664
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
514
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
665
|
+
logger_1.logger.warn("Database connection error in updateManyConflictEvent, retrying...", {
|
|
666
|
+
operation: 'updateManyConflictEvent',
|
|
667
|
+
model: 'ConflictEvent',
|
|
668
|
+
attempt: retryCount,
|
|
669
|
+
maxRetries: MAX_RETRIES,
|
|
670
|
+
});
|
|
515
671
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
516
672
|
continue;
|
|
517
673
|
}
|
|
518
|
-
// Log
|
|
519
|
-
logger_1.logger.error("Database
|
|
674
|
+
// Log structured error details and rethrow
|
|
675
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
676
|
+
operation: 'updateManyConflictEvent',
|
|
677
|
+
model: 'ConflictEvent',
|
|
678
|
+
error: String(error),
|
|
679
|
+
isRetryable: isConnectionError,
|
|
680
|
+
});
|
|
520
681
|
throw error;
|
|
521
682
|
}
|
|
522
683
|
}
|
|
@@ -531,7 +692,7 @@ exports.ConflictEvent = {
|
|
|
531
692
|
* @returns The deleted ConflictEvent or null.
|
|
532
693
|
*/
|
|
533
694
|
async delete(props, globalClient) {
|
|
534
|
-
var _a, _b, _c, _d, _e;
|
|
695
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
535
696
|
// Maximum number of retries for database connection issues
|
|
536
697
|
const MAX_RETRIES = 3;
|
|
537
698
|
let retryCount = 0;
|
|
@@ -575,21 +736,58 @@ exports.ConflictEvent = {
|
|
|
575
736
|
}
|
|
576
737
|
catch (error) {
|
|
577
738
|
lastError = error;
|
|
739
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
740
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
741
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
742
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
743
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
744
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
745
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
746
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
747
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
748
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
749
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
750
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
751
|
+
if (isConstraintViolation) {
|
|
752
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
753
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneConflictEvent", {
|
|
754
|
+
operation: 'deleteOneConflictEvent',
|
|
755
|
+
model: 'ConflictEvent',
|
|
756
|
+
error: String(error),
|
|
757
|
+
recordId: props.id,
|
|
758
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
759
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
760
|
+
isRetryable: false,
|
|
761
|
+
});
|
|
762
|
+
throw error;
|
|
763
|
+
}
|
|
578
764
|
// Check if this is a database connection error that we should retry
|
|
579
|
-
const isConnectionError = ((
|
|
580
|
-
((
|
|
581
|
-
((
|
|
582
|
-
((
|
|
583
|
-
(error.networkError && ((
|
|
765
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
766
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
767
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
768
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
769
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
584
770
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
585
771
|
retryCount++;
|
|
586
772
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
587
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
773
|
+
logger_1.logger.warn("Database connection error in deleteOneConflictEvent, retrying...", {
|
|
774
|
+
operation: 'deleteOneConflictEvent',
|
|
775
|
+
model: 'ConflictEvent',
|
|
776
|
+
attempt: retryCount,
|
|
777
|
+
maxRetries: MAX_RETRIES,
|
|
778
|
+
recordId: props.id,
|
|
779
|
+
});
|
|
588
780
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
589
781
|
continue;
|
|
590
782
|
}
|
|
591
|
-
// Log
|
|
592
|
-
logger_1.logger.error("Database
|
|
783
|
+
// Log structured error details and rethrow
|
|
784
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
785
|
+
operation: 'deleteOneConflictEvent',
|
|
786
|
+
model: 'ConflictEvent',
|
|
787
|
+
error: String(error),
|
|
788
|
+
recordId: props.id,
|
|
789
|
+
isRetryable: isConnectionError,
|
|
790
|
+
});
|
|
593
791
|
throw error;
|
|
594
792
|
}
|
|
595
793
|
}
|
|
@@ -659,12 +857,22 @@ exports.ConflictEvent = {
|
|
|
659
857
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
660
858
|
retryCount++;
|
|
661
859
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
662
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
860
|
+
logger_1.logger.warn("Database connection error in getConflictEvent, retrying...", {
|
|
861
|
+
operation: 'getConflictEvent',
|
|
862
|
+
model: 'ConflictEvent',
|
|
863
|
+
attempt: retryCount,
|
|
864
|
+
maxRetries: MAX_RETRIES,
|
|
865
|
+
});
|
|
663
866
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
664
867
|
continue;
|
|
665
868
|
}
|
|
666
|
-
// Log
|
|
667
|
-
logger_1.logger.error("Database
|
|
869
|
+
// Log structured error details and rethrow
|
|
870
|
+
logger_1.logger.error("Database get operation failed", {
|
|
871
|
+
operation: 'getConflictEvent',
|
|
872
|
+
model: 'ConflictEvent',
|
|
873
|
+
error: String(error),
|
|
874
|
+
isRetryable: isConnectionError,
|
|
875
|
+
});
|
|
668
876
|
throw error;
|
|
669
877
|
}
|
|
670
878
|
}
|
|
@@ -722,12 +930,22 @@ exports.ConflictEvent = {
|
|
|
722
930
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
723
931
|
retryCount++;
|
|
724
932
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
725
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
933
|
+
logger_1.logger.warn("Database connection error in getAllConflictEvent, retrying...", {
|
|
934
|
+
operation: 'getAllConflictEvent',
|
|
935
|
+
model: 'ConflictEvent',
|
|
936
|
+
attempt: retryCount,
|
|
937
|
+
maxRetries: MAX_RETRIES,
|
|
938
|
+
});
|
|
726
939
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
727
940
|
continue;
|
|
728
941
|
}
|
|
729
|
-
// Log
|
|
730
|
-
logger_1.logger.error("Database
|
|
942
|
+
// Log structured error details and rethrow
|
|
943
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
944
|
+
operation: 'getAllConflictEvent',
|
|
945
|
+
model: 'ConflictEvent',
|
|
946
|
+
error: String(error),
|
|
947
|
+
isRetryable: isConnectionError,
|
|
948
|
+
});
|
|
731
949
|
throw error;
|
|
732
950
|
}
|
|
733
951
|
}
|
|
@@ -804,12 +1022,22 @@ exports.ConflictEvent = {
|
|
|
804
1022
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
805
1023
|
retryCount++;
|
|
806
1024
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
807
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1025
|
+
logger_1.logger.warn("Database connection error in findManyConflictEvent, retrying...", {
|
|
1026
|
+
operation: 'findManyConflictEvent',
|
|
1027
|
+
model: 'ConflictEvent',
|
|
1028
|
+
attempt: retryCount,
|
|
1029
|
+
maxRetries: MAX_RETRIES,
|
|
1030
|
+
});
|
|
808
1031
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
809
1032
|
continue;
|
|
810
1033
|
}
|
|
811
|
-
// Log
|
|
812
|
-
logger_1.logger.error("Database
|
|
1034
|
+
// Log structured error details and rethrow
|
|
1035
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
1036
|
+
operation: 'findManyConflictEvent',
|
|
1037
|
+
model: 'ConflictEvent',
|
|
1038
|
+
error: String(error),
|
|
1039
|
+
isRetryable: isConnectionError,
|
|
1040
|
+
});
|
|
813
1041
|
throw error;
|
|
814
1042
|
}
|
|
815
1043
|
}
|