@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
@@ -34,7 +34,7 @@ exports.AnalyticsConfiguration = {
34
34
  * @returns The created AnalyticsConfiguration or null.
35
35
  */
36
36
  async create(props, globalClient) {
37
- var _a, _b, _c, _d, _e;
37
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
38
38
  // Maximum number of retries for database connection issues
39
39
  const MAX_RETRIES = 3;
40
40
  let retryCount = 0;
@@ -83,21 +83,52 @@ exports.AnalyticsConfiguration = {
83
83
  }
84
84
  catch (error) {
85
85
  lastError = error;
86
+ // Check for constraint violations FIRST - these are NEVER retryable
87
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
88
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
89
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
90
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
91
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
92
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
93
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
94
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
95
+ if (isConstraintViolation) {
96
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
97
+ logger_1.logger.error("Non-retryable constraint violation in createOneAnalyticsConfiguration", {
98
+ operation: 'createOneAnalyticsConfiguration',
99
+ model: 'AnalyticsConfiguration',
100
+ error: String(error),
101
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
102
+ errorCategory: 'CONSTRAINT_VIOLATION',
103
+ isRetryable: false,
104
+ });
105
+ throw error;
106
+ }
86
107
  // Check if this is a database connection error that we should retry
87
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
88
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
89
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
90
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
91
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
108
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
109
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
110
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
111
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
112
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
92
113
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
93
114
  retryCount++;
94
115
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
95
- logger_1.logger.warn("Database connection error, retrying...");
116
+ logger_1.logger.warn("Database connection error in createOneAnalyticsConfiguration, retrying...", {
117
+ operation: 'createOneAnalyticsConfiguration',
118
+ model: 'AnalyticsConfiguration',
119
+ attempt: retryCount,
120
+ maxRetries: MAX_RETRIES,
121
+ });
96
122
  await new Promise(resolve => setTimeout(resolve, delay));
97
123
  continue;
98
124
  }
99
- // Log the error and rethrow
100
- logger_1.logger.error("Database error occurred", { error: String(error) });
125
+ // Log structured error details and rethrow
126
+ logger_1.logger.error("Database create operation failed", {
127
+ operation: 'createOneAnalyticsConfiguration',
128
+ model: 'AnalyticsConfiguration',
129
+ error: String(error),
130
+ isRetryable: isConnectionError,
131
+ });
101
132
  throw error;
102
133
  }
103
134
  }
@@ -112,7 +143,7 @@ exports.AnalyticsConfiguration = {
112
143
  * @returns The count of created records or null.
113
144
  */
114
145
  async createMany(props, globalClient) {
115
- var _a, _b, _c, _d, _e;
146
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
116
147
  // Maximum number of retries for database connection issues
117
148
  const MAX_RETRIES = 3;
118
149
  let retryCount = 0;
@@ -160,21 +191,52 @@ exports.AnalyticsConfiguration = {
160
191
  }
161
192
  catch (error) {
162
193
  lastError = error;
194
+ // Check for constraint violations FIRST - these are NEVER retryable
195
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
196
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
197
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
198
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
199
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
200
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
201
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
202
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
203
+ if (isConstraintViolation) {
204
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
205
+ logger_1.logger.error("Non-retryable constraint violation in createManyAnalyticsConfiguration", {
206
+ operation: 'createManyAnalyticsConfiguration',
207
+ model: 'AnalyticsConfiguration',
208
+ error: String(error),
209
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
210
+ errorCategory: 'CONSTRAINT_VIOLATION',
211
+ isRetryable: false,
212
+ });
213
+ throw error;
214
+ }
163
215
  // Check if this is a database connection error that we should retry
164
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
165
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
166
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
167
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
168
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
216
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
217
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
218
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
219
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
220
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
169
221
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
170
222
  retryCount++;
171
223
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
172
- logger_1.logger.warn("Database connection error, retrying...");
224
+ logger_1.logger.warn("Database connection error in createManyAnalyticsConfiguration, retrying...", {
225
+ operation: 'createManyAnalyticsConfiguration',
226
+ model: 'AnalyticsConfiguration',
227
+ attempt: retryCount,
228
+ maxRetries: MAX_RETRIES,
229
+ });
173
230
  await new Promise(resolve => setTimeout(resolve, delay));
174
231
  continue;
175
232
  }
176
- // Log the error and rethrow
177
- logger_1.logger.error("Database error occurred", { error: String(error) });
233
+ // Log structured error details and rethrow
234
+ logger_1.logger.error("Database createMany operation failed", {
235
+ operation: 'createManyAnalyticsConfiguration',
236
+ model: 'AnalyticsConfiguration',
237
+ error: String(error),
238
+ isRetryable: isConnectionError,
239
+ });
178
240
  throw error;
179
241
  }
180
242
  }
