@klauswuestefeld/jux-web 2024.4.1 → 2024.4.2

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/dist/jux-web.js CHANGED
@@ -193,6 +193,7 @@ var juxWeb = (function (exports) {
193
193
  };
194
194
  let requestRunning = false;
195
195
  const maxRetries = 20;
196
+ const timeout = 15000;
196
197
  const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1) => __awaiter$2(void 0, [url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1], void 0, function* (url, options, onSuccess, onError, onRedirect, requestType = 'query', handleUnauthorized = defaultHandleUnauthorized, retrial = false, retrialNum = 0) {
197
198
  if (requestRunning && !retrial) { // only allow one request at a time
198
199
  setTimeout(() => backendRequest(url, options, onSuccess, onError, onRedirect, requestType, handleUnauthorized, false), 300);
@@ -207,10 +208,12 @@ var juxWeb = (function (exports) {
207
208
  }
208
209
  let response;
209
210
  requestRunning = true;
210
- const requestInit = Object.assign({}, options);
211
+ const controller = new AbortController();
212
+ let timeoutId;
211
213
  if (requestType === 'query') {
212
- requestInit.signal = AbortSignal.timeout(15000);
214
+ timeoutId = setTimeout(() => controller.abort(), timeout); // abort connections that take longer than the value set on the timeout const
213
215
  }
216
+ const requestInit = Object.assign(Object.assign({}, options), { signal: controller.signal });
214
217
  if (onRedirect)
215
218
  requestInit.redirect = 'manual'; // Treat redirects manually instead of following them automatically.
216
219
  try {
@@ -246,7 +249,7 @@ var juxWeb = (function (exports) {
246
249
  return;
247
250
  }
248
251
  finally {
249
- requestRunning = false;
252
+ clearTimeout(timeoutId);
250
253
  }
251
254
  removeOverlay();
252
255
  if (onRedirect)
@@ -274,6 +277,9 @@ var juxWeb = (function (exports) {
274
277
  // json conversion error / json response dealing errors
275
278
  onError(err);
276
279
  }
280
+ finally {
281
+ requestRunning = false;
282
+ }
277
283
  });
278
284
  const post = (endpoint, body, onSuccess, onError, onRedirect, requestType = "query") => {
279
285
  const options = {
package/dist/main.esm.js CHANGED
@@ -192,6 +192,7 @@ const defaultHandleUnauthorized = () => {
192
192
  };
193
193
  let requestRunning = false;
194
194
  const maxRetries = 20;
195
+ const timeout = 15000;
195
196
  const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1) => __awaiter(void 0, [url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1], void 0, function* (url, options, onSuccess, onError, onRedirect, requestType = 'query', handleUnauthorized = defaultHandleUnauthorized, retrial = false, retrialNum = 0) {
196
197
  if (requestRunning && !retrial) { // only allow one request at a time
197
198
  setTimeout(() => backendRequest(url, options, onSuccess, onError, onRedirect, requestType, handleUnauthorized, false), 300);
@@ -206,10 +207,12 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
206
207
  }
207
208
  let response;
208
209
  requestRunning = true;
209
- const requestInit = Object.assign({}, options);
210
+ const controller = new AbortController();
211
+ let timeoutId;
210
212
  if (requestType === 'query') {
211
- requestInit.signal = AbortSignal.timeout(15000);
213
+ timeoutId = setTimeout(() => controller.abort(), timeout); // abort connections that take longer than the value set on the timeout const
212
214
  }
215
+ const requestInit = Object.assign(Object.assign({}, options), { signal: controller.signal });
213
216
  if (onRedirect)
214
217
  requestInit.redirect = 'manual'; // Treat redirects manually instead of following them automatically.
215
218
  try {
@@ -245,7 +248,7 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
245
248
  return;
246
249
  }
247
250
  finally {
248
- requestRunning = false;
251
+ clearTimeout(timeoutId);
249
252
  }
250
253
  removeOverlay();
251
254
  if (onRedirect)
@@ -273,6 +276,9 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
273
276
  // json conversion error / json response dealing errors
274
277
  onError(err);
275
278
  }
279
+ finally {
280
+ requestRunning = false;
281
+ }
276
282
  });
277
283
  const post = (endpoint, body, onSuccess, onError, onRedirect, requestType = "query") => {
278
284
  const options = {
package/dist/main.js CHANGED
@@ -216,6 +216,7 @@ const defaultHandleUnauthorized = () => {
216
216
  };
217
217
  let requestRunning = false;
218
218
  const maxRetries = 20;
219
+ const timeout = 15000;
219
220
  const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1) => __awaiter(void 0, [url_1, options_1, onSuccess_1, onError_1, onRedirect_1, ...args_1], void 0, function* (url, options, onSuccess, onError, onRedirect, requestType = 'query', handleUnauthorized = defaultHandleUnauthorized, retrial = false, retrialNum = 0) {
220
221
  if (requestRunning && !retrial) { // only allow one request at a time
221
222
  setTimeout(() => backendRequest(url, options, onSuccess, onError, onRedirect, requestType, handleUnauthorized, false), 300);
@@ -230,10 +231,12 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
230
231
  }
231
232
  let response;
232
233
  requestRunning = true;
233
- const requestInit = Object.assign({}, options);
234
+ const controller = new AbortController();
235
+ let timeoutId;
234
236
  if (requestType === 'query') {
235
- requestInit.signal = AbortSignal.timeout(15000);
237
+ timeoutId = setTimeout(() => controller.abort(), timeout); // abort connections that take longer than the value set on the timeout const
236
238
  }
239
+ const requestInit = Object.assign(Object.assign({}, options), { signal: controller.signal });
237
240
  if (onRedirect)
238
241
  requestInit.redirect = 'manual'; // Treat redirects manually instead of following them automatically.
239
242
  try {
@@ -269,7 +272,7 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
269
272
  return;
270
273
  }
271
274
  finally {
272
- requestRunning = false;
275
+ clearTimeout(timeoutId);
273
276
  }
274
277
  removeOverlay();
275
278
  if (onRedirect)
@@ -297,6 +300,9 @@ const backendRequest = (url_1, options_1, onSuccess_1, onError_1, onRedirect_1,
297
300
  // json conversion error / json response dealing errors
298
301
  onError(err);
299
302
  }
303
+ finally {
304
+ requestRunning = false;
305
+ }
300
306
  });
301
307
  const post = (endpoint, body, onSuccess, onError, onRedirect, requestType = "query") => {
302
308
  const options = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klauswuestefeld/jux-web",
3
- "version": "2024.4.1",
3
+ "version": "2024.4.2",
4
4
  "author": "Jux.House",
5
5
  "license": "Copyrighted",
6
6
  "description": "",