@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
@@ -182,7 +182,7 @@ exports.ModelVersionArtifact = {
182
182
  * @returns The created ModelVersionArtifact or null.
183
183
  */
184
184
  async create(props, globalClient) {
185
- var _a, _b, _c, _d, _e;
185
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
186
186
  // Maximum number of retries for database connection issues
187
187
  const MAX_RETRIES = 3;
188
188
  let retryCount = 0;
@@ -989,21 +989,52 @@ exports.ModelVersionArtifact = {
989
989
  }
990
990
  catch (error) {
991
991
  lastError = error;
992
+ // Check for constraint violations FIRST - these are NEVER retryable
993
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
994
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
995
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
996
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
997
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
998
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
999
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
1000
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
1001
+ if (isConstraintViolation) {
1002
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
1003
+ logger_1.logger.error("Non-retryable constraint violation in createOneModelVersionArtifact", {
1004
+ operation: 'createOneModelVersionArtifact',
1005
+ model: 'ModelVersionArtifact',
1006
+ error: String(error),
1007
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
1008
+ errorCategory: 'CONSTRAINT_VIOLATION',
1009
+ isRetryable: false,
1010
+ });
1011
+ throw error;
1012
+ }
992
1013
  // Check if this is a database connection error that we should retry
993
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
994
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
995
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
996
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
997
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
1014
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
1015
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
1016
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
1017
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
1018
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
998
1019
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
999
1020
  retryCount++;
1000
1021
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
1001
- logger_1.logger.warn("Database connection error, retrying...");
1022
+ logger_1.logger.warn("Database connection error in createOneModelVersionArtifact, retrying...", {
1023
+ operation: 'createOneModelVersionArtifact',
1024
+ model: 'ModelVersionArtifact',
1025
+ attempt: retryCount,
1026
+ maxRetries: MAX_RETRIES,
1027
+ });
1002
1028
  await new Promise(resolve => setTimeout(resolve, delay));
1003
1029
  continue;
1004
1030
  }
1005
- // Log the error and rethrow
1006
- logger_1.logger.error("Database error occurred", { error: String(error) });
1031
+ // Log structured error details and rethrow
1032
+ logger_1.logger.error("Database create operation failed", {
1033
+ operation: 'createOneModelVersionArtifact',
1034
+ model: 'ModelVersionArtifact',
1035
+ error: String(error),
1036
+ isRetryable: isConnectionError,
1037
+ });
1007
1038
  throw error;
1008
1039
  }
1009
1040
  }
@@ -1018,7 +1049,7 @@ exports.ModelVersionArtifact = {
1018
1049
  * @returns The count of created records or null.
1019
1050
  */
1020
1051
  async createMany(props, globalClient) {
1021
- var _a, _b, _c, _d, _e;
1052
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1022
1053
  // Maximum number of retries for database connection issues
1023
1054
  const MAX_RETRIES = 3;
1024
1055
  let retryCount = 0;
@@ -1063,21 +1094,52 @@ exports.ModelVersionArtifact = {
1063
1094
  }
1064
1095
  catch (error) {
1065
1096
  lastError = error;
1097
+ // Check for constraint violations FIRST - these are NEVER retryable
1098
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
1099
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
1100
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
1101
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
1102
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
1103
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
1104
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
1105
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
1106
+ if (isConstraintViolation) {
1107
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
1108
+ logger_1.logger.error("Non-retryable constraint violation in createManyModelVersionArtifact", {
1109
+ operation: 'createManyModelVersionArtifact',
1110
+ model: 'ModelVersionArtifact',
1111
+ error: String(error),
1112
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
1113
+ errorCategory: 'CONSTRAINT_VIOLATION',
1114
+ isRetryable: false,
1115
+ });
1116
+ throw error;
1117
+ }
1066
1118
  // Check if this is a database connection error that we should retry
1067
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
1068
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
1069
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
1070
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
1071
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
1119
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
1120
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
1121
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
1122
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
1123
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
1072
1124
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
1073
1125
  retryCount++;
1074
1126
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
1075
- logger_1.logger.warn("Database connection error, retrying...");
1127
+ logger_1.logger.warn("Database connection error in createManyModelVersionArtifact, retrying...", {
1128
+ operation: 'createManyModelVersionArtifact',
1129
+ model: 'ModelVersionArtifact',
1130
+ attempt: retryCount,
1131
+ maxRetries: MAX_RETRIES,
1132
+ });
1076
1133
  await new Promise(resolve => setTimeout(resolve, delay));
1077
1134
  continue;
1078
1135
  }
1079
- // Log the error and rethrow
1080
- logger_1.logger.error("Database error occurred", { error: String(error) });
1136
+ // Log structured error details and rethrow
1137
+ logger_1.logger.error("Database createMany operation failed", {
1138
+ operation: 'createManyModelVersionArtifact',
1139
+ model: 'ModelVersionArtifact',
1140
+ error: String(error),
1141
+ isRetryable: isConnectionError,
1142
+ });
1081
1143
  throw error;
1082
1144
  }
1083
1145
  }
