@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/SignalLineage.cjs
CHANGED
|
@@ -55,7 +55,7 @@ exports.SignalLineage = {
|
|
|
55
55
|
* @returns The created SignalLineage or null.
|
|
56
56
|
*/
|
|
57
57
|
async create(props, globalClient) {
|
|
58
|
-
var _a, _b, _c, _d, _e;
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
59
59
|
// Maximum number of retries for database connection issues
|
|
60
60
|
const MAX_RETRIES = 3;
|
|
61
61
|
let retryCount = 0;
|
|
@@ -123,21 +123,52 @@ exports.SignalLineage = {
|
|
|
123
123
|
}
|
|
124
124
|
catch (error) {
|
|
125
125
|
lastError = error;
|
|
126
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
127
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
128
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
129
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
130
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
131
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
132
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
133
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
134
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
135
|
+
if (isConstraintViolation) {
|
|
136
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
137
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneSignalLineage", {
|
|
138
|
+
operation: 'createOneSignalLineage',
|
|
139
|
+
model: 'SignalLineage',
|
|
140
|
+
error: String(error),
|
|
141
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
142
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
143
|
+
isRetryable: false,
|
|
144
|
+
});
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
126
147
|
// Check if this is a database connection error that we should retry
|
|
127
|
-
const isConnectionError = ((
|
|
128
|
-
((
|
|
129
|
-
((
|
|
130
|
-
((
|
|
131
|
-
(error.networkError && ((
|
|
148
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
149
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
150
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
151
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
152
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
132
153
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
133
154
|
retryCount++;
|
|
134
155
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
135
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
156
|
+
logger_1.logger.warn("Database connection error in createOneSignalLineage, retrying...", {
|
|
157
|
+
operation: 'createOneSignalLineage',
|
|
158
|
+
model: 'SignalLineage',
|
|
159
|
+
attempt: retryCount,
|
|
160
|
+
maxRetries: MAX_RETRIES,
|
|
161
|
+
});
|
|
136
162
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
137
163
|
continue;
|
|
138
164
|
}
|
|
139
|
-
// Log
|
|
140
|
-
logger_1.logger.error("Database
|
|
165
|
+
// Log structured error details and rethrow
|
|
166
|
+
logger_1.logger.error("Database create operation failed", {
|
|
167
|
+
operation: 'createOneSignalLineage',
|
|
168
|
+
model: 'SignalLineage',
|
|
169
|
+
error: String(error),
|
|
170
|
+
isRetryable: isConnectionError,
|
|
171
|
+
});
|
|
141
172
|
throw error;
|
|
142
173
|
}
|
|
143
174
|
}
|
|
@@ -152,7 +183,7 @@ exports.SignalLineage = {
|
|
|
152
183
|
* @returns The count of created records or null.
|
|
153
184
|
*/
|
|
154
185
|
async createMany(props, globalClient) {
|
|
155
|
-
var _a, _b, _c, _d, _e;
|
|
186
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
156
187
|
// Maximum number of retries for database connection issues
|
|
157
188
|
const MAX_RETRIES = 3;
|
|
158
189
|
let retryCount = 0;
|
|
@@ -219,21 +250,52 @@ exports.SignalLineage = {
|
|
|
219
250
|
}
|
|
220
251
|
catch (error) {
|
|
221
252
|
lastError = error;
|
|
253
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
254
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
255
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
256
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
257
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
258
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
259
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
260
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
261
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
262
|
+
if (isConstraintViolation) {
|
|
263
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
264
|
+
logger_1.logger.error("Non-retryable constraint violation in createManySignalLineage", {
|
|
265
|
+
operation: 'createManySignalLineage',
|
|
266
|
+
model: 'SignalLineage',
|
|
267
|
+
error: String(error),
|
|
268
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
269
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
270
|
+
isRetryable: false,
|
|
271
|
+
});
|
|
272
|
+
throw error;
|
|
273
|
+
}
|
|
222
274
|
// Check if this is a database connection error that we should retry
|
|
223
|
-
const isConnectionError = ((
|
|
224
|
-
((
|
|
225
|
-
((
|
|
226
|
-
((
|
|
227
|
-
(error.networkError && ((
|
|
275
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
276
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
277
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
278
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
279
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
228
280
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
229
281
|
retryCount++;
|
|
230
282
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
231
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
283
|
+
logger_1.logger.warn("Database connection error in createManySignalLineage, retrying...", {
|
|
284
|
+
operation: 'createManySignalLineage',
|
|
285
|
+
model: 'SignalLineage',
|
|
286
|
+
attempt: retryCount,
|
|
287
|
+
maxRetries: MAX_RETRIES,
|
|
288
|
+
});
|
|
232
289
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
233
290
|
continue;
|
|
234
291
|
}
|
|
235
|
-
// Log
|
|
236
|
-
logger_1.logger.error("Database
|
|
292
|
+
// Log structured error details and rethrow
|
|
293
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
294
|
+
operation: 'createManySignalLineage',
|
|
295
|
+
model: 'SignalLineage',
|
|
296
|
+
error: String(error),
|
|
297
|
+
isRetryable: isConnectionError,
|
|
298
|
+
});
|
|
237
299
|
throw error;
|
|
238
300
|
}
|
|
239
301
|
}
|
|
@@ -248,7 +310,7 @@ exports.SignalLineage = {
|
|
|
248
310
|
* @returns The updated SignalLineage or null.
|
|
249
311
|
*/
|
|
250
312
|
async update(props, globalClient) {
|
|
251
|
-
var _a, _b, _c, _d, _e;
|
|
313
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
252
314
|
// Maximum number of retries for database connection issues
|
|
253
315
|
const MAX_RETRIES = 3;
|
|
254
316
|
let retryCount = 0;
|
|
@@ -388,21 +450,55 @@ exports.SignalLineage = {
|
|
|
388
450
|
}
|
|
389
451
|
catch (error) {
|
|
390
452
|
lastError = error;
|
|
453
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
454
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
455
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
456
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
457
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
458
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
459
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
460
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
461
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
462
|
+
if (isConstraintViolation) {
|
|
463
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
464
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneSignalLineage", {
|
|
465
|
+
operation: 'updateOneSignalLineage',
|
|
466
|
+
model: 'SignalLineage',
|
|
467
|
+
error: String(error),
|
|
468
|
+
recordId: props.id,
|
|
469
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
470
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
471
|
+
isRetryable: false,
|
|
472
|
+
});
|
|
473
|
+
throw error;
|
|
474
|
+
}
|
|
391
475
|
// Check if this is a database connection error that we should retry
|
|
392
|
-
const isConnectionError = ((
|
|
393
|
-
((
|
|
394
|
-
((
|
|
395
|
-
((
|
|
396
|
-
(error.networkError && ((
|
|
476
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
477
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
478
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
479
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
480
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
397
481
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
398
482
|
retryCount++;
|
|
399
483
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
400
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
484
|
+
logger_1.logger.warn("Database connection error in updateOneSignalLineage, retrying...", {
|
|
485
|
+
operation: 'updateOneSignalLineage',
|
|
486
|
+
model: 'SignalLineage',
|
|
487
|
+
attempt: retryCount,
|
|
488
|
+
maxRetries: MAX_RETRIES,
|
|
489
|
+
recordId: props.id,
|
|
490
|
+
});
|
|
401
491
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
402
492
|
continue;
|
|
403
493
|
}
|
|
404
|
-
// Log
|
|
405
|
-
logger_1.logger.error("Database
|
|
494
|
+
// Log structured error details and rethrow
|
|
495
|
+
logger_1.logger.error("Database update operation failed", {
|
|
496
|
+
operation: 'updateOneSignalLineage',
|
|
497
|
+
model: 'SignalLineage',
|
|
498
|
+
error: String(error),
|
|
499
|
+
recordId: props.id,
|
|
500
|
+
isRetryable: isConnectionError,
|
|
501
|
+
});
|
|
406
502
|
throw error;
|
|
407
503
|
}
|
|
408
504
|
}
|
|
@@ -417,7 +513,7 @@ exports.SignalLineage = {
|
|
|
417
513
|
* @returns The updated SignalLineage or null.
|
|
418
514
|
*/
|
|
419
515
|
async upsert(props, globalClient) {
|
|
420
|
-
var _a, _b, _c, _d, _e;
|
|
516
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
421
517
|
// Maximum number of retries for database connection issues
|
|
422
518
|
const MAX_RETRIES = 3;
|
|
423
519
|
let retryCount = 0;
|
|
@@ -577,21 +673,55 @@ exports.SignalLineage = {
|
|
|
577
673
|
}
|
|
578
674
|
catch (error) {
|
|
579
675
|
lastError = error;
|
|
676
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
677
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
678
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
679
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
680
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
681
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
682
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
683
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
684
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
685
|
+
if (isConstraintViolation) {
|
|
686
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
687
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneSignalLineage", {
|
|
688
|
+
operation: 'upsertOneSignalLineage',
|
|
689
|
+
model: 'SignalLineage',
|
|
690
|
+
error: String(error),
|
|
691
|
+
recordId: props.id,
|
|
692
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
693
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
694
|
+
isRetryable: false,
|
|
695
|
+
});
|
|
696
|
+
throw error;
|
|
697
|
+
}
|
|
580
698
|
// Check if this is a database connection error that we should retry
|
|
581
|
-
const isConnectionError = ((
|
|
582
|
-
((
|
|
583
|
-
((
|
|
584
|
-
((
|
|
585
|
-
(error.networkError && ((
|
|
699
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
700
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
701
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
702
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
703
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
586
704
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
587
705
|
retryCount++;
|
|
588
706
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
589
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
707
|
+
logger_1.logger.warn("Database connection error in upsertOneSignalLineage, retrying...", {
|
|
708
|
+
operation: 'upsertOneSignalLineage',
|
|
709
|
+
model: 'SignalLineage',
|
|
710
|
+
attempt: retryCount,
|
|
711
|
+
maxRetries: MAX_RETRIES,
|
|
712
|
+
recordId: props.id,
|
|
713
|
+
});
|
|
590
714
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
591
715
|
continue;
|
|
592
716
|
}
|
|
593
|
-
// Log
|
|
594
|
-
logger_1.logger.error("Database
|
|
717
|
+
// Log structured error details and rethrow
|
|
718
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
719
|
+
operation: 'upsertOneSignalLineage',
|
|
720
|
+
model: 'SignalLineage',
|
|
721
|
+
error: String(error),
|
|
722
|
+
recordId: props.id,
|
|
723
|
+
isRetryable: isConnectionError,
|
|
724
|
+
});
|
|
595
725
|
throw error;
|
|
596
726
|
}
|
|
597
727
|
}
|
|
@@ -606,7 +736,7 @@ exports.SignalLineage = {
|
|
|
606
736
|
* @returns The count of created records or null.
|
|
607
737
|
*/
|
|
608
738
|
async updateMany(props, globalClient) {
|
|
609
|
-
var _a, _b, _c, _d, _e;
|
|
739
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
610
740
|
// Maximum number of retries for database connection issues
|
|
611
741
|
const MAX_RETRIES = 3;
|
|
612
742
|
let retryCount = 0;
|
|
@@ -746,21 +876,52 @@ exports.SignalLineage = {
|
|
|
746
876
|
}
|
|
747
877
|
catch (error) {
|
|
748
878
|
lastError = error;
|
|
879
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
880
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
881
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
882
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
883
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
884
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
885
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
886
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
887
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
888
|
+
if (isConstraintViolation) {
|
|
889
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
890
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManySignalLineage", {
|
|
891
|
+
operation: 'updateManySignalLineage',
|
|
892
|
+
model: 'SignalLineage',
|
|
893
|
+
error: String(error),
|
|
894
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
895
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
896
|
+
isRetryable: false,
|
|
897
|
+
});
|
|
898
|
+
throw error;
|
|
899
|
+
}
|
|
749
900
|
// Check if this is a database connection error that we should retry
|
|
750
|
-
const isConnectionError = ((
|
|
751
|
-
((
|
|
752
|
-
((
|
|
753
|
-
((
|
|
754
|
-
(error.networkError && ((
|
|
901
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
902
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
903
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
904
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
905
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
755
906
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
756
907
|
retryCount++;
|
|
757
908
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
758
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
909
|
+
logger_1.logger.warn("Database connection error in updateManySignalLineage, retrying...", {
|
|
910
|
+
operation: 'updateManySignalLineage',
|
|
911
|
+
model: 'SignalLineage',
|
|
912
|
+
attempt: retryCount,
|
|
913
|
+
maxRetries: MAX_RETRIES,
|
|
914
|
+
});
|
|
759
915
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
760
916
|
continue;
|
|
761
917
|
}
|
|
762
|
-
// Log
|
|
763
|
-
logger_1.logger.error("Database
|
|
918
|
+
// Log structured error details and rethrow
|
|
919
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
920
|
+
operation: 'updateManySignalLineage',
|
|
921
|
+
model: 'SignalLineage',
|
|
922
|
+
error: String(error),
|
|
923
|
+
isRetryable: isConnectionError,
|
|
924
|
+
});
|
|
764
925
|
throw error;
|
|
765
926
|
}
|
|
766
927
|
}
|
|
@@ -775,7 +936,7 @@ exports.SignalLineage = {
|
|
|
775
936
|
* @returns The deleted SignalLineage or null.
|
|
776
937
|
*/
|
|
777
938
|
async delete(props, globalClient) {
|
|
778
|
-
var _a, _b, _c, _d, _e;
|
|
939
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
779
940
|
// Maximum number of retries for database connection issues
|
|
780
941
|
const MAX_RETRIES = 3;
|
|
781
942
|
let retryCount = 0;
|
|
@@ -819,21 +980,58 @@ exports.SignalLineage = {
|
|
|
819
980
|
}
|
|
820
981
|
catch (error) {
|
|
821
982
|
lastError = error;
|
|
983
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
984
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
985
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
986
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
987
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
988
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
989
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
990
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
991
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
992
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
993
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
994
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
995
|
+
if (isConstraintViolation) {
|
|
996
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
997
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneSignalLineage", {
|
|
998
|
+
operation: 'deleteOneSignalLineage',
|
|
999
|
+
model: 'SignalLineage',
|
|
1000
|
+
error: String(error),
|
|
1001
|
+
recordId: props.id,
|
|
1002
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
1003
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
1004
|
+
isRetryable: false,
|
|
1005
|
+
});
|
|
1006
|
+
throw error;
|
|
1007
|
+
}
|
|
822
1008
|
// Check if this is a database connection error that we should retry
|
|
823
|
-
const isConnectionError = ((
|
|
824
|
-
((
|
|
825
|
-
((
|
|
826
|
-
((
|
|
827
|
-
(error.networkError && ((
|
|
1009
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
1010
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
1011
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
1012
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
1013
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
828
1014
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
829
1015
|
retryCount++;
|
|
830
1016
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
831
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1017
|
+
logger_1.logger.warn("Database connection error in deleteOneSignalLineage, retrying...", {
|
|
1018
|
+
operation: 'deleteOneSignalLineage',
|
|
1019
|
+
model: 'SignalLineage',
|
|
1020
|
+
attempt: retryCount,
|
|
1021
|
+
maxRetries: MAX_RETRIES,
|
|
1022
|
+
recordId: props.id,
|
|
1023
|
+
});
|
|
832
1024
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
833
1025
|
continue;
|
|
834
1026
|
}
|
|
835
|
-
// Log
|
|
836
|
-
logger_1.logger.error("Database
|
|
1027
|
+
// Log structured error details and rethrow
|
|
1028
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
1029
|
+
operation: 'deleteOneSignalLineage',
|
|
1030
|
+
model: 'SignalLineage',
|
|
1031
|
+
error: String(error),
|
|
1032
|
+
recordId: props.id,
|
|
1033
|
+
isRetryable: isConnectionError,
|
|
1034
|
+
});
|
|
837
1035
|
throw error;
|
|
838
1036
|
}
|
|
839
1037
|
}
|
|
@@ -907,12 +1105,22 @@ exports.SignalLineage = {
|
|
|
907
1105
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
908
1106
|
retryCount++;
|
|
909
1107
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
910
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1108
|
+
logger_1.logger.warn("Database connection error in getSignalLineage, retrying...", {
|
|
1109
|
+
operation: 'getSignalLineage',
|
|
1110
|
+
model: 'SignalLineage',
|
|
1111
|
+
attempt: retryCount,
|
|
1112
|
+
maxRetries: MAX_RETRIES,
|
|
1113
|
+
});
|
|
911
1114
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
912
1115
|
continue;
|
|
913
1116
|
}
|
|
914
|
-
// Log
|
|
915
|
-
logger_1.logger.error("Database
|
|
1117
|
+
// Log structured error details and rethrow
|
|
1118
|
+
logger_1.logger.error("Database get operation failed", {
|
|
1119
|
+
operation: 'getSignalLineage',
|
|
1120
|
+
model: 'SignalLineage',
|
|
1121
|
+
error: String(error),
|
|
1122
|
+
isRetryable: isConnectionError,
|
|
1123
|
+
});
|
|
916
1124
|
throw error;
|
|
917
1125
|
}
|
|
918
1126
|
}
|
|
@@ -970,12 +1178,22 @@ exports.SignalLineage = {
|
|
|
970
1178
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
971
1179
|
retryCount++;
|
|
972
1180
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
973
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1181
|
+
logger_1.logger.warn("Database connection error in getAllSignalLineage, retrying...", {
|
|
1182
|
+
operation: 'getAllSignalLineage',
|
|
1183
|
+
model: 'SignalLineage',
|
|
1184
|
+
attempt: retryCount,
|
|
1185
|
+
maxRetries: MAX_RETRIES,
|
|
1186
|
+
});
|
|
974
1187
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
975
1188
|
continue;
|
|
976
1189
|
}
|
|
977
|
-
// Log
|
|
978
|
-
logger_1.logger.error("Database
|
|
1190
|
+
// Log structured error details and rethrow
|
|
1191
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
1192
|
+
operation: 'getAllSignalLineage',
|
|
1193
|
+
model: 'SignalLineage',
|
|
1194
|
+
error: String(error),
|
|
1195
|
+
isRetryable: isConnectionError,
|
|
1196
|
+
});
|
|
979
1197
|
throw error;
|
|
980
1198
|
}
|
|
981
1199
|
}
|
|
@@ -1058,12 +1276,22 @@ exports.SignalLineage = {
|
|
|
1058
1276
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
1059
1277
|
retryCount++;
|
|
1060
1278
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
1061
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1279
|
+
logger_1.logger.warn("Database connection error in findManySignalLineage, retrying...", {
|
|
1280
|
+
operation: 'findManySignalLineage',
|
|
1281
|
+
model: 'SignalLineage',
|
|
1282
|
+
attempt: retryCount,
|
|
1283
|
+
maxRetries: MAX_RETRIES,
|
|
1284
|
+
});
|
|
1062
1285
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
1063
1286
|
continue;
|
|
1064
1287
|
}
|
|
1065
|
-
// Log
|
|
1066
|
-
logger_1.logger.error("Database
|
|
1288
|
+
// Log structured error details and rethrow
|
|
1289
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
1290
|
+
operation: 'findManySignalLineage',
|
|
1291
|
+
model: 'SignalLineage',
|
|
1292
|
+
error: String(error),
|
|
1293
|
+
isRetryable: isConnectionError,
|
|
1294
|
+
});
|
|
1067
1295
|
throw error;
|
|
1068
1296
|
}
|
|
1069
1297
|
}
|