@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.
Files changed (229) hide show
  1. package/ABTest.cjs +291 -63
  2. package/Account.cjs +291 -63
  3. package/AccountLinkingRequest.cjs +291 -63
  4. package/Action.cjs +291 -63
  5. package/Alert.cjs +291 -63
  6. package/Allocation.cjs +291 -63
  7. package/AlpacaAccount.cjs +291 -63
  8. package/AnalyticsConfiguration.cjs +291 -63
  9. package/AnalyticsSnapshot.cjs +291 -63
  10. package/Asset.cjs +291 -63
  11. package/AuditLog.cjs +291 -63
  12. package/Authenticator.cjs +291 -63
  13. package/Configuration.cjs +291 -63
  14. package/ConflictEvent.cjs +291 -63
  15. package/ConnectionHealthSnapshot.cjs +291 -63
  16. package/Customer.cjs +291 -63
  17. package/DeadLetterMessage.cjs +291 -63
  18. package/EconomicEvent.cjs +291 -63
  19. package/Event.cjs +291 -63
  20. package/EventSnapshot.cjs +291 -63
  21. package/FeatureImportanceAnalysis.cjs +291 -63
  22. package/InstitutionalFlowSignal.cjs +291 -63
  23. package/InstitutionalHolding.cjs +291 -63
  24. package/InstitutionalSentimentAlerts.cjs +291 -63
  25. package/InstitutionalSentimentErrors.cjs +291 -63
  26. package/InstitutionalSentimentHistory.cjs +291 -63
  27. package/InstitutionalSentimentMetrics.cjs +291 -63
  28. package/InviteToken.cjs +291 -63
  29. package/LinkedProvider.cjs +291 -63
  30. package/MLTrainingData.cjs +291 -63
  31. package/MarketSentiment.cjs +291 -63
  32. package/ModelArtifact.cjs +291 -63
  33. package/ModelVersion.cjs +291 -63
  34. package/ModelVersionArtifact.cjs +291 -63
  35. package/NewsArticle.cjs +291 -63
  36. package/NewsArticleAssetSentiment.cjs +291 -63
  37. package/OptionsContract.cjs +291 -63
  38. package/OptionsGreeksHistory.cjs +291 -63
  39. package/OptionsPosition.cjs +291 -63
  40. package/OptionsTradeExecution.cjs +291 -63
  41. package/PortfolioGreeksHistory.cjs +291 -63
  42. package/ScheduledOptionOrder.cjs +291 -63
  43. package/Session.cjs +291 -63
  44. package/SignalGeneratorMetrics.cjs +291 -63
  45. package/SignalLineage.cjs +291 -63
  46. package/SignalOutcome.cjs +291 -63
  47. package/SignalPriorityQueue.cjs +291 -63
  48. package/SyncEvent.cjs +291 -63
  49. package/SystemAlert.cjs +291 -63
  50. package/Trade.cjs +291 -63
  51. package/TradeAuditEvent.cjs +291 -63
  52. package/TradeExecutionHistory.cjs +291 -63
  53. package/User.cjs +291 -63
  54. package/VerificationToken.cjs +291 -63
  55. package/WaitlistEntry.cjs +291 -63
  56. package/esm/ABTest.d.ts.map +1 -1
  57. package/esm/ABTest.js.map +1 -1
  58. package/esm/ABTest.mjs +255 -27
  59. package/esm/Account.d.ts.map +1 -1
  60. package/esm/Account.js.map +1 -1
  61. package/esm/Account.mjs +255 -27
  62. package/esm/AccountLinkingRequest.d.ts.map +1 -1
  63. package/esm/AccountLinkingRequest.js.map +1 -1
  64. package/esm/AccountLinkingRequest.mjs +255 -27
  65. package/esm/Action.d.ts.map +1 -1
  66. package/esm/Action.js.map +1 -1
  67. package/esm/Action.mjs +255 -27
  68. package/esm/Alert.d.ts.map +1 -1
  69. package/esm/Alert.js.map +1 -1
  70. package/esm/Alert.mjs +255 -27
  71. package/esm/Allocation.d.ts.map +1 -1
  72. package/esm/Allocation.js.map +1 -1
  73. package/esm/Allocation.mjs +255 -27
  74. package/esm/AlpacaAccount.d.ts.map +1 -1
  75. package/esm/AlpacaAccount.js.map +1 -1
  76. package/esm/AlpacaAccount.mjs +255 -27
  77. package/esm/AnalyticsConfiguration.d.ts.map +1 -1
  78. package/esm/AnalyticsConfiguration.js.map +1 -1
  79. package/esm/AnalyticsConfiguration.mjs +255 -27
  80. package/esm/AnalyticsSnapshot.d.ts.map +1 -1
  81. package/esm/AnalyticsSnapshot.js.map +1 -1
  82. package/esm/AnalyticsSnapshot.mjs +255 -27
  83. package/esm/Asset.d.ts.map +1 -1
  84. package/esm/Asset.js.map +1 -1
  85. package/esm/Asset.mjs +255 -27
  86. package/esm/AuditLog.d.ts.map +1 -1
  87. package/esm/AuditLog.js.map +1 -1
  88. package/esm/AuditLog.mjs +255 -27
  89. package/esm/Authenticator.d.ts.map +1 -1
  90. package/esm/Authenticator.js.map +1 -1
  91. package/esm/Authenticator.mjs +255 -27
  92. package/esm/Configuration.d.ts.map +1 -1
  93. package/esm/Configuration.js.map +1 -1
  94. package/esm/Configuration.mjs +255 -27
  95. package/esm/ConflictEvent.d.ts.map +1 -1
  96. package/esm/ConflictEvent.js.map +1 -1
  97. package/esm/ConflictEvent.mjs +255 -27
  98. package/esm/ConnectionHealthSnapshot.d.ts.map +1 -1
  99. package/esm/ConnectionHealthSnapshot.js.map +1 -1
  100. package/esm/ConnectionHealthSnapshot.mjs +255 -27
  101. package/esm/Customer.d.ts.map +1 -1
  102. package/esm/Customer.js.map +1 -1
  103. package/esm/Customer.mjs +255 -27
  104. package/esm/DeadLetterMessage.d.ts.map +1 -1
  105. package/esm/DeadLetterMessage.js.map +1 -1
  106. package/esm/DeadLetterMessage.mjs +255 -27
  107. package/esm/EconomicEvent.d.ts.map +1 -1
  108. package/esm/EconomicEvent.js.map +1 -1
  109. package/esm/EconomicEvent.mjs +255 -27
  110. package/esm/Event.d.ts.map +1 -1
  111. package/esm/Event.js.map +1 -1
  112. package/esm/Event.mjs +255 -27
  113. package/esm/EventSnapshot.d.ts.map +1 -1
  114. package/esm/EventSnapshot.js.map +1 -1
  115. package/esm/EventSnapshot.mjs +255 -27
  116. package/esm/FeatureImportanceAnalysis.d.ts.map +1 -1
  117. package/esm/FeatureImportanceAnalysis.js.map +1 -1
  118. package/esm/FeatureImportanceAnalysis.mjs +255 -27
  119. package/esm/InstitutionalFlowSignal.d.ts.map +1 -1
  120. package/esm/InstitutionalFlowSignal.js.map +1 -1
  121. package/esm/InstitutionalFlowSignal.mjs +255 -27
  122. package/esm/InstitutionalHolding.d.ts.map +1 -1
  123. package/esm/InstitutionalHolding.js.map +1 -1
  124. package/esm/InstitutionalHolding.mjs +255 -27
  125. package/esm/InstitutionalSentimentAlerts.d.ts.map +1 -1
  126. package/esm/InstitutionalSentimentAlerts.js.map +1 -1
  127. package/esm/InstitutionalSentimentAlerts.mjs +255 -27
  128. package/esm/InstitutionalSentimentErrors.d.ts.map +1 -1
  129. package/esm/InstitutionalSentimentErrors.js.map +1 -1
  130. package/esm/InstitutionalSentimentErrors.mjs +255 -27
  131. package/esm/InstitutionalSentimentHistory.d.ts.map +1 -1
  132. package/esm/InstitutionalSentimentHistory.js.map +1 -1
  133. package/esm/InstitutionalSentimentHistory.mjs +255 -27
  134. package/esm/InstitutionalSentimentMetrics.d.ts.map +1 -1
  135. package/esm/InstitutionalSentimentMetrics.js.map +1 -1
  136. package/esm/InstitutionalSentimentMetrics.mjs +255 -27
  137. package/esm/InviteToken.d.ts.map +1 -1
  138. package/esm/InviteToken.js.map +1 -1
  139. package/esm/InviteToken.mjs +255 -27
  140. package/esm/LinkedProvider.d.ts.map +1 -1
  141. package/esm/LinkedProvider.js.map +1 -1
  142. package/esm/LinkedProvider.mjs +255 -27
  143. package/esm/MLTrainingData.d.ts.map +1 -1
  144. package/esm/MLTrainingData.js.map +1 -1
  145. package/esm/MLTrainingData.mjs +255 -27
  146. package/esm/MarketSentiment.d.ts.map +1 -1
  147. package/esm/MarketSentiment.js.map +1 -1
  148. package/esm/MarketSentiment.mjs +255 -27
  149. package/esm/ModelArtifact.d.ts.map +1 -1
  150. package/esm/ModelArtifact.js.map +1 -1
  151. package/esm/ModelArtifact.mjs +255 -27
  152. package/esm/ModelVersion.d.ts.map +1 -1
  153. package/esm/ModelVersion.js.map +1 -1
  154. package/esm/ModelVersion.mjs +255 -27
  155. package/esm/ModelVersionArtifact.d.ts.map +1 -1
  156. package/esm/ModelVersionArtifact.js.map +1 -1
  157. package/esm/ModelVersionArtifact.mjs +255 -27
  158. package/esm/NewsArticle.d.ts.map +1 -1
  159. package/esm/NewsArticle.js.map +1 -1
  160. package/esm/NewsArticle.mjs +255 -27
  161. package/esm/NewsArticleAssetSentiment.d.ts.map +1 -1
  162. package/esm/NewsArticleAssetSentiment.js.map +1 -1
  163. package/esm/NewsArticleAssetSentiment.mjs +255 -27
  164. package/esm/OptionsContract.d.ts.map +1 -1
  165. package/esm/OptionsContract.js.map +1 -1
  166. package/esm/OptionsContract.mjs +255 -27
  167. package/esm/OptionsGreeksHistory.d.ts.map +1 -1
  168. package/esm/OptionsGreeksHistory.js.map +1 -1
  169. package/esm/OptionsGreeksHistory.mjs +255 -27
  170. package/esm/OptionsPosition.d.ts.map +1 -1
  171. package/esm/OptionsPosition.js.map +1 -1
  172. package/esm/OptionsPosition.mjs +255 -27
  173. package/esm/OptionsTradeExecution.d.ts.map +1 -1
  174. package/esm/OptionsTradeExecution.js.map +1 -1
  175. package/esm/OptionsTradeExecution.mjs +255 -27
  176. package/esm/PortfolioGreeksHistory.d.ts.map +1 -1
  177. package/esm/PortfolioGreeksHistory.js.map +1 -1
  178. package/esm/PortfolioGreeksHistory.mjs +255 -27
  179. package/esm/ScheduledOptionOrder.d.ts.map +1 -1
  180. package/esm/ScheduledOptionOrder.js.map +1 -1
  181. package/esm/ScheduledOptionOrder.mjs +255 -27
  182. package/esm/Session.d.ts.map +1 -1
  183. package/esm/Session.js.map +1 -1
  184. package/esm/Session.mjs +255 -27
  185. package/esm/SignalGeneratorMetrics.d.ts.map +1 -1
  186. package/esm/SignalGeneratorMetrics.js.map +1 -1
  187. package/esm/SignalGeneratorMetrics.mjs +255 -27
  188. package/esm/SignalLineage.d.ts.map +1 -1
  189. package/esm/SignalLineage.js.map +1 -1
  190. package/esm/SignalLineage.mjs +255 -27
  191. package/esm/SignalOutcome.d.ts.map +1 -1
  192. package/esm/SignalOutcome.js.map +1 -1
  193. package/esm/SignalOutcome.mjs +255 -27
  194. package/esm/SignalPriorityQueue.d.ts.map +1 -1
  195. package/esm/SignalPriorityQueue.js.map +1 -1
  196. package/esm/SignalPriorityQueue.mjs +255 -27
  197. package/esm/SyncEvent.d.ts.map +1 -1
  198. package/esm/SyncEvent.js.map +1 -1
  199. package/esm/SyncEvent.mjs +255 -27
  200. package/esm/SystemAlert.d.ts.map +1 -1
  201. package/esm/SystemAlert.js.map +1 -1
  202. package/esm/SystemAlert.mjs +255 -27
  203. package/esm/Trade.d.ts.map +1 -1
  204. package/esm/Trade.js.map +1 -1
  205. package/esm/Trade.mjs +255 -27
  206. package/esm/TradeAuditEvent.d.ts.map +1 -1
  207. package/esm/TradeAuditEvent.js.map +1 -1
  208. package/esm/TradeAuditEvent.mjs +255 -27
  209. package/esm/TradeExecutionHistory.d.ts.map +1 -1
  210. package/esm/TradeExecutionHistory.js.map +1 -1
  211. package/esm/TradeExecutionHistory.mjs +255 -27
  212. package/esm/User.d.ts.map +1 -1
  213. package/esm/User.js.map +1 -1
  214. package/esm/User.mjs +255 -27
  215. package/esm/VerificationToken.d.ts.map +1 -1
  216. package/esm/VerificationToken.js.map +1 -1
  217. package/esm/VerificationToken.mjs +255 -27
  218. package/esm/WaitlistEntry.d.ts.map +1 -1
  219. package/esm/WaitlistEntry.js.map +1 -1
  220. package/esm/WaitlistEntry.mjs +255 -27
  221. package/esm/middleware/audit-logger.d.ts +0 -7
  222. package/esm/middleware/audit-logger.d.ts.map +1 -1
  223. package/esm/middleware/audit-logger.js.map +1 -1
  224. package/esm/middleware/audit-logger.mjs +5 -3
  225. package/esm/prismaClient.d.ts.map +1 -1
  226. package/esm/prismaClient.js.map +1 -1
  227. package/esm/prismaClient.mjs +38 -9
  228. package/package.json +1 -1
  229. 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 = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
94
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
95
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
96
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
97
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
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 the error and rethrow
106
- logger_1.logger.error("Database error occurred", { error: String(error) });
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 = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
174
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
175
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
176
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
177
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
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 the error and rethrow
186
- logger_1.logger.error("Database error occurred", { error: String(error) });
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 = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
282
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
283
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
284
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
285
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
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 the error and rethrow
294
- logger_1.logger.error("Database error occurred", { error: String(error) });
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 = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
391
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
392
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
393
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
394
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
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 the error and rethrow
403
- logger_1.logger.error("Database error occurred", { error: String(error) });
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 = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
499
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
500
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
501
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
502
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
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 the error and rethrow
511
- logger_1.logger.error("Database error occurred", { error: String(error) });
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 = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
572
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
573
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
574
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
575
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
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 the error and rethrow
584
- logger_1.logger.error("Database error occurred", { error: String(error) });
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 the error and rethrow
656
- logger_1.logger.error("Database error occurred", { error: String(error) });
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 the error and rethrow
719
- logger_1.logger.error("Database error occurred", { error: String(error) });
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 the error and rethrow
798
- logger_1.logger.error("Database error occurred", { error: String(error) });
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
  }