@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.cjs
CHANGED
|
@@ -1703,7 +1703,7 @@ const safeJSON = (text) => {
|
|
|
1703
1703
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1704
1704
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1705
1705
|
|
|
1706
|
-
const VERSION = '6.
|
|
1706
|
+
const VERSION = '6.41.0'; // x-release-please-version
|
|
1707
1707
|
|
|
1708
1708
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1709
1709
|
const isRunningInBrowser = () => {
|
|
@@ -11315,7 +11315,10 @@ class OpenAI {
|
|
|
11315
11315
|
if (isTimeout) {
|
|
11316
11316
|
throw new APIConnectionTimeoutError();
|
|
11317
11317
|
}
|
|
11318
|
-
throw new APIConnectionError({
|
|
11318
|
+
throw new APIConnectionError({
|
|
11319
|
+
message: getConnectionErrorMessage(response),
|
|
11320
|
+
cause: response,
|
|
11321
|
+
});
|
|
11319
11322
|
}
|
|
11320
11323
|
const specialHeaders = [...response.headers.entries()]
|
|
11321
11324
|
.filter(([name]) => name === 'x-request-id')
|
|
@@ -11647,6 +11650,25 @@ OpenAI.Evals = Evals;
|
|
|
11647
11650
|
OpenAI.Containers = Containers;
|
|
11648
11651
|
OpenAI.Skills = Skills;
|
|
11649
11652
|
OpenAI.Videos = Videos;
|
|
11653
|
+
function getConnectionErrorMessage(error) {
|
|
11654
|
+
if (isUndiciDispatcherVersionMismatchError(error)) {
|
|
11655
|
+
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(...) } });`;
|
|
11656
|
+
}
|
|
11657
|
+
return undefined;
|
|
11658
|
+
}
|
|
11659
|
+
function isUndiciDispatcherVersionMismatchError(error) {
|
|
11660
|
+
let current = error;
|
|
11661
|
+
for (let i = 0; i < 8 && current && typeof current === 'object'; i++) {
|
|
11662
|
+
const err = current;
|
|
11663
|
+
if (err.code === 'UND_ERR_INVALID_ARG' &&
|
|
11664
|
+
typeof err.message === 'string' &&
|
|
11665
|
+
err.message.includes('invalid onRequestStart method')) {
|
|
11666
|
+
return true;
|
|
11667
|
+
}
|
|
11668
|
+
current = err.cause;
|
|
11669
|
+
}
|
|
11670
|
+
return false;
|
|
11671
|
+
}
|
|
11650
11672
|
|
|
11651
11673
|
function getEnumValues(entries) {
|
|
11652
11674
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|