@@ -189,7 +251,7 @@ exports.AnalyticsConfiguration = {
189
251
  * @returns The updated AnalyticsConfiguration or null.
190
252
  */
191
253
  async update(props, globalClient) {
192
- var _a, _b, _c, _d, _e;
254
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
193
255
  // Maximum number of retries for database connection issues
194
256
  const MAX_RETRIES = 3;
195
257
  let retryCount = 0;
@@ -262,21 +324,55 @@ exports.AnalyticsConfiguration = {
262
324
  }
263
325
  catch (error) {
264
326
  lastError = error;
327
+ // Check for constraint violations FIRST - these are NEVER retryable
328
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
329
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
330
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
331
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
332
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
333
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
334
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
335
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
336
+ if (isConstraintViolation) {
337
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
338
+ logger_1.logger.error("Non-retryable constraint violation in updateOneAnalyticsConfiguration", {
339
+ operation: 'updateOneAnalyticsConfiguration',
340
+ model: 'AnalyticsConfiguration',
341
+ error: String(error),
342
+ recordId: props.id,
343
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
344
+ errorCategory: 'CONSTRAINT_VIOLATION',
345
+ isRetryable: false,
346
+ });
347
+ throw error;
348
+ }
265
349
  // Check if this is a database connection error that we should retry
266
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
267
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
268
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
269
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
270
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
350
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
351
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
352
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
353
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
354
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
271
355
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
272
356
  retryCount++;
273
357
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
274
- logger_1.logger.warn("Database connection error, retrying...");
358
+ logger_1.logger.warn("Database connection error in updateOneAnalyticsConfiguration, retrying...", {
359
+ operation: 'updateOneAnalyticsConfiguration',
360
+ model: 'AnalyticsConfiguration',
361
+ attempt: retryCount,
362
+ maxRetries: MAX_RETRIES,
363
+ recordId: props.id,
364
+ });
275
365
  await new Promise(resolve => setTimeout(resolve, delay));
276
366
  continue;
277
367
  }
278
- // Log the error and rethrow
279
- logger_1.logger.error("Database error occurred", { error: String(error) });
368
+ // Log structured error details and rethrow
369
+ logger_1.logger.error("Database update operation failed", {
370
+ operation: 'updateOneAnalyticsConfiguration',
371
+ model: 'AnalyticsConfiguration',
372
+ error: String(error),
373
+ recordId: props.id,
374
+ isRetryable: isConnectionError,
375
+ });
280
376
  throw error;
281
377
  }
282
378
  }
@@ -291,7 +387,7 @@ exports.AnalyticsConfiguration = {
291
387
  * @returns The updated AnalyticsConfiguration or null.
292
388
  */
293
389
  async upsert(props, globalClient) {
294
- var _a, _b, _c, _d, _e;
390
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
295
391
  // Maximum number of retries for database connection issues
296
392
  const MAX_RETRIES = 3;
297
393
  let retryCount = 0;
@@ -362,21 +458,55 @@ exports.AnalyticsConfiguration = {
362
458
  }
363
459
  catch (error) {
364
460
  lastError = error;
461
+ // Check for constraint violations FIRST - these are NEVER retryable
462
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
463
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
464
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
465
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
466
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
467
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
468
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
469
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
470
+ if (isConstraintViolation) {
471
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
472
+ logger_1.logger.error("Non-retryable constraint violation in upsertOneAnalyticsConfiguration", {
473
+ operation: 'upsertOneAnalyticsConfiguration',
474
+ model: 'AnalyticsConfiguration',
475
+ error: String(error),
476
+ recordId: props.id,
477
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
478
+ errorCategory: 'CONSTRAINT_VIOLATION',
479
+ isRetryable: false,
480
+ });
481
+ throw error;
482
+ }
365
483
  // Check if this is a database connection error that we should retry
366
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
367
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
368
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
369
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
370
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
484
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
485
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
486
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
487
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
488
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
371
489
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
372
490
  retryCount++;
373
491
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
374
- logger_1.logger.warn("Database connection error, retrying...");
492
+ logger_1.logger.warn("Database connection error in upsertOneAnalyticsConfiguration, retrying...", {
493
+ operation: 'upsertOneAnalyticsConfiguration',
494
+ model: 'AnalyticsConfiguration',
495
+ attempt: retryCount,
496
+ maxRetries: MAX_RETRIES,
497
+ recordId: props.id,
498
+ });
375
499
  await new Promise(resolve => setTimeout(resolve, delay));
376
500
  continue;
377
501
  }
378
- // Log the error and rethrow
379
- logger_1.logger.error("Database error occurred", { error: String(error) });
502
+ // Log structured error details and rethrow
503
+ logger_1.logger.error("Database upsert operation failed", {
504
+ operation: 'upsertOneAnalyticsConfiguration',
505
+ model: 'AnalyticsConfiguration',
506
+ error: String(error),
507
+ recordId: props.id,
508
+ isRetryable: isConnectionError,
509
+ });
380
510
  throw error;
381
511
  }
382
512
  }
