@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
@@ -212,7 +212,7 @@ exports.OptionsGreeksHistory = {
212
212
  * @returns The created OptionsGreeksHistory or null.
213
213
  */
214
214
  async create(props, globalClient) {
215
- var _a, _b, _c, _d, _e;
215
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
216
216
  // Maximum number of retries for database connection issues
217
217
  const MAX_RETRIES = 3;
218
218
  let retryCount = 0;
@@ -424,21 +424,52 @@ exports.OptionsGreeksHistory = {
424
424
  }
425
425
  catch (error) {
426
426
  lastError = error;
427
+ // Check for constraint violations FIRST - these are NEVER retryable
428
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
429
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
430
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
431
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
432
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
433
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
434
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
435
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
436
+ if (isConstraintViolation) {
437
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
438
+ logger_1.logger.error("Non-retryable constraint violation in createOneOptionsGreeksHistory", {
439
+ operation: 'createOneOptionsGreeksHistory',
440
+ model: 'OptionsGreeksHistory',
441
+ error: String(error),
442
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
443
+ errorCategory: 'CONSTRAINT_VIOLATION',
444
+ isRetryable: false,
445
+ });
446
+ throw error;
447
+ }
427
448
  // Check if this is a database connection error that we should retry
428
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
429
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
430
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
431
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
432
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
449
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
450
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
451
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
452
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
453
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
433
454
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
434
455
  retryCount++;
435
456
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
436
- logger_1.logger.warn("Database connection error, retrying...");
457
+ logger_1.logger.warn("Database connection error in createOneOptionsGreeksHistory, retrying...", {
458
+ operation: 'createOneOptionsGreeksHistory',
459
+ model: 'OptionsGreeksHistory',
460
+ attempt: retryCount,
461
+ maxRetries: MAX_RETRIES,
462
+ });
437
463
  await new Promise(resolve => setTimeout(resolve, delay));
438
464
  continue;
439
465
  }
440
- // Log the error and rethrow
441
- logger_1.logger.error("Database error occurred", { error: String(error) });
466
+ // Log structured error details and rethrow
467
+ logger_1.logger.error("Database create operation failed", {
468
+ operation: 'createOneOptionsGreeksHistory',
469
+ model: 'OptionsGreeksHistory',
470
+ error: String(error),
471
+ isRetryable: isConnectionError,
472
+ });
442
473
  throw error;
443
474
  }
444
475
  }
@@ -453,7 +484,7 @@ exports.OptionsGreeksHistory = {
453
484
  * @returns The count of created records or null.
454
485
  */
455
486
  async createMany(props, globalClient) {
456
- var _a, _b, _c, _d, _e;
487
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
457
488
  // Maximum number of retries for database connection issues
458
489
  const MAX_RETRIES = 3;
459
490
  let retryCount = 0;
@@ -502,21 +533,52 @@ exports.OptionsGreeksHistory = {
502
533
  }
503
534
  catch (error) {
504
535
  lastError = error;
536
+ // Check for constraint violations FIRST - these are NEVER retryable
537
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
538
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
539
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
540
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
541
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
542
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
543
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
544
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
545
+ if (isConstraintViolation) {
546
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
547
+ logger_1.logger.error("Non-retryable constraint violation in createManyOptionsGreeksHistory", {
548
+ operation: 'createManyOptionsGreeksHistory',
549
+ model: 'OptionsGreeksHistory',
550
+ error: String(error),
551
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
552
+ errorCategory: 'CONSTRAINT_VIOLATION',
553
+ isRetryable: false,
554
+ });
555
+ throw error;
556
+ }
505
557
  // Check if this is a database connection error that we should retry
506
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
507
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
508
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
509
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
510
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
558
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
559
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
560
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
561
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
562
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
511
563
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
512
564
  retryCount++;
513
565
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
514
- logger_1.logger.warn("Database connection error, retrying...");
566
+ logger_1.logger.warn("Database connection error in createManyOptionsGreeksHistory, retrying...", {
567
+ operation: 'createManyOptionsGreeksHistory',
568
+ model: 'OptionsGreeksHistory',
569
+ attempt: retryCount,
570
+ maxRetries: MAX_RETRIES,
571
+ });
515
572
  await new Promise(resolve => setTimeout(resolve, delay));
516
573
  continue;
517
574
  }
518
- // Log the error and rethrow
519
- logger_1.logger.error("Database error occurred", { error: String(error) });
575
+ // Log structured error details and rethrow
576
+ logger_1.logger.error("Database createMany operation failed", {
577
+ operation: 'createManyOptionsGreeksHistory',
578
+ model: 'OptionsGreeksHistory',
579
+ error: String(error),
580
+ isRetryable: isConnectionError,
581
+ });
520
582
  throw error;
521
583
  }
522
584
  }
