@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.
package/dist/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.74",
6
+ "version": "1.0.76",
7
7
  "author": "Disco Media",
8
8
  "description": "Utility functions used in Disco Media apps",
9
9
  "always-build-npm": true,
@@ -13,14 +13,14 @@
13
13
  "type": "module",
14
14
  "exports": {
15
15
  ".": {
16
+ "types": "./dist/types/index.d.ts",
16
17
  "import": "./dist/index.mjs",
17
- "require": "./dist/index.cjs",
18
- "types": "./dist/types/index.d.ts"
18
+ "require": "./dist/index.cjs"
19
19
  },
20
20
  "./frontend": {
21
+ "types": "./dist/types-frontend/index-frontend.d.ts",
21
22
  "import": "./dist/index-frontend.mjs",
22
- "require": "./dist/index-frontend.cjs",
23
- "types": "./dist/types-frontend/index-frontend.d.ts"
23
+ "require": "./dist/index-frontend.cjs"
24
24
  }
25
25
  },
26
26
  "files": [
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "dotenv": "^17.4.2",
36
- "openai": "^6.39.0",
36
+ "openai": "^6.41.0",
37
37
  "p-limit": "^7.3.0",
38
38
  "tslib": "^2.8.1",
39
39
  "ws": "^8.21.0",
@@ -41,13 +41,13 @@
41
41
  },
42
42
  "license": "ISC",
43
43
  "devDependencies": {
44
- "@rollup/plugin-commonjs": "^29.0.2",
44
+ "@rollup/plugin-commonjs": "^29.0.3",
45
45
  "@rollup/plugin-json": "^6.1.0",
46
46
  "@rollup/plugin-node-resolve": "^16.0.3",
47
47
  "@rollup/plugin-typescript": "^12.3.0",
48
48
  "@types/ws": "^8.18.1",
49
49
  "lightweight-charts": "^5.2.0",
50
- "rollup": "^4.60.4",
50
+ "rollup": "^4.61.0",
51
51
  "typescript": "^6.0.3"
52
52
  }
53
53
  }
package/dist/test.js CHANGED
@@ -648,7 +648,7 @@ const safeJSON = (text) => {
648
648
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
649
649
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
650
650
 
651
- const VERSION = '6.39.0'; // x-release-please-version
651
+ const VERSION = '6.41.0'; // x-release-please-version
652
652
 
653
653
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
654
654
  const isRunningInBrowser = () => {
@@ -10246,7 +10246,10 @@ class OpenAI {
10246
10246
  if (isTimeout) {
10247
10247
  throw new APIConnectionTimeoutError();
10248
10248
  }
10249
- throw new APIConnectionError({ cause: response });
10249
+ throw new APIConnectionError({
10250
+ message: getConnectionErrorMessage(response),
10251
+ cause: response,
10252
+ });
10250
10253
  }
10251
10254
  const specialHeaders = [...response.headers.entries()]
10252
10255
  .filter(([name]) => name === 'x-request-id')
@@ -10578,6 +10581,25 @@ OpenAI.Evals = Evals;
10578
10581
  OpenAI.Containers = Containers;
10579
10582
  OpenAI.Skills = Skills;
10580
10583
  OpenAI.Videos = Videos;
10584
+ function getConnectionErrorMessage(error) {
10585
+ if (isUndiciDispatcherVersionMismatchError(error)) {
10586
+ 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(...) } });`;
10587
+ }
10588
+ return undefined;
10589
+ }
10590
+ function isUndiciDispatcherVersionMismatchError(error) {
10591
+ let current = error;
10592
+ for (let i = 0; i < 8 && current && typeof current === 'object'; i++) {
10593
+ const err = current;
10594
+ if (err.code === 'UND_ERR_INVALID_ARG' &&
10595
+ typeof err.message === 'string' &&
10596
+ err.message.includes('invalid onRequestStart method')) {
10597
+ return true;
10598
+ }
10599
+ current = err.cause;
10600
+ }
10601
+ return false;
10602
+ }
10581
10603
 
10582
10604
  new Set(OPENAI_MODELS);
10583
10605