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