@@ -531,7 +593,7 @@ exports.OptionsGreeksHistory = {
531
593
  * @returns The updated OptionsGreeksHistory or null.
532
594
  */
533
595
  async update(props, globalClient) {
534
- var _a, _b, _c, _d, _e;
596
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
535
597
  // Maximum number of retries for database connection issues
536
598
  const MAX_RETRIES = 3;
537
599
  let retryCount = 0;
@@ -1420,21 +1482,55 @@ exports.OptionsGreeksHistory = {
1420
1482
  }
1421
1483
  catch (error) {
1422
1484
  lastError = error;
1485
+ // Check for constraint violations FIRST - these are NEVER retryable
1486
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
1487
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
1488
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
1489
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
1490
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
1491
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
1492
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
1493
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
1494
+ if (isConstraintViolation) {
1495
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
1496
+ logger_1.logger.error("Non-retryable constraint violation in updateOneOptionsGreeksHistory", {
1497
+ operation: 'updateOneOptionsGreeksHistory',
1498
+ model: 'OptionsGreeksHistory',
1499
+ error: String(error),
1500
+ recordId: props.id,
1501
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
1502
+ errorCategory: 'CONSTRAINT_VIOLATION',
1503
+ isRetryable: false,
1504
+ });
1505
+ throw error;
1506
+ }
1423
1507
  // Check if this is a database connection error that we should retry
1424
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
1425
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
1426
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
1427
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
1428
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
1508
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
1509
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
1510
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
1511
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
1512
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
1429
1513
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
1430
1514
  retryCount++;
1431
1515
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
1432
- logger_1.logger.warn("Database connection error, retrying...");
1516
+ logger_1.logger.warn("Database connection error in updateOneOptionsGreeksHistory, retrying...", {
1517
+ operation: 'updateOneOptionsGreeksHistory',
1518
+ model: 'OptionsGreeksHistory',
1519
+ attempt: retryCount,
1520
+ maxRetries: MAX_RETRIES,
1521
+ recordId: props.id,
1522
+ });
1433
1523
  await new Promise(resolve => setTimeout(resolve, delay));
1434
1524
  continue;
1435
1525
  }
1436
- // Log the error and rethrow
1437
- logger_1.logger.error("Database error occurred", { error: String(error) });
1526
+ // Log structured error details and rethrow
1527
+ logger_1.logger.error("Database update operation failed", {
1528
+ operation: 'updateOneOptionsGreeksHistory',
1529
+ model: 'OptionsGreeksHistory',
1530
+ error: String(error),
1531
+ recordId: props.id,
1532
+ isRetryable: isConnectionError,
1533
+ });
1438
1534
  throw error;
1439
1535
  }
1440
1536
  }
