@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
@@ -208,7 +208,7 @@ exports.AccountLinkingRequest = {
208
208
  * @returns The created AccountLinkingRequest or null.
209
209
  */
210
210
  async create(props, globalClient) {
211
- var _a, _b, _c, _d, _e;
211
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
212
212
  // Maximum number of retries for database connection issues
213
213
  const MAX_RETRIES = 3;
214
214
  let retryCount = 0;
@@ -567,21 +567,52 @@ exports.AccountLinkingRequest = {
567
567
  }
568
568
  catch (error) {
569
569
  lastError = error;
570
+ // Check for constraint violations FIRST - these are NEVER retryable
571
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
572
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
573
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
574
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
575
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
576
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
577
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
578
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
579
+ if (isConstraintViolation) {
580
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
581
+ logger_1.logger.error("Non-retryable constraint violation in createOneAccountLinkingRequest", {
582
+ operation: 'createOneAccountLinkingRequest',
583
+ model: 'AccountLinkingRequest',
584
+ error: String(error),
585
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
586
+ errorCategory: 'CONSTRAINT_VIOLATION',
587
+ isRetryable: false,
588
+ });
589
+ throw error;
590
+ }
570
591
  // Check if this is a database connection error that we should retry
571
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
572
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
573
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
574
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
575
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
592
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
593
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
594
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
595
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
596
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
576
597
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
577
598
  retryCount++;
578
599
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
579
- logger_1.logger.warn("Database connection error, retrying...");
600
+ logger_1.logger.warn("Database connection error in createOneAccountLinkingRequest, retrying...", {
601
+ operation: 'createOneAccountLinkingRequest',
602
+ model: 'AccountLinkingRequest',
603
+ attempt: retryCount,
604
+ maxRetries: MAX_RETRIES,
605
+ });
580
606
  await new Promise(resolve => setTimeout(resolve, delay));
581
607
  continue;
582
608
  }
583
- // Log the error and rethrow
584
- logger_1.logger.error("Database error occurred", { error: String(error) });
609
+ // Log structured error details and rethrow
610
+ logger_1.logger.error("Database create operation failed", {
611
+ operation: 'createOneAccountLinkingRequest',
612
+ model: 'AccountLinkingRequest',
613
+ error: String(error),
614
+ isRetryable: isConnectionError,
615
+ });
585
616
  throw error;
586
617
  }
587
618
  }
@@ -596,7 +627,7 @@ exports.AccountLinkingRequest = {
596
627
  * @returns The count of created records or null.
597
628
  */
598
629
  async createMany(props, globalClient) {
599
- var _a, _b, _c, _d, _e;
630
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
600
631
  // Maximum number of retries for database connection issues
601
632
  const MAX_RETRIES = 3;
602
633
  let retryCount = 0;
@@ -651,21 +682,52 @@ exports.AccountLinkingRequest = {
651
682
  }
652
683
  catch (error) {
653
684
  lastError = error;
685
+ // Check for constraint violations FIRST - these are NEVER retryable
686
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
687
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
688
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
689
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
690
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
691
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
692
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
693
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
694
+ if (isConstraintViolation) {
695
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
696
+ logger_1.logger.error("Non-retryable constraint violation in createManyAccountLinkingRequest", {
697
+ operation: 'createManyAccountLinkingRequest',
698
+ model: 'AccountLinkingRequest',
699
+ error: String(error),
700
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
701
+ errorCategory: 'CONSTRAINT_VIOLATION',
702
+ isRetryable: false,
703
+ });
704
+ throw error;
705
+ }
654
706
  // Check if this is a database connection error that we should retry
655
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
656
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
657
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
658
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
659
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
707
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
708
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
709
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
710
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
711
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
660
712
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
661
713
  retryCount++;
662
714
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
663
- logger_1.logger.warn("Database connection error, retrying...");
715
+ logger_1.logger.warn("Database connection error in createManyAccountLinkingRequest, retrying...", {
716
+ operation: 'createManyAccountLinkingRequest',
717
+ model: 'AccountLinkingRequest',
718
+ attempt: retryCount,
719
+ maxRetries: MAX_RETRIES,
720
+ });
664
721
  await new Promise(resolve => setTimeout(resolve, delay));
665
722
  continue;
666
723
  }
667
- // Log the error and rethrow
668
- logger_1.logger.error("Database error occurred", { error: String(error) });
724
+ // Log structured error details and rethrow
725
+ logger_1.logger.error("Database createMany operation failed", {
726
+ operation: 'createManyAccountLinkingRequest',
727
+ model: 'AccountLinkingRequest',
728
+ error: String(error),
729
+ isRetryable: isConnectionError,
730
+ });
669
731
  throw error;
670
732
  }
671
733
  }
