adaptic-backend 1.0.340 → 1.0.342

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 (122) hide show
  1. package/Account.cjs +2670 -2264
  2. package/Account.d.ts +19 -2
  3. package/Action.cjs +1195 -839
  4. package/Action.d.ts +19 -2
  5. package/Alert.cjs +2651 -2347
  6. package/Alert.d.ts +19 -2
  7. package/Allocation.cjs +2631 -2304
  8. package/Allocation.d.ts +19 -2
  9. package/AlpacaAccount.cjs +2654 -2104
  10. package/AlpacaAccount.d.ts +19 -2
  11. package/Asset.cjs +2611 -1544
  12. package/Asset.d.ts +19 -2
  13. package/Authenticator.cjs +2603 -2290
  14. package/Authenticator.d.ts +19 -2
  15. package/Customer.cjs +2506 -2220
  16. package/Customer.d.ts +19 -2
  17. package/EconomicEvent.cjs +708 -367
  18. package/EconomicEvent.d.ts +19 -2
  19. package/MarketSentiment.cjs +691 -340
  20. package/MarketSentiment.d.ts +19 -2
  21. package/NewsArticle.cjs +2114 -1655
  22. package/NewsArticle.d.ts +19 -2
  23. package/NewsArticleAssetSentiment.cjs +1873 -1564
  24. package/NewsArticleAssetSentiment.d.ts +19 -2
  25. package/ScheduledOptionOrder.cjs +607 -316
  26. package/ScheduledOptionOrder.d.ts +19 -2
  27. package/Session.cjs +2592 -2294
  28. package/Session.d.ts +19 -2
  29. package/Trade.cjs +1261 -795
  30. package/Trade.d.ts +19 -2
  31. package/User.cjs +2432 -2013
  32. package/User.d.ts +19 -2
  33. package/VerificationToken.cjs +637 -328
  34. package/VerificationToken.d.ts +19 -2
  35. package/esm/Account.d.ts +19 -2
  36. package/esm/Account.d.ts.map +1 -1
  37. package/esm/Account.js.map +1 -1
  38. package/esm/Account.mjs +2661 -2262
  39. package/esm/Action.d.ts +19 -2
  40. package/esm/Action.d.ts.map +1 -1
  41. package/esm/Action.js.map +1 -1
  42. package/esm/Action.mjs +1186 -837
  43. package/esm/Alert.d.ts +19 -2
  44. package/esm/Alert.d.ts.map +1 -1
  45. package/esm/Alert.js.map +1 -1
  46. package/esm/Alert.mjs +2642 -2345
  47. package/esm/Allocation.d.ts +19 -2
  48. package/esm/Allocation.d.ts.map +1 -1
  49. package/esm/Allocation.js.map +1 -1
  50. package/esm/Allocation.mjs +2622 -2302
  51. package/esm/AlpacaAccount.d.ts +19 -2
  52. package/esm/AlpacaAccount.d.ts.map +1 -1
  53. package/esm/AlpacaAccount.js.map +1 -1
  54. package/esm/AlpacaAccount.mjs +2645 -2102
  55. package/esm/Asset.d.ts +19 -2
  56. package/esm/Asset.d.ts.map +1 -1
  57. package/esm/Asset.js.map +1 -1
  58. package/esm/Asset.mjs +2602 -1542
  59. package/esm/Authenticator.d.ts +19 -2
  60. package/esm/Authenticator.d.ts.map +1 -1
  61. package/esm/Authenticator.js.map +1 -1
  62. package/esm/Authenticator.mjs +2594 -2288
  63. package/esm/Customer.d.ts +19 -2
  64. package/esm/Customer.d.ts.map +1 -1
  65. package/esm/Customer.js.map +1 -1
  66. package/esm/Customer.mjs +2497 -2218
  67. package/esm/EconomicEvent.d.ts +19 -2
  68. package/esm/EconomicEvent.d.ts.map +1 -1
  69. package/esm/EconomicEvent.js.map +1 -1
  70. package/esm/EconomicEvent.mjs +699 -365
  71. package/esm/MarketSentiment.d.ts +19 -2
  72. package/esm/MarketSentiment.d.ts.map +1 -1
  73. package/esm/MarketSentiment.js.map +1 -1
  74. package/esm/MarketSentiment.mjs +682 -338
  75. package/esm/NewsArticle.d.ts +19 -2
  76. package/esm/NewsArticle.d.ts.map +1 -1
  77. package/esm/NewsArticle.js.map +1 -1
  78. package/esm/NewsArticle.mjs +2105 -1653
  79. package/esm/NewsArticleAssetSentiment.d.ts +19 -2
  80. package/esm/NewsArticleAssetSentiment.d.ts.map +1 -1
  81. package/esm/NewsArticleAssetSentiment.js.map +1 -1
  82. package/esm/NewsArticleAssetSentiment.mjs +1864 -1562
  83. package/esm/ScheduledOptionOrder.d.ts +19 -2
  84. package/esm/ScheduledOptionOrder.d.ts.map +1 -1
  85. package/esm/ScheduledOptionOrder.js.map +1 -1
  86. package/esm/ScheduledOptionOrder.mjs +598 -314
  87. package/esm/Session.d.ts +19 -2
  88. package/esm/Session.d.ts.map +1 -1
  89. package/esm/Session.js.map +1 -1
  90. package/esm/Session.mjs +2583 -2292
  91. package/esm/Trade.d.ts +19 -2
  92. package/esm/Trade.d.ts.map +1 -1
  93. package/esm/Trade.js.map +1 -1
  94. package/esm/Trade.mjs +1252 -793
  95. package/esm/User.d.ts +19 -2
  96. package/esm/User.d.ts.map +1 -1
  97. package/esm/User.js.map +1 -1
  98. package/esm/User.mjs +2423 -2011
  99. package/esm/VerificationToken.d.ts +19 -2
  100. package/esm/VerificationToken.d.ts.map +1 -1
  101. package/esm/VerificationToken.js.map +1 -1
  102. package/esm/VerificationToken.mjs +628 -326
  103. package/esm/generated/typegraphql-prisma/enhance.js.map +1 -1
  104. package/esm/generated/typegraphql-prisma/enhance.mjs +1 -1
  105. package/esm/generated/typegraphql-prisma/resolvers/inputs/AccountWhereUniqueInput.d.ts +1 -1
  106. package/esm/generated/typegraphql-prisma/resolvers/inputs/AccountWhereUniqueInput.d.ts.map +1 -1
  107. package/esm/generated/typegraphql-prisma/resolvers/inputs/AccountWhereUniqueInput.js.map +1 -1
  108. package/esm/generated/typegraphql-prisma/resolvers/inputs/AccountWhereUniqueInput.mjs +7 -7
  109. package/esm/prismaClient.d.ts +4 -5
  110. package/esm/prismaClient.d.ts.map +1 -1
  111. package/esm/prismaClient.js.map +1 -1
  112. package/esm/prismaClient.mjs +13 -11
  113. package/generated/typegraphql-prisma/enhance.cjs +1 -1
  114. package/generated/typegraphql-prisma/enhance.js.map +1 -1
  115. package/generated/typegraphql-prisma/resolvers/inputs/AccountWhereUniqueInput.cjs +6 -6
  116. package/generated/typegraphql-prisma/resolvers/inputs/AccountWhereUniqueInput.d.ts +1 -1
  117. package/generated/typegraphql-prisma/resolvers/inputs/AccountWhereUniqueInput.d.ts.map +1 -1
  118. package/generated/typegraphql-prisma/resolvers/inputs/AccountWhereUniqueInput.js.map +1 -1
  119. package/package.json +1 -1
  120. package/prismaClient.cjs +13 -11
  121. package/prismaClient.d.ts +4 -5
  122. package/server.cjs +37 -5
