@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 +16 -6
- package/dist/main.cjs.map +1 -1
- package/dist/module.js +17 -7
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/module.js
CHANGED
|
@@ -10,7 +10,7 @@ import {xml2js as $hgUW1$xml2js, js2xml as $hgUW1$js2xml} from "xml-js";
|
|
|
10
10
|
import $hgUW1$json2md from "json2md";
|
|
11
11
|
import $hgUW1$mime from "mime";
|
|
12
12
|
import $hgUW1$pmap from "p-map";
|
|
13
|
-
import $hgUW1$pretry from "p-retry";
|
|
13
|
+
import $hgUW1$pretry, {AbortError as $hgUW1$AbortError} from "p-retry";
|
|
14
14
|
import {Buffer as $hgUW1$Buffer} from "buffer";
|
|
15
15
|
import {parseOfficeAsync as $hgUW1$parseOfficeAsync} from "officeparser";
|
|
16
16
|
import {resolvePDFJS as $hgUW1$resolvePDFJS} from "pdfjs-serverless";
|
|
@@ -1392,11 +1392,16 @@ async function $bf2fdaa075f6a5e5$var$generateEmbeddingsCohere(body, api_key) {
|
|
|
1392
1392
|
texts: chunk
|
|
1393
1393
|
})
|
|
1394
1394
|
});
|
|
1395
|
-
if (!response.ok)
|
|
1395
|
+
if (!response.ok) {
|
|
1396
|
+
if (response.status === 429) throw new Error("Rate limit exceeded");
|
|
1397
|
+
if (response.status >= 500) throw new Error("Server error");
|
|
1398
|
+
throw new (0, $hgUW1$AbortError)(await response.text());
|
|
1399
|
+
}
|
|
1396
1400
|
return await response.json();
|
|
1397
1401
|
}, {
|
|
1398
|
-
retries:
|
|
1399
|
-
maxTimeout:
|
|
1402
|
+
retries: 5,
|
|
1403
|
+
maxTimeout: 5000,
|
|
1404
|
+
minTimeout: 2500
|
|
1400
1405
|
});
|
|
1401
1406
|
}, {
|
|
1402
1407
|
concurrency: 1
|
|
@@ -1412,11 +1417,16 @@ async function $bf2fdaa075f6a5e5$var$generateEmbeddingsCohere(body, api_key) {
|
|
|
1412
1417
|
},
|
|
1413
1418
|
body: JSON.stringify(body)
|
|
1414
1419
|
});
|
|
1415
|
-
if (!response.ok)
|
|
1420
|
+
if (!response.ok) {
|
|
1421
|
+
if (response.status === 429) throw new Error("Rate limit exceeded");
|
|
1422
|
+
if (response.status >= 500) throw new Error("Server error");
|
|
1423
|
+
throw new (0, $hgUW1$AbortError)(await response.text());
|
|
1424
|
+
}
|
|
1416
1425
|
return await response.json();
|
|
1417
1426
|
}, {
|
|
1418
|
-
retries:
|
|
1419
|
-
maxTimeout:
|
|
1427
|
+
retries: 5,
|
|
1428
|
+
maxTimeout: 5000,
|
|
1429
|
+
minTimeout: 2500
|
|
1420
1430
|
});
|
|
1421
1431
|
}
|
|
1422
1432
|
var $bf2fdaa075f6a5e5$export$2e2bcd8739ae039 = $bf2fdaa075f6a5e5$var$generateEmbeddingsCohere;
|