@@ -391,7 +521,7 @@ exports.AnalyticsConfiguration = {
391
521
  * @returns The count of created records or null.
392
522
  */
393
523
  async updateMany(props, globalClient) {
394
- var _a, _b, _c, _d, _e;
524
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
395
525
  // Maximum number of retries for database connection issues
396
526
  const MAX_RETRIES = 3;
397
527
  let retryCount = 0;
@@ -464,21 +594,52 @@ exports.AnalyticsConfiguration = {
464
594
  }
465
595
  catch (error) {
466
596
  lastError = error;
597
+ // Check for constraint violations FIRST - these are NEVER retryable
598
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
599
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
600
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
601
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
602
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
603
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
604
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
605
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
606
+ if (isConstraintViolation) {
607
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
608
+ logger_1.logger.error("Non-retryable constraint violation in updateManyAnalyticsConfiguration", {
609
+ operation: 'updateManyAnalyticsConfiguration',
610
+ model: 'AnalyticsConfiguration',
611
+ error: String(error),
612
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
613
+ errorCategory: 'CONSTRAINT_VIOLATION',
614
+ isRetryable: false,
615
+ });
616
+ throw error;
617
+ }
467
618
  // Check if this is a database connection error that we should retry
468
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
469
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
470
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
471
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
472
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
619
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
620
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
621
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
622
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
623
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
473
624
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
474
625
  retryCount++;
475
626
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
476
- logger_1.logger.warn("Database connection error, retrying...");
627
+ logger_1.logger.warn("Database connection error in updateManyAnalyticsConfiguration, retrying...", {
628
+ operation: 'updateManyAnalyticsConfiguration',
629
+ model: 'AnalyticsConfiguration',
630
+ attempt: retryCount,
631
+ maxRetries: MAX_RETRIES,
632
+ });
477
633
  await new Promise(resolve => setTimeout(resolve, delay));
478
634
  continue;
479
635
  }
480
- // Log the error and rethrow
481
- logger_1.logger.error("Database error occurred", { error: String(error) });
636
+ // Log structured error details and rethrow
637
+ logger_1.logger.error("Database updateMany operation failed", {
638
+ operation: 'updateManyAnalyticsConfiguration',
639
+ model: 'AnalyticsConfiguration',
640
+ error: String(error),
641
+ isRetryable: isConnectionError,
642
+ });
482
643
  throw error;
483
644
  }
484
645
  }
