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