@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
|
@@ -80,6 +80,27 @@ export const ConnectionHealthSnapshot = {
|
|
|
80
80
|
}
|
|
81
81
|
catch (error) {
|
|
82
82
|
lastError = error;
|
|
83
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
84
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
85
|
+
error.message?.includes('violates unique constraint') ||
|
|
86
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
87
|
+
error.message?.includes('unique constraint') ||
|
|
88
|
+
error.message?.includes('23514') ||
|
|
89
|
+
error.message?.includes('23505') ||
|
|
90
|
+
error.message?.includes('P2002') ||
|
|
91
|
+
error.message?.includes('P2003');
|
|
92
|
+
if (isConstraintViolation) {
|
|
93
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
94
|
+
logger.error("Non-retryable constraint violation in createOneConnectionHealthSnapshot", {
|
|
95
|
+
operation: 'createOneConnectionHealthSnapshot',
|
|
96
|
+
model: 'ConnectionHealthSnapshot',
|
|
97
|
+
error: String(error),
|
|
98
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
99
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
100
|
+
isRetryable: false,
|
|
101
|
+
});
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
83
104
|
// Check if this is a database connection error that we should retry
|
|
84
105
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
85
106
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -89,12 +110,22 @@ export const ConnectionHealthSnapshot = {
|
|
|
89
110
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
90
111
|
retryCount++;
|
|
91
112
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
92
|
-
logger.warn("Database connection error, retrying..."
|
|
113
|
+
logger.warn("Database connection error in createOneConnectionHealthSnapshot, retrying...", {
|
|
114
|
+
operation: 'createOneConnectionHealthSnapshot',
|
|
115
|
+
model: 'ConnectionHealthSnapshot',
|
|
116
|
+
attempt: retryCount,
|
|
117
|
+
maxRetries: MAX_RETRIES,
|
|
118
|
+
});
|
|
93
119
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
94
120
|
continue;
|
|
95
121
|
}
|
|
96
|
-
// Log
|
|
97
|
-
logger.error("Database
|
|
122
|
+
// Log structured error details and rethrow
|
|
123
|
+
logger.error("Database create operation failed", {
|
|
124
|
+
operation: 'createOneConnectionHealthSnapshot',
|
|
125
|
+
model: 'ConnectionHealthSnapshot',
|
|
126
|
+
error: String(error),
|
|
127
|
+
isRetryable: isConnectionError,
|
|
128
|
+
});
|
|
98
129
|
throw error;
|
|
99
130
|
}
|
|
100
131
|
}
|
|
@@ -157,6 +188,27 @@ export const ConnectionHealthSnapshot = {
|
|
|
157
188
|
}
|
|
158
189
|
catch (error) {
|
|
159
190
|
lastError = error;
|
|
191
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
192
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
193
|
+
error.message?.includes('violates unique constraint') ||
|
|
194
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
195
|
+
error.message?.includes('unique constraint') ||
|
|
196
|
+
error.message?.includes('23514') ||
|
|
197
|
+
error.message?.includes('23505') ||
|
|
198
|
+
error.message?.includes('P2002') ||
|
|
199
|
+
error.message?.includes('P2003');
|
|
200
|
+
if (isConstraintViolation) {
|
|
201
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
202
|
+
logger.error("Non-retryable constraint violation in createManyConnectionHealthSnapshot", {
|
|
203
|
+
operation: 'createManyConnectionHealthSnapshot',
|
|
204
|
+
model: 'ConnectionHealthSnapshot',
|
|
205
|
+
error: String(error),
|
|
206
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
207
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
208
|
+
isRetryable: false,
|
|
209
|
+
});
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
160
212
|
// Check if this is a database connection error that we should retry
|
|
161
213
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
162
214
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -166,12 +218,22 @@ export const ConnectionHealthSnapshot = {
|
|
|
166
218
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
167
219
|
retryCount++;
|
|
168
220
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
169
|
-
logger.warn("Database connection error, retrying..."
|
|
221
|
+
logger.warn("Database connection error in createManyConnectionHealthSnapshot, retrying...", {
|
|
222
|
+
operation: 'createManyConnectionHealthSnapshot',
|
|
223
|
+
model: 'ConnectionHealthSnapshot',
|
|
224
|
+
attempt: retryCount,
|
|
225
|
+
maxRetries: MAX_RETRIES,
|
|
226
|
+
});
|
|
170
227
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
171
228
|
continue;
|
|
172
229
|
}
|
|
173
|
-
// Log
|
|
174
|
-
logger.error("Database
|
|
230
|
+
// Log structured error details and rethrow
|
|
231
|
+
logger.error("Database createMany operation failed", {
|
|
232
|
+
operation: 'createManyConnectionHealthSnapshot',
|
|
233
|
+
model: 'ConnectionHealthSnapshot',
|
|
234
|
+
error: String(error),
|
|
235
|
+
isRetryable: isConnectionError,
|
|
236
|
+
});
|
|
175
237
|
throw error;
|
|
176
238
|
}
|
|
177
239
|
}
|
|
@@ -255,6 +317,28 @@ export const ConnectionHealthSnapshot = {
|
|
|
255
317
|
}
|
|
256
318
|
catch (error) {
|
|
257
319
|
lastError = error;
|
|
320
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
321
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
322
|
+
error.message?.includes('violates unique constraint') ||
|
|
323
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
324
|
+
error.message?.includes('unique constraint') ||
|
|
325
|
+
error.message?.includes('23514') ||
|
|
326
|
+
error.message?.includes('23505') ||
|
|
327
|
+
error.message?.includes('P2002') ||
|
|
328
|
+
error.message?.includes('P2003');
|
|
329
|
+
if (isConstraintViolation) {
|
|
330
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
331
|
+
logger.error("Non-retryable constraint violation in updateOneConnectionHealthSnapshot", {
|
|
332
|
+
operation: 'updateOneConnectionHealthSnapshot',
|
|
333
|
+
model: 'ConnectionHealthSnapshot',
|
|
334
|
+
error: String(error),
|
|
335
|
+
recordId: props.id,
|
|
336
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
337
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
338
|
+
isRetryable: false,
|
|
339
|
+
});
|
|
340
|
+
throw error;
|
|
341
|
+
}
|
|
258
342
|
// Check if this is a database connection error that we should retry
|
|
259
343
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
260
344
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -264,12 +348,24 @@ export const ConnectionHealthSnapshot = {
|
|
|
264
348
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
265
349
|
retryCount++;
|
|
266
350
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
267
|
-
logger.warn("Database connection error, retrying..."
|
|
351
|
+
logger.warn("Database connection error in updateOneConnectionHealthSnapshot, retrying...", {
|
|
352
|
+
operation: 'updateOneConnectionHealthSnapshot',
|
|
353
|
+
model: 'ConnectionHealthSnapshot',
|
|
354
|
+
attempt: retryCount,
|
|
355
|
+
maxRetries: MAX_RETRIES,
|
|
356
|
+
recordId: props.id,
|
|
357
|
+
});
|
|
268
358
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
269
359
|
continue;
|
|
270
360
|
}
|
|
271
|
-
// Log
|
|
272
|
-
logger.error("Database
|
|
361
|
+
// Log structured error details and rethrow
|
|
362
|
+
logger.error("Database update operation failed", {
|
|
363
|
+
operation: 'updateOneConnectionHealthSnapshot',
|
|
364
|
+
model: 'ConnectionHealthSnapshot',
|
|
365
|
+
error: String(error),
|
|
366
|
+
recordId: props.id,
|
|
367
|
+
isRetryable: isConnectionError,
|
|
368
|
+
});
|
|
273
369
|
throw error;
|
|
274
370
|
}
|
|
275
371
|
}
|
|
@@ -355,6 +451,28 @@ export const ConnectionHealthSnapshot = {
|
|
|
355
451
|
}
|
|
356
452
|
catch (error) {
|
|
357
453
|
lastError = error;
|
|
454
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
455
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
456
|
+
error.message?.includes('violates unique constraint') ||
|
|
457
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
458
|
+
error.message?.includes('unique constraint') ||
|
|
459
|
+
error.message?.includes('23514') ||
|
|
460
|
+
error.message?.includes('23505') ||
|
|
461
|
+
error.message?.includes('P2002') ||
|
|
462
|
+
error.message?.includes('P2003');
|
|
463
|
+
if (isConstraintViolation) {
|
|
464
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
465
|
+
logger.error("Non-retryable constraint violation in upsertOneConnectionHealthSnapshot", {
|
|
466
|
+
operation: 'upsertOneConnectionHealthSnapshot',
|
|
467
|
+
model: 'ConnectionHealthSnapshot',
|
|
468
|
+
error: String(error),
|
|
469
|
+
recordId: props.id,
|
|
470
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
471
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
472
|
+
isRetryable: false,
|
|
473
|
+
});
|
|
474
|
+
throw error;
|
|
475
|
+
}
|
|
358
476
|
// Check if this is a database connection error that we should retry
|
|
359
477
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
360
478
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -364,12 +482,24 @@ export const ConnectionHealthSnapshot = {
|
|
|
364
482
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
365
483
|
retryCount++;
|
|
366
484
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
367
|
-
logger.warn("Database connection error, retrying..."
|
|
485
|
+
logger.warn("Database connection error in upsertOneConnectionHealthSnapshot, retrying...", {
|
|
486
|
+
operation: 'upsertOneConnectionHealthSnapshot',
|
|
487
|
+
model: 'ConnectionHealthSnapshot',
|
|
488
|
+
attempt: retryCount,
|
|
489
|
+
maxRetries: MAX_RETRIES,
|
|
490
|
+
recordId: props.id,
|
|
491
|
+
});
|
|
368
492
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
369
493
|
continue;
|
|
370
494
|
}
|
|
371
|
-
// Log
|
|
372
|
-
logger.error("Database
|
|
495
|
+
// Log structured error details and rethrow
|
|
496
|
+
logger.error("Database upsert operation failed", {
|
|
497
|
+
operation: 'upsertOneConnectionHealthSnapshot',
|
|
498
|
+
model: 'ConnectionHealthSnapshot',
|
|
499
|
+
error: String(error),
|
|
500
|
+
recordId: props.id,
|
|
501
|
+
isRetryable: isConnectionError,
|
|
502
|
+
});
|
|
373
503
|
throw error;
|
|
374
504
|
}
|
|
375
505
|
}
|
|
@@ -453,6 +583,27 @@ export const ConnectionHealthSnapshot = {
|
|
|
453
583
|
}
|
|
454
584
|
catch (error) {
|
|
455
585
|
lastError = error;
|
|
586
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
587
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
588
|
+
error.message?.includes('violates unique constraint') ||
|
|
589
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
590
|
+
error.message?.includes('unique constraint') ||
|
|
591
|
+
error.message?.includes('23514') ||
|
|
592
|
+
error.message?.includes('23505') ||
|
|
593
|
+
error.message?.includes('P2002') ||
|
|
594
|
+
error.message?.includes('P2003');
|
|
595
|
+
if (isConstraintViolation) {
|
|
596
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
597
|
+
logger.error("Non-retryable constraint violation in updateManyConnectionHealthSnapshot", {
|
|
598
|
+
operation: 'updateManyConnectionHealthSnapshot',
|
|
599
|
+
model: 'ConnectionHealthSnapshot',
|
|
600
|
+
error: String(error),
|
|
601
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
602
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
603
|
+
isRetryable: false,
|
|
604
|
+
});
|
|
605
|
+
throw error;
|
|
606
|
+
}
|
|
456
607
|
// Check if this is a database connection error that we should retry
|
|
457
608
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
458
609
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -462,12 +613,22 @@ export const ConnectionHealthSnapshot = {
|
|
|
462
613
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
463
614
|
retryCount++;
|
|
464
615
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
465
|
-
logger.warn("Database connection error, retrying..."
|
|
616
|
+
logger.warn("Database connection error in updateManyConnectionHealthSnapshot, retrying...", {
|
|
617
|
+
operation: 'updateManyConnectionHealthSnapshot',
|
|
618
|
+
model: 'ConnectionHealthSnapshot',
|
|
619
|
+
attempt: retryCount,
|
|
620
|
+
maxRetries: MAX_RETRIES,
|
|
621
|
+
});
|
|
466
622
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
467
623
|
continue;
|
|
468
624
|
}
|
|
469
|
-
// Log
|
|
470
|
-
logger.error("Database
|
|
625
|
+
// Log structured error details and rethrow
|
|
626
|
+
logger.error("Database updateMany operation failed", {
|
|
627
|
+
operation: 'updateManyConnectionHealthSnapshot',
|
|
628
|
+
model: 'ConnectionHealthSnapshot',
|
|
629
|
+
error: String(error),
|
|
630
|
+
isRetryable: isConnectionError,
|
|
631
|
+
});
|
|
471
632
|
throw error;
|
|
472
633
|
}
|
|
473
634
|
}
|
|
@@ -525,6 +686,31 @@ export const ConnectionHealthSnapshot = {
|
|
|
525
686
|
}
|
|
526
687
|
catch (error) {
|
|
527
688
|
lastError = error;
|
|
689
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
690
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
691
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
692
|
+
error.message?.includes('violates unique constraint') ||
|
|
693
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
694
|
+
error.message?.includes('unique constraint') ||
|
|
695
|
+
error.message?.includes('23514') ||
|
|
696
|
+
error.message?.includes('23505') ||
|
|
697
|
+
error.message?.includes('23503') ||
|
|
698
|
+
error.message?.includes('P2002') ||
|
|
699
|
+
error.message?.includes('P2003') ||
|
|
700
|
+
error.message?.includes('P2014');
|
|
701
|
+
if (isConstraintViolation) {
|
|
702
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
703
|
+
logger.error("Non-retryable constraint violation in deleteOneConnectionHealthSnapshot", {
|
|
704
|
+
operation: 'deleteOneConnectionHealthSnapshot',
|
|
705
|
+
model: 'ConnectionHealthSnapshot',
|
|
706
|
+
error: String(error),
|
|
707
|
+
recordId: props.id,
|
|
708
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
709
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
710
|
+
isRetryable: false,
|
|
711
|
+
});
|
|
712
|
+
throw error;
|
|
713
|
+
}
|
|
528
714
|
// Check if this is a database connection error that we should retry
|
|
529
715
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
530
716
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -534,12 +720,24 @@ export const ConnectionHealthSnapshot = {
|
|
|
534
720
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
535
721
|
retryCount++;
|
|
536
722
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
537
|
-
logger.warn("Database connection error, retrying..."
|
|
723
|
+
logger.warn("Database connection error in deleteOneConnectionHealthSnapshot, retrying...", {
|
|
724
|
+
operation: 'deleteOneConnectionHealthSnapshot',
|
|
725
|
+
model: 'ConnectionHealthSnapshot',
|
|
726
|
+
attempt: retryCount,
|
|
727
|
+
maxRetries: MAX_RETRIES,
|
|
728
|
+
recordId: props.id,
|
|
729
|
+
});
|
|
538
730
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
539
731
|
continue;
|
|
540
732
|
}
|
|
541
|
-
// Log
|
|
542
|
-
logger.error("Database
|
|
733
|
+
// Log structured error details and rethrow
|
|
734
|
+
logger.error("Database delete operation failed", {
|
|
735
|
+
operation: 'deleteOneConnectionHealthSnapshot',
|
|
736
|
+
model: 'ConnectionHealthSnapshot',
|
|
737
|
+
error: String(error),
|
|
738
|
+
recordId: props.id,
|
|
739
|
+
isRetryable: isConnectionError,
|
|
740
|
+
});
|
|
543
741
|
throw error;
|
|
544
742
|
}
|
|
545
743
|
}
|
|
@@ -605,12 +803,22 @@ export const ConnectionHealthSnapshot = {
|
|
|
605
803
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
606
804
|
retryCount++;
|
|
607
805
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
608
|
-
logger.warn("Database connection error, retrying..."
|
|
806
|
+
logger.warn("Database connection error in getConnectionHealthSnapshot, retrying...", {
|
|
807
|
+
operation: 'getConnectionHealthSnapshot',
|
|
808
|
+
model: 'ConnectionHealthSnapshot',
|
|
809
|
+
attempt: retryCount,
|
|
810
|
+
maxRetries: MAX_RETRIES,
|
|
811
|
+
});
|
|
609
812
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
610
813
|
continue;
|
|
611
814
|
}
|
|
612
|
-
// Log
|
|
613
|
-
logger.error("Database
|
|
815
|
+
// Log structured error details and rethrow
|
|
816
|
+
logger.error("Database get operation failed", {
|
|
817
|
+
operation: 'getConnectionHealthSnapshot',
|
|
818
|
+
model: 'ConnectionHealthSnapshot',
|
|
819
|
+
error: String(error),
|
|
820
|
+
isRetryable: isConnectionError,
|
|
821
|
+
});
|
|
614
822
|
throw error;
|
|
615
823
|
}
|
|
616
824
|
}
|
|
@@ -667,12 +875,22 @@ export const ConnectionHealthSnapshot = {
|
|
|
667
875
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
668
876
|
retryCount++;
|
|
669
877
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
670
|
-
logger.warn("Database connection error, retrying..."
|
|
878
|
+
logger.warn("Database connection error in getAllConnectionHealthSnapshot, retrying...", {
|
|
879
|
+
operation: 'getAllConnectionHealthSnapshot',
|
|
880
|
+
model: 'ConnectionHealthSnapshot',
|
|
881
|
+
attempt: retryCount,
|
|
882
|
+
maxRetries: MAX_RETRIES,
|
|
883
|
+
});
|
|
671
884
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
672
885
|
continue;
|
|
673
886
|
}
|
|
674
|
-
// Log
|
|
675
|
-
logger.error("Database
|
|
887
|
+
// Log structured error details and rethrow
|
|
888
|
+
logger.error("Database getAll operation failed", {
|
|
889
|
+
operation: 'getAllConnectionHealthSnapshot',
|
|
890
|
+
model: 'ConnectionHealthSnapshot',
|
|
891
|
+
error: String(error),
|
|
892
|
+
isRetryable: isConnectionError,
|
|
893
|
+
});
|
|
676
894
|
throw error;
|
|
677
895
|
}
|
|
678
896
|
}
|
|
@@ -745,12 +963,22 @@ export const ConnectionHealthSnapshot = {
|
|
|
745
963
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
746
964
|
retryCount++;
|
|
747
965
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
748
|
-
logger.warn("Database connection error, retrying..."
|
|
966
|
+
logger.warn("Database connection error in findManyConnectionHealthSnapshot, retrying...", {
|
|
967
|
+
operation: 'findManyConnectionHealthSnapshot',
|
|
968
|
+
model: 'ConnectionHealthSnapshot',
|
|
969
|
+
attempt: retryCount,
|
|
970
|
+
maxRetries: MAX_RETRIES,
|
|
971
|
+
});
|
|
749
972
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
750
973
|
continue;
|
|
751
974
|
}
|
|
752
|
-
// Log
|
|
753
|
-
logger.error("Database
|
|
975
|
+
// Log structured error details and rethrow
|
|
976
|
+
logger.error("Database findMany operation failed", {
|
|
977
|
+
operation: 'findManyConnectionHealthSnapshot',
|
|
978
|
+
model: 'ConnectionHealthSnapshot',
|
|
979
|
+
error: String(error),
|
|
980
|
+
isRetryable: isConnectionError,
|
|
981
|
+
});
|
|
754
982
|
throw error;
|
|
755
983
|
}
|
|
756
984
|
}
|
package/esm/Customer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Customer.d.ts","sourceRoot":"","sources":["../../src/Customer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAmM7G,eAAO,MAAM,QAAQ;IAEnB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,YAAY,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Customer.d.ts","sourceRoot":"","sources":["../../src/Customer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAmM7G,eAAO,MAAM,QAAQ;IAEnB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,YAAY,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IAualH;;;;;;OAMG;sBACqB,YAAY,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAmHlI;;;;;;OAMG;kBACiB,YAAY,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IA6pChH;;;;;;OAMG;kBACiB,YAAY,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IAk9ChH;;;;;;OAMG;sBACqB,YAAY,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA4pClI;;;;;;OAMG;kBACiB,YAAY,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IAmHhH;;;;;;;OAOG;eACc,YAAY,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA+FtI;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC;IA4EpG;;;;;;;OAOG;oBACmB,YAAY,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC;CAyG9I,CAAC"}
|