@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
@@ -137,7 +137,7 @@ exports.NewsArticleAssetSentiment = {
137
137
  * @returns The created NewsArticleAssetSentiment or null.
138
138
  */
139
139
  async create(props, globalClient) {
140
- var _a, _b, _c, _d, _e;
140
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
141
141
  // Maximum number of retries for database connection issues
142
142
  const MAX_RETRIES = 3;
143
143
  let retryCount = 0;
@@ -332,21 +332,52 @@ exports.NewsArticleAssetSentiment = {
332
332
  }
333
333
  catch (error) {
334
334
  lastError = error;
335
+ // Check for constraint violations FIRST - these are NEVER retryable
336
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
337
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
338
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
339
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
340
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
341
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
342
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
343
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
344
+ if (isConstraintViolation) {
345
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
346
+ logger_1.logger.error("Non-retryable constraint violation in createOneNewsArticleAssetSentiment", {
347
+ operation: 'createOneNewsArticleAssetSentiment',
348
+ model: 'NewsArticleAssetSentiment',
349
+ error: String(error),
350
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
351
+ errorCategory: 'CONSTRAINT_VIOLATION',
352
+ isRetryable: false,
353
+ });
354
+ throw error;
355
+ }
335
356
  // Check if this is a database connection error that we should retry
336
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
337
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
338
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
339
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
340
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
357
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
358
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
359
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
360
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
361
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
341
362
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
342
363
  retryCount++;
343
364
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
344
- logger_1.logger.warn("Database connection error, retrying...");
365
+ logger_1.logger.warn("Database connection error in createOneNewsArticleAssetSentiment, retrying...", {
366
+ operation: 'createOneNewsArticleAssetSentiment',
367
+ model: 'NewsArticleAssetSentiment',
368
+ attempt: retryCount,
369
+ maxRetries: MAX_RETRIES,
370
+ });
345
371
  await new Promise(resolve => setTimeout(resolve, delay));
346
372
  continue;
347
373
  }
348
- // Log the error and rethrow
349
- logger_1.logger.error("Database error occurred", { error: String(error) });
374
+ // Log structured error details and rethrow
375
+ logger_1.logger.error("Database create operation failed", {
376
+ operation: 'createOneNewsArticleAssetSentiment',
377
+ model: 'NewsArticleAssetSentiment',
378
+ error: String(error),
379
+ isRetryable: isConnectionError,
380
+ });
350
381
  throw error;
351
382
  }
352
383
  }
@@ -361,7 +392,7 @@ exports.NewsArticleAssetSentiment = {
361
392
  * @returns The count of created records or null.
362
393
  */
363
394
  async createMany(props, globalClient) {
364
- var _a, _b, _c, _d, _e;
395
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
365
396
  // Maximum number of retries for database connection issues
366
397
  const MAX_RETRIES = 3;
367
398
  let retryCount = 0;
@@ -410,21 +441,52 @@ exports.NewsArticleAssetSentiment = {
410
441
  }
411
442
  catch (error) {
412
443
  lastError = error;
444
+ // Check for constraint violations FIRST - these are NEVER retryable
445
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
446
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
447
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
448
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
449
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
450
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
451
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
452
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
453
+ if (isConstraintViolation) {
454
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
455
+ logger_1.logger.error("Non-retryable constraint violation in createManyNewsArticleAssetSentiment", {
456
+ operation: 'createManyNewsArticleAssetSentiment',
457
+ model: 'NewsArticleAssetSentiment',
458
+ error: String(error),
459
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
460
+ errorCategory: 'CONSTRAINT_VIOLATION',
461
+ isRetryable: false,
462
+ });
463
+ throw error;
464
+ }
413
465
  // Check if this is a database connection error that we should retry
414
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
415
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
416
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
417
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
418
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
466
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
467
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
468
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
469
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
470
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
419
471
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
420
472
  retryCount++;
421
473
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
422
- logger_1.logger.warn("Database connection error, retrying...");
474
+ logger_1.logger.warn("Database connection error in createManyNewsArticleAssetSentiment, retrying...", {
475
+ operation: 'createManyNewsArticleAssetSentiment',
476
+ model: 'NewsArticleAssetSentiment',
477
+ attempt: retryCount,
478
+ maxRetries: MAX_RETRIES,
479
+ });
423
480
  await new Promise(resolve => setTimeout(resolve, delay));
424
481
  continue;
425
482
  }
426
- // Log the error and rethrow
427
- logger_1.logger.error("Database error occurred", { error: String(error) });
483
+ // Log structured error details and rethrow
484
+ logger_1.logger.error("Database createMany operation failed", {
485
+ operation: 'createManyNewsArticleAssetSentiment',
486
+ model: 'NewsArticleAssetSentiment',
487
+ error: String(error),
488
+ isRetryable: isConnectionError,
489
+ });
428
490
  throw error;
429
491
  }
430
492
  }
