@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.cjs CHANGED
@@ -2541,7 +2541,7 @@ const safeJSON = (text) => {
2541
2541
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2542
2542
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2543
2543
 
2544
- const VERSION = '6.17.0'; // x-release-please-version
2544
+ const VERSION = '6.22.0'; // x-release-please-version
2545
2545
 
2546
2546
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2547
2547
  const isRunningInBrowser = () => {
@@ -3674,6 +3674,11 @@ async function defaultParseResponse(client, props) {
3674
3674
  const mediaType = contentType?.split(';')[0]?.trim();
3675
3675
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
3676
3676
  if (isJSON) {
3677
+ const contentLength = response.headers.get('content-length');
3678
+ if (contentLength === '0') {
3679
+ // if there is no content we can't do anything
3680
+ return undefined;
3681
+ }
3677
3682
  const json = await response.json();
3678
3683
  return addRequestID(json, response);
3679
3684
  }
@@ -7030,7 +7035,7 @@ class Completions extends APIResource {
7030
7035
  }
7031
7036
 
7032
7037
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7033
- class Content extends APIResource {
7038
+ let Content$2 = class Content extends APIResource {
7034
7039
  /**
7035
7040
  * Retrieve Container File Content
7036
7041
  */
@@ -7042,13 +7047,13 @@ class Content extends APIResource {
7042
7047
  __binaryResponse: true,
7043
7048
  });
7044
7049
  }
7045
- }
7050
+ };
7046
7051
 
7047
7052
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7048
7053
  let Files$2 = class Files extends APIResource {
7049
7054
  constructor() {
7050
7055
  super(...arguments);
7051
- this.content = new Content(this._client);
7056
+ this.content = new Content$2(this._client);
7052
7057
  }
7053
7058
  /**
7054
7059
  * Create a Container File
@@ -7057,7 +7062,7 @@ let Files$2 = class Files extends APIResource {
7057
7062
  * a JSON request with a file ID.
7058
7063
  */
7059
7064
  create(containerID, body, options) {
7060
- return this._client.post(path `/containers/${containerID}/files`, multipartFormRequestOptions({ body, ...options }, this._client));
7065
+ return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
7061
7066
  }
7062
7067
  /**
7063
7068
  * Retrieve Container File
@@ -7086,7 +7091,7 @@ let Files$2 = class Files extends APIResource {
7086
7091
  });
7087
7092
  }
7088
7093
  };
7089
- Files$2.Content = Content;
7094
+ Files$2.Content = Content$2;
7090
7095
 
7091
7096
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7092
7097
  class Containers extends APIResource {
@@ -8374,6 +8379,114 @@ class Responses extends APIResource {
8374
8379
  Responses.InputItems = InputItems;
8375
8380
  Responses.InputTokens = InputTokens;
8376
8381
 
8382
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8383
+ let Content$1 = class Content extends APIResource {
8384
+ /**
8385
+ * Get Skill Content
8386
+ */
8387
+ retrieve(skillID, options) {
8388
+ return this._client.get(path `/skills/${skillID}/content`, {
8389
+ ...options,
8390
+ headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
8391
+ __binaryResponse: true,
8392
+ });
8393
+ }
8394
+ };
8395
+
8396
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8397
+ class Content extends APIResource {
8398
+ /**
8399
+ * Get Skill Version Content
8400
+ */
8401
+ retrieve(version, params, options) {
8402
+ const { skill_id } = params;
8403
+ return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
8404
+ ...options,
8405
+ headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
8406
+ __binaryResponse: true,
8407
+ });
8408
+ }
8409
+ }
8410
+
8411
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8412
+ class Versions extends APIResource {
8413
+ constructor() {
8414
+ super(...arguments);
8415
+ this.content = new Content(this._client);
8416
+ }
8417
+ /**
8418
+ * Create Skill Version
8419
+ */
8420
+ create(skillID, body = {}, options) {
8421
+ return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
8422
+ }
8423
+ /**
8424
+ * Get Skill Version
8425
+ */
8426
+ retrieve(version, params, options) {
8427
+ const { skill_id } = params;
8428
+ return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
8429
+ }
8430
+ /**
8431
+ * List Skill Versions
8432
+ */
8433
+ list(skillID, query = {}, options) {
8434
+ return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
8435
+ query,
8436
+ ...options,
8437
+ });
8438
+ }
8439
+ /**
8440
+ * Delete Skill Version
8441
+ */
8442
+ delete(version, params, options) {
8443
+ const { skill_id } = params;
8444
+ return this._client.delete(path `/skills/${skill_id}/versions/${version}`, options);
8445
+ }
8446
+ }
8447
+ Versions.Content = Content;
8448
+
8449
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8450
+ class Skills extends APIResource {
8451
+ constructor() {
8452
+ super(...arguments);
8453
+ this.content = new Content$1(this._client);
8454
+ this.versions = new Versions(this._client);
8455
+ }
8456
+ /**
8457
+ * Create Skill
8458
+ */
8459
+ create(body = {}, options) {
8460
+ return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
8461
+ }
8462
+ /**
8463
+ * Get Skill
8464
+ */
8465
+ retrieve(skillID, options) {
8466
+ return this._client.get(path `/skills/${skillID}`, options);
8467
+ }
8468
+ /**
8469
+ * Update Skill Default Version
8470
+ */
8471
+ update(skillID, body, options) {
8472
+ return this._client.post(path `/skills/${skillID}`, { body, ...options });
8473
+ }
8474
+ /**
8475
+ * List Skills
8476
+ */
8477
+ list(query = {}, options) {
8478
+ return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
8479
+ }
8480
+ /**
8481
+ * Delete Skill
8482
+ */
8483
+ delete(skillID, options) {
8484
+ return this._client.delete(path `/skills/${skillID}`, options);
8485
+ }
8486
+ }
8487
+ Skills.Content = Content$1;
8488
+ Skills.Versions = Versions;
8489
+
8377
8490
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8378
8491
  class Parts extends APIResource {
8379
8492
  /**
@@ -8983,6 +9096,7 @@ class OpenAI {
8983
9096
  this.conversations = new Conversations(this);
8984
9097
  this.evals = new Evals(this);
8985
9098
  this.containers = new Containers(this);
9099
+ this.skills = new Skills(this);
8986
9100
  this.videos = new Videos(this);
8987
9101
  if (apiKey === undefined) {
8988
9102
  throw new OpenAIError('Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.');
@@ -9240,7 +9354,9 @@ class OpenAI {
9240
9354
  return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
9241
9355
  }
9242
9356
  getAPIList(path, Page, opts) {
9243
- return this.requestAPIList(Page, { method: 'get', path, ...opts });
9357
+ return this.requestAPIList(Page, opts && 'then' in opts ?
9358
+ opts.then((opts) => ({ method: 'get', path, ...opts }))
9359
+ : { method: 'get', path, ...opts });
9244
9360
  }
9245
9361
  requestAPIList(Page, options) {
9246
9362
  const request = this.makeRequest(options, null, undefined);
@@ -9248,9 +9364,10 @@ class OpenAI {
9248
9364
  }
9249
9365
  async fetchWithTimeout(url, init, ms, controller) {
9250
9366
  const { signal, method, ...options } = init || {};
9367
+ const abort = this._makeAbort(controller);
9251
9368
  if (signal)
9252
- signal.addEventListener('abort', () => controller.abort());
9253
- const timeout = setTimeout(() => controller.abort(), ms);
9369
+ signal.addEventListener('abort', abort, { once: true });
9370
+ const timeout = setTimeout(abort, ms);
9254
9371
  const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
9255
9372
  (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
9256
9373
  const fetchOptions = {
@@ -9381,6 +9498,11 @@ class OpenAI {
9381
9498
  this.validateHeaders(headers);
9382
9499
  return headers.values;
9383
9500
  }
9501
+ _makeAbort(controller) {
9502
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
9503
+ // would capture all request options, and cause a memory leak.
9504
+ return () => controller.abort();
9505
+ }
9384
9506
  buildBody({ options: { body, headers: rawHeaders } }) {
9385
9507
  if (!body) {
9386
9508
  return { bodyHeaders: undefined, body: undefined };
@@ -9454,6 +9576,7 @@ OpenAI.Realtime = Realtime;
9454
9576
  OpenAI.Conversations = Conversations;
9455
9577
  OpenAI.Evals = Evals;
9456
9578
  OpenAI.Containers = Containers;
9579
+ OpenAI.Skills = Skills;
9457
9580
  OpenAI.Videos = Videos;
9458
9581
 
9459
9582
  // llm-openai-config.ts
@@ -16344,7 +16467,7 @@ var config = {};
16344
16467
 
16345
16468
  var main = {exports: {}};
16346
16469
 
16347
- var version = "17.2.3";
16470
+ var version = "17.3.1";
16348
16471
  var require$$4 = {
16349
16472
  version: version};
16350
16473
 
@@ -16366,12 +16489,9 @@ function requireMain () {
16366
16489
  '🔐 encrypt with Dotenvx: https://dotenvx.com',
16367
16490
  '🔐 prevent committing .env to code: https://dotenvx.com/precommit',
16368
16491
  '🔐 prevent building .env in docker: https://dotenvx.com/prebuild',
16369
- '📡 add observability to secrets: https://dotenvx.com/ops',
16370
- '👥 sync secrets across teammates & machines: https://dotenvx.com/ops',
16371
- '🗂️ backup and recover secrets: https://dotenvx.com/ops',
16372
- '✅ audit secrets and track compliance: https://dotenvx.com/ops',
16373
- '🔄 add secrets lifecycle management: https://dotenvx.com/ops',
16374
- '🔑 add access controls to secrets: https://dotenvx.com/ops',
16492
+ '🤖 agentic secret storage: https://dotenvx.com/as2',
16493
+ '⚡️ secrets for agents: https://dotenvx.com/as2',
16494
+ '🛡️ auth for agents: https://vestauth.com',
16375
16495
  '🛠️ run anywhere with `dotenvx run -- yourcommand`',
16376
16496
  '⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }',
16377
16497
  '⚙️ enable debug logging with { debug: true }',