@@ -1092,7 +1154,7 @@ exports.ModelVersionArtifact = {
1092
1154
  * @returns The updated ModelVersionArtifact or null.
1093
1155
  */
1094
1156
  async update(props, globalClient) {
1095
- var _a, _b, _c, _d, _e;
1157
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1096
1158
  // Maximum number of retries for database connection issues
1097
1159
  const MAX_RETRIES = 3;
1098
1160
  let retryCount = 0;
@@ -4482,21 +4544,55 @@ exports.ModelVersionArtifact = {
4482
4544
  }
4483
4545
  catch (error) {
4484
4546
  lastError = error;
4547
+ // Check for constraint violations FIRST - these are NEVER retryable
4548
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
4549
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
4550
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
4551
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
4552
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
4553
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
4554
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
4555
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
4556
+ if (isConstraintViolation) {
4557
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
4558
+ logger_1.logger.error("Non-retryable constraint violation in updateOneModelVersionArtifact", {
4559
+ operation: 'updateOneModelVersionArtifact',
4560
+ model: 'ModelVersionArtifact',
4561
+ error: String(error),
4562
+ recordId: props.id,
4563
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
4564
+ errorCategory: 'CONSTRAINT_VIOLATION',
4565
+ isRetryable: false,
4566
+ });
4567
+ throw error;
4568
+ }
4485
4569
  // Check if this is a database connection error that we should retry
4486
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
4487
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
4488
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
4489
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
4490
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
4570
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
4571
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
4572
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
4573
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
4574
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
4491
4575
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
4492
4576
  retryCount++;
4493
4577
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
4494
- logger_1.logger.warn("Database connection error, retrying...");
4578
+ logger_1.logger.warn("Database connection error in updateOneModelVersionArtifact, retrying...", {
4579
+ operation: 'updateOneModelVersionArtifact',
4580
+ model: 'ModelVersionArtifact',
4581
+ attempt: retryCount,
4582
+ maxRetries: MAX_RETRIES,
4583
+ recordId: props.id,
4584
+ });
4495
4585
  await new Promise(resolve => setTimeout(resolve, delay));
4496
4586
  continue;
4497
4587
  }
4498
- // Log the error and rethrow
4499
- logger_1.logger.error("Database error occurred", { error: String(error) });
4588
+ // Log structured error details and rethrow
4589
+ logger_1.logger.error("Database update operation failed", {
4590
+ operation: 'updateOneModelVersionArtifact',
4591
+ model: 'ModelVersionArtifact',
4592
+ error: String(error),
4593
+ recordId: props.id,
4594
+ isRetryable: isConnectionError,
4595
+ });
4500
4596
  throw error;
4501
4597
  }
4502
4598
  }
