@adaptic/backend-legacy 0.0.903 → 0.0.905
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ABTest.cjs +291 -63
- package/Account.cjs +291 -63
- package/AccountLinkingRequest.cjs +291 -63
- package/Action.cjs +291 -63
- package/Alert.cjs +291 -63
- package/Allocation.cjs +291 -63
- package/AlpacaAccount.cjs +291 -63
- package/AnalyticsConfiguration.cjs +291 -63
- package/AnalyticsSnapshot.cjs +291 -63
- package/Asset.cjs +291 -63
- package/AuditLog.cjs +291 -63
- package/Authenticator.cjs +291 -63
- package/Configuration.cjs +291 -63
- package/ConflictEvent.cjs +291 -63
- package/ConnectionHealthSnapshot.cjs +291 -63
- package/Customer.cjs +291 -63
- package/DeadLetterMessage.cjs +291 -63
- package/EconomicEvent.cjs +291 -63
- package/Event.cjs +291 -63
- package/EventSnapshot.cjs +291 -63
- package/FeatureImportanceAnalysis.cjs +291 -63
- package/InstitutionalFlowSignal.cjs +291 -63
- package/InstitutionalHolding.cjs +291 -63
- package/InstitutionalSentimentAlerts.cjs +291 -63
- package/InstitutionalSentimentErrors.cjs +291 -63
- package/InstitutionalSentimentHistory.cjs +291 -63
- package/InstitutionalSentimentMetrics.cjs +291 -63
- package/InviteToken.cjs +291 -63
- package/LinkedProvider.cjs +291 -63
- package/MLTrainingData.cjs +291 -63
- package/MarketSentiment.cjs +291 -63
- package/ModelArtifact.cjs +291 -63
- package/ModelVersion.cjs +291 -63
- package/ModelVersionArtifact.cjs +291 -63
- package/NewsArticle.cjs +291 -63
- package/NewsArticleAssetSentiment.cjs +291 -63
- package/OptionsContract.cjs +291 -63
- package/OptionsGreeksHistory.cjs +291 -63
- package/OptionsPosition.cjs +291 -63
- package/OptionsTradeExecution.cjs +291 -63
- package/PortfolioGreeksHistory.cjs +291 -63
- package/ScheduledOptionOrder.cjs +291 -63
- package/Session.cjs +291 -63
- package/SignalGeneratorMetrics.cjs +291 -63
- package/SignalLineage.cjs +291 -63
- package/SignalOutcome.cjs +291 -63
- package/SignalPriorityQueue.cjs +291 -63
- package/SyncEvent.cjs +291 -63
- package/SystemAlert.cjs +291 -63
- package/Trade.cjs +291 -63
- package/TradeAuditEvent.cjs +291 -63
- package/TradeExecutionHistory.cjs +291 -63
- package/User.cjs +291 -63
- package/VerificationToken.cjs +291 -63
- package/WaitlistEntry.cjs +291 -63
- package/esm/ABTest.d.ts.map +1 -1
- package/esm/ABTest.js.map +1 -1
- package/esm/ABTest.mjs +255 -27
- package/esm/Account.d.ts.map +1 -1
- package/esm/Account.js.map +1 -1
- package/esm/Account.mjs +255 -27
- package/esm/AccountLinkingRequest.d.ts.map +1 -1
- package/esm/AccountLinkingRequest.js.map +1 -1
- package/esm/AccountLinkingRequest.mjs +255 -27
- package/esm/Action.d.ts.map +1 -1
- package/esm/Action.js.map +1 -1
- package/esm/Action.mjs +255 -27
- package/esm/Alert.d.ts.map +1 -1
- package/esm/Alert.js.map +1 -1
- package/esm/Alert.mjs +255 -27
- package/esm/Allocation.d.ts.map +1 -1
- package/esm/Allocation.js.map +1 -1
- package/esm/Allocation.mjs +255 -27
- package/esm/AlpacaAccount.d.ts.map +1 -1
- package/esm/AlpacaAccount.js.map +1 -1
- package/esm/AlpacaAccount.mjs +255 -27
- package/esm/AnalyticsConfiguration.d.ts.map +1 -1
- package/esm/AnalyticsConfiguration.js.map +1 -1
- package/esm/AnalyticsConfiguration.mjs +255 -27
- package/esm/AnalyticsSnapshot.d.ts.map +1 -1
- package/esm/AnalyticsSnapshot.js.map +1 -1
- package/esm/AnalyticsSnapshot.mjs +255 -27
- package/esm/Asset.d.ts.map +1 -1
- package/esm/Asset.js.map +1 -1
- package/esm/Asset.mjs +255 -27
- package/esm/AuditLog.d.ts.map +1 -1
- package/esm/AuditLog.js.map +1 -1
- package/esm/AuditLog.mjs +255 -27
- package/esm/Authenticator.d.ts.map +1 -1
- package/esm/Authenticator.js.map +1 -1
- package/esm/Authenticator.mjs +255 -27
- package/esm/Configuration.d.ts.map +1 -1
- package/esm/Configuration.js.map +1 -1
- package/esm/Configuration.mjs +255 -27
- package/esm/ConflictEvent.d.ts.map +1 -1
- package/esm/ConflictEvent.js.map +1 -1
- package/esm/ConflictEvent.mjs +255 -27
- package/esm/ConnectionHealthSnapshot.d.ts.map +1 -1
- package/esm/ConnectionHealthSnapshot.js.map +1 -1
- package/esm/ConnectionHealthSnapshot.mjs +255 -27
- package/esm/Customer.d.ts.map +1 -1
- package/esm/Customer.js.map +1 -1
- package/esm/Customer.mjs +255 -27
- package/esm/DeadLetterMessage.d.ts.map +1 -1
- package/esm/DeadLetterMessage.js.map +1 -1
- package/esm/DeadLetterMessage.mjs +255 -27
- package/esm/EconomicEvent.d.ts.map +1 -1
- package/esm/EconomicEvent.js.map +1 -1
- package/esm/EconomicEvent.mjs +255 -27
- package/esm/Event.d.ts.map +1 -1
- package/esm/Event.js.map +1 -1
- package/esm/Event.mjs +255 -27
- package/esm/EventSnapshot.d.ts.map +1 -1
- package/esm/EventSnapshot.js.map +1 -1
- package/esm/EventSnapshot.mjs +255 -27
- package/esm/FeatureImportanceAnalysis.d.ts.map +1 -1
- package/esm/FeatureImportanceAnalysis.js.map +1 -1
- package/esm/FeatureImportanceAnalysis.mjs +255 -27
- package/esm/InstitutionalFlowSignal.d.ts.map +1 -1
- package/esm/InstitutionalFlowSignal.js.map +1 -1
- package/esm/InstitutionalFlowSignal.mjs +255 -27
- package/esm/InstitutionalHolding.d.ts.map +1 -1
- package/esm/InstitutionalHolding.js.map +1 -1
- package/esm/InstitutionalHolding.mjs +255 -27
- package/esm/InstitutionalSentimentAlerts.d.ts.map +1 -1
- package/esm/InstitutionalSentimentAlerts.js.map +1 -1
- package/esm/InstitutionalSentimentAlerts.mjs +255 -27
- package/esm/InstitutionalSentimentErrors.d.ts.map +1 -1
- package/esm/InstitutionalSentimentErrors.js.map +1 -1
- package/esm/InstitutionalSentimentErrors.mjs +255 -27
- package/esm/InstitutionalSentimentHistory.d.ts.map +1 -1
- package/esm/InstitutionalSentimentHistory.js.map +1 -1
- package/esm/InstitutionalSentimentHistory.mjs +255 -27
- package/esm/InstitutionalSentimentMetrics.d.ts.map +1 -1
- package/esm/InstitutionalSentimentMetrics.js.map +1 -1
- package/esm/InstitutionalSentimentMetrics.mjs +255 -27
- package/esm/InviteToken.d.ts.map +1 -1
- package/esm/InviteToken.js.map +1 -1
- package/esm/InviteToken.mjs +255 -27
- package/esm/LinkedProvider.d.ts.map +1 -1
- package/esm/LinkedProvider.js.map +1 -1
- package/esm/LinkedProvider.mjs +255 -27
- package/esm/MLTrainingData.d.ts.map +1 -1
- package/esm/MLTrainingData.js.map +1 -1
- package/esm/MLTrainingData.mjs +255 -27
- package/esm/MarketSentiment.d.ts.map +1 -1
- package/esm/MarketSentiment.js.map +1 -1
- package/esm/MarketSentiment.mjs +255 -27
- package/esm/ModelArtifact.d.ts.map +1 -1
- package/esm/ModelArtifact.js.map +1 -1
- package/esm/ModelArtifact.mjs +255 -27
- package/esm/ModelVersion.d.ts.map +1 -1
- package/esm/ModelVersion.js.map +1 -1
- package/esm/ModelVersion.mjs +255 -27
- package/esm/ModelVersionArtifact.d.ts.map +1 -1
- package/esm/ModelVersionArtifact.js.map +1 -1
- package/esm/ModelVersionArtifact.mjs +255 -27
- package/esm/NewsArticle.d.ts.map +1 -1
- package/esm/NewsArticle.js.map +1 -1
- package/esm/NewsArticle.mjs +255 -27
- package/esm/NewsArticleAssetSentiment.d.ts.map +1 -1
- package/esm/NewsArticleAssetSentiment.js.map +1 -1
- package/esm/NewsArticleAssetSentiment.mjs +255 -27
- package/esm/OptionsContract.d.ts.map +1 -1
- package/esm/OptionsContract.js.map +1 -1
- package/esm/OptionsContract.mjs +255 -27
- package/esm/OptionsGreeksHistory.d.ts.map +1 -1
- package/esm/OptionsGreeksHistory.js.map +1 -1
- package/esm/OptionsGreeksHistory.mjs +255 -27
- package/esm/OptionsPosition.d.ts.map +1 -1
- package/esm/OptionsPosition.js.map +1 -1
- package/esm/OptionsPosition.mjs +255 -27
- package/esm/OptionsTradeExecution.d.ts.map +1 -1
- package/esm/OptionsTradeExecution.js.map +1 -1
- package/esm/OptionsTradeExecution.mjs +255 -27
- package/esm/PortfolioGreeksHistory.d.ts.map +1 -1
- package/esm/PortfolioGreeksHistory.js.map +1 -1
- package/esm/PortfolioGreeksHistory.mjs +255 -27
- package/esm/ScheduledOptionOrder.d.ts.map +1 -1
- package/esm/ScheduledOptionOrder.js.map +1 -1
- package/esm/ScheduledOptionOrder.mjs +255 -27
- package/esm/Session.d.ts.map +1 -1
- package/esm/Session.js.map +1 -1
- package/esm/Session.mjs +255 -27
- package/esm/SignalGeneratorMetrics.d.ts.map +1 -1
- package/esm/SignalGeneratorMetrics.js.map +1 -1
- package/esm/SignalGeneratorMetrics.mjs +255 -27
- package/esm/SignalLineage.d.ts.map +1 -1
- package/esm/SignalLineage.js.map +1 -1
- package/esm/SignalLineage.mjs +255 -27
- package/esm/SignalOutcome.d.ts.map +1 -1
- package/esm/SignalOutcome.js.map +1 -1
- package/esm/SignalOutcome.mjs +255 -27
- package/esm/SignalPriorityQueue.d.ts.map +1 -1
- package/esm/SignalPriorityQueue.js.map +1 -1
- package/esm/SignalPriorityQueue.mjs +255 -27
- package/esm/SyncEvent.d.ts.map +1 -1
- package/esm/SyncEvent.js.map +1 -1
- package/esm/SyncEvent.mjs +255 -27
- package/esm/SystemAlert.d.ts.map +1 -1
- package/esm/SystemAlert.js.map +1 -1
- package/esm/SystemAlert.mjs +255 -27
- package/esm/Trade.d.ts.map +1 -1
- package/esm/Trade.js.map +1 -1
- package/esm/Trade.mjs +255 -27
- package/esm/TradeAuditEvent.d.ts.map +1 -1
- package/esm/TradeAuditEvent.js.map +1 -1
- package/esm/TradeAuditEvent.mjs +255 -27
- package/esm/TradeExecutionHistory.d.ts.map +1 -1
- package/esm/TradeExecutionHistory.js.map +1 -1
- package/esm/TradeExecutionHistory.mjs +255 -27
- package/esm/User.d.ts.map +1 -1
- package/esm/User.js.map +1 -1
- package/esm/User.mjs +255 -27
- package/esm/VerificationToken.d.ts.map +1 -1
- package/esm/VerificationToken.js.map +1 -1
- package/esm/VerificationToken.mjs +255 -27
- package/esm/WaitlistEntry.d.ts.map +1 -1
- package/esm/WaitlistEntry.js.map +1 -1
- package/esm/WaitlistEntry.mjs +255 -27
- package/esm/middleware/audit-logger.d.ts +0 -7
- package/esm/middleware/audit-logger.d.ts.map +1 -1
- package/esm/middleware/audit-logger.js.map +1 -1
- package/esm/middleware/audit-logger.mjs +5 -3
- package/esm/prismaClient.d.ts.map +1 -1
- package/esm/prismaClient.js.map +1 -1
- package/esm/prismaClient.mjs +38 -9
- package/package.json +1 -1
- package/prismaClient.cjs +38 -9
package/SignalOutcome.cjs
CHANGED
|
@@ -41,7 +41,7 @@ exports.SignalOutcome = {
|
|
|
41
41
|
* @returns The created SignalOutcome or null.
|
|
42
42
|
*/
|
|
43
43
|
async create(props, globalClient) {
|
|
44
|
-
var _a, _b, _c, _d, _e;
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
45
45
|
// Maximum number of retries for database connection issues
|
|
46
46
|
const MAX_RETRIES = 3;
|
|
47
47
|
let retryCount = 0;
|
|
@@ -96,21 +96,52 @@ exports.SignalOutcome = {
|
|
|
96
96
|
}
|
|
97
97
|
catch (error) {
|
|
98
98
|
lastError = error;
|
|
99
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
100
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
101
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
102
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
103
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
104
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
105
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
106
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
107
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
108
|
+
if (isConstraintViolation) {
|
|
109
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
110
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneSignalOutcome", {
|
|
111
|
+
operation: 'createOneSignalOutcome',
|
|
112
|
+
model: 'SignalOutcome',
|
|
113
|
+
error: String(error),
|
|
114
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
115
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
116
|
+
isRetryable: false,
|
|
117
|
+
});
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
99
120
|
// Check if this is a database connection error that we should retry
|
|
100
|
-
const isConnectionError = ((
|
|
101
|
-
((
|
|
102
|
-
((
|
|
103
|
-
((
|
|
104
|
-
(error.networkError && ((
|
|
121
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
122
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
123
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
124
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
125
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
105
126
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
106
127
|
retryCount++;
|
|
107
128
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
108
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
129
|
+
logger_1.logger.warn("Database connection error in createOneSignalOutcome, retrying...", {
|
|
130
|
+
operation: 'createOneSignalOutcome',
|
|
131
|
+
model: 'SignalOutcome',
|
|
132
|
+
attempt: retryCount,
|
|
133
|
+
maxRetries: MAX_RETRIES,
|
|
134
|
+
});
|
|
109
135
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
110
136
|
continue;
|
|
111
137
|
}
|
|
112
|
-
// Log
|
|
113
|
-
logger_1.logger.error("Database
|
|
138
|
+
// Log structured error details and rethrow
|
|
139
|
+
logger_1.logger.error("Database create operation failed", {
|
|
140
|
+
operation: 'createOneSignalOutcome',
|
|
141
|
+
model: 'SignalOutcome',
|
|
142
|
+
error: String(error),
|
|
143
|
+
isRetryable: isConnectionError,
|
|
144
|
+
});
|
|
114
145
|
throw error;
|
|
115
146
|
}
|
|
116
147
|
}
|
|
@@ -125,7 +156,7 @@ exports.SignalOutcome = {
|
|
|
125
156
|
* @returns The count of created records or null.
|
|
126
157
|
*/
|
|
127
158
|
async createMany(props, globalClient) {
|
|
128
|
-
var _a, _b, _c, _d, _e;
|
|
159
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
129
160
|
// Maximum number of retries for database connection issues
|
|
130
161
|
const MAX_RETRIES = 3;
|
|
131
162
|
let retryCount = 0;
|
|
@@ -179,21 +210,52 @@ exports.SignalOutcome = {
|
|
|
179
210
|
}
|
|
180
211
|
catch (error) {
|
|
181
212
|
lastError = error;
|
|
213
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
214
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
215
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
216
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
217
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
218
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
219
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
220
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
221
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
222
|
+
if (isConstraintViolation) {
|
|
223
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
224
|
+
logger_1.logger.error("Non-retryable constraint violation in createManySignalOutcome", {
|
|
225
|
+
operation: 'createManySignalOutcome',
|
|
226
|
+
model: 'SignalOutcome',
|
|
227
|
+
error: String(error),
|
|
228
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
229
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
230
|
+
isRetryable: false,
|
|
231
|
+
});
|
|
232
|
+
throw error;
|
|
233
|
+
}
|
|
182
234
|
// Check if this is a database connection error that we should retry
|
|
183
|
-
const isConnectionError = ((
|
|
184
|
-
((
|
|
185
|
-
((
|
|
186
|
-
((
|
|
187
|
-
(error.networkError && ((
|
|
235
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
236
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
237
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
238
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
239
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
188
240
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
189
241
|
retryCount++;
|
|
190
242
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
191
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
243
|
+
logger_1.logger.warn("Database connection error in createManySignalOutcome, retrying...", {
|
|
244
|
+
operation: 'createManySignalOutcome',
|
|
245
|
+
model: 'SignalOutcome',
|
|
246
|
+
attempt: retryCount,
|
|
247
|
+
maxRetries: MAX_RETRIES,
|
|
248
|
+
});
|
|
192
249
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
193
250
|
continue;
|
|
194
251
|
}
|
|
195
|
-
// Log
|
|
196
|
-
logger_1.logger.error("Database
|
|
252
|
+
// Log structured error details and rethrow
|
|
253
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
254
|
+
operation: 'createManySignalOutcome',
|
|
255
|
+
model: 'SignalOutcome',
|
|
256
|
+
error: String(error),
|
|
257
|
+
isRetryable: isConnectionError,
|
|
258
|
+
});
|
|
197
259
|
throw error;
|
|
198
260
|
}
|
|
199
261
|
}
|
|
@@ -208,7 +270,7 @@ exports.SignalOutcome = {
|
|
|
208
270
|
* @returns The updated SignalOutcome or null.
|
|
209
271
|
*/
|
|
210
272
|
async update(props, globalClient) {
|
|
211
|
-
var _a, _b, _c, _d, _e;
|
|
273
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
212
274
|
// Maximum number of retries for database connection issues
|
|
213
275
|
const MAX_RETRIES = 3;
|
|
214
276
|
let retryCount = 0;
|
|
@@ -305,21 +367,55 @@ exports.SignalOutcome = {
|
|
|
305
367
|
}
|
|
306
368
|
catch (error) {
|
|
307
369
|
lastError = error;
|
|
370
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
371
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
372
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
373
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
374
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
375
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
376
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
377
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
378
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
379
|
+
if (isConstraintViolation) {
|
|
380
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
381
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneSignalOutcome", {
|
|
382
|
+
operation: 'updateOneSignalOutcome',
|
|
383
|
+
model: 'SignalOutcome',
|
|
384
|
+
error: String(error),
|
|
385
|
+
recordId: props.id,
|
|
386
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
387
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
388
|
+
isRetryable: false,
|
|
389
|
+
});
|
|
390
|
+
throw error;
|
|
391
|
+
}
|
|
308
392
|
// Check if this is a database connection error that we should retry
|
|
309
|
-
const isConnectionError = ((
|
|
310
|
-
((
|
|
311
|
-
((
|
|
312
|
-
((
|
|
313
|
-
(error.networkError && ((
|
|
393
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
394
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
395
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
396
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
397
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
314
398
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
315
399
|
retryCount++;
|
|
316
400
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
317
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
401
|
+
logger_1.logger.warn("Database connection error in updateOneSignalOutcome, retrying...", {
|
|
402
|
+
operation: 'updateOneSignalOutcome',
|
|
403
|
+
model: 'SignalOutcome',
|
|
404
|
+
attempt: retryCount,
|
|
405
|
+
maxRetries: MAX_RETRIES,
|
|
406
|
+
recordId: props.id,
|
|
407
|
+
});
|
|
318
408
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
319
409
|
continue;
|
|
320
410
|
}
|
|
321
|
-
// Log
|
|
322
|
-
logger_1.logger.error("Database
|
|
411
|
+
// Log structured error details and rethrow
|
|
412
|
+
logger_1.logger.error("Database update operation failed", {
|
|
413
|
+
operation: 'updateOneSignalOutcome',
|
|
414
|
+
model: 'SignalOutcome',
|
|
415
|
+
error: String(error),
|
|
416
|
+
recordId: props.id,
|
|
417
|
+
isRetryable: isConnectionError,
|
|
418
|
+
});
|
|
323
419
|
throw error;
|
|
324
420
|
}
|
|
325
421
|
}
|
|
@@ -334,7 +430,7 @@ exports.SignalOutcome = {
|
|
|
334
430
|
* @returns The updated SignalOutcome or null.
|
|
335
431
|
*/
|
|
336
432
|
async upsert(props, globalClient) {
|
|
337
|
-
var _a, _b, _c, _d, _e;
|
|
433
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
338
434
|
// Maximum number of retries for database connection issues
|
|
339
435
|
const MAX_RETRIES = 3;
|
|
340
436
|
let retryCount = 0;
|
|
@@ -441,21 +537,55 @@ exports.SignalOutcome = {
|
|
|
441
537
|
}
|
|
442
538
|
catch (error) {
|
|
443
539
|
lastError = error;
|
|
540
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
541
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
542
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
543
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
544
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
545
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
546
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
547
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
548
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
549
|
+
if (isConstraintViolation) {
|
|
550
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
551
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneSignalOutcome", {
|
|
552
|
+
operation: 'upsertOneSignalOutcome',
|
|
553
|
+
model: 'SignalOutcome',
|
|
554
|
+
error: String(error),
|
|
555
|
+
recordId: props.id,
|
|
556
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
557
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
558
|
+
isRetryable: false,
|
|
559
|
+
});
|
|
560
|
+
throw error;
|
|
561
|
+
}
|
|
444
562
|
// Check if this is a database connection error that we should retry
|
|
445
|
-
const isConnectionError = ((
|
|
446
|
-
((
|
|
447
|
-
((
|
|
448
|
-
((
|
|
449
|
-
(error.networkError && ((
|
|
563
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
564
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
565
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
566
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
567
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
450
568
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
451
569
|
retryCount++;
|
|
452
570
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
453
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
571
|
+
logger_1.logger.warn("Database connection error in upsertOneSignalOutcome, retrying...", {
|
|
572
|
+
operation: 'upsertOneSignalOutcome',
|
|
573
|
+
model: 'SignalOutcome',
|
|
574
|
+
attempt: retryCount,
|
|
575
|
+
maxRetries: MAX_RETRIES,
|
|
576
|
+
recordId: props.id,
|
|
577
|
+
});
|
|
454
578
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
455
579
|
continue;
|
|
456
580
|
}
|
|
457
|
-
// Log
|
|
458
|
-
logger_1.logger.error("Database
|
|
581
|
+
// Log structured error details and rethrow
|
|
582
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
583
|
+
operation: 'upsertOneSignalOutcome',
|
|
584
|
+
model: 'SignalOutcome',
|
|
585
|
+
error: String(error),
|
|
586
|
+
recordId: props.id,
|
|
587
|
+
isRetryable: isConnectionError,
|
|
588
|
+
});
|
|
459
589
|
throw error;
|
|
460
590
|
}
|
|
461
591
|
}
|
|
@@ -470,7 +600,7 @@ exports.SignalOutcome = {
|
|
|
470
600
|
* @returns The count of created records or null.
|
|
471
601
|
*/
|
|
472
602
|
async updateMany(props, globalClient) {
|
|
473
|
-
var _a, _b, _c, _d, _e;
|
|
603
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
474
604
|
// Maximum number of retries for database connection issues
|
|
475
605
|
const MAX_RETRIES = 3;
|
|
476
606
|
let retryCount = 0;
|
|
@@ -567,21 +697,52 @@ exports.SignalOutcome = {
|
|
|
567
697
|
}
|
|
568
698
|
catch (error) {
|
|
569
699
|
lastError = error;
|
|
700
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
701
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
702
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
703
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
704
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
705
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
706
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
707
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
708
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
709
|
+
if (isConstraintViolation) {
|
|
710
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
711
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManySignalOutcome", {
|
|
712
|
+
operation: 'updateManySignalOutcome',
|
|
713
|
+
model: 'SignalOutcome',
|
|
714
|
+
error: String(error),
|
|
715
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
716
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
717
|
+
isRetryable: false,
|
|
718
|
+
});
|
|
719
|
+
throw error;
|
|
720
|
+
}
|
|
570
721
|
// Check if this is a database connection error that we should retry
|
|
571
|
-
const isConnectionError = ((
|
|
572
|
-
((
|
|
573
|
-
((
|
|
574
|
-
((
|
|
575
|
-
(error.networkError && ((
|
|
722
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
723
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
724
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
725
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
726
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
576
727
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
577
728
|
retryCount++;
|
|
578
729
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
579
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
730
|
+
logger_1.logger.warn("Database connection error in updateManySignalOutcome, retrying...", {
|
|
731
|
+
operation: 'updateManySignalOutcome',
|
|
732
|
+
model: 'SignalOutcome',
|
|
733
|
+
attempt: retryCount,
|
|
734
|
+
maxRetries: MAX_RETRIES,
|
|
735
|
+
});
|
|
580
736
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
581
737
|
continue;
|
|
582
738
|
}
|
|
583
|
-
// Log
|
|
584
|
-
logger_1.logger.error("Database
|
|
739
|
+
// Log structured error details and rethrow
|
|
740
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
741
|
+
operation: 'updateManySignalOutcome',
|
|
742
|
+
model: 'SignalOutcome',
|
|
743
|
+
error: String(error),
|
|
744
|
+
isRetryable: isConnectionError,
|
|
745
|
+
});
|
|
585
746
|
throw error;
|
|
586
747
|
}
|
|
587
748
|
}
|
|
@@ -596,7 +757,7 @@ exports.SignalOutcome = {
|
|
|
596
757
|
* @returns The deleted SignalOutcome or null.
|
|
597
758
|
*/
|
|
598
759
|
async delete(props, globalClient) {
|
|
599
|
-
var _a, _b, _c, _d, _e;
|
|
760
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
600
761
|
// Maximum number of retries for database connection issues
|
|
601
762
|
const MAX_RETRIES = 3;
|
|
602
763
|
let retryCount = 0;
|
|
@@ -640,21 +801,58 @@ exports.SignalOutcome = {
|
|
|
640
801
|
}
|
|
641
802
|
catch (error) {
|
|
642
803
|
lastError = error;
|
|
804
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
805
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
806
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
807
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
808
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
809
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
810
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
811
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
812
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
813
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
814
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
815
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
816
|
+
if (isConstraintViolation) {
|
|
817
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
818
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneSignalOutcome", {
|
|
819
|
+
operation: 'deleteOneSignalOutcome',
|
|
820
|
+
model: 'SignalOutcome',
|
|
821
|
+
error: String(error),
|
|
822
|
+
recordId: props.id,
|
|
823
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
824
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
825
|
+
isRetryable: false,
|
|
826
|
+
});
|
|
827
|
+
throw error;
|
|
828
|
+
}
|
|
643
829
|
// Check if this is a database connection error that we should retry
|
|
644
|
-
const isConnectionError = ((
|
|
645
|
-
((
|
|
646
|
-
((
|
|
647
|
-
((
|
|
648
|
-
(error.networkError && ((
|
|
830
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
831
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
832
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
833
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
834
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
649
835
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
650
836
|
retryCount++;
|
|
651
837
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
652
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
838
|
+
logger_1.logger.warn("Database connection error in deleteOneSignalOutcome, retrying...", {
|
|
839
|
+
operation: 'deleteOneSignalOutcome',
|
|
840
|
+
model: 'SignalOutcome',
|
|
841
|
+
attempt: retryCount,
|
|
842
|
+
maxRetries: MAX_RETRIES,
|
|
843
|
+
recordId: props.id,
|
|
844
|
+
});
|
|
653
845
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
654
846
|
continue;
|
|
655
847
|
}
|
|
656
|
-
// Log
|
|
657
|
-
logger_1.logger.error("Database
|
|
848
|
+
// Log structured error details and rethrow
|
|
849
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
850
|
+
operation: 'deleteOneSignalOutcome',
|
|
851
|
+
model: 'SignalOutcome',
|
|
852
|
+
error: String(error),
|
|
853
|
+
recordId: props.id,
|
|
854
|
+
isRetryable: isConnectionError,
|
|
855
|
+
});
|
|
658
856
|
throw error;
|
|
659
857
|
}
|
|
660
858
|
}
|
|
@@ -727,12 +925,22 @@ exports.SignalOutcome = {
|
|
|
727
925
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
728
926
|
retryCount++;
|
|
729
927
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
730
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
928
|
+
logger_1.logger.warn("Database connection error in getSignalOutcome, retrying...", {
|
|
929
|
+
operation: 'getSignalOutcome',
|
|
930
|
+
model: 'SignalOutcome',
|
|
931
|
+
attempt: retryCount,
|
|
932
|
+
maxRetries: MAX_RETRIES,
|
|
933
|
+
});
|
|
731
934
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
732
935
|
continue;
|
|
733
936
|
}
|
|
734
|
-
// Log
|
|
735
|
-
logger_1.logger.error("Database
|
|
937
|
+
// Log structured error details and rethrow
|
|
938
|
+
logger_1.logger.error("Database get operation failed", {
|
|
939
|
+
operation: 'getSignalOutcome',
|
|
940
|
+
model: 'SignalOutcome',
|
|
941
|
+
error: String(error),
|
|
942
|
+
isRetryable: isConnectionError,
|
|
943
|
+
});
|
|
736
944
|
throw error;
|
|
737
945
|
}
|
|
738
946
|
}
|
|
@@ -790,12 +998,22 @@ exports.SignalOutcome = {
|
|
|
790
998
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
791
999
|
retryCount++;
|
|
792
1000
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
793
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1001
|
+
logger_1.logger.warn("Database connection error in getAllSignalOutcome, retrying...", {
|
|
1002
|
+
operation: 'getAllSignalOutcome',
|
|
1003
|
+
model: 'SignalOutcome',
|
|
1004
|
+
attempt: retryCount,
|
|
1005
|
+
maxRetries: MAX_RETRIES,
|
|
1006
|
+
});
|
|
794
1007
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
795
1008
|
continue;
|
|
796
1009
|
}
|
|
797
|
-
// Log
|
|
798
|
-
logger_1.logger.error("Database
|
|
1010
|
+
// Log structured error details and rethrow
|
|
1011
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
1012
|
+
operation: 'getAllSignalOutcome',
|
|
1013
|
+
model: 'SignalOutcome',
|
|
1014
|
+
error: String(error),
|
|
1015
|
+
isRetryable: isConnectionError,
|
|
1016
|
+
});
|
|
799
1017
|
throw error;
|
|
800
1018
|
}
|
|
801
1019
|
}
|
|
@@ -875,12 +1093,22 @@ exports.SignalOutcome = {
|
|
|
875
1093
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
876
1094
|
retryCount++;
|
|
877
1095
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
878
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1096
|
+
logger_1.logger.warn("Database connection error in findManySignalOutcome, retrying...", {
|
|
1097
|
+
operation: 'findManySignalOutcome',
|
|
1098
|
+
model: 'SignalOutcome',
|
|
1099
|
+
attempt: retryCount,
|
|
1100
|
+
maxRetries: MAX_RETRIES,
|
|
1101
|
+
});
|
|
879
1102
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
880
1103
|
continue;
|
|
881
1104
|
}
|
|
882
|
-
// Log
|
|
883
|
-
logger_1.logger.error("Database
|
|
1105
|
+
// Log structured error details and rethrow
|
|
1106
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
1107
|
+
operation: 'findManySignalOutcome',
|
|
1108
|
+
model: 'SignalOutcome',
|
|
1109
|
+
error: String(error),
|
|
1110
|
+
isRetryable: isConnectionError,
|
|
1111
|
+
});
|
|
884
1112
|
throw error;
|
|
885
1113
|
}
|
|
886
1114
|
}
|