@discomedia/utils 1.0.57 → 1.0.59
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 +132 -9
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +132 -9
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +136 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +136 -16
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +3 -3
- package/dist/test.js +137 -16
- package/dist/test.js.map +1 -1
- package/package.json +3 -3
package/dist/index-frontend.cjs
CHANGED
|
@@ -260,7 +260,7 @@ const safeJSON = (text) => {
|
|
|
260
260
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
261
261
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
262
262
|
|
|
263
|
-
const VERSION = '6.
|
|
263
|
+
const VERSION = '6.22.0'; // x-release-please-version
|
|
264
264
|
|
|
265
265
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
266
266
|
const isRunningInBrowser = () => {
|
|
@@ -1393,6 +1393,11 @@ async function defaultParseResponse(client, props) {
|
|
|
1393
1393
|
const mediaType = contentType?.split(';')[0]?.trim();
|
|
1394
1394
|
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
1395
1395
|
if (isJSON) {
|
|
1396
|
+
const contentLength = response.headers.get('content-length');
|
|
1397
|
+
if (contentLength === '0') {
|
|
1398
|
+
// if there is no content we can't do anything
|
|
1399
|
+
return undefined;
|
|
1400
|
+
}
|
|
1396
1401
|
const json = await response.json();
|
|
1397
1402
|
return addRequestID(json, response);
|
|
1398
1403
|
}
|
|
@@ -4749,7 +4754,7 @@ class Completions extends APIResource {
|
|
|
4749
4754
|
}
|
|
4750
4755
|
|
|
4751
4756
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4752
|
-
class Content extends APIResource {
|
|
4757
|
+
let Content$2 = class Content extends APIResource {
|
|
4753
4758
|
/**
|
|
4754
4759
|
* Retrieve Container File Content
|
|
4755
4760
|
*/
|
|
@@ -4761,13 +4766,13 @@ class Content extends APIResource {
|
|
|
4761
4766
|
__binaryResponse: true,
|
|
4762
4767
|
});
|
|
4763
4768
|
}
|
|
4764
|
-
}
|
|
4769
|
+
};
|
|
4765
4770
|
|
|
4766
4771
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4767
4772
|
let Files$2 = class Files extends APIResource {
|
|
4768
4773
|
constructor() {
|
|
4769
4774
|
super(...arguments);
|
|
4770
|
-
this.content = new Content(this._client);
|
|
4775
|
+
this.content = new Content$2(this._client);
|
|
4771
4776
|
}
|
|
4772
4777
|
/**
|
|
4773
4778
|
* Create a Container File
|
|
@@ -4776,7 +4781,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
4776
4781
|
* a JSON request with a file ID.
|
|
4777
4782
|
*/
|
|
4778
4783
|
create(containerID, body, options) {
|
|
4779
|
-
return this._client.post(path `/containers/${containerID}/files`,
|
|
4784
|
+
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
4780
4785
|
}
|
|
4781
4786
|
/**
|
|
4782
4787
|
* Retrieve Container File
|
|
@@ -4805,7 +4810,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
4805
4810
|
});
|
|
4806
4811
|
}
|
|
4807
4812
|
};
|
|
4808
|
-
Files$2.Content = Content;
|
|
4813
|
+
Files$2.Content = Content$2;
|
|
4809
4814
|
|
|
4810
4815
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4811
4816
|
class Containers extends APIResource {
|
|
@@ -6093,6 +6098,114 @@ class Responses extends APIResource {
|
|
|
6093
6098
|
Responses.InputItems = InputItems;
|
|
6094
6099
|
Responses.InputTokens = InputTokens;
|
|
6095
6100
|
|
|
6101
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6102
|
+
let Content$1 = class Content extends APIResource {
|
|
6103
|
+
/**
|
|
6104
|
+
* Get Skill Content
|
|
6105
|
+
*/
|
|
6106
|
+
retrieve(skillID, options) {
|
|
6107
|
+
return this._client.get(path `/skills/${skillID}/content`, {
|
|
6108
|
+
...options,
|
|
6109
|
+
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
6110
|
+
__binaryResponse: true,
|
|
6111
|
+
});
|
|
6112
|
+
}
|
|
6113
|
+
};
|
|
6114
|
+
|
|
6115
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6116
|
+
class Content extends APIResource {
|
|
6117
|
+
/**
|
|
6118
|
+
* Get Skill Version Content
|
|
6119
|
+
*/
|
|
6120
|
+
retrieve(version, params, options) {
|
|
6121
|
+
const { skill_id } = params;
|
|
6122
|
+
return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
|
|
6123
|
+
...options,
|
|
6124
|
+
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
6125
|
+
__binaryResponse: true,
|
|
6126
|
+
});
|
|
6127
|
+
}
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6131
|
+
class Versions extends APIResource {
|
|
6132
|
+
constructor() {
|
|
6133
|
+
super(...arguments);
|
|
6134
|
+
this.content = new Content(this._client);
|
|
6135
|
+
}
|
|
6136
|
+
/**
|
|
6137
|
+
* Create Skill Version
|
|
6138
|
+
*/
|
|
6139
|
+
create(skillID, body = {}, options) {
|
|
6140
|
+
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
6141
|
+
}
|
|
6142
|
+
/**
|
|
6143
|
+
* Get Skill Version
|
|
6144
|
+
*/
|
|
6145
|
+
retrieve(version, params, options) {
|
|
6146
|
+
const { skill_id } = params;
|
|
6147
|
+
return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
|
|
6148
|
+
}
|
|
6149
|
+
/**
|
|
6150
|
+
* List Skill Versions
|
|
6151
|
+
*/
|
|
6152
|
+
list(skillID, query = {}, options) {
|
|
6153
|
+
return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
|
|
6154
|
+
query,
|
|
6155
|
+
...options,
|
|
6156
|
+
});
|
|
6157
|
+
}
|
|
6158
|
+
/**
|
|
6159
|
+
* Delete Skill Version
|
|
6160
|
+
*/
|
|
6161
|
+
delete(version, params, options) {
|
|
6162
|
+
const { skill_id } = params;
|
|
6163
|
+
return this._client.delete(path `/skills/${skill_id}/versions/${version}`, options);
|
|
6164
|
+
}
|
|
6165
|
+
}
|
|
6166
|
+
Versions.Content = Content;
|
|
6167
|
+
|
|
6168
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6169
|
+
class Skills extends APIResource {
|
|
6170
|
+
constructor() {
|
|
6171
|
+
super(...arguments);
|
|
6172
|
+
this.content = new Content$1(this._client);
|
|
6173
|
+
this.versions = new Versions(this._client);
|
|
6174
|
+
}
|
|
6175
|
+
/**
|
|
6176
|
+
* Create Skill
|
|
6177
|
+
*/
|
|
6178
|
+
create(body = {}, options) {
|
|
6179
|
+
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
6180
|
+
}
|
|
6181
|
+
/**
|
|
6182
|
+
* Get Skill
|
|
6183
|
+
*/
|
|
6184
|
+
retrieve(skillID, options) {
|
|
6185
|
+
return this._client.get(path `/skills/${skillID}`, options);
|
|
6186
|
+
}
|
|
6187
|
+
/**
|
|
6188
|
+
* Update Skill Default Version
|
|
6189
|
+
*/
|
|
6190
|
+
update(skillID, body, options) {
|
|
6191
|
+
return this._client.post(path `/skills/${skillID}`, { body, ...options });
|
|
6192
|
+
}
|
|
6193
|
+
/**
|
|
6194
|
+
* List Skills
|
|
6195
|
+
*/
|
|
6196
|
+
list(query = {}, options) {
|
|
6197
|
+
return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
|
|
6198
|
+
}
|
|
6199
|
+
/**
|
|
6200
|
+
* Delete Skill
|
|
6201
|
+
*/
|
|
6202
|
+
delete(skillID, options) {
|
|
6203
|
+
return this._client.delete(path `/skills/${skillID}`, options);
|
|
6204
|
+
}
|
|
6205
|
+
}
|
|
6206
|
+
Skills.Content = Content$1;
|
|
6207
|
+
Skills.Versions = Versions;
|
|
6208
|
+
|
|
6096
6209
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6097
6210
|
class Parts extends APIResource {
|
|
6098
6211
|
/**
|
|
@@ -6702,6 +6815,7 @@ class OpenAI {
|
|
|
6702
6815
|
this.conversations = new Conversations(this);
|
|
6703
6816
|
this.evals = new Evals(this);
|
|
6704
6817
|
this.containers = new Containers(this);
|
|
6818
|
+
this.skills = new Skills(this);
|
|
6705
6819
|
this.videos = new Videos(this);
|
|
6706
6820
|
if (apiKey === undefined) {
|
|
6707
6821
|
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.');
|
|
@@ -6959,7 +7073,9 @@ class OpenAI {
|
|
|
6959
7073
|
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
6960
7074
|
}
|
|
6961
7075
|
getAPIList(path, Page, opts) {
|
|
6962
|
-
return this.requestAPIList(Page,
|
|
7076
|
+
return this.requestAPIList(Page, opts && 'then' in opts ?
|
|
7077
|
+
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
7078
|
+
: { method: 'get', path, ...opts });
|
|
6963
7079
|
}
|
|
6964
7080
|
requestAPIList(Page, options) {
|
|
6965
7081
|
const request = this.makeRequest(options, null, undefined);
|
|
@@ -6967,9 +7083,10 @@ class OpenAI {
|
|
|
6967
7083
|
}
|
|
6968
7084
|
async fetchWithTimeout(url, init, ms, controller) {
|
|
6969
7085
|
const { signal, method, ...options } = init || {};
|
|
7086
|
+
const abort = this._makeAbort(controller);
|
|
6970
7087
|
if (signal)
|
|
6971
|
-
signal.addEventListener('abort',
|
|
6972
|
-
const timeout = setTimeout(
|
|
7088
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
7089
|
+
const timeout = setTimeout(abort, ms);
|
|
6973
7090
|
const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
|
|
6974
7091
|
(typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
|
|
6975
7092
|
const fetchOptions = {
|
|
@@ -7100,6 +7217,11 @@ class OpenAI {
|
|
|
7100
7217
|
this.validateHeaders(headers);
|
|
7101
7218
|
return headers.values;
|
|
7102
7219
|
}
|
|
7220
|
+
_makeAbort(controller) {
|
|
7221
|
+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
7222
|
+
// would capture all request options, and cause a memory leak.
|
|
7223
|
+
return () => controller.abort();
|
|
7224
|
+
}
|
|
7103
7225
|
buildBody({ options: { body, headers: rawHeaders } }) {
|
|
7104
7226
|
if (!body) {
|
|
7105
7227
|
return { bodyHeaders: undefined, body: undefined };
|
|
@@ -7173,6 +7295,7 @@ OpenAI.Realtime = Realtime;
|
|
|
7173
7295
|
OpenAI.Conversations = Conversations;
|
|
7174
7296
|
OpenAI.Evals = Evals;
|
|
7175
7297
|
OpenAI.Containers = Containers;
|
|
7298
|
+
OpenAI.Skills = Skills;
|
|
7176
7299
|
OpenAI.Videos = Videos;
|
|
7177
7300
|
|
|
7178
7301
|
// llm-openai-config.ts
|