@@ -439,7 +501,7 @@ exports.NewsArticleAssetSentiment = {
439
501
  * @returns The updated NewsArticleAssetSentiment or null.
440
502
  */
441
503
  async update(props, globalClient) {
442
- var _a, _b, _c, _d, _e;
504
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
443
505
  // Maximum number of retries for database connection issues
444
506
  const MAX_RETRIES = 3;
445
507
  let retryCount = 0;
@@ -969,21 +1031,55 @@ exports.NewsArticleAssetSentiment = {
969
1031
  }
970
1032
  catch (error) {
971
1033
  lastError = error;
1034
+ // Check for constraint violations FIRST - these are NEVER retryable
1035
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
1036
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
1037
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
1038
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
1039
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
1040
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
1041
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
1042
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
1043
+ if (isConstraintViolation) {
1044
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
1045
+ logger_1.logger.error("Non-retryable constraint violation in updateOneNewsArticleAssetSentiment", {
1046
+ operation: 'updateOneNewsArticleAssetSentiment',
1047
+ model: 'NewsArticleAssetSentiment',
1048
+ error: String(error),
1049
+ recordId: props.id,
1050
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
1051
+ errorCategory: 'CONSTRAINT_VIOLATION',
1052
+ isRetryable: false,
1053
+ });
1054
+ throw error;
1055
+ }
972
1056
  // Check if this is a database connection error that we should retry
973
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
974
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
975
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
976
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
977
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
1057
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
1058
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
1059
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
1060
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
1061
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
978
1062
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
979
1063
  retryCount++;
980
1064
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
981
- logger_1.logger.warn("Database connection error, retrying...");
1065
+ logger_1.logger.warn("Database connection error in updateOneNewsArticleAssetSentiment, retrying...", {
1066
+ operation: 'updateOneNewsArticleAssetSentiment',
1067
+ model: 'NewsArticleAssetSentiment',
1068
+ attempt: retryCount,
1069
+ maxRetries: MAX_RETRIES,
1070
+ recordId: props.id,
1071
+ });
982
1072
  await new Promise(resolve => setTimeout(resolve, delay));
983
1073
  continue;
984
1074
  }
985
- // Log the error and rethrow
986
- logger_1.logger.error("Database error occurred", { error: String(error) });
1075
+ // Log structured error details and rethrow
1076
+ logger_1.logger.error("Database update operation failed", {
1077
+ operation: 'updateOneNewsArticleAssetSentiment',
1078
+ model: 'NewsArticleAssetSentiment',
1079
+ error: String(error),
1080
+ recordId: props.id,
1081
+ isRetryable: isConnectionError,
1082
+ });
987
1083
  throw error;
988
1084
  }
989
1085
  }
