@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
|
@@ -71,6 +71,27 @@ export const ScheduledOptionOrder = {
|
|
|
71
71
|
}
|
|
72
72
|
catch (error) {
|
|
73
73
|
lastError = error;
|
|
74
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
75
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
76
|
+
error.message?.includes('violates unique constraint') ||
|
|
77
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
78
|
+
error.message?.includes('unique constraint') ||
|
|
79
|
+
error.message?.includes('23514') ||
|
|
80
|
+
error.message?.includes('23505') ||
|
|
81
|
+
error.message?.includes('P2002') ||
|
|
82
|
+
error.message?.includes('P2003');
|
|
83
|
+
if (isConstraintViolation) {
|
|
84
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
85
|
+
logger.error("Non-retryable constraint violation in createOneScheduledOptionOrder", {
|
|
86
|
+
operation: 'createOneScheduledOptionOrder',
|
|
87
|
+
model: 'ScheduledOptionOrder',
|
|
88
|
+
error: String(error),
|
|
89
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
90
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
91
|
+
isRetryable: false,
|
|
92
|
+
});
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
74
95
|
// Check if this is a database connection error that we should retry
|
|
75
96
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
76
97
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -80,12 +101,22 @@ export const ScheduledOptionOrder = {
|
|
|
80
101
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
81
102
|
retryCount++;
|
|
82
103
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
83
|
-
logger.warn("Database connection error, retrying..."
|
|
104
|
+
logger.warn("Database connection error in createOneScheduledOptionOrder, retrying...", {
|
|
105
|
+
operation: 'createOneScheduledOptionOrder',
|
|
106
|
+
model: 'ScheduledOptionOrder',
|
|
107
|
+
attempt: retryCount,
|
|
108
|
+
maxRetries: MAX_RETRIES,
|
|
109
|
+
});
|
|
84
110
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
85
111
|
continue;
|
|
86
112
|
}
|
|
87
|
-
// Log
|
|
88
|
-
logger.error("Database
|
|
113
|
+
// Log structured error details and rethrow
|
|
114
|
+
logger.error("Database create operation failed", {
|
|
115
|
+
operation: 'createOneScheduledOptionOrder',
|
|
116
|
+
model: 'ScheduledOptionOrder',
|
|
117
|
+
error: String(error),
|
|
118
|
+
isRetryable: isConnectionError,
|
|
119
|
+
});
|
|
89
120
|
throw error;
|
|
90
121
|
}
|
|
91
122
|
}
|
|
@@ -144,6 +175,27 @@ export const ScheduledOptionOrder = {
|
|
|
144
175
|
}
|
|
145
176
|
catch (error) {
|
|
146
177
|
lastError = error;
|
|
178
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
179
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
180
|
+
error.message?.includes('violates unique constraint') ||
|
|
181
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
182
|
+
error.message?.includes('unique constraint') ||
|
|
183
|
+
error.message?.includes('23514') ||
|
|
184
|
+
error.message?.includes('23505') ||
|
|
185
|
+
error.message?.includes('P2002') ||
|
|
186
|
+
error.message?.includes('P2003');
|
|
187
|
+
if (isConstraintViolation) {
|
|
188
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
189
|
+
logger.error("Non-retryable constraint violation in createManyScheduledOptionOrder", {
|
|
190
|
+
operation: 'createManyScheduledOptionOrder',
|
|
191
|
+
model: 'ScheduledOptionOrder',
|
|
192
|
+
error: String(error),
|
|
193
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
194
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
195
|
+
isRetryable: false,
|
|
196
|
+
});
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
147
199
|
// Check if this is a database connection error that we should retry
|
|
148
200
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
149
201
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -153,12 +205,22 @@ export const ScheduledOptionOrder = {
|
|
|
153
205
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
154
206
|
retryCount++;
|
|
155
207
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
156
|
-
logger.warn("Database connection error, retrying..."
|
|
208
|
+
logger.warn("Database connection error in createManyScheduledOptionOrder, retrying...", {
|
|
209
|
+
operation: 'createManyScheduledOptionOrder',
|
|
210
|
+
model: 'ScheduledOptionOrder',
|
|
211
|
+
attempt: retryCount,
|
|
212
|
+
maxRetries: MAX_RETRIES,
|
|
213
|
+
});
|
|
157
214
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
158
215
|
continue;
|
|
159
216
|
}
|
|
160
|
-
// Log
|
|
161
|
-
logger.error("Database
|
|
217
|
+
// Log structured error details and rethrow
|
|
218
|
+
logger.error("Database createMany operation failed", {
|
|
219
|
+
operation: 'createManyScheduledOptionOrder',
|
|
220
|
+
model: 'ScheduledOptionOrder',
|
|
221
|
+
error: String(error),
|
|
222
|
+
isRetryable: isConnectionError,
|
|
223
|
+
});
|
|
162
224
|
throw error;
|
|
163
225
|
}
|
|
164
226
|
}
|
|
@@ -227,6 +289,28 @@ export const ScheduledOptionOrder = {
|
|
|
227
289
|
}
|
|
228
290
|
catch (error) {
|
|
229
291
|
lastError = error;
|
|
292
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
293
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
294
|
+
error.message?.includes('violates unique constraint') ||
|
|
295
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
296
|
+
error.message?.includes('unique constraint') ||
|
|
297
|
+
error.message?.includes('23514') ||
|
|
298
|
+
error.message?.includes('23505') ||
|
|
299
|
+
error.message?.includes('P2002') ||
|
|
300
|
+
error.message?.includes('P2003');
|
|
301
|
+
if (isConstraintViolation) {
|
|
302
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
303
|
+
logger.error("Non-retryable constraint violation in updateOneScheduledOptionOrder", {
|
|
304
|
+
operation: 'updateOneScheduledOptionOrder',
|
|
305
|
+
model: 'ScheduledOptionOrder',
|
|
306
|
+
error: String(error),
|
|
307
|
+
recordId: props.id,
|
|
308
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
309
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
310
|
+
isRetryable: false,
|
|
311
|
+
});
|
|
312
|
+
throw error;
|
|
313
|
+
}
|
|
230
314
|
// Check if this is a database connection error that we should retry
|
|
231
315
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
232
316
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -236,12 +320,24 @@ export const ScheduledOptionOrder = {
|
|
|
236
320
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
237
321
|
retryCount++;
|
|
238
322
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
239
|
-
logger.warn("Database connection error, retrying..."
|
|
323
|
+
logger.warn("Database connection error in updateOneScheduledOptionOrder, retrying...", {
|
|
324
|
+
operation: 'updateOneScheduledOptionOrder',
|
|
325
|
+
model: 'ScheduledOptionOrder',
|
|
326
|
+
attempt: retryCount,
|
|
327
|
+
maxRetries: MAX_RETRIES,
|
|
328
|
+
recordId: props.id,
|
|
329
|
+
});
|
|
240
330
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
241
331
|
continue;
|
|
242
332
|
}
|
|
243
|
-
// Log
|
|
244
|
-
logger.error("Database
|
|
333
|
+
// Log structured error details and rethrow
|
|
334
|
+
logger.error("Database update operation failed", {
|
|
335
|
+
operation: 'updateOneScheduledOptionOrder',
|
|
336
|
+
model: 'ScheduledOptionOrder',
|
|
337
|
+
error: String(error),
|
|
338
|
+
recordId: props.id,
|
|
339
|
+
isRetryable: isConnectionError,
|
|
340
|
+
});
|
|
245
341
|
throw error;
|
|
246
342
|
}
|
|
247
343
|
}
|
|
@@ -311,6 +407,28 @@ export const ScheduledOptionOrder = {
|
|
|
311
407
|
}
|
|
312
408
|
catch (error) {
|
|
313
409
|
lastError = error;
|
|
410
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
411
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
412
|
+
error.message?.includes('violates unique constraint') ||
|
|
413
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
414
|
+
error.message?.includes('unique constraint') ||
|
|
415
|
+
error.message?.includes('23514') ||
|
|
416
|
+
error.message?.includes('23505') ||
|
|
417
|
+
error.message?.includes('P2002') ||
|
|
418
|
+
error.message?.includes('P2003');
|
|
419
|
+
if (isConstraintViolation) {
|
|
420
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
421
|
+
logger.error("Non-retryable constraint violation in upsertOneScheduledOptionOrder", {
|
|
422
|
+
operation: 'upsertOneScheduledOptionOrder',
|
|
423
|
+
model: 'ScheduledOptionOrder',
|
|
424
|
+
error: String(error),
|
|
425
|
+
recordId: props.id,
|
|
426
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
427
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
428
|
+
isRetryable: false,
|
|
429
|
+
});
|
|
430
|
+
throw error;
|
|
431
|
+
}
|
|
314
432
|
// Check if this is a database connection error that we should retry
|
|
315
433
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
316
434
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -320,12 +438,24 @@ export const ScheduledOptionOrder = {
|
|
|
320
438
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
321
439
|
retryCount++;
|
|
322
440
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
323
|
-
logger.warn("Database connection error, retrying..."
|
|
441
|
+
logger.warn("Database connection error in upsertOneScheduledOptionOrder, retrying...", {
|
|
442
|
+
operation: 'upsertOneScheduledOptionOrder',
|
|
443
|
+
model: 'ScheduledOptionOrder',
|
|
444
|
+
attempt: retryCount,
|
|
445
|
+
maxRetries: MAX_RETRIES,
|
|
446
|
+
recordId: props.id,
|
|
447
|
+
});
|
|
324
448
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
325
449
|
continue;
|
|
326
450
|
}
|
|
327
|
-
// Log
|
|
328
|
-
logger.error("Database
|
|
451
|
+
// Log structured error details and rethrow
|
|
452
|
+
logger.error("Database upsert operation failed", {
|
|
453
|
+
operation: 'upsertOneScheduledOptionOrder',
|
|
454
|
+
model: 'ScheduledOptionOrder',
|
|
455
|
+
error: String(error),
|
|
456
|
+
recordId: props.id,
|
|
457
|
+
isRetryable: isConnectionError,
|
|
458
|
+
});
|
|
329
459
|
throw error;
|
|
330
460
|
}
|
|
331
461
|
}
|
|
@@ -394,6 +524,27 @@ export const ScheduledOptionOrder = {
|
|
|
394
524
|
}
|
|
395
525
|
catch (error) {
|
|
396
526
|
lastError = error;
|
|
527
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
528
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
529
|
+
error.message?.includes('violates unique constraint') ||
|
|
530
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
531
|
+
error.message?.includes('unique constraint') ||
|
|
532
|
+
error.message?.includes('23514') ||
|
|
533
|
+
error.message?.includes('23505') ||
|
|
534
|
+
error.message?.includes('P2002') ||
|
|
535
|
+
error.message?.includes('P2003');
|
|
536
|
+
if (isConstraintViolation) {
|
|
537
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
538
|
+
logger.error("Non-retryable constraint violation in updateManyScheduledOptionOrder", {
|
|
539
|
+
operation: 'updateManyScheduledOptionOrder',
|
|
540
|
+
model: 'ScheduledOptionOrder',
|
|
541
|
+
error: String(error),
|
|
542
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
543
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
544
|
+
isRetryable: false,
|
|
545
|
+
});
|
|
546
|
+
throw error;
|
|
547
|
+
}
|
|
397
548
|
// Check if this is a database connection error that we should retry
|
|
398
549
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
399
550
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -403,12 +554,22 @@ export const ScheduledOptionOrder = {
|
|
|
403
554
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
404
555
|
retryCount++;
|
|
405
556
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
406
|
-
logger.warn("Database connection error, retrying..."
|
|
557
|
+
logger.warn("Database connection error in updateManyScheduledOptionOrder, retrying...", {
|
|
558
|
+
operation: 'updateManyScheduledOptionOrder',
|
|
559
|
+
model: 'ScheduledOptionOrder',
|
|
560
|
+
attempt: retryCount,
|
|
561
|
+
maxRetries: MAX_RETRIES,
|
|
562
|
+
});
|
|
407
563
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
408
564
|
continue;
|
|
409
565
|
}
|
|
410
|
-
// Log
|
|
411
|
-
logger.error("Database
|
|
566
|
+
// Log structured error details and rethrow
|
|
567
|
+
logger.error("Database updateMany operation failed", {
|
|
568
|
+
operation: 'updateManyScheduledOptionOrder',
|
|
569
|
+
model: 'ScheduledOptionOrder',
|
|
570
|
+
error: String(error),
|
|
571
|
+
isRetryable: isConnectionError,
|
|
572
|
+
});
|
|
412
573
|
throw error;
|
|
413
574
|
}
|
|
414
575
|
}
|
|
@@ -466,6 +627,31 @@ export const ScheduledOptionOrder = {
|
|
|
466
627
|
}
|
|
467
628
|
catch (error) {
|
|
468
629
|
lastError = error;
|
|
630
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
631
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
632
|
+
const isConstraintViolation = error.message?.includes('violates check constraint') ||
|
|
633
|
+
error.message?.includes('violates unique constraint') ||
|
|
634
|
+
error.message?.includes('violates foreign key constraint') ||
|
|
635
|
+
error.message?.includes('unique constraint') ||
|
|
636
|
+
error.message?.includes('23514') ||
|
|
637
|
+
error.message?.includes('23505') ||
|
|
638
|
+
error.message?.includes('23503') ||
|
|
639
|
+
error.message?.includes('P2002') ||
|
|
640
|
+
error.message?.includes('P2003') ||
|
|
641
|
+
error.message?.includes('P2014');
|
|
642
|
+
if (isConstraintViolation) {
|
|
643
|
+
const constraintMatch = error.message?.match(/constraint\s+"([^"]+)"/);
|
|
644
|
+
logger.error("Non-retryable constraint violation in deleteOneScheduledOptionOrder", {
|
|
645
|
+
operation: 'deleteOneScheduledOptionOrder',
|
|
646
|
+
model: 'ScheduledOptionOrder',
|
|
647
|
+
error: String(error),
|
|
648
|
+
recordId: props.id,
|
|
649
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
650
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
651
|
+
isRetryable: false,
|
|
652
|
+
});
|
|
653
|
+
throw error;
|
|
654
|
+
}
|
|
469
655
|
// Check if this is a database connection error that we should retry
|
|
470
656
|
const isConnectionError = error.message?.includes('Server has closed the connection') ||
|
|
471
657
|
error.message?.includes('Cannot reach database server') ||
|
|
@@ -475,12 +661,24 @@ export const ScheduledOptionOrder = {
|
|
|
475
661
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
476
662
|
retryCount++;
|
|
477
663
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
478
|
-
logger.warn("Database connection error, retrying..."
|
|
664
|
+
logger.warn("Database connection error in deleteOneScheduledOptionOrder, retrying...", {
|
|
665
|
+
operation: 'deleteOneScheduledOptionOrder',
|
|
666
|
+
model: 'ScheduledOptionOrder',
|
|
667
|
+
attempt: retryCount,
|
|
668
|
+
maxRetries: MAX_RETRIES,
|
|
669
|
+
recordId: props.id,
|
|
670
|
+
});
|
|
479
671
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
480
672
|
continue;
|
|
481
673
|
}
|
|
482
|
-
// Log
|
|
483
|
-
logger.error("Database
|
|
674
|
+
// Log structured error details and rethrow
|
|
675
|
+
logger.error("Database delete operation failed", {
|
|
676
|
+
operation: 'deleteOneScheduledOptionOrder',
|
|
677
|
+
model: 'ScheduledOptionOrder',
|
|
678
|
+
error: String(error),
|
|
679
|
+
recordId: props.id,
|
|
680
|
+
isRetryable: isConnectionError,
|
|
681
|
+
});
|
|
484
682
|
throw error;
|
|
485
683
|
}
|
|
486
684
|
}
|
|
@@ -546,12 +744,22 @@ export const ScheduledOptionOrder = {
|
|
|
546
744
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
547
745
|
retryCount++;
|
|
548
746
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
549
|
-
logger.warn("Database connection error, retrying..."
|
|
747
|
+
logger.warn("Database connection error in getScheduledOptionOrder, retrying...", {
|
|
748
|
+
operation: 'getScheduledOptionOrder',
|
|
749
|
+
model: 'ScheduledOptionOrder',
|
|
750
|
+
attempt: retryCount,
|
|
751
|
+
maxRetries: MAX_RETRIES,
|
|
752
|
+
});
|
|
550
753
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
551
754
|
continue;
|
|
552
755
|
}
|
|
553
|
-
// Log
|
|
554
|
-
logger.error("Database
|
|
756
|
+
// Log structured error details and rethrow
|
|
757
|
+
logger.error("Database get operation failed", {
|
|
758
|
+
operation: 'getScheduledOptionOrder',
|
|
759
|
+
model: 'ScheduledOptionOrder',
|
|
760
|
+
error: String(error),
|
|
761
|
+
isRetryable: isConnectionError,
|
|
762
|
+
});
|
|
555
763
|
throw error;
|
|
556
764
|
}
|
|
557
765
|
}
|
|
@@ -608,12 +816,22 @@ export const ScheduledOptionOrder = {
|
|
|
608
816
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
609
817
|
retryCount++;
|
|
610
818
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
611
|
-
logger.warn("Database connection error, retrying..."
|
|
819
|
+
logger.warn("Database connection error in getAllScheduledOptionOrder, retrying...", {
|
|
820
|
+
operation: 'getAllScheduledOptionOrder',
|
|
821
|
+
model: 'ScheduledOptionOrder',
|
|
822
|
+
attempt: retryCount,
|
|
823
|
+
maxRetries: MAX_RETRIES,
|
|
824
|
+
});
|
|
612
825
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
613
826
|
continue;
|
|
614
827
|
}
|
|
615
|
-
// Log
|
|
616
|
-
logger.error("Database
|
|
828
|
+
// Log structured error details and rethrow
|
|
829
|
+
logger.error("Database getAll operation failed", {
|
|
830
|
+
operation: 'getAllScheduledOptionOrder',
|
|
831
|
+
model: 'ScheduledOptionOrder',
|
|
832
|
+
error: String(error),
|
|
833
|
+
isRetryable: isConnectionError,
|
|
834
|
+
});
|
|
617
835
|
throw error;
|
|
618
836
|
}
|
|
619
837
|
}
|
|
@@ -686,12 +904,22 @@ export const ScheduledOptionOrder = {
|
|
|
686
904
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
687
905
|
retryCount++;
|
|
688
906
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
689
|
-
logger.warn("Database connection error, retrying..."
|
|
907
|
+
logger.warn("Database connection error in findManyScheduledOptionOrder, retrying...", {
|
|
908
|
+
operation: 'findManyScheduledOptionOrder',
|
|
909
|
+
model: 'ScheduledOptionOrder',
|
|
910
|
+
attempt: retryCount,
|
|
911
|
+
maxRetries: MAX_RETRIES,
|
|
912
|
+
});
|
|
690
913
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
691
914
|
continue;
|
|
692
915
|
}
|
|
693
|
-
// Log
|
|
694
|
-
logger.error("Database
|
|
916
|
+
// Log structured error details and rethrow
|
|
917
|
+
logger.error("Database findMany operation failed", {
|
|
918
|
+
operation: 'findManyScheduledOptionOrder',
|
|
919
|
+
model: 'ScheduledOptionOrder',
|
|
920
|
+
error: String(error),
|
|
921
|
+
isRetryable: isConnectionError,
|
|
922
|
+
});
|
|
695
923
|
throw error;
|
|
696
924
|
}
|
|
697
925
|
}
|
package/esm/Session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/Session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAqI7G,eAAO,MAAM,OAAO;IAElB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,WAAW,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/Session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAA4B,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,UAAU,CAAC;AAqI7G,eAAO,MAAM,OAAO;IAElB;;;;;OAKG;IAEH;;;;;;OAMG;kBACiB,WAAW,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IA+ahH;;;;;;OAMG;sBACqB,WAAW,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA+GjI;;;;;;OAMG;kBACiB,WAAW,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IA2rC9G;;;;;;OAMG;kBACiB,WAAW,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAq/C9G;;;;;;OAMG;sBACqB,WAAW,EAAE,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA0rCjI;;;;;;OAMG;kBACiB,WAAW,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAmH9G;;;;;;;OAOG;eACc,WAAW,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAuFpI;;;;;OAKG;0BACyB,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;IA4EnG;;;;;;;OAOG;oBACmB,WAAW,iBAAiB,gBAAgB,CAAC,qBAAqB,CAAC,eAAe,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;CA6F5I,CAAC"}
|