@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/Event.cjs
CHANGED
|
@@ -51,7 +51,7 @@ exports.Event = {
|
|
|
51
51
|
* @returns The created Event or null.
|
|
52
52
|
*/
|
|
53
53
|
async create(props, globalClient) {
|
|
54
|
-
var _a, _b, _c, _d, _e;
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
55
55
|
// Maximum number of retries for database connection issues
|
|
56
56
|
const MAX_RETRIES = 3;
|
|
57
57
|
let retryCount = 0;
|
|
@@ -117,21 +117,52 @@ exports.Event = {
|
|
|
117
117
|
}
|
|
118
118
|
catch (error) {
|
|
119
119
|
lastError = error;
|
|
120
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
121
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
122
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
123
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
124
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
125
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
126
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
127
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
128
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
129
|
+
if (isConstraintViolation) {
|
|
130
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
131
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneEvent", {
|
|
132
|
+
operation: 'createOneEvent',
|
|
133
|
+
model: 'Event',
|
|
134
|
+
error: String(error),
|
|
135
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
136
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
137
|
+
isRetryable: false,
|
|
138
|
+
});
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
120
141
|
// Check if this is a database connection error that we should retry
|
|
121
|
-
const isConnectionError = ((
|
|
122
|
-
((
|
|
123
|
-
((
|
|
124
|
-
((
|
|
125
|
-
(error.networkError && ((
|
|
142
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
143
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
144
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
145
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
146
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
126
147
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
127
148
|
retryCount++;
|
|
128
149
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
129
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
150
|
+
logger_1.logger.warn("Database connection error in createOneEvent, retrying...", {
|
|
151
|
+
operation: 'createOneEvent',
|
|
152
|
+
model: 'Event',
|
|
153
|
+
attempt: retryCount,
|
|
154
|
+
maxRetries: MAX_RETRIES,
|
|
155
|
+
});
|
|
130
156
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
131
157
|
continue;
|
|
132
158
|
}
|
|
133
|
-
// Log
|
|
134
|
-
logger_1.logger.error("Database
|
|
159
|
+
// Log structured error details and rethrow
|
|
160
|
+
logger_1.logger.error("Database create operation failed", {
|
|
161
|
+
operation: 'createOneEvent',
|
|
162
|
+
model: 'Event',
|
|
163
|
+
error: String(error),
|
|
164
|
+
isRetryable: isConnectionError,
|
|
165
|
+
});
|
|
135
166
|
throw error;
|
|
136
167
|
}
|
|
137
168
|
}
|
|
@@ -146,7 +177,7 @@ exports.Event = {
|
|
|
146
177
|
* @returns The count of created records or null.
|
|
147
178
|
*/
|
|
148
179
|
async createMany(props, globalClient) {
|
|
149
|
-
var _a, _b, _c, _d, _e;
|
|
180
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
150
181
|
// Maximum number of retries for database connection issues
|
|
151
182
|
const MAX_RETRIES = 3;
|
|
152
183
|
let retryCount = 0;
|
|
@@ -211,21 +242,52 @@ exports.Event = {
|
|
|
211
242
|
}
|
|
212
243
|
catch (error) {
|
|
213
244
|
lastError = error;
|
|
245
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
246
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
247
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
248
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
249
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
250
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
251
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
252
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
253
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
254
|
+
if (isConstraintViolation) {
|
|
255
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
256
|
+
logger_1.logger.error("Non-retryable constraint violation in createManyEvent", {
|
|
257
|
+
operation: 'createManyEvent',
|
|
258
|
+
model: 'Event',
|
|
259
|
+
error: String(error),
|
|
260
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
261
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
262
|
+
isRetryable: false,
|
|
263
|
+
});
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
214
266
|
// Check if this is a database connection error that we should retry
|
|
215
|
-
const isConnectionError = ((
|
|
216
|
-
((
|
|
217
|
-
((
|
|
218
|
-
((
|
|
219
|
-
(error.networkError && ((
|
|
267
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
268
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
269
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
270
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
271
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
220
272
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
221
273
|
retryCount++;
|
|
222
274
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
223
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
275
|
+
logger_1.logger.warn("Database connection error in createManyEvent, retrying...", {
|
|
276
|
+
operation: 'createManyEvent',
|
|
277
|
+
model: 'Event',
|
|
278
|
+
attempt: retryCount,
|
|
279
|
+
maxRetries: MAX_RETRIES,
|
|
280
|
+
});
|
|
224
281
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
225
282
|
continue;
|
|
226
283
|
}
|
|
227
|
-
// Log
|
|
228
|
-
logger_1.logger.error("Database
|
|
284
|
+
// Log structured error details and rethrow
|
|
285
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
286
|
+
operation: 'createManyEvent',
|
|
287
|
+
model: 'Event',
|
|
288
|
+
error: String(error),
|
|
289
|
+
isRetryable: isConnectionError,
|
|
290
|
+
});
|
|
229
291
|
throw error;
|
|
230
292
|
}
|
|
231
293
|
}
|
|
@@ -240,7 +302,7 @@ exports.Event = {
|
|
|
240
302
|
* @returns The updated Event or null.
|
|
241
303
|
*/
|
|
242
304
|
async update(props, globalClient) {
|
|
243
|
-
var _a, _b, _c, _d, _e;
|
|
305
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
244
306
|
// Maximum number of retries for database connection issues
|
|
245
307
|
const MAX_RETRIES = 3;
|
|
246
308
|
let retryCount = 0;
|
|
@@ -386,21 +448,55 @@ exports.Event = {
|
|
|
386
448
|
}
|
|
387
449
|
catch (error) {
|
|
388
450
|
lastError = error;
|
|
451
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
452
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
453
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
454
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
455
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
456
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
457
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
458
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
459
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
460
|
+
if (isConstraintViolation) {
|
|
461
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
462
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneEvent", {
|
|
463
|
+
operation: 'updateOneEvent',
|
|
464
|
+
model: 'Event',
|
|
465
|
+
error: String(error),
|
|
466
|
+
recordId: props.id,
|
|
467
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
468
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
469
|
+
isRetryable: false,
|
|
470
|
+
});
|
|
471
|
+
throw error;
|
|
472
|
+
}
|
|
389
473
|
// Check if this is a database connection error that we should retry
|
|
390
|
-
const isConnectionError = ((
|
|
391
|
-
((
|
|
392
|
-
((
|
|
393
|
-
((
|
|
394
|
-
(error.networkError && ((
|
|
474
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
475
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
476
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
477
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
478
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
395
479
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
396
480
|
retryCount++;
|
|
397
481
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
398
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
482
|
+
logger_1.logger.warn("Database connection error in updateOneEvent, retrying...", {
|
|
483
|
+
operation: 'updateOneEvent',
|
|
484
|
+
model: 'Event',
|
|
485
|
+
attempt: retryCount,
|
|
486
|
+
maxRetries: MAX_RETRIES,
|
|
487
|
+
recordId: props.id,
|
|
488
|
+
});
|
|
399
489
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
400
490
|
continue;
|
|
401
491
|
}
|
|
402
|
-
// Log
|
|
403
|
-
logger_1.logger.error("Database
|
|
492
|
+
// Log structured error details and rethrow
|
|
493
|
+
logger_1.logger.error("Database update operation failed", {
|
|
494
|
+
operation: 'updateOneEvent',
|
|
495
|
+
model: 'Event',
|
|
496
|
+
error: String(error),
|
|
497
|
+
recordId: props.id,
|
|
498
|
+
isRetryable: isConnectionError,
|
|
499
|
+
});
|
|
404
500
|
throw error;
|
|
405
501
|
}
|
|
406
502
|
}
|
|
@@ -415,7 +511,7 @@ exports.Event = {
|
|
|
415
511
|
* @returns The updated Event or null.
|
|
416
512
|
*/
|
|
417
513
|
async upsert(props, globalClient) {
|
|
418
|
-
var _a, _b, _c, _d, _e;
|
|
514
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
419
515
|
// Maximum number of retries for database connection issues
|
|
420
516
|
const MAX_RETRIES = 3;
|
|
421
517
|
let retryCount = 0;
|
|
@@ -576,21 +672,55 @@ exports.Event = {
|
|
|
576
672
|
}
|
|
577
673
|
catch (error) {
|
|
578
674
|
lastError = error;
|
|
675
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
676
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
677
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
678
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
679
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
680
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
681
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
682
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
683
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
684
|
+
if (isConstraintViolation) {
|
|
685
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
686
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneEvent", {
|
|
687
|
+
operation: 'upsertOneEvent',
|
|
688
|
+
model: 'Event',
|
|
689
|
+
error: String(error),
|
|
690
|
+
recordId: props.id,
|
|
691
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
692
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
693
|
+
isRetryable: false,
|
|
694
|
+
});
|
|
695
|
+
throw error;
|
|
696
|
+
}
|
|
579
697
|
// Check if this is a database connection error that we should retry
|
|
580
|
-
const isConnectionError = ((
|
|
581
|
-
((
|
|
582
|
-
((
|
|
583
|
-
((
|
|
584
|
-
(error.networkError && ((
|
|
698
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
699
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
700
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
701
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
702
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
585
703
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
586
704
|
retryCount++;
|
|
587
705
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
588
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
706
|
+
logger_1.logger.warn("Database connection error in upsertOneEvent, retrying...", {
|
|
707
|
+
operation: 'upsertOneEvent',
|
|
708
|
+
model: 'Event',
|
|
709
|
+
attempt: retryCount,
|
|
710
|
+
maxRetries: MAX_RETRIES,
|
|
711
|
+
recordId: props.id,
|
|
712
|
+
});
|
|
589
713
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
590
714
|
continue;
|
|
591
715
|
}
|
|
592
|
-
// Log
|
|
593
|
-
logger_1.logger.error("Database
|
|
716
|
+
// Log structured error details and rethrow
|
|
717
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
718
|
+
operation: 'upsertOneEvent',
|
|
719
|
+
model: 'Event',
|
|
720
|
+
error: String(error),
|
|
721
|
+
recordId: props.id,
|
|
722
|
+
isRetryable: isConnectionError,
|
|
723
|
+
});
|
|
594
724
|
throw error;
|
|
595
725
|
}
|
|
596
726
|
}
|
|
@@ -605,7 +735,7 @@ exports.Event = {
|
|
|
605
735
|
* @returns The count of created records or null.
|
|
606
736
|
*/
|
|
607
737
|
async updateMany(props, globalClient) {
|
|
608
|
-
var _a, _b, _c, _d, _e;
|
|
738
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
609
739
|
// Maximum number of retries for database connection issues
|
|
610
740
|
const MAX_RETRIES = 3;
|
|
611
741
|
let retryCount = 0;
|
|
@@ -751,21 +881,52 @@ exports.Event = {
|
|
|
751
881
|
}
|
|
752
882
|
catch (error) {
|
|
753
883
|
lastError = error;
|
|
884
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
885
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
886
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
887
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
888
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
889
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
890
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
891
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
892
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
893
|
+
if (isConstraintViolation) {
|
|
894
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
895
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManyEvent", {
|
|
896
|
+
operation: 'updateManyEvent',
|
|
897
|
+
model: 'Event',
|
|
898
|
+
error: String(error),
|
|
899
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
900
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
901
|
+
isRetryable: false,
|
|
902
|
+
});
|
|
903
|
+
throw error;
|
|
904
|
+
}
|
|
754
905
|
// Check if this is a database connection error that we should retry
|
|
755
|
-
const isConnectionError = ((
|
|
756
|
-
((
|
|
757
|
-
((
|
|
758
|
-
((
|
|
759
|
-
(error.networkError && ((
|
|
906
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
907
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
908
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
909
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
910
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
760
911
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
761
912
|
retryCount++;
|
|
762
913
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
763
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
914
|
+
logger_1.logger.warn("Database connection error in updateManyEvent, retrying...", {
|
|
915
|
+
operation: 'updateManyEvent',
|
|
916
|
+
model: 'Event',
|
|
917
|
+
attempt: retryCount,
|
|
918
|
+
maxRetries: MAX_RETRIES,
|
|
919
|
+
});
|
|
764
920
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
765
921
|
continue;
|
|
766
922
|
}
|
|
767
|
-
// Log
|
|
768
|
-
logger_1.logger.error("Database
|
|
923
|
+
// Log structured error details and rethrow
|
|
924
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
925
|
+
operation: 'updateManyEvent',
|
|
926
|
+
model: 'Event',
|
|
927
|
+
error: String(error),
|
|
928
|
+
isRetryable: isConnectionError,
|
|
929
|
+
});
|
|
769
930
|
throw error;
|
|
770
931
|
}
|
|
771
932
|
}
|
|
@@ -780,7 +941,7 @@ exports.Event = {
|
|
|
780
941
|
* @returns The deleted Event or null.
|
|
781
942
|
*/
|
|
782
943
|
async delete(props, globalClient) {
|
|
783
|
-
var _a, _b, _c, _d, _e;
|
|
944
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
784
945
|
// Maximum number of retries for database connection issues
|
|
785
946
|
const MAX_RETRIES = 3;
|
|
786
947
|
let retryCount = 0;
|
|
@@ -824,21 +985,58 @@ exports.Event = {
|
|
|
824
985
|
}
|
|
825
986
|
catch (error) {
|
|
826
987
|
lastError = error;
|
|
988
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
989
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
990
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
991
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
992
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
993
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
994
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
995
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
996
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
997
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
998
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
999
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
1000
|
+
if (isConstraintViolation) {
|
|
1001
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
1002
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneEvent", {
|
|
1003
|
+
operation: 'deleteOneEvent',
|
|
1004
|
+
model: 'Event',
|
|
1005
|
+
error: String(error),
|
|
1006
|
+
recordId: props.id,
|
|
1007
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1008
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1009
|
+
isRetryable: false,
|
|
1010
|
+
});
|
|
1011
|
+
throw error;
|
|
1012
|
+
}
|
|
827
1013
|
// Check if this is a database connection error that we should retry
|
|
828
|
-
const isConnectionError = ((
|
|
829
|
-
((
|
|
830
|
-
((
|
|
831
|
-
((
|
|
832
|
-
(error.networkError && ((
|
|
1014
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
1015
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
1016
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
1017
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
1018
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
833
1019
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
834
1020
|
retryCount++;
|
|
835
1021
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
836
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1022
|
+
logger_1.logger.warn("Database connection error in deleteOneEvent, retrying...", {
|
|
1023
|
+
operation: 'deleteOneEvent',
|
|
1024
|
+
model: 'Event',
|
|
1025
|
+
attempt: retryCount,
|
|
1026
|
+
maxRetries: MAX_RETRIES,
|
|
1027
|
+
recordId: props.id,
|
|
1028
|
+
});
|
|
837
1029
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
838
1030
|
continue;
|
|
839
1031
|
}
|
|
840
|
-
// Log
|
|
841
|
-
logger_1.logger.error("Database
|
|
1032
|
+
// Log structured error details and rethrow
|
|
1033
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
1034
|
+
operation: 'deleteOneEvent',
|
|
1035
|
+
model: 'Event',
|
|
1036
|
+
error: String(error),
|
|
1037
|
+
recordId: props.id,
|
|
1038
|
+
isRetryable: isConnectionError,
|
|
1039
|
+
});
|
|
842
1040
|
throw error;
|
|
843
1041
|
}
|
|
844
1042
|
}
|
|
@@ -930,12 +1128,22 @@ exports.Event = {
|
|
|
930
1128
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
931
1129
|
retryCount++;
|
|
932
1130
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
933
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1131
|
+
logger_1.logger.warn("Database connection error in getEvent, retrying...", {
|
|
1132
|
+
operation: 'getEvent',
|
|
1133
|
+
model: 'Event',
|
|
1134
|
+
attempt: retryCount,
|
|
1135
|
+
maxRetries: MAX_RETRIES,
|
|
1136
|
+
});
|
|
934
1137
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
935
1138
|
continue;
|
|
936
1139
|
}
|
|
937
|
-
// Log
|
|
938
|
-
logger_1.logger.error("Database
|
|
1140
|
+
// Log structured error details and rethrow
|
|
1141
|
+
logger_1.logger.error("Database get operation failed", {
|
|
1142
|
+
operation: 'getEvent',
|
|
1143
|
+
model: 'Event',
|
|
1144
|
+
error: String(error),
|
|
1145
|
+
isRetryable: isConnectionError,
|
|
1146
|
+
});
|
|
939
1147
|
throw error;
|
|
940
1148
|
}
|
|
941
1149
|
}
|
|
@@ -993,12 +1201,22 @@ exports.Event = {
|
|
|
993
1201
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
994
1202
|
retryCount++;
|
|
995
1203
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
996
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1204
|
+
logger_1.logger.warn("Database connection error in getAllEvent, retrying...", {
|
|
1205
|
+
operation: 'getAllEvent',
|
|
1206
|
+
model: 'Event',
|
|
1207
|
+
attempt: retryCount,
|
|
1208
|
+
maxRetries: MAX_RETRIES,
|
|
1209
|
+
});
|
|
997
1210
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
998
1211
|
continue;
|
|
999
1212
|
}
|
|
1000
|
-
// Log
|
|
1001
|
-
logger_1.logger.error("Database
|
|
1213
|
+
// Log structured error details and rethrow
|
|
1214
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
1215
|
+
operation: 'getAllEvent',
|
|
1216
|
+
model: 'Event',
|
|
1217
|
+
error: String(error),
|
|
1218
|
+
isRetryable: isConnectionError,
|
|
1219
|
+
});
|
|
1002
1220
|
throw error;
|
|
1003
1221
|
}
|
|
1004
1222
|
}
|
|
@@ -1099,12 +1317,22 @@ exports.Event = {
|
|
|
1099
1317
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1100
1318
|
retryCount++;
|
|
1101
1319
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1102
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1320
|
+
logger_1.logger.warn("Database connection error in findManyEvent, retrying...", {
|
|
1321
|
+
operation: 'findManyEvent',
|
|
1322
|
+
model: 'Event',
|
|
1323
|
+
attempt: retryCount,
|
|
1324
|
+
maxRetries: MAX_RETRIES,
|
|
1325
|
+
});
|
|
1103
1326
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1104
1327
|
continue;
|
|
1105
1328
|
}
|
|
1106
|
-
// Log
|
|
1107
|
-
logger_1.logger.error("Database
|
|
1329
|
+
// Log structured error details and rethrow
|
|
1330
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
1331
|
+
operation: 'findManyEvent',
|
|
1332
|
+
model: 'Event',
|
|
1333
|
+
error: String(error),
|
|
1334
|
+
isRetryable: isConnectionError,
|
|
1335
|
+
});
|
|
1108
1336
|
throw error;
|
|
1109
1337
|
}
|
|
1110
1338
|
}
|