@@ -680,7 +742,7 @@ exports.AccountLinkingRequest = {
680
742
  * @returns The updated AccountLinkingRequest or null.
681
743
  */
682
744
  async update(props, globalClient) {
683
- var _a, _b, _c, _d, _e;
745
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
684
746
  // Maximum number of retries for database connection issues
685
747
  const MAX_RETRIES = 3;
686
748
  let retryCount = 0;
@@ -1796,21 +1858,55 @@ exports.AccountLinkingRequest = {
1796
1858
  }
1797
1859
  catch (error) {
1798
1860
  lastError = error;
1861
+ // Check for constraint violations FIRST - these are NEVER retryable
1862
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
1863
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
1864
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
1865
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
1866
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
1867
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
1868
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
1869
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
1870
+ if (isConstraintViolation) {
1871
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
1872
+ logger_1.logger.error("Non-retryable constraint violation in updateOneAccountLinkingRequest", {
1873
+ operation: 'updateOneAccountLinkingRequest',
1874
+ model: 'AccountLinkingRequest',
1875
+ error: String(error),
1876
+ recordId: props.id,
1877
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
1878
+ errorCategory: 'CONSTRAINT_VIOLATION',
1879
+ isRetryable: false,
1880
+ });
1881
+ throw error;
1882
+ }
1799
1883
  // Check if this is a database connection error that we should retry
1800
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
1801
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
1802
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
1803
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
1804
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
1884
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
1885
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
1886
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
1887
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
1888
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
1805
1889
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
1806
1890
  retryCount++;
1807
1891
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
1808
- logger_1.logger.warn("Database connection error, retrying...");
1892
+ logger_1.logger.warn("Database connection error in updateOneAccountLinkingRequest, retrying...", {
1893
+ operation: 'updateOneAccountLinkingRequest',
1894
+ model: 'AccountLinkingRequest',
1895
+ attempt: retryCount,
1896
+ maxRetries: MAX_RETRIES,
1897
+ recordId: props.id,
1898
+ });
1809
1899
  await new Promise(resolve => setTimeout(resolve, delay));
1810
1900
  continue;
1811
1901
  }
1812
- // Log the error and rethrow
1813
- logger_1.logger.error("Database error occurred", { error: String(error) });
1902
+ // Log structured error details and rethrow
1903
+ logger_1.logger.error("Database update operation failed", {
1904
+ operation: 'updateOneAccountLinkingRequest',
1905
+ model: 'AccountLinkingRequest',
1906
+ error: String(error),
1907
+ recordId: props.id,
1908
+ isRetryable: isConnectionError,
1909
+ });
1814
1910
  throw error;
1815
1911
  }
1816
1912
  }
@@ -1825,7 +1921,7 @@ exports.AccountLinkingRequest = {
1825
1921
  * @returns The updated AccountLinkingRequest or null.
1826
1922
  */
1827
1923
  async upsert(props, globalClient) {
1828
- var _a, _b, _c, _d, _e;
1924
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1829
1925
  // Maximum number of retries for database connection issues
1830
1926
  const MAX_RETRIES = 3;
1831
1927
  let retryCount = 0;
@@ -3252,21 +3348,55 @@ exports.AccountLinkingRequest = {
3252
3348
  }
3253
3349
  catch (error) {
3254
3350
  lastError = error;
3351
+ // Check for constraint violations FIRST - these are NEVER retryable
3352
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
3353
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
3354
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
3355
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
3356
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
3357
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
3358
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
3359
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
3360
+ if (isConstraintViolation) {
3361
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
3362
+ logger_1.logger.error("Non-retryable constraint violation in upsertOneAccountLinkingRequest", {
3363
+ operation: 'upsertOneAccountLinkingRequest',
3364
+ model: 'AccountLinkingRequest',
3365
+ error: String(error),
3366
+ recordId: props.id,
3367
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
3368
+ errorCategory: 'CONSTRAINT_VIOLATION',
3369
+ isRetryable: false,
3370
+ });
3371
+ throw error;
3372
+ }
3255
3373
  // Check if this is a database connection error that we should retry
3256
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
3257
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
3258
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
3259
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
3260
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
3374
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
3375
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
3376
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
3377
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
3378
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
3261
3379
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
3262
3380
  retryCount++;
3263
3381
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
3264
- logger_1.logger.warn("Database connection error, retrying...");
3382
+ logger_1.logger.warn("Database connection error in upsertOneAccountLinkingRequest, retrying...", {
3383
+ operation: 'upsertOneAccountLinkingRequest',
3384
+ model: 'AccountLinkingRequest',
3385
+ attempt: retryCount,
3386
+ maxRetries: MAX_RETRIES,
3387
+ recordId: props.id,
3388
+ });
3265
3389
  await new Promise(resolve => setTimeout(resolve, delay));
3266
3390
  continue;
3267
3391
  }
3268
- // Log the error and rethrow
3269
- logger_1.logger.error("Database error occurred", { error: String(error) });
3392
+ // Log structured error details and rethrow
3393
+ logger_1.logger.error("Database upsert operation failed", {
3394
+ operation: 'upsertOneAccountLinkingRequest',
3395
+ model: 'AccountLinkingRequest',
3396
+ error: String(error),
3397
+ recordId: props.id,
3398
+ isRetryable: isConnectionError,
3399
+ });
3270
3400
  throw error;
3271
3401
  }
3272
3402
  }
