@truto/truto-jsonata 1.0.16 → 1.0.18

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/main.cjs CHANGED
@@ -1401,11 +1401,16 @@ async function $caaee789061bb8bb$var$generateEmbeddingsCohere(body, api_key) {
1401
1401
  texts: chunk
1402
1402
  })
1403
1403
  });
1404
- if (!response.ok) throw new Error(await response.text());
1404
+ if (!response.ok) {
1405
+ if (response.status === 429) throw new Error("Rate limit exceeded");
1406
+ if (response.status >= 500) throw new Error("Server error");
1407
+ throw new (0, $dxT2C$pretry.AbortError)(await response.text());
1408
+ }
1405
1409
  return await response.json();
1406
1410
  }, {
1407
- retries: 10,
1408
- maxTimeout: 600000
1411
+ retries: 5,
1412
+ maxTimeout: 5000,
1413
+ minTimeout: 2500
1409
1414
  });
1410
1415
  }, {
1411
1416
  concurrency: 1
@@ -1421,11 +1426,16 @@ async function $caaee789061bb8bb$var$generateEmbeddingsCohere(body, api_key) {
1421
1426
  },
1422
1427
  body: JSON.stringify(body)
1423
1428
  });
1424
- if (!response.ok) throw new Error(await response.text());
1429
+ if (!response.ok) {
1430
+ if (response.status === 429) throw new Error("Rate limit exceeded");
1431
+ if (response.status >= 500) throw new Error("Server error");
1432
+ throw new (0, $dxT2C$pretry.AbortError)(await response.text());
1433
+ }
1425
1434
  return await response.json();
1426
1435
  }, {
1427
- retries: 10,
1428
- maxTimeout: 600000
1436
+ retries: 5,
1437
+ maxTimeout: 5000,
1438
+ minTimeout: 2500
1429
1439
  });
1430
1440
  }
1431
1441
  var $caaee789061bb8bb$export$2e2bcd8739ae039 = $caaee789061bb8bb$var$generateEmbeddingsCohere;