@@ -4511,7 +4607,7 @@ exports.ModelVersionArtifact = {
4511
4607
  * @returns The updated ModelVersionArtifact or null.
4512
4608
  */
4513
4609
  async upsert(props, globalClient) {
4514
- var _a, _b, _c, _d, _e;
4610
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
4515
4611
  // Maximum number of retries for database connection issues
4516
4612
  const MAX_RETRIES = 3;
4517
4613
  let retryCount = 0;
@@ -8660,21 +8756,55 @@ exports.ModelVersionArtifact = {
8660
8756
  }
8661
8757
  catch (error) {
8662
8758
  lastError = error;
8759
+ // Check for constraint violations FIRST - these are NEVER retryable
8760
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
8761
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
8762
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
8763
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
8764
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
8765
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
8766
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
8767
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
8768
+ if (isConstraintViolation) {
8769
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
8770
+ logger_1.logger.error("Non-retryable constraint violation in upsertOneModelVersionArtifact", {
8771
+ operation: 'upsertOneModelVersionArtifact',
8772
+ model: 'ModelVersionArtifact',
8773
+ error: String(error),
8774
+ recordId: props.id,
8775
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
8776
+ errorCategory: 'CONSTRAINT_VIOLATION',
8777
+ isRetryable: false,
8778
+ });
8779
+ throw error;
8780
+ }
8663
8781
  // Check if this is a database connection error that we should retry
8664
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
8665
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
8666
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
8667
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
8668
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
8782
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
8783
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
8784
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
8785
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
8786
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
8669
8787
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
8670
8788
  retryCount++;
8671
8789
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
8672
- logger_1.logger.warn("Database connection error, retrying...");
8790
+ logger_1.logger.warn("Database connection error in upsertOneModelVersionArtifact, retrying...", {
8791
+ operation: 'upsertOneModelVersionArtifact',
8792
+ model: 'ModelVersionArtifact',
8793
+ attempt: retryCount,
8794
+ maxRetries: MAX_RETRIES,
8795
+ recordId: props.id,
8796
+ });
8673
8797
  await new Promise(resolve => setTimeout(resolve, delay));
8674
8798
  continue;
8675
8799
  }
8676
- // Log the error and rethrow
8677
- logger_1.logger.error("Database error occurred", { error: String(error) });
8800
+ // Log structured error details and rethrow
8801
+ logger_1.logger.error("Database upsert operation failed", {
8802
+ operation: 'upsertOneModelVersionArtifact',
8803
+ model: 'ModelVersionArtifact',
8804
+ error: String(error),
8805
+ recordId: props.id,
8806
+ isRetryable: isConnectionError,
8807
+ });
8678
8808
  throw error;
8679
8809
  }
8680
8810
  }
@@ -8689,7 +8819,7 @@ exports.ModelVersionArtifact = {
8689
8819
  * @returns The count of created records or null.
8690
8820
  */
8691
8821
  async updateMany(props, globalClient) {
8692
- var _a, _b, _c, _d, _e;
8822
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
8693
8823
  // Maximum number of retries for database connection issues
8694
8824
  const MAX_RETRIES = 3;
8695
8825
  let retryCount = 0;
@@ -12079,21 +12209,52 @@ exports.ModelVersionArtifact = {
12079
12209
  }
12080
12210
  catch (error) {
12081
12211
  lastError = error;
12212
+ // Check for constraint violations FIRST - these are NEVER retryable
12213
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
12214
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
12215
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
12216
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
12217
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
12218
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
12219
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('P2002')) ||
12220
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2003'));
12221
+ if (isConstraintViolation) {
12222
+ const constraintMatch = (_j = error.message) === null || _j === void 0 ? void 0 : _j.match(/constraint\s+"([^"]+)"/);
12223
+ logger_1.logger.error("Non-retryable constraint violation in updateManyModelVersionArtifact", {
12224
+ operation: 'updateManyModelVersionArtifact',
12225
+ model: 'ModelVersionArtifact',
12226
+ error: String(error),
12227
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
12228
+ errorCategory: 'CONSTRAINT_VIOLATION',
12229
+ isRetryable: false,
12230
+ });
12231
+ throw error;
12232
+ }
12082
12233
  // Check if this is a database connection error that we should retry
12083
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
12084
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
12085
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
12086
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
12087
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
12234
+ const isConnectionError = ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('Server has closed the connection')) ||
12235
+ ((_l = error.message) === null || _l === void 0 ? void 0 : _l.includes('Cannot reach database server')) ||
12236
+ ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Connection timed out')) ||
12237
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Accelerate')) || // Prisma Accelerate proxy errors
12238
+ (error.networkError && ((_p = error.networkError.message) === null || _p === void 0 ? void 0 : _p.includes('Failed to fetch')));
12088
12239
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
12089
12240
  retryCount++;
12090
12241
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
12091
- logger_1.logger.warn("Database connection error, retrying...");
12242
+ logger_1.logger.warn("Database connection error in updateManyModelVersionArtifact, retrying...", {
12243
+ operation: 'updateManyModelVersionArtifact',
12244
+ model: 'ModelVersionArtifact',
12245
+ attempt: retryCount,
12246
+ maxRetries: MAX_RETRIES,
12247
+ });
12092
12248
  await new Promise(resolve => setTimeout(resolve, delay));
12093
12249
  continue;
12094
12250
  }
