@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
|
@@ -305,6 +305,27 @@ export const InstitutionalFlowSignal = {
|
|
|
305
305
|
}
|
|
306
306
|
catch (error) {
|
|
307
307
|
lastError = error;
|
|
308
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
309
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
310
|
+
error.message?.includes('violates unique constraint') ||
|
|
311
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
312
|
+
error.message?.includes('unique constraint') ||
|
|
313
|
+
error.message?.includes('23514') ||
|
|
314
|
+
error.message?.includes('23505') ||
|
|
315
|
+
error.message?.includes('P2002') ||
|
|
316
|
+
error.message?.includes('P2003');
|
|
317
|
+
if (isConstraintViolation) {
|
|
318
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
319
|
+
logger.error("Non-retryable constraint violation in createOneInstitutionalFlowSignal", {
|
|
320
|
+
operation: 'createOneInstitutionalFlowSignal',
|
|
321
|
+
model: 'InstitutionalFlowSignal',
|
|
322
|
+
error: String(error),
|
|
323
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
324
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
325
|
+
isRetryable: false,
|
|
326
|
+
});
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
308
329
|
// Check if this is a database connection error that we should retry
|
|
309
330
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
310
331
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -314,12 +335,22 @@ export const InstitutionalFlowSignal = {
|
|
|
314
335
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
315
336
|
retryCount++;
|
|
316
337
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
317
|
-
logger.warn("Database connection error, retrying..."
|
|
338
|
+
logger.warn("Database connection error in createOneInstitutionalFlowSignal, retrying...", {
|
|
339
|
+
operation: 'createOneInstitutionalFlowSignal',
|
|
340
|
+
model: 'InstitutionalFlowSignal',
|
|
341
|
+
attempt: retryCount,
|
|
342
|
+
maxRetries: MAX_RETRIES,
|
|
343
|
+
});
|
|
318
344
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
319
345
|
continue;
|
|
320
346
|
}
|
|
321
|
-
// Log
|
|
322
|
-
logger.error("Database
|
|
347
|
+
// Log structured error details and rethrow
|
|
348
|
+
logger.error("Database create operation failed", {
|
|
349
|
+
operation: 'createOneInstitutionalFlowSignal',
|
|
350
|
+
model: 'InstitutionalFlowSignal',
|
|
351
|
+
error: String(error),
|
|
352
|
+
isRetryable: isConnectionError,
|
|
353
|
+
});
|
|
323
354
|
throw error;
|
|
324
355
|
}
|
|
325
356
|
}
|
|
@@ -380,6 +411,27 @@ export const InstitutionalFlowSignal = {
|
|
|
380
411
|
}
|
|
381
412
|
catch (error) {
|
|
382
413
|
lastError = error;
|
|
414
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
415
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
416
|
+
error.message?.includes('violates unique constraint') ||
|
|
417
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
418
|
+
error.message?.includes('unique constraint') ||
|
|
419
|
+
error.message?.includes('23514') ||
|
|
420
|
+
error.message?.includes('23505') ||
|
|
421
|
+
error.message?.includes('P2002') ||
|
|
422
|
+
error.message?.includes('P2003');
|
|
423
|
+
if (isConstraintViolation) {
|
|
424
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
425
|
+
logger.error("Non-retryable constraint violation in createManyInstitutionalFlowSignal", {
|
|
426
|
+
operation: 'createManyInstitutionalFlowSignal',
|
|
427
|
+
model: 'InstitutionalFlowSignal',
|
|
428
|
+
error: String(error),
|
|
429
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
430
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
431
|
+
isRetryable: false,
|
|
432
|
+
});
|
|
433
|
+
throw error;
|
|
434
|
+
}
|
|
383
435
|
// Check if this is a database connection error that we should retry
|
|
384
436
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
385
437
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -389,12 +441,22 @@ export const InstitutionalFlowSignal = {
|
|
|
389
441
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
390
442
|
retryCount++;
|
|
391
443
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
392
|
-
logger.warn("Database connection error, retrying..."
|
|
444
|
+
logger.warn("Database connection error in createManyInstitutionalFlowSignal, retrying...", {
|
|
445
|
+
operation: 'createManyInstitutionalFlowSignal',
|
|
446
|
+
model: 'InstitutionalFlowSignal',
|
|
447
|
+
attempt: retryCount,
|
|
448
|
+
maxRetries: MAX_RETRIES,
|
|
449
|
+
});
|
|
393
450
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
394
451
|
continue;
|
|
395
452
|
}
|
|
396
|
-
// Log
|
|
397
|
-
logger.error("Database
|
|
453
|
+
// Log structured error details and rethrow
|
|
454
|
+
logger.error("Database createMany operation failed", {
|
|
455
|
+
operation: 'createManyInstitutionalFlowSignal',
|
|
456
|
+
model: 'InstitutionalFlowSignal',
|
|
457
|
+
error: String(error),
|
|
458
|
+
isRetryable: isConnectionError,
|
|
459
|
+
});
|
|
398
460
|
throw error;
|
|
399
461
|
}
|
|
400
462
|
}
|
|
@@ -1017,6 +1079,28 @@ export const InstitutionalFlowSignal = {
|
|
|
1017
1079
|
}
|
|
1018
1080
|
catch (error) {
|
|
1019
1081
|
lastError = error;
|
|
1082
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1083
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1084
|
+
error.message?.includes('violates unique constraint') ||
|
|
1085
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1086
|
+
error.message?.includes('unique constraint') ||
|
|
1087
|
+
error.message?.includes('23514') ||
|
|
1088
|
+
error.message?.includes('23505') ||
|
|
1089
|
+
error.message?.includes('P2002') ||
|
|
1090
|
+
error.message?.includes('P2003');
|
|
1091
|
+
if (isConstraintViolation) {
|
|
1092
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1093
|
+
logger.error("Non-retryable constraint violation in updateOneInstitutionalFlowSignal", {
|
|
1094
|
+
operation: 'updateOneInstitutionalFlowSignal',
|
|
1095
|
+
model: 'InstitutionalFlowSignal',
|
|
1096
|
+
error: String(error),
|
|
1097
|
+
recordId: props.id,
|
|
1098
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1099
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1100
|
+
isRetryable: false,
|
|
1101
|
+
});
|
|
1102
|
+
throw error;
|
|
1103
|
+
}
|
|
1020
1104
|
// Check if this is a database connection error that we should retry
|
|
1021
1105
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1022
1106
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1026,12 +1110,24 @@ export const InstitutionalFlowSignal = {
|
|
|
1026
1110
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1027
1111
|
retryCount++;
|
|
1028
1112
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1029
|
-
logger.warn("Database connection error, retrying..."
|
|
1113
|
+
logger.warn("Database connection error in updateOneInstitutionalFlowSignal, retrying...", {
|
|
1114
|
+
operation: 'updateOneInstitutionalFlowSignal',
|
|
1115
|
+
model: 'InstitutionalFlowSignal',
|
|
1116
|
+
attempt: retryCount,
|
|
1117
|
+
maxRetries: MAX_RETRIES,
|
|
1118
|
+
recordId: props.id,
|
|
1119
|
+
});
|
|
1030
1120
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1031
1121
|
continue;
|
|
1032
1122
|
}
|
|
1033
|
-
// Log
|
|
1034
|
-
logger.error("Database
|
|
1123
|
+
// Log structured error details and rethrow
|
|
1124
|
+
logger.error("Database update operation failed", {
|
|
1125
|
+
operation: 'updateOneInstitutionalFlowSignal',
|
|
1126
|
+
model: 'InstitutionalFlowSignal',
|
|
1127
|
+
error: String(error),
|
|
1128
|
+
recordId: props.id,
|
|
1129
|
+
isRetryable: isConnectionError,
|
|
1130
|
+
});
|
|
1035
1131
|
throw error;
|
|
1036
1132
|
}
|
|
1037
1133
|
}
|
|
@@ -1802,6 +1898,28 @@ export const InstitutionalFlowSignal = {
|
|
|
1802
1898
|
}
|
|
1803
1899
|
catch (error) {
|
|
1804
1900
|
lastError = error;
|
|
1901
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
1902
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
1903
|
+
error.message?.includes('violates unique constraint') ||
|
|
1904
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
1905
|
+
error.message?.includes('unique constraint') ||
|
|
1906
|
+
error.message?.includes('23514') ||
|
|
1907
|
+
error.message?.includes('23505') ||
|
|
1908
|
+
error.message?.includes('P2002') ||
|
|
1909
|
+
error.message?.includes('P2003');
|
|
1910
|
+
if (isConstraintViolation) {
|
|
1911
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
1912
|
+
logger.error("Non-retryable constraint violation in upsertOneInstitutionalFlowSignal", {
|
|
1913
|
+
operation: 'upsertOneInstitutionalFlowSignal',
|
|
1914
|
+
model: 'InstitutionalFlowSignal',
|
|
1915
|
+
error: String(error),
|
|
1916
|
+
recordId: props.id,
|
|
1917
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1918
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1919
|
+
isRetryable: false,
|
|
1920
|
+
});
|
|
1921
|
+
throw error;
|
|
1922
|
+
}
|
|
1805
1923
|
// Check if this is a database connection error that we should retry
|
|
1806
1924
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
1807
1925
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -1811,12 +1929,24 @@ export const InstitutionalFlowSignal = {
|
|
|
1811
1929
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1812
1930
|
retryCount++;
|
|
1813
1931
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1814
|
-
logger.warn("Database connection error, retrying..."
|
|
1932
|
+
logger.warn("Database connection error in upsertOneInstitutionalFlowSignal, retrying...", {
|
|
1933
|
+
operation: 'upsertOneInstitutionalFlowSignal',
|
|
1934
|
+
model: 'InstitutionalFlowSignal',
|
|
1935
|
+
attempt: retryCount,
|
|
1936
|
+
maxRetries: MAX_RETRIES,
|
|
1937
|
+
recordId: props.id,
|
|
1938
|
+
});
|
|
1815
1939
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1816
1940
|
continue;
|
|
1817
1941
|
}
|
|
1818
|
-
// Log
|
|
1819
|
-
logger.error("Database
|
|
1942
|
+
// Log structured error details and rethrow
|
|
1943
|
+
logger.error("Database upsert operation failed", {
|
|
1944
|
+
operation: 'upsertOneInstitutionalFlowSignal',
|
|
1945
|
+
model: 'InstitutionalFlowSignal',
|
|
1946
|
+
error: String(error),
|
|
1947
|
+
recordId: props.id,
|
|
1948
|
+
isRetryable: isConnectionError,
|
|
1949
|
+
});
|
|
1820
1950
|
throw error;
|
|
1821
1951
|
}
|
|
1822
1952
|
}
|
|
@@ -2439,6 +2569,27 @@ export const InstitutionalFlowSignal = {
|
|
|
2439
2569
|
}
|
|
2440
2570
|
catch (error) {
|
|
2441
2571
|
lastError = error;
|
|
2572
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
2573
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
2574
|
+
error.message?.includes('violates unique constraint') ||
|
|
2575
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
2576
|
+
error.message?.includes('unique constraint') ||
|
|
2577
|
+
error.message?.includes('23514') ||
|
|
2578
|
+
error.message?.includes('23505') ||
|
|
2579
|
+
error.message?.includes('P2002') ||
|
|
2580
|
+
error.message?.includes('P2003');
|
|
2581
|
+
if (isConstraintViolation) {
|
|
2582
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
2583
|
+
logger.error("Non-retryable constraint violation in updateManyInstitutionalFlowSignal", {
|
|
2584
|
+
operation: 'updateManyInstitutionalFlowSignal',
|
|
2585
|
+
model: 'InstitutionalFlowSignal',
|
|
2586
|
+
error: String(error),
|
|
2587
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
2588
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
2589
|
+
isRetryable: false,
|
|
2590
|
+
});
|
|
2591
|
+
throw error;
|
|
2592
|
+
}
|
|
2442
2593
|
// Check if this is a database connection error that we should retry
|
|
2443
2594
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
2444
2595
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -2448,12 +2599,22 @@ export const InstitutionalFlowSignal = {
|
|
|
2448
2599
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2449
2600
|
retryCount++;
|
|
2450
2601
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2451
|
-
logger.warn("Database connection error, retrying..."
|
|
2602
|
+
logger.warn("Database connection error in updateManyInstitutionalFlowSignal, retrying...", {
|
|
2603
|
+
operation: 'updateManyInstitutionalFlowSignal',
|
|
2604
|
+
model: 'InstitutionalFlowSignal',
|
|
2605
|
+
attempt: retryCount,
|
|
2606
|
+
maxRetries: MAX_RETRIES,
|
|
2607
|
+
});
|
|
2452
2608
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2453
2609
|
continue;
|
|
2454
2610
|
}
|
|
2455
|
-
// Log
|
|
2456
|
-
logger.error("Database
|
|
2611
|
+
// Log structured error details and rethrow
|
|
2612
|
+
logger.error("Database updateMany operation failed", {
|
|
2613
|
+
operation: 'updateManyInstitutionalFlowSignal',
|
|
2614
|
+
model: 'InstitutionalFlowSignal',
|
|
2615
|
+
error: String(error),
|
|
2616
|
+
isRetryable: isConnectionError,
|
|
2617
|
+
});
|
|
2457
2618
|
throw error;
|
|
2458
2619
|
}
|
|
2459
2620
|
}
|
|
@@ -2511,6 +2672,31 @@ export const InstitutionalFlowSignal = {
|
|
|
2511
2672
|
}
|
|
2512
2673
|
catch (error) {
|
|
2513
2674
|
lastError = error;
|
|
2675
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
2676
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
2677
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
2678
|
+
error.message?.includes('violates unique constraint') ||
|
|
2679
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
2680
|
+
error.message?.includes('unique constraint') ||
|
|
2681
|
+
error.message?.includes('23514') ||
|
|
2682
|
+
error.message?.includes('23505') ||
|
|
2683
|
+
error.message?.includes('23503') ||
|
|
2684
|
+
error.message?.includes('P2002') ||
|
|
2685
|
+
error.message?.includes('P2003') ||
|
|
2686
|
+
error.message?.includes('P2014');
|
|
2687
|
+
if (isConstraintViolation) {
|
|
2688
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
2689
|
+
logger.error("Non-retryable constraint violation in deleteOneInstitutionalFlowSignal", {
|
|
2690
|
+
operation: 'deleteOneInstitutionalFlowSignal',
|
|
2691
|
+
model: 'InstitutionalFlowSignal',
|
|
2692
|
+
error: String(error),
|
|
2693
|
+
recordId: props.id,
|
|
2694
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
2695
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
2696
|
+
isRetryable: false,
|
|
2697
|
+
});
|
|
2698
|
+
throw error;
|
|
2699
|
+
}
|
|
2514
2700
|
// Check if this is a database connection error that we should retry
|
|
2515
2701
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
2516
2702
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -2520,12 +2706,24 @@ export const InstitutionalFlowSignal = {
|
|
|
2520
2706
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2521
2707
|
retryCount++;
|
|
2522
2708
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2523
|
-
logger.warn("Database connection error, retrying..."
|
|
2709
|
+
logger.warn("Database connection error in deleteOneInstitutionalFlowSignal, retrying...", {
|
|
2710
|
+
operation: 'deleteOneInstitutionalFlowSignal',
|
|
2711
|
+
model: 'InstitutionalFlowSignal',
|
|
2712
|
+
attempt: retryCount,
|
|
2713
|
+
maxRetries: MAX_RETRIES,
|
|
2714
|
+
recordId: props.id,
|
|
2715
|
+
});
|
|
2524
2716
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2525
2717
|
continue;
|
|
2526
2718
|
}
|
|
2527
|
-
// Log
|
|
2528
|
-
logger.error("Database
|
|
2719
|
+
// Log structured error details and rethrow
|
|
2720
|
+
logger.error("Database delete operation failed", {
|
|
2721
|
+
operation: 'deleteOneInstitutionalFlowSignal',
|
|
2722
|
+
model: 'InstitutionalFlowSignal',
|
|
2723
|
+
error: String(error),
|
|
2724
|
+
recordId: props.id,
|
|
2725
|
+
isRetryable: isConnectionError,
|
|
2726
|
+
});
|
|
2529
2727
|
throw error;
|
|
2530
2728
|
}
|
|
2531
2729
|
}
|
|
@@ -2594,12 +2792,22 @@ export const InstitutionalFlowSignal = {
|
|
|
2594
2792
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2595
2793
|
retryCount++;
|
|
2596
2794
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2597
|
-
logger.warn("Database connection error, retrying..."
|
|
2795
|
+
logger.warn("Database connection error in getInstitutionalFlowSignal, retrying...", {
|
|
2796
|
+
operation: 'getInstitutionalFlowSignal',
|
|
2797
|
+
model: 'InstitutionalFlowSignal',
|
|
2798
|
+
attempt: retryCount,
|
|
2799
|
+
maxRetries: MAX_RETRIES,
|
|
2800
|
+
});
|
|
2598
2801
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2599
2802
|
continue;
|
|
2600
2803
|
}
|
|
2601
|
-
// Log
|
|
2602
|
-
logger.error("Database
|
|
2804
|
+
// Log structured error details and rethrow
|
|
2805
|
+
logger.error("Database get operation failed", {
|
|
2806
|
+
operation: 'getInstitutionalFlowSignal',
|
|
2807
|
+
model: 'InstitutionalFlowSignal',
|
|
2808
|
+
error: String(error),
|
|
2809
|
+
isRetryable: isConnectionError,
|
|
2810
|
+
});
|
|
2603
2811
|
throw error;
|
|
2604
2812
|
}
|
|
2605
2813
|
}
|
|
@@ -2656,12 +2864,22 @@ export const InstitutionalFlowSignal = {
|
|
|
2656
2864
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2657
2865
|
retryCount++;
|
|
2658
2866
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2659
|
-
logger.warn("Database connection error, retrying..."
|
|
2867
|
+
logger.warn("Database connection error in getAllInstitutionalFlowSignal, retrying...", {
|
|
2868
|
+
operation: 'getAllInstitutionalFlowSignal',
|
|
2869
|
+
model: 'InstitutionalFlowSignal',
|
|
2870
|
+
attempt: retryCount,
|
|
2871
|
+
maxRetries: MAX_RETRIES,
|
|
2872
|
+
});
|
|
2660
2873
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2661
2874
|
continue;
|
|
2662
2875
|
}
|
|
2663
|
-
// Log
|
|
2664
|
-
logger.error("Database
|
|
2876
|
+
// Log structured error details and rethrow
|
|
2877
|
+
logger.error("Database getAll operation failed", {
|
|
2878
|
+
operation: 'getAllInstitutionalFlowSignal',
|
|
2879
|
+
model: 'InstitutionalFlowSignal',
|
|
2880
|
+
error: String(error),
|
|
2881
|
+
isRetryable: isConnectionError,
|
|
2882
|
+
});
|
|
2665
2883
|
throw error;
|
|
2666
2884
|
}
|
|
2667
2885
|
}
|
|
@@ -2737,12 +2955,22 @@ export const InstitutionalFlowSignal = {
|
|
|
2737
2955
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
2738
2956
|
retryCount++;
|
|
2739
2957
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
2740
|
-
logger.warn("Database connection error, retrying..."
|
|
2958
|
+
logger.warn("Database connection error in findManyInstitutionalFlowSignal, retrying...", {
|
|
2959
|
+
operation: 'findManyInstitutionalFlowSignal',
|
|
2960
|
+
model: 'InstitutionalFlowSignal',
|
|
2961
|
+
attempt: retryCount,
|
|
2962
|
+
maxRetries: MAX_RETRIES,
|
|
2963
|
+
});
|
|
2741
2964
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
2742
2965
|
continue;
|
|
2743
2966
|
}
|
|
2744
|
-
// Log
|
|
2745
|
-
logger.error("Database
|
|
2967
|
+
// Log structured error details and rethrow
|
|
2968
|
+
logger.error("Database findMany operation failed", {
|
|
2969
|
+
operation: 'findManyInstitutionalFlowSignal',
|
|
2970
|
+
model: 'InstitutionalFlowSignal',
|
|
2971
|
+
error: String(error),
|
|
2972
|
+
isRetryable: isConnectionError,
|
|
2973
|
+
});
|
|
2746
2974
|
throw error;
|
|
2747
2975
|
}
|
|
2748
2976
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstitutionalHolding.d.ts","sourceRoot":"","sources":["../../src/InstitutionalHolding.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AAC9H,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAoG7G,eAAO,MAAM,oBAAoB;IAE/B;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"InstitutionalHolding.d.ts","sourceRoot":"","sources":["../../src/InstitutionalHolding.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AAC9H,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAoG7G,eAAO,MAAM,oBAAoB;IAE/B;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAsQ1I;;;;;;OAMG;sBACqB,wBAAwB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAiH9I;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAsqBxI;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAuzBxI;;;;;;OAMG;sBACqB,wBAAwB,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAqqB9I;;;;;;OAMG;kBACiB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAmHxI;;;;;;;OAOG;eACc,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;IAuF9J;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC;IA4EhH;;;;;;;OAOG;oBACmB,wBAAwB,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC;CA6FtK,CAAC"}
|