@@ -998,7 +1094,7 @@ exports.NewsArticleAssetSentiment = {
998
1094
  * @returns The updated NewsArticleAssetSentiment or null.
999
1095
  */
1000
1096
  async upsert(props, globalClient) {
1001
- var _a, _b, _c, _d, _e;
1097
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1002
1098
  // Maximum number of retries for database connection issues
1003
1099
  const MAX_RETRIES = 3;
1004
1100
  let retryCount = 0;
@@ -1678,21 +1774,55 @@ exports.NewsArticleAssetSentiment = {
1678
1774
  }
1679
1775
  catch (error) {
1680
1776
  lastError = error;
1777
+ // Check for constraint violations FIRST - these are NEVER retryable
1778
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
1779
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
1780
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
1781
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
1782
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
1783
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
1784
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
1785
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
1786
+ if (isConstraintViolation) {
1787
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
1788
+ logger_1.logger.error("Non-retryable constraint violation in upsertOneNewsArticleAssetSentiment", {
1789
+ operation: 'upsertOneNewsArticleAssetSentiment',
1790
+ model: 'NewsArticleAssetSentiment',
1791
+ error: String(error),
1792
+ recordId: props.id,
1793
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
1794
+ errorCategory: 'CONSTRAINT_VIOLATION',
1795
+ isRetryable: false,
1796
+ });
1797
+ throw error;
1798
+ }
1681
1799
  // Check if this is a database connection error that we should retry
1682
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
1683
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
1684
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
1685
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
1686
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
1800
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
1801
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
1802
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
1803
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
1804
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
1687
1805
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
1688
1806
  retryCount++;
1689
1807
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
1690
- logger_1.logger.warn("Database connection error, retrying...");
1808
+ logger_1.logger.warn("Database connection error in upsertOneNewsArticleAssetSentiment, retrying...", {
1809
+ operation: 'upsertOneNewsArticleAssetSentiment',
1810
+ model: 'NewsArticleAssetSentiment',
1811
+ attempt: retryCount,
1812
+ maxRetries: MAX_RETRIES,
1813
+ recordId: props.id,
1814
+ });
1691
1815
  await new Promise(resolve => setTimeout(resolve, delay));
1692
1816
  continue;
1693
1817
  }
1694
- // Log the error and rethrow
1695
- logger_1.logger.error("Database error occurred", { error: String(error) });
1818
+ // Log structured error details and rethrow
1819
+ logger_1.logger.error("Database upsert operation failed", {
1820
+ operation: 'upsertOneNewsArticleAssetSentiment',
1821
+ model: 'NewsArticleAssetSentiment',
1822
+ error: String(error),
1823
+ recordId: props.id,
1824
+ isRetryable: isConnectionError,
1825
+ });
1696
1826
  throw error;
1697
1827
  }
1698
1828
  }
@@ -1707,7 +1837,7 @@ exports.NewsArticleAssetSentiment = {
1707
1837
  * @returns The count of created records or null.
1708
1838
  */
1709
1839
  async updateMany(props, globalClient) {
1710
- var _a, _b, _c, _d, _e;
1840
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1711
1841
  // Maximum number of retries for database connection issues
1712
1842
  const MAX_RETRIES = 3;
1713
1843
  let retryCount = 0;
@@ -2237,21 +2367,52 @@ exports.NewsArticleAssetSentiment = {
2237
2367
  }
2238
2368
  catch (error) {
2239
2369
  lastError = error;
2370
+ // Check for constraint violations FIRST - these are NEVER retryable
2371
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
2372
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
2373
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
2374
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
2375
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
2376
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
2377
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
2378
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
2379
+ if (isConstraintViolation) {
2380
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
2381
+ logger_1.logger.error("Non-retryable constraint violation in updateManyNewsArticleAssetSentiment", {
2382
+ operation: 'updateManyNewsArticleAssetSentiment',
2383
+ model: 'NewsArticleAssetSentiment',
2384
+ error: String(error),
2385
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
2386
+ errorCategory: 'CONSTRAINT_VIOLATION',
2387
+ isRetryable: false,
2388
+ });
2389
+ throw error;
2390
+ }
2240
2391
  // Check if this is a database connection error that we should retry
2241
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
2242
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
2243
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
2244
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
2245
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
2392
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
2393
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
2394
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
2395
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
2396
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
2246
2397
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
2247
2398
  retryCount++;
2248
2399
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
2249
- logger_1.logger.warn("Database connection error, retrying...");
2400
+ logger_1.logger.warn("Database connection error in updateManyNewsArticleAssetSentiment, retrying...", {
2401
+ operation: 'updateManyNewsArticleAssetSentiment',
2402
+ model: 'NewsArticleAssetSentiment',
2403
+ attempt: retryCount,
2404
+ maxRetries: MAX_RETRIES,
2405
+ });
2250
2406
  await new Promise(resolve => setTimeout(resolve, delay));
2251
2407
  continue;
2252
2408
  }
2253
- // Log the error and rethrow
2254
- logger_1.logger.error("Database error occurred", { error: String(error) });
2409
+ // Log structured error details and rethrow
2410
+ logger_1.logger.error("Database updateMany operation failed", {
2411
+ operation: 'updateManyNewsArticleAssetSentiment',
2412
+ model: 'NewsArticleAssetSentiment',
2413
+ error: String(error),
2414
+ isRetryable: isConnectionError,
2415
+ });
2255
2416
  throw error;
2256
2417
  }
2257
2418
  }
