@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.
@@ -346,7 +346,7 @@ const safeJSON = (text) => {
346
346
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
347
347
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
348
348
 
349
- const VERSION = '6.39.0'; // x-release-please-version
349
+ const VERSION = '6.41.0'; // x-release-please-version
350
350
 
351
351
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
352
352
  const isRunningInBrowser = () => {
@@ -9958,7 +9958,10 @@ class OpenAI {
9958
9958
  if (isTimeout) {
9959
9959
  throw new APIConnectionTimeoutError();
9960
9960
  }
9961
- throw new APIConnectionError({ cause: response });
9961
+ throw new APIConnectionError({
9962
+ message: getConnectionErrorMessage(response),
9963
+ cause: response,
9964
+ });
9962
9965
  }
9963
9966
  const specialHeaders = [...response.headers.entries()]
9964
9967
  .filter(([name]) => name === 'x-request-id')
@@ -10290,6 +10293,25 @@ OpenAI.Evals = Evals;
10290
10293
  OpenAI.Containers = Containers;
10291
10294
  OpenAI.Skills = Skills;
10292
10295
  OpenAI.Videos = Videos;
10296
+ function getConnectionErrorMessage(error) {
10297
+ if (isUndiciDispatcherVersionMismatchError(error)) {
10298
+ 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(...) } });`;
10299
+ }
10300
+ return undefined;
10301
+ }
10302
+ function isUndiciDispatcherVersionMismatchError(error) {
10303
+ let current = error;
10304
+ for (let i = 0; i < 8 && current && typeof current === 'object'; i++) {
10305
+ const err = current;
10306
+ if (err.code === 'UND_ERR_INVALID_ARG' &&
10307
+ typeof err.message === 'string' &&
10308
+ err.message.includes('invalid onRequestStart method')) {
10309
+ return true;
10310
+ }
10311
+ current = err.cause;
10312
+ }
10313
+ return false;
10314
+ }
10293
10315
 
10294
10316
  function getEnumValues(entries) {
10295
10317
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");