@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
|
@@ -82,6 +82,27 @@ export const InstitutionalSentimentMetrics = {
|
|
|
82
82
|
}
|
|
83
83
|
catch (error) {
|
|
84
84
|
lastError = error;
|
|
85
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
86
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
87
|
+
error.message?.includes('violates unique constraint') ||
|
|
88
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
89
|
+
error.message?.includes('unique constraint') ||
|
|
90
|
+
error.message?.includes('23514') ||
|
|
91
|
+
error.message?.includes('23505') ||
|
|
92
|
+
error.message?.includes('P2002') ||
|
|
93
|
+
error.message?.includes('P2003');
|
|
94
|
+
if (isConstraintViolation) {
|
|
95
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
96
|
+
logger.error("Non-retryable constraint violation in createOneInstitutionalSentimentMetrics", {
|
|
97
|
+
operation: 'createOneInstitutionalSentimentMetrics',
|
|
98
|
+
model: 'InstitutionalSentimentMetrics',
|
|
99
|
+
error: String(error),
|
|
100
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
101
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
102
|
+
isRetryable: false,
|
|
103
|
+
});
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
85
106
|
// Check if this is a database connection error that we should retry
|
|
86
107
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
87
108
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -91,12 +112,22 @@ export const InstitutionalSentimentMetrics = {
|
|
|
91
112
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
92
113
|
retryCount++;
|
|
93
114
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
94
|
-
logger.warn("Database connection error, retrying..."
|
|
115
|
+
logger.warn("Database connection error in createOneInstitutionalSentimentMetrics, retrying...", {
|
|
116
|
+
operation: 'createOneInstitutionalSentimentMetrics',
|
|
117
|
+
model: 'InstitutionalSentimentMetrics',
|
|
118
|
+
attempt: retryCount,
|
|
119
|
+
maxRetries: MAX_RETRIES,
|
|
120
|
+
});
|
|
95
121
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
96
122
|
continue;
|
|
97
123
|
}
|
|
98
|
-
// Log
|
|
99
|
-
logger.error("Database
|
|
124
|
+
// Log structured error details and rethrow
|
|
125
|
+
logger.error("Database create operation failed", {
|
|
126
|
+
operation: 'createOneInstitutionalSentimentMetrics',
|
|
127
|
+
model: 'InstitutionalSentimentMetrics',
|
|
128
|
+
error: String(error),
|
|
129
|
+
isRetryable: isConnectionError,
|
|
130
|
+
});
|
|
100
131
|
throw error;
|
|
101
132
|
}
|
|
102
133
|
}
|
|
@@ -160,6 +191,27 @@ export const InstitutionalSentimentMetrics = {
|
|
|
160
191
|
}
|
|
161
192
|
catch (error) {
|
|
162
193
|
lastError = error;
|
|
194
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
195
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
196
|
+
error.message?.includes('violates unique constraint') ||
|
|
197
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
198
|
+
error.message?.includes('unique constraint') ||
|
|
199
|
+
error.message?.includes('23514') ||
|
|
200
|
+
error.message?.includes('23505') ||
|
|
201
|
+
error.message?.includes('P2002') ||
|
|
202
|
+
error.message?.includes('P2003');
|
|
203
|
+
if (isConstraintViolation) {
|
|
204
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
205
|
+
logger.error("Non-retryable constraint violation in createManyInstitutionalSentimentMetrics", {
|
|
206
|
+
operation: 'createManyInstitutionalSentimentMetrics',
|
|
207
|
+
model: 'InstitutionalSentimentMetrics',
|
|
208
|
+
error: String(error),
|
|
209
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
210
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
211
|
+
isRetryable: false,
|
|
212
|
+
});
|
|
213
|
+
throw error;
|
|
214
|
+
}
|
|
163
215
|
// Check if this is a database connection error that we should retry
|
|
164
216
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
165
217
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -169,12 +221,22 @@ export const InstitutionalSentimentMetrics = {
|
|
|
169
221
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
170
222
|
retryCount++;
|
|
171
223
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
172
|
-
logger.warn("Database connection error, retrying..."
|
|
224
|
+
logger.warn("Database connection error in createManyInstitutionalSentimentMetrics, retrying...", {
|
|
225
|
+
operation: 'createManyInstitutionalSentimentMetrics',
|
|
226
|
+
model: 'InstitutionalSentimentMetrics',
|
|
227
|
+
attempt: retryCount,
|
|
228
|
+
maxRetries: MAX_RETRIES,
|
|
229
|
+
});
|
|
173
230
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
174
231
|
continue;
|
|
175
232
|
}
|
|
176
|
-
// Log
|
|
177
|
-
logger.error("Database
|
|
233
|
+
// Log structured error details and rethrow
|
|
234
|
+
logger.error("Database createMany operation failed", {
|
|
235
|
+
operation: 'createManyInstitutionalSentimentMetrics',
|
|
236
|
+
model: 'InstitutionalSentimentMetrics',
|
|
237
|
+
error: String(error),
|
|
238
|
+
isRetryable: isConnectionError,
|
|
239
|
+
});
|
|
178
240
|
throw error;
|
|
179
241
|
}
|
|
180
242
|
}
|
|
@@ -261,6 +323,28 @@ export const InstitutionalSentimentMetrics = {
|
|
|
261
323
|
}
|
|
262
324
|
catch (error) {
|
|
263
325
|
lastError = error;
|
|
326
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
327
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
328
|
+
error.message?.includes('violates unique constraint') ||
|
|
329
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
330
|
+
error.message?.includes('unique constraint') ||
|
|
331
|
+
error.message?.includes('23514') ||
|
|
332
|
+
error.message?.includes('23505') ||
|
|
333
|
+
error.message?.includes('P2002') ||
|
|
334
|
+
error.message?.includes('P2003');
|
|
335
|
+
if (isConstraintViolation) {
|
|
336
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
337
|
+
logger.error("Non-retryable constraint violation in updateOneInstitutionalSentimentMetrics", {
|
|
338
|
+
operation: 'updateOneInstitutionalSentimentMetrics',
|
|
339
|
+
model: 'InstitutionalSentimentMetrics',
|
|
340
|
+
error: String(error),
|
|
341
|
+
recordId: props.id,
|
|
342
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
343
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
344
|
+
isRetryable: false,
|
|
345
|
+
});
|
|
346
|
+
throw error;
|
|
347
|
+
}
|
|
264
348
|
// Check if this is a database connection error that we should retry
|
|
265
349
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
266
350
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -270,12 +354,24 @@ export const InstitutionalSentimentMetrics = {
|
|
|
270
354
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
271
355
|
retryCount++;
|
|
272
356
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
273
|
-
logger.warn("Database connection error, retrying..."
|
|
357
|
+
logger.warn("Database connection error in updateOneInstitutionalSentimentMetrics, retrying...", {
|
|
358
|
+
operation: 'updateOneInstitutionalSentimentMetrics',
|
|
359
|
+
model: 'InstitutionalSentimentMetrics',
|
|
360
|
+
attempt: retryCount,
|
|
361
|
+
maxRetries: MAX_RETRIES,
|
|
362
|
+
recordId: props.id,
|
|
363
|
+
});
|
|
274
364
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
275
365
|
continue;
|
|
276
366
|
}
|
|
277
|
-
// Log
|
|
278
|
-
logger.error("Database
|
|
367
|
+
// Log structured error details and rethrow
|
|
368
|
+
logger.error("Database update operation failed", {
|
|
369
|
+
operation: 'updateOneInstitutionalSentimentMetrics',
|
|
370
|
+
model: 'InstitutionalSentimentMetrics',
|
|
371
|
+
error: String(error),
|
|
372
|
+
recordId: props.id,
|
|
373
|
+
isRetryable: isConnectionError,
|
|
374
|
+
});
|
|
279
375
|
throw error;
|
|
280
376
|
}
|
|
281
377
|
}
|
|
@@ -365,6 +461,28 @@ export const InstitutionalSentimentMetrics = {
|
|
|
365
461
|
}
|
|
366
462
|
catch (error) {
|
|
367
463
|
lastError = error;
|
|
464
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
465
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
466
|
+
error.message?.includes('violates unique constraint') ||
|
|
467
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
468
|
+
error.message?.includes('unique constraint') ||
|
|
469
|
+
error.message?.includes('23514') ||
|
|
470
|
+
error.message?.includes('23505') ||
|
|
471
|
+
error.message?.includes('P2002') ||
|
|
472
|
+
error.message?.includes('P2003');
|
|
473
|
+
if (isConstraintViolation) {
|
|
474
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
475
|
+
logger.error("Non-retryable constraint violation in upsertOneInstitutionalSentimentMetrics", {
|
|
476
|
+
operation: 'upsertOneInstitutionalSentimentMetrics',
|
|
477
|
+
model: 'InstitutionalSentimentMetrics',
|
|
478
|
+
error: String(error),
|
|
479
|
+
recordId: props.id,
|
|
480
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
481
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
482
|
+
isRetryable: false,
|
|
483
|
+
});
|
|
484
|
+
throw error;
|
|
485
|
+
}
|
|
368
486
|
// Check if this is a database connection error that we should retry
|
|
369
487
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
370
488
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -374,12 +492,24 @@ export const InstitutionalSentimentMetrics = {
|
|
|
374
492
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
375
493
|
retryCount++;
|
|
376
494
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
377
|
-
logger.warn("Database connection error, retrying..."
|
|
495
|
+
logger.warn("Database connection error in upsertOneInstitutionalSentimentMetrics, retrying...", {
|
|
496
|
+
operation: 'upsertOneInstitutionalSentimentMetrics',
|
|
497
|
+
model: 'InstitutionalSentimentMetrics',
|
|
498
|
+
attempt: retryCount,
|
|
499
|
+
maxRetries: MAX_RETRIES,
|
|
500
|
+
recordId: props.id,
|
|
501
|
+
});
|
|
378
502
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
379
503
|
continue;
|
|
380
504
|
}
|
|
381
|
-
// Log
|
|
382
|
-
logger.error("Database
|
|
505
|
+
// Log structured error details and rethrow
|
|
506
|
+
logger.error("Database upsert operation failed", {
|
|
507
|
+
operation: 'upsertOneInstitutionalSentimentMetrics',
|
|
508
|
+
model: 'InstitutionalSentimentMetrics',
|
|
509
|
+
error: String(error),
|
|
510
|
+
recordId: props.id,
|
|
511
|
+
isRetryable: isConnectionError,
|
|
512
|
+
});
|
|
383
513
|
throw error;
|
|
384
514
|
}
|
|
385
515
|
}
|
|
@@ -466,6 +596,27 @@ export const InstitutionalSentimentMetrics = {
|
|
|
466
596
|
}
|
|
467
597
|
catch (error) {
|
|
468
598
|
lastError = error;
|
|
599
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
600
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
601
|
+
error.message?.includes('violates unique constraint') ||
|
|
602
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
603
|
+
error.message?.includes('unique constraint') ||
|
|
604
|
+
error.message?.includes('23514') ||
|
|
605
|
+
error.message?.includes('23505') ||
|
|
606
|
+
error.message?.includes('P2002') ||
|
|
607
|
+
error.message?.includes('P2003');
|
|
608
|
+
if (isConstraintViolation) {
|
|
609
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
610
|
+
logger.error("Non-retryable constraint violation in updateManyInstitutionalSentimentMetrics", {
|
|
611
|
+
operation: 'updateManyInstitutionalSentimentMetrics',
|
|
612
|
+
model: 'InstitutionalSentimentMetrics',
|
|
613
|
+
error: String(error),
|
|
614
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
615
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
616
|
+
isRetryable: false,
|
|
617
|
+
});
|
|
618
|
+
throw error;
|
|
619
|
+
}
|
|
469
620
|
// Check if this is a database connection error that we should retry
|
|
470
621
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
471
622
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -475,12 +626,22 @@ export const InstitutionalSentimentMetrics = {
|
|
|
475
626
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
476
627
|
retryCount++;
|
|
477
628
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
478
|
-
logger.warn("Database connection error, retrying..."
|
|
629
|
+
logger.warn("Database connection error in updateManyInstitutionalSentimentMetrics, retrying...", {
|
|
630
|
+
operation: 'updateManyInstitutionalSentimentMetrics',
|
|
631
|
+
model: 'InstitutionalSentimentMetrics',
|
|
632
|
+
attempt: retryCount,
|
|
633
|
+
maxRetries: MAX_RETRIES,
|
|
634
|
+
});
|
|
479
635
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
480
636
|
continue;
|
|
481
637
|
}
|
|
482
|
-
// Log
|
|
483
|
-
logger.error("Database
|
|
638
|
+
// Log structured error details and rethrow
|
|
639
|
+
logger.error("Database updateMany operation failed", {
|
|
640
|
+
operation: 'updateManyInstitutionalSentimentMetrics',
|
|
641
|
+
model: 'InstitutionalSentimentMetrics',
|
|
642
|
+
error: String(error),
|
|
643
|
+
isRetryable: isConnectionError,
|
|
644
|
+
});
|
|
484
645
|
throw error;
|
|
485
646
|
}
|
|
486
647
|
}
|
|
@@ -538,6 +699,31 @@ export const InstitutionalSentimentMetrics = {
|
|
|
538
699
|
}
|
|
539
700
|
catch (error) {
|
|
540
701
|
lastError = error;
|
|
702
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
703
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
704
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
705
|
+
error.message?.includes('violates unique constraint') ||
|
|
706
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
707
|
+
error.message?.includes('unique constraint') ||
|
|
708
|
+
error.message?.includes('23514') ||
|
|
709
|
+
error.message?.includes('23505') ||
|
|
710
|
+
error.message?.includes('23503') ||
|
|
711
|
+
error.message?.includes('P2002') ||
|
|
712
|
+
error.message?.includes('P2003') ||
|
|
713
|
+
error.message?.includes('P2014');
|
|
714
|
+
if (isConstraintViolation) {
|
|
715
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
716
|
+
logger.error("Non-retryable constraint violation in deleteOneInstitutionalSentimentMetrics", {
|
|
717
|
+
operation: 'deleteOneInstitutionalSentimentMetrics',
|
|
718
|
+
model: 'InstitutionalSentimentMetrics',
|
|
719
|
+
error: String(error),
|
|
720
|
+
recordId: props.id,
|
|
721
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
722
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
723
|
+
isRetryable: false,
|
|
724
|
+
});
|
|
725
|
+
throw error;
|
|
726
|
+
}
|
|
541
727
|
// Check if this is a database connection error that we should retry
|
|
542
728
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
543
729
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -547,12 +733,24 @@ export const InstitutionalSentimentMetrics = {
|
|
|
547
733
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
548
734
|
retryCount++;
|
|
549
735
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
550
|
-
logger.warn("Database connection error, retrying..."
|
|
736
|
+
logger.warn("Database connection error in deleteOneInstitutionalSentimentMetrics, retrying...", {
|
|
737
|
+
operation: 'deleteOneInstitutionalSentimentMetrics',
|
|
738
|
+
model: 'InstitutionalSentimentMetrics',
|
|
739
|
+
attempt: retryCount,
|
|
740
|
+
maxRetries: MAX_RETRIES,
|
|
741
|
+
recordId: props.id,
|
|
742
|
+
});
|
|
551
743
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
552
744
|
continue;
|
|
553
745
|
}
|
|
554
|
-
// Log
|
|
555
|
-
logger.error("Database
|
|
746
|
+
// Log structured error details and rethrow
|
|
747
|
+
logger.error("Database delete operation failed", {
|
|
748
|
+
operation: 'deleteOneInstitutionalSentimentMetrics',
|
|
749
|
+
model: 'InstitutionalSentimentMetrics',
|
|
750
|
+
error: String(error),
|
|
751
|
+
recordId: props.id,
|
|
752
|
+
isRetryable: isConnectionError,
|
|
753
|
+
});
|
|
556
754
|
throw error;
|
|
557
755
|
}
|
|
558
756
|
}
|
|
@@ -618,12 +816,22 @@ export const InstitutionalSentimentMetrics = {
|
|
|
618
816
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
619
817
|
retryCount++;
|
|
620
818
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
621
|
-
logger.warn("Database connection error, retrying..."
|
|
819
|
+
logger.warn("Database connection error in getInstitutionalSentimentMetrics, retrying...", {
|
|
820
|
+
operation: 'getInstitutionalSentimentMetrics',
|
|
821
|
+
model: 'InstitutionalSentimentMetrics',
|
|
822
|
+
attempt: retryCount,
|
|
823
|
+
maxRetries: MAX_RETRIES,
|
|
824
|
+
});
|
|
622
825
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
623
826
|
continue;
|
|
624
827
|
}
|
|
625
|
-
// Log
|
|
626
|
-
logger.error("Database
|
|
828
|
+
// Log structured error details and rethrow
|
|
829
|
+
logger.error("Database get operation failed", {
|
|
830
|
+
operation: 'getInstitutionalSentimentMetrics',
|
|
831
|
+
model: 'InstitutionalSentimentMetrics',
|
|
832
|
+
error: String(error),
|
|
833
|
+
isRetryable: isConnectionError,
|
|
834
|
+
});
|
|
627
835
|
throw error;
|
|
628
836
|
}
|
|
629
837
|
}
|
|
@@ -680,12 +888,22 @@ export const InstitutionalSentimentMetrics = {
|
|
|
680
888
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
681
889
|
retryCount++;
|
|
682
890
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
683
|
-
logger.warn("Database connection error, retrying..."
|
|
891
|
+
logger.warn("Database connection error in getAllInstitutionalSentimentMetrics, retrying...", {
|
|
892
|
+
operation: 'getAllInstitutionalSentimentMetrics',
|
|
893
|
+
model: 'InstitutionalSentimentMetrics',
|
|
894
|
+
attempt: retryCount,
|
|
895
|
+
maxRetries: MAX_RETRIES,
|
|
896
|
+
});
|
|
684
897
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
685
898
|
continue;
|
|
686
899
|
}
|
|
687
|
-
// Log
|
|
688
|
-
logger.error("Database
|
|
900
|
+
// Log structured error details and rethrow
|
|
901
|
+
logger.error("Database getAll operation failed", {
|
|
902
|
+
operation: 'getAllInstitutionalSentimentMetrics',
|
|
903
|
+
model: 'InstitutionalSentimentMetrics',
|
|
904
|
+
error: String(error),
|
|
905
|
+
isRetryable: isConnectionError,
|
|
906
|
+
});
|
|
689
907
|
throw error;
|
|
690
908
|
}
|
|
691
909
|
}
|
|
@@ -758,12 +976,22 @@ export const InstitutionalSentimentMetrics = {
|
|
|
758
976
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
759
977
|
retryCount++;
|
|
760
978
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
761
|
-
logger.warn("Database connection error, retrying..."
|
|
979
|
+
logger.warn("Database connection error in findManyInstitutionalSentimentMetrics, retrying...", {
|
|
980
|
+
operation: 'findManyInstitutionalSentimentMetrics',
|
|
981
|
+
model: 'InstitutionalSentimentMetrics',
|
|
982
|
+
attempt: retryCount,
|
|
983
|
+
maxRetries: MAX_RETRIES,
|
|
984
|
+
});
|
|
762
985
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
763
986
|
continue;
|
|
764
987
|
}
|
|
765
|
-
// Log
|
|
766
|
-
logger.error("Database
|
|
988
|
+
// Log structured error details and rethrow
|
|
989
|
+
logger.error("Database findMany operation failed", {
|
|
990
|
+
operation: 'findManyInstitutionalSentimentMetrics',
|
|
991
|
+
model: 'InstitutionalSentimentMetrics',
|
|
992
|
+
error: String(error),
|
|
993
|
+
isRetryable: isConnectionError,
|
|
994
|
+
});
|
|
767
995
|
throw error;
|
|
768
996
|
}
|
|
769
997
|
}
|
package/esm/InviteToken.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InviteToken.d.ts","sourceRoot":"","sources":["../../src/InviteToken.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAsK7G,eAAO,MAAM,WAAW;IAEtB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,eAAe,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"InviteToken.d.ts","sourceRoot":"","sources":["../../src/InviteToken.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAsK7G,eAAO,MAAM,WAAW;IAEtB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,eAAe,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAuXxH;;;;;;OAMG;sBACqB,eAAe,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAkHrI;;;;;;OAMG;kBACiB,eAAe,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAgoCtH;;;;;;OAMG;kBACiB,eAAe,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAq4CtH;;;;;;OAMG;sBACqB,eAAe,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA+nCrI;;;;;;OAMG;kBACiB,eAAe,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAmHtH;;;;;;;OAOG;eACc,eAAe,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAwF5I;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IA4EvG;;;;;;;OAOG;oBACmB,eAAe,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;CA6FpJ,CAAC"}
|