@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/esm/Action.mjs
CHANGED
|
@@ -129,6 +129,27 @@ export const Action = {
|
|
|
129
129
|
}
|
|
130
130
|
catch (error) {
|
|
131
131
|
lastError = error;
|
|
132
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
133
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
134
|
+
error.message?.includes('violates unique constraint') ||
|
|
135
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
136
|
+
error.message?.includes('unique constraint') ||
|
|
137
|
+
error.message?.includes('23514') ||
|
|
138
|
+
error.message?.includes('23505') ||
|
|
139
|
+
error.message?.includes('P2002') ||
|
|
140
|
+
error.message?.includes('P2003');
|
|
141
|
+
if (isConstraintViolation) {
|
|
142
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
143
|
+
logger.error("Non-retryable constraint violation in createOneAction", {
|
|
144
|
+
operation: 'createOneAction',
|
|
145
|
+
model: 'Action',
|
|
146
|
+
error: String(error),
|
|
147
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
148
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
149
|
+
isRetryable: false,
|
|
150
|
+
});
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
132
153
|
// Check if this is a database connection error that we should retry
|
|
133
154
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
134
155
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -138,12 +159,22 @@ export const Action = {
|
|
|
138
159
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
139
160
|
retryCount++;
|
|
140
161
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
141
|
-
logger.warn("Database connection error, retrying..."
|
|
162
|
+
logger.warn("Database connection error in createOneAction, retrying...", {
|
|
163
|
+
operation: 'createOneAction',
|
|
164
|
+
model: 'Action',
|
|
165
|
+
attempt: retryCount,
|
|
166
|
+
maxRetries: MAX_RETRIES,
|
|
167
|
+
});
|
|
142
168
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
143
169
|
continue;
|
|
144
170
|
}
|
|
145
|
-
// Log
|
|
146
|
-
logger.error("Database
|
|
171
|
+
// Log structured error details and rethrow
|
|
172
|
+
logger.error("Database create operation failed", {
|
|
173
|
+
operation: 'createOneAction',
|
|
174
|
+
model: 'Action',
|
|
175
|
+
error: String(error),
|
|
176
|
+
isRetryable: isConnectionError,
|
|
177
|
+
});
|
|
147
178
|
throw error;
|
|
148
179
|
}
|
|
149
180
|
}
|
|
@@ -208,6 +239,27 @@ export const Action = {
|
|
|
208
239
|
}
|
|
209
240
|
catch (error) {
|
|
210
241
|
lastError = error;
|
|
242
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
243
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
244
|
+
error.message?.includes('violates unique constraint') ||
|
|
245
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
246
|
+
error.message?.includes('unique constraint') ||
|
|
247
|
+
error.message?.includes('23514') ||
|
|
248
|
+
error.message?.includes('23505') ||
|
|
249
|
+
error.message?.includes('P2002') ||
|
|
250
|
+
error.message?.includes('P2003');
|
|
251
|
+
if (isConstraintViolation) {
|
|
252
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
253
|
+
logger.error("Non-retryable constraint violation in createManyAction", {
|
|
254
|
+
operation: 'createManyAction',
|
|
255
|
+
model: 'Action',
|
|
256
|
+
error: String(error),
|
|
257
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
258
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
259
|
+
isRetryable: false,
|
|
260
|
+
});
|
|
261
|
+
throw error;
|
|
262
|
+
}
|
|
211
263
|
// Check if this is a database connection error that we should retry
|
|
212
264
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
213
265
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -217,12 +269,22 @@ export const Action = {
|
|
|
217
269
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
218
270
|
retryCount++;
|
|
219
271
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
220
|
-
logger.warn("Database connection error, retrying..."
|
|
272
|
+
logger.warn("Database connection error in createManyAction, retrying...", {
|
|
273
|
+
operation: 'createManyAction',
|
|
274
|
+
model: 'Action',
|
|
275
|
+
attempt: retryCount,
|
|
276
|
+
maxRetries: MAX_RETRIES,
|
|
277
|
+
});
|
|
221
278
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
222
279
|
continue;
|
|
223
280
|
}
|
|
224
|
-
// Log
|
|
225
|
-
logger.error("Database
|
|
281
|
+
// Log structured error details and rethrow
|
|
282
|
+
logger.error("Database createMany operation failed", {
|
|
283
|
+
operation: 'createManyAction',
|
|
284
|
+
model: 'Action',
|
|
285
|
+
error: String(error),
|
|
286
|
+
isRetryable: isConnectionError,
|
|
287
|
+
});
|
|
226
288
|
throw error;
|
|
227
289
|
}
|
|
228
290
|
}
|
|
@@ -443,6 +505,28 @@ export const Action = {
|
|
|
443
505
|
}
|
|
444
506
|
catch (error) {
|
|
445
507
|
lastError = error;
|
|
508
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
509
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
510
|
+
error.message?.includes('violates unique constraint') ||
|
|
511
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
512
|
+
error.message?.includes('unique constraint') ||
|
|
513
|
+
error.message?.includes('23514') ||
|
|
514
|
+
error.message?.includes('23505') ||
|
|
515
|
+
error.message?.includes('P2002') ||
|
|
516
|
+
error.message?.includes('P2003');
|
|
517
|
+
if (isConstraintViolation) {
|
|
518
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
519
|
+
logger.error("Non-retryable constraint violation in updateOneAction", {
|
|
520
|
+
operation: 'updateOneAction',
|
|
521
|
+
model: 'Action',
|
|
522
|
+
error: String(error),
|
|
523
|
+
recordId: props.id,
|
|
524
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
525
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
526
|
+
isRetryable: false,
|
|
527
|
+
});
|
|
528
|
+
throw error;
|
|
529
|
+
}
|
|
446
530
|
// Check if this is a database connection error that we should retry
|
|
447
531
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
448
532
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -452,12 +536,24 @@ export const Action = {
|
|
|
452
536
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
453
537
|
retryCount++;
|
|
454
538
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
455
|
-
logger.warn("Database connection error, retrying..."
|
|
539
|
+
logger.warn("Database connection error in updateOneAction, retrying...", {
|
|
540
|
+
operation: 'updateOneAction',
|
|
541
|
+
model: 'Action',
|
|
542
|
+
attempt: retryCount,
|
|
543
|
+
maxRetries: MAX_RETRIES,
|
|
544
|
+
recordId: props.id,
|
|
545
|
+
});
|
|
456
546
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
457
547
|
continue;
|
|
458
548
|
}
|
|
459
|
-
// Log
|
|
460
|
-
logger.error("Database
|
|
549
|
+
// Log structured error details and rethrow
|
|
550
|
+
logger.error("Database update operation failed", {
|
|
551
|
+
operation: 'updateOneAction',
|
|
552
|
+
model: 'Action',
|
|
553
|
+
error: String(error),
|
|
554
|
+
recordId: props.id,
|
|
555
|
+
isRetryable: isConnectionError,
|
|
556
|
+
});
|
|
461
557
|
throw error;
|
|
462
558
|
}
|
|
463
559
|
}
|
|
@@ -723,6 +819,28 @@ export const Action = {
|
|
|
723
819
|
}
|
|
724
820
|
catch (error) {
|
|
725
821
|
lastError = error;
|
|
822
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
823
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
824
|
+
error.message?.includes('violates unique constraint') ||
|
|
825
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
826
|
+
error.message?.includes('unique constraint') ||
|
|
827
|
+
error.message?.includes('23514') ||
|
|
828
|
+
error.message?.includes('23505') ||
|
|
829
|
+
error.message?.includes('P2002') ||
|
|
830
|
+
error.message?.includes('P2003');
|
|
831
|
+
if (isConstraintViolation) {
|
|
832
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
833
|
+
logger.error("Non-retryable constraint violation in upsertOneAction", {
|
|
834
|
+
operation: 'upsertOneAction',
|
|
835
|
+
model: 'Action',
|
|
836
|
+
error: String(error),
|
|
837
|
+
recordId: props.id,
|
|
838
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
839
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
840
|
+
isRetryable: false,
|
|
841
|
+
});
|
|
842
|
+
throw error;
|
|
843
|
+
}
|
|
726
844
|
// Check if this is a database connection error that we should retry
|
|
727
845
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
728
846
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -732,12 +850,24 @@ export const Action = {
|
|
|
732
850
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
733
851
|
retryCount++;
|
|
734
852
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
735
|
-
logger.warn("Database connection error, retrying..."
|
|
853
|
+
logger.warn("Database connection error in upsertOneAction, retrying...", {
|
|
854
|
+
operation: 'upsertOneAction',
|
|
855
|
+
model: 'Action',
|
|
856
|
+
attempt: retryCount,
|
|
857
|
+
maxRetries: MAX_RETRIES,
|
|
858
|
+
recordId: props.id,
|
|
859
|
+
});
|
|
736
860
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
737
861
|
continue;
|
|
738
862
|
}
|
|
739
|
-
// Log
|
|
740
|
-
logger.error("Database
|
|
863
|
+
// Log structured error details and rethrow
|
|
864
|
+
logger.error("Database upsert operation failed", {
|
|
865
|
+
operation: 'upsertOneAction',
|
|
866
|
+
model: 'Action',
|
|
867
|
+
error: String(error),
|
|
868
|
+
recordId: props.id,
|
|
869
|
+
isRetryable: isConnectionError,
|
|
870
|
+
});
|
|
741
871
|
throw error;
|
|
742
872
|
}
|
|
743
873
|
}
|
|
@@ -958,6 +1088,27 @@ export const Action = {
|
|
|
958
1088
|
}
|
|
959
1089
|
catch (error) {
|
|
960
1090
|
lastError = error;
|
|
1091
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1092
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1093
|
+
error.message?.includes('violates unique constraint') ||
|
|
1094
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1095
|
+
error.message?.includes('unique constraint') ||
|
|
1096
|
+
error.message?.includes('23514') ||
|
|
1097
|
+
error.message?.includes('23505') ||
|
|
1098
|
+
error.message?.includes('P2002') ||
|
|
1099
|
+
error.message?.includes('P2003');
|
|
1100
|
+
if (isConstraintViolation) {
|
|
1101
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1102
|
+
logger.error("Non-retryable constraint violation in updateManyAction", {
|
|
1103
|
+
operation: 'updateManyAction',
|
|
1104
|
+
model: 'Action',
|
|
1105
|
+
error: String(error),
|
|
1106
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1107
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1108
|
+
isRetryable: false,
|
|
1109
|
+
});
|
|
1110
|
+
throw error;
|
|
1111
|
+
}
|
|
961
1112
|
// Check if this is a database connection error that we should retry
|
|
962
1113
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
963
1114
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -967,12 +1118,22 @@ export const Action = {
|
|
|
967
1118
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
968
1119
|
retryCount++;
|
|
969
1120
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
970
|
-
logger.warn("Database connection error, retrying..."
|
|
1121
|
+
logger.warn("Database connection error in updateManyAction, retrying...", {
|
|
1122
|
+
operation: 'updateManyAction',
|
|
1123
|
+
model: 'Action',
|
|
1124
|
+
attempt: retryCount,
|
|
1125
|
+
maxRetries: MAX_RETRIES,
|
|
1126
|
+
});
|
|
971
1127
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
972
1128
|
continue;
|
|
973
1129
|
}
|
|
974
|
-
// Log
|
|
975
|
-
logger.error("Database
|
|
1130
|
+
// Log structured error details and rethrow
|
|
1131
|
+
logger.error("Database updateMany operation failed", {
|
|
1132
|
+
operation: 'updateManyAction',
|
|
1133
|
+
model: 'Action',
|
|
1134
|
+
error: String(error),
|
|
1135
|
+
isRetryable: isConnectionError,
|
|
1136
|
+
});
|
|
976
1137
|
throw error;
|
|
977
1138
|
}
|
|
978
1139
|
}
|
|
@@ -1030,6 +1191,31 @@ export const Action = {
|
|
|
1030
1191
|
}
|
|
1031
1192
|
catch (error) {
|
|
1032
1193
|
lastError = error;
|
|
1194
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1195
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
1196
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1197
|
+
error.message?.includes('violates unique constraint') ||
|
|
1198
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1199
|
+
error.message?.includes('unique constraint') ||
|
|
1200
|
+
error.message?.includes('23514') ||
|
|
1201
|
+
error.message?.includes('23505') ||
|
|
1202
|
+
error.message?.includes('23503') ||
|
|
1203
|
+
error.message?.includes('P2002') ||
|
|
1204
|
+
error.message?.includes('P2003') ||
|
|
1205
|
+
error.message?.includes('P2014');
|
|
1206
|
+
if (isConstraintViolation) {
|
|
1207
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1208
|
+
logger.error("Non-retryable constraint violation in deleteOneAction", {
|
|
1209
|
+
operation: 'deleteOneAction',
|
|
1210
|
+
model: 'Action',
|
|
1211
|
+
error: String(error),
|
|
1212
|
+
recordId: props.id,
|
|
1213
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1214
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1215
|
+
isRetryable: false,
|
|
1216
|
+
});
|
|
1217
|
+
throw error;
|
|
1218
|
+
}
|
|
1033
1219
|
// Check if this is a database connection error that we should retry
|
|
1034
1220
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1035
1221
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1039,12 +1225,24 @@ export const Action = {
|
|
|
1039
1225
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1040
1226
|
retryCount++;
|
|
1041
1227
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1042
|
-
logger.warn("Database connection error, retrying..."
|
|
1228
|
+
logger.warn("Database connection error in deleteOneAction, retrying...", {
|
|
1229
|
+
operation: 'deleteOneAction',
|
|
1230
|
+
model: 'Action',
|
|
1231
|
+
attempt: retryCount,
|
|
1232
|
+
maxRetries: MAX_RETRIES,
|
|
1233
|
+
recordId: props.id,
|
|
1234
|
+
});
|
|
1043
1235
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1044
1236
|
continue;
|
|
1045
1237
|
}
|
|
1046
|
-
// Log
|
|
1047
|
-
logger.error("Database
|
|
1238
|
+
// Log structured error details and rethrow
|
|
1239
|
+
logger.error("Database delete operation failed", {
|
|
1240
|
+
operation: 'deleteOneAction',
|
|
1241
|
+
model: 'Action',
|
|
1242
|
+
error: String(error),
|
|
1243
|
+
recordId: props.id,
|
|
1244
|
+
isRetryable: isConnectionError,
|
|
1245
|
+
});
|
|
1048
1246
|
throw error;
|
|
1049
1247
|
}
|
|
1050
1248
|
}
|
|
@@ -1114,12 +1312,22 @@ export const Action = {
|
|
|
1114
1312
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1115
1313
|
retryCount++;
|
|
1116
1314
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1117
|
-
logger.warn("Database connection error, retrying..."
|
|
1315
|
+
logger.warn("Database connection error in getAction, retrying...", {
|
|
1316
|
+
operation: 'getAction',
|
|
1317
|
+
model: 'Action',
|
|
1318
|
+
attempt: retryCount,
|
|
1319
|
+
maxRetries: MAX_RETRIES,
|
|
1320
|
+
});
|
|
1118
1321
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1119
1322
|
continue;
|
|
1120
1323
|
}
|
|
1121
|
-
// Log
|
|
1122
|
-
logger.error("Database
|
|
1324
|
+
// Log structured error details and rethrow
|
|
1325
|
+
logger.error("Database get operation failed", {
|
|
1326
|
+
operation: 'getAction',
|
|
1327
|
+
model: 'Action',
|
|
1328
|
+
error: String(error),
|
|
1329
|
+
isRetryable: isConnectionError,
|
|
1330
|
+
});
|
|
1123
1331
|
throw error;
|
|
1124
1332
|
}
|
|
1125
1333
|
}
|
|
@@ -1176,12 +1384,22 @@ export const Action = {
|
|
|
1176
1384
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1177
1385
|
retryCount++;
|
|
1178
1386
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1179
|
-
logger.warn("Database connection error, retrying..."
|
|
1387
|
+
logger.warn("Database connection error in getAllAction, retrying...", {
|
|
1388
|
+
operation: 'getAllAction',
|
|
1389
|
+
model: 'Action',
|
|
1390
|
+
attempt: retryCount,
|
|
1391
|
+
maxRetries: MAX_RETRIES,
|
|
1392
|
+
});
|
|
1180
1393
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1181
1394
|
continue;
|
|
1182
1395
|
}
|
|
1183
|
-
// Log
|
|
1184
|
-
logger.error("Database
|
|
1396
|
+
// Log structured error details and rethrow
|
|
1397
|
+
logger.error("Database getAll operation failed", {
|
|
1398
|
+
operation: 'getAllAction',
|
|
1399
|
+
model: 'Action',
|
|
1400
|
+
error: String(error),
|
|
1401
|
+
isRetryable: isConnectionError,
|
|
1402
|
+
});
|
|
1185
1403
|
throw error;
|
|
1186
1404
|
}
|
|
1187
1405
|
}
|
|
@@ -1257,12 +1475,22 @@ export const Action = {
|
|
|
1257
1475
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1258
1476
|
retryCount++;
|
|
1259
1477
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1260
|
-
logger.warn("Database connection error, retrying..."
|
|
1478
|
+
logger.warn("Database connection error in findManyAction, retrying...", {
|
|
1479
|
+
operation: 'findManyAction',
|
|
1480
|
+
model: 'Action',
|
|
1481
|
+
attempt: retryCount,
|
|
1482
|
+
maxRetries: MAX_RETRIES,
|
|
1483
|
+
});
|
|
1261
1484
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1262
1485
|
continue;
|
|
1263
1486
|
}
|
|
1264
|
-
// Log
|
|
1265
|
-
logger.error("Database
|
|
1487
|
+
// Log structured error details and rethrow
|
|
1488
|
+
logger.error("Database findMany operation failed", {
|
|
1489
|
+
operation: 'findManyAction',
|
|
1490
|
+
model: 'Action',
|
|
1491
|
+
error: String(error),
|
|
1492
|
+
isRetryable: isConnectionError,
|
|
1493
|
+
});
|
|
1266
1494
|
throw error;
|
|
1267
1495
|
}
|
|
1268
1496
|
}
|
package/esm/Alert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/Alert.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AA6B7G,eAAO,MAAM,KAAK;IAEhB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/Alert.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AA6B7G,eAAO,MAAM,KAAK;IAEhB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAqZ5G;;;;;;OAMG;sBACqB,SAAS,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAyH/H;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAisC1G;;;;;;OAMG;kBACiB,SAAS,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAi+C1G;;;;;;OAMG;sBACqB,SAAS,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAgsC/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;IA0FhI;;;;;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"}
|