@discomedia/utils 1.0.75 → 1.0.77
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 +66 -3
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +66 -3
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +66 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +66 -3
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +66 -3
- package/dist/test.js.map +1 -1
- package/package.json +4 -4
package/dist/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.77",
|
|
7
7
|
"author": "Disco Media",
|
|
8
8
|
"description": "Utility functions used in Disco Media apps",
|
|
9
9
|
"always-build-npm": true,
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"dotenv": "^17.4.2",
|
|
36
|
-
"openai": "^6.
|
|
36
|
+
"openai": "^6.44.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.
|
|
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.
|
|
50
|
+
"rollup": "^4.62.2",
|
|
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.
|
|
651
|
+
const VERSION = '6.44.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 = () => {
|
|
@@ -3020,7 +3020,12 @@ _AbstractChatCompletionRunner_instances = new WeakSet(), _AbstractChatCompletion
|
|
|
3020
3020
|
for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
3021
3021
|
const message = this.messages[i];
|
|
3022
3022
|
if (isAssistantMessage(message) && message?.tool_calls?.length) {
|
|
3023
|
-
|
|
3023
|
+
for (let j = message.tool_calls.length - 1; j >= 0; j--) {
|
|
3024
|
+
const toolCall = message.tool_calls[j];
|
|
3025
|
+
if (toolCall?.type === 'function') {
|
|
3026
|
+
return toolCall.function;
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3024
3029
|
}
|
|
3025
3030
|
}
|
|
3026
3031
|
return;
|
|
@@ -4398,6 +4403,23 @@ let SpendAlerts$1 = class SpendAlerts extends APIResource {
|
|
|
4398
4403
|
__security: { adminAPIKeyAuth: true },
|
|
4399
4404
|
});
|
|
4400
4405
|
}
|
|
4406
|
+
/**
|
|
4407
|
+
* Retrieves an organization spend alert.
|
|
4408
|
+
*
|
|
4409
|
+
* @example
|
|
4410
|
+
* ```ts
|
|
4411
|
+
* const organizationSpendAlert =
|
|
4412
|
+
* await client.admin.organization.spendAlerts.retrieve(
|
|
4413
|
+
* 'alert_id',
|
|
4414
|
+
* );
|
|
4415
|
+
* ```
|
|
4416
|
+
*/
|
|
4417
|
+
retrieve(alertID, options) {
|
|
4418
|
+
return this._client.get(path `/organization/spend_alerts/${alertID}`, {
|
|
4419
|
+
...options,
|
|
4420
|
+
__security: { adminAPIKeyAuth: true },
|
|
4421
|
+
});
|
|
4422
|
+
}
|
|
4401
4423
|
/**
|
|
4402
4424
|
* Updates an organization spend alert.
|
|
4403
4425
|
*
|
|
@@ -5429,6 +5451,25 @@ class SpendAlerts extends APIResource {
|
|
|
5429
5451
|
__security: { adminAPIKeyAuth: true },
|
|
5430
5452
|
});
|
|
5431
5453
|
}
|
|
5454
|
+
/**
|
|
5455
|
+
* Retrieves a project spend alert.
|
|
5456
|
+
*
|
|
5457
|
+
* @example
|
|
5458
|
+
* ```ts
|
|
5459
|
+
* const projectSpendAlert =
|
|
5460
|
+
* await client.admin.organization.projects.spendAlerts.retrieve(
|
|
5461
|
+
* 'alert_id',
|
|
5462
|
+
* { project_id: 'project_id' },
|
|
5463
|
+
* );
|
|
5464
|
+
* ```
|
|
5465
|
+
*/
|
|
5466
|
+
retrieve(alertID, params, options) {
|
|
5467
|
+
const { project_id } = params;
|
|
5468
|
+
return this._client.get(path `/organization/projects/${project_id}/spend_alerts/${alertID}`, {
|
|
5469
|
+
...options,
|
|
5470
|
+
__security: { adminAPIKeyAuth: true },
|
|
5471
|
+
});
|
|
5472
|
+
}
|
|
5432
5473
|
/**
|
|
5433
5474
|
* Updates a project spend alert.
|
|
5434
5475
|
*
|
|
@@ -10246,7 +10287,10 @@ class OpenAI {
|
|
|
10246
10287
|
if (isTimeout) {
|
|
10247
10288
|
throw new APIConnectionTimeoutError();
|
|
10248
10289
|
}
|
|
10249
|
-
throw new APIConnectionError({
|
|
10290
|
+
throw new APIConnectionError({
|
|
10291
|
+
message: getConnectionErrorMessage(response),
|
|
10292
|
+
cause: response,
|
|
10293
|
+
});
|
|
10250
10294
|
}
|
|
10251
10295
|
const specialHeaders = [...response.headers.entries()]
|
|
10252
10296
|
.filter(([name]) => name === 'x-request-id')
|
|
@@ -10578,6 +10622,25 @@ OpenAI.Evals = Evals;
|
|
|
10578
10622
|
OpenAI.Containers = Containers;
|
|
10579
10623
|
OpenAI.Skills = Skills;
|
|
10580
10624
|
OpenAI.Videos = Videos;
|
|
10625
|
+
function getConnectionErrorMessage(error) {
|
|
10626
|
+
if (isUndiciDispatcherVersionMismatchError(error)) {
|
|
10627
|
+
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(...) } });`;
|
|
10628
|
+
}
|
|
10629
|
+
return undefined;
|
|
10630
|
+
}
|
|
10631
|
+
function isUndiciDispatcherVersionMismatchError(error) {
|
|
10632
|
+
let current = error;
|
|
10633
|
+
for (let i = 0; i < 8 && current && typeof current === 'object'; i++) {
|
|
10634
|
+
const err = current;
|
|
10635
|
+
if (err.code === 'UND_ERR_INVALID_ARG' &&
|
|
10636
|
+
typeof err.message === 'string' &&
|
|
10637
|
+
err.message.includes('invalid onRequestStart method')) {
|
|
10638
|
+
return true;
|
|
10639
|
+
}
|
|
10640
|
+
current = err.cause;
|
|
10641
|
+
}
|
|
10642
|
+
return false;
|
|
10643
|
+
}
|
|
10581
10644
|
|
|
10582
10645
|
new Set(OPENAI_MODELS);
|
|
10583
10646
|
|