@discomedia/utils 1.0.58 → 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 +136 -16
- package/dist/test.js.map +1 -1
- package/package.json +3 -3
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.59",
|
|
7
7
|
"author": "Disco Media",
|
|
8
8
|
"description": "Utility functions used in Disco Media apps",
|
|
9
9
|
"always-build-npm": true,
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"test": "npm run build && node dist/test.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"dotenv": "^17.
|
|
36
|
-
"openai": "^6.
|
|
35
|
+
"dotenv": "^17.3.1",
|
|
36
|
+
"openai": "^6.22.0",
|
|
37
37
|
"p-limit": "^7.3.0",
|
|
38
38
|
"tslib": "^2.8.1",
|
|
39
39
|
"ws": "^8.19.0"
|
package/dist/test.js
CHANGED
|
@@ -837,7 +837,7 @@ const safeJSON = (text) => {
|
|
|
837
837
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
838
838
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
839
839
|
|
|
840
|
-
const VERSION = '6.
|
|
840
|
+
const VERSION = '6.22.0'; // x-release-please-version
|
|
841
841
|
|
|
842
842
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
843
843
|
const isRunningInBrowser = () => {
|
|
@@ -1970,6 +1970,11 @@ async function defaultParseResponse(client, props) {
|
|
|
1970
1970
|
const mediaType = contentType?.split(';')[0]?.trim();
|
|
1971
1971
|
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
1972
1972
|
if (isJSON) {
|
|
1973
|
+
const contentLength = response.headers.get('content-length');
|
|
1974
|
+
if (contentLength === '0') {
|
|
1975
|
+
// if there is no content we can't do anything
|
|
1976
|
+
return undefined;
|
|
1977
|
+
}
|
|
1973
1978
|
const json = await response.json();
|
|
1974
1979
|
return addRequestID(json, response);
|
|
1975
1980
|
}
|
|
@@ -5326,7 +5331,7 @@ class Completions extends APIResource {
|
|
|
5326
5331
|
}
|
|
5327
5332
|
|
|
5328
5333
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5329
|
-
class Content extends APIResource {
|
|
5334
|
+
let Content$2 = class Content extends APIResource {
|
|
5330
5335
|
/**
|
|
5331
5336
|
* Retrieve Container File Content
|
|
5332
5337
|
*/
|
|
@@ -5338,13 +5343,13 @@ class Content extends APIResource {
|
|
|
5338
5343
|
__binaryResponse: true,
|
|
5339
5344
|
});
|
|
5340
5345
|
}
|
|
5341
|
-
}
|
|
5346
|
+
};
|
|
5342
5347
|
|
|
5343
5348
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5344
5349
|
let Files$2 = class Files extends APIResource {
|
|
5345
5350
|
constructor() {
|
|
5346
5351
|
super(...arguments);
|
|
5347
|
-
this.content = new Content(this._client);
|
|
5352
|
+
this.content = new Content$2(this._client);
|
|
5348
5353
|
}
|
|
5349
5354
|
/**
|
|
5350
5355
|
* Create a Container File
|
|
@@ -5353,7 +5358,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
5353
5358
|
* a JSON request with a file ID.
|
|
5354
5359
|
*/
|
|
5355
5360
|
create(containerID, body, options) {
|
|
5356
|
-
return this._client.post(path `/containers/${containerID}/files`,
|
|
5361
|
+
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
5357
5362
|
}
|
|
5358
5363
|
/**
|
|
5359
5364
|
* Retrieve Container File
|
|
@@ -5382,7 +5387,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
5382
5387
|
});
|
|
5383
5388
|
}
|
|
5384
5389
|
};
|
|
5385
|
-
Files$2.Content = Content;
|
|
5390
|
+
Files$2.Content = Content$2;
|
|
5386
5391
|
|
|
5387
5392
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5388
5393
|
class Containers extends APIResource {
|
|
@@ -6670,6 +6675,114 @@ class Responses extends APIResource {
|
|
|
6670
6675
|
Responses.InputItems = InputItems;
|
|
6671
6676
|
Responses.InputTokens = InputTokens;
|
|
6672
6677
|
|
|
6678
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6679
|
+
let Content$1 = class Content extends APIResource {
|
|
6680
|
+
/**
|
|
6681
|
+
* Get Skill Content
|
|
6682
|
+
*/
|
|
6683
|
+
retrieve(skillID, options) {
|
|
6684
|
+
return this._client.get(path `/skills/${skillID}/content`, {
|
|
6685
|
+
...options,
|
|
6686
|
+
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
6687
|
+
__binaryResponse: true,
|
|
6688
|
+
});
|
|
6689
|
+
}
|
|
6690
|
+
};
|
|
6691
|
+
|
|
6692
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6693
|
+
class Content extends APIResource {
|
|
6694
|
+
/**
|
|
6695
|
+
* Get Skill Version Content
|
|
6696
|
+
*/
|
|
6697
|
+
retrieve(version, params, options) {
|
|
6698
|
+
const { skill_id } = params;
|
|
6699
|
+
return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
|
|
6700
|
+
...options,
|
|
6701
|
+
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
6702
|
+
__binaryResponse: true,
|
|
6703
|
+
});
|
|
6704
|
+
}
|
|
6705
|
+
}
|
|
6706
|
+
|
|
6707
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6708
|
+
class Versions extends APIResource {
|
|
6709
|
+
constructor() {
|
|
6710
|
+
super(...arguments);
|
|
6711
|
+
this.content = new Content(this._client);
|
|
6712
|
+
}
|
|
6713
|
+
/**
|
|
6714
|
+
* Create Skill Version
|
|
6715
|
+
*/
|
|
6716
|
+
create(skillID, body = {}, options) {
|
|
6717
|
+
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
6718
|
+
}
|
|
6719
|
+
/**
|
|
6720
|
+
* Get Skill Version
|
|
6721
|
+
*/
|
|
6722
|
+
retrieve(version, params, options) {
|
|
6723
|
+
const { skill_id } = params;
|
|
6724
|
+
return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
|
|
6725
|
+
}
|
|
6726
|
+
/**
|
|
6727
|
+
* List Skill Versions
|
|
6728
|
+
*/
|
|
6729
|
+
list(skillID, query = {}, options) {
|
|
6730
|
+
return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
|
|
6731
|
+
query,
|
|
6732
|
+
...options,
|
|
6733
|
+
});
|
|
6734
|
+
}
|
|
6735
|
+
/**
|
|
6736
|
+
* Delete Skill Version
|
|
6737
|
+
*/
|
|
6738
|
+
delete(version, params, options) {
|
|
6739
|
+
const { skill_id } = params;
|
|
6740
|
+
return this._client.delete(path `/skills/${skill_id}/versions/${version}`, options);
|
|
6741
|
+
}
|
|
6742
|
+
}
|
|
6743
|
+
Versions.Content = Content;
|
|
6744
|
+
|
|
6745
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6746
|
+
class Skills extends APIResource {
|
|
6747
|
+
constructor() {
|
|
6748
|
+
super(...arguments);
|
|
6749
|
+
this.content = new Content$1(this._client);
|
|
6750
|
+
this.versions = new Versions(this._client);
|
|
6751
|
+
}
|
|
6752
|
+
/**
|
|
6753
|
+
* Create Skill
|
|
6754
|
+
*/
|
|
6755
|
+
create(body = {}, options) {
|
|
6756
|
+
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
6757
|
+
}
|
|
6758
|
+
/**
|
|
6759
|
+
* Get Skill
|
|
6760
|
+
*/
|
|
6761
|
+
retrieve(skillID, options) {
|
|
6762
|
+
return this._client.get(path `/skills/${skillID}`, options);
|
|
6763
|
+
}
|
|
6764
|
+
/**
|
|
6765
|
+
* Update Skill Default Version
|
|
6766
|
+
*/
|
|
6767
|
+
update(skillID, body, options) {
|
|
6768
|
+
return this._client.post(path `/skills/${skillID}`, { body, ...options });
|
|
6769
|
+
}
|
|
6770
|
+
/**
|
|
6771
|
+
* List Skills
|
|
6772
|
+
*/
|
|
6773
|
+
list(query = {}, options) {
|
|
6774
|
+
return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
|
|
6775
|
+
}
|
|
6776
|
+
/**
|
|
6777
|
+
* Delete Skill
|
|
6778
|
+
*/
|
|
6779
|
+
delete(skillID, options) {
|
|
6780
|
+
return this._client.delete(path `/skills/${skillID}`, options);
|
|
6781
|
+
}
|
|
6782
|
+
}
|
|
6783
|
+
Skills.Content = Content$1;
|
|
6784
|
+
Skills.Versions = Versions;
|
|
6785
|
+
|
|
6673
6786
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6674
6787
|
class Parts extends APIResource {
|
|
6675
6788
|
/**
|
|
@@ -7279,6 +7392,7 @@ class OpenAI {
|
|
|
7279
7392
|
this.conversations = new Conversations(this);
|
|
7280
7393
|
this.evals = new Evals(this);
|
|
7281
7394
|
this.containers = new Containers(this);
|
|
7395
|
+
this.skills = new Skills(this);
|
|
7282
7396
|
this.videos = new Videos(this);
|
|
7283
7397
|
if (apiKey === undefined) {
|
|
7284
7398
|
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.');
|
|
@@ -7536,7 +7650,9 @@ class OpenAI {
|
|
|
7536
7650
|
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
7537
7651
|
}
|
|
7538
7652
|
getAPIList(path, Page, opts) {
|
|
7539
|
-
return this.requestAPIList(Page,
|
|
7653
|
+
return this.requestAPIList(Page, opts && 'then' in opts ?
|
|
7654
|
+
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
7655
|
+
: { method: 'get', path, ...opts });
|
|
7540
7656
|
}
|
|
7541
7657
|
requestAPIList(Page, options) {
|
|
7542
7658
|
const request = this.makeRequest(options, null, undefined);
|
|
@@ -7544,9 +7660,10 @@ class OpenAI {
|
|
|
7544
7660
|
}
|
|
7545
7661
|
async fetchWithTimeout(url, init, ms, controller) {
|
|
7546
7662
|
const { signal, method, ...options } = init || {};
|
|
7663
|
+
const abort = this._makeAbort(controller);
|
|
7547
7664
|
if (signal)
|
|
7548
|
-
signal.addEventListener('abort',
|
|
7549
|
-
const timeout = setTimeout(
|
|
7665
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
7666
|
+
const timeout = setTimeout(abort, ms);
|
|
7550
7667
|
const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
|
|
7551
7668
|
(typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
|
|
7552
7669
|
const fetchOptions = {
|
|
@@ -7677,6 +7794,11 @@ class OpenAI {
|
|
|
7677
7794
|
this.validateHeaders(headers);
|
|
7678
7795
|
return headers.values;
|
|
7679
7796
|
}
|
|
7797
|
+
_makeAbort(controller) {
|
|
7798
|
+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
7799
|
+
// would capture all request options, and cause a memory leak.
|
|
7800
|
+
return () => controller.abort();
|
|
7801
|
+
}
|
|
7680
7802
|
buildBody({ options: { body, headers: rawHeaders } }) {
|
|
7681
7803
|
if (!body) {
|
|
7682
7804
|
return { bodyHeaders: undefined, body: undefined };
|
|
@@ -7750,6 +7872,7 @@ OpenAI.Realtime = Realtime;
|
|
|
7750
7872
|
OpenAI.Conversations = Conversations;
|
|
7751
7873
|
OpenAI.Evals = Evals;
|
|
7752
7874
|
OpenAI.Containers = Containers;
|
|
7875
|
+
OpenAI.Skills = Skills;
|
|
7753
7876
|
OpenAI.Videos = Videos;
|
|
7754
7877
|
|
|
7755
7878
|
function getDefaultExportFromCjs (x) {
|
|
@@ -12736,7 +12859,7 @@ var config = {};
|
|
|
12736
12859
|
|
|
12737
12860
|
var main = {exports: {}};
|
|
12738
12861
|
|
|
12739
|
-
var version = "17.
|
|
12862
|
+
var version = "17.3.1";
|
|
12740
12863
|
var require$$4 = {
|
|
12741
12864
|
version: version};
|
|
12742
12865
|
|
|
@@ -12758,12 +12881,9 @@ function requireMain () {
|
|
|
12758
12881
|
'🔐 encrypt with Dotenvx: https://dotenvx.com',
|
|
12759
12882
|
'🔐 prevent committing .env to code: https://dotenvx.com/precommit',
|
|
12760
12883
|
'🔐 prevent building .env in docker: https://dotenvx.com/prebuild',
|
|
12761
|
-
'
|
|
12762
|
-
'
|
|
12763
|
-
'
|
|
12764
|
-
'✅ audit secrets and track compliance: https://dotenvx.com/ops',
|
|
12765
|
-
'🔄 add secrets lifecycle management: https://dotenvx.com/ops',
|
|
12766
|
-
'🔑 add access controls to secrets: https://dotenvx.com/ops',
|
|
12884
|
+
'🤖 agentic secret storage: https://dotenvx.com/as2',
|
|
12885
|
+
'⚡️ secrets for agents: https://dotenvx.com/as2',
|
|
12886
|
+
'🛡️ auth for agents: https://vestauth.com',
|
|
12767
12887
|
'🛠️ run anywhere with `dotenvx run -- yourcommand`',
|
|
12768
12888
|
'⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }',
|
|
12769
12889
|
'⚙️ enable debug logging with { debug: true }',
|