@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
|
@@ -77,6 +77,27 @@ export const AnalyticsSnapshot = {
|
|
|
77
77
|
}
|
|
78
78
|
catch (error) {
|
|
79
79
|
lastError = error;
|
|
80
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
81
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
82
|
+
error.message?.includes('violates unique constraint') ||
|
|
83
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
84
|
+
error.message?.includes('unique constraint') ||
|
|
85
|
+
error.message?.includes('23514') ||
|
|
86
|
+
error.message?.includes('23505') ||
|
|
87
|
+
error.message?.includes('P2002') ||
|
|
88
|
+
error.message?.includes('P2003');
|
|
89
|
+
if (isConstraintViolation) {
|
|
90
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
91
|
+
logger.error("Non-retryable constraint violation in createOneAnalyticsSnapshot", {
|
|
92
|
+
operation: 'createOneAnalyticsSnapshot',
|
|
93
|
+
model: 'AnalyticsSnapshot',
|
|
94
|
+
error: String(error),
|
|
95
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
96
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
97
|
+
isRetryable: false,
|
|
98
|
+
});
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
80
101
|
// Check if this is a database connection error that we should retry
|
|
81
102
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
82
103
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -86,12 +107,22 @@ export const AnalyticsSnapshot = {
|
|
|
86
107
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
87
108
|
retryCount++;
|
|
88
109
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
89
|
-
logger.warn("Database connection error, retrying..."
|
|
110
|
+
logger.warn("Database connection error in createOneAnalyticsSnapshot, retrying...", {
|
|
111
|
+
operation: 'createOneAnalyticsSnapshot',
|
|
112
|
+
model: 'AnalyticsSnapshot',
|
|
113
|
+
attempt: retryCount,
|
|
114
|
+
maxRetries: MAX_RETRIES,
|
|
115
|
+
});
|
|
90
116
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
91
117
|
continue;
|
|
92
118
|
}
|
|
93
|
-
// Log
|
|
94
|
-
logger.error("Database
|
|
119
|
+
// Log structured error details and rethrow
|
|
120
|
+
logger.error("Database create operation failed", {
|
|
121
|
+
operation: 'createOneAnalyticsSnapshot',
|
|
122
|
+
model: 'AnalyticsSnapshot',
|
|
123
|
+
error: String(error),
|
|
124
|
+
isRetryable: isConnectionError,
|
|
125
|
+
});
|
|
95
126
|
throw error;
|
|
96
127
|
}
|
|
97
128
|
}
|
|
@@ -152,6 +183,27 @@ export const AnalyticsSnapshot = {
|
|
|
152
183
|
}
|
|
153
184
|
catch (error) {
|
|
154
185
|
lastError = error;
|
|
186
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
187
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
188
|
+
error.message?.includes('violates unique constraint') ||
|
|
189
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
190
|
+
error.message?.includes('unique constraint') ||
|
|
191
|
+
error.message?.includes('23514') ||
|
|
192
|
+
error.message?.includes('23505') ||
|
|
193
|
+
error.message?.includes('P2002') ||
|
|
194
|
+
error.message?.includes('P2003');
|
|
195
|
+
if (isConstraintViolation) {
|
|
196
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
197
|
+
logger.error("Non-retryable constraint violation in createManyAnalyticsSnapshot", {
|
|
198
|
+
operation: 'createManyAnalyticsSnapshot',
|
|
199
|
+
model: 'AnalyticsSnapshot',
|
|
200
|
+
error: String(error),
|
|
201
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
202
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
203
|
+
isRetryable: false,
|
|
204
|
+
});
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
155
207
|
// Check if this is a database connection error that we should retry
|
|
156
208
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
157
209
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -161,12 +213,22 @@ export const AnalyticsSnapshot = {
|
|
|
161
213
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
162
214
|
retryCount++;
|
|
163
215
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
164
|
-
logger.warn("Database connection error, retrying..."
|
|
216
|
+
logger.warn("Database connection error in createManyAnalyticsSnapshot, retrying...", {
|
|
217
|
+
operation: 'createManyAnalyticsSnapshot',
|
|
218
|
+
model: 'AnalyticsSnapshot',
|
|
219
|
+
attempt: retryCount,
|
|
220
|
+
maxRetries: MAX_RETRIES,
|
|
221
|
+
});
|
|
165
222
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
166
223
|
continue;
|
|
167
224
|
}
|
|
168
|
-
// Log
|
|
169
|
-
logger.error("Database
|
|
225
|
+
// Log structured error details and rethrow
|
|
226
|
+
logger.error("Database createMany operation failed", {
|
|
227
|
+
operation: 'createManyAnalyticsSnapshot',
|
|
228
|
+
model: 'AnalyticsSnapshot',
|
|
229
|
+
error: String(error),
|
|
230
|
+
isRetryable: isConnectionError,
|
|
231
|
+
});
|
|
170
232
|
throw error;
|
|
171
233
|
}
|
|
172
234
|
}
|
|
@@ -250,6 +312,28 @@ export const AnalyticsSnapshot = {
|
|
|
250
312
|
}
|
|
251
313
|
catch (error) {
|
|
252
314
|
lastError = error;
|
|
315
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
316
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
317
|
+
error.message?.includes('violates unique constraint') ||
|
|
318
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
319
|
+
error.message?.includes('unique constraint') ||
|
|
320
|
+
error.message?.includes('23514') ||
|
|
321
|
+
error.message?.includes('23505') ||
|
|
322
|
+
error.message?.includes('P2002') ||
|
|
323
|
+
error.message?.includes('P2003');
|
|
324
|
+
if (isConstraintViolation) {
|
|
325
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
326
|
+
logger.error("Non-retryable constraint violation in updateOneAnalyticsSnapshot", {
|
|
327
|
+
operation: 'updateOneAnalyticsSnapshot',
|
|
328
|
+
model: 'AnalyticsSnapshot',
|
|
329
|
+
error: String(error),
|
|
330
|
+
recordId: props.id,
|
|
331
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
332
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
333
|
+
isRetryable: false,
|
|
334
|
+
});
|
|
335
|
+
throw error;
|
|
336
|
+
}
|
|
253
337
|
// Check if this is a database connection error that we should retry
|
|
254
338
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
255
339
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -259,12 +343,24 @@ export const AnalyticsSnapshot = {
|
|
|
259
343
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
260
344
|
retryCount++;
|
|
261
345
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
262
|
-
logger.warn("Database connection error, retrying..."
|
|
346
|
+
logger.warn("Database connection error in updateOneAnalyticsSnapshot, retrying...", {
|
|
347
|
+
operation: 'updateOneAnalyticsSnapshot',
|
|
348
|
+
model: 'AnalyticsSnapshot',
|
|
349
|
+
attempt: retryCount,
|
|
350
|
+
maxRetries: MAX_RETRIES,
|
|
351
|
+
recordId: props.id,
|
|
352
|
+
});
|
|
263
353
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
264
354
|
continue;
|
|
265
355
|
}
|
|
266
|
-
// Log
|
|
267
|
-
logger.error("Database
|
|
356
|
+
// Log structured error details and rethrow
|
|
357
|
+
logger.error("Database update operation failed", {
|
|
358
|
+
operation: 'updateOneAnalyticsSnapshot',
|
|
359
|
+
model: 'AnalyticsSnapshot',
|
|
360
|
+
error: String(error),
|
|
361
|
+
recordId: props.id,
|
|
362
|
+
isRetryable: isConnectionError,
|
|
363
|
+
});
|
|
268
364
|
throw error;
|
|
269
365
|
}
|
|
270
366
|
}
|
|
@@ -345,6 +441,28 @@ export const AnalyticsSnapshot = {
|
|
|
345
441
|
}
|
|
346
442
|
catch (error) {
|
|
347
443
|
lastError = error;
|
|
444
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
445
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
446
|
+
error.message?.includes('violates unique constraint') ||
|
|
447
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
448
|
+
error.message?.includes('unique constraint') ||
|
|
449
|
+
error.message?.includes('23514') ||
|
|
450
|
+
error.message?.includes('23505') ||
|
|
451
|
+
error.message?.includes('P2002') ||
|
|
452
|
+
error.message?.includes('P2003');
|
|
453
|
+
if (isConstraintViolation) {
|
|
454
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
455
|
+
logger.error("Non-retryable constraint violation in upsertOneAnalyticsSnapshot", {
|
|
456
|
+
operation: 'upsertOneAnalyticsSnapshot',
|
|
457
|
+
model: 'AnalyticsSnapshot',
|
|
458
|
+
error: String(error),
|
|
459
|
+
recordId: props.id,
|
|
460
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
461
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
462
|
+
isRetryable: false,
|
|
463
|
+
});
|
|
464
|
+
throw error;
|
|
465
|
+
}
|
|
348
466
|
// Check if this is a database connection error that we should retry
|
|
349
467
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
350
468
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -354,12 +472,24 @@ export const AnalyticsSnapshot = {
|
|
|
354
472
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
355
473
|
retryCount++;
|
|
356
474
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
357
|
-
logger.warn("Database connection error, retrying..."
|
|
475
|
+
logger.warn("Database connection error in upsertOneAnalyticsSnapshot, retrying...", {
|
|
476
|
+
operation: 'upsertOneAnalyticsSnapshot',
|
|
477
|
+
model: 'AnalyticsSnapshot',
|
|
478
|
+
attempt: retryCount,
|
|
479
|
+
maxRetries: MAX_RETRIES,
|
|
480
|
+
recordId: props.id,
|
|
481
|
+
});
|
|
358
482
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
359
483
|
continue;
|
|
360
484
|
}
|
|
361
|
-
// Log
|
|
362
|
-
logger.error("Database
|
|
485
|
+
// Log structured error details and rethrow
|
|
486
|
+
logger.error("Database upsert operation failed", {
|
|
487
|
+
operation: 'upsertOneAnalyticsSnapshot',
|
|
488
|
+
model: 'AnalyticsSnapshot',
|
|
489
|
+
error: String(error),
|
|
490
|
+
recordId: props.id,
|
|
491
|
+
isRetryable: isConnectionError,
|
|
492
|
+
});
|
|
363
493
|
throw error;
|
|
364
494
|
}
|
|
365
495
|
}
|
|
@@ -443,6 +573,27 @@ export const AnalyticsSnapshot = {
|
|
|
443
573
|
}
|
|
444
574
|
catch (error) {
|
|
445
575
|
lastError = error;
|
|
576
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
577
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
578
|
+
error.message?.includes('violates unique constraint') ||
|
|
579
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
580
|
+
error.message?.includes('unique constraint') ||
|
|
581
|
+
error.message?.includes('23514') ||
|
|
582
|
+
error.message?.includes('23505') ||
|
|
583
|
+
error.message?.includes('P2002') ||
|
|
584
|
+
error.message?.includes('P2003');
|
|
585
|
+
if (isConstraintViolation) {
|
|
586
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
587
|
+
logger.error("Non-retryable constraint violation in updateManyAnalyticsSnapshot", {
|
|
588
|
+
operation: 'updateManyAnalyticsSnapshot',
|
|
589
|
+
model: 'AnalyticsSnapshot',
|
|
590
|
+
error: String(error),
|
|
591
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
592
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
593
|
+
isRetryable: false,
|
|
594
|
+
});
|
|
595
|
+
throw error;
|
|
596
|
+
}
|
|
446
597
|
// Check if this is a database connection error that we should retry
|
|
447
598
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
448
599
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -452,12 +603,22 @@ export const AnalyticsSnapshot = {
|
|
|
452
603
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
453
604
|
retryCount++;
|
|
454
605
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
455
|
-
logger.warn("Database connection error, retrying..."
|
|
606
|
+
logger.warn("Database connection error in updateManyAnalyticsSnapshot, retrying...", {
|
|
607
|
+
operation: 'updateManyAnalyticsSnapshot',
|
|
608
|
+
model: 'AnalyticsSnapshot',
|
|
609
|
+
attempt: retryCount,
|
|
610
|
+
maxRetries: MAX_RETRIES,
|
|
611
|
+
});
|
|
456
612
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
457
613
|
continue;
|
|
458
614
|
}
|
|
459
|
-
// Log
|
|
460
|
-
logger.error("Database
|
|
615
|
+
// Log structured error details and rethrow
|
|
616
|
+
logger.error("Database updateMany operation failed", {
|
|
617
|
+
operation: 'updateManyAnalyticsSnapshot',
|
|
618
|
+
model: 'AnalyticsSnapshot',
|
|
619
|
+
error: String(error),
|
|
620
|
+
isRetryable: isConnectionError,
|
|
621
|
+
});
|
|
461
622
|
throw error;
|
|
462
623
|
}
|
|
463
624
|
}
|
|
@@ -515,6 +676,31 @@ export const AnalyticsSnapshot = {
|
|
|
515
676
|
}
|
|
516
677
|
catch (error) {
|
|
517
678
|
lastError = error;
|
|
679
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
680
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
681
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
682
|
+
error.message?.includes('violates unique constraint') ||
|
|
683
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
684
|
+
error.message?.includes('unique constraint') ||
|
|
685
|
+
error.message?.includes('23514') ||
|
|
686
|
+
error.message?.includes('23505') ||
|
|
687
|
+
error.message?.includes('23503') ||
|
|
688
|
+
error.message?.includes('P2002') ||
|
|
689
|
+
error.message?.includes('P2003') ||
|
|
690
|
+
error.message?.includes('P2014');
|
|
691
|
+
if (isConstraintViolation) {
|
|
692
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
693
|
+
logger.error("Non-retryable constraint violation in deleteOneAnalyticsSnapshot", {
|
|
694
|
+
operation: 'deleteOneAnalyticsSnapshot',
|
|
695
|
+
model: 'AnalyticsSnapshot',
|
|
696
|
+
error: String(error),
|
|
697
|
+
recordId: props.id,
|
|
698
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
699
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
700
|
+
isRetryable: false,
|
|
701
|
+
});
|
|
702
|
+
throw error;
|
|
703
|
+
}
|
|
518
704
|
// Check if this is a database connection error that we should retry
|
|
519
705
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
520
706
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -524,12 +710,24 @@ export const AnalyticsSnapshot = {
|
|
|
524
710
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
525
711
|
retryCount++;
|
|
526
712
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
527
|
-
logger.warn("Database connection error, retrying..."
|
|
713
|
+
logger.warn("Database connection error in deleteOneAnalyticsSnapshot, retrying...", {
|
|
714
|
+
operation: 'deleteOneAnalyticsSnapshot',
|
|
715
|
+
model: 'AnalyticsSnapshot',
|
|
716
|
+
attempt: retryCount,
|
|
717
|
+
maxRetries: MAX_RETRIES,
|
|
718
|
+
recordId: props.id,
|
|
719
|
+
});
|
|
528
720
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
529
721
|
continue;
|
|
530
722
|
}
|
|
531
|
-
// Log
|
|
532
|
-
logger.error("Database
|
|
723
|
+
// Log structured error details and rethrow
|
|
724
|
+
logger.error("Database delete operation failed", {
|
|
725
|
+
operation: 'deleteOneAnalyticsSnapshot',
|
|
726
|
+
model: 'AnalyticsSnapshot',
|
|
727
|
+
error: String(error),
|
|
728
|
+
recordId: props.id,
|
|
729
|
+
isRetryable: isConnectionError,
|
|
730
|
+
});
|
|
533
731
|
throw error;
|
|
534
732
|
}
|
|
535
733
|
}
|
|
@@ -598,12 +796,22 @@ export const AnalyticsSnapshot = {
|
|
|
598
796
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
599
797
|
retryCount++;
|
|
600
798
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
601
|
-
logger.warn("Database connection error, retrying..."
|
|
799
|
+
logger.warn("Database connection error in getAnalyticsSnapshot, retrying...", {
|
|
800
|
+
operation: 'getAnalyticsSnapshot',
|
|
801
|
+
model: 'AnalyticsSnapshot',
|
|
802
|
+
attempt: retryCount,
|
|
803
|
+
maxRetries: MAX_RETRIES,
|
|
804
|
+
});
|
|
602
805
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
603
806
|
continue;
|
|
604
807
|
}
|
|
605
|
-
// Log
|
|
606
|
-
logger.error("Database
|
|
808
|
+
// Log structured error details and rethrow
|
|
809
|
+
logger.error("Database get operation failed", {
|
|
810
|
+
operation: 'getAnalyticsSnapshot',
|
|
811
|
+
model: 'AnalyticsSnapshot',
|
|
812
|
+
error: String(error),
|
|
813
|
+
isRetryable: isConnectionError,
|
|
814
|
+
});
|
|
607
815
|
throw error;
|
|
608
816
|
}
|
|
609
817
|
}
|
|
@@ -660,12 +868,22 @@ export const AnalyticsSnapshot = {
|
|
|
660
868
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
661
869
|
retryCount++;
|
|
662
870
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
663
|
-
logger.warn("Database connection error, retrying..."
|
|
871
|
+
logger.warn("Database connection error in getAllAnalyticsSnapshot, retrying...", {
|
|
872
|
+
operation: 'getAllAnalyticsSnapshot',
|
|
873
|
+
model: 'AnalyticsSnapshot',
|
|
874
|
+
attempt: retryCount,
|
|
875
|
+
maxRetries: MAX_RETRIES,
|
|
876
|
+
});
|
|
664
877
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
665
878
|
continue;
|
|
666
879
|
}
|
|
667
|
-
// Log
|
|
668
|
-
logger.error("Database
|
|
880
|
+
// Log structured error details and rethrow
|
|
881
|
+
logger.error("Database getAll operation failed", {
|
|
882
|
+
operation: 'getAllAnalyticsSnapshot',
|
|
883
|
+
model: 'AnalyticsSnapshot',
|
|
884
|
+
error: String(error),
|
|
885
|
+
isRetryable: isConnectionError,
|
|
886
|
+
});
|
|
669
887
|
throw error;
|
|
670
888
|
}
|
|
671
889
|
}
|
|
@@ -741,12 +959,22 @@ export const AnalyticsSnapshot = {
|
|
|
741
959
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
742
960
|
retryCount++;
|
|
743
961
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
744
|
-
logger.warn("Database connection error, retrying..."
|
|
962
|
+
logger.warn("Database connection error in findManyAnalyticsSnapshot, retrying...", {
|
|
963
|
+
operation: 'findManyAnalyticsSnapshot',
|
|
964
|
+
model: 'AnalyticsSnapshot',
|
|
965
|
+
attempt: retryCount,
|
|
966
|
+
maxRetries: MAX_RETRIES,
|
|
967
|
+
});
|
|
745
968
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
746
969
|
continue;
|
|
747
970
|
}
|
|
748
|
-
// Log
|
|
749
|
-
logger.error("Database
|
|
971
|
+
// Log structured error details and rethrow
|
|
972
|
+
logger.error("Database findMany operation failed", {
|
|
973
|
+
operation: 'findManyAnalyticsSnapshot',
|
|
974
|
+
model: 'AnalyticsSnapshot',
|
|
975
|
+
error: String(error),
|
|
976
|
+
isRetryable: isConnectionError,
|
|
977
|
+
});
|
|
750
978
|
throw error;
|
|
751
979
|
}
|
|
752
980
|
}
|
package/esm/Asset.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Asset.d.ts","sourceRoot":"","sources":["../../src/Asset.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAiG7G,eAAO,MAAM,KAAK;IAEhB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Asset.d.ts","sourceRoot":"","sources":["../../src/Asset.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAiG7G,eAAO,MAAM,KAAK;IAEhB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAuQ5G;;;;;;OAMG;sBACqB,SAAS,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAmK/H;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IA+hB1G;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAirB1G;;;;;;OAMG;sBACqB,SAAS,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA8hB/H;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAmH1G;;;;;;;OAOG;eACc,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAsFhI;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;IA4EjG;;;;;;;OAOG;oBACmB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CAgGxI,CAAC"}
|