@@ -1449,7 +1545,7 @@ exports.OptionsGreeksHistory = {
1449
1545
  * @returns The updated OptionsGreeksHistory or null.
1450
1546
  */
1451
1547
  async upsert(props, globalClient) {
1452
- var _a, _b, _c, _d, _e;
1548
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1453
1549
  // Maximum number of retries for database connection issues
1454
1550
  const MAX_RETRIES = 3;
1455
1551
  let retryCount = 0;
@@ -2502,21 +2598,55 @@ exports.OptionsGreeksHistory = {
2502
2598
  }
2503
2599
  catch (error) {
2504
2600
  lastError = error;
2601
+ // Check for constraint violations FIRST - these are NEVER retryable
2602
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
2603
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
2604
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
2605
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
2606
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
2607
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
2608
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
2609
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
2610
+ if (isConstraintViolation) {
2611
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
2612
+ logger_1.logger.error("Non-retryable constraint violation in upsertOneOptionsGreeksHistory", {
2613
+ operation: 'upsertOneOptionsGreeksHistory',
2614
+ model: 'OptionsGreeksHistory',
2615
+ error: String(error),
2616
+ recordId: props.id,
2617
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
2618
+ errorCategory: 'CONSTRAINT_VIOLATION',
2619
+ isRetryable: false,
2620
+ });
2621
+ throw error;
2622
+ }
2505
2623
  // Check if this is a database connection error that we should retry
2506
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
2507
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
2508
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
2509
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
2510
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
2624
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
2625
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
2626
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
2627
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
2628
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
2511
2629
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
2512
2630
  retryCount++;
2513
2631
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
2514
- logger_1.logger.warn("Database connection error, retrying...");
2632
+ logger_1.logger.warn("Database connection error in upsertOneOptionsGreeksHistory, retrying...", {
2633
+ operation: 'upsertOneOptionsGreeksHistory',
2634
+ model: 'OptionsGreeksHistory',
2635
+ attempt: retryCount,
2636
+ maxRetries: MAX_RETRIES,
2637
+ recordId: props.id,
2638
+ });
2515
2639
  await new Promise(resolve => setTimeout(resolve, delay));
2516
2640
  continue;
2517
2641
  }
2518
- // Log the error and rethrow
2519
- logger_1.logger.error("Database error occurred", { error: String(error) });
2642
+ // Log structured error details and rethrow
2643
+ logger_1.logger.error("Database upsert operation failed", {
2644
+ operation: 'upsertOneOptionsGreeksHistory',
2645
+ model: 'OptionsGreeksHistory',
2646
+ error: String(error),
2647
+ recordId: props.id,
2648
+ isRetryable: isConnectionError,
2649
+ });
2520
2650
  throw error;
2521
2651
  }
2522
2652
  }
@@ -2531,7 +2661,7 @@ exports.OptionsGreeksHistory = {
2531
2661
  * @returns The count of created records or null.
2532
2662
  */
2533
2663
  async updateMany(props, globalClient) {
2534
- var _a, _b, _c, _d, _e;
2664
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
2535
2665
  // Maximum number of retries for database connection issues
2536
2666
  const MAX_RETRIES = 3;
2537
2667
  let retryCount = 0;
@@ -3420,21 +3550,52 @@ exports.OptionsGreeksHistory = {
3420
3550
  }
3421
3551
  catch (error) {
3422
3552
  lastError = error;
3553
+ // Check for constraint violations FIRST - these are NEVER retryable
3554
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
3555
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
3556
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
3557
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
3558
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
3559
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
3560
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
3561
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
3562
+ if (isConstraintViolation) {
3563
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
3564
+ logger_1.logger.error("Non-retryable constraint violation in updateManyOptionsGreeksHistory", {
3565
+ operation: 'updateManyOptionsGreeksHistory',
3566
+ model: 'OptionsGreeksHistory',
3567
+ error: String(error),
3568
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
3569
+ errorCategory: 'CONSTRAINT_VIOLATION',
3570
+ isRetryable: false,
3571
+ });
3572
+ throw error;
3573
+ }
3423
3574
  // Check if this is a database connection error that we should retry
3424
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
3425
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
3426
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
3427
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
3428
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
3575
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
3576
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
3577
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
3578
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
3579
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
3429
3580
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
3430
3581
  retryCount++;
3431
3582
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
3432
- logger_1.logger.warn("Database connection error, retrying...");
3583
+ logger_1.logger.warn("Database connection error in updateManyOptionsGreeksHistory, retrying...", {
3584
+ operation: 'updateManyOptionsGreeksHistory',
3585
+ model: 'OptionsGreeksHistory',
3586
+ attempt: retryCount,
3587
+ maxRetries: MAX_RETRIES,
3588
+ });
3433
3589
  await new Promise(resolve => setTimeout(resolve, delay));
3434
3590
  continue;
3435
3591
  }
3436
- // Log the error and rethrow
3437
- logger_1.logger.error("Database error occurred", { error: String(error) });
3592
+ // Log structured error details and rethrow
3593
+ logger_1.logger.error("Database updateMany operation failed", {
3594
+ operation: 'updateManyOptionsGreeksHistory',
3595
+ model: 'OptionsGreeksHistory',
3596
+ error: String(error),
3597
+ isRetryable: isConnectionError,
3598
+ });
3438
3599
  throw error;
3439
3600
  }
3440
3601
  }