@@ -2266,7 +2427,7 @@ exports.NewsArticleAssetSentiment = {
2266
2427
  * @returns The deleted NewsArticleAssetSentiment or null.
2267
2428
  */
2268
2429
  async delete(props, globalClient) {
2269
- var _a, _b, _c, _d, _e;
2430
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
2270
2431
  // Maximum number of retries for database connection issues
2271
2432
  const MAX_RETRIES = 3;
2272
2433
  let retryCount = 0;
@@ -2310,21 +2471,58 @@ exports.NewsArticleAssetSentiment = {
2310
2471
  }
2311
2472
  catch (error) {
2312
2473
  lastError = error;
2474
+ // Check for constraint violations FIRST - these are NEVER retryable
2475
+ // (e.g., foreign key constraints preventing deletion)
2476
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
2477
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
2478
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
2479
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
2480
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
2481
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
2482
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
2483
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
2484
+ ((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
2485
+ ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
2486
+ if (isConstraintViolation) {
2487
+ const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
2488
+ logger_1.logger.error("Non-retryable constraint violation in deleteOneNewsArticleAssetSentiment", {
2489
+ operation: 'deleteOneNewsArticleAssetSentiment',
2490
+ model: 'NewsArticleAssetSentiment',
2491
+ error: String(error),
2492
+ recordId: props.id,
2493
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
2494
+ errorCategory: 'CONSTRAINT_VIOLATION',
2495
+ isRetryable: false,
2496
+ });
2497
+ throw error;
2498
+ }
2313
2499
  // Check if this is a database connection error that we should retry
2314
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
2315
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
2316
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
2317
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
2318
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
2500
+ const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
2501
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
2502
+ ((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
2503
+ ((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
2504
+ (error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
2319
2505
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
2320
2506
  retryCount++;
2321
2507
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
2322
- logger_1.logger.warn("Database connection error, retrying...");
2508
+ logger_1.logger.warn("Database connection error in deleteOneNewsArticleAssetSentiment, retrying...", {
2509
+ operation: 'deleteOneNewsArticleAssetSentiment',
2510
+ model: 'NewsArticleAssetSentiment',
2511
+ attempt: retryCount,
2512
+ maxRetries: MAX_RETRIES,
2513
+ recordId: props.id,
2514
+ });
2323
2515
  await new Promise(resolve => setTimeout(resolve, delay));
2324
2516
  continue;
2325
2517
  }
2326
- // Log the error and rethrow
2327
- logger_1.logger.error("Database error occurred", { error: String(error) });
2518
+ // Log structured error details and rethrow
2519
+ logger_1.logger.error("Database delete operation failed", {
2520
+ operation: 'deleteOneNewsArticleAssetSentiment',
2521
+ model: 'NewsArticleAssetSentiment',
2522
+ error: String(error),
2523
+ recordId: props.id,
2524
+ isRetryable: isConnectionError,
2525
+ });
2328
2526
  throw error;
2329
2527
  }
2330
2528
  }
@@ -2395,12 +2593,22 @@ exports.NewsArticleAssetSentiment = {
2395
2593
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
2396
2594
  retryCount++;
2397
2595
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
2398
- logger_1.logger.warn("Database connection error, retrying...");
2596
+ logger_1.logger.warn("Database connection error in getNewsArticleAssetSentiment, retrying...", {
2597
+ operation: 'getNewsArticleAssetSentiment',
2598
+ model: 'NewsArticleAssetSentiment',
2599
+ attempt: retryCount,
2600
+ maxRetries: MAX_RETRIES,
2601
+ });
2399
2602
  await new Promise(resolve => setTimeout(resolve, delay));
2400
2603
  continue;
2401
2604
  }
2402
- // Log the error and rethrow
2403
- logger_1.logger.error("Database error occurred", { error: String(error) });
2605
+ // Log structured error details and rethrow
2606
+ logger_1.logger.error("Database get operation failed", {
2607
+ operation: 'getNewsArticleAssetSentiment',
2608
+ model: 'NewsArticleAssetSentiment',
2609
+ error: String(error),
2610
+ isRetryable: isConnectionError,
2611
+ });
2404
2612
  throw error;
2405
2613
  }
2406
2614
  }
@@ -2458,12 +2666,22 @@ exports.NewsArticleAssetSentiment = {
2458
2666
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
2459
2667
  retryCount++;
2460
2668
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
2461
- logger_1.logger.warn("Database connection error, retrying...");
2669
+ logger_1.logger.warn("Database connection error in getAllNewsArticleAssetSentiment, retrying...", {
2670
+ operation: 'getAllNewsArticleAssetSentiment',
2671
+ model: 'NewsArticleAssetSentiment',
2672
+ attempt: retryCount,
2673
+ maxRetries: MAX_RETRIES,
2674
+ });
2462
2675
  await new Promise(resolve => setTimeout(resolve, delay));
2463
2676
  continue;
2464
2677
  }
2465
- // Log the error and rethrow
2466
- logger_1.logger.error("Database error occurred", { error: String(error) });
2678
+ // Log structured error details and rethrow
2679
+ logger_1.logger.error("Database getAll operation failed", {
2680
+ operation: 'getAllNewsArticleAssetSentiment',
2681
+ model: 'NewsArticleAssetSentiment',
2682
+ error: String(error),
2683
+ isRetryable: isConnectionError,
2684
+ });
2467
2685
  throw error;
2468
2686
  }
2469
2687
  }
@@ -2543,12 +2761,22 @@ exports.NewsArticleAssetSentiment = {
2543
2761
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
2544
2762
  retryCount++;
2545
2763
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
2546
- logger_1.logger.warn("Database connection error, retrying...");
2764
+ logger_1.logger.warn("Database connection error in findManyNewsArticleAssetSentiment, retrying...", {
2765
+ operation: 'findManyNewsArticleAssetSentiment',
2766
+ model: 'NewsArticleAssetSentiment',
2767
+ attempt: retryCount,
2768
+ maxRetries: MAX_RETRIES,
2769
+ });
2547
2770
  await new Promise(resolve => setTimeout(resolve, delay));
2548
2771
  continue;
2549
2772
  }
2550
- // Log the error and rethrow
2551
- logger_1.logger.error("Database error occurred", { error: String(error) });
2773
+ // Log structured error details and rethrow
2774
+ logger_1.logger.error("Database findMany operation failed", {
2775
+ operation: 'findManyNewsArticleAssetSentiment',
2776
+ model: 'NewsArticleAssetSentiment',
2777
+ error: String(error),
2778
+ isRetryable: isConnectionError,
2779
+ });
2552
2780
  throw error;
2553
2781
  }
2554
2782
  }