@@ -493,7 +654,7 @@ exports.AnalyticsConfiguration = {
493
654
  * @returns The deleted AnalyticsConfiguration or null.
494
655
  */
495
656
  async delete(props, globalClient) {
496
- var _a, _b, _c, _d, _e;
657
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
497
658
  // Maximum number of retries for database connection issues
498
659
  const MAX_RETRIES = 3;
499
660
  let retryCount = 0;
@@ -537,21 +698,58 @@ exports.AnalyticsConfiguration = {
537
698
  }
538
699
  catch (error) {
539
700
  lastError = error;
701
+ // Check for constraint violations FIRST - these are NEVER retryable
702
+ // (e.g., foreign key constraints preventing deletion)
703
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
704
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
705
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
706
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
707
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
708
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
709
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
710
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
711
+ ((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
712
+ ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
713
+ if (isConstraintViolation) {
714
+ const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
715
+ logger_1.logger.error("Non-retryable constraint violation in deleteOneAnalyticsConfiguration", {
716
+ operation: 'deleteOneAnalyticsConfiguration',
717
+ model: 'AnalyticsConfiguration',
718
+ error: String(error),
719
+ recordId: props.id,
720
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
721
+ errorCategory: 'CONSTRAINT_VIOLATION',
722
+ isRetryable: false,
723
+ });
724
+ throw error;
725
+ }
540
726
  // Check if this is a database connection error that we should retry
541
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
542
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
543
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
544
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
545
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
727
+ const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
728
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
729
+ ((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
730
+ ((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
731
+ (error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
546
732
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
547
733
  retryCount++;
548
734
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
549
- logger_1.logger.warn("Database connection error, retrying...");
735
+ logger_1.logger.warn("Database connection error in deleteOneAnalyticsConfiguration, retrying...", {
736
+ operation: 'deleteOneAnalyticsConfiguration',
737
+ model: 'AnalyticsConfiguration',
738
+ attempt: retryCount,
739
+ maxRetries: MAX_RETRIES,
740
+ recordId: props.id,
741
+ });
550
742
  await new Promise(resolve => setTimeout(resolve, delay));
551
743
  continue;
552
744
  }
553
- // Log the error and rethrow
554
- logger_1.logger.error("Database error occurred", { error: String(error) });
745
+ // Log structured error details and rethrow
746
+ logger_1.logger.error("Database delete operation failed", {
747
+ operation: 'deleteOneAnalyticsConfiguration',
748
+ model: 'AnalyticsConfiguration',
749
+ error: String(error),
750
+ recordId: props.id,
751
+ isRetryable: isConnectionError,
752
+ });
555
753
  throw error;
556
754
  }
557
755
  }
@@ -621,12 +819,22 @@ exports.AnalyticsConfiguration = {
621
819
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
622
820
  retryCount++;
623
821
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
624
- logger_1.logger.warn("Database connection error, retrying...");
822
+ logger_1.logger.warn("Database connection error in getAnalyticsConfiguration, retrying...", {
823
+ operation: 'getAnalyticsConfiguration',
824
+ model: 'AnalyticsConfiguration',
825
+ attempt: retryCount,
826
+ maxRetries: MAX_RETRIES,
827
+ });
625
828
  await new Promise(resolve => setTimeout(resolve, delay));
626
829
  continue;
627
830
  }
628
- // Log the error and rethrow
629
- logger_1.logger.error("Database error occurred", { error: String(error) });
831
+ // Log structured error details and rethrow
832
+ logger_1.logger.error("Database get operation failed", {
833
+ operation: 'getAnalyticsConfiguration',
834
+ model: 'AnalyticsConfiguration',
835
+ error: String(error),
836
+ isRetryable: isConnectionError,
837
+ });
630
838
  throw error;
631
839
  }
632
840
  }
@@ -684,12 +892,22 @@ exports.AnalyticsConfiguration = {
684
892
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
685
893
  retryCount++;
686
894
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
687
- logger_1.logger.warn("Database connection error, retrying...");
895
+ logger_1.logger.warn("Database connection error in getAllAnalyticsConfiguration, retrying...", {
896
+ operation: 'getAllAnalyticsConfiguration',
897
+ model: 'AnalyticsConfiguration',
898
+ attempt: retryCount,
899
+ maxRetries: MAX_RETRIES,
900
+ });
688
901
  await new Promise(resolve => setTimeout(resolve, delay));
689
902
  continue;
690
903
  }
691
- // Log the error and rethrow
692
- logger_1.logger.error("Database error occurred", { error: String(error) });
904
+ // Log structured error details and rethrow
905
+ logger_1.logger.error("Database getAll operation failed", {
906
+ operation: 'getAllAnalyticsConfiguration',
907
+ model: 'AnalyticsConfiguration',
908
+ error: String(error),
909
+ isRetryable: isConnectionError,
910
+ });
693
911
  throw error;
694
912
  }
695
913
  }
@@ -766,12 +984,22 @@ exports.AnalyticsConfiguration = {
766
984
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
767
985
  retryCount++;
768
986
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
769
- logger_1.logger.warn("Database connection error, retrying...");
987
+ logger_1.logger.warn("Database connection error in findManyAnalyticsConfiguration, retrying...", {
988
+ operation: 'findManyAnalyticsConfiguration',
989
+ model: 'AnalyticsConfiguration',
990
+ attempt: retryCount,
991
+ maxRetries: MAX_RETRIES,
992
+ });
770
993
  await new Promise(resolve => setTimeout(resolve, delay));
771
994
  continue;
772
995
  }
773
- // Log the error and rethrow
774
- logger_1.logger.error("Database error occurred", { error: String(error) });
996
+ // Log structured error details and rethrow
997
+ logger_1.logger.error("Database findMany operation failed", {
998
+ operation: 'findManyAnalyticsConfiguration',
999
+ model: 'AnalyticsConfiguration',
1000
+ error: String(error),
1001
+ isRetryable: isConnectionError,
1002
+ });
775
1003
  throw error;
776
1004
  }
777
1005
  }