@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/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.44.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 = () => {
|
|
@@ -4089,7 +4089,12 @@ _AbstractChatCompletionRunner_instances = new WeakSet(), _AbstractChatCompletion
|
|
|
4089
4089
|
for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
4090
4090
|
const message = this.messages[i];
|
|
4091
4091
|
if (isAssistantMessage(message) && message?.tool_calls?.length) {
|
|
4092
|
-
|
|
4092
|
+
for (let j = message.tool_calls.length - 1; j >= 0; j--) {
|
|
4093
|
+
const toolCall = message.tool_calls[j];
|
|
4094
|
+
if (toolCall?.type === 'function') {
|
|
4095
|
+
return toolCall.function;
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4093
4098
|
}
|
|
4094
4099
|
}
|
|
4095
4100
|
return;
|
|
@@ -5467,6 +5472,23 @@ let SpendAlerts$1 = class SpendAlerts extends APIResource {
|
|
|
5467
5472
|
__security: { adminAPIKeyAuth: true },
|
|
5468
5473
|
});
|
|
5469
5474
|
}
|
|
5475
|
+
/**
|
|
5476
|
+
* Retrieves an organization spend alert.
|
|
5477
|
+
*
|
|
5478
|
+
* @example
|
|
5479
|
+
* ```ts
|
|
5480
|
+
* const organizationSpendAlert =
|
|
5481
|
+
* await client.admin.organization.spendAlerts.retrieve(
|
|
5482
|
+
* 'alert_id',
|
|
5483
|
+
* );
|
|
5484
|
+
* ```
|
|
5485
|
+
*/
|
|
5486
|
+
retrieve(alertID, options) {
|
|
5487
|
+
return this._client.get(path `/organization/spend_alerts/${alertID}`, {
|
|
5488
|
+
...options,
|
|
5489
|
+
__security: { adminAPIKeyAuth: true },
|
|
5490
|
+
});
|
|
5491
|
+
}
|
|
5470
5492
|
/**
|
|
5471
5493
|
* Updates an organization spend alert.
|
|
5472
5494
|
*
|
|
@@ -6498,6 +6520,25 @@ class SpendAlerts extends APIResource {
|
|
|
6498
6520
|
__security: { adminAPIKeyAuth: true },
|
|
6499
6521
|
});
|
|
6500
6522
|
}
|
|
6523
|
+
/**
|
|
6524
|
+
* Retrieves a project spend alert.
|
|
6525
|
+
*
|
|
6526
|
+
* @example
|
|
6527
|
+
* ```ts
|
|
6528
|
+
* const projectSpendAlert =
|
|
6529
|
+
* await client.admin.organization.projects.spendAlerts.retrieve(
|
|
6530
|
+
* 'alert_id',
|
|
6531
|
+
* { project_id: 'project_id' },
|
|
6532
|
+
* );
|
|
6533
|
+
* ```
|
|
6534
|
+
*/
|
|
6535
|
+
retrieve(alertID, params, options) {
|
|
6536
|
+
const { project_id } = params;
|
|
6537
|
+
return this._client.get(path `/organization/projects/${project_id}/spend_alerts/${alertID}`, {
|
|
6538
|
+
...options,
|
|
6539
|
+
__security: { adminAPIKeyAuth: true },
|
|
6540
|
+
});
|
|
6541
|
+
}
|
|
6501
6542
|
/**
|
|
6502
6543
|
* Updates a project spend alert.
|
|
6503
6544
|
*
|
|
@@ -11315,7 +11356,10 @@ class OpenAI {
|
|
|
11315
11356
|
if (isTimeout) {
|
|
11316
11357
|
throw new APIConnectionTimeoutError();
|
|
11317
11358
|
}
|
|
11318
|
-
throw new APIConnectionError({
|
|
11359
|
+
throw new APIConnectionError({
|
|
11360
|
+
message: getConnectionErrorMessage(response),
|
|
11361
|
+
cause: response,
|
|
11362
|
+
});
|
|
11319
11363
|
}
|
|
11320
11364
|
const specialHeaders = [...response.headers.entries()]
|
|
11321
11365
|
.filter(([name]) => name === 'x-request-id')
|
|
@@ -11647,6 +11691,25 @@ OpenAI.Evals = Evals;
|
|
|
11647
11691
|
OpenAI.Containers = Containers;
|
|
11648
11692
|
OpenAI.Skills = Skills;
|
|
11649
11693
|
OpenAI.Videos = Videos;
|
|
11694
|
+
function getConnectionErrorMessage(error) {
|
|
11695
|
+
if (isUndiciDispatcherVersionMismatchError(error)) {
|
|
11696
|
+
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(...) } });`;
|
|
11697
|
+
}
|
|
11698
|
+
return undefined;
|
|
11699
|
+
}
|
|
11700
|
+
function isUndiciDispatcherVersionMismatchError(error) {
|
|
11701
|
+
let current = error;
|
|
11702
|
+
for (let i = 0; i < 8 && current && typeof current === 'object'; i++) {
|
|
11703
|
+
const err = current;
|
|
11704
|
+
if (err.code === 'UND_ERR_INVALID_ARG' &&
|
|
11705
|
+
typeof err.message === 'string' &&
|
|
11706
|
+
err.message.includes('invalid onRequestStart method')) {
|
|
11707
|
+
return true;
|
|
11708
|
+
}
|
|
11709
|
+
current = err.cause;
|
|
11710
|
+
}
|
|
11711
|
+
return false;
|
|
11712
|
+
}
|
|
11650
11713
|
|
|
11651
11714
|
function getEnumValues(entries) {
|
|
11652
11715
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|