@discomedia/utils 1.0.75 → 1.0.76
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/index-frontend.cjs +24 -2
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +24 -2
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +24 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +24 -2
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +24 -2
- package/dist/test.js.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1701,7 +1701,7 @@ const safeJSON = (text) => {
|
|
|
1701
1701
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1702
1702
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1703
1703
|
|
|
1704
|
-
const VERSION = '6.
|
|
1704
|
+
const VERSION = '6.41.0'; // x-release-please-version
|
|
1705
1705
|
|
|
1706
1706
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1707
1707
|
const isRunningInBrowser = () => {
|
|
@@ -11313,7 +11313,10 @@ class OpenAI {
|
|
|
11313
11313
|
if (isTimeout) {
|
|
11314
11314
|
throw new APIConnectionTimeoutError();
|
|
11315
11315
|
}
|
|
11316
|
-
throw new APIConnectionError({
|
|
11316
|
+
throw new APIConnectionError({
|
|
11317
|
+
message: getConnectionErrorMessage(response),
|
|
11318
|
+
cause: response,
|
|
11319
|
+
});
|
|
11317
11320
|
}
|
|
11318
11321
|
const specialHeaders = [...response.headers.entries()]
|
|
11319
11322
|
.filter(([name]) => name === 'x-request-id')
|
|
@@ -11645,6 +11648,25 @@ OpenAI.Evals = Evals;
|
|
|
11645
11648
|
OpenAI.Containers = Containers;
|
|
11646
11649
|
OpenAI.Skills = Skills;
|
|
11647
11650
|
OpenAI.Videos = Videos;
|
|
11651
|
+
function getConnectionErrorMessage(error) {
|
|
11652
|
+
if (isUndiciDispatcherVersionMismatchError(error)) {
|
|
11653
|
+
return `Connection error. This may be caused by passing an undici dispatcher, such as ProxyAgent, that is incompatible with the fetch implementation. If you are using undici's ProxyAgent, pass the fetch implementation from the same undici package: import { fetch, ProxyAgent } from 'undici'; new OpenAI({ fetch, fetchOptions: { dispatcher: new ProxyAgent(...) } });`;
|
|
11654
|
+
}
|
|
11655
|
+
return undefined;
|
|
11656
|
+
}
|
|
11657
|
+
function isUndiciDispatcherVersionMismatchError(error) {
|
|
11658
|
+
let current = error;
|
|
11659
|
+
for (let i = 0; i < 8 && current && typeof current === 'object'; i++) {
|
|
11660
|
+
const err = current;
|
|
11661
|
+
if (err.code === 'UND_ERR_INVALID_ARG' &&
|
|
11662
|
+
typeof err.message === 'string' &&
|
|
11663
|
+
err.message.includes('invalid onRequestStart method')) {
|
|
11664
|
+
return true;
|
|
11665
|
+
}
|
|
11666
|
+
current = err.cause;
|
|
11667
|
+
}
|
|
11668
|
+
return false;
|
|
11669
|
+
}
|
|
11648
11670
|
|
|
11649
11671
|
function getEnumValues(entries) {
|
|
11650
11672
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|