12095
- // Log the error and rethrow
12096
- logger_1.logger.error("Database error occurred", { error: String(error) });
12251
+ // Log structured error details and rethrow
12252
+ logger_1.logger.error("Database updateMany operation failed", {
12253
+ operation: 'updateManyModelVersionArtifact',
12254
+ model: 'ModelVersionArtifact',
12255
+ error: String(error),
12256
+ isRetryable: isConnectionError,
12257
+ });
12097
12258
  throw error;
12098
12259
  }
12099
12260
  }
@@ -12108,7 +12269,7 @@ exports.ModelVersionArtifact = {
12108
12269
  * @returns The deleted ModelVersionArtifact or null.
12109
12270
  */
12110
12271
  async delete(props, globalClient) {
12111
- var _a, _b, _c, _d, _e;
12272
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
12112
12273
  // Maximum number of retries for database connection issues
12113
12274
  const MAX_RETRIES = 3;
12114
12275
  let retryCount = 0;
@@ -12152,21 +12313,58 @@ exports.ModelVersionArtifact = {
12152
12313
  }
12153
12314
  catch (error) {
12154
12315
  lastError = error;
12316
+ // Check for constraint violations FIRST - these are NEVER retryable
12317
+ // (e.g., foreign key constraints preventing deletion)
12318
+ const isConstraintViolation = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('violates check constraint')) ||
12319
+ ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('violates unique constraint')) ||
12320
+ ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('violates foreign key constraint')) ||
12321
+ ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('unique constraint')) ||
12322
+ ((_e = error.message) === null || _e === void 0 ? void 0 : _e.includes('23514')) ||
12323
+ ((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('23505')) ||
12324
+ ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('23503')) ||
12325
+ ((_h = error.message) === null || _h === void 0 ? void 0 : _h.includes('P2002')) ||
12326
+ ((_j = error.message) === null || _j === void 0 ? void 0 : _j.includes('P2003')) ||
12327
+ ((_k = error.message) === null || _k === void 0 ? void 0 : _k.includes('P2014'));
12328
+ if (isConstraintViolation) {
12329
+ const constraintMatch = (_l = error.message) === null || _l === void 0 ? void 0 : _l.match(/constraint\s+"([^"]+)"/);
12330
+ logger_1.logger.error("Non-retryable constraint violation in deleteOneModelVersionArtifact", {
12331
+ operation: 'deleteOneModelVersionArtifact',
12332
+ model: 'ModelVersionArtifact',
12333
+ error: String(error),
12334
+ recordId: props.id,
12335
+ constraintName: constraintMatch ? constraintMatch[1] : undefined,
12336
+ errorCategory: 'CONSTRAINT_VIOLATION',
12337
+ isRetryable: false,
12338
+ });
12339
+ throw error;
12340
+ }
12155
12341
  // Check if this is a database connection error that we should retry
12156
- const isConnectionError = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Server has closed the connection')) ||
12157
- ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot reach database server')) ||
12158
- ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Connection timed out')) ||
12159
- ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes('Accelerate')) || // Prisma Accelerate proxy errors
12160
- (error.networkError && ((_e = error.networkError.message) === null || _e === void 0 ? void 0 : _e.includes('Failed to fetch')));
12342
+ const isConnectionError = ((_m = error.message) === null || _m === void 0 ? void 0 : _m.includes('Server has closed the connection')) ||
12343
+ ((_o = error.message) === null || _o === void 0 ? void 0 : _o.includes('Cannot reach database server')) ||
12344
+ ((_p = error.message) === null || _p === void 0 ? void 0 : _p.includes('Connection timed out')) ||
12345
+ ((_q = error.message) === null || _q === void 0 ? void 0 : _q.includes('Accelerate')) || // Prisma Accelerate proxy errors
12346
+ (error.networkError && ((_r = error.networkError.message) === null || _r === void 0 ? void 0 : _r.includes('Failed to fetch')));
12161
12347
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
12162
12348
  retryCount++;
12163
12349
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
12164
- logger_1.logger.warn("Database connection error, retrying...");
12350
+ logger_1.logger.warn("Database connection error in deleteOneModelVersionArtifact, retrying...", {
12351
+ operation: 'deleteOneModelVersionArtifact',
12352
+ model: 'ModelVersionArtifact',
12353
+ attempt: retryCount,
12354
+ maxRetries: MAX_RETRIES,
12355
+ recordId: props.id,
12356
+ });
12165
12357
  await new Promise(resolve => setTimeout(resolve, delay));