@@ -3281,7 +3411,7 @@ exports.AccountLinkingRequest = {
3281
3411
  * @returns The count of created records or null.
3282
3412
  */
3283
3413
  async updateMany(props, globalClient) {
3284
- var _a, _b, _c, _d, _e;
3414
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
3285
3415
  // Maximum number of retries for database connection issues
3286
3416
  const MAX_RETRIES = 3;
3287
3417
  let retryCount = 0;
@@ -4397,21 +4527,52 @@ exports.AccountLinkingRequest = {
4397
4527
  }
4398
4528
  catch (error) {
4399
4529
  lastError = error;
4530
+ // Check for constraint violations FIRST - these are NEVER retryable
4531
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
4532
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
4533
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
4534
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
4535
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
4536
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
4537
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
4538
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
4539
+ if (isConstraintViolation) {
4540
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
4541
+ logger_1.logger.error("Non-retryable constraint violation in updateManyAccountLinkingRequest", {
4542
+ operation: 'updateManyAccountLinkingRequest',
4543
+ model: 'AccountLinkingRequest',
4544
+ error: String(error),
4545
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
4546
+ errorCategory: 'CONSTRAINT_VIOLATION',
4547
+ isRetryable: false,
4548
+ });
4549
+ throw error;
4550
+ }
4400
4551
  // Check if this is a database connection error that we should retry
4401
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
4402
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
4403
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
4404
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
4405
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
4552
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
4553
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
4554
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
4555
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
4556
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
4406
4557
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
4407
4558
  retryCount++;
4408
4559
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
4409
- logger_1.logger.warn("Database connection error, retrying...");
4560
+ logger_1.logger.warn("Database connection error in updateManyAccountLinkingRequest, retrying...", {
4561
+ operation: 'updateManyAccountLinkingRequest',
4562
+ model: 'AccountLinkingRequest',
4563
+ attempt: retryCount,
4564
+ maxRetries: MAX_RETRIES,
4565
+ });
4410
4566
  await new Promise(resolve => setTimeout(resolve, delay));
4411
4567
  continue;
4412
4568
  }
4413
- // Log the error and rethrow
4414
- logger_1.logger.error("Database error occurred", { error: String(error) });
4569
+ // Log structured error details and rethrow
4570
+ logger_1.logger.error("Database updateMany operation failed", {
4571
+ operation: 'updateManyAccountLinkingRequest',
4572
+ model: 'AccountLinkingRequest',
4573
+ error: String(error),
4574
+ isRetryable: isConnectionError,
4575
+ });
4415
4576
  throw error;
4416
4577
  }
4417
4578
  }