@@ -3449,7 +3610,7 @@ exports.OptionsGreeksHistory = {
3449
3610
  * @returns The deleted OptionsGreeksHistory or null.
3450
3611
  */
3451
3612
  async delete(props, globalClient) {
3452
- var _a, _b, _c, _d, _e;
3613
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
3453
3614
  // Maximum number of retries for database connection issues
3454
3615
  const MAX_RETRIES = 3;
3455
3616
  let retryCount = 0;
@@ -3493,21 +3654,58 @@ exports.OptionsGreeksHistory = {
3493
3654
  }
3494
3655
  catch (error) {
3495
3656
  lastError = error;
3657
+ // Check for constraint violations FIRST - these are NEVER retryable
3658
+ // (e.g., foreign key constraints preventing deletion)
3659
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
3660
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
3661
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
3662
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
3663
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
3664
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
3665
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
3666
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
3667
+ ((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
3668
+ ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
3669
+ if (isConstraintViolation) {
3670
+ const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
3671
+ logger_1.logger.error("Non-retryable constraint violation in deleteOneOptionsGreeksHistory", {
3672
+ operation: 'deleteOneOptionsGreeksHistory',
3673
+ model: 'OptionsGreeksHistory',
3674
+ error: String(error),
3675
+ recordId: props.id,
3676
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
3677
+ errorCategory: 'CONSTRAINT_VIOLATION',
3678
+ isRetryable: false,
3679
+ });
3680
+ throw error;
3681
+ }
3496
3682
  // Check if this is a database connection error that we should retry
3497
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
3498
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
3499
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
3500
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
3501
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
3683
+ const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
3684
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
3685
+ ((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
3686
+ ((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
3687
+ (error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
3502
3688
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
3503
3689
  retryCount++;
3504
3690
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
3505
- logger_1.logger.warn("Database connection error, retrying...");
3691
+ logger_1.logger.warn("Database connection error in deleteOneOptionsGreeksHistory, retrying...", {
3692
+ operation: 'deleteOneOptionsGreeksHistory',
3693
+ model: 'OptionsGreeksHistory',
3694
+ attempt: retryCount,
3695
+ maxRetries: MAX_RETRIES,
3696
+ recordId: props.id,
3697
+ });
3506
3698
  await new Promise(resolve => setTimeout(resolve, delay));
3507
3699
  continue;
3508
3700
  }
3509
- // Log the error and rethrow
3510
- logger_1.logger.error("Database error occurred", { error: String(error) });
3701
+ // Log structured error details and rethrow
3702
+ logger_1.logger.error("Database delete operation failed", {
3703
+ operation: 'deleteOneOptionsGreeksHistory',
3704
+ model: 'OptionsGreeksHistory',
3705
+ error: String(error),
3706
+ recordId: props.id,
3707
+ isRetryable: isConnectionError,
3708
+ });
3511
3709
  throw error;
3512
3710
  }
3513
3711
  }
@@ -3577,12 +3775,22 @@ exports.OptionsGreeksHistory = {
3577
3775
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
3578
3776
  retryCount++;
3579
3777
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
3580
- logger_1.logger.warn("Database connection error, retrying...");
3778
+ logger_1.logger.warn("Database connection error in getOptionsGreeksHistory, retrying...", {
3779
+ operation: 'getOptionsGreeksHistory',
3780
+ model: 'OptionsGreeksHistory',
3781
+ attempt: retryCount,
3782
+ maxRetries: MAX_RETRIES,
3783
+ });
3581
3784
  await new Promise(resolve => setTimeout(resolve, delay));
3582
3785
  continue;
3583
3786
  }
3584
- // Log the error and rethrow
3585
- logger_1.logger.error("Database error occurred", { error: String(error) });
3787
+ // Log structured error details and rethrow
3788
+ logger_1.logger.error("Database get operation failed", {
3789
+ operation: 'getOptionsGreeksHistory',
3790
+ model: 'OptionsGreeksHistory',
3791
+ error: String(error),
3792
+ isRetryable: isConnectionError,
3793
+ });
3586
3794
  throw error;
3587
3795
  }
3588
3796
  }
@@ -3640,12 +3848,22 @@ exports.OptionsGreeksHistory = {
3640
3848
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
3641
3849
  retryCount++;
3642
3850
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
3643
- logger_1.logger.warn("Database connection error, retrying...");
3851
+ logger_1.logger.warn("Database connection error in getAllOptionsGreeksHistory, retrying...", {
3852
+ operation: 'getAllOptionsGreeksHistory',
3853
+ model: 'OptionsGreeksHistory',
3854
+ attempt: retryCount,
3855
+ maxRetries: MAX_RETRIES,
3856
+ });
3644
3857
  await new Promise(resolve => setTimeout(resolve, delay));
3645
3858
  continue;
3646
3859
  }
3647
- // Log the error and rethrow
3648
- logger_1.logger.error("Database error occurred", { error: String(error) });
3860
+ // Log structured error details and rethrow
3861
+ logger_1.logger.error("Database getAll operation failed", {
3862
+ operation: 'getAllOptionsGreeksHistory',
3863
+ model: 'OptionsGreeksHistory',
3864
+ error: String(error),
3865
+ isRetryable: isConnectionError,
3866
+ });
3649
3867
  throw error;
3650
3868
  }
3651
3869
  }
@@ -3722,12 +3940,22 @@ exports.OptionsGreeksHistory = {
3722
3940
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
3723
3941
  retryCount++;
3724
3942
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
3725
- logger_1.logger.warn("Database connection error, retrying...");
3943
+ logger_1.logger.warn("Database connection error in findManyOptionsGreeksHistory, retrying...", {
3944
+ operation: 'findManyOptionsGreeksHistory',
3945
+ model: 'OptionsGreeksHistory',
3946
+ attempt: retryCount,
3947
+ maxRetries: MAX_RETRIES,
3948
+ });
3726
3949
  await new Promise(resolve => setTimeout(resolve, delay));
3727
3950
  continue;
3728
3951
  }
3729
- // Log the error and rethrow
3730
- logger_1.logger.error("Database error occurred", { error: String(error) });
3952
+ // Log structured error details and rethrow
3953
+ logger_1.logger.error("Database findMany operation failed", {
3954
+ operation: 'findManyOptionsGreeksHistory',
3955
+ model: 'OptionsGreeksHistory',
3956
+ error: String(error),
3957
+ isRetryable: isConnectionError,
3958
+ });
3731
3959
  throw error;
3732
3960
  }
3733
3961
  }