@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/Configuration.cjs
CHANGED
|
@@ -37,7 +37,7 @@ exports.Configuration = {
|
|
|
37
37
|
* @returns The created Configuration or null.
|
|
38
38
|
*/
|
|
39
39
|
async create(props, globalClient) {
|
|
40
|
-
var _a, _b, _c, _d, _e;
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
41
41
|
// Maximum number of retries for database connection issues
|
|
42
42
|
const MAX_RETRIES = 3;
|
|
43
43
|
let retryCount = 0;
|
|
@@ -89,21 +89,52 @@ exports.Configuration = {
|
|
|
89
89
|
}
|
|
90
90
|
catch (error) {
|
|
91
91
|
lastError = error;
|
|
92
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
93
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
94
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
95
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
96
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
97
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
98
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
99
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
100
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
101
|
+
if (isConstraintViolation) {
|
|
102
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
103
|
+
logger_1.logger.error("Non-retryable constraint violation in createOneConfiguration", {
|
|
104
|
+
operation: 'createOneConfiguration',
|
|
105
|
+
model: 'Configuration',
|
|
106
|
+
error: String(error),
|
|
107
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
108
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
109
|
+
isRetryable: false,
|
|
110
|
+
});
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
92
113
|
// Check if this is a database connection error that we should retry
|
|
93
|
-
const isConnectionError = ((
|
|
94
|
-
((
|
|
95
|
-
((
|
|
96
|
-
((
|
|
97
|
-
(error.networkError && ((
|
|
114
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
115
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
116
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
117
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
118
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
98
119
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
99
120
|
retryCount++;
|
|
100
121
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
101
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
122
|
+
logger_1.logger.warn("Database connection error in createOneConfiguration, retrying...", {
|
|
123
|
+
operation: 'createOneConfiguration',
|
|
124
|
+
model: 'Configuration',
|
|
125
|
+
attempt: retryCount,
|
|
126
|
+
maxRetries: MAX_RETRIES,
|
|
127
|
+
});
|
|
102
128
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
103
129
|
continue;
|
|
104
130
|
}
|
|
105
|
-
// Log
|
|
106
|
-
logger_1.logger.error("Database
|
|
131
|
+
// Log structured error details and rethrow
|
|
132
|
+
logger_1.logger.error("Database create operation failed", {
|
|
133
|
+
operation: 'createOneConfiguration',
|
|
134
|
+
model: 'Configuration',
|
|
135
|
+
error: String(error),
|
|
136
|
+
isRetryable: isConnectionError,
|
|
137
|
+
});
|
|
107
138
|
throw error;
|
|
108
139
|
}
|
|
109
140
|
}
|
|
@@ -118,7 +149,7 @@ exports.Configuration = {
|
|
|
118
149
|
* @returns The count of created records or null.
|
|
119
150
|
*/
|
|
120
151
|
async createMany(props, globalClient) {
|
|
121
|
-
var _a, _b, _c, _d, _e;
|
|
152
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
122
153
|
// Maximum number of retries for database connection issues
|
|
123
154
|
const MAX_RETRIES = 3;
|
|
124
155
|
let retryCount = 0;
|
|
@@ -169,21 +200,52 @@ exports.Configuration = {
|
|
|
169
200
|
}
|
|
170
201
|
catch (error) {
|
|
171
202
|
lastError = error;
|
|
203
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
204
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
205
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
206
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
207
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
208
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
209
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
210
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
211
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
212
|
+
if (isConstraintViolation) {
|
|
213
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
214
|
+
logger_1.logger.error("Non-retryable constraint violation in createManyConfiguration", {
|
|
215
|
+
operation: 'createManyConfiguration',
|
|
216
|
+
model: 'Configuration',
|
|
217
|
+
error: String(error),
|
|
218
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
219
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
220
|
+
isRetryable: false,
|
|
221
|
+
});
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
172
224
|
// Check if this is a database connection error that we should retry
|
|
173
|
-
const isConnectionError = ((
|
|
174
|
-
((
|
|
175
|
-
((
|
|
176
|
-
((
|
|
177
|
-
(error.networkError && ((
|
|
225
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
226
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
227
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
228
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
229
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
178
230
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
179
231
|
retryCount++;
|
|
180
232
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
181
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
233
|
+
logger_1.logger.warn("Database connection error in createManyConfiguration, retrying...", {
|
|
234
|
+
operation: 'createManyConfiguration',
|
|
235
|
+
model: 'Configuration',
|
|
236
|
+
attempt: retryCount,
|
|
237
|
+
maxRetries: MAX_RETRIES,
|
|
238
|
+
});
|
|
182
239
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
183
240
|
continue;
|
|
184
241
|
}
|
|
185
|
-
// Log
|
|
186
|
-
logger_1.logger.error("Database
|
|
242
|
+
// Log structured error details and rethrow
|
|
243
|
+
logger_1.logger.error("Database createMany operation failed", {
|
|
244
|
+
operation: 'createManyConfiguration',
|
|
245
|
+
model: 'Configuration',
|
|
246
|
+
error: String(error),
|
|
247
|
+
isRetryable: isConnectionError,
|
|
248
|
+
});
|
|
187
249
|
throw error;
|
|
188
250
|
}
|
|
189
251
|
}
|
|
@@ -198,7 +260,7 @@ exports.Configuration = {
|
|
|
198
260
|
* @returns The updated Configuration or null.
|
|
199
261
|
*/
|
|
200
262
|
async update(props, globalClient) {
|
|
201
|
-
var _a, _b, _c, _d, _e;
|
|
263
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
202
264
|
// Maximum number of retries for database connection issues
|
|
203
265
|
const MAX_RETRIES = 3;
|
|
204
266
|
let retryCount = 0;
|
|
@@ -277,21 +339,55 @@ exports.Configuration = {
|
|
|
277
339
|
}
|
|
278
340
|
catch (error) {
|
|
279
341
|
lastError = error;
|
|
342
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
343
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
344
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
345
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
346
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
347
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
348
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
349
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
350
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
351
|
+
if (isConstraintViolation) {
|
|
352
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
353
|
+
logger_1.logger.error("Non-retryable constraint violation in updateOneConfiguration", {
|
|
354
|
+
operation: 'updateOneConfiguration',
|
|
355
|
+
model: 'Configuration',
|
|
356
|
+
error: String(error),
|
|
357
|
+
recordId: props.id,
|
|
358
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
359
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
360
|
+
isRetryable: false,
|
|
361
|
+
});
|
|
362
|
+
throw error;
|
|
363
|
+
}
|
|
280
364
|
// Check if this is a database connection error that we should retry
|
|
281
|
-
const isConnectionError = ((
|
|
282
|
-
((
|
|
283
|
-
((
|
|
284
|
-
((
|
|
285
|
-
(error.networkError && ((
|
|
365
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
366
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
367
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
368
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
369
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
286
370
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
287
371
|
retryCount++;
|
|
288
372
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
289
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
373
|
+
logger_1.logger.warn("Database connection error in updateOneConfiguration, retrying...", {
|
|
374
|
+
operation: 'updateOneConfiguration',
|
|
375
|
+
model: 'Configuration',
|
|
376
|
+
attempt: retryCount,
|
|
377
|
+
maxRetries: MAX_RETRIES,
|
|
378
|
+
recordId: props.id,
|
|
379
|
+
});
|
|
290
380
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
291
381
|
continue;
|
|
292
382
|
}
|
|
293
|
-
// Log
|
|
294
|
-
logger_1.logger.error("Database
|
|
383
|
+
// Log structured error details and rethrow
|
|
384
|
+
logger_1.logger.error("Database update operation failed", {
|
|
385
|
+
operation: 'updateOneConfiguration',
|
|
386
|
+
model: 'Configuration',
|
|
387
|
+
error: String(error),
|
|
388
|
+
recordId: props.id,
|
|
389
|
+
isRetryable: isConnectionError,
|
|
390
|
+
});
|
|
295
391
|
throw error;
|
|
296
392
|
}
|
|
297
393
|
}
|
|
@@ -306,7 +402,7 @@ exports.Configuration = {
|
|
|
306
402
|
* @returns The updated Configuration or null.
|
|
307
403
|
*/
|
|
308
404
|
async upsert(props, globalClient) {
|
|
309
|
-
var _a, _b, _c, _d, _e;
|
|
405
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
310
406
|
// Maximum number of retries for database connection issues
|
|
311
407
|
const MAX_RETRIES = 3;
|
|
312
408
|
let retryCount = 0;
|
|
@@ -386,21 +482,55 @@ exports.Configuration = {
|
|
|
386
482
|
}
|
|
387
483
|
catch (error) {
|
|
388
484
|
lastError = error;
|
|
485
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
486
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
487
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
488
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
489
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
490
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
491
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
492
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
493
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
494
|
+
if (isConstraintViolation) {
|
|
495
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
496
|
+
logger_1.logger.error("Non-retryable constraint violation in upsertOneConfiguration", {
|
|
497
|
+
operation: 'upsertOneConfiguration',
|
|
498
|
+
model: 'Configuration',
|
|
499
|
+
error: String(error),
|
|
500
|
+
recordId: props.id,
|
|
501
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
502
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
503
|
+
isRetryable: false,
|
|
504
|
+
});
|
|
505
|
+
throw error;
|
|
506
|
+
}
|
|
389
507
|
// Check if this is a database connection error that we should retry
|
|
390
|
-
const isConnectionError = ((
|
|
391
|
-
((
|
|
392
|
-
((
|
|
393
|
-
((
|
|
394
|
-
(error.networkError && ((
|
|
508
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
509
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
510
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
511
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
512
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
395
513
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
396
514
|
retryCount++;
|
|
397
515
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
398
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
516
|
+
logger_1.logger.warn("Database connection error in upsertOneConfiguration, retrying...", {
|
|
517
|
+
operation: 'upsertOneConfiguration',
|
|
518
|
+
model: 'Configuration',
|
|
519
|
+
attempt: retryCount,
|
|
520
|
+
maxRetries: MAX_RETRIES,
|
|
521
|
+
recordId: props.id,
|
|
522
|
+
});
|
|
399
523
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
400
524
|
continue;
|
|
401
525
|
}
|
|
402
|
-
// Log
|
|
403
|
-
logger_1.logger.error("Database
|
|
526
|
+
// Log structured error details and rethrow
|
|
527
|
+
logger_1.logger.error("Database upsert operation failed", {
|
|
528
|
+
operation: 'upsertOneConfiguration',
|
|
529
|
+
model: 'Configuration',
|
|
530
|
+
error: String(error),
|
|
531
|
+
recordId: props.id,
|
|
532
|
+
isRetryable: isConnectionError,
|
|
533
|
+
});
|
|
404
534
|
throw error;
|
|
405
535
|
}
|
|
406
536
|
}
|
|
@@ -415,7 +545,7 @@ exports.Configuration = {
|
|
|
415
545
|
* @returns The count of created records or null.
|
|
416
546
|
*/
|
|
417
547
|
async updateMany(props, globalClient) {
|
|
418
|
-
var _a, _b, _c, _d, _e;
|
|
548
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
419
549
|
// Maximum number of retries for database connection issues
|
|
420
550
|
const MAX_RETRIES = 3;
|
|
421
551
|
let retryCount = 0;
|
|
@@ -494,21 +624,52 @@ exports.Configuration = {
|
|
|
494
624
|
}
|
|
495
625
|
catch (error) {
|
|
496
626
|
lastError = error;
|
|
627
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
628
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
629
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
630
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
631
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
632
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
633
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
634
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
|
|
635
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
|
|
636
|
+
if (isConstraintViolation) {
|
|
637
|
+
const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
|
|
638
|
+
logger_1.logger.error("Non-retryable constraint violation in updateManyConfiguration", {
|
|
639
|
+
operation: 'updateManyConfiguration',
|
|
640
|
+
model: 'Configuration',
|
|
641
|
+
error: String(error),
|
|
642
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
643
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
644
|
+
isRetryable: false,
|
|
645
|
+
});
|
|
646
|
+
throw error;
|
|
647
|
+
}
|
|
497
648
|
// Check if this is a database connection error that we should retry
|
|
498
|
-
const isConnectionError = ((
|
|
499
|
-
((
|
|
500
|
-
((
|
|
501
|
-
((
|
|
502
|
-
(error.networkError && ((
|
|
649
|
+
const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
|
|
650
|
+
((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
|
|
651
|
+
((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
|
|
652
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
653
|
+
(error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
|
|
503
654
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
504
655
|
retryCount++;
|
|
505
656
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
506
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
657
|
+
logger_1.logger.warn("Database connection error in updateManyConfiguration, retrying...", {
|
|
658
|
+
operation: 'updateManyConfiguration',
|
|
659
|
+
model: 'Configuration',
|
|
660
|
+
attempt: retryCount,
|
|
661
|
+
maxRetries: MAX_RETRIES,
|
|
662
|
+
});
|
|
507
663
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
508
664
|
continue;
|
|
509
665
|
}
|
|
510
|
-
// Log
|
|
511
|
-
logger_1.logger.error("Database
|
|
666
|
+
// Log structured error details and rethrow
|
|
667
|
+
logger_1.logger.error("Database updateMany operation failed", {
|
|
668
|
+
operation: 'updateManyConfiguration',
|
|
669
|
+
model: 'Configuration',
|
|
670
|
+
error: String(error),
|
|
671
|
+
isRetryable: isConnectionError,
|
|
672
|
+
});
|
|
512
673
|
throw error;
|
|
513
674
|
}
|
|
514
675
|
}
|
|
@@ -523,7 +684,7 @@ exports.Configuration = {
|
|
|
523
684
|
* @returns The deleted Configuration or null.
|
|
524
685
|
*/
|
|
525
686
|
async delete(props, globalClient) {
|
|
526
|
-
var _a, _b, _c, _d, _e;
|
|
687
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
527
688
|
// Maximum number of retries for database connection issues
|
|
528
689
|
const MAX_RETRIES = 3;
|
|
529
690
|
let retryCount = 0;
|
|
@@ -567,21 +728,58 @@ exports.Configuration = {
|
|
|
567
728
|
}
|
|
568
729
|
catch (error) {
|
|
569
730
|
lastError = error;
|
|
731
|
+
// Check for constraint violations FIRST - these are NEVER retryable
|
|
732
|
+
// (e.g., foreign key constraints preventing deletion)
|
|
733
|
+
const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
|
|
734
|
+
((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
|
|
735
|
+
((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
|
|
736
|
+
((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
|
|
737
|
+
((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
|
|
738
|
+
((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
|
|
739
|
+
((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
|
|
740
|
+
((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
|
|
741
|
+
((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
|
|
742
|
+
((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
|
|
743
|
+
if (isConstraintViolation) {
|
|
744
|
+
const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
|
|
745
|
+
logger_1.logger.error("Non-retryable constraint violation in deleteOneConfiguration", {
|
|
746
|
+
operation: 'deleteOneConfiguration',
|
|
747
|
+
model: 'Configuration',
|
|
748
|
+
error: String(error),
|
|
749
|
+
recordId: props.id,
|
|
750
|
+
constraintName: constraintMatch ? constraintMatch[1] : undefined,
|
|
751
|
+
errorCategory: 'CONSTRAINT_VIOLATION',
|
|
752
|
+
isRetryable: false,
|
|
753
|
+
});
|
|
754
|
+
throw error;
|
|
755
|
+
}
|
|
570
756
|
// Check if this is a database connection error that we should retry
|
|
571
|
-
const isConnectionError = ((
|
|
572
|
-
((
|
|
573
|
-
((
|
|
574
|
-
((
|
|
575
|
-
(error.networkError && ((
|
|
757
|
+
const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
|
|
758
|
+
((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
|
|
759
|
+
((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
|
|
760
|
+
((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
|
|
761
|
+
(error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
|
|
576
762
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
577
763
|
retryCount++;
|
|
578
764
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
579
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
765
|
+
logger_1.logger.warn("Database connection error in deleteOneConfiguration, retrying...", {
|
|
766
|
+
operation: 'deleteOneConfiguration',
|
|
767
|
+
model: 'Configuration',
|
|
768
|
+
attempt: retryCount,
|
|
769
|
+
maxRetries: MAX_RETRIES,
|
|
770
|
+
recordId: props.id,
|
|
771
|
+
});
|
|
580
772
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
581
773
|
continue;
|
|
582
774
|
}
|
|
583
|
-
// Log
|
|
584
|
-
logger_1.logger.error("Database
|
|
775
|
+
// Log structured error details and rethrow
|
|
776
|
+
logger_1.logger.error("Database delete operation failed", {
|
|
777
|
+
operation: 'deleteOneConfiguration',
|
|
778
|
+
model: 'Configuration',
|
|
779
|
+
error: String(error),
|
|
780
|
+
recordId: props.id,
|
|
781
|
+
isRetryable: isConnectionError,
|
|
782
|
+
});
|
|
585
783
|
throw error;
|
|
586
784
|
}
|
|
587
785
|
}
|
|
@@ -648,12 +846,22 @@ exports.Configuration = {
|
|
|
648
846
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
649
847
|
retryCount++;
|
|
650
848
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
651
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
849
|
+
logger_1.logger.warn("Database connection error in getConfiguration, retrying...", {
|
|
850
|
+
operation: 'getConfiguration',
|
|
851
|
+
model: 'Configuration',
|
|
852
|
+
attempt: retryCount,
|
|
853
|
+
maxRetries: MAX_RETRIES,
|
|
854
|
+
});
|
|
652
855
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
653
856
|
continue;
|
|
654
857
|
}
|
|
655
|
-
// Log
|
|
656
|
-
logger_1.logger.error("Database
|
|
858
|
+
// Log structured error details and rethrow
|
|
859
|
+
logger_1.logger.error("Database get operation failed", {
|
|
860
|
+
operation: 'getConfiguration',
|
|
861
|
+
model: 'Configuration',
|
|
862
|
+
error: String(error),
|
|
863
|
+
isRetryable: isConnectionError,
|
|
864
|
+
});
|
|
657
865
|
throw error;
|
|
658
866
|
}
|
|
659
867
|
}
|
|
@@ -711,12 +919,22 @@ exports.Configuration = {
|
|
|
711
919
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
712
920
|
retryCount++;
|
|
713
921
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
714
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
922
|
+
logger_1.logger.warn("Database connection error in getAllConfiguration, retrying...", {
|
|
923
|
+
operation: 'getAllConfiguration',
|
|
924
|
+
model: 'Configuration',
|
|
925
|
+
attempt: retryCount,
|
|
926
|
+
maxRetries: MAX_RETRIES,
|
|
927
|
+
});
|
|
715
928
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
716
929
|
continue;
|
|
717
930
|
}
|
|
718
|
-
// Log
|
|
719
|
-
logger_1.logger.error("Database
|
|
931
|
+
// Log structured error details and rethrow
|
|
932
|
+
logger_1.logger.error("Database getAll operation failed", {
|
|
933
|
+
operation: 'getAllConfiguration',
|
|
934
|
+
model: 'Configuration',
|
|
935
|
+
error: String(error),
|
|
936
|
+
isRetryable: isConnectionError,
|
|
937
|
+
});
|
|
720
938
|
throw error;
|
|
721
939
|
}
|
|
722
940
|
}
|
|
@@ -790,12 +1008,22 @@ exports.Configuration = {
|
|
|
790
1008
|
if (isConnectionError && retryCount < MAX_RETRIES - 1) {
|
|
791
1009
|
retryCount++;
|
|
792
1010
|
const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
|
|
793
|
-
logger_1.logger.warn("Database connection error, retrying..."
|
|
1011
|
+
logger_1.logger.warn("Database connection error in findManyConfiguration, retrying...", {
|
|
1012
|
+
operation: 'findManyConfiguration',
|
|
1013
|
+
model: 'Configuration',
|
|
1014
|
+
attempt: retryCount,
|
|
1015
|
+
maxRetries: MAX_RETRIES,
|
|
1016
|
+
});
|
|
794
1017
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
795
1018
|
continue;
|
|
796
1019
|
}
|
|
797
|
-
// Log
|
|
798
|
-
logger_1.logger.error("Database
|
|
1020
|
+
// Log structured error details and rethrow
|
|
1021
|
+
logger_1.logger.error("Database findMany operation failed", {
|
|
1022
|
+
operation: 'findManyConfiguration',
|
|
1023
|
+
model: 'Configuration',
|
|
1024
|
+
error: String(error),
|
|
1025
|
+
isRetryable: isConnectionError,
|
|
1026
|
+
});
|
|
799
1027
|
throw error;
|
|
800
1028
|
}
|
|
801
1029
|
}
|