12166
12358
  continue;
12167
12359
  }
12168
- // Log the error and rethrow
12169
- logger_1.logger.error("Database error occurred", { error: String(error) });
12360
+ // Log structured error details and rethrow
12361
+ logger_1.logger.error("Database delete operation failed", {
12362
+ operation: 'deleteOneModelVersionArtifact',
12363
+ model: 'ModelVersionArtifact',
12364
+ error: String(error),
12365
+ recordId: props.id,
12366
+ isRetryable: isConnectionError,
12367
+ });
12170
12368
  throw error;
12171
12369
  }
12172
12370
  }
@@ -12239,12 +12437,22 @@ exports.ModelVersionArtifact = {
12239
12437
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
12240
12438
  retryCount++;
12241
12439
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
12242
- logger_1.logger.warn("Database connection error, retrying...");
12440
+ logger_1.logger.warn("Database connection error in getModelVersionArtifact, retrying...", {
12441
+ operation: 'getModelVersionArtifact',
12442
+ model: 'ModelVersionArtifact',
12443
+ attempt: retryCount,
12444
+ maxRetries: MAX_RETRIES,
12445
+ });
12243
12446
  await new Promise(resolve => setTimeout(resolve, delay));
12244
12447
  continue;
12245
12448
  }
12246
- // Log the error and rethrow
12247
- logger_1.logger.error("Database error occurred", { error: String(error) });
12449
+ // Log structured error details and rethrow
12450
+ logger_1.logger.error("Database get operation failed", {
12451
+ operation: 'getModelVersionArtifact',
12452
+ model: 'ModelVersionArtifact',
12453
+ error: String(error),
12454
+ isRetryable: isConnectionError,
12455
+ });
12248
12456
  throw error;
12249
12457
  }
12250
12458
  }
@@ -12302,12 +12510,22 @@ exports.ModelVersionArtifact = {
12302
12510
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
12303
12511
  retryCount++;
12304
12512
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
12305
- logger_1.logger.warn("Database connection error, retrying...");
12513
+ logger_1.logger.warn("Database connection error in getAllModelVersionArtifact, retrying...", {
12514
+ operation: 'getAllModelVersionArtifact',
12515
+ model: 'ModelVersionArtifact',
12516
+ attempt: retryCount,
12517
+ maxRetries: MAX_RETRIES,
12518
+ });
12306
12519
  await new Promise(resolve => setTimeout(resolve, delay));
12307
12520
  continue;
12308
12521
  }
12309
- // Log the error and rethrow
12310
- logger_1.logger.error("Database error occurred", { error: String(error) });
12522
+ // Log structured error details and rethrow
12523
+ logger_1.logger.error("Database getAll operation failed", {
12524
+ operation: 'getAllModelVersionArtifact',
12525
+ model: 'ModelVersionArtifact',
12526
+ error: String(error),
12527
+ isRetryable: isConnectionError,
12528
+ });
12311
12529
  throw error;
12312
12530
  }
12313
12531
  }
@@ -12387,12 +12605,22 @@ exports.ModelVersionArtifact = {
12387
12605
  if (isConnectionError && retryCount < MAX_RETRIES - 1) {
12388
12606
  retryCount++;
12389
12607
  const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
12390
- logger_1.logger.warn("Database connection error, retrying...");
12608
+ logger_1.logger.warn("Database connection error in findManyModelVersionArtifact, retrying...", {
12609
+ operation: 'findManyModelVersionArtifact',
12610
+ model: 'ModelVersionArtifact',
12611
+ attempt: retryCount,
12612
+ maxRetries: MAX_RETRIES,
12613
+ });
12391
12614
  await new Promise(resolve => setTimeout(resolve, delay));
12392
12615
  continue;
12393
12616
  }
12394
- // Log the error and rethrow
12395
- logger_1.logger.error("Database error occurred", { error: String(error) });
12617
+ // Log structured error details and rethrow
12618
+ logger_1.logger.error("Database findMany operation failed", {
12619
+ operation: 'findManyModelVersionArtifact',
12620
+ model: 'ModelVersionArtifact',
12621
+ error: String(error),
12622
+ isRetryable: isConnectionError,
12623
+ });
12396
12624
  throw error;
12397
12625
  }
12398
12626
  }