@@ -17,414 +17,698 @@ export const ScheduledOptionOrder = {
17
17
  * @param client - Apollo Client instance.
18
18
  * @returns The created ScheduledOptionOrder or null.
19
19
  */
20
+ /**
21
+ * Create a new ScheduledOptionOrder record.
22
+ * Enhanced with connection resilience against Prisma connection errors.
23
+ * @param props - Properties for the new record.
24
+ * @param globalClient - Apollo Client instance.
25
+ * @returns The created ScheduledOptionOrder or null.
26
+ */
20
27
  async create(props, globalClient) {
21
- const [modules, client] = await Promise.all([
22
- getApolloModules(),
23
- globalClient
24
- ? Promise.resolve(globalClient)
25
- : importedClient
26
- ]);
27
- const { gql, ApolloError } = modules;
28
- const CREATE_ONE_SCHEDULEDOPTIONORDER = gql `
29
- mutation createOneScheduledOptionOrder($data: ScheduledOptionOrderCreateInput!) {
30
- createOneScheduledOptionOrder(data: $data) {
31
- ${selectionSet}
32
- }
33
- }
34
- `;
35
- const variables = {
36
- data: {
37
- payload: props.payload !== undefined ? props.payload : undefined,
38
- status: props.status !== undefined ? props.status : undefined,
39
- },
40
- };
41
- const filteredVariables = removeUndefinedProps(variables);
42
- try {
43
- const response = await client.mutate({ mutation: CREATE_ONE_SCHEDULEDOPTIONORDER, variables: filteredVariables });
44
- if (response.errors && response.errors.length > 0)
45
- throw new Error(response.errors[0].message);
46
- if (response && response.data && response.data.createOneScheduledOptionOrder) {
47
- return response.data.createOneScheduledOptionOrder;
28
+ // Maximum number of retries for database connection issues
29
+ const MAX_RETRIES = 3;
30
+ let retryCount = 0;
31
+ let lastError = null;
32
+ // Retry loop to handle potential database connection issues
33
+ while (retryCount < MAX_RETRIES) {
34
+ try {
35
+ const [modules, client] = await Promise.all([
36
+ getApolloModules(),
37
+ globalClient
38
+ ? Promise.resolve(globalClient)
39
+ : importedClient
40
+ ]);
41
+ const { gql, ApolloError } = modules;
42
+ const CREATE_ONE_SCHEDULEDOPTIONORDER = gql `
43
+ mutation createOneScheduledOptionOrder($data: ScheduledOptionOrderCreateInput!) {
44
+ createOneScheduledOptionOrder(data: $data) {
45
+ ${selectionSet}
46
+ }
47
+ }
48
+ `;
49
+ const variables = {
50
+ data: {
51
+ payload: props.payload !== undefined ? props.payload : undefined,
52
+ status: props.status !== undefined ? props.status : undefined,
53
+ },
54
+ };
55
+ const filteredVariables = removeUndefinedProps(variables);
56
+ const response = await client.mutate({
57
+ mutation: CREATE_ONE_SCHEDULEDOPTIONORDER,
58
+ variables: filteredVariables,
59
+ // Don't cache mutations, but ensure we're using the freshest context
60
+ fetchPolicy: 'no-cache'
61
+ });
62
+ if (response.errors && response.errors.length > 0)
63
+ throw new Error(response.errors[0].message);
64
+ if (response && response.data && response.data.createOneScheduledOptionOrder) {
65
+ return response.data.createOneScheduledOptionOrder;
66
+ }
67
+ else {
68
+ return null;
69
+ }
48
70
  }
49
- else {
50
- return null;
71
+ catch (error) {
72
+ lastError = error;
73
+ // Check if this is a database connection error that we should retry
74
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
75
+ error.message?.includes('Cannot reach database server') ||
76
+ error.message?.includes('Connection timed out') ||
77
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
78
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
79
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
80
+ retryCount++;
81
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
82
+ console.warn("Database connection error, retrying...");
83
+ await new Promise(resolve => setTimeout(resolve, delay));
84
+ continue;
85
+ }
86
+ // Log the error and rethrow
87
+ console.error("Database error occurred:", error);
88
+ throw error;
51
89
  }
52
90
  }
53
- catch (error) {
54
- console.error('Error in createOneScheduledOptionOrder:', error);
55
- throw error;
56
- }
91
+ // If we exhausted retries, throw the last error
92
+ throw lastError;
57
93
  },
58
94
  /**
59
95
  * Create multiple ScheduledOptionOrder records.
96
+ * Enhanced with connection resilience against Prisma connection errors.
60
97
  * @param props - Array of ScheduledOptionOrder objects for the new records.
61
98
  * @param globalClient - Apollo Client instance.
62
99
  * @returns The count of created records or null.
63
100
  */
64
101
  async createMany(props, globalClient) {
65
- const [modules, client] = await Promise.all([
66
- getApolloModules(),
67
- globalClient
68
- ? Promise.resolve(globalClient)
69
- : importedClient
70
- ]);
71
- const { gql, ApolloError } = modules;
72
- const CREATE_MANY_SCHEDULEDOPTIONORDER = gql `
73
- mutation createManyScheduledOptionOrder($data: [ScheduledOptionOrderCreateManyInput!]!) {
74
- createManyScheduledOptionOrder(data: $data) {
75
- count
76
- }
77
- }`;
78
- const variables = {
79
- data: props.map(prop => ({
80
- payload: prop.payload !== undefined ? prop.payload : undefined,
81
- status: prop.status !== undefined ? prop.status : undefined,
82
- })),
83
- };
84
- const filteredVariables = removeUndefinedProps(variables);
85
- try {
86
- const response = await client.mutate({ mutation: CREATE_MANY_SCHEDULEDOPTIONORDER, variables: filteredVariables });
87
- if (response.errors && response.errors.length > 0)
88
- throw new Error(response.errors[0].message);
89
- if (response && response.data && response.data.createManyScheduledOptionOrder) {
90
- return response.data.createManyScheduledOptionOrder;
102
+ // Maximum number of retries for database connection issues
103
+ const MAX_RETRIES = 3;
104
+ let retryCount = 0;
105
+ let lastError = null;
106
+ // Retry loop to handle potential database connection issues
107
+ while (retryCount < MAX_RETRIES) {
108
+ try {
109
+ const [modules, client] = await Promise.all([
110
+ getApolloModules(),
111
+ globalClient
112
+ ? Promise.resolve(globalClient)
113
+ : importedClient
114
+ ]);
115
+ const { gql, ApolloError } = modules;
116
+ const CREATE_MANY_SCHEDULEDOPTIONORDER = gql `
117
+ mutation createManyScheduledOptionOrder($data: [ScheduledOptionOrderCreateManyInput!]!) {
118
+ createManyScheduledOptionOrder(data: $data) {
119
+ count
91
120
  }
92
- else {
93
- return null;
121
+ }`;
122
+ const variables = {
123
+ data: props.map(prop => ({
124
+ payload: prop.payload !== undefined ? prop.payload : undefined,
125
+ status: prop.status !== undefined ? prop.status : undefined,
126
+ })),
127
+ };
128
+ const filteredVariables = removeUndefinedProps(variables);
129
+ const response = await client.mutate({
130
+ mutation: CREATE_MANY_SCHEDULEDOPTIONORDER,
131
+ variables: filteredVariables,
132
+ // Don't cache mutations, but ensure we're using the freshest context
133
+ fetchPolicy: 'no-cache'
134
+ });
135
+ if (response.errors && response.errors.length > 0)
136
+ throw new Error(response.errors[0].message);
137
+ if (response && response.data && response.data.createManyScheduledOptionOrder) {
138
+ return response.data.createManyScheduledOptionOrder;
139
+ }
140
+ else {
141
+ return null;
142
+ }
143
+ }
144
+ catch (error) {
145
+ lastError = error;
146
+ // Check if this is a database connection error that we should retry
147
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
148
+ error.message?.includes('Cannot reach database server') ||
149
+ error.message?.includes('Connection timed out') ||
150
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
151
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
152
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
153
+ retryCount++;
154
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
155
+ console.warn("Database connection error, retrying...");
156
+ await new Promise(resolve => setTimeout(resolve, delay));
157
+ continue;
158
+ }
159
+ // Log the error and rethrow
160
+ console.error("Database error occurred:", error);
161
+ throw error;
94
162
  }
95
163
  }
96
- catch (error) {
97
- console.error('Error in createManyScheduledOptionOrder:', error);
98
- throw error;
99
- }
164
+ // If we exhausted retries, throw the last error
165
+ throw lastError;
100
166
  },
101
167
  /**
102
168
  * Update a single ScheduledOptionOrder record.
169
+ * Enhanced with connection resilience against Prisma connection errors.
103
170
  * @param props - Properties to update.
104
171
  * @param globalClient - Apollo Client instance.
105
172
  * @returns The updated ScheduledOptionOrder or null.
106
173
  */
107
174
  async update(props, globalClient) {
108
- const [modules, client] = await Promise.all([
109
- getApolloModules(),
110
- globalClient
111
- ? Promise.resolve(globalClient)
112
- : importedClient
113
- ]);
114
- const { gql, ApolloError } = modules;
115
- const UPDATE_ONE_SCHEDULEDOPTIONORDER = gql `
116
- mutation updateOneScheduledOptionOrder($data: ScheduledOptionOrderUpdateInput!, $where: ScheduledOptionOrderWhereUniqueInput!) {
117
- updateOneScheduledOptionOrder(data: $data, where: $where) {
118
- ${selectionSet}
119
- }
120
- }`;
121
- const variables = {
122
- where: {
123
- id: props.id !== undefined ? props.id : undefined,
124
- },
125
- data: {
126
- id: props.id !== undefined ? {
127
- set: props.id
128
- } : undefined,
129
- payload: props.payload !== undefined ? {
130
- set: props.payload
131
- } : undefined,
132
- status: props.status !== undefined ? {
133
- set: props.status
134
- } : undefined,
135
- },
136
- };
137
- const filteredVariables = removeUndefinedProps(variables);
138
- try {
139
- const response = await client.mutate({ mutation: UPDATE_ONE_SCHEDULEDOPTIONORDER, variables: filteredVariables });
140
- if (response.errors && response.errors.length > 0)
141
- throw new Error(response.errors[0].message);
142
- if (response && response.data && response.data.updateOneScheduledOptionOrder) {
143
- return response.data.updateOneScheduledOptionOrder;
175
+ // Maximum number of retries for database connection issues
176
+ const MAX_RETRIES = 3;
177
+ let retryCount = 0;
178
+ let lastError = null;
179
+ // Retry loop to handle potential database connection issues
180
+ while (retryCount < MAX_RETRIES) {
181
+ try {
182
+ const [modules, client] = await Promise.all([
183
+ getApolloModules(),
184
+ globalClient
185
+ ? Promise.resolve(globalClient)
186
+ : importedClient
187
+ ]);
188
+ const { gql, ApolloError } = modules;
189
+ const UPDATE_ONE_SCHEDULEDOPTIONORDER = gql `
190
+ mutation updateOneScheduledOptionOrder($data: ScheduledOptionOrderUpdateInput!, $where: ScheduledOptionOrderWhereUniqueInput!) {
191
+ updateOneScheduledOptionOrder(data: $data, where: $where) {
192
+ ${selectionSet}
144
193
  }
145
- else {
146
- return null;
194
+ }`;
195
+ const variables = {
196
+ where: {
197
+ id: props.id !== undefined ? props.id : undefined,
198
+ status: props.status !== undefined ? {
199
+ equals: props.status
200
+ } : undefined,
201
+ },
202
+ data: {
203
+ id: props.id !== undefined ? {
204
+ set: props.id
205
+ } : undefined,
206
+ payload: props.payload !== undefined ? {
207
+ set: props.payload
208
+ } : undefined,
209
+ status: props.status !== undefined ? {
210
+ set: props.status
211
+ } : undefined,
212
+ },
213
+ };
214
+ const filteredVariables = removeUndefinedProps(variables);
215
+ const response = await client.mutate({
216
+ mutation: UPDATE_ONE_SCHEDULEDOPTIONORDER,
217
+ variables: filteredVariables,
218
+ // Don't cache mutations, but ensure we're using the freshest context
219
+ fetchPolicy: 'no-cache'
220
+ });
221
+ if (response.errors && response.errors.length > 0)
222
+ throw new Error(response.errors[0].message);
223
+ if (response && response.data && response.data.updateOneScheduledOptionOrder) {
224
+ return response.data.updateOneScheduledOptionOrder;
225
+ }
226
+ else {
227
+ return null;
228
+ }
229
+ }
230
+ catch (error) {
231
+ lastError = error;
232
+ // Check if this is a database connection error that we should retry
233
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
234
+ error.message?.includes('Cannot reach database server') ||
235
+ error.message?.includes('Connection timed out') ||
236
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
237
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
238
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
239
+ retryCount++;
240
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
241
+ console.warn("Database connection error, retrying...");
242
+ await new Promise(resolve => setTimeout(resolve, delay));
243
+ continue;
244
+ }
245
+ // Log the error and rethrow
246
+ console.error("Database error occurred:", error);
247
+ throw error;
147
248
  }
148
249
  }
149
- catch (error) {
150
- console.error('Error in updateOneScheduledOptionOrder:', error);
151
- throw error;
152
- }
250
+ // If we exhausted retries, throw the last error
251
+ throw lastError;
153
252
  },
154
253
  /**
155
254
  * Upsert a single ScheduledOptionOrder record.
255
+ * Enhanced with connection resilience against Prisma connection errors.
156
256
  * @param props - Properties to update.
157
257
  * @param globalClient - Apollo Client instance.
158
258
  * @returns The updated ScheduledOptionOrder or null.
159
259
  */
160
260
  async upsert(props, globalClient) {
161
- const [modules, client] = await Promise.all([
162
- getApolloModules(),
163
- globalClient
164
- ? Promise.resolve(globalClient)
165
- : importedClient
166
- ]);
167
- const { gql, ApolloError } = modules;
168
- const UPSERT_ONE_SCHEDULEDOPTIONORDER = gql `
169
- mutation upsertOneScheduledOptionOrder($where: ScheduledOptionOrderWhereUniqueInput!, $create: ScheduledOptionOrderCreateInput!, $update: ScheduledOptionOrderUpdateInput!) {
170
- upsertOneScheduledOptionOrder(where: $where, create: $create, update: $update) {
171
- ${selectionSet}
172
- }
173
- }`;
174
- const variables = {
175
- where: {
176
- id: props.id !== undefined ? props.id : undefined,
177
- },
178
- create: {
179
- payload: props.payload !== undefined ? props.payload : undefined,
180
- status: props.status !== undefined ? props.status : undefined,
181
- },
182
- update: {
183
- payload: props.payload !== undefined ? {
184
- set: props.payload
185
- } : undefined,
186
- status: props.status !== undefined ? {
187
- set: props.status
188
- } : undefined,
189
- },
190
- };
191
- const filteredVariables = removeUndefinedProps(variables);
192
- try {
193
- const response = await client.mutate({ mutation: UPSERT_ONE_SCHEDULEDOPTIONORDER, variables: filteredVariables });
194
- if (response.errors && response.errors.length > 0)
195
- throw new Error(response.errors[0].message);
196
- if (response && response.data && response.data.upsertOneScheduledOptionOrder) {
197
- return response.data.upsertOneScheduledOptionOrder;
261
+ // Maximum number of retries for database connection issues
262
+ const MAX_RETRIES = 3;
263
+ let retryCount = 0;
264
+ let lastError = null;
265
+ // Retry loop to handle potential database connection issues
266
+ while (retryCount < MAX_RETRIES) {
267
+ try {
268
+ const [modules, client] = await Promise.all([
269
+ getApolloModules(),
270
+ globalClient
271
+ ? Promise.resolve(globalClient)
272
+ : importedClient
273
+ ]);
274
+ const { gql, ApolloError } = modules;
275
+ const UPSERT_ONE_SCHEDULEDOPTIONORDER = gql `
276
+ mutation upsertOneScheduledOptionOrder($where: ScheduledOptionOrderWhereUniqueInput!, $create: ScheduledOptionOrderCreateInput!, $update: ScheduledOptionOrderUpdateInput!) {
277
+ upsertOneScheduledOptionOrder(where: $where, create: $create, update: $update) {
278
+ ${selectionSet}
198
279
  }
199
- else {
200
- return null;
280
+ }`;
281
+ const variables = {
282
+ where: {
283
+ id: props.id !== undefined ? props.id : undefined,
284
+ status: props.status !== undefined ? {
285
+ equals: props.status
286
+ } : undefined,
287
+ },
288
+ create: {
289
+ payload: props.payload !== undefined ? props.payload : undefined,
290
+ status: props.status !== undefined ? props.status : undefined,
291
+ },
292
+ update: {
293
+ payload: props.payload !== undefined ? {
294
+ set: props.payload
295
+ } : undefined,
296
+ status: props.status !== undefined ? {
297
+ set: props.status
298
+ } : undefined,
299
+ },
300
+ };
301
+ const filteredVariables = removeUndefinedProps(variables);
302
+ const response = await client.mutate({
303
+ mutation: UPSERT_ONE_SCHEDULEDOPTIONORDER,
304
+ variables: filteredVariables,
305
+ // Don't cache mutations, but ensure we're using the freshest context
306
+ fetchPolicy: 'no-cache'
307
+ });
308
+ if (response.errors && response.errors.length > 0)
309
+ throw new Error(response.errors[0].message);
310
+ if (response && response.data && response.data.upsertOneScheduledOptionOrder) {
311
+ return response.data.upsertOneScheduledOptionOrder;
312
+ }
313
+ else {
314
+ return null;
315
+ }
316
+ }
317
+ catch (error) {
318
+ lastError = error;
319
+ // Check if this is a database connection error that we should retry
320
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
321
+ error.message?.includes('Cannot reach database server') ||
322
+ error.message?.includes('Connection timed out') ||
323
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
324
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
325
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
326
+ retryCount++;
327
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
328
+ console.warn("Database connection error, retrying...");
329
+ await new Promise(resolve => setTimeout(resolve, delay));
330
+ continue;
331
+ }
332
+ // Log the error and rethrow
333
+ console.error("Database error occurred:", error);
334
+ throw error;
201
335
  }
202
336
  }
203
- catch (error) {
204
- console.error('Error in upsertOneScheduledOptionOrder:', error);
205
- throw error;
206
- }
337
+ // If we exhausted retries, throw the last error
338
+ throw lastError;
207
339
  },
208
340
  /**
209
341
  * Update multiple ScheduledOptionOrder records.
342
+ * Enhanced with connection resilience against Prisma connection errors.
210
343
  * @param props - Array of ScheduledOptionOrder objects for the updated records.
211
344
  * @param globalClient - Apollo Client instance.
212
345
  * @returns The count of created records or null.
213
346
  */
214
347
  async updateMany(props, globalClient) {
215
- const [modules, client] = await Promise.all([
216
- getApolloModules(),
217
- globalClient
218
- ? Promise.resolve(globalClient)
219
- : importedClient
220
- ]);
221
- const { gql, ApolloError } = modules;
222
- const UPDATE_MANY_SCHEDULEDOPTIONORDER = gql `
223
- mutation updateManyScheduledOptionOrder($data: [ScheduledOptionOrderCreateManyInput!]!) {
224
- updateManyScheduledOptionOrder(data: $data) {
225
- count
226
- }
227
- }`;
228
- const variables = props.map(prop => ({
229
- where: {
230
- id: prop.id !== undefined ? prop.id : undefined,
231
- },
232
- data: {
233
- id: prop.id !== undefined ? {
234
- set: prop.id
235
- } : undefined,
236
- payload: prop.payload !== undefined ? {
237
- set: prop.payload
238
- } : undefined,
239
- status: prop.status !== undefined ? {
240
- set: prop.status
241
- } : undefined,
242
- },
243
- }));
244
- const filteredVariables = removeUndefinedProps(variables);
245
- try {
246
- const response = await client.mutate({ mutation: UPDATE_MANY_SCHEDULEDOPTIONORDER, variables: filteredVariables });
247
- if (response.errors && response.errors.length > 0)
248
- throw new Error(response.errors[0].message);
249
- if (response && response.data && response.data.updateManyScheduledOptionOrder) {
250
- return response.data.updateManyScheduledOptionOrder;
348
+ // Maximum number of retries for database connection issues
349
+ const MAX_RETRIES = 3;
350
+ let retryCount = 0;
351
+ let lastError = null;
352
+ // Retry loop to handle potential database connection issues
353
+ while (retryCount < MAX_RETRIES) {
354
+ try {
355
+ const [modules, client] = await Promise.all([
356
+ getApolloModules(),
357
+ globalClient
358
+ ? Promise.resolve(globalClient)
359
+ : importedClient
360
+ ]);
361
+ const { gql, ApolloError } = modules;
362
+ const UPDATE_MANY_SCHEDULEDOPTIONORDER = gql `
363
+ mutation updateManyScheduledOptionOrder($data: [ScheduledOptionOrderCreateManyInput!]!) {
364
+ updateManyScheduledOptionOrder(data: $data) {
365
+ count
251
366
  }
252
- else {
253
- return null;
367
+ }`;
368
+ const variables = props.map(prop => ({
369
+ where: {
370
+ id: prop.id !== undefined ? prop.id : undefined,
371
+ status: prop.status !== undefined ? {
372
+ equals: prop.status
373
+ } : undefined,
374
+ },
375
+ data: {
376
+ id: prop.id !== undefined ? {
377
+ set: prop.id
378
+ } : undefined,
379
+ payload: prop.payload !== undefined ? {
380
+ set: prop.payload
381
+ } : undefined,
382
+ status: prop.status !== undefined ? {
383
+ set: prop.status
384
+ } : undefined,
385
+ },
386
+ }));
387
+ const filteredVariables = removeUndefinedProps(variables);
388
+ const response = await client.mutate({
389
+ mutation: UPDATE_MANY_SCHEDULEDOPTIONORDER,
390
+ variables: filteredVariables,
391
+ // Don't cache mutations, but ensure we're using the freshest context
392
+ fetchPolicy: 'no-cache'
393
+ });
394
+ if (response.errors && response.errors.length > 0)
395
+ throw new Error(response.errors[0].message);
396
+ if (response && response.data && response.data.updateManyScheduledOptionOrder) {
397
+ return response.data.updateManyScheduledOptionOrder;
398
+ }
399
+ else {
400
+ return null;
401
+ }
402
+ }
403
+ catch (error) {
404
+ lastError = error;
405
+ // Check if this is a database connection error that we should retry
406
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
407
+ error.message?.includes('Cannot reach database server') ||
408
+ error.message?.includes('Connection timed out') ||
409
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
410
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
411
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
412
+ retryCount++;
413
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
414
+ console.warn("Database connection error, retrying...");
415
+ await new Promise(resolve => setTimeout(resolve, delay));
416
+ continue;
417
+ }
418
+ // Log the error and rethrow
419
+ console.error("Database error occurred:", error);
420
+ throw error;
254
421
  }
255
422
  }
256
- catch (error) {
257
- console.error('Error in updateManyScheduledOptionOrder:', error);
258
- throw error;
259
- }
423
+ // If we exhausted retries, throw the last error
424
+ throw lastError;
260
425
  },
261
426
  /**
262
427
  * Delete a single ScheduledOptionOrder record.
263
- * @param props - Properties to update.
428
+ * Enhanced with connection resilience against Prisma connection errors.
429
+ * @param props - Properties to identify the record to delete.
264
430
  * @param globalClient - Apollo Client instance.
265
431
  * @returns The deleted ScheduledOptionOrder or null.
266
432
  */
267
433
  async delete(props, globalClient) {
268
- const [modules, client] = await Promise.all([
269
- getApolloModules(),
270
- globalClient
271
- ? Promise.resolve(globalClient)
272
- : importedClient
273
- ]);
274
- const { gql, ApolloError } = modules;
275
- const DELETE_ONE_SCHEDULEDOPTIONORDER = gql `
276
- mutation deleteOneScheduledOptionOrder($where: ScheduledOptionOrderWhereUniqueInput!) {
277
- deleteOneScheduledOptionOrder(where: $where) {
278
- id
279
- }
280
- }`;
281
- const variables = {
282
- where: {
283
- id: props.id ? props.id : undefined,
434
+ // Maximum number of retries for database connection issues
435
+ const MAX_RETRIES = 3;
436
+ let retryCount = 0;
437
+ let lastError = null;
438
+ // Retry loop to handle potential database connection issues
439
+ while (retryCount < MAX_RETRIES) {
440
+ try {
441
+ const [modules, client] = await Promise.all([
442
+ getApolloModules(),
443
+ globalClient
444
+ ? Promise.resolve(globalClient)
445
+ : importedClient
446
+ ]);
447
+ const { gql, ApolloError } = modules;
448
+ const DELETE_ONE_SCHEDULEDOPTIONORDER = gql `
449
+ mutation deleteOneScheduledOptionOrder($where: ScheduledOptionOrderWhereUniqueInput!) {
450
+ deleteOneScheduledOptionOrder(where: $where) {
451
+ id
284
452
  }
285
- };
286
- const filteredVariables = removeUndefinedProps(variables);
287
- try {
288
- const response = await client.mutate({ mutation: DELETE_ONE_SCHEDULEDOPTIONORDER, variables: filteredVariables });
289
- if (response.errors && response.errors.length > 0)
290
- throw new Error(response.errors[0].message);
291
- if (response && response.data && response.data.deleteOneScheduledOptionOrder) {
292
- return response.data.deleteOneScheduledOptionOrder;
453
+ }`;
454
+ const variables = {
455
+ where: {
456
+ id: props.id ? props.id : undefined,
457
+ }
458
+ };
459
+ const filteredVariables = removeUndefinedProps(variables);
460
+ const response = await client.mutate({
461
+ mutation: DELETE_ONE_SCHEDULEDOPTIONORDER,
462
+ variables: filteredVariables,
463
+ // Don't cache mutations, but ensure we're using the freshest context
464
+ fetchPolicy: 'no-cache'
465
+ });
466
+ if (response.errors && response.errors.length > 0)
467
+ throw new Error(response.errors[0].message);
468
+ if (response && response.data && response.data.deleteOneScheduledOptionOrder) {
469
+ return response.data.deleteOneScheduledOptionOrder;
470
+ }
471
+ else {
472
+ return null;
473
+ }
293
474
  }
294
- else {
295
- return null;
475
+ catch (error) {
476
+ lastError = error;
477
+ // Check if this is a database connection error that we should retry
478
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
479
+ error.message?.includes('Cannot reach database server') ||
480
+ error.message?.includes('Connection timed out') ||
481
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
482
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
483
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
484
+ retryCount++;
485
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
486
+ console.warn("Database connection error, retrying...");
487
+ await new Promise(resolve => setTimeout(resolve, delay));
488
+ continue;
489
+ }
490
+ // Log the error and rethrow
491
+ console.error("Database error occurred:", error);
492
+ throw error;
296
493
  }
297
494
  }
298
- catch (error) {
299
- console.error('Error in deleteOneScheduledOptionOrder:', error);
300
- throw error;
301
- }
495
+ // If we exhausted retries, throw the last error
496
+ throw lastError;
302
497
  },
303
498
  /**
304
499
  * Retrieve a single ScheduledOptionOrder record by ID.
305
- * @param props - Properties to update.
500
+ * Enhanced with connection resilience against Prisma connection errors.
501
+ * @param props - Properties to identify the record.
306
502
  * @param globalClient - Apollo Client instance.
503
+ * @param whereInput - Optional custom where input.
307
504
  * @returns The retrieved ScheduledOptionOrder or null.
308
505
  */
309
506
  async get(props, globalClient, whereInput) {
310
- const [modules, client] = await Promise.all([
311
- getApolloModules(),
312
- globalClient
313
- ? Promise.resolve(globalClient)
314
- : importedClient
315
- ]);
316
- const { gql, ApolloError } = modules;
317
- const GET_SCHEDULEDOPTIONORDER = gql `
318
- query getScheduledOptionOrder($where: ScheduledOptionOrderWhereUniqueInput!) {
319
- getScheduledOptionOrder(where: $where) {
320
- ${selectionSet}
321
- }
322
- }`;
323
- const variables = {
324
- where: whereInput ? whereInput : {
325
- id: props.id !== undefined ? props.id : undefined,
326
- },
327
- };
328
- const filteredVariables = removeUndefinedProps(variables);
329
- try {
330
- const response = await client.query({ query: GET_SCHEDULEDOPTIONORDER, variables: filteredVariables });
331
- if (response.errors && response.errors.length > 0)
332
- throw new Error(response.errors[0].message);
333
- return response.data?.getScheduledOptionOrder ?? null;
334
- }
335
- catch (error) {
336
- if (error instanceof ApolloError && error.message === 'No ScheduledOptionOrder found') {
337
- return null;
507
+ // Maximum number of retries for database connection issues
508
+ const MAX_RETRIES = 3;
509
+ let retryCount = 0;
510
+ let lastError = null;
511
+ // Retry loop to handle potential database connection issues
512
+ while (retryCount < MAX_RETRIES) {
513
+ try {
514
+ const [modules, client] = await Promise.all([
515
+ getApolloModules(),
516
+ globalClient
517
+ ? Promise.resolve(globalClient)
518
+ : importedClient
519
+ ]);
520
+ const { gql, ApolloError } = modules;
521
+ const GET_SCHEDULEDOPTIONORDER = gql `
522
+ query getScheduledOptionOrder($where: ScheduledOptionOrderWhereUniqueInput!) {
523
+ getScheduledOptionOrder(where: $where) {
524
+ ${selectionSet}
525
+ }
526
+ }`;
527
+ const variables = {
528
+ where: whereInput ? whereInput : {
529
+ id: props.id !== undefined ? props.id : undefined,
530
+ status: props.status !== undefined ? {
531
+ equals: props.status
532
+ } : undefined,
533
+ },
534
+ };
535
+ const filteredVariables = removeUndefinedProps(variables);
536
+ const response = await client.query({
537
+ query: GET_SCHEDULEDOPTIONORDER,
538
+ variables: filteredVariables,
539
+ fetchPolicy: 'network-only', // Force network request to avoid stale cache
540
+ });
541
+ if (response.errors && response.errors.length > 0)
542
+ throw new Error(response.errors[0].message);
543
+ return response.data?.getScheduledOptionOrder ?? null;
338
544
  }
339
- else {
340
- console.error('Error in getScheduledOptionOrder:', error);
545
+ catch (error) {
546
+ lastError = error;
547
+ // Check if this is a "No record found" error - this is an expected condition, not a failure
548
+ if (error.message === 'No ScheduledOptionOrder found') {
549
+ return null;
550
+ }
551
+ // Check if this is a database connection error that we should retry
552
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
553
+ error.message?.includes('Cannot reach database server') ||
554
+ error.message?.includes('Connection timed out') ||
555
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
556
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
557
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
558
+ retryCount++;
559
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
560
+ console.warn("Database connection error, retrying...");
561
+ await new Promise(resolve => setTimeout(resolve, delay));
562
+ continue;
563
+ }
564
+ // Log the error and rethrow
565
+ console.error("Database error occurred:", error);
341
566
  throw error;
342
567
  }
343
568
  }
569
+ // If we exhausted retries, throw the last error
570
+ throw lastError;
344
571
  },
345
572
  /**
346
573
  * Retrieve all ScheduledOptionOrders records.
574
+ * Enhanced with connection resilience against Prisma connection errors.
347
575
  * @param globalClient - Apollo Client instance.
348
576
  * @returns An array of ScheduledOptionOrder records or null.
349
577
  */
350
578
  async getAll(globalClient) {
351
- const [modules, client] = await Promise.all([
352
- getApolloModules(),
353
- globalClient
354
- ? Promise.resolve(globalClient)
355
- : importedClient
356
- ]);
357
- const { gql, ApolloError } = modules;
358
- const GET_ALL_SCHEDULEDOPTIONORDER = gql `
359
- query getAllScheduledOptionOrder {
360
- scheduledOptionOrders {
361
- ${selectionSet}
362
- }
363
- }`;
364
- try {
365
- const response = await client.query({ query: GET_ALL_SCHEDULEDOPTIONORDER });
366
- if (response.errors && response.errors.length > 0)
367
- throw new Error(response.errors[0].message);
368
- return response.data?.scheduledOptionOrders ?? null;
369
- }
370
- catch (error) {
371
- if (error instanceof ApolloError && error.message === 'No ScheduledOptionOrder found') {
372
- return null;
579
+ // Maximum number of retries for database connection issues
580
+ const MAX_RETRIES = 3;
581
+ let retryCount = 0;
582
+ let lastError = null;
583
+ // Retry loop to handle potential database connection issues
584
+ while (retryCount < MAX_RETRIES) {
585
+ try {
586
+ const [modules, client] = await Promise.all([
587
+ getApolloModules(),
588
+ globalClient
589
+ ? Promise.resolve(globalClient)
590
+ : importedClient
591
+ ]);
592
+ const { gql, ApolloError } = modules;
593
+ const GET_ALL_SCHEDULEDOPTIONORDER = gql `
594
+ query getAllScheduledOptionOrder {
595
+ scheduledOptionOrders {
596
+ ${selectionSet}
373
597
  }
374
- else {
375
- console.error('Error in getScheduledOptionOrder:', error);
598
+ }`;
599
+ const response = await client.query({
600
+ query: GET_ALL_SCHEDULEDOPTIONORDER,
601
+ fetchPolicy: 'network-only', // Force network request to avoid stale cache
602
+ });
603
+ if (response.errors && response.errors.length > 0)
604
+ throw new Error(response.errors[0].message);
605
+ return response.data?.scheduledOptionOrders ?? null;
606
+ }
607
+ catch (error) {
608
+ lastError = error;
609
+ // Check if this is a "No record found" error - this is an expected condition, not a failure
610
+ if (error.message === 'No ScheduledOptionOrder found') {
611
+ return null;
612
+ }
613
+ // Check if this is a database connection error that we should retry
614
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
615
+ error.message?.includes('Cannot reach database server') ||
616
+ error.message?.includes('Connection timed out') ||
617
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
618
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
619
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
620
+ retryCount++;
621
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
622
+ console.warn("Database connection error, retrying...");
623
+ await new Promise(resolve => setTimeout(resolve, delay));
624
+ continue;
625
+ }
626
+ // Log the error and rethrow
627
+ console.error("Database error occurred:", error);
376
628
  throw error;
377
629
  }
378
630
  }
631
+ // If we exhausted retries, throw the last error
632
+ throw lastError;
379
633
  },
380
634
  /**
381
635
  * Find multiple ScheduledOptionOrder records based on conditions.
636
+ * Enhanced with connection resilience against Prisma connection errors.
382
637
  * @param props - Conditions to find records.
383
638
  * @param globalClient - Apollo Client instance.
639
+ * @param whereInput - Optional custom where input.
384
640
  * @returns An array of found ScheduledOptionOrder records or null.
385
641
  */
386
642
  async findMany(props, globalClient, whereInput) {
387
- const [modules, client] = await Promise.all([
388
- getApolloModules(),
389
- globalClient
390
- ? Promise.resolve(globalClient)
391
- : importedClient
392
- ]);
393
- const { gql, ApolloError } = modules;
394
- const FIND_MANY_SCHEDULEDOPTIONORDER = gql `
395
- query findManyScheduledOptionOrder($where: ScheduledOptionOrderWhereInput!) {
396
- scheduledOptionOrders(where: $where) {
397
- ${selectionSet}
398
- }
399
- }`;
400
- const variables = {
401
- where: whereInput ? whereInput : {
402
- id: props.id !== undefined ? {
403
- equals: props.id
404
- } : undefined,
405
- },
406
- };
407
- const filteredVariables = removeUndefinedProps(variables);
408
- try {
409
- const response = await client.query({ query: FIND_MANY_SCHEDULEDOPTIONORDER, variables: filteredVariables });
410
- if (response.errors && response.errors.length > 0)
411
- throw new Error(response.errors[0].message);
412
- if (response && response.data && response.data.scheduledoptionorders) {
413
- return response.data.scheduledOptionOrders;
643
+ // Maximum number of retries for database connection issues
644
+ const MAX_RETRIES = 3;
645
+ let retryCount = 0;
646
+ let lastError = null;
647
+ // Retry loop to handle potential database connection issues
648
+ while (retryCount < MAX_RETRIES) {
649
+ try {
650
+ const [modules, client] = await Promise.all([
651
+ getApolloModules(),
652
+ globalClient
653
+ ? Promise.resolve(globalClient)
654
+ : importedClient
655
+ ]);
656
+ const { gql, ApolloError } = modules;
657
+ const FIND_MANY_SCHEDULEDOPTIONORDER = gql `
658
+ query findManyScheduledOptionOrder($where: ScheduledOptionOrderWhereInput!) {
659
+ scheduledOptionOrders(where: $where) {
660
+ ${selectionSet}
414
661
  }
415
- else {
416
- return [];
417
- }
418
- }
419
- catch (error) {
420
- if (error instanceof ApolloError && error.message === 'No ScheduledOptionOrder found') {
421
- return null;
662
+ }`;
663
+ const variables = {
664
+ where: whereInput ? whereInput : {
665
+ id: props.id !== undefined ? props.id : undefined,
666
+ status: props.status !== undefined ? {
667
+ equals: props.status
668
+ } : undefined,
669
+ },
670
+ };
671
+ const filteredVariables = removeUndefinedProps(variables);
672
+ const response = await client.query({
673
+ query: FIND_MANY_SCHEDULEDOPTIONORDER,
674
+ variables: filteredVariables,
675
+ fetchPolicy: 'network-only', // Force network request to avoid stale cache
676
+ });
677
+ if (response.errors && response.errors.length > 0)
678
+ throw new Error(response.errors[0].message);
679
+ if (response && response.data && response.data.scheduledoptionorders) {
680
+ return response.data.scheduledOptionOrders;
681
+ }
682
+ else {
683
+ return [];
684
+ }
422
685
  }
423
- else {
424
- console.error('Error in getScheduledOptionOrder:', error);
686
+ catch (error) {
687
+ lastError = error;
688
+ // Check if this is a "No record found" error - this is an expected condition, not a failure
689
+ if (error.message === 'No ScheduledOptionOrder found') {
690
+ return null;
691
+ }
692
+ // Check if this is a database connection error that we should retry
693
+ const isConnectionError = error.message?.includes('Server has closed the connection') ||
694
+ error.message?.includes('Cannot reach database server') ||
695
+ error.message?.includes('Connection timed out') ||
696
+ error.message?.includes('Accelerate') || // Prisma Accelerate proxy errors
697
+ (error.networkError && error.networkError.message?.includes('Failed to fetch'));
698
+ if (isConnectionError && retryCount < MAX_RETRIES - 1) {
699
+ retryCount++;
700
+ const delay = Math.pow(2, retryCount) * 100; // Exponential backoff: 200ms, 400ms, 800ms
701
+ console.warn("Database connection error, retrying...");
702
+ await new Promise(resolve => setTimeout(resolve, delay));
703
+ continue;
704
+ }
705
+ // Log the error and rethrow
706
+ console.error("Database error occurred:", error);
425
707
  throw error;
426
708
  }
427
709
  }
710
+ // If we exhausted retries, throw the last error
711
+ throw lastError;
428
712
  }
429
713
  };
430
714
  //# sourceMappingURL=ScheduledOptionOrder.js.map