@@ -4426,7 +4587,7 @@ exports.AccountLinkingRequest = {
4426
4587
  * @returns The deleted AccountLinkingRequest or null.
4427
4588
  */
4428
4589
  async delete(props, globalClient) {
4429
- var _a, _b, _c, _d, _e;
4590
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
4430
4591
  // Maximum number of retries for database connection issues
4431
4592
  const MAX_RETRIES = 3;
4432
4593
  let retryCount = 0;
@@ -4470,21 +4631,58 @@ exports.AccountLinkingRequest = {
4470
4631
  }
4471
4632
  catch (error) {
4472
4633
  lastError = error;
4634
+ // Check for constraint violations FIRST - these are NEVER retryable
4635
+ // (e.g., foreign key constraints preventing deletion)
4636
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
4637
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
4638
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
4639
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
4640
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
4641
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
4642
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
4643
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
4644
+ ((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
4645
+ ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
4646
+ if (isConstraintViolation) {
4647
+ const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
4648
+ logger_1.logger.error("Non-retryable constraint violation in deleteOneAccountLinkingRequest", {
4649
+ operation: 'deleteOneAccountLinkingRequest',
4650
+ model: 'AccountLinkingRequest',
4651
+ error: String(error),
4652
+ recordId: props.id,
4653
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
4654
+ errorCategory: 'CONSTRAINT_VIOLATION',
4655
+ isRetryable: false,
4656
+ });
4657
+ throw error;
4658
+ }
4473
4659
  // Check if this is a database connection error that we should retry
4474
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
4475
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
4476
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
4477
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
4478
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
4660
+ const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
4661
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
4662
+ ((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
4663
+ ((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
4664
+ (error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
4479
4665
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
4480
4666
  retryCount++;
4481
4667
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
4482
- logger_1.logger.warn("Database connection error, retrying...");
4668
+ logger_1.logger.warn("Database connection error in deleteOneAccountLinkingRequest, retrying...", {
4669
+ operation: 'deleteOneAccountLinkingRequest',
4670
+ model: 'AccountLinkingRequest',
4671
+ attempt: retryCount,
4672
+ maxRetries: MAX_RETRIES,
4673
+ recordId: props.id,
4674
+ });
4483
4675
  await new Promise(resolve => setTimeout(resolve, delay));
4484
4676
  continue;
4485
4677
  }
4486
- // Log the error and rethrow
4487
- logger_1.logger.error("Database error occurred", { error: String(error) });
4678
+ // Log structured error details and rethrow
4679
+ logger_1.logger.error("Database delete operation failed", {
4680
+ operation: 'deleteOneAccountLinkingRequest',
4681
+ model: 'AccountLinkingRequest',
4682
+ error: String(error),
4683
+ recordId: props.id,
4684
+ isRetryable: isConnectionError,
4685
+ });
4488
4686
  throw error;
4489
4687
  }
4490
4688
  }
@@ -4560,12 +4758,22 @@ exports.AccountLinkingRequest = {
4560
4758
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
4561
4759
  retryCount++;
4562
4760
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
4563
- logger_1.logger.warn("Database connection error, retrying...");
4761
+ logger_1.logger.warn("Database connection error in getAccountLinkingRequest, retrying...", {
4762
+ operation: 'getAccountLinkingRequest',
4763
+ model: 'AccountLinkingRequest',
4764
+ attempt: retryCount,
4765
+ maxRetries: MAX_RETRIES,
4766
+ });
4564
4767
  await new Promise(resolve => setTimeout(resolve, delay));
4565
4768
  continue;
4566
4769
  }
4567
- // Log the error and rethrow
4568
- logger_1.logger.error("Database error occurred", { error: String(error) });
4770
+ // Log structured error details and rethrow
4771
+ logger_1.logger.error("Database get operation failed", {
4772
+ operation: 'getAccountLinkingRequest',
4773
+ model: 'AccountLinkingRequest',
4774
+ error: String(error),
4775
+ isRetryable: isConnectionError,
4776
+ });
4569
4777
  throw error;
4570
4778
  }
4571
4779
  }
@@ -4623,12 +4831,22 @@ exports.AccountLinkingRequest = {
4623
4831
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
4624
4832
  retryCount++;
4625
4833
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
4626
- logger_1.logger.warn("Database connection error, retrying...");
4834
+ logger_1.logger.warn("Database connection error in getAllAccountLinkingRequest, retrying...", {
4835
+ operation: 'getAllAccountLinkingRequest',
4836
+ model: 'AccountLinkingRequest',
4837
+ attempt: retryCount,
4838
+ maxRetries: MAX_RETRIES,
4839
+ });
4627
4840
  await new Promise(resolve => setTimeout(resolve, delay));
4628
4841
  continue;
4629
4842
  }
4630
- // Log the error and rethrow
4631
- logger_1.logger.error("Database error occurred", { error: String(error) });
4843
+ // Log structured error details and rethrow
4844
+ logger_1.logger.error("Database getAll operation failed", {
4845
+ operation: 'getAllAccountLinkingRequest',
4846
+ model: 'AccountLinkingRequest',
4847
+ error: String(error),
4848
+ isRetryable: isConnectionError,
4849
+ });
4632
4850
  throw error;
4633
4851
  }
4634
4852
  }
@@ -4711,12 +4929,22 @@ exports.AccountLinkingRequest = {
4711
4929
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
4712
4930
  retryCount++;
4713
4931
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
4714
- logger_1.logger.warn("Database connection error, retrying...");
4932
+ logger_1.logger.warn("Database connection error in findManyAccountLinkingRequest, retrying...", {
4933
+ operation: 'findManyAccountLinkingRequest',
4934
+ model: 'AccountLinkingRequest',
4935
+ attempt: retryCount,
4936
+ maxRetries: MAX_RETRIES,
4937
+ });
4715
4938
  await new Promise(resolve => setTimeout(resolve, delay));
4716
4939
  continue;
4717
4940
  }
4718
- // Log the error and rethrow
4719
- logger_1.logger.error("Database error occurred", { error: String(error) });
4941
+ // Log structured error details and rethrow
4942
+ logger_1.logger.error("Database findMany operation failed", {
4943
+ operation: 'findManyAccountLinkingRequest',
4944
+ model: 'AccountLinkingRequest',
4945
+ error: String(error),
4946
+ isRetryable: isConnectionError,
4947
+ });
4720
4948
  throw error;
4721
